dsh-model-think-level 2.3.6 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/lib/camouflage-store.d.ts +55 -0
- package/lib/camouflage.d.ts +91 -0
- package/lib/client/AdvancedPane.d.ts +38 -0
- package/lib/client/CamouflageEditor.d.ts +100 -0
- package/lib/client/HeadersEditor.d.ts +21 -1
- package/lib/client/injection/model-order-drag.d.ts +3 -1
- package/lib/client/locales.d.ts +8 -0
- package/lib/client/styles.d.ts +1 -1
- package/lib/client.js +93 -39
- package/lib/client.js.map +4 -4
- package/lib/constants.d.ts +14 -0
- package/lib/headers-core.d.ts +17 -2
- package/lib/index.js +336 -63
- package/lib/index.js.map +4 -4
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -4,7 +4,7 @@ window.__ModuleLoader__.load({
|
|
|
4
4
|
var module = { exports: {} };
|
|
5
5
|
var exports = module.exports;
|
|
6
6
|
|
|
7
|
-
"use strict";var $r=Object.defineProperty;var km=Object.getOwnPropertyDescriptor;var Em=Object.getOwnPropertyNames;var Tm=Object.prototype.hasOwnProperty;var Sm=(e,t,n)=>t in e?$r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Mm=(e,t)=>{for(var n in t)$r(e,n,{get:t[n],enumerable:!0})},Lm=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Em(t))!Tm.call(e,o)&&o!==n&&$r(e,o,{get:()=>t[o],enumerable:!(r=km(t,o))||r.enumerable});return e};var Am=e=>Lm($r({},"__esModule",{value:!0}),e);var Oe=(e,t,n)=>Sm(e,typeof t!="symbol"?t+"":t,n);var Zw={};Mm(Zw,{EffortEditor:()=>vo,REFRESH_MIN_INTERVAL_MS:()=>wm,apply:()=>Qw,baselineModelsOf:()=>Fd,compatOf:()=>co,createEditorApi:()=>po,defaultEffortOf:()=>fo,describeNamespace:()=>le,effortsOf:()=>so,findModelMenu:()=>wa,findModelTrigger:()=>xa,imageGenOf:()=>sa,inject:()=>Xw,inputOf:()=>lo,invalidateProbeCache:()=>da,name:()=>Jw,nameOf:()=>uo,providerHeadersOf:()=>la,providersOf:()=>Pe,routeIsDeclared:()=>et,userProvidersOf:()=>Vt,writeModelRows:()=>mr,writeProviderHeaders:()=>gr});module.exports=Am(Zw);var vm=require("react");function Js(e,t){let n=!1,r=0,o=!1,i;return{schedule:()=>{if(o||n)return;n=!0;let a=Math.max(0,t-(Date.now()-r));i=setTimeout(()=>{i=void 0,n=!1,r=Date.now(),o||e()},a)},dispose:()=>{o=!0,i!==void 0&&clearTimeout(i),i=void 0,n=!1}}}var Te="dsh-model-think-level",Xs="/dsh-model-think-level/raw-models";var Vr="/dsh-model-think-level/provider-key",Yr="/dsh-model-think-level/key-index",Qs="/dsh-model-think-level/balance",Zs="/dsh-model-think-level/autofill-config",ed="/dsh-model-think-level/headers-config",Ri="/dsh-model-think-level/fingerprint",Ci="/dsh-model-think-level/ui-order";var Re="llm-pi-ai",Qe="reasoningEffortsUnset",mt="inputUnset",Ze="inputImageGen",gn="reasoningEffortsAutofilled",hn="defaultEffort",Hi="/dsh-model-think-level/image-config";var Ni=Te;var or=require("react");function td(e){let{locale:t}=e,n=(0,or.useCallback)(o=>t.subscribe(o),[t]),r=(0,or.useCallback)(()=>t.getSnapshot().revision??0,[t]);return(0,or.useSyncExternalStore)(n,r),e.children()}var nd={reasoningEffort:"Reasoning effort",thinkingMode:"Thinking",thinkingModeOff:"Off \u2014 this model is declared as not reasoning.",levelsLabel:"Declared levels",levelsHint:"Click to declare; clear every level to declare nothing \u2014 requests follow the provider default.",stateDeclared:"{count} declared \xB7 default {default}",stateUndeclared:"Nothing declared \u2014 requests follow the provider default.",modalityText:"Text",autoAdapt:"Auto-adapt",autoAdaptAll:"Auto-detect thinking levels",autoAdaptWorking:"Detecting\u2026",autoAdaptDone:"Adapted {count} \xB7 save to write",autoAdaptEmpty:"All already configured",autoAdaptUnsuggested:"No suggestion available",autoAdaptBlocked:"No models to adapt yet",autoAdaptFailed:"Detection failed: {message}",autoAdaptDoneHint:"Held for {count} model(s): they land when this card is saved.",autoAdaptEmptyHint:"Every model of this provider already declares its thinking levels.",autoAdaptUnsuggestedHint:"The models that still need a declaration have no knowledge-base match \u2014 adapt them one by one.",autoAdaptBlockedHint:"Nothing to adapt yet: the card has no models, is not saved, or the settings document is read-only.",apply:"Apply",reset:"Reset",referenceTitle:"Reference capacities",contextWindowLabel:"Context window",maxTokensLabel:"Max output",capacityBlank:"Catalogue value",capacityUnitsHint:"Digits or K/M/B/T shorthand, e.g. 1,048,576 or 1M.",capacityRule:"Max output above the window is refused upstream; this check is local only.",tokensUnit:"tokens",inputModality:"Supported modalities",modalityImage:"Image",modalityImageGen:"Image generation",modalityImageGenHint:"Marked as an image generator \u2014 pick it in the composer, type a prompt, and the send goes straight to the images API.",modalityInherit:"Not declared \u2014 the provider default applies (usually text-only).",modalityDeclared:"Declared \u2014 clearing Image goes back to text only.",capacityInherit:"Empty keeps the catalogue value.",clearDeclaration:"Clear declaration",noSuggestion:"No suggestion is available for this model.",writeError:"Failed: {message}",renderFailed:"Reasoning-effort editor failed to render",wirePlaceholder:"Wire value",wireValue:"value",wireShow:"Edit wire values",wireHide:"Hide wire values",wireHint:"Empty keeps the level's conventional spelling; a non-empty off value is what gets sent when thinking is closed.",reasoningDisabled:"No reasoning-effort control declared for this model (false) \u2014 do not arm thinking levels.",bareHint:"Clearing every level removes the declaration \u2014 requests go out bare (provider default), which some relays require.",defaultRiskDisabled:"No off level: Default and provider tests send thinking: disabled, which this model rejects (e.g. 1210).",defaultRiskQwen:"No off level: Default sends enable_thinking: false \u2014 only fails where the upstream requires thinking on.",stagedHint:"Not saved yet. Staged settings are applied automatically once the model is saved.",level_off:"off",level_minimal:"minimal",level_low:"low",level_medium:"medium",level_high:"high",level_xhigh:"xhigh",level_max:"max",sliderToggleTitle:"Model and reasoning-effort rows",sliderToggleDescription:"Show the model row and the reasoning-level chips in the model menu; the levels follow the current model.",sliderToggleAria:"Enable the model and reasoning-effort rows",settingOn:"On",settingOff:"Off",sliderNoLevels:"The current model exposes no reasoning-effort levels.",triggerFallback:"Select model",effortDefault:"Default",modelRowLabel:"Model",effortRowLabel:"Reasoning level",tagVision:"Image input",tagThinking:"Sends thinking levels",tagImageGen:"Image generation model",sliderNoCurrent:"No model selected.",sliderCommitSlow:"The switch is taking too long \u2014 try again.",defaultEffortLabel:"Default effort",defaultEffortUnset:"Follow memory",defaultEffortHint:"The level new sessions start at; a level you pick by hand always wins. Empty follows memory.",followMemory:"Follow memory",clearDefaultEffort:"Clear pick",modelSearchPlaceholder:"Search models\u2026",modelSearchNoMatches:"No matching models",modelSearchClear:"Clear search",modelSearchFailed:"Model search failed to render",editorTabsLabel:"Editor sections",editorTabProvider:"Provider",editorTabModels:"Models",editorTabAdvanced:"Advanced",editorTabFingerprint:"Fingerprint",fpTitle:"Model fingerprint",fpIntro:"Only GPT and Claude models can be probed \u2014 the fingerprint library covers those two families, and models outside it never appear here.",fpCount:"{count} probeable",fpSummary:"Identified {identified} \xB7 doubtful {doubtful} \xB7 failed {failed}",fpSummaryNone:"Nothing checked yet.",fpRunning:"Checking \xB7 {done} / {total} (keeps going if you leave)",fpDetectAll:"Check all",fpDetect:"Check",fpRetest:"Re-check",fpRetry:"Retry",fpCost:"{count} prompts \xB7 about {seconds}s",fpCostMinutes:"{count} prompts \xB7 about {minutes} min",fpCostUnknown:"{count} prompts",fpForget:"Forget",fpStateUnchecked:"Not checked",fpStateRunning:"Checking \xB7 {done}/{total}",fpStateIdentified:"{model} \xB7 {probability}",fpStateDoubtful:"Doubtful \xB7 {probability}",fpStateFailed:"Check failed",fpQueued:"Queued \xB7 #{position}",fpEvidence:"{used} / {total} prompts",fpSimilarity:"Similarity",fpDetailShow:"Show result",fpDetailHide:"Hide result",fpFamily:"Family",fpChallengeCounted:"Q{index} {numbers} \xB7 counted",fpChallengeRejected:"Q{index} {parsed}/{numbers} \xB7 not counted",fpChallengeSkipped:"Q{index} {numbers} \xB7 early stop",fpChallengeTitle:"How each of the three prompts settled. The number is how many integers the prompt asked for; a slash means it asked for the right-hand count and answered only the left. A prompt only counts when it returns at least max(80, 55% of what it asked).",fpCandidates:"Closest candidates",fpClosedSet:"Closed-set result: a model outside the library is still attributed to the nearest listed one. Read it as a comparison, not a certificate.",fpCheckedAt:"Checked {time}",fpTiming:"Timing: first token {first}s \xB7 total {total}s \xB7 ~{rate} chars/s",fpLoadFailed:"Could not read the stored verdicts: {error}",fpRunFailed:"Check failed: {error}",keyRevealShow:"Show key",keyRevealHide:"Hide key",keyRevealFailed:"Stored key unavailable",keysLoading:"Loading keys\u2026",keysAdd:"Add another key",keysAddConfirm:"Add",keysEnable:"Enable {name}",keysDisable:"Disable {name}",keysMissing:"Not stored",keysEdit:"Edit",keysRemove:"Delete",keysConfirmRemove:"Confirm delete",keysCancel:"Cancel",keysSave:"Save",keysAlias:"Label",keysAliasPlaceholder:"Name (optional), e.g. Team",keysValue:"Key",keysValuePlaceholder:"Paste the API key",keysNewValuePlaceholder:"Paste the new API key",keysAddIllegal:"A key is printable ASCII without spaces.",keysAdded:"Key stored.",keysRenamed:"Label saved.",keysReplaced:"Key replaced.",keysRemoved:"Key removed.",keysCopy:"Copy {name}",keysCopied:"Key copied.",keysCopyFailed:"Could not copy the key.",keysScope:"Models served by {name}",keysModels:"Models",keysScopeAll:"All models",keysScopeNone:"No models found",keysScopeCount:"{count} models",keysScopeSaved:"Model scope saved.",keysScopeHint:"Only the ticked models use this key; the rest go to the provider's other keys.",keysScopeAutoHint:"This scope was written by the auto-probe from the models this key actually lists; every sweep re-checks it.",keysProbe:"Auto-probe",keysProbing:"Probing\u2026",keysProbeHint:`Ask every key what it actually serves, then keep each key to the models it shares with this provider's list. A key that serves every added model keeps "All models"; a key that serves none of them is switched off.`,keysProbeSingle:"One key has nothing to divide \u2014 add a second key first.",keysProbeDone:"Probe finished \u2014 scopes checked against what each key serves.",keysScopeEmpty:"This provider has no models yet. Add models first, then pick them here.",keysProtocolLabel:"Protocol for {name}",keysProtocolCreate:"Protocol",keysProtocolCreateHint:"The wire this key signs with; the addresses the provider has configured decide which families are offered.",keysProtocolDefault:"Auto (per model)",keysProtocolDefaultHint:"Picks each model\u2019s own wire: claude models use the Anthropic address, the rest the provider\u2019s protocol (where that address is configured).",keysProtocolAnthropic:"Anthropic",keysProtocolAnthropicHint:"Anthropic API \xB7 Claude models",keysProtocolOpenAI:"Chat Completions",keysProtocolOpenAIHint:"OpenAI API \xB7 GPT models, most agents",keysProtocolResponses:"Responses",keysProtocolResponsesHint:"OpenAI API \xB7 Codex",keysProtocolShortChat:"Chat",keysProtocolShortResponses:"Responses",keysProtocolShortAnthropic:"Anthropic",keysProtocolSaved:"Protocol saved.",keysEndpointOpenAI:"OpenAI",keysEndpointAnthropic:"Anthropic",keysEndpointBalance:"Balance",keysEndpointBalanceHint:"Read-only endpoint queried for this provider\u2019s balance; the first API key is sent along.",keysMoreEndpoints:"More endpoints",keysEndpointsCount:"{count} more",keysEndpointInvalid:"The address must start with http:// or https://",keysUnreachable:"The plugin\u2019s key route did not answer.",keysPanelFailed:"Key manager failed to render",keysDraftHint:"Held by this page and stored when the provider is created \u2014 a reload discards them, exactly like the card\u2019s own fields.",keysLastEnabledOff:"The last enabled key cannot be switched off.",headersTitle:"Request headers",headersHint:"Sent on every request of this route.",headersEmpty:"No extra request headers are configured.",headersAdd:"Add header",headersName:"Name",headersNamePlaceholder:"e.g. x-company",headersValue:"Value",headersEdit:"Edit",headersSave:"Save",headersCancel:"Cancel",headersClear:"Clear all",headersRemove:"Remove header",headersSaved:"Saved.",headersCleared:"Cleared \u2014 this route sends no extra request headers.",headersReadOnly:"The settings document is not writable.",headersConflictOrigin:"Routes sharing one endpoint declare different request-header values: when the model in a request body does not identify exactly one of them, that request falls back to the first route.",headersConflictPatched:"The installed dsh-llm-pi-ai already carries a request-header patch: enter values in the headers above and this plugin need not take the request layer over.",headersConflictSiblings:"A plugin rewriting the same layer is installed: {names}. Only one user-agent rewrite should be active at a time, or the last writer on the wire wins.",headersError:"Save failed: {error}",headersNoRoute:"This route is no longer in the settings document \u2014 save the official card once first.",providerReorderAria:"Reorder {provider}",providerReorderHint:"Drag to set the provider order \u2014 the model switcher follows it.",providerToggleAria:"Enable {provider}",providerToggleHint:"A disabled provider is not listed by the model switcher.",providerBalanceLabel:"Balance",providerBalanceHint:"Fetched from this provider\u2019s balance endpoint.",providerBalanceRefresh:"Refresh balance",providerBalanceUnavailable:"Balance \u2014",providerDisabledGroupShow:"Show {count} switched-off provider(s)",providerDisabledGroupHide:"Hide {count} switched-off provider(s)",providerDisabledGroupHint:"A switched-off provider keeps its configuration and folds away here \u2014 unfold it to switch it back on.",providerRemoveDisabled:"Delete",providerRemoveLocked:"A built-in provider cannot be deleted.",modelReorderAria:"Reorder {model}",modelReorderHint:"Drag to set the order of this provider\u2019s models \u2014 the model switcher follows it.",configButton:"Advanced settings",configButtonHint:"Open advanced settings",configPaneTitle:"Advanced settings",configPaneClose:"Close",configPaneFailed:"Config pane failed to render",imagegenSectionTitle:"Image generation",imagegenEnable:"Enable image generation",cardStateOn:"On",cardStateOff:"Off",imagegenEnabledHint:"Allow the image-generation tool. Expand to configure the model and image parameters.",imagegenDisabledHint:"The image-generation tool is off. Your model and image settings are kept.",imagegenExpand:"Configure image generation",imagegenCollapse:"Collapse image-generation settings",imagegenSaving:"Saving\u2026",imagegenRefreshFailed:"Saved, but could not refresh the configuration: {error}",imagegenLoading:"Loading\u2026",imagegenLoadFailed:"Could not read the image config",imagegenDefaultsLabel:"Defaults",imagegenDefaultModelLabel:"Default model",imagegenDefaultModelNone:"Not set",imagegenSizeLabel:"Size",imagegenQualityLabel:"Quality",imagegenCountLabel:"Count",imagegenTimeoutLabel:"Timeout",imagegenTimeoutMinutes:"{minutes} min",imagegenTimeoutHint:"The per-request cap; every retry of the parameter fallback chain gets this budget too.",imagegenCardRunning:"Generating image\u2026",imagegenToolMissing:"The built-in image tool is not registered, so a model cannot call it.",imagegenToolMissingWhy:"Host said: {reason}",autoContinueSectionTitle:"Auto-continue",autoContinueExpand:"Configure auto-continue",autoContinueCollapse:"Collapse auto-continue settings",autoContinueTitle:"Continue interrupted turns",autoContinueDescription:"When a turn is cut off by a disconnect, a timeout or the output limit, reply \u201CContinue\u201D automatically. Clean finishes, your own stops and auth or quota errors are left alone.",autoContinueHint:"Wait {seconds}s after a failure \xB7 Up to {count} retries",autoContinueWaitLabel:"Wait after failure",autoContinueRetriesLabel:"Retry limit",autoContinueSecondsUnit:"s",autoContinueRetriesUnit:"retries",autoContinueConfigHint:"Whole numbers: {waitMin}\u2013{waitMax} seconds, {retriesMin}\u2013{retriesMax} retries. Saved when you leave the field or press Enter. After every failure, wait this long before sending \u201CContinue\u201D; a longer provider-requested delay wins.",autoContinueAria:"Enable auto-continue",autoContinueMessage:"Continue"},rd={reasoningEffort:"\u601D\u8003\u5F3A\u5EA6",thinkingMode:"\u601D\u8003",thinkingModeOff:"\u5DF2\u5173\u95ED\u2014\u2014\u8BE5\u6A21\u578B\u58F0\u660E\u4E3A\u4E0D\u601D\u8003\u3002",levelsLabel:"\u652F\u6301\u6863\u4F4D",levelsHint:"\u70B9\u9009\u5373\u58F0\u660E\uFF1B\u5168\u90E8\u53D6\u6D88\u5219\u4E0D\u58F0\u660E\uFF0C\u8BF7\u6C42\u6309\u4F9B\u5E94\u5546\u9ED8\u8BA4\u53D1\u9001\u3002",stateDeclared:"\u5DF2\u58F0\u660E {count} \u6863 \xB7 \u9ED8\u8BA4 {default}",stateUndeclared:"\u672A\u58F0\u660E\u2014\u2014\u8BF7\u6C42\u6309\u4F9B\u5E94\u5546\u9ED8\u8BA4\u53D1\u9001\u3002",modalityText:"\u6587\u672C",autoAdapt:"\u81EA\u52A8\u9002\u914D",autoAdaptAll:"\u81EA\u52A8\u83B7\u53D6\u601D\u8003\u7B49\u7EA7",autoAdaptWorking:"\u83B7\u53D6\u4E2D\u2026",autoAdaptDone:"\u5DF2\u9002\u914D {count} \u4E2A\xB7\u4FDD\u5B58\u540E\u5199\u5165",autoAdaptEmpty:"\u5DF2\u5168\u90E8\u914D\u7F6E",autoAdaptUnsuggested:"\u6CA1\u6709\u53EF\u7528\u5EFA\u8BAE",autoAdaptBlocked:"\u6682\u65E0\u53EF\u9002\u914D\u6A21\u578B",autoAdaptFailed:"\u83B7\u53D6\u5931\u8D25\uFF1A{message}",autoAdaptDoneHint:"\u5DF2\u6682\u5B58 {count} \u4E2A\u6A21\u578B\u7684\u9002\u914D\u7ED3\u679C\uFF1A\u70B9\u8BE5\u5361\u7247\u7684\u300C\u4FDD\u5B58\u300D\u540E\u5199\u5165\u3002",autoAdaptEmptyHint:"\u8BE5\u4F9B\u5E94\u5546\u4E0B\u6240\u6709\u6A21\u578B\u90FD\u5DF2\u58F0\u660E\u601D\u8003\u7B49\u7EA7\u3002",autoAdaptUnsuggestedHint:"\u4ECD\u9700\u58F0\u660E\u7684\u6A21\u578B\u6CA1\u6709\u77E5\u8BC6\u5E93\u5339\u914D\u2014\u2014\u8BF7\u9010\u4E2A\u6253\u5F00\u6A21\u578B\u884C\u624B\u52A8\u9002\u914D\u3002",autoAdaptBlockedHint:"\u6682\u65E0\u53EF\u9002\u914D\u5185\u5BB9\uFF1A\u8BE5\u5361\u7247\u8FD8\u6CA1\u6709\u6A21\u578B\u3001\u5C1A\u672A\u4FDD\u5B58\uFF0C\u6216\u5F53\u524D\u8BBE\u7F6E\u6587\u6863\u4E0D\u53EF\u5199\u5165\u3002",apply:"\u5E94\u7528",reset:"\u653E\u5F03\u4FEE\u6539",referenceTitle:"\u53C2\u8003\u5BB9\u91CF",contextWindowLabel:"\u4E0A\u4E0B\u6587\u7A97\u53E3",maxTokensLabel:"\u6700\u5927\u8F93\u51FA",capacityBlank:"\u6CBF\u7528\u76EE\u5F55\u503C",capacityUnitsHint:"\u53EF\u586B\u6570\u5B57\u6216 K/M/B/T \u7B80\u5199\uFF0C\u4F8B\u5982 1,048,576 \u6216 1M\u3002",capacityRule:"\u6700\u5927\u8F93\u51FA\u8D85\u8FC7\u7A97\u53E3\u4F1A\u88AB\u4E0A\u6E38\u62D2\u7EDD\uFF0C\u8FD9\u91CC\u53EA\u505A\u672C\u5730\u6821\u9A8C\u3002",tokensUnit:"tokens",inputModality:"\u652F\u6301\u6A21\u6001",modalityImage:"\u56FE\u7247",modalityImageGen:"\u751F\u56FE",modalityImageGenHint:"\u5DF2\u6807\u8BB0\u4E3A\u751F\u56FE\u6A21\u578B\u2014\u2014\u5728\u5BF9\u8BDD\u6846\u9009\u4E2D\u5B83\u540E\u76F4\u63A5\u8F93\u5165\u63D0\u793A\u8BCD\u53D1\u9001\uFF0C\u5373\u8D70\u56FE\u7247\u63A5\u53E3\u751F\u6210\u56FE\u7247\u3002",modalityInherit:"\u672A\u58F0\u660E\u2014\u2014\u7EE7\u627F\u63D0\u4F9B\u65B9\u9ED8\u8BA4\uFF08\u901A\u5E38\u4EC5\u6587\u672C\uFF09\u3002",modalityDeclared:"\u5DF2\u58F0\u660E\u2014\u2014\u53D6\u6D88\u300C\u56FE\u7247\u300D\u5373\u56DE\u5230\u4EC5\u6587\u672C\u3002",capacityInherit:"\u7559\u7A7A\uFF1D\u6CBF\u7528\u6A21\u578B\u76EE\u5F55\u91CC\u7684\u503C\u3002",clearDeclaration:"\u6E05\u9664\u58F0\u660E",noSuggestion:"\u6CA1\u6709\u9002\u7528\u4E8E\u8BE5\u6A21\u578B\u7684\u5EFA\u8BAE\u3002",writeError:"\u5199\u5165\u5931\u8D25\uFF1A{message}",renderFailed:"\u601D\u8003\u5F3A\u5EA6\u7F16\u8F91\u5668\u6E32\u67D3\u5931\u8D25",wirePlaceholder:"\u7EBF\u4E0A\u53D6\u503C",wireValue:"\u53D6\u503C",wireShow:"\u7F16\u8F91\u7EBF\u4E0A\u53D6\u503C",wireHide:"\u6536\u8D77\u7EBF\u4E0A\u53D6\u503C",wireHint:"\u7559\u7A7A\uFF1D\u6CBF\u7528\u8BE5\u6863\u4F4D\u7684\u7EA6\u5B9A\u62FC\u5199\uFF1Boff \u6863\u586B\u4E86\u975E\u7A7A\u503C\uFF0C\u5C31\u4F1A\u5728\u5173\u95ED\u601D\u8003\u65F6\u53D1\u9001\u8FD9\u4E00\u6BB5\u3002",reasoningDisabled:"\u8BE5\u6A21\u578B\u58F0\u660E\u4E3A\u65E0 reasoning-effort \u63A7\u5236\uFF08false\uFF09\u2014\u2014\u8BF7\u52FF\u52FE\u9009\u601D\u8003\u6863\u3002",bareHint:"\u5168\u90E8\u53D6\u6D88\u5E76\u4FDD\u5B58\u5C06\u6E05\u9664\u58F0\u660E\u2014\u2014\u8BF7\u6C42\u4EE5\u88F8\u683C\u5F0F\u53D1\u51FA\uFF08\u8D70\u63D0\u4F9B\u65B9\u9ED8\u8BA4\uFF09\uFF0C\u90E8\u5206\u4E2D\u8F6C\u7AD9\u9700\u8981\u8FD9\u6837\u3002",defaultRiskDisabled:"\u65E0 off \u6863\uFF1ADefault \u4E0E\u63D0\u4F9B\u5546\u6D4B\u8BD5\u4F1A\u53D1\u9001 thinking: disabled\uFF0C\u8BE5\u6A21\u578B\u4F1A\u62A5\u9519\uFF08\u5982 1210\uFF09\u3002",defaultRiskQwen:"\u65E0 off \u6863\uFF1ADefault \u4F1A\u53D1\u9001 enable_thinking: false\u2014\u2014\u4EC5\u5728\u4E0A\u6E38\u8981\u6C42\u5F00\u542F\u601D\u8003\u65F6\u624D\u4F1A\u5931\u8D25\u3002",stagedHint:"\u5C1A\u672A\u4FDD\u5B58\u3002\u6682\u5B58\u7684\u914D\u7F6E\u5C06\u5728\u8BE5\u6A21\u578B\u4FDD\u5B58\u540E\u81EA\u52A8\u5E94\u7528\u3002",level_off:"off",level_minimal:"minimal",level_low:"low",level_medium:"medium",level_high:"high",level_xhigh:"xhigh",level_max:"max",sliderToggleTitle:"\u6A21\u578B\u4E0E\u601D\u8003\u7B49\u7EA7\u884C",sliderToggleDescription:"\u5728\u6A21\u578B\u83DC\u5355\u4E2D\u663E\u793A\u6A21\u578B\u884C\u4E0E\u601D\u8003\u7B49\u7EA7\u6807\u7B7E\uFF0C\u6863\u4F4D\u968F\u5F53\u524D\u6A21\u578B\u81EA\u52A8\u9002\u914D",sliderToggleAria:"\u542F\u7528\u6A21\u578B\u4E0E\u601D\u8003\u7B49\u7EA7\u884C",settingOn:"\u542F\u7528",settingOff:"\u505C\u7528",sliderNoLevels:"\u5F53\u524D\u6A21\u578B\u672A\u63D0\u4F9B\u601D\u8003\u5F3A\u5EA6\u6863\u4F4D",triggerFallback:"\u9009\u62E9\u6A21\u578B",effortDefault:"\u9ED8\u8BA4",modelRowLabel:"\u6A21\u578B",effortRowLabel:"\u601D\u8003\u7B49\u7EA7",tagVision:"\u652F\u6301\u56FE\u7247\u8F93\u5165",tagThinking:"\u652F\u6301\u601D\u8003\u7B49\u7EA7",tagImageGen:"\u751F\u56FE\u6A21\u578B",sliderNoCurrent:"\u5F53\u524D\u65E0\u9009\u62E9\u4E2D\u7684\u6A21\u578B\u3002",sliderCommitSlow:"\u5207\u6362\u8D85\u65F6\u2014\u2014\u8BF7\u91CD\u8BD5\u3002",defaultEffortLabel:"\u9ED8\u8BA4\u601D\u8003\u5F3A\u5EA6",defaultEffortUnset:"\u8DDF\u968F\u8BB0\u5FC6",defaultEffortHint:"\u65B0\u4F1A\u8BDD\u7684\u8D77\u59CB\u6863\u4F4D\uFF1B\u4F1A\u8BDD\u5185\u624B\u52A8\u9009\u62E9\u59CB\u7EC8\u4F18\u5148\u3002\u7559\u7A7A\u5219\u8DDF\u968F\u8BB0\u5FC6\u94FE\u3002",followMemory:"\u8DDF\u968F\u8BB0\u5FC6",clearDefaultEffort:"\u6E05\u9664\u9009\u62E9",modelSearchPlaceholder:"\u641C\u7D22\u6A21\u578B\u2026",modelSearchNoMatches:"\u672A\u627E\u5230\u5339\u914D\u6A21\u578B",modelSearchClear:"\u6E05\u7A7A\u641C\u7D22",modelSearchFailed:"\u6A21\u578B\u641C\u7D22\u6E32\u67D3\u5931\u8D25",editorTabsLabel:"\u7F16\u8F91\u5668\u5206\u533A",editorTabProvider:"\u4F9B\u5E94\u5546\u914D\u7F6E",editorTabModels:"\u6A21\u578B\u914D\u7F6E",editorTabAdvanced:"\u9AD8\u7EA7\u914D\u7F6E",editorTabFingerprint:"\u6307\u7EB9\u68C0\u6D4B",fpTitle:"\u6A21\u578B\u6307\u7EB9",fpIntro:"\u53EA\u6709 GPT \u4E0E Claude \u7CFB\u5217\u6A21\u578B\u53EF\u68C0\u6D4B\u2014\u2014\u6307\u7EB9\u5E93\u53EA\u8986\u76D6\u8FD9\u4E24\u4E2A\u5BB6\u65CF\uFF0C\u4E0D\u5728\u6B64\u5217\u7684\u6A21\u578B\u4E0D\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\u3002",fpCount:"{count} \u4E2A\u53EF\u68C0\u6D4B",fpSummary:"\u5DF2\u8BC6\u522B {identified} \xB7 \u5B58\u7591 {doubtful} \xB7 \u5931\u8D25 {failed}",fpSummaryNone:"\u5C1A\u672A\u68C0\u6D4B\u3002",fpRunning:"\u6B63\u5728\u68C0\u6D4B \xB7 {done} / {total}\uFF08\u5207\u8D70\u4E5F\u4F1A\u7EE7\u7EED\uFF09",fpDetectAll:"\u68C0\u6D4B\u5168\u90E8",fpDetect:"\u68C0\u6D4B",fpRetest:"\u91CD\u6D4B",fpRetry:"\u91CD\u8BD5",fpCost:"{count} \u9898 \xB7 \u7EA6 {seconds} \u79D2",fpCostMinutes:"{count} \u9898 \xB7 \u7EA6 {minutes} \u5206\u949F",fpCostUnknown:"{count} \u9898",fpForget:"\u5FD8\u6389",fpStateUnchecked:"\u672A\u68C0\u6D4B",fpStateRunning:"\u68C0\u6D4B\u4E2D \xB7 {done}/{total}",fpStateIdentified:"{model} \xB7 {probability}",fpStateDoubtful:"\u5B58\u7591 \xB7 {probability}",fpStateFailed:"\u68C0\u6D4B\u5931\u8D25",fpQueued:"\u6392\u961F \xB7 \u7B2C {position} \u4E2A",fpEvidence:"{used} / {total} \u9898",fpSimilarity:"\u76F8\u4F3C\u5EA6",fpDetailShow:"\u5C55\u5F00\u7ED3\u679C",fpDetailHide:"\u6536\u8D77\u7ED3\u679C",fpFamily:"\u5BB6\u65CF",fpChallengeCounted:"\u9898{index} {numbers} \u4E2A \xB7 \u8BA1\u5165",fpChallengeRejected:"\u9898{index} {parsed}/{numbers} \xB7 \u672A\u8BA1\u5165",fpChallengeSkipped:"\u9898{index} {numbers} \u4E2A \xB7 \u65E9\u505C",fpChallengeTitle:"\u4E09\u9053\u9898\u5404\u81EA\u7684\u843D\u70B9\u3002\u6570\u5B57\u662F\u8FD9\u9898\u8981\u6C42\u7684\u6574\u6570\u4E2A\u6570\uFF1B\u6709\u659C\u6760\u65F6\uFF0C\u53F3\u8FB9\u662F\u8981\u6C42\u6570\u3001\u5DE6\u8FB9\u662F\u5B9E\u9645\u7B54\u56DE\u7684\u4E2A\u6570\u3002\u7B54\u56DE\u4E0D\u5230 max(80, \u8981\u6C42\u6570\u7684 55%) \u5C31\u4E0D\u8BA1\u5165\u3002",fpCandidates:"\u6700\u63A5\u8FD1\u7684\u5019\u9009",fpClosedSet:"\u95ED\u96C6\u7ED3\u8BBA\uFF1A\u4E0D\u5728\u5E93\u91CC\u7684\u6A21\u578B\u4ECD\u4F1A\u88AB\u5F52\u7ED9\u6700\u63A5\u8FD1\u7684\u90A3\u4E2A\u3002\u8BF7\u5F53\u6210\u4E00\u6B21\u6BD4\u5BF9\uFF0C\u4E0D\u662F\u8BC1\u660E\u3002",fpCheckedAt:"\u68C0\u6D4B\u4E8E {time}",fpTiming:"\u8017\u65F6\uFF1A\u9996\u5B57 {first} \u79D2 \xB7 \u603B\u8BA1 {total} \u79D2 \xB7 \u5410\u5B57\u7EA6 {rate} \u5B57\u7B26/\u79D2",fpLoadFailed:"\u8BFB\u4E0D\u5230\u5DF2\u5B58\u7ED3\u8BBA\uFF1A{error}",fpRunFailed:"\u68C0\u6D4B\u5931\u8D25\uFF1A{error}",keyRevealShow:"\u663E\u793A\u5BC6\u94A5",keyRevealHide:"\u9690\u85CF\u5BC6\u94A5",keyRevealFailed:"\u65E0\u6CD5\u8BFB\u53D6\u5DF2\u4FDD\u5B58\u7684\u5BC6\u94A5",keysLoading:"\u6B63\u5728\u8BFB\u53D6\u5BC6\u94A5\u2026",keysAdd:"\u6DFB\u52A0\u53E6\u4E00\u4E2A\u5BC6\u94A5",keysAddConfirm:"\u6DFB\u52A0",keysEnable:"\u542F\u7528 {name}",keysDisable:"\u505C\u7528 {name}",keysMissing:"\u672A\u5B58\u50A8",keysEdit:"\u4FEE\u6539",keysRemove:"\u5220\u9664",keysConfirmRemove:"\u786E\u8BA4\u5220\u9664",keysCancel:"\u53D6\u6D88",keysSave:"\u4FDD\u5B58",keysAlias:"\u522B\u540D",keysAliasPlaceholder:"\u540D\u79F0\uFF08\u53EF\u9009\uFF09\uFF0C\u4F8B\u5982 \u56E2\u961F",keysValue:"\u5BC6\u94A5",keysValuePlaceholder:"\u7C98\u8D34 API \u5BC6\u94A5",keysNewValuePlaceholder:"\u7C98\u8D34\u65B0\u7684 API \u5BC6\u94A5",keysAddIllegal:"\u5BC6\u94A5\u53EA\u80FD\u662F\u53EF\u6253\u5370 ASCII \u5B57\u7B26\uFF0C\u4E14\u4E0D\u80FD\u5305\u542B\u7A7A\u683C\u3002",keysAdded:"\u5DF2\u4FDD\u5B58\u5BC6\u94A5\u3002",keysRenamed:"\u5DF2\u4FDD\u5B58\u522B\u540D\u3002",keysReplaced:"\u5DF2\u66FF\u6362\u5BC6\u94A5\u3002",keysRemoved:"\u5DF2\u5220\u9664\u5BC6\u94A5\u3002",keysCopy:"\u590D\u5236 {name}",keysCopied:"\u5DF2\u590D\u5236\u5BC6\u94A5\u3002",keysCopyFailed:"\u65E0\u6CD5\u590D\u5236\u5BC6\u94A5\u3002",keysScope:"{name} \u63D0\u4F9B\u670D\u52A1\u7684\u6A21\u578B",keysModels:"\u6A21\u578B",keysScopeAll:"\u5168\u90E8\u6A21\u578B",keysScopeNone:"\u672A\u53D1\u73B0\u6A21\u578B",keysScopeCount:"{count} \u4E2A\u6A21\u578B",keysScopeSaved:"\u5DF2\u4FDD\u5B58\u6A21\u578B\u8303\u56F4\u3002",keysScopeHint:"\u53EA\u6709\u9009\u4E2D\u7684\u6A21\u578B\u4F1A\u7528\u8FD9\u4E2A Key\uFF0C\u5176\u4ED6\u6A21\u578B\u4EA4\u7ED9\u8BE5\u4F9B\u5E94\u5546\u7684\u5176\u4ED6 Key\u3002",keysScopeAutoHint:"\u8FD9\u4E2A\u8303\u56F4\u7531\u81EA\u52A8\u63A2\u6D4B\u6309\u8FD9\u628A\u5BC6\u94A5\u5B9E\u9645\u63D0\u4F9B\u7684\u6A21\u578B\u5199\u5165\uFF0C\u6BCF\u6B21\u63A2\u6D4B\u90FD\u4F1A\u91CD\u65B0\u6821\u51C6\u3002",keysProbe:"\u81EA\u52A8\u63A2\u6D4B",keysProbing:"\u63A2\u6D4B\u4E2D\u2026",keysProbeHint:"\u63A2\u6D4B\u6BCF\u628A\u5BC6\u94A5\u5B9E\u9645\u63D0\u4F9B\u54EA\u4E9B\u6A21\u578B\uFF0C\u628A\u6BCF\u628A\u5BC6\u94A5\u9650\u5B9A\u5728\u5B83\u4E0E\u672C\u4F9B\u5E94\u5546\u6A21\u578B\u5217\u8868\u7684\u4EA4\u96C6\u4E0A\uFF1A\u80FD\u63D0\u4F9B\u5168\u90E8\u5DF2\u6DFB\u52A0\u6A21\u578B\u65F6\u4FDD\u6301\u201C\u5168\u90E8\u6A21\u578B\u201D\uFF0C\u4E00\u4E2A\u90FD\u4E0D\u63D0\u4F9B\u65F6\u5173\u95ED\u8FD9\u628A\u5BC6\u94A5\u3002",keysProbeSingle:"\u53EA\u6709\u4E00\u4E2A\u5BC6\u94A5\uFF0C\u65E0\u9700\u63A2\u6D4B\u2014\u2014\u5148\u6DFB\u52A0\u7B2C\u4E8C\u4E2A\u5BC6\u94A5\u3002",keysProbeDone:"\u63A2\u6D4B\u5B8C\u6210\uFF0C\u5DF2\u6309\u5404\u5BC6\u94A5\u5B9E\u9645\u652F\u6301\u7684\u6A21\u578B\u52FE\u9009\u3002",keysScopeEmpty:"\u8BE5\u4F9B\u5E94\u5546\u8FD8\u6CA1\u6709\u6A21\u578B\u3002\u8BF7\u5148\u6DFB\u52A0\u6A21\u578B\uFF0C\u518D\u6765\u8FD9\u91CC\u9009\u62E9\u3002",keysProtocolLabel:"{name} \u4F7F\u7528\u7684\u534F\u8BAE",keysProtocolCreate:"\u534F\u8BAE",keysProtocolCreateHint:"\u8FD9\u628A\u5BC6\u94A5\u8981\u8D70\u7684\u534F\u8BAE\uFF1B\u53EF\u9009\u54EA\u4E9B\u53D6\u51B3\u4E8E\u4F9B\u5E94\u5546\u5DF2\u914D\u7F6E\u7684\u7AEF\u70B9\u5730\u5740\u3002",keysProtocolDefault:"\u81EA\u52A8\uFF08\u6309\u6A21\u578B\uFF09",keysProtocolDefaultHint:"\u6309\u6A21\u578B\u81EA\u52A8\u9009\u62E9\u534F\u8BAE\uFF1Aclaude \u7CFB\u6A21\u578B\u8D70 Anthropic \u5730\u5740\uFF0C\u5176\u4F59\u6CBF\u7528\u8BE5\u4F9B\u5E94\u5546\u81EA\u5E26\u7684\u534F\u8BAE\uFF08\u9700\u5DF2\u914D\u7F6E\u5BF9\u5E94\u5730\u5740\uFF09",keysProtocolAnthropic:"Anthropic",keysProtocolAnthropicHint:"Anthropic API \xB7 Claude \u6A21\u578B",keysProtocolOpenAI:"Chat Completions",keysProtocolOpenAIHint:"OpenAI API \xB7 GPT \u6A21\u578B\u3001\u5927\u591A\u6570 agent",keysProtocolResponses:"Responses",keysProtocolResponsesHint:"OpenAI API \xB7 Codex",keysProtocolShortChat:"Chat",keysProtocolShortResponses:"Responses",keysProtocolShortAnthropic:"Anthropic",keysProtocolSaved:"\u5DF2\u4FDD\u5B58\u534F\u8BAE\u3002",keysEndpointOpenAI:"OpenAI",keysEndpointAnthropic:"Anthropic",keysEndpointBalance:"\u4F59\u989D",keysEndpointBalanceHint:"\u53EA\u8BFB\u63A5\u53E3\uFF1A\u7528\u4E8E\u8BFB\u53D6\u8BE5\u4F9B\u5E94\u5546\u4F59\u989D\uFF0C\u4F1A\u5E26\u4E0A\u5BC6\u94A5\u5217\u8868\u4E2D\u7684\u7B2C\u4E00\u628A\u5BC6\u94A5\u3002",keysMoreEndpoints:"\u66F4\u591A\u7AEF\u70B9",keysEndpointsCount:"\u53E6\u6709 {count} \u4E2A",keysEndpointInvalid:"\u5730\u5740\u9700\u4EE5 http:// \u6216 https:// \u5F00\u5934",keysUnreachable:"\u63D2\u4EF6\u7684\u5BC6\u94A5\u63A5\u53E3\u6CA1\u6709\u54CD\u5E94\u3002",keysPanelFailed:"\u5BC6\u94A5\u7BA1\u7406\u9762\u677F\u6E32\u67D3\u5931\u8D25",keysDraftHint:"\u5BC6\u94A5\u6682\u5B58\u5728\u672C\u9875\uFF0C\u521B\u5EFA\u4F9B\u5E94\u5546\u540E\u81EA\u52A8\u4FDD\u5B58\uFF1B\u5237\u65B0\u9875\u9762\u4F1A\u4E22\u5F03\uFF0C\u4E0E\u5361\u7247\u81EA\u8EAB\u8868\u5355\u4E00\u81F4\u3002",keysLastEnabledOff:"\u4E0D\u80FD\u505C\u7528\u6700\u540E\u4E00\u628A\u542F\u7528\u4E2D\u7684\u5BC6\u94A5\u3002",headersTitle:"\u8BF7\u6C42\u5934",headersHint:"\u8BE5\u8DEF\u7531\u7684\u6BCF\u4E2A\u8BF7\u6C42\u90FD\u4F1A\u643A\u5E26\u81EA\u5B9A\u4E49\u8BF7\u6C42\u5934\u3002",headersEmpty:"\u5C1A\u672A\u914D\u7F6E\u989D\u5916\u8BF7\u6C42\u5934\u3002",headersAdd:"\u6DFB\u52A0\u8BF7\u6C42\u5934",headersName:"\u540D\u79F0",headersNamePlaceholder:"\u4F8B\u5982 x-company",headersValue:"\u503C",headersEdit:"\u7F16\u8F91",headersSave:"\u4FDD\u5B58",headersCancel:"\u53D6\u6D88",headersClear:"\u5168\u90E8\u6E05\u7A7A",headersRemove:"\u5220\u9664\u8BF7\u6C42\u5934",headersSaved:"\u5DF2\u4FDD\u5B58\u3002",headersCleared:"\u5DF2\u6E05\u7A7A\u2014\u2014\u8BE5\u8DEF\u7531\u4E0D\u518D\u643A\u5E26\u989D\u5916\u8BF7\u6C42\u5934\u3002",headersReadOnly:"\u5F53\u524D\u8BBE\u7F6E\u6587\u6863\u4E0D\u53EF\u5199\u5165\u3002",headersConflictOrigin:"\u540C\u4E00\u4E2A endpoint \u4E0A\u6709\u591A\u4E2A\u8DEF\u7531\u914D\u7F6E\u4E86\u4E0D\u540C\u7684\u8BF7\u6C42\u5934\u503C\uFF1A\u5F53\u8BF7\u6C42\u4F53\u91CC\u7684\u6A21\u578B\u65E0\u6CD5\u552F\u4E00\u5B9A\u4F4D\u5176\u4E2D\u4E00\u4E2A\u8DEF\u7531\u65F6\uFF0C\u8BE5\u8BF7\u6C42\u56DE\u9000\u5230\u7B2C\u4E00\u4E2A\u8DEF\u7531\u7684\u914D\u7F6E\u3002",headersConflictPatched:"\u68C0\u6D4B\u5230\u5B98\u65B9 dsh-llm-pi-ai \u5DF2\u5728\u8BF7\u6C42\u5C42\u5904\u7406\u8BF7\u6C42\u5934\uFF1A\u628A\u503C\u586B\u5728\u4E0A\u65B9\u8BF7\u6C42\u5934\u914D\u7F6E\u4E2D\u5373\u53EF\uFF0C\u65E0\u9700\u91CD\u590D\u63A5\u7BA1\u3002",headersConflictSiblings:"\u68C0\u6D4B\u5230\u4F1A\u6539\u5199\u540C\u4E00\u5C42\u7684\u540C\u7C7B\u63D2\u4EF6\uFF1A{names}\u3002\u540C\u4E00\u65F6\u95F4\u53EA\u5E94\u542F\u7528\u4E00\u79CD\u8BF7\u6C42\u5934\u6539\u5199\uFF0C\u5426\u5219\u7EBF\u4E0A\u751F\u6548\u7684\u662F\u6700\u540E\u5199\u5165\u8005\u3002",headersError:"\u4FDD\u5B58\u5931\u8D25\uFF1A{error}",headersNoRoute:"\u8BE5\u8DEF\u7531\u5DF2\u4E0D\u5728\u8BBE\u7F6E\u6587\u6863\u4E2D\u2014\u2014\u8BF7\u5148\u4FDD\u5B58\u4E00\u6B21\u5B98\u65B9\u5361\u7247\u3002",providerReorderAria:"\u62D6\u52A8\u6392\u5E8F\uFF1A{provider}",providerReorderHint:"\u62D6\u52A8\u8C03\u6574\u4F9B\u5E94\u5546\u987A\u5E8F\u2014\u2014\u6A21\u578B\u5207\u6362\u6309\u6B64\u987A\u5E8F\u663E\u793A\u3002",providerToggleAria:"\u542F\u7528 {provider}",providerToggleHint:"\u7981\u7528\u540E\u8BE5\u4F9B\u5E94\u5546\u4E0D\u5728\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u663E\u793A\u3002",providerBalanceLabel:"\u4F59\u989D",providerBalanceHint:"\u6765\u81EA\u8BE5\u4F9B\u5E94\u5546\u914D\u7F6E\u7684\u4F59\u989D\u63A5\u53E3\u3002",providerBalanceRefresh:"\u5237\u65B0\u4F59\u989D",providerBalanceUnavailable:"\u4F59\u989D \u2014",providerDisabledGroupShow:"\u5C55\u5F00 {count} \u4E2A\u5DF2\u7981\u7528\u7684\u4F9B\u5E94\u5546",providerDisabledGroupHide:"\u6536\u8D77 {count} \u4E2A\u5DF2\u7981\u7528\u7684\u4F9B\u5E94\u5546",providerDisabledGroupHint:"\u5DF2\u7981\u7528\u7684\u4F9B\u5E94\u5546\u914D\u7F6E\u4ECD\u5728\uFF0C\u53EA\u662F\u6298\u53E0\u5728\u8FD9\u91CC\u2014\u2014\u5C55\u5F00\u540E\u53EF\u4EE5\u91CD\u65B0\u542F\u7528\u3002",providerRemoveDisabled:"\u5220\u9664",providerRemoveLocked:"\u5185\u7F6E\u4F9B\u5E94\u5546\u4E0D\u53EF\u5220\u9664\u3002",modelReorderAria:"\u62D6\u52A8\u6392\u5E8F\uFF1A{model}",modelReorderHint:"\u62D6\u52A8\u8C03\u6574\u8BE5\u4F9B\u5E94\u5546\u5185\u6A21\u578B\u987A\u5E8F\u2014\u2014\u6A21\u578B\u5207\u6362\u6309\u6B64\u987A\u5E8F\u663E\u793A\u3002",configButton:"\u9AD8\u7EA7\u8BBE\u7F6E",configButtonHint:"\u6253\u5F00\u9AD8\u7EA7\u8BBE\u7F6E",configPaneTitle:"\u9AD8\u7EA7\u8BBE\u7F6E",configPaneClose:"\u5173\u95ED",configPaneFailed:"\u914D\u7F6E\u9762\u677F\u6E32\u67D3\u5931\u8D25",imagegenSectionTitle:"\u751F\u56FE",imagegenEnable:"\u542F\u7528\u751F\u56FE",cardStateOn:"\u5F00\u542F",cardStateOff:"\u5173\u95ED",imagegenEnabledHint:"\u5141\u8BB8\u4F7F\u7528\u751F\u56FE\u5DE5\u5177\uFF0C\u70B9\u51FB\u5C55\u5F00\u914D\u7F6E\u6A21\u578B\u548C\u56FE\u7247\u53C2\u6570\u3002",imagegenDisabledHint:"\u4E0D\u4F7F\u7528\u751F\u56FE\u5DE5\u5177\uFF0C\u5DF2\u914D\u7F6E\u7684\u6A21\u578B\u548C\u56FE\u7247\u53C2\u6570\u4ECD\u4F1A\u4FDD\u7559\u3002",imagegenExpand:"\u5C55\u5F00\u751F\u56FE\u8BBE\u7F6E",imagegenCollapse:"\u6536\u8D77\u751F\u56FE\u8BBE\u7F6E",imagegenSaving:"\u6B63\u5728\u4FDD\u5B58\u2026",imagegenRefreshFailed:"\u5DF2\u4FDD\u5B58\uFF0C\u4F46\u65E0\u6CD5\u5237\u65B0\u914D\u7F6E\uFF1A{error}",imagegenLoading:"\u6B63\u5728\u8BFB\u53D6\u2026",imagegenLoadFailed:"\u8BFB\u4E0D\u5230\u751F\u56FE\u914D\u7F6E",imagegenDefaultsLabel:"\u9ED8\u8BA4\u53C2\u6570",imagegenDefaultModelLabel:"\u9ED8\u8BA4\u751F\u56FE\u6A21\u578B",imagegenDefaultModelNone:"\u672A\u8BBE\u7F6E",imagegenSizeLabel:"\u5C3A\u5BF8",imagegenQualityLabel:"\u8D28\u91CF",imagegenCountLabel:"\u6570\u91CF",imagegenTimeoutLabel:"\u8D85\u65F6",imagegenTimeoutMinutes:"{minutes} \u5206\u949F",imagegenTimeoutHint:"\u5355\u6B21\u8BF7\u6C42\u4E0A\u9650\uFF1B\u53C2\u6570\u56DE\u9000\u7684\u6BCF\u6B21\u91CD\u8BD5\u4E5F\u7528\u5B83\u3002",imagegenCardRunning:"\u6B63\u5728\u751F\u6210\u56FE\u7247\u2026",imagegenToolMissing:"\u5185\u5EFA\u751F\u56FE\u5DE5\u5177\u6CA1\u6709\u6CE8\u518C\u6210\u529F\uFF0C\u6A21\u578B\u8C03\u4E0D\u5230\u5B83\u3002",imagegenToolMissingWhy:"\u5BBF\u4E3B\u8BF4\uFF1A{reason}",autoContinueSectionTitle:"\u81EA\u52A8\u7EE7\u7EED",autoContinueExpand:"\u5C55\u5F00\u81EA\u52A8\u7EE7\u7EED\u8BBE\u7F6E",autoContinueCollapse:"\u6536\u8D77\u81EA\u52A8\u7EE7\u7EED\u8BBE\u7F6E",autoContinueTitle:"\u81EA\u52A8\u7EE7\u7EED\u88AB\u4E2D\u65AD\u7684\u4F1A\u8BDD",autoContinueDescription:"\u4F1A\u8BDD\u56E0\u65AD\u7EBF\u3001\u8D85\u65F6\u6216\u8F93\u51FA\u8FBE\u5230\u4E0A\u9650\u800C\u4E2D\u65AD\u65F6\uFF0C\u81EA\u52A8\u56DE\u590D\u300C\u7EE7\u7EED\u300D\u3002\u6B63\u5E38\u5B8C\u6210\u3001\u624B\u52A8\u505C\u6B62\u3001\u9274\u6743\u6216\u989D\u5EA6\u7C7B\u9519\u8BEF\u4E0D\u4F1A\u89E6\u53D1\u3002",autoContinueHint:"\u5931\u8D25\u540E\u7B49 {seconds} \u79D2\u518D\u7EE7\u7EED \xB7 \u6700\u591A {count} \u6B21",autoContinueWaitLabel:"\u5931\u8D25\u540E\u7B49\u5F85",autoContinueRetriesLabel:"\u91CD\u8BD5\u4E0A\u9650",autoContinueSecondsUnit:"\u79D2",autoContinueRetriesUnit:"\u6B21",autoContinueConfigHint:"\u586B\u6574\u6570\uFF1A{waitMin}\u2013{waitMax} \u79D2\u3001{retriesMin}\u2013{retriesMax} \u6B21\uFF1B\u79FB\u5F00\u7126\u70B9\u6216\u6309\u56DE\u8F66\u81EA\u52A8\u4FDD\u5B58\u3002\u6BCF\u6B21\u5931\u8D25\u540E\u5148\u7B49\u8FD9\u4E48\u4E45\u518D\u53D1\u9001\u300C\u7EE7\u7EED\u300D\uFF1B\u4F9B\u5E94\u5546\u8981\u6C42\u7684\u7B49\u5F85\u66F4\u4E45\u65F6\u6309\u66F4\u4E45\u7684\u6765\u3002",autoContinueAria:"\u542F\u7528\u81EA\u52A8\u7EE7\u7EED",autoContinueMessage:"\u7EE7\u7EED"};var Jr="dsh-model-think-level.slider.enabled",Rm=["dsh-reasoning-effort.enabled","@dsh-external/dsh-reasoning-effort.enabled"],ir=Cm();function Cm(){try{let e=window.localStorage.getItem(Jr),t=e===null?Rm.map(n=>window.localStorage.getItem(n)).find(n=>n!==null):null;return(e??t??null)!=="false"}catch{return!0}}var Ii=new Set;function od(){for(let e of[...Ii])e()}function st(){return ir}function id(e){if(ir!==e){ir=e;try{window.localStorage.setItem(Jr,String(e))}catch{}od()}}function ad(e){ir!==e&&(ir=e,od())}function Xr(e){return Ii.add(e),()=>{Ii.delete(e)}}var Qr="dsh-model-think-level.provider-order",sd=["deepseek-account","deepseek-official"];function yn(e){if(e===null)return[];try{let t=JSON.parse(e);return Array.isArray(t)?Pi(t.filter(n=>typeof n=="string")):[]}catch{return[]}}function Pi(e){let t=new Set,n=[];for(let r of e)r.length===0||t.has(r)||(t.add(r),n.push(r));return n}var bn=(()=>{try{return yn(window.localStorage.getItem(Qr))}catch{return[]}})(),Oi=new Set;function dd(){for(let e of[...Oi])e()}function ld(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function vn(){return bn}function Zr(e){let t=Pi(e);if(!ld(bn,t)){bn=t;try{window.localStorage.setItem(Qr,JSON.stringify(bn))}catch{}dd()}}function cd(e){let t=Pi(e);ld(bn,t)||(bn=t,dd())}function wn(e){return Oi.add(e),()=>{Oi.delete(e)}}function _i(e){let t=n=>{let r=sd.indexOf(n);return r<0?sd.length:r};return e.map((n,r)=>({id:n,index:r,rank:t(n)})).sort((n,r)=>n.rank-r.rank||n.index-r.index).map(n=>n.id)}function xn(e,t){let n=new Map;for(let a of t)n.has(a)||n.set(a,n.size);let r=[],o=[];e.forEach((a,s)=>{n.has(a)&&(r.push(s),o.push(a))}),o.sort((a,s)=>n.get(a)-n.get(s));let i=[...e];return r.forEach((a,s)=>{i[a]=o[s]}),i}function ud(e){return xn(_i(e),vn())}function Di(e,t,n){let r=e.indexOf(t);if(r<0)return[...e];let o=[...e];o.splice(r,1);let i=Math.max(0,Math.min(o.length,n));return o.splice(i,0,t),o}var eo="dsh-model-think-level.providers.disabled",Fi=new Set,Ht=Hm();function Hm(){try{return yn(window.localStorage.getItem(eo))}catch{return[]}}function fd(e){return yn(e)}function ar(){return Ht}function kn(e){return!Ht.includes(e)}function pd(e,t){let n=!Ht.includes(e);t!==n&&Ki(t?Ht.filter(r=>r!==e):[...Ht,e],!0)}function md(e){Ki(e,!1)}function gd(e){Ki(e,!0)}function En(e){return Fi.add(e),()=>{Fi.delete(e)}}function Nm(e,t){return e.length!==t.length?!1:e.every(n=>t.includes(n))}function Ki(e,t){if(!Nm(Ht,e)){if(Ht=[...new Set(e)],t)try{window.localStorage.setItem(eo,JSON.stringify(Ht))}catch{}for(let n of[...Fi])n()}}var to="dsh-model-think-level.model-order";function qi(e){if(e===null)return{};try{let t=JSON.parse(e);if(t===null||typeof t!="object"||Array.isArray(t))return{};let n={};for(let[r,o]of Object.entries(t)){if(r.length===0||!Array.isArray(o))continue;let i=Gi(o.filter(a=>typeof a=="string"));i.length>0&&(n[r]=i)}return n}catch{return{}}}function Gi(e){let t=new Set,n=[];for(let r of e)r.length===0||t.has(r)||(t.add(r),n.push(r));return n}var Nt=(()=>{try{return qi(window.localStorage.getItem(to))}catch{return{}}})(),Bi=new Set;function Wi(){for(let e of[...Bi])e()}function Im(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function hd(){try{window.localStorage.setItem(to,JSON.stringify(Nt))}catch{}}function sr(){return Nt}function bd(e){return Nt[e]??Om}var Om=[];function yd(e,t){if(e.length===0)return;let n=Gi(t),r=bd(e);if(Im(r,n)&&(n.length>0||!(e in Nt)))return;let o={...Nt};n.length===0?delete o[e]:o[e]=n,Nt=o,hd(),Wi()}function vd(e){Nt=e,Wi()}function wd(e){let t={};for(let[n,r]of Object.entries(e)){if(n.length===0)continue;let o=Gi(r);o.length>0&&(t[n]=o)}Nt=t,hd(),Wi()}function Tn(e){return Bi.add(e),()=>{Bi.delete(e)}}function Pm(e,t){return xn(e,t)}function xd(e,t){return xn(t,bd(e))}function Ui(e,t){if(e.length===0||t.length===0)return e;let n=new Map(e.map(r=>[r.id,r]));return Pm(e.map(r=>r.id),t).map(r=>n.get(r))}var kd="dsh-model-think-level.order-saved-at",_m=400,Dm=6e4;function $i(e){if(!Array.isArray(e))return[];let t=new Set,n=[];for(let r of e){if(typeof r!="string")continue;let o=r.trim();o.length===0||t.has(o)||(t.add(o),n.push(o))}return n}function Fm(e){if(typeof e!="object"||e===null||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e)){if(n.length===0)continue;let o=$i(r);o.length>0&&(t[n]=o)}return t}function Ed(e){if(typeof e!="object"||e===null)return;let t=e;return{savedAt:typeof t.savedAt=="number"&&Number.isFinite(t.savedAt)?t.savedAt:0,providerOrder:$i(t.providerOrder),modelOrder:Fm(t.modelOrder),providersDisabled:Array.isArray(t.providersDisabled)?$i(t.providersDisabled):void 0}}function Td(e){return e.providerOrder.length>0||Object.keys(e.modelOrder).length>0||e.providersDisabled!==void 0}function dr(){try{let e=window.localStorage.getItem(kd),t=e===null?0:Number(e);return Number.isFinite(t)&&t>0?t:0}catch{return 0}}function Yi(e){try{window.localStorage.setItem(kd,String(e))}catch{}}function lr(){return JSON.stringify({providerOrder:vn(),modelOrder:sr(),providersDisabled:ar()})}var Ot,dt,Sn=new Set,no,ji,Ce=!1,Vi=!1,It,qe=0;function Km(){let e=Math.max(Date.now(),dr()+1);return Yi(e),e}function Sd(){if(dt=void 0,Ce)return;let e=dr(),t=JSON.stringify({savedAt:e>0?e:Date.now(),providerOrder:vn(),modelOrder:sr(),providersDisabled:ar()});Ot=lr();let n=qe,r=fetch(Ci,{method:"POST",headers:{"content-type":"application/json"},body:t}).then(async o=>{if(Ce||n!==qe)return!0;let i=await o.json().catch(()=>{});if(Ce||n!==qe)return!0;let a=Ed(i?.data);return o.status===409?dr()!==e?!0:a!==void 0&&Td(a)?(Md(a),!0):(Ot=void 0,!1):o.ok?(a!==void 0&&a.savedAt>dr()&&Yi(a.savedAt),!0):(Ot=void 0,!1)}).catch(()=>(!Ce&&n===qe&&(Ot=void 0),!1));Sn.add(r),r.then(()=>{Sn.delete(r)})}function Ji(e){Ce||dt!==void 0||lr()!==Ot&&(dt=setTimeout(Sd,e))}function Xi(){dt!==void 0&&(clearTimeout(dt),Sd())}async function Bm(){if(Ce)return;let e=qe;if(await oo(),!(Ce||e!==qe))for(lr()!==Ot&&dt===void 0&&Sn.size===0&&Ji(0);!Ce&&e===qe&&(dt!==void 0||Sn.size>0);){Xi();let t=await Promise.all([...Sn]);if(Ce||e!==qe)return;if(t.includes(!1))throw new Error("\u6A21\u578B\u987A\u5E8F\u548C\u542F\u505C\u5C1A\u672A\u4FDD\u5B58\uFF0C\u8BF7\u91CD\u8BD5\u540C\u6B65")}}function zi(){Ce||Vi||(Km(),Ji(_m))}function Md(e){Vi=!0;try{Zr(e.providerOrder),wd(e.modelOrder),e.providersDisabled!==void 0&&gd(e.providersDisabled)}finally{Vi=!1}Yi(e.savedAt),Ot=lr()}function oo(){if(Ce)return Promise.resolve();if(It!==void 0)return It;let e=qm().finally(()=>{It===e&&(It=void 0)});return It=e,e}async function qm(){let e=qe,t;try{let o=await fetch(Ci,{method:"GET"});if(o.ok){let i=await o.json();i.ok===!0&&(t=Ed(i.data))}}catch{return}if(Ce||e!==qe||dt!==void 0)return;let n=dr(),r=JSON.stringify({providerOrder:t?.providerOrder??[],modelOrder:t?.modelOrder??{},providersDisabled:t?.providersDisabled??[]});if(t!==void 0&&Td(t)&&t.savedAt>=n){Md(t);return}lr()!==r&&Ji(0)}function ro(){Ce||typeof document<"u"&&document.visibilityState==="hidden"||oo()}function Ld(){Ce=!1,qe+=1,It=void 0,Sn.clear(),Ot=void 0;let e=wn(zi),t=Tn(zi),n=En(zi);no=setInterval(ro,Dm);let r=a=>{let s=a.detail;typeof s?.waitUntil=="function"&&s.waitUntil(Bm())},o=()=>{let a=qe;(async()=>(It!==void 0&&await It,!Ce&&a===qe&&await oo()))()};typeof window<"u"&&(window.addEventListener("focus",ro),window.addEventListener("dsh-webdav-sync:before-snapshot",r),window.addEventListener("dsh-webdav-sync:applied",o));let i=()=>{document.visibilityState==="visible"&&ro()};return typeof document<"u"&&document.addEventListener("visibilitychange",i),ji=()=>{typeof document<"u"&&document.removeEventListener("visibilitychange",i),typeof window<"u"&&(window.removeEventListener("focus",ro),window.removeEventListener("dsh-webdav-sync:before-snapshot",r),window.removeEventListener("dsh-webdav-sync:applied",o))},oo(),()=>{Ce=!0,qe+=1,dt!==void 0&&clearTimeout(dt),dt=void 0,no!==void 0&&clearInterval(no),no=void 0,ji?.(),ji=void 0,e(),t(),n()}}var Ad=`
|
|
7
|
+
"use strict";var Qr=Object.defineProperty;var Pm=Object.getOwnPropertyDescriptor;var _m=Object.getOwnPropertyNames;var Dm=Object.prototype.hasOwnProperty;var Fm=(e,t,n)=>t in e?Qr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Km=(e,t)=>{for(var n in t)Qr(e,n,{get:t[n],enumerable:!0})},qm=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _m(t))!Dm.call(e,o)&&o!==n&&Qr(e,o,{get:()=>t[o],enumerable:!(r=Pm(t,o))||r.enumerable});return e};var Bm=e=>qm(Qr({},"__esModule",{value:!0}),e);var Pe=(e,t,n)=>Fm(e,typeof t!="symbol"?t+"":t,n);var mx={};Km(mx,{EffortEditor:()=>To,REFRESH_MIN_INTERVAL_MS:()=>Om,apply:()=>px,baselineModelsOf:()=>jd,compatOf:()=>go,createEditorApi:()=>yo,defaultEffortOf:()=>bo,describeNamespace:()=>de,effortsOf:()=>po,findModelMenu:()=>Ta,findModelTrigger:()=>Sa,imageGenOf:()=>ua,inject:()=>fx,inputOf:()=>mo,invalidateProbeCache:()=>fa,name:()=>ux,nameOf:()=>ho,providerHeadersOf:()=>pa,providersOf:()=>_e,routeIsDeclared:()=>nt,userProvidersOf:()=>Qt,writeModelRows:()=>br,writeProviderHeaders:()=>yr});module.exports=Bm(mx);var Nm=require("react");function rd(e,t){let n=!1,r=0,o=!1,i;return{schedule:()=>{if(o||n)return;n=!0;let a=Math.max(0,t-(Date.now()-r));i=setTimeout(()=>{i=void 0,n=!1,r=Date.now(),o||e()},a)},dispose:()=>{o=!0,i!==void 0&&clearTimeout(i),i=void 0,n=!1}}}var ye="dsh-model-think-level",od="/dsh-model-think-level/raw-models";var Zr="/dsh-model-think-level/provider-key",eo="/dsh-model-think-level/key-index",id="/dsh-model-think-level/balance",ad="/dsh-model-think-level/autofill-config",sd="/dsh-model-think-level/headers-config",Ni="/dsh-model-think-level/fingerprint",Oi="/dsh-model-think-level/ui-order";var Ce="llm-pi-ai",et="reasoningEffortsUnset",ht="inputUnset",tt="inputImageGen",vn="reasoningEffortsAutofilled",wn="defaultEffort",Ii="/dsh-model-think-level/camouflage";var Pi="/dsh-model-think-level/image-config";var _i=ye;var sr=require("react");function dd(e){let{locale:t}=e,n=(0,sr.useCallback)(o=>t.subscribe(o),[t]),r=(0,sr.useCallback)(()=>t.getSnapshot().revision??0,[t]);return(0,sr.useSyncExternalStore)(n,r),e.children()}var ld={reasoningEffort:"Reasoning effort",thinkingMode:"Thinking",thinkingModeOff:"Off \u2014 this model is declared as not reasoning.",levelsLabel:"Declared levels",levelsHint:"Click to declare; clear every level to declare nothing \u2014 requests follow the provider default.",stateDeclared:"{count} declared \xB7 default {default}",stateUndeclared:"Nothing declared \u2014 requests follow the provider default.",modalityText:"Text",autoAdapt:"Auto-adapt",autoAdaptAll:"Auto-detect thinking levels",autoAdaptWorking:"Detecting\u2026",autoAdaptDone:"Adapted {count} \xB7 save to write",autoAdaptEmpty:"All already configured",autoAdaptUnsuggested:"No suggestion available",autoAdaptBlocked:"No models to adapt yet",autoAdaptFailed:"Detection failed: {message}",autoAdaptDoneHint:"Held for {count} model(s): they land when this card is saved.",autoAdaptEmptyHint:"Every model of this provider already declares its thinking levels.",autoAdaptUnsuggestedHint:"The models that still need a declaration have no knowledge-base match \u2014 adapt them one by one.",autoAdaptBlockedHint:"Nothing to adapt yet: the card has no models, is not saved, or the settings document is read-only.",apply:"Apply",reset:"Reset",referenceTitle:"Reference capacities",contextWindowLabel:"Context window",maxTokensLabel:"Max output",capacityBlank:"Catalogue value",capacityUnitsHint:"Digits or K/M/B/T shorthand, e.g. 1,048,576 or 1M.",capacityRule:"Max output above the window is refused upstream; this check is local only.",tokensUnit:"tokens",inputModality:"Supported modalities",modalityImage:"Image",modalityImageGen:"Image generation",modalityImageGenHint:"Marked as an image generator \u2014 pick it in the composer, type a prompt, and the send goes straight to the images API.",modalityInherit:"Not declared \u2014 the provider default applies (usually text-only).",modalityDeclared:"Declared \u2014 clearing Image goes back to text only.",capacityInherit:"Empty keeps the catalogue value.",clearDeclaration:"Clear declaration",noSuggestion:"No suggestion is available for this model.",writeError:"Failed: {message}",renderFailed:"Reasoning-effort editor failed to render",wirePlaceholder:"Wire value",wireValue:"value",wireShow:"Edit wire values",wireHide:"Hide wire values",wireHint:"Empty keeps the level's conventional spelling; a non-empty off value is what gets sent when thinking is closed.",reasoningDisabled:"No reasoning-effort control declared for this model (false) \u2014 do not arm thinking levels.",bareHint:"Clearing every level removes the declaration \u2014 requests go out bare (provider default), which some relays require.",defaultRiskDisabled:"No off level: Default and provider tests send thinking: disabled, which this model rejects (e.g. 1210).",defaultRiskQwen:"No off level: Default sends enable_thinking: false \u2014 only fails where the upstream requires thinking on.",stagedHint:"Not saved yet. Staged settings are applied automatically once the model is saved.",level_off:"off",level_minimal:"minimal",level_low:"low",level_medium:"medium",level_high:"high",level_xhigh:"xhigh",level_max:"max",sliderToggleTitle:"Model and reasoning-effort rows",sliderToggleDescription:"Show the model row and the reasoning-level chips in the model menu; the levels follow the current model.",sliderToggleAria:"Enable the model and reasoning-effort rows",settingOn:"On",settingOff:"Off",sliderNoLevels:"The current model exposes no reasoning-effort levels.",triggerFallback:"Select model",effortDefault:"Default",modelRowLabel:"Model",effortRowLabel:"Reasoning level",tagVision:"Image input",tagThinking:"Sends thinking levels",tagImageGen:"Image generation model",sliderNoCurrent:"No model selected.",sliderCommitSlow:"The switch is taking too long \u2014 try again.",defaultEffortLabel:"Default effort",defaultEffortUnset:"Follow memory",defaultEffortHint:"The level new sessions start at; a level you pick by hand always wins. Empty follows memory.",followMemory:"Follow memory",clearDefaultEffort:"Clear pick",modelSearchPlaceholder:"Search models\u2026",modelSearchNoMatches:"No matching models",modelSearchClear:"Clear search",modelSearchFailed:"Model search failed to render",editorTabsLabel:"Editor sections",editorTabProvider:"Provider",editorTabModels:"Models",editorTabAdvanced:"Advanced",editorTabFingerprint:"Fingerprint",fpTitle:"Model fingerprint",fpIntro:"Only GPT and Claude models can be probed \u2014 the fingerprint library covers those two families, and models outside it never appear here.",fpCount:"{count} probeable",fpSummary:"Identified {identified} \xB7 doubtful {doubtful} \xB7 failed {failed}",fpSummaryNone:"Nothing checked yet.",fpRunning:"Checking \xB7 {done} / {total} (keeps going if you leave)",fpDetectAll:"Check all",fpDetect:"Check",fpRetest:"Re-check",fpRetry:"Retry",fpCost:"{count} prompts \xB7 about {seconds}s",fpCostMinutes:"{count} prompts \xB7 about {minutes} min",fpCostUnknown:"{count} prompts",fpForget:"Forget",fpStateUnchecked:"Not checked",fpStateRunning:"Checking \xB7 {done}/{total}",fpStateIdentified:"{model} \xB7 {probability}",fpStateDoubtful:"Doubtful \xB7 {probability}",fpStateFailed:"Check failed",fpQueued:"Queued \xB7 #{position}",fpEvidence:"{used} / {total} prompts",fpSimilarity:"Similarity",fpDetailShow:"Show result",fpDetailHide:"Hide result",fpFamily:"Family",fpChallengeCounted:"Q{index} {numbers} \xB7 counted",fpChallengeRejected:"Q{index} {parsed}/{numbers} \xB7 not counted",fpChallengeSkipped:"Q{index} {numbers} \xB7 early stop",fpChallengeTitle:"How each of the three prompts settled. The number is how many integers the prompt asked for; a slash means it asked for the right-hand count and answered only the left. A prompt only counts when it returns at least max(80, 55% of what it asked).",fpCandidates:"Closest candidates",fpClosedSet:"Closed-set result: a model outside the library is still attributed to the nearest listed one. Read it as a comparison, not a certificate.",fpCheckedAt:"Checked {time}",fpTiming:"Timing: first token {first}s \xB7 total {total}s \xB7 ~{rate} chars/s",fpLoadFailed:"Could not read the stored verdicts: {error}",fpRunFailed:"Check failed: {error}",keyRevealShow:"Show key",keyRevealHide:"Hide key",keyRevealFailed:"Stored key unavailable",keysLoading:"Loading keys\u2026",keysAdd:"Add another key",keysAddConfirm:"Add",keysEnable:"Enable {name}",keysDisable:"Disable {name}",keysMissing:"Not stored",keysEdit:"Edit",keysRemove:"Delete",keysConfirmRemove:"Confirm delete",keysCancel:"Cancel",keysSave:"Save",keysAlias:"Label",keysAliasPlaceholder:"Name (optional), e.g. Team",keysValue:"Key",keysValuePlaceholder:"Paste the API key",keysNewValuePlaceholder:"Paste the new API key",keysAddIllegal:"A key is printable ASCII without spaces.",keysAdded:"Key stored.",keysRenamed:"Label saved.",keysReplaced:"Key replaced.",keysRemoved:"Key removed.",keysCopy:"Copy {name}",keysCopied:"Key copied.",keysCopyFailed:"Could not copy the key.",keysScope:"Models served by {name}",keysModels:"Models",keysScopeAll:"All models",keysScopeNone:"No models found",keysScopeCount:"{count} models",keysScopeSaved:"Model scope saved.",keysScopeHint:"Only the ticked models use this key; the rest go to the provider's other keys.",keysScopeAutoHint:"This scope was written by the auto-probe from the models this key actually lists; every sweep re-checks it.",keysProbe:"Auto-probe",keysProbing:"Probing\u2026",keysProbeHint:`Ask every key what it actually serves, then keep each key to the models it shares with this provider's list. A key that serves every added model keeps "All models"; a key that serves none of them is switched off.`,keysProbeSingle:"One key has nothing to divide \u2014 add a second key first.",keysProbeDone:"Probe finished \u2014 scopes checked against what each key serves.",keysScopeEmpty:"This provider has no models yet. Add models first, then pick them here.",keysProtocolLabel:"Protocol for {name}",keysProtocolCreate:"Protocol",keysProtocolCreateHint:"The wire this key signs with; the addresses the provider has configured decide which families are offered.",keysProtocolDefault:"Auto (per model)",keysProtocolDefaultHint:"Picks each model\u2019s own wire: claude models use the Anthropic address, the rest the provider\u2019s protocol (where that address is configured).",keysProtocolAnthropic:"Anthropic",keysProtocolAnthropicHint:"Anthropic API \xB7 Claude models",keysProtocolOpenAI:"Chat Completions",keysProtocolOpenAIHint:"OpenAI API \xB7 GPT models, most agents",keysProtocolResponses:"Responses",keysProtocolResponsesHint:"OpenAI API \xB7 Codex",keysProtocolShortChat:"Chat",keysProtocolShortResponses:"Responses",keysProtocolShortAnthropic:"Anthropic",keysProtocolSaved:"Protocol saved.",keysEndpointOpenAI:"OpenAI",keysEndpointAnthropic:"Anthropic",keysEndpointBalance:"Balance",keysEndpointBalanceHint:"Read-only endpoint queried for this provider\u2019s balance; the first API key is sent along.",keysMoreEndpoints:"More endpoints",keysEndpointsCount:"{count} more",keysEndpointInvalid:"The address must start with http:// or https://",keysUnreachable:"The plugin\u2019s key route did not answer.",keysPanelFailed:"Key manager failed to render",keysDraftHint:"Held by this page and stored when the provider is created \u2014 a reload discards them, exactly like the card\u2019s own fields.",keysLastEnabledOff:"The last enabled key cannot be switched off.",headersTitle:"Request headers",headersHint:"Sent on every request of this route.",camouflageTitle:"Request disguise",camouflageHint:"Sends this route\u2019s requests as the official CLI of the vendor you pick: its client headers, and for Claude the identity system prompt and user id its validator looks for. Off by default.",camouflageOff:"Off",camouflageCodex:"Codex",camouflageClaude:"Claude",camouflageSaved:"Disguise saved.",camouflageError:"The plugin\u2019s disguise endpoint did not answer.",camouflageUnavailable:"The request interception is not installed, so this switch has no effect.",headersEmpty:"No extra request headers are configured.",headersAdd:"Add header",headersName:"Name",headersNamePlaceholder:"e.g. x-company",headersValue:"Value",headersEdit:"Edit",headersSave:"Save",headersCancel:"Cancel",headersClear:"Clear all",headersRemove:"Remove header",headersSaved:"Saved.",headersCleared:"Cleared \u2014 this route sends no extra request headers.",headersReadOnly:"The settings document is not writable.",headersConflictOrigin:"Routes sharing one endpoint declare different request-header values: when the model in a request body does not identify exactly one of them, that request falls back to the first route.",headersConflictPatched:"The installed dsh-llm-pi-ai already carries a request-header patch: enter values in the headers above and this plugin need not take the request layer over.",headersConflictSiblings:"A plugin rewriting the same layer is installed: {names}. Only one user-agent rewrite should be active at a time, or the last writer on the wire wins.",headersError:"Save failed: {error}",headersNoRoute:"This route is no longer in the settings document \u2014 save the official card once first.",providerReorderAria:"Reorder {provider}",providerReorderHint:"Drag to set the provider order \u2014 the model switcher follows it.",providerToggleAria:"Enable {provider}",providerToggleHint:"A disabled provider is not listed by the model switcher.",providerBalanceLabel:"Balance",providerBalanceHint:"Fetched from this provider\u2019s balance endpoint.",providerBalanceRefresh:"Refresh balance",providerBalanceUnavailable:"Balance \u2014",providerDisabledGroupShow:"Show {count} switched-off provider(s)",providerDisabledGroupHide:"Hide {count} switched-off provider(s)",providerDisabledGroupHint:"A switched-off provider keeps its configuration and folds away here \u2014 unfold it to switch it back on.",providerRemoveDisabled:"Delete",providerRemoveLocked:"A built-in provider cannot be deleted.",modelReorderAria:"Reorder {model}",modelReorderHint:"Drag to set the order of this provider\u2019s models \u2014 the model switcher follows it.",configButton:"Advanced settings",configButtonHint:"Open advanced settings",configPaneTitle:"Advanced settings",configPaneClose:"Close",configPaneFailed:"Config pane failed to render",imagegenSectionTitle:"Image generation",imagegenEnable:"Enable image generation",cardStateOn:"On",cardStateOff:"Off",imagegenEnabledHint:"Allow the image-generation tool. Expand to configure the model and image parameters.",imagegenDisabledHint:"The image-generation tool is off. Your model and image settings are kept.",imagegenExpand:"Configure image generation",imagegenCollapse:"Collapse image-generation settings",imagegenSaving:"Saving\u2026",imagegenRefreshFailed:"Saved, but could not refresh the configuration: {error}",imagegenLoading:"Loading\u2026",imagegenLoadFailed:"Could not read the image config",imagegenDefaultsLabel:"Defaults",imagegenDefaultModelLabel:"Default model",imagegenDefaultModelNone:"Not set",imagegenSizeLabel:"Size",imagegenQualityLabel:"Quality",imagegenCountLabel:"Count",imagegenTimeoutLabel:"Timeout",imagegenTimeoutMinutes:"{minutes} min",imagegenTimeoutHint:"The per-request cap; every retry of the parameter fallback chain gets this budget too.",imagegenCardRunning:"Generating image\u2026",imagegenToolMissing:"The built-in image tool is not registered, so a model cannot call it.",imagegenToolMissingWhy:"Host said: {reason}",autoContinueSectionTitle:"Auto-continue",autoContinueExpand:"Configure auto-continue",autoContinueCollapse:"Collapse auto-continue settings",autoContinueTitle:"Continue interrupted turns",autoContinueDescription:"When a turn is cut off by a disconnect, a timeout or the output limit, reply \u201CContinue\u201D automatically. Clean finishes, your own stops and auth or quota errors are left alone.",autoContinueHint:"Wait {seconds}s after a failure \xB7 Up to {count} retries",autoContinueWaitLabel:"Wait after failure",autoContinueRetriesLabel:"Retry limit",autoContinueSecondsUnit:"s",autoContinueRetriesUnit:"retries",autoContinueConfigHint:"Whole numbers: {waitMin}\u2013{waitMax} seconds, {retriesMin}\u2013{retriesMax} retries. Saved when you leave the field or press Enter. After every failure, wait this long before sending \u201CContinue\u201D; a longer provider-requested delay wins.",autoContinueAria:"Enable auto-continue",autoContinueMessage:"Continue"},cd={reasoningEffort:"\u601D\u8003\u5F3A\u5EA6",thinkingMode:"\u601D\u8003",thinkingModeOff:"\u5DF2\u5173\u95ED\u2014\u2014\u8BE5\u6A21\u578B\u58F0\u660E\u4E3A\u4E0D\u601D\u8003\u3002",levelsLabel:"\u652F\u6301\u6863\u4F4D",levelsHint:"\u70B9\u9009\u5373\u58F0\u660E\uFF1B\u5168\u90E8\u53D6\u6D88\u5219\u4E0D\u58F0\u660E\uFF0C\u8BF7\u6C42\u6309\u4F9B\u5E94\u5546\u9ED8\u8BA4\u53D1\u9001\u3002",stateDeclared:"\u5DF2\u58F0\u660E {count} \u6863 \xB7 \u9ED8\u8BA4 {default}",stateUndeclared:"\u672A\u58F0\u660E\u2014\u2014\u8BF7\u6C42\u6309\u4F9B\u5E94\u5546\u9ED8\u8BA4\u53D1\u9001\u3002",modalityText:"\u6587\u672C",autoAdapt:"\u81EA\u52A8\u9002\u914D",autoAdaptAll:"\u81EA\u52A8\u83B7\u53D6\u601D\u8003\u7B49\u7EA7",autoAdaptWorking:"\u83B7\u53D6\u4E2D\u2026",autoAdaptDone:"\u5DF2\u9002\u914D {count} \u4E2A\xB7\u4FDD\u5B58\u540E\u5199\u5165",autoAdaptEmpty:"\u5DF2\u5168\u90E8\u914D\u7F6E",autoAdaptUnsuggested:"\u6CA1\u6709\u53EF\u7528\u5EFA\u8BAE",autoAdaptBlocked:"\u6682\u65E0\u53EF\u9002\u914D\u6A21\u578B",autoAdaptFailed:"\u83B7\u53D6\u5931\u8D25\uFF1A{message}",autoAdaptDoneHint:"\u5DF2\u6682\u5B58 {count} \u4E2A\u6A21\u578B\u7684\u9002\u914D\u7ED3\u679C\uFF1A\u70B9\u8BE5\u5361\u7247\u7684\u300C\u4FDD\u5B58\u300D\u540E\u5199\u5165\u3002",autoAdaptEmptyHint:"\u8BE5\u4F9B\u5E94\u5546\u4E0B\u6240\u6709\u6A21\u578B\u90FD\u5DF2\u58F0\u660E\u601D\u8003\u7B49\u7EA7\u3002",autoAdaptUnsuggestedHint:"\u4ECD\u9700\u58F0\u660E\u7684\u6A21\u578B\u6CA1\u6709\u77E5\u8BC6\u5E93\u5339\u914D\u2014\u2014\u8BF7\u9010\u4E2A\u6253\u5F00\u6A21\u578B\u884C\u624B\u52A8\u9002\u914D\u3002",autoAdaptBlockedHint:"\u6682\u65E0\u53EF\u9002\u914D\u5185\u5BB9\uFF1A\u8BE5\u5361\u7247\u8FD8\u6CA1\u6709\u6A21\u578B\u3001\u5C1A\u672A\u4FDD\u5B58\uFF0C\u6216\u5F53\u524D\u8BBE\u7F6E\u6587\u6863\u4E0D\u53EF\u5199\u5165\u3002",apply:"\u5E94\u7528",reset:"\u653E\u5F03\u4FEE\u6539",referenceTitle:"\u53C2\u8003\u5BB9\u91CF",contextWindowLabel:"\u4E0A\u4E0B\u6587\u7A97\u53E3",maxTokensLabel:"\u6700\u5927\u8F93\u51FA",capacityBlank:"\u6CBF\u7528\u76EE\u5F55\u503C",capacityUnitsHint:"\u53EF\u586B\u6570\u5B57\u6216 K/M/B/T \u7B80\u5199\uFF0C\u4F8B\u5982 1,048,576 \u6216 1M\u3002",capacityRule:"\u6700\u5927\u8F93\u51FA\u8D85\u8FC7\u7A97\u53E3\u4F1A\u88AB\u4E0A\u6E38\u62D2\u7EDD\uFF0C\u8FD9\u91CC\u53EA\u505A\u672C\u5730\u6821\u9A8C\u3002",tokensUnit:"tokens",inputModality:"\u652F\u6301\u6A21\u6001",modalityImage:"\u56FE\u7247",modalityImageGen:"\u751F\u56FE",modalityImageGenHint:"\u5DF2\u6807\u8BB0\u4E3A\u751F\u56FE\u6A21\u578B\u2014\u2014\u5728\u5BF9\u8BDD\u6846\u9009\u4E2D\u5B83\u540E\u76F4\u63A5\u8F93\u5165\u63D0\u793A\u8BCD\u53D1\u9001\uFF0C\u5373\u8D70\u56FE\u7247\u63A5\u53E3\u751F\u6210\u56FE\u7247\u3002",modalityInherit:"\u672A\u58F0\u660E\u2014\u2014\u7EE7\u627F\u63D0\u4F9B\u65B9\u9ED8\u8BA4\uFF08\u901A\u5E38\u4EC5\u6587\u672C\uFF09\u3002",modalityDeclared:"\u5DF2\u58F0\u660E\u2014\u2014\u53D6\u6D88\u300C\u56FE\u7247\u300D\u5373\u56DE\u5230\u4EC5\u6587\u672C\u3002",capacityInherit:"\u7559\u7A7A\uFF1D\u6CBF\u7528\u6A21\u578B\u76EE\u5F55\u91CC\u7684\u503C\u3002",clearDeclaration:"\u6E05\u9664\u58F0\u660E",noSuggestion:"\u6CA1\u6709\u9002\u7528\u4E8E\u8BE5\u6A21\u578B\u7684\u5EFA\u8BAE\u3002",writeError:"\u5199\u5165\u5931\u8D25\uFF1A{message}",renderFailed:"\u601D\u8003\u5F3A\u5EA6\u7F16\u8F91\u5668\u6E32\u67D3\u5931\u8D25",wirePlaceholder:"\u7EBF\u4E0A\u53D6\u503C",wireValue:"\u53D6\u503C",wireShow:"\u7F16\u8F91\u7EBF\u4E0A\u53D6\u503C",wireHide:"\u6536\u8D77\u7EBF\u4E0A\u53D6\u503C",wireHint:"\u7559\u7A7A\uFF1D\u6CBF\u7528\u8BE5\u6863\u4F4D\u7684\u7EA6\u5B9A\u62FC\u5199\uFF1Boff \u6863\u586B\u4E86\u975E\u7A7A\u503C\uFF0C\u5C31\u4F1A\u5728\u5173\u95ED\u601D\u8003\u65F6\u53D1\u9001\u8FD9\u4E00\u6BB5\u3002",reasoningDisabled:"\u8BE5\u6A21\u578B\u58F0\u660E\u4E3A\u65E0 reasoning-effort \u63A7\u5236\uFF08false\uFF09\u2014\u2014\u8BF7\u52FF\u52FE\u9009\u601D\u8003\u6863\u3002",bareHint:"\u5168\u90E8\u53D6\u6D88\u5E76\u4FDD\u5B58\u5C06\u6E05\u9664\u58F0\u660E\u2014\u2014\u8BF7\u6C42\u4EE5\u88F8\u683C\u5F0F\u53D1\u51FA\uFF08\u8D70\u63D0\u4F9B\u65B9\u9ED8\u8BA4\uFF09\uFF0C\u90E8\u5206\u4E2D\u8F6C\u7AD9\u9700\u8981\u8FD9\u6837\u3002",defaultRiskDisabled:"\u65E0 off \u6863\uFF1ADefault \u4E0E\u63D0\u4F9B\u5546\u6D4B\u8BD5\u4F1A\u53D1\u9001 thinking: disabled\uFF0C\u8BE5\u6A21\u578B\u4F1A\u62A5\u9519\uFF08\u5982 1210\uFF09\u3002",defaultRiskQwen:"\u65E0 off \u6863\uFF1ADefault \u4F1A\u53D1\u9001 enable_thinking: false\u2014\u2014\u4EC5\u5728\u4E0A\u6E38\u8981\u6C42\u5F00\u542F\u601D\u8003\u65F6\u624D\u4F1A\u5931\u8D25\u3002",stagedHint:"\u5C1A\u672A\u4FDD\u5B58\u3002\u6682\u5B58\u7684\u914D\u7F6E\u5C06\u5728\u8BE5\u6A21\u578B\u4FDD\u5B58\u540E\u81EA\u52A8\u5E94\u7528\u3002",level_off:"off",level_minimal:"minimal",level_low:"low",level_medium:"medium",level_high:"high",level_xhigh:"xhigh",level_max:"max",sliderToggleTitle:"\u6A21\u578B\u4E0E\u601D\u8003\u7B49\u7EA7\u884C",sliderToggleDescription:"\u5728\u6A21\u578B\u83DC\u5355\u4E2D\u663E\u793A\u6A21\u578B\u884C\u4E0E\u601D\u8003\u7B49\u7EA7\u6807\u7B7E\uFF0C\u6863\u4F4D\u968F\u5F53\u524D\u6A21\u578B\u81EA\u52A8\u9002\u914D",sliderToggleAria:"\u542F\u7528\u6A21\u578B\u4E0E\u601D\u8003\u7B49\u7EA7\u884C",settingOn:"\u542F\u7528",settingOff:"\u505C\u7528",sliderNoLevels:"\u5F53\u524D\u6A21\u578B\u672A\u63D0\u4F9B\u601D\u8003\u5F3A\u5EA6\u6863\u4F4D",triggerFallback:"\u9009\u62E9\u6A21\u578B",effortDefault:"\u9ED8\u8BA4",modelRowLabel:"\u6A21\u578B",effortRowLabel:"\u601D\u8003\u7B49\u7EA7",tagVision:"\u652F\u6301\u56FE\u7247\u8F93\u5165",tagThinking:"\u652F\u6301\u601D\u8003\u7B49\u7EA7",tagImageGen:"\u751F\u56FE\u6A21\u578B",sliderNoCurrent:"\u5F53\u524D\u65E0\u9009\u62E9\u4E2D\u7684\u6A21\u578B\u3002",sliderCommitSlow:"\u5207\u6362\u8D85\u65F6\u2014\u2014\u8BF7\u91CD\u8BD5\u3002",defaultEffortLabel:"\u9ED8\u8BA4\u601D\u8003\u5F3A\u5EA6",defaultEffortUnset:"\u8DDF\u968F\u8BB0\u5FC6",defaultEffortHint:"\u65B0\u4F1A\u8BDD\u7684\u8D77\u59CB\u6863\u4F4D\uFF1B\u4F1A\u8BDD\u5185\u624B\u52A8\u9009\u62E9\u59CB\u7EC8\u4F18\u5148\u3002\u7559\u7A7A\u5219\u8DDF\u968F\u8BB0\u5FC6\u94FE\u3002",followMemory:"\u8DDF\u968F\u8BB0\u5FC6",clearDefaultEffort:"\u6E05\u9664\u9009\u62E9",modelSearchPlaceholder:"\u641C\u7D22\u6A21\u578B\u2026",modelSearchNoMatches:"\u672A\u627E\u5230\u5339\u914D\u6A21\u578B",modelSearchClear:"\u6E05\u7A7A\u641C\u7D22",modelSearchFailed:"\u6A21\u578B\u641C\u7D22\u6E32\u67D3\u5931\u8D25",editorTabsLabel:"\u7F16\u8F91\u5668\u5206\u533A",editorTabProvider:"\u4F9B\u5E94\u5546\u914D\u7F6E",editorTabModels:"\u6A21\u578B\u914D\u7F6E",editorTabAdvanced:"\u9AD8\u7EA7\u914D\u7F6E",editorTabFingerprint:"\u6307\u7EB9\u68C0\u6D4B",fpTitle:"\u6A21\u578B\u6307\u7EB9",fpIntro:"\u53EA\u6709 GPT \u4E0E Claude \u7CFB\u5217\u6A21\u578B\u53EF\u68C0\u6D4B\u2014\u2014\u6307\u7EB9\u5E93\u53EA\u8986\u76D6\u8FD9\u4E24\u4E2A\u5BB6\u65CF\uFF0C\u4E0D\u5728\u6B64\u5217\u7684\u6A21\u578B\u4E0D\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\u3002",fpCount:"{count} \u4E2A\u53EF\u68C0\u6D4B",fpSummary:"\u5DF2\u8BC6\u522B {identified} \xB7 \u5B58\u7591 {doubtful} \xB7 \u5931\u8D25 {failed}",fpSummaryNone:"\u5C1A\u672A\u68C0\u6D4B\u3002",fpRunning:"\u6B63\u5728\u68C0\u6D4B \xB7 {done} / {total}\uFF08\u5207\u8D70\u4E5F\u4F1A\u7EE7\u7EED\uFF09",fpDetectAll:"\u68C0\u6D4B\u5168\u90E8",fpDetect:"\u68C0\u6D4B",fpRetest:"\u91CD\u6D4B",fpRetry:"\u91CD\u8BD5",fpCost:"{count} \u9898 \xB7 \u7EA6 {seconds} \u79D2",fpCostMinutes:"{count} \u9898 \xB7 \u7EA6 {minutes} \u5206\u949F",fpCostUnknown:"{count} \u9898",fpForget:"\u5FD8\u6389",fpStateUnchecked:"\u672A\u68C0\u6D4B",fpStateRunning:"\u68C0\u6D4B\u4E2D \xB7 {done}/{total}",fpStateIdentified:"{model} \xB7 {probability}",fpStateDoubtful:"\u5B58\u7591 \xB7 {probability}",fpStateFailed:"\u68C0\u6D4B\u5931\u8D25",fpQueued:"\u6392\u961F \xB7 \u7B2C {position} \u4E2A",fpEvidence:"{used} / {total} \u9898",fpSimilarity:"\u76F8\u4F3C\u5EA6",fpDetailShow:"\u5C55\u5F00\u7ED3\u679C",fpDetailHide:"\u6536\u8D77\u7ED3\u679C",fpFamily:"\u5BB6\u65CF",fpChallengeCounted:"\u9898{index} {numbers} \u4E2A \xB7 \u8BA1\u5165",fpChallengeRejected:"\u9898{index} {parsed}/{numbers} \xB7 \u672A\u8BA1\u5165",fpChallengeSkipped:"\u9898{index} {numbers} \u4E2A \xB7 \u65E9\u505C",fpChallengeTitle:"\u4E09\u9053\u9898\u5404\u81EA\u7684\u843D\u70B9\u3002\u6570\u5B57\u662F\u8FD9\u9898\u8981\u6C42\u7684\u6574\u6570\u4E2A\u6570\uFF1B\u6709\u659C\u6760\u65F6\uFF0C\u53F3\u8FB9\u662F\u8981\u6C42\u6570\u3001\u5DE6\u8FB9\u662F\u5B9E\u9645\u7B54\u56DE\u7684\u4E2A\u6570\u3002\u7B54\u56DE\u4E0D\u5230 max(80, \u8981\u6C42\u6570\u7684 55%) \u5C31\u4E0D\u8BA1\u5165\u3002",fpCandidates:"\u6700\u63A5\u8FD1\u7684\u5019\u9009",fpClosedSet:"\u95ED\u96C6\u7ED3\u8BBA\uFF1A\u4E0D\u5728\u5E93\u91CC\u7684\u6A21\u578B\u4ECD\u4F1A\u88AB\u5F52\u7ED9\u6700\u63A5\u8FD1\u7684\u90A3\u4E2A\u3002\u8BF7\u5F53\u6210\u4E00\u6B21\u6BD4\u5BF9\uFF0C\u4E0D\u662F\u8BC1\u660E\u3002",fpCheckedAt:"\u68C0\u6D4B\u4E8E {time}",fpTiming:"\u8017\u65F6\uFF1A\u9996\u5B57 {first} \u79D2 \xB7 \u603B\u8BA1 {total} \u79D2 \xB7 \u5410\u5B57\u7EA6 {rate} \u5B57\u7B26/\u79D2",fpLoadFailed:"\u8BFB\u4E0D\u5230\u5DF2\u5B58\u7ED3\u8BBA\uFF1A{error}",fpRunFailed:"\u68C0\u6D4B\u5931\u8D25\uFF1A{error}",keyRevealShow:"\u663E\u793A\u5BC6\u94A5",keyRevealHide:"\u9690\u85CF\u5BC6\u94A5",keyRevealFailed:"\u65E0\u6CD5\u8BFB\u53D6\u5DF2\u4FDD\u5B58\u7684\u5BC6\u94A5",keysLoading:"\u6B63\u5728\u8BFB\u53D6\u5BC6\u94A5\u2026",keysAdd:"\u6DFB\u52A0\u53E6\u4E00\u4E2A\u5BC6\u94A5",keysAddConfirm:"\u6DFB\u52A0",keysEnable:"\u542F\u7528 {name}",keysDisable:"\u505C\u7528 {name}",keysMissing:"\u672A\u5B58\u50A8",keysEdit:"\u4FEE\u6539",keysRemove:"\u5220\u9664",keysConfirmRemove:"\u786E\u8BA4\u5220\u9664",keysCancel:"\u53D6\u6D88",keysSave:"\u4FDD\u5B58",keysAlias:"\u522B\u540D",keysAliasPlaceholder:"\u540D\u79F0\uFF08\u53EF\u9009\uFF09\uFF0C\u4F8B\u5982 \u56E2\u961F",keysValue:"\u5BC6\u94A5",keysValuePlaceholder:"\u7C98\u8D34 API \u5BC6\u94A5",keysNewValuePlaceholder:"\u7C98\u8D34\u65B0\u7684 API \u5BC6\u94A5",keysAddIllegal:"\u5BC6\u94A5\u53EA\u80FD\u662F\u53EF\u6253\u5370 ASCII \u5B57\u7B26\uFF0C\u4E14\u4E0D\u80FD\u5305\u542B\u7A7A\u683C\u3002",keysAdded:"\u5DF2\u4FDD\u5B58\u5BC6\u94A5\u3002",keysRenamed:"\u5DF2\u4FDD\u5B58\u522B\u540D\u3002",keysReplaced:"\u5DF2\u66FF\u6362\u5BC6\u94A5\u3002",keysRemoved:"\u5DF2\u5220\u9664\u5BC6\u94A5\u3002",keysCopy:"\u590D\u5236 {name}",keysCopied:"\u5DF2\u590D\u5236\u5BC6\u94A5\u3002",keysCopyFailed:"\u65E0\u6CD5\u590D\u5236\u5BC6\u94A5\u3002",keysScope:"{name} \u63D0\u4F9B\u670D\u52A1\u7684\u6A21\u578B",keysModels:"\u6A21\u578B",keysScopeAll:"\u5168\u90E8\u6A21\u578B",keysScopeNone:"\u672A\u53D1\u73B0\u6A21\u578B",keysScopeCount:"{count} \u4E2A\u6A21\u578B",keysScopeSaved:"\u5DF2\u4FDD\u5B58\u6A21\u578B\u8303\u56F4\u3002",keysScopeHint:"\u53EA\u6709\u9009\u4E2D\u7684\u6A21\u578B\u4F1A\u7528\u8FD9\u4E2A Key\uFF0C\u5176\u4ED6\u6A21\u578B\u4EA4\u7ED9\u8BE5\u4F9B\u5E94\u5546\u7684\u5176\u4ED6 Key\u3002",keysScopeAutoHint:"\u8FD9\u4E2A\u8303\u56F4\u7531\u81EA\u52A8\u63A2\u6D4B\u6309\u8FD9\u628A\u5BC6\u94A5\u5B9E\u9645\u63D0\u4F9B\u7684\u6A21\u578B\u5199\u5165\uFF0C\u6BCF\u6B21\u63A2\u6D4B\u90FD\u4F1A\u91CD\u65B0\u6821\u51C6\u3002",keysProbe:"\u81EA\u52A8\u63A2\u6D4B",keysProbing:"\u63A2\u6D4B\u4E2D\u2026",keysProbeHint:"\u63A2\u6D4B\u6BCF\u628A\u5BC6\u94A5\u5B9E\u9645\u63D0\u4F9B\u54EA\u4E9B\u6A21\u578B\uFF0C\u628A\u6BCF\u628A\u5BC6\u94A5\u9650\u5B9A\u5728\u5B83\u4E0E\u672C\u4F9B\u5E94\u5546\u6A21\u578B\u5217\u8868\u7684\u4EA4\u96C6\u4E0A\uFF1A\u80FD\u63D0\u4F9B\u5168\u90E8\u5DF2\u6DFB\u52A0\u6A21\u578B\u65F6\u4FDD\u6301\u201C\u5168\u90E8\u6A21\u578B\u201D\uFF0C\u4E00\u4E2A\u90FD\u4E0D\u63D0\u4F9B\u65F6\u5173\u95ED\u8FD9\u628A\u5BC6\u94A5\u3002",keysProbeSingle:"\u53EA\u6709\u4E00\u4E2A\u5BC6\u94A5\uFF0C\u65E0\u9700\u63A2\u6D4B\u2014\u2014\u5148\u6DFB\u52A0\u7B2C\u4E8C\u4E2A\u5BC6\u94A5\u3002",keysProbeDone:"\u63A2\u6D4B\u5B8C\u6210\uFF0C\u5DF2\u6309\u5404\u5BC6\u94A5\u5B9E\u9645\u652F\u6301\u7684\u6A21\u578B\u52FE\u9009\u3002",keysScopeEmpty:"\u8BE5\u4F9B\u5E94\u5546\u8FD8\u6CA1\u6709\u6A21\u578B\u3002\u8BF7\u5148\u6DFB\u52A0\u6A21\u578B\uFF0C\u518D\u6765\u8FD9\u91CC\u9009\u62E9\u3002",keysProtocolLabel:"{name} \u4F7F\u7528\u7684\u534F\u8BAE",keysProtocolCreate:"\u534F\u8BAE",keysProtocolCreateHint:"\u8FD9\u628A\u5BC6\u94A5\u8981\u8D70\u7684\u534F\u8BAE\uFF1B\u53EF\u9009\u54EA\u4E9B\u53D6\u51B3\u4E8E\u4F9B\u5E94\u5546\u5DF2\u914D\u7F6E\u7684\u7AEF\u70B9\u5730\u5740\u3002",keysProtocolDefault:"\u81EA\u52A8\uFF08\u6309\u6A21\u578B\uFF09",keysProtocolDefaultHint:"\u6309\u6A21\u578B\u81EA\u52A8\u9009\u62E9\u534F\u8BAE\uFF1Aclaude \u7CFB\u6A21\u578B\u8D70 Anthropic \u5730\u5740\uFF0C\u5176\u4F59\u6CBF\u7528\u8BE5\u4F9B\u5E94\u5546\u81EA\u5E26\u7684\u534F\u8BAE\uFF08\u9700\u5DF2\u914D\u7F6E\u5BF9\u5E94\u5730\u5740\uFF09",keysProtocolAnthropic:"Anthropic",keysProtocolAnthropicHint:"Anthropic API \xB7 Claude \u6A21\u578B",keysProtocolOpenAI:"Chat Completions",keysProtocolOpenAIHint:"OpenAI API \xB7 GPT \u6A21\u578B\u3001\u5927\u591A\u6570 agent",keysProtocolResponses:"Responses",keysProtocolResponsesHint:"OpenAI API \xB7 Codex",keysProtocolShortChat:"Chat",keysProtocolShortResponses:"Responses",keysProtocolShortAnthropic:"Anthropic",keysProtocolSaved:"\u5DF2\u4FDD\u5B58\u534F\u8BAE\u3002",keysEndpointOpenAI:"OpenAI",keysEndpointAnthropic:"Anthropic",keysEndpointBalance:"\u4F59\u989D",keysEndpointBalanceHint:"\u53EA\u8BFB\u63A5\u53E3\uFF1A\u7528\u4E8E\u8BFB\u53D6\u8BE5\u4F9B\u5E94\u5546\u4F59\u989D\uFF0C\u4F1A\u5E26\u4E0A\u5BC6\u94A5\u5217\u8868\u4E2D\u7684\u7B2C\u4E00\u628A\u5BC6\u94A5\u3002",keysMoreEndpoints:"\u66F4\u591A\u7AEF\u70B9",keysEndpointsCount:"\u53E6\u6709 {count} \u4E2A",keysEndpointInvalid:"\u5730\u5740\u9700\u4EE5 http:// \u6216 https:// \u5F00\u5934",keysUnreachable:"\u63D2\u4EF6\u7684\u5BC6\u94A5\u63A5\u53E3\u6CA1\u6709\u54CD\u5E94\u3002",keysPanelFailed:"\u5BC6\u94A5\u7BA1\u7406\u9762\u677F\u6E32\u67D3\u5931\u8D25",keysDraftHint:"\u5BC6\u94A5\u6682\u5B58\u5728\u672C\u9875\uFF0C\u521B\u5EFA\u4F9B\u5E94\u5546\u540E\u81EA\u52A8\u4FDD\u5B58\uFF1B\u5237\u65B0\u9875\u9762\u4F1A\u4E22\u5F03\uFF0C\u4E0E\u5361\u7247\u81EA\u8EAB\u8868\u5355\u4E00\u81F4\u3002",keysLastEnabledOff:"\u4E0D\u80FD\u505C\u7528\u6700\u540E\u4E00\u628A\u542F\u7528\u4E2D\u7684\u5BC6\u94A5\u3002",headersTitle:"\u8BF7\u6C42\u5934",headersHint:"\u8BE5\u8DEF\u7531\u7684\u6BCF\u4E2A\u8BF7\u6C42\u90FD\u4F1A\u643A\u5E26\u81EA\u5B9A\u4E49\u8BF7\u6C42\u5934\u3002",camouflageTitle:"\u8BF7\u6C42\u4F2A\u88C5",camouflageHint:"\u8BA9\u8BE5\u8DEF\u7531\u7684\u8BF7\u6C42\u4EE5\u6240\u9009\u5382\u5546\u5B98\u65B9 CLI \u7684\u8EAB\u4EFD\u53D1\u51FA\uFF1A\u643A\u5E26\u5176\u5BA2\u6237\u7AEF\u8BF7\u6C42\u5934\uFF0CClaude \u9884\u8BBE\u8FD8\u4F1A\u8865\u4E0A\u5BF9\u5E94\u6821\u9A8C\u6240\u9700\u7684\u8EAB\u4EFD\u7CFB\u7EDF\u63D0\u793A\u4E0E user_id\u3002\u9ED8\u8BA4\u5173\u95ED\u3002",camouflageOff:"\u5173\u95ED",camouflageCodex:"Codex",camouflageClaude:"Claude",camouflageSaved:"\u5DF2\u4FDD\u5B58\u4F2A\u88C5\u3002",camouflageError:"\u63D2\u4EF6\u7684\u4F2A\u88C5\u63A5\u53E3\u6CA1\u6709\u54CD\u5E94\u3002",camouflageUnavailable:"\u8BF7\u6C42\u62E6\u622A\u672A\u5B89\u88C5\uFF0C\u6B64\u5F00\u5173\u4E0D\u4F1A\u751F\u6548\u3002",headersEmpty:"\u5C1A\u672A\u914D\u7F6E\u989D\u5916\u8BF7\u6C42\u5934\u3002",headersAdd:"\u6DFB\u52A0\u8BF7\u6C42\u5934",headersName:"\u540D\u79F0",headersNamePlaceholder:"\u4F8B\u5982 x-company",headersValue:"\u503C",headersEdit:"\u7F16\u8F91",headersSave:"\u4FDD\u5B58",headersCancel:"\u53D6\u6D88",headersClear:"\u5168\u90E8\u6E05\u7A7A",headersRemove:"\u5220\u9664\u8BF7\u6C42\u5934",headersSaved:"\u5DF2\u4FDD\u5B58\u3002",headersCleared:"\u5DF2\u6E05\u7A7A\u2014\u2014\u8BE5\u8DEF\u7531\u4E0D\u518D\u643A\u5E26\u989D\u5916\u8BF7\u6C42\u5934\u3002",headersReadOnly:"\u5F53\u524D\u8BBE\u7F6E\u6587\u6863\u4E0D\u53EF\u5199\u5165\u3002",headersConflictOrigin:"\u540C\u4E00\u4E2A endpoint \u4E0A\u6709\u591A\u4E2A\u8DEF\u7531\u914D\u7F6E\u4E86\u4E0D\u540C\u7684\u8BF7\u6C42\u5934\u503C\uFF1A\u5F53\u8BF7\u6C42\u4F53\u91CC\u7684\u6A21\u578B\u65E0\u6CD5\u552F\u4E00\u5B9A\u4F4D\u5176\u4E2D\u4E00\u4E2A\u8DEF\u7531\u65F6\uFF0C\u8BE5\u8BF7\u6C42\u56DE\u9000\u5230\u7B2C\u4E00\u4E2A\u8DEF\u7531\u7684\u914D\u7F6E\u3002",headersConflictPatched:"\u68C0\u6D4B\u5230\u5B98\u65B9 dsh-llm-pi-ai \u5DF2\u5728\u8BF7\u6C42\u5C42\u5904\u7406\u8BF7\u6C42\u5934\uFF1A\u628A\u503C\u586B\u5728\u4E0A\u65B9\u8BF7\u6C42\u5934\u914D\u7F6E\u4E2D\u5373\u53EF\uFF0C\u65E0\u9700\u91CD\u590D\u63A5\u7BA1\u3002",headersConflictSiblings:"\u68C0\u6D4B\u5230\u4F1A\u6539\u5199\u540C\u4E00\u5C42\u7684\u540C\u7C7B\u63D2\u4EF6\uFF1A{names}\u3002\u540C\u4E00\u65F6\u95F4\u53EA\u5E94\u542F\u7528\u4E00\u79CD\u8BF7\u6C42\u5934\u6539\u5199\uFF0C\u5426\u5219\u7EBF\u4E0A\u751F\u6548\u7684\u662F\u6700\u540E\u5199\u5165\u8005\u3002",headersError:"\u4FDD\u5B58\u5931\u8D25\uFF1A{error}",headersNoRoute:"\u8BE5\u8DEF\u7531\u5DF2\u4E0D\u5728\u8BBE\u7F6E\u6587\u6863\u4E2D\u2014\u2014\u8BF7\u5148\u4FDD\u5B58\u4E00\u6B21\u5B98\u65B9\u5361\u7247\u3002",providerReorderAria:"\u62D6\u52A8\u6392\u5E8F\uFF1A{provider}",providerReorderHint:"\u62D6\u52A8\u8C03\u6574\u4F9B\u5E94\u5546\u987A\u5E8F\u2014\u2014\u6A21\u578B\u5207\u6362\u6309\u6B64\u987A\u5E8F\u663E\u793A\u3002",providerToggleAria:"\u542F\u7528 {provider}",providerToggleHint:"\u7981\u7528\u540E\u8BE5\u4F9B\u5E94\u5546\u4E0D\u5728\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u663E\u793A\u3002",providerBalanceLabel:"\u4F59\u989D",providerBalanceHint:"\u6765\u81EA\u8BE5\u4F9B\u5E94\u5546\u914D\u7F6E\u7684\u4F59\u989D\u63A5\u53E3\u3002",providerBalanceRefresh:"\u5237\u65B0\u4F59\u989D",providerBalanceUnavailable:"\u4F59\u989D \u2014",providerDisabledGroupShow:"\u5C55\u5F00 {count} \u4E2A\u5DF2\u7981\u7528\u7684\u4F9B\u5E94\u5546",providerDisabledGroupHide:"\u6536\u8D77 {count} \u4E2A\u5DF2\u7981\u7528\u7684\u4F9B\u5E94\u5546",providerDisabledGroupHint:"\u5DF2\u7981\u7528\u7684\u4F9B\u5E94\u5546\u914D\u7F6E\u4ECD\u5728\uFF0C\u53EA\u662F\u6298\u53E0\u5728\u8FD9\u91CC\u2014\u2014\u5C55\u5F00\u540E\u53EF\u4EE5\u91CD\u65B0\u542F\u7528\u3002",providerRemoveDisabled:"\u5220\u9664",providerRemoveLocked:"\u5185\u7F6E\u4F9B\u5E94\u5546\u4E0D\u53EF\u5220\u9664\u3002",modelReorderAria:"\u62D6\u52A8\u6392\u5E8F\uFF1A{model}",modelReorderHint:"\u62D6\u52A8\u8C03\u6574\u8BE5\u4F9B\u5E94\u5546\u5185\u6A21\u578B\u987A\u5E8F\u2014\u2014\u6A21\u578B\u5207\u6362\u6309\u6B64\u987A\u5E8F\u663E\u793A\u3002",configButton:"\u9AD8\u7EA7\u8BBE\u7F6E",configButtonHint:"\u6253\u5F00\u9AD8\u7EA7\u8BBE\u7F6E",configPaneTitle:"\u9AD8\u7EA7\u8BBE\u7F6E",configPaneClose:"\u5173\u95ED",configPaneFailed:"\u914D\u7F6E\u9762\u677F\u6E32\u67D3\u5931\u8D25",imagegenSectionTitle:"\u751F\u56FE",imagegenEnable:"\u542F\u7528\u751F\u56FE",cardStateOn:"\u5F00\u542F",cardStateOff:"\u5173\u95ED",imagegenEnabledHint:"\u5141\u8BB8\u4F7F\u7528\u751F\u56FE\u5DE5\u5177\uFF0C\u70B9\u51FB\u5C55\u5F00\u914D\u7F6E\u6A21\u578B\u548C\u56FE\u7247\u53C2\u6570\u3002",imagegenDisabledHint:"\u4E0D\u4F7F\u7528\u751F\u56FE\u5DE5\u5177\uFF0C\u5DF2\u914D\u7F6E\u7684\u6A21\u578B\u548C\u56FE\u7247\u53C2\u6570\u4ECD\u4F1A\u4FDD\u7559\u3002",imagegenExpand:"\u5C55\u5F00\u751F\u56FE\u8BBE\u7F6E",imagegenCollapse:"\u6536\u8D77\u751F\u56FE\u8BBE\u7F6E",imagegenSaving:"\u6B63\u5728\u4FDD\u5B58\u2026",imagegenRefreshFailed:"\u5DF2\u4FDD\u5B58\uFF0C\u4F46\u65E0\u6CD5\u5237\u65B0\u914D\u7F6E\uFF1A{error}",imagegenLoading:"\u6B63\u5728\u8BFB\u53D6\u2026",imagegenLoadFailed:"\u8BFB\u4E0D\u5230\u751F\u56FE\u914D\u7F6E",imagegenDefaultsLabel:"\u9ED8\u8BA4\u53C2\u6570",imagegenDefaultModelLabel:"\u9ED8\u8BA4\u751F\u56FE\u6A21\u578B",imagegenDefaultModelNone:"\u672A\u8BBE\u7F6E",imagegenSizeLabel:"\u5C3A\u5BF8",imagegenQualityLabel:"\u8D28\u91CF",imagegenCountLabel:"\u6570\u91CF",imagegenTimeoutLabel:"\u8D85\u65F6",imagegenTimeoutMinutes:"{minutes} \u5206\u949F",imagegenTimeoutHint:"\u5355\u6B21\u8BF7\u6C42\u4E0A\u9650\uFF1B\u53C2\u6570\u56DE\u9000\u7684\u6BCF\u6B21\u91CD\u8BD5\u4E5F\u7528\u5B83\u3002",imagegenCardRunning:"\u6B63\u5728\u751F\u6210\u56FE\u7247\u2026",imagegenToolMissing:"\u5185\u5EFA\u751F\u56FE\u5DE5\u5177\u6CA1\u6709\u6CE8\u518C\u6210\u529F\uFF0C\u6A21\u578B\u8C03\u4E0D\u5230\u5B83\u3002",imagegenToolMissingWhy:"\u5BBF\u4E3B\u8BF4\uFF1A{reason}",autoContinueSectionTitle:"\u81EA\u52A8\u7EE7\u7EED",autoContinueExpand:"\u5C55\u5F00\u81EA\u52A8\u7EE7\u7EED\u8BBE\u7F6E",autoContinueCollapse:"\u6536\u8D77\u81EA\u52A8\u7EE7\u7EED\u8BBE\u7F6E",autoContinueTitle:"\u81EA\u52A8\u7EE7\u7EED\u88AB\u4E2D\u65AD\u7684\u4F1A\u8BDD",autoContinueDescription:"\u4F1A\u8BDD\u56E0\u65AD\u7EBF\u3001\u8D85\u65F6\u6216\u8F93\u51FA\u8FBE\u5230\u4E0A\u9650\u800C\u4E2D\u65AD\u65F6\uFF0C\u81EA\u52A8\u56DE\u590D\u300C\u7EE7\u7EED\u300D\u3002\u6B63\u5E38\u5B8C\u6210\u3001\u624B\u52A8\u505C\u6B62\u3001\u9274\u6743\u6216\u989D\u5EA6\u7C7B\u9519\u8BEF\u4E0D\u4F1A\u89E6\u53D1\u3002",autoContinueHint:"\u5931\u8D25\u540E\u7B49 {seconds} \u79D2\u518D\u7EE7\u7EED \xB7 \u6700\u591A {count} \u6B21",autoContinueWaitLabel:"\u5931\u8D25\u540E\u7B49\u5F85",autoContinueRetriesLabel:"\u91CD\u8BD5\u4E0A\u9650",autoContinueSecondsUnit:"\u79D2",autoContinueRetriesUnit:"\u6B21",autoContinueConfigHint:"\u586B\u6574\u6570\uFF1A{waitMin}\u2013{waitMax} \u79D2\u3001{retriesMin}\u2013{retriesMax} \u6B21\uFF1B\u79FB\u5F00\u7126\u70B9\u6216\u6309\u56DE\u8F66\u81EA\u52A8\u4FDD\u5B58\u3002\u6BCF\u6B21\u5931\u8D25\u540E\u5148\u7B49\u8FD9\u4E48\u4E45\u518D\u53D1\u9001\u300C\u7EE7\u7EED\u300D\uFF1B\u4F9B\u5E94\u5546\u8981\u6C42\u7684\u7B49\u5F85\u66F4\u4E45\u65F6\u6309\u66F4\u4E45\u7684\u6765\u3002",autoContinueAria:"\u542F\u7528\u81EA\u52A8\u7EE7\u7EED",autoContinueMessage:"\u7EE7\u7EED"};var to="dsh-model-think-level.slider.enabled",Gm=["dsh-reasoning-effort.enabled","@dsh-external/dsh-reasoning-effort.enabled"],dr=Wm();function Wm(){try{let e=window.localStorage.getItem(to),t=e===null?Gm.map(n=>window.localStorage.getItem(n)).find(n=>n!==null):null;return(e??t??null)!=="false"}catch{return!0}}var Di=new Set;function ud(){for(let e of[...Di])e()}function lt(){return dr}function fd(e){if(dr!==e){dr=e;try{window.localStorage.setItem(to,String(e))}catch{}ud()}}function pd(e){dr!==e&&(dr=e,ud())}function no(e){return Di.add(e),()=>{Di.delete(e)}}var ro="dsh-model-think-level.provider-order",md=["deepseek-account","deepseek-official"];function kn(e){if(e===null)return[];try{let t=JSON.parse(e);return Array.isArray(t)?Ki(t.filter(n=>typeof n=="string")):[]}catch{return[]}}function Ki(e){let t=new Set,n=[];for(let r of e)r.length===0||t.has(r)||(t.add(r),n.push(r));return n}var xn=(()=>{try{return kn(window.localStorage.getItem(ro))}catch{return[]}})(),Fi=new Set;function gd(){for(let e of[...Fi])e()}function hd(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function En(){return xn}function oo(e){let t=Ki(e);if(!hd(xn,t)){xn=t;try{window.localStorage.setItem(ro,JSON.stringify(xn))}catch{}gd()}}function bd(e){let t=Ki(e);hd(xn,t)||(xn=t,gd())}function Tn(e){return Fi.add(e),()=>{Fi.delete(e)}}function qi(e){let t=n=>{let r=md.indexOf(n);return r<0?md.length:r};return e.map((n,r)=>({id:n,index:r,rank:t(n)})).sort((n,r)=>n.rank-r.rank||n.index-r.index).map(n=>n.id)}function Sn(e,t){let n=new Map;for(let a of t)n.has(a)||n.set(a,n.size);let r=[],o=[];e.forEach((a,s)=>{n.has(a)&&(r.push(s),o.push(a))}),o.sort((a,s)=>n.get(a)-n.get(s));let i=[...e];return r.forEach((a,s)=>{i[a]=o[s]}),i}function yd(e){return Sn(qi(e),En())}function Bi(e,t,n){let r=e.indexOf(t);if(r<0)return[...e];let o=[...e];o.splice(r,1);let i=Math.max(0,Math.min(o.length,n));return o.splice(i,0,t),o}var io="dsh-model-think-level.providers.disabled",Gi=new Set,Ot=Um();function Um(){try{return kn(window.localStorage.getItem(io))}catch{return[]}}function vd(e){return kn(e)}function lr(){return Ot}function Mn(e){return!Ot.includes(e)}function wd(e,t){let n=!Ot.includes(e);t!==n&&Wi(t?Ot.filter(r=>r!==e):[...Ot,e],!0)}function xd(e){Wi(e,!1)}function kd(e){Wi(e,!0)}function Ln(e){return Gi.add(e),()=>{Gi.delete(e)}}function jm(e,t){return e.length!==t.length?!1:e.every(n=>t.includes(n))}function Wi(e,t){if(!jm(Ot,e)){if(Ot=[...new Set(e)],t)try{window.localStorage.setItem(io,JSON.stringify(Ot))}catch{}for(let n of[...Gi])n()}}var ao="dsh-model-think-level.model-order";function ji(e){if(e===null)return{};try{let t=JSON.parse(e);if(t===null||typeof t!="object"||Array.isArray(t))return{};let n={};for(let[r,o]of Object.entries(t)){if(r.length===0||!Array.isArray(o))continue;let i=zi(o.filter(a=>typeof a=="string"));i.length>0&&(n[r]=i)}return n}catch{return{}}}function zi(e){let t=new Set,n=[];for(let r of e)r.length===0||t.has(r)||(t.add(r),n.push(r));return n}var It=(()=>{try{return ji(window.localStorage.getItem(ao))}catch{return{}}})(),Ui=new Set;function $i(){for(let e of[...Ui])e()}function zm(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Ed(){try{window.localStorage.setItem(ao,JSON.stringify(It))}catch{}}function cr(){return It}function Td(e){return It[e]??$m}var $m=[];function Sd(e,t){if(e.length===0)return;let n=zi(t),r=Td(e);if(zm(r,n)&&(n.length>0||!(e in It)))return;let o={...It};n.length===0?delete o[e]:o[e]=n,It=o,Ed(),$i()}function Md(e){It=e,$i()}function Ld(e){let t={};for(let[n,r]of Object.entries(e)){if(n.length===0)continue;let o=zi(r);o.length>0&&(t[n]=o)}It=t,Ed(),$i()}function An(e){return Ui.add(e),()=>{Ui.delete(e)}}function Vm(e,t){return Sn(e,t)}function Ad(e,t){return Sn(t,Td(e))}function Vi(e,t){if(e.length===0||t.length===0)return e;let n=new Map(e.map(r=>[r.id,r]));return Vm(e.map(r=>r.id),t).map(r=>n.get(r))}var Rd="dsh-model-think-level.order-saved-at",Ym=400,Jm=6e4;function Xi(e){if(!Array.isArray(e))return[];let t=new Set,n=[];for(let r of e){if(typeof r!="string")continue;let o=r.trim();o.length===0||t.has(o)||(t.add(o),n.push(o))}return n}function Xm(e){if(typeof e!="object"||e===null||Array.isArray(e))return{};let t={};for(let[n,r]of Object.entries(e)){if(n.length===0)continue;let o=Xi(r);o.length>0&&(t[n]=o)}return t}function Cd(e){if(typeof e!="object"||e===null)return;let t=e;return{savedAt:typeof t.savedAt=="number"&&Number.isFinite(t.savedAt)?t.savedAt:0,providerOrder:Xi(t.providerOrder),modelOrder:Xm(t.modelOrder),providersDisabled:Array.isArray(t.providersDisabled)?Xi(t.providersDisabled):void 0}}function Hd(e){return e.providerOrder.length>0||Object.keys(e.modelOrder).length>0||e.providersDisabled!==void 0}function ur(){try{let e=window.localStorage.getItem(Rd),t=e===null?0:Number(e);return Number.isFinite(t)&&t>0?t:0}catch{return 0}}function Zi(e){try{window.localStorage.setItem(Rd,String(e))}catch{}}function fr(){return JSON.stringify({providerOrder:En(),modelOrder:cr(),providersDisabled:lr()})}var _t,ct,Rn=new Set,so,Yi,He=!1,Qi=!1,Pt,We=0;function Qm(){let e=Math.max(Date.now(),ur()+1);return Zi(e),e}function Nd(){if(ct=void 0,He)return;let e=ur(),t=JSON.stringify({savedAt:e>0?e:Date.now(),providerOrder:En(),modelOrder:cr(),providersDisabled:lr()});_t=fr();let n=We,r=fetch(Oi,{method:"POST",headers:{"content-type":"application/json"},body:t}).then(async o=>{if(He||n!==We)return!0;let i=await o.json().catch(()=>{});if(He||n!==We)return!0;let a=Cd(i?.data);return o.status===409?ur()!==e?!0:a!==void 0&&Hd(a)?(Od(a),!0):(_t=void 0,!1):o.ok?(a!==void 0&&a.savedAt>ur()&&Zi(a.savedAt),!0):(_t=void 0,!1)}).catch(()=>(!He&&n===We&&(_t=void 0),!1));Rn.add(r),r.then(()=>{Rn.delete(r)})}function ea(e){He||ct!==void 0||fr()!==_t&&(ct=setTimeout(Nd,e))}function ta(){ct!==void 0&&(clearTimeout(ct),Nd())}async function Zm(){if(He)return;let e=We;if(await co(),!(He||e!==We))for(fr()!==_t&&ct===void 0&&Rn.size===0&&ea(0);!He&&e===We&&(ct!==void 0||Rn.size>0);){ta();let t=await Promise.all([...Rn]);if(He||e!==We)return;if(t.includes(!1))throw new Error("\u6A21\u578B\u987A\u5E8F\u548C\u542F\u505C\u5C1A\u672A\u4FDD\u5B58\uFF0C\u8BF7\u91CD\u8BD5\u540C\u6B65")}}function Ji(){He||Qi||(Qm(),ea(Ym))}function Od(e){Qi=!0;try{oo(e.providerOrder),Ld(e.modelOrder),e.providersDisabled!==void 0&&kd(e.providersDisabled)}finally{Qi=!1}Zi(e.savedAt),_t=fr()}function co(){if(He)return Promise.resolve();if(Pt!==void 0)return Pt;let e=eg().finally(()=>{Pt===e&&(Pt=void 0)});return Pt=e,e}async function eg(){let e=We,t;try{let o=await fetch(Oi,{method:"GET"});if(o.ok){let i=await o.json();i.ok===!0&&(t=Cd(i.data))}}catch{return}if(He||e!==We||ct!==void 0)return;let n=ur(),r=JSON.stringify({providerOrder:t?.providerOrder??[],modelOrder:t?.modelOrder??{},providersDisabled:t?.providersDisabled??[]});if(t!==void 0&&Hd(t)&&t.savedAt>=n){Od(t);return}fr()!==r&&ea(0)}function lo(){He||typeof document<"u"&&document.visibilityState==="hidden"||co()}function Id(){He=!1,We+=1,Pt=void 0,Rn.clear(),_t=void 0;let e=Tn(Ji),t=An(Ji),n=Ln(Ji);so=setInterval(lo,Jm);let r=a=>{let s=a.detail;typeof s?.waitUntil=="function"&&s.waitUntil(Zm())},o=()=>{let a=We;(async()=>(Pt!==void 0&&await Pt,!He&&a===We&&await co()))()};typeof window<"u"&&(window.addEventListener("focus",lo),window.addEventListener("dsh-webdav-sync:before-snapshot",r),window.addEventListener("dsh-webdav-sync:applied",o));let i=()=>{document.visibilityState==="visible"&&lo()};return typeof document<"u"&&document.addEventListener("visibilitychange",i),Yi=()=>{typeof document<"u"&&document.removeEventListener("visibilitychange",i),typeof window<"u"&&(window.removeEventListener("focus",lo),window.removeEventListener("dsh-webdav-sync:before-snapshot",r),window.removeEventListener("dsh-webdav-sync:applied",o))},co(),()=>{He=!0,We+=1,ct!==void 0&&clearTimeout(ct),ct=void 0,so!==void 0&&clearInterval(so),so=void 0,Yi?.(),Yi=void 0,e(),t(),n()}}var Pd=`
|
|
8
8
|
/* ---- Quiet Precision: the plugin's own token layer ----
|
|
9
9
|
Every value below is a HOST design-platform token (--dsw-*) with the light
|
|
10
10
|
theme's literal as the fallback, so the plugin inherits a theme switch for
|
|
@@ -2806,8 +2806,8 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
2806
2806
|
.bre-keys-row.is-off .bre-keys-mask { opacity: 0.45; }
|
|
2807
2807
|
|
|
2808
2808
|
/* With an alias the alias is the row's name and the masked key follows it as a
|
|
2809
|
-
quiet code pill; without one the masked key is the name
|
|
2810
|
-
|
|
2809
|
+
quiet code pill; without one the masked key is the name. Neither preview grows
|
|
2810
|
+
past its text: copy must follow the mask, not the row's leftover whitespace. */
|
|
2811
2811
|
.bre-keys-alias {
|
|
2812
2812
|
flex: 0 1 auto;
|
|
2813
2813
|
min-width: 0;
|
|
@@ -2834,7 +2834,7 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
2834
2834
|
}
|
|
2835
2835
|
|
|
2836
2836
|
.bre-keys-mask-plain {
|
|
2837
|
-
flex:
|
|
2837
|
+
flex: 0 1 auto;
|
|
2838
2838
|
padding: 0;
|
|
2839
2839
|
background: transparent;
|
|
2840
2840
|
color: var(--dsw-alias-label-primary, #0f1115);
|
|
@@ -2842,13 +2842,9 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
2842
2842
|
font-size: 12px;
|
|
2843
2843
|
}
|
|
2844
2844
|
|
|
2845
|
-
/* The copy affordance
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
own reason to exist. It leads the row instead of trailing the preview because
|
|
2849
|
-
the hover tray grows in from the right and would otherwise shove the glyph
|
|
2850
|
-
sideways the moment the pointer reaches it. It borrows the preview's quiet
|
|
2851
|
-
tone and answers with a tick once the clipboard has the text. */
|
|
2845
|
+
/* The always-visible copy affordance follows the masked preview in the value
|
|
2846
|
+
group. Its fixed hit area survives truncation, and it answers with a tick only
|
|
2847
|
+
once the clipboard has the text. */
|
|
2852
2848
|
.bre-keys-copy {
|
|
2853
2849
|
flex: 0 0 auto;
|
|
2854
2850
|
display: inline-flex;
|
|
@@ -2856,7 +2852,7 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
2856
2852
|
justify-content: center;
|
|
2857
2853
|
width: 20px;
|
|
2858
2854
|
height: 20px;
|
|
2859
|
-
margin-
|
|
2855
|
+
margin-left: -2px;
|
|
2860
2856
|
padding: 0;
|
|
2861
2857
|
border: 0;
|
|
2862
2858
|
border-radius: 4px;
|
|
@@ -2883,14 +2879,9 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
2883
2879
|
color: var(--dsw-alias-state-success-primary, #18a058);
|
|
2884
2880
|
}
|
|
2885
2881
|
|
|
2886
|
-
/* The
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
them, because a hidden action there would be an unreachable one. The model
|
|
2890
|
-
scope rides on its own button here (its label is the count), so there is no
|
|
2891
|
-
separate summary text beside the key any more. The tray parks at the right
|
|
2892
|
-
edge: no status word is painted on a row any more (\u72B6\u6001\u90FD\u79FB\u9664\u2014\u2014\u4E1C\u897F\u591A\u4E86\uFF0C
|
|
2893
|
-
\u522B\u540D\u88AB\u7701\u7565), so the right edge is the tray's alone. */
|
|
2882
|
+
/* The action tray parks at the right edge. The visual refinement below keeps
|
|
2883
|
+
protocol and scope visible, and removes hover-only verbs from the resting
|
|
2884
|
+
layout rather than reserving their widths with opacity. */
|
|
2894
2885
|
.bre-keys-actions {
|
|
2895
2886
|
display: inline-flex;
|
|
2896
2887
|
flex: 0 0 auto;
|
|
@@ -3056,12 +3047,21 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
3056
3047
|
position: relative;
|
|
3057
3048
|
display: inline-flex;
|
|
3058
3049
|
align-items: center;
|
|
3050
|
+
/* The tray is one line now, so this label is where a narrow row gives: it
|
|
3051
|
+
truncates instead of pushing the verbs past the row's right edge. */
|
|
3052
|
+
flex: 0 1 auto;
|
|
3053
|
+
min-width: 0;
|
|
3054
|
+
overflow: hidden;
|
|
3059
3055
|
color: var(--dsw-alias-label-secondary, #61666b);
|
|
3060
3056
|
}
|
|
3061
3057
|
|
|
3062
3058
|
.bre-keys-protocol {
|
|
3063
3059
|
display: inline-flex;
|
|
3064
3060
|
align-items: center;
|
|
3061
|
+
/* Follows the wrap's truncation rather than forcing it open. */
|
|
3062
|
+
min-width: 0;
|
|
3063
|
+
max-width: 100%;
|
|
3064
|
+
white-space: nowrap;
|
|
3065
3065
|
gap: 2px;
|
|
3066
3066
|
margin: 0;
|
|
3067
3067
|
padding: 2px 6px;
|
|
@@ -3644,6 +3644,10 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
3644
3644
|
.bre-keys-list > li + li { border-top: 1px solid var(--bre-line-2); }
|
|
3645
3645
|
|
|
3646
3646
|
.bre-keys-row {
|
|
3647
|
+
/* One line, always: the preview gives way (it truncates) so the actions stay
|
|
3648
|
+
on the same baseline. A row that wrapped would change height under the
|
|
3649
|
+
pointer, and the copy glyph would move with it. */
|
|
3650
|
+
flex-wrap: nowrap;
|
|
3647
3651
|
gap: 8px;
|
|
3648
3652
|
min-height: 40px;
|
|
3649
3653
|
padding: 0 10px;
|
|
@@ -3653,6 +3657,18 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
3653
3657
|
|
|
3654
3658
|
.bre-keys-row:hover { background: var(--bre-hover); }
|
|
3655
3659
|
|
|
3660
|
+
/* Alias, masked preview and copy share one compact group. The text can truncate
|
|
3661
|
+
in a narrow row, but copy keeps its hit area. 28px is the enable switch's
|
|
3662
|
+
20px plus the row's 8px gap. */
|
|
3663
|
+
.bre-keys-value {
|
|
3664
|
+
flex: 0 1 auto;
|
|
3665
|
+
display: inline-flex;
|
|
3666
|
+
align-items: center;
|
|
3667
|
+
gap: 6px;
|
|
3668
|
+
min-width: 0;
|
|
3669
|
+
max-width: calc(100% - 28px);
|
|
3670
|
+
}
|
|
3671
|
+
|
|
3656
3672
|
/* The enable check: a ring that fills. Filled is accent with a white tick, empty
|
|
3657
3673
|
is a grey ring with nothing in it \u2014 the two readings of a checkbox, drawn at
|
|
3658
3674
|
the list's own scale. (The tick is the STATE of one control, which is why it
|
|
@@ -3727,7 +3743,7 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
3727
3743
|
justify-content: center;
|
|
3728
3744
|
width: 20px;
|
|
3729
3745
|
height: 20px;
|
|
3730
|
-
margin-
|
|
3746
|
+
margin-left: -2px;
|
|
3731
3747
|
padding: 0;
|
|
3732
3748
|
border: none;
|
|
3733
3749
|
border-radius: var(--bre-r-xs);
|
|
@@ -3756,30 +3772,43 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
3756
3772
|
|
|
3757
3773
|
/* The row's tray: the protocol and the model scope are STATE and stay on the
|
|
3758
3774
|
row; the verbs appear on hover. The split is made here rather than in the
|
|
3759
|
-
markup \u2014 the tray stays mounted and only the VERBS inside it are
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
the
|
|
3765
|
-
count
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3775
|
+
markup \u2014 the tray stays mounted and only the VERBS inside it are hidden,
|
|
3776
|
+
picked out by :not(.bre-keys-scope): the scope is a <button> too, but its
|
|
3777
|
+
label is a count, not an action.
|
|
3778
|
+
The verbs HOLD their width at rest and only their ink appears: take them out
|
|
3779
|
+
of the line (display, or a bare opacity on a layout they no longer occupy)
|
|
3780
|
+
and the tray shrinks under the pointer, shoving the protocol pill and the
|
|
3781
|
+
scope count sideways the instant the pointer arrives \u2014 the click lands on a
|
|
3782
|
+
different word than the one that was aimed at (user bug 3). "order: 1" keeps
|
|
3783
|
+
the reserved seat at the TAIL of the tray, after the protocol and scope, so
|
|
3784
|
+
nothing at rest sits apart: the protocol and scope keep their exact places
|
|
3785
|
+
and the three verbs fade in to their right. "pointer-events: none" keeps the
|
|
3786
|
+
invisible seat unclickable; the buttons stay in the tab order, so focusing the
|
|
3787
|
+
protocol reveals them as well.
|
|
3788
|
+
The row stays on one line \u2014 a second line would push its height under the
|
|
3789
|
+
pointer \u2014 and the preview is what gives way if a narrow row runs out of room. */
|
|
3770
3790
|
.bre-keys-actions {
|
|
3791
|
+
flex-wrap: nowrap;
|
|
3792
|
+
white-space: nowrap;
|
|
3793
|
+
justify-content: flex-end;
|
|
3771
3794
|
gap: 6px;
|
|
3795
|
+
min-width: 0;
|
|
3796
|
+
max-width: 100%;
|
|
3772
3797
|
opacity: 1;
|
|
3773
3798
|
pointer-events: auto;
|
|
3774
3799
|
}
|
|
3775
3800
|
|
|
3776
3801
|
.bre-keys-actions .bre-link-button:not(.bre-keys-scope) {
|
|
3777
|
-
|
|
3802
|
+
order: 1;
|
|
3803
|
+
opacity: 0;
|
|
3804
|
+
pointer-events: none;
|
|
3805
|
+
transition: opacity var(--bre-t) var(--bre-ease);
|
|
3778
3806
|
}
|
|
3779
3807
|
|
|
3780
3808
|
.bre-keys-row:hover .bre-keys-actions .bre-link-button:not(.bre-keys-scope),
|
|
3781
3809
|
.bre-keys-row:focus-within .bre-keys-actions .bre-link-button:not(.bre-keys-scope) {
|
|
3782
|
-
|
|
3810
|
+
opacity: 1;
|
|
3811
|
+
pointer-events: auto;
|
|
3783
3812
|
}
|
|
3784
3813
|
|
|
3785
3814
|
/* A row waiting on "confirm remove / cancel" must never hide its own question. */
|
|
@@ -3791,7 +3820,6 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
3791
3820
|
|
|
3792
3821
|
@media (hover: none) {
|
|
3793
3822
|
.bre-keys-actions .bre-link-button:not(.bre-keys-scope) {
|
|
3794
|
-
display: inline-flex;
|
|
3795
3823
|
opacity: 1;
|
|
3796
3824
|
pointer-events: auto;
|
|
3797
3825
|
}
|
|
@@ -4823,11 +4851,37 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
4823
4851
|
overflow-wrap: anywhere;
|
|
4824
4852
|
}
|
|
4825
4853
|
|
|
4826
|
-
`;var cr="bre:endpoints-changed",ur="bre:settings-changed",fr="bre:balance-changed";var hr=require("react"),dl=require("react-dom");var M=require("react"),Yd=require("react-dom");var z=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Rd(e){let t=e.toLowerCase();return t.includes("compat")||t.includes("thinkingtokenbudget")||t.includes("vllmpriority")||t.includes("supportsmaxoutput")}function Mn(e,t){if(!z(e))return[];let n=e[t];return!z(n)||!Array.isArray(n.models)?[]:n.models.filter(z)}function zt(e,t){if(!z(e))return{};let n=e[t];if(!z(n))return{};let r=typeof n.api=="string"?n.api:void 0,o=typeof n.baseURL=="string"?n.baseURL:void 0,i=typeof n.displayName=="string"?n.displayName:void 0;return{api:r,baseURL:o,displayName:i}}var Pd=["off","minimal","low","medium","high","xhigh","max"],Gm=["text","image"];var Wm=[{id:"deepseek-v4-vision",patterns:["deepseek-v4-flash-vision","deepseek-v4-vision"],efforts:{off:"none",low:"low",high:"high",max:"max"},defaultEffort:"high",compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,maxTokens:384e3,note:"DeepSeek \u89C6\u89C9\u5B9E\u9A8C\u7248 id\uFF08deepseek-v4-flash-vision-exp\uFF09\u3002\u5B98\u65B9\u76EE\u5F55\u5DF2\u6807\u6CE8\u8BE5\u6A21\u578B\u9000\u5F79\uFF0C\u540D\u5B57\u4ECD\u88AB\u63A5\u53D7\u3001\u7531\u73B0\u884C deepseek-flash \u63D0\u4F9B\u670D\u52A1\u2014\u2014\u56FE\u7247\u8F93\u5165\u73B0\u5DF2\u7531 deepseek-flash \u539F\u751F\u63D0\u4F9B\u3002"},{id:"deepseek-v4-1-flash",patterns:["deepseek-v4.1-flash","deepseek-flash"],efforts:{off:"none",low:"low",high:"high",max:"max"},defaultEffort:"high",compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,maxTokens:384e3,note:'DeepSeek-V4.1-Flash\uFF082026-09-10 \u53D1\u5E03\u7684\u73B0\u884C\u5B98\u65B9\u6A21\u578B\uFF0C\u5B98\u65B9 id \u4E3A deepseek-flash\uFF1B25 \u4E07\u5E76\u53D1\u3001**\u539F\u751F\u56FE\u7247\u8F93\u5165**\uFF09\u3002V4.1 \u7684\u5404\u5199\u6CD5\uFF08deepseek-flash\u3001deepseek-v4.1-flash\u3001deepseek-v4-1-flash\uFF0C\u4EE5\u53CA\u5E26\u65E5\u671F\u540E\u7F00\u7684\u7B2C\u4E09\u65B9\u53D8\u4F53\uFF09\u90FD\u5F52\u6B64\u6761\u2014\u2014\u7EAF\u6587\u672C\u7684 deepseek-v4 \u4E3B\u5E72\u4E0D\u518D\u541E\u6389\u5B83\u4EEC\u3002\u5B98\u65B9\u679A\u4E3E\u540C V4 \u7CFB\uFF1AOff\uFF08thinking:"disabled"\uFF09/ Low / High / Max\uFF0C\u9ED8\u8BA4 High\uFF1B\u5BB9\u91CF 1,048,576 \u4E0A\u4E0B\u6587 / \u6700\u5927\u8F93\u51FA 384K\u3002'},{id:"deepseek-v4",patterns:["deepseek-v4"],efforts:{off:"none",low:"low",high:"high",max:"max"},defaultEffort:"high",compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!0},input:["text"],contextWindow:1048576,maxTokens:384e3,note:'DeepSeek \u5B98\u65B9\u679A\u4E3E Low / High / Max\uFF08\u9ED8\u8BA4 High\uFF1Bminimal\u3001medium\u3001xhigh \u517C\u5BB9\u6620\u5C04\uFF0Cultra\u2192max\uFF09\uFF0COff \u5373 thinking:"disabled"\uFF08Responses API \u4E0B off \u4EE5 reasoning.effort:"none" \u8868\u793A\uFF09\u3002\u672C\u6761\u76EE\u662F V4 \u5BB6\u65CF\u7684**\u7EAF\u6587\u672C**\u6210\u5458\uFF1Adeepseek-v4-pro\uFF08= DeepSeek-V4-Pro-0813\uFF0C\u5B98\u65B9\u4E0D\u652F\u6301\u56FE\u7247\uFF09\u4E0E\u5DF2\u9000\u5F79\u6A21\u578B\u7684\u517C\u5BB9\u522B\u540D deepseek-v4-flash\uFF08deepseek-v4-flash-vision-exp \u53E6\u6709\u89C6\u89C9\u6761\u76EE\uFF09\u3002**\u6536\u56FE\u7684 V4.1-Flash\uFF08\u5B98\u65B9 id deepseek-flash\uFF09\u53E6\u6709\u4E13\u95E8\u6761\u76EE**\uFF0C\u5176 input \u542B image\u3002\u5BB9\u91CF\uFF1A1,048,576 \u4E0A\u4E0B\u6587 / \u6700\u5927\u8F93\u51FA 384K\uFF08393,216\uFF1B\u9ED8\u8BA4\u975E\u601D\u8003 8K\u3001\u601D\u8003 64K\u3001effort=max \u65F6 128K\uFF09\u3002'},{id:"deepseek-v3",patterns:["deepseek-v3","deepseek-chat"],efforts:{off:"none",high:"high",max:"max"},compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!0},input:["text"],contextWindow:163840,maxTokens:65536,note:"DeepSeek V3 \u6863\u4F4D\uFF1AOff / High / Max\u3002\u5B98\u65B9\u5DF2\u505C\u552E V3 \u4EE3\uFF08\u5B9A\u4EF7\u9875\u4EC5\u5269 V4 \u4E09\u578B\uFF09\uFF0C\u5BB9\u91CF\u53D6\u76EE\u5F55\u73B0\u5F79\u503C\u3002"},{id:"deepseek-r1",patterns:["deepseek-r1","deepseek-reasoner"],efforts:{high:"high"},defaultEffort:"high",compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!0},input:["text"],contextWindow:163840,maxTokens:32768,note:"DeepSeek-R1 \u4E3A\u63A8\u7406\u6A21\u578B\uFF0C\u4EC5\u63D0\u4F9B High\u3002\u5B98\u65B9\u5DF2\u4E0B\u67B6 R1 \u4EE3\uFF0C\u5BB9\u91CF\u53D6\u76EE\u5F55 r1-0528 \u503C\u3002"},{id:"openai-gpt-5-2",patterns:["gpt-5.2"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"off",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.2 \u6863\u4F4D\uFF1ANone / Low / Medium / High / XHigh\uFF08\u9ED8\u8BA4 None\uFF09\u3002\u5B98\u65B9\u53E6\u652F\u6301 PDF \u8F93\u5165\uFF08\u6838\u5FC3\u8BCD\u8868\u6682\u4E0D\u542B\uFF09\u3002gpt-5.2-pro \u5B98\u65B9\u9875\u672A\u5355\u5217\u6863\u4F4D\u884C\uFF0C\u6309\u672C\u6761\u76EE\u540C\u6863\u5904\u7406\uFF1Bgpt-5.2-codex \u89C1\u5355\u72EC\u6761\u76EE\u3002"},{id:"openai-gpt-5-2-codex",patterns:["gpt-5.2-codex"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.2-Codex \u6863\u4F4D\uFF1ALow / Medium / High / XHigh\uFF08\u65E0 None \u6863\uFF0C\u52FF\u52FE Off\uFF09\uFF0C\u5E26\u56FE\u8F93\u5165\u3001400K\u3002"},{id:"openai-gpt-5-6",patterns:["gpt-5.6"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:272e3,maxTokens:128e3,note:"GPT-5.6\uFF08\u522B\u540D\u5373 sol\uFF09\u6863\u4F4D\uFF1ANone / Low / Medium(\u9ED8\u8BA4) / High / XHigh / Max\uFF1Bsol/luna/terra \u540C\u6863\uFF0C\u5E26\u56FE\u8F93\u5165\u30022026-10 \u6821\u51C6\uFF1A\u4E0A\u4E0B\u6587\u6309 pi-ai 1.2.0 \u76EE\u5F55\u8BB0 272,000\uFF08\u6B64\u524D\u8BEF\u8BB0 1,050,000\uFF09\u3002"},{id:"openai-gpt-5-5",patterns:["gpt-5.5"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:272e3,maxTokens:128e3,note:"GPT-5.5 \u6863\u4F4D\uFF1ANone / Low / Medium(\u9ED8\u8BA4) / High / XHigh\uFF08\u65E0 Max \u6863\uFF09\uFF0C\u5E26\u56FE\u8F93\u5165\u3002pro \u53D8\u4F53\u4EC5 High(\u9ED8\u8BA4) / XHigh\u30011.05M \u4E0A\u4E0B\u6587\u4E14\u4EC5 Responses API\u30022026-10 \u6821\u51C6\uFF1A\u4E0A\u4E0B\u6587\u6309 pi-ai 1.2.0 \u76EE\u5F55\u8BB0 272,000\uFF08\u6B64\u524D\u8BEF\u8BB0 1,050,000\uFF09\u3002"},{id:"openai-gpt-5-4",patterns:["gpt-5.4"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"off",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:272e3,maxTokens:128e3,note:"GPT-5.4 \u6863\u4F4D\uFF1ANone(\u9ED8\u8BA4) / Low / Medium / High / XHigh\uFF0C\u5E26\u56FE\u8F93\u5165\u3002pro \u53D8\u4F53\u4EC5 Medium/High/XHigh\uFF081.05M\uFF09\uFF1Bmini/nano \u4E3A 400K \u4E0A\u4E0B\u6587\u30022026-10 \u6821\u51C6\uFF1A\u4E0A\u4E0B\u6587\u6309 pi-ai 1.2.0 \u76EE\u5F55\u8BB0 272,000\uFF08\u6B64\u524D\u8BEF\u8BB0 1,050,000\uFF09\u3002"},{id:"openai-gpt-5-3",patterns:["gpt-5.3"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.3-Codex \u6863\u4F4D\uFF1ANone / Low / Medium(\u9ED8\u8BA4) / High / XHigh\uFF0C\u5E26\u56FE\u8F93\u5165\u3001400K\uFF1B2026-10 \u6821\u51C6\uFF1ANone \u6863\u6309 pi-ai 1.2.0 \u76EE\u5F55\u8865\u56DE\uFF08\u6B64\u524D\u6309\u65E7\u6A21\u578B\u9875\u8BB0\u4E3A\u65E0 None\uFF09\u3002gpt-5.3-chat \u4E3A\u975E\u63A8\u7406\u804A\u5929\u6A21\u578B\uFF08\u89C1 chat \u6761\u76EE\uFF09\u3002"},{id:"openai-gpt-5-1",patterns:["gpt-5.1"],efforts:{off:"none",low:"low",medium:"medium",high:"high"},defaultEffort:"off",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.1 \u6863\u4F4D\uFF1ANone / Low / Medium / High\uFF08\u9ED8\u8BA4 None\uFF09\u3002"},{id:"openai-gpt-5-1-codex",patterns:["gpt-5.1-codex"],efforts:{low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.1-Codex \u7CFB\u5217\uFF1A\u5B98\u65B9\u6A21\u578B\u9875\u672A\u5355\u5217 effort \u503C\u57DF\uFF0C\u6309\u540C\u4EE3\u4FDD\u5B88\u6863 Low / Medium / High\uFF08\u65E0 None\uFF1Bxhigh \u672A\u8BC1\u5B9E\uFF09\u3002\u5982\u7AEF\u70B9\u652F\u6301 xhigh/none \u53EF\u624B\u8C03\u3002"},{id:"openai-gpt-5",patterns:["gpt-5"],efforts:{minimal:"minimal",low:"low",medium:"medium",high:"high"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5 \u521D\u4EE3\u6863\u4F4D\uFF1AMinimal / Low / Medium / High\uFF0C\u65E0\u5173\u95ED\u6863\u3002"},{id:"openai-gpt-5-2-chat",patterns:["gpt-5.2-chat"],efforts:{off:null,medium:"medium",xhigh:"xhigh"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:128e3,maxTokens:16384,note:"GPT-5.2-Chat\uFF08\u5B98\u65B9 id gpt-5.2-chat-latest\uFF09\uFF1Api-ai 1.2.0 \u76EE\u5F55\u8BB0\u4E3A\u63A8\u7406\u6A21\u578B\uFF0C\u4EC5 Medium / XHigh \u4E24\u6863\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF0C\u975E\u663E\u5F0F\u5173\u95ED\uFF09\uFF0C128K / 16,384 \u8F93\u51FA\u30022026-10 \u65B0\u589E\u6761\u76EE\u3002"},{id:"openai-chat",patterns:["gpt-5.1-chat-latest","gpt-5.3-chat-latest","gpt-5-chat-latest","gpt-chat-latest","gpt-5-chat","gpt-5.1-chat","gpt-5.3-chat"],efforts:!1,input:["text","image"],contextWindow:128e3,maxTokens:16384,note:"-chat \u7CFB\u5217\uFF08\u5B98\u65B9 id \u4E3A gpt-5.x-chat-latest\uFF09\u4E3A\u975E\u63A8\u7406\u804A\u5929\u6A21\u578B\uFF0C\u4E0D\u652F\u6301 effort \u53C2\u6570\uFF08\u52FF\u52FE\u601D\u8003\u6863\uFF09\uFF1B\u5B98\u65B9\u652F\u6301\u56FE\u7247\u8F93\u5165\uFF0C128K / 16,384 \u8F93\u51FA\u3002gpt-5-chat-latest \u5DF2\u4E8E 2026-07-23 \u4E0B\u67B6\u3001gpt-chat-latest \u5DF2\u65E0\u5B98\u65B9\u9875\u9762\uFF08\u4FDD\u7559\u6A21\u5F0F\u4F9B\u7F51\u5173\uFF09\u3002gpt-5.2-chat \u53E6\u6709\u63A8\u7406\u6761\u76EE\u3002"},{id:"openai-o",patterns:["o1","o3","o4"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:2e5,maxTokens:1e5,note:"OpenAI o \u7CFB\u6863\u4F4D\uFF1ALow / Medium / High\u3002\u5B98\u65B9\u5DF2\u4E8E 2026-06 \u516C\u544A\u9000\u5F79\uFF08o1/o1-pro/o3-mini/o4-mini 2026-10-23 \u79FB\u9664\u3001o3/o3-pro 2026-12-11\uFF09\uFF0C\u7F51\u5173\u6B8B\u7559\u4ECD\u53EF\u547D\u4E2D\uFF1B\u591A\u6570 o \u7CFB\u7AEF\u70B9\u6536\u56FE\uFF08o3-mini \u4F8B\u5916\uFF09\u3002"},{id:"openai-gpt-oss",patterns:["gpt-oss"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"low",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],contextWindow:131072,maxTokens:131072,note:"GPT-OSS \u5F00\u6E90\u6743\u91CD\uFF08Ollama/vLLM \u5E38\u89C1\uFF09\uFF1Areasoning effort Low / Medium / High\uFF0C\u7EAF\u6587\u672C\uFF0C131K \u4E0A\u4E0B\u6587 / 131K \u8F93\u51FA\u30022026-09 \u590D\u6838\uFF1A\u5B98\u65B9\u6A21\u578B\u9875\u73B0\u5728\u5199 Chat Completions = Not supported\u3001\u65E0\u56FE\u7247\u8F93\u5165\uFF08\u9ED8\u8BA4 Low \u6765\u81EA\u5B98\u65B9 CLI\uFF0C\u4E0D\u662F API \u9875\uFF09\uFF0C\u56E0\u6B64\u8FD9\u91CC\u4E0D\u518D\u58F0\u660E Off\u3002"},{id:"openai-gpt-6",patterns:["gpt-6-luna","gpt-6-sol","gpt-6-terra","gpt-6.1"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:272e3,maxTokens:128e3,note:'GPT-6 \u7CFB\uFF08luna/sol/terra\uFF0C2026-10 \u6821\u51C6\u65B0\u589E\uFF09\uFF1Api-ai 1.2.0 \u76EE\u5F55\u5168\u6863 None / Low / Medium / High / XHigh / Max\uFF0C\u5E26\u56FE\u8F93\u5165\uFF0C272,000 \u4E0A\u4E0B\u6587 / 128,000 \u8F93\u51FA\u3002gpt-6-astra \u89C1\u5355\u72EC\u6761\u76EE\uFF08\u88F8 "gpt-6" \u4E0E 6.1-sol \u7531 astra \u6761\u76EE\u627F\u63A5\uFF0Coff \u4EE5\u7701\u7565\u8868\u8FBE\uFF0C"none" \u672A\u8BC1\u5B9E\u53EF\u624B\u8C03\uFF09\u3002'},{id:"openai-gpt-6-astra",patterns:["gpt-6-astra","gpt-6","gpt-6.1-sol"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:272e3,maxTokens:128e3,note:'GPT-6 Astra \u6863\u4F4D\uFF1ALow / Medium / High / XHigh / Max\u2014\u2014**\u6CA1\u6709 None \u6863**\uFF08\u5B98\u65B9\u539F\u6587\uFF1A\u8BBE\u4E3A none \u8FD4\u56DE HTTP 400\uFF09\uFF0C\u56E0\u6B64\u672C\u6761\u76EE\u4E0D\u58F0\u660E Off\u3002\u5E26\u56FE\u8F93\u5165\uFF1B2026-10 \u6821\u51C6\uFF1A\u4E0A\u4E0B\u6587\u6309 pi-ai 1.2.0 \u76EE\u5F55\u8BB0 272,000\uFF08\u6B64\u524D\u8BEF\u8BB0 1,050,000\uFF09\u3002\u5DE5\u5177\u8C03\u7528\u9700\u8D70 Responses API\u3002gpt-6 luna/sol/terra \u89C1\u5355\u72EC\u6761\u76EE\uFF1B\u88F8 "gpt-6" \u4E0E 6.1-sol\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF09\u7531\u672C\u6761\u76EE\u627F\u63A5\u3002'},{id:"openai-gpt-daybreak",patterns:["gpt-daybreak"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:105e4,maxTokens:128e3,note:"GPT-Daybreak\uFF08blue-latest 1.05M / red-latest 400K\uFF0C2026-10 \u65B0\u589E\uFF09\uFF1Api-ai 1.2.0 \u76EE\u5F55\u5168\u6863 None / Low / Medium / High / XHigh / Max\uFF0C\u5E26\u56FE\u8F93\u5165 / 128,000 \u8F93\u51FA\u3002"},{id:"openai-gpt-realtime",patterns:["gpt-realtime"],efforts:{minimal:"minimal",low:"low",medium:"medium",high:"high",xhigh:"xhigh"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:128e3,maxTokens:32e3,note:"GPT-Realtime 2.1\uFF082026-10 \u65B0\u589E\uFF09\uFF1Api-ai 1.2.0 \u76EE\u5F55\u6863\u4F4D Minimal / Low / Medium / High / XHigh\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF09\uFF0C128,000 \u4E0A\u4E0B\u6587 / 32,000 \u8F93\u51FA\u3002"},{id:"openai-gpt-5-6-cyber",patterns:["gpt-5.6-cyber"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.6-Cyber\uFF1A\u5B98\u65B9\u6A21\u578B\u9875\u672A\u5355\u5217 effort \u503C\u57DF\uFF08\u4E0D\u7B49\u4E8E\u4E0D\u652F\u6301\uFF09\uFF0C\u6545\u6309\u540C\u4EE3\u4FDD\u5B88\u6863 Low / Medium / High / XHigh\uFF1B\u8BE5\u578B\u53F7\u4EC5 Responses API\uFF0C\u5E26\u56FE\u8F93\u5165\u3001400K \u4E0A\u4E0B\u6587\u3002\u5B98\u65B9\u652F\u6301\u7684\u5176\u4ED6\u6863\u4F4D\u53EF\u624B\u8C03\u540E\u5E94\u7528\u3002"},{id:"openai-gpt-4o",patterns:["gpt-4o"],efforts:!1,input:["text","image"],contextWindow:128e3,maxTokens:16384,note:"GPT-4o \u4EE3\u9645\uFF1A\u975E\u63A8\u7406\u6A21\u578B\uFF0C\u4E0D\u652F\u6301 effort \u53C2\u6570\uFF08\u52FF\u52FE\u601D\u8003\u6863\uFF09\uFF1B\u56FE\u7247\u8F93\u5165\u5168\u7CFB\u6807\u914D\uFF0C128K / 16,384 \u8F93\u51FA\u3002"},{id:"openai-gpt-4-1",patterns:["gpt-4.1"],efforts:!1,input:["text","image"],contextWindow:1047576,maxTokens:32768,note:"GPT-4.1 \u5168\u7CFB\uFF08\u542B mini/nano\uFF09\uFF1A\u975E\u63A8\u7406\u6A21\u578B\uFF0C\u4E0D\u652F\u6301 effort \u53C2\u6570\uFF1B\u5B98\u65B9 1,047,576 \u4E0A\u4E0B\u6587 / 32,768 \u8F93\u51FA\uFF0C\u5168\u7CFB\u5E26\u56FE\u8F93\u5165\u3002"},{id:"openai-gpt-4-turbo-preview",patterns:["gpt-4-turbo-preview"],efforts:!1,input:["text"],contextWindow:128e3,maxTokens:4096,note:"GPT-4 Turbo Preview\uFF1A\u975E\u63A8\u7406\u6A21\u578B\uFF0C\u7EAF\u6587\u672C\u8F93\u5165\uFF08\u6B63\u5F0F turbo \u5FEB\u7167\u652F\u6301\u56FE\u7247\uFF0C\u89C1\u4E0B\u6761\uFF09\uFF0C128K\u3002"},{id:"openai-gpt-4-turbo",patterns:["gpt-4-turbo"],efforts:!1,input:["text","image"],contextWindow:128e3,maxTokens:4096,note:"GPT-4 Turbo\uFF1A\u975E\u63A8\u7406\u6A21\u578B\uFF0C\u5B98\u65B9\u652F\u6301\u56FE\u7247\u8F93\u5165\uFF0C128K / 4,096 \u8F93\u51FA\u3002"},{id:"openai-gpt",patterns:["gpt-4","gpt-3.5"],efforts:!1,input:["text"],note:"GPT-4/3.5 \u4EE3\u9645\uFF1A\u975E\u63A8\u7406\u6A21\u578B\uFF0C\u4E0D\u652F\u6301 effort \u53C2\u6570\uFF08\u52FF\u52FE\u601D\u8003\u6863\uFF09\u3002gpt-4-turbo/4.1 \u8D77\u652F\u6301\u56FE\u7247\uFF0C\u89C1\u5355\u72EC\u6761\u76EE\uFF1B\u65B0\u4EE3\u8BF7\u7528 GPT-5 \u7CFB\uFF08\u89C1 openai-chat/gpt-5.x \u6761\u76EE\uFF09\u3002"},{id:"anthropic-claude-5-5",patterns:["claude-haiku-5.5","claude-opus-5-5","claude-sonnet-5-5","haiku-5.5","claude-5-5"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},defaultEffort:"high",compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude 5.5 \u4EE3\uFF08Haiku 5.5 / Opus 5.5 / Sonnet 5.5\uFF09\uFF1Api-ai 1.2.0 \u5B98\u65B9\u76EE\u5F55\u5168\u6863 Low / Medium / High(\u9ED8\u8BA4) / XHigh / Max\uFF0C\u81EA\u9002\u5E94\u601D\u8003\uFF0C1M \u4E0A\u4E0B\u6587 / 128K \u8F93\u51FA\u3002off/minimal \u4EE5\u7701\u7565\u8868\u8FBE\uFF08\u76EE\u5F55\u5C06\u4E24\u952E\u8BB0\u4E3A null\uFF0C\u975E\u663E\u5F0F\u5173\u95ED\uFF09\u3002"},{id:"anthropic-claude-5",patterns:["claude-fable-5","claude-mythos-5","claude-opus-5","claude-sonnet-5"],efforts:{xhigh:"xhigh",max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude 5 \u4EE3\uFF08Fable 5 / Mythos 5 / Opus 5 / Sonnet 5\uFF09\uFF1A2026-10 \u6821\u51C6\u2014\u2014pi-ai 1.2.0 \u5B98\u65B9\u76EE\u5F55\u5DF2\u6536\u7D27\u4E3A XHigh / Max\uFF08low/medium/high \u6863\u5DF2\u4ECE\u8BE5\u4EE3 effort \u76EE\u5F55\u79FB\u9664\uFF1BFable 5 \u4E0E Opus 5 \u53E6\u63A5\u53D7\u4EE5\u7701\u7565\u8868\u8FBE\u7684 off\uFF0CSonnet 5 \u65E0 off\uFF09\u30021M \u4E0A\u4E0B\u6587 / 128K \u8F93\u51FA\uFF08Batch 300K\uFF09\u3002\u5B98\u65B9\u652F\u6301 PDF \u8F93\u5165\u3002\u6CE8\u610F\uFF1AAnthropic \u5B98\u65B9 OpenAI \u517C\u5BB9\u5C42\u4F1A\u5FFD\u7565 effort \u53C2\u6570\uFF0C\u58F0\u660E\u5728\u7B2C\u4E09\u65B9\u7F51\u5173\u6620\u5C04\u65F6\u751F\u6548\u3002"},{id:"anthropic-claude-5-1",patterns:["claude-fable-5-1","claude-mythos-5-1"],efforts:{xhigh:"xhigh",max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude Fable 5.1 / Mythos 5.1\uFF1A2026-10 \u6821\u51C6\u2014\u2014pi-ai 1.2.0 \u76EE\u5F55\u6863\u4F4D XHigh / Max\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF09\uFF0C\u81EA\u9002\u5E94\u601D\u8003\u5E38\u5F00\uFF08\u4E0D\u63A5\u53D7 enabled/disabled\uFF09\u30021M \u4E0A\u4E0B\u6587 / 128K \u8F93\u51FA\uFF1BFable 5.1 \u652F\u6301\u4F1A\u8BDD\u4E2D\u9014\u6539\u6863\uFF08\u9700 beta header\uFF0C\u672C\u63D2\u4EF6\u4E0D\u6D89\u53CA\uFF09\u3002"},{id:"anthropic-claude-mythos-preview",patterns:["claude-mythos-preview"],efforts:{low:"low",medium:"medium",high:"high",max:"max"},defaultEffort:"high",compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude Mythos Preview\uFF1A\u5B98\u65B9\u6863\u4F4D Low / Medium / High / Max\uFF08\u65E0 XHigh\uFF09\uFF0C1M \u4E0A\u4E0B\u6587\u3002pi-ai 1.2.0 \u76EE\u5F55\u65E0 mythos \u6761\u76EE\uFF0C\u672C\u6863\u4F4D\u6CBF\u7528\u5B98\u65B9 effort \u77E9\u9635\u3002"},{id:"anthropic-claude-opus-4-high",patterns:["claude-opus-4-8","claude-opus-4-7"],efforts:{xhigh:"xhigh",max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude Opus 4.7/4.8\uFF1A2026-10 \u6821\u51C6\u2014\u2014pi-ai 1.2.0 \u5B98\u65B9\u76EE\u5F55\u6863\u4F4D\u4EC5 XHigh / Max\uFF08low/medium/high \u5DF2\u4ECE\u8BE5\u4EE3\u76EE\u5F55\u79FB\u9664\uFF1Bxhigh \u4E3A\u5B98\u65B9\u63A8\u8350\u7684\u7F16\u7801\u8D77\u6B65\u6863\uFF09\u30021M \u4E0A\u4E0B\u6587\u3002"},{id:"anthropic-claude-4-6",patterns:["claude-opus-4-6","claude-sonnet-4-6"],efforts:{max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude 4.6 \u4EE3\uFF08Opus 4.6 / Sonnet 4.6\uFF09\uFF1A2026-10 \u6821\u51C6\u2014\u2014pi-ai 1.2.0 \u5B98\u65B9\u76EE\u5F55\u4EC5\u5269 Max \u4E00\u6863\uFF08low/medium/high/xhigh \u5747\u5DF2\u4ECE\u76EE\u5F55\u79FB\u9664\uFF09\u30021M \u4E0A\u4E0B\u6587\u3002"},{id:"anthropic-claude-opus-4-5",patterns:["claude-opus-4-5"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"high",compat:{supportsReasoningEffort:!0},input:["text","image"],contextWindow:2e5,maxTokens:64e3,note:"Claude Opus 4.5\uFF1A\u5B98\u65B9 effort \u652F\u6301\u5217\u8868\uFF0820251101 \u5FEB\u7167\uFF09\uFF0C\u6863\u4F4D Low / Medium / High\uFF08\u65E0 XHigh/Max\uFF09\uFF0C\u53EF\u4E0E budget_tokens \u5E76\u7528\uFF1B200K / 64K\u3002"},{id:"anthropic-claude",patterns:["claude"],efforts:!1,input:["text","image"],contextWindow:2e5,maxTokens:64e3,note:"Claude 3.x \u4E0E Sonnet 4.5 / Haiku 4.5\uFF1A\u5B98\u65B9 effort \u53C2\u6570\u4E0D\u652F\u6301\uFF08\u4EC5 5.5/5/5.1 \u4EE3\u3001Opus 4.5/4.6/4.7/4.8\u3001Sonnet 4.6 \u652F\u6301\uFF09\uFF0C\u601D\u8003\u7531 thinking.type \u63A7\u5236\u2014\u2014\u52FF\u52FE\u601D\u8003\u6863\u3002\u53C2\u8003\u5BB9\u91CF 200K / 64K\uFF08Haiku 3.5 \u4E3A\u7EAF\u6587\u672C\uFF0C\u6309\u9700\u53D6\u6D88\u56FE\u7247\uFF09\u3002Haiku 5.5 \u53CA\u6574\u4E2A 5.5 \u4EE3\u89C1\u4E0A\u65B9 anthropic-claude-5-5 \u6761\u76EE\u3002"},{id:"google-gemini",patterns:["gemini"],efforts:{low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,maxTokens:65536,note:"Gemini \u901A\u7528\u5B89\u5168\u6863\uFF1ALow / Medium / High\uFF08\u5B98\u65B9 OpenAI \u517C\u5BB9\u6620\u5C04\u8868\u53E6\u6536 minimal\uFF1A2.5 \u7CFB\u6620\u5C04\u4E3A 1,024 \u9884\u7B97\u30013.1 Flash-Lite/3 Flash \u539F\u751F minimal\u30013.1 Pro \u843D low\uFF09\u3002none \u4EC5\u80FD\u5173 2.5 \u975E Pro\uFF1B2.5 Pro \u4E0E 3 \u4EE3\u4E0D\u53EF\u5173\uFF1B\u5404\u578B\u9ED8\u8BA4\u4E0D\u4E00\uFF08flash-lite \u9ED8\u8BA4\u5173\uFF09\u3002\u5B98\u65B9\u53E6\u6536\u97F3\u9891/\u89C6\u9891/PDF\u3002Gemma-4 \u89C1\u4E0B\u6761\u3002"},{id:"google-gemma-4",patterns:["gemma-4"],efforts:{off:null,minimal:"MINIMAL",high:"HIGH"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:262144,maxTokens:32768,note:"Gemma 4\uFF0826b/31b-it\uFF09\uFF1A\u4E09\u6863 Minimal / High\uFF08\u6863\u4F4D\u7EBF\u4E3A\u5B98\u65B9\u5927\u5199\u679A\u4E3E\u62FC\u5199\uFF09\uFF0Coff \u4EE5\u7701\u7565\u8868\u8FBE\uFF1BLow/Medium \u4E0D\u88AB\u63A5\u53D7\u3002\u5E26\u56FE\u8F93\u5165\uFF0C262,144 / 32,768\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF09\u3002"},{id:"xai-grok-4-7",patterns:["grok-4.7"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:5e5,maxTokens:5e5,note:'Grok 4.7\uFF1A\u6863\u4F4D Low / Medium / High / XHigh\uFF0C\u601D\u8003\u4E0D\u53EF\u5173\u95ED\uFF08off \u4EC5\u4EE5\u7701\u7565\u8868\u8FBE\uFF09\uFF1B\u5E26\u56FE\u8F93\u5165\uFF0C500K \u4E0A\u4E0B\u6587 / 500K \u8F93\u51FA\uFF082026-10 \u6821\u51C6\uFF1Api-ai 1.2.0 \u5B98\u65B9\u76EE\u5F55\u786E\u8BA4\u6863\u4F4D\u4E0E\u5BB9\u91CF\uFF0C"\u4E0A\u6E38 404"\u4E0E"\u6863\u4F4D\u672A\u8BC1\u5B9E"\u4E24\u6761\u65E7\u8BB0\u5F55\u4F5C\u5E9F\uFF09\u3002grok-4.5 \u4F20 xhigh \u88AB\u9759\u9ED8\u6309 High \u5904\u7406\u7684\u8BF4\u660E\u89C1\u5176\u6761\u76EE\u3002'},{id:"xai-grok-high",patterns:["grok-4.6"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"high",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:5e5,note:'Grok 4.6 \u6863\u4F4D\uFF1ALow / Medium / High(\u9ED8\u8BA4) / XHigh\uFF0C\u601D\u8003\u4E0D\u53EF\u5173\u95ED\uFF1B\u5E26\u56FE\u8F93\u5165\u3001500K \u4E0A\u4E0B\u6587\u3002Grok 4.7 \u89C1\u4E0A\u4E00\u6761\uFF08\u6B64\u524D\u8BB0\u4E3A"\u4E0D\u5B58\u5728"\uFF0C\u5DF2\u968F\u53D1\u5E03\u4F5C\u5E9F\uFF09\u3002'},{id:"xai-grok-4-5",patterns:["grok-4.5"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"high",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:5e5,note:"Grok 4.5 \u6863\u4F4D\uFF1ALow / Medium / High(\u9ED8\u8BA4)\uFF0C\u601D\u8003\u4E0D\u53EF\u5173\u95ED\uFF1B\u5E26\u56FE\u8F93\u5165\u3002\u4F20\u5165 xhigh \u4F1A\u88AB\u5B98\u65B9\u9759\u9ED8\u6309 High \u5904\u7406\u3002"},{id:"xai-grok-4-3",patterns:["grok-4.3"],efforts:{off:"none",low:"low",medium:"medium",high:"high"},defaultEffort:"low",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1e6,maxTokens:3e4,note:"Grok 4.3\uFF1A\u5B98\u65B9\u56DB\u7EA7 reasoning effort\uFF08None / Low(\u9ED8\u8BA4) / Medium / High\uFF09\uFF0C1M \u4E0A\u4E0B\u6587 / 30,000 \u8F93\u51FA\uFF082026-10 \u6821\u51C6\uFF1AXHigh \u6863\u6309 pi-ai 1.2.0 \u76EE\u5F55\u79FB\u9664\u2014\u2014\u5B83\u81EA 4.6 \u8D77\u624D\u52A0\u5165\uFF1B\u5E26\u56FE\u8F93\u5165\uFF09\u3002grok-4-fast \u7B49\u65E7 slug 2026-05-15 \u8D77\u81EA\u52A8\u91CD\u5B9A\u5411\u5230\u672C\u578B\u53F7\u3002"},{id:"xai-grok",patterns:["grok"],efforts:{low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],note:"Grok \u901A\u7528\u6863\u4F4D\uFF1ALow / Medium / High\u3002\u521D\u4EE3 grok-4\u3001grok-4.20 \u4E0E grok-build-0.1 \u4E0D\u63A5\u53D7\u8BE5\u53C2\u6570\uFF08grok-4 \u7CFB\u4E0E grok-3 \u5DF2\u4E8E 2026-05-15 \u9000\u5F79\u5E76\u91CD\u5B9A\u5411\u81F3 4.3\uFF09\uFF1Bgrok-4.20-multi-agent \u7684\u56DB\u6863\u63A7\u5236\u7684\u662F agent \u6570\u91CF\u800C\u975E\u601D\u8003\u6DF1\u5EA6\u3002\u65B0\u65E7\u4EE3\u9645\u8BF7\u4F18\u5148\u9009 4.5/4.6/4.3\uFF1B\u591A\u6A21\u6001\u53D8\u4F53\u6309\u9700\u52FE\u9009\u56FE\u7247\u3002"},{id:"mistral-magistral",patterns:["magistral"],efforts:{off:"none",high:"high"},defaultEffort:"off",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:262144,maxTokens:16384,note:'Magistral\uFF08magistral-medium-latest\uFF09\uFF1A2026-10 \u6821\u51C6\u2014\u2014pi-ai 1.2.0 \u76EE\u5F55\u663E\u793A\u73B0\u5F79 magistral \u8D70 mistral-conversations \u534F\u8BAE\u5E76\u63A5\u53D7 effort\uFF08None / High \u4E24\u6863\uFF0C\u9ED8\u8BA4 None\uFF09\uFF0C\u5E26\u56FE\u8F93\u5165\uFF0C262,144 / 16,384\u3002\u65E9\u524D"\u8BE5\u7EBF\u65E0 effort \u53C2\u6570\u4E14\u5DF2\u5F03\u7528"\u7684\u8BB0\u5F55\u4F5C\u5E9F\u3002'},{id:"mistral-medium-3",patterns:["mistral-medium-3.5","mistral-large-4","mistral-medium-2604","mistral-medium-latest","mistral-small-latest","mistral-small-2603"],efforts:{off:"none",high:"high"},defaultEffort:"off",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],note:"Mistral \u73B0\u5F79\u63A8\u7406\u6863\uFF082026-10 \u6269\u5145\uFF09\uFF1ANone / High \u4E24\u6863\uFF0C\u5B98\u65B9 reasoning_effort \u679A\u4E3E\u5373 none/high\uFF1B\u73B0\u5F79\u578B\u53F7 mistral-large-4\uFF081M\uFF09\u3001mistral-medium-3.5\uFF082604/latest\uFF09\u3001mistral-small-2603\uFF08Small 4\uFF09\u7ECF\u5B83\u63A7\u5236\uFF0C\u5747\u5E26\u89C6\u89C9\u3002\u5BB9\u91CF\uFF1Alarge-4 262,144 \u8F93\u51FA\u3001medium 262,144 \u8F93\u51FA\u3001small 256,000 \u8F93\u51FA\uFF08\u4E0A\u4E0B\u6587\u5747 262,144\uFF09\u3002\u975E\u63A8\u7406\u65E7\u6B3E\u89C1\u4E0B\u6761\u3002"},{id:"mistral-legacy",patterns:["mistral-large-2411","mistral-large-latest","mistral-large-2512","mistral-medium-2505","mistral-medium-2508","mistral-small-2506","mistral-nemo","devstral","ministral","codestral","pixtral","voxtral"],efforts:!1,input:["text","image"],note:"Mistral \u975E\u63A8\u7406\u7EBF\uFF082026-10 \u65B0\u589E\u6761\u76EE\uFF09\uFF1Alarge-2411/2512/latest\u3001medium-2505/2508\u3001small-2506\u3001nemo \u53CA devstral/ministral/codestral/pixtral/voxtral \u7B49\u4E13\u7528\u7EBF\u5747\u4E0D\u63A5\u53D7 effort \u53C2\u6570\uFF08\u52FF\u52FE\u601D\u8003\u6863\uFF09\u3002\u591A\u6570\u73B0\u5F79\u6B3E\u5E26\u89C6\u89C9\uFF08large-2411 \u4E3A\u7EAF\u6587\u672C\uFF09\u3002"},{id:"qwen-vision",patterns:["qwen-vl","qwen2-vl","qwen2-5-vl","qwen3-vl","qvq"],efforts:{off:null,high:"high"},defaultEffort:"high",compat:{thinkingFormat:"qwen"},input:["text","image"],contextWindow:131072,maxTokens:8192,note:"\u901A\u4E49\u89C6\u89C9\u7EBF\uFF08Qwen-VL/QvQ\uFF09\uFF1Aenable_thinking \u5F00\u5173\uFF08\u5F00=High\uFF09\uFF0C\u6536\u56FE\u3002qwen3-vl \u5BB9\u91CF\u66F4\u5927\uFF0C\u6309\u9700\u4E0A\u8C03\u3002"},{id:"qwen-3-8",patterns:["qwen3.8"],efforts:{off:null,low:"low",medium:"medium",xhigh:"xhigh"},defaultEffort:"xhigh",compat:{thinkingFormat:"qwen",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1e6,note:"Qwen 3.8 \u7CFB\uFF1A\u5B98\u65B9 reasoning_effort \u6863\u4F4D XHigh(\u9ED8\u8BA4) / Medium / Low\uFF0Cthinking \u9ED8\u8BA4\u5F00\u3001\u53EF\u6309\u8BF7\u6C42\u5173\u95ED\uFF1B\u539F\u751F\u591A\u6A21\u6001\uFF08qwen3.8-max \u56FE\u50CF/\u89C6\u9891\u7406\u89E3\uFF0C\u89C6\u9891\u672A\u5165\u6838\u5FC3\u8BCD\u8868\uFF09\u30021M \u6863\u4E0A\u4E0B\u6587\u300227B \u4E0E Flash-Next \u5F00\u6E90\u6B3E\u89C1\u5355\u72EC\u6761\u76EE\u3002"},{id:"qwen-3-8-27b",patterns:["qwen3.8-27b"],efforts:{off:null,low:"low",medium:"medium",xhigh:"xhigh"},defaultEffort:"xhigh",compat:{thinkingFormat:"qwen",supportsReasoningEffort:!0},input:["text","image"],contextWindow:262144,note:"Qwen3.8-27B\uFF08dense\uFF0C2026-08-14 \u5F00\u6E90\uFF09\uFF1A\u5B98\u65B9 reasoning_effort \u6863\u4F4D XHigh(\u9ED8\u8BA4) / Medium / Low\uFF0Cthinking \u9ED8\u8BA4\u5F00\u3001\u53EF\u6309\u8BF7\u6C42\u5173\uFF1B\u539F\u751F\u56FE\u50CF+\u89C6\u9891\u7406\u89E3\uFF08\u89C6\u9891\u672A\u5165\u6838\u5FC3\u8BCD\u8868\uFF09\u3002262,144 \u539F\u751F\u4E0A\u4E0B\u6587\u3001\u5B98\u65B9\u58F0\u660E\u53EF\u6269\u81F3 1M\u3002\u6765\u6E90\uFF1AHF Qwen/Qwen3.8-27B \u6A21\u578B\u5361\u3002"},{id:"qwen-3-8-flash-next",patterns:["qwen3.8-flash-next"],efforts:{off:null,low:"low",medium:"medium",xhigh:"xhigh"},defaultEffort:"xhigh",compat:{thinkingFormat:"qwen",supportsReasoningEffort:!0},input:["text","image"],contextWindow:262144,note:"Qwen3.8-Flash-Next\uFF08125B-A6B \u5B9E\u9A8C\u67B6\u6784\uFF0CQwen4 \u524D\u8EAB\uFF09\uFF1A\u5B98\u65B9 reasoning_effort \u6863\u4F4D XHigh(\u9ED8\u8BA4) / Medium / Low + enable_thinking \u5F00\u5173\uFF1B\u539F\u751F\u89C6\u89C9\uFF08Vision Encoder\uFF09\u3002262,144 \u539F\u751F\u4E0A\u4E0B\u6587\u3001\u53EF\u6269\u81F3 1M\u3002\u6765\u6E90\uFF1AHF \u6A21\u578B\u5361\u4E0E qwen.ai \u5B98\u65B9\u535A\u5BA2\u3002"},{id:"qwen",patterns:["qwen","qwq"],efforts:{off:null,high:"high"},defaultEffort:"high",compat:{thinkingFormat:"qwen"},input:["text"],contextWindow:1e6,maxTokens:65536,note:"\u901A\u4E49\u5343\u95EE\uFF1Aenable_thinking \u5F00\u5173\uFF08\u65E0 effort \u6863\uFF09\uFF0C\u5F00=High\uFF1B\u73B0\u5F79\u65D7\u8230\u4E3A qwen3.8 \u7CFB\uFF081M \u6863\u4E0A\u4E0B\u6587\uFF0C\u89C1 qwen-3-8 \u6761\u76EE\uFF09\u30023.6/3.7 \u4EE3\u7684 Plus/Flash \u4EA6\u9ED8\u8BA4\u591A\u6A21\u6001\uFF08\u56FE\u7247/\u89C6\u9891\uFF09\uFF0C\u5982\u63A5\u5165\u8BF7\u6309\u9700\u52FE\u9009\u56FE\u7247\uFF1B\u89C6\u89C9\u7EBF\u89C1 qwen-vision \u6761\u76EE\u3002"},{id:"glm-vision",patterns:["glm-4v","glm-4-6v","glm-4-5v","glm-5v"],efforts:{off:null,high:"high"},defaultEffort:"high",compat:{thinkingFormat:"zai"},input:["text","image"],contextWindow:131072,maxTokens:32768,note:"\u667A\u8C31\u89C6\u89C9\u7EBF\uFF08GLM-4V/4.5V/4.6V/5V\uFF09\uFF1Athinking \u5F00\u5173\uFF08\u5F00=High\uFF09\uFF0C\u6536\u56FE\u3002GLM-4.5V \u4E3A\u5F3A\u5236\u601D\u8003\uFF08\u4F20 disabled \u62A5\u9519\uFF0C\u8BF7\u624B\u52A8\u5220 Off \u6863\uFF09\u3002"},{id:"glm-5-3-flash",patterns:["glm-5.3-flash","glm-5.3-flashx"],efforts:{low:"low",high:"high",max:"max"},defaultEffort:"max",compat:{thinkingFormat:"zai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,maxTokens:131072,note:"GLM-5.3-Flash\uFF08320B\uFF0C\u5B98\u65B9\u6587\u6863 vlm \u5206\u7C7B\uFF09\uFF1A\u5F3A\u5236\u601D\u8003\uFF08thinking.type \u4EC5 enabled\uFF0C\u4E0D\u652F\u6301\u5173\u95ED\uFF09\uFF0C\u6587\u672C\u53C2\u6570\u4E0E GLM-5.3 \u4E00\u81F4\u2014\u2014\u6863\u4F4D Low / High / Max\u3002\u8F93\u5165\u6A21\u6001\uFF1A\u89C6\u9891\u3001\u56FE\u50CF\u3001\u6587\u672C\u3001\u6587\u4EF6\uFF08\u89C6\u9891/\u6587\u4EF6\u672A\u5165\u6838\u5FC3\u8BCD\u8868\uFF0C\u56FE\u7247\u53EF\u52FE\uFF09\u3002\u5B98\u65B9 1M \u4E0A\u4E0B\u6587 / 128K \u6700\u5927\u8F93\u51FA\u3002\u6765\u6E90\uFF1Adocs.bigmodel.cn \u6A21\u578B\u9875\u3002"},{id:"glm-5-3",patterns:["glm-5.3"],efforts:{low:"low",high:"high",max:"max"},defaultEffort:"max",compat:{thinkingFormat:"zai",supportsReasoningEffort:!0},input:["text"],contextWindow:1048576,maxTokens:131072,note:"GLM-5.3 \u6863\u4F4D\uFF1ALow / High / Max\uFF08\u5F3A\u5236\u601D\u8003\uFF0C\u5176\u4F59\u503C\u62A5\u9519\uFF09\u3002\u5B98\u65B9\u5BB9\u91CF 1M / 128K\u3002"},{id:"glm-5-2",patterns:["glm-5.2"],efforts:{off:"none",minimal:"minimal",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},defaultEffort:"max",compat:{thinkingFormat:"zai",supportsReasoningEffort:!0},input:["text"],contextWindow:1048576,maxTokens:131072,note:"GLM-5.2 \u6863\u4F4D\uFF1ANone / Minimal / Low / Medium / High / XHigh / Max\uFF08\u5B98\u65B9\u6620\u5C04\uFF1ALow\xB7Medium\u2192High\u3001XHigh\u2192Max\u3001None\xB7Minimal=\u505C\u6B62\u601D\u8003\uFF09\u3002\u89C6\u89C9\u7EBF\u89C1 glm-vision \u6761\u76EE\u3002"},{id:"glm",patterns:["glm","zhipu","chatglm"],efforts:{off:null,high:"high"},defaultEffort:"high",compat:{thinkingFormat:"zai"},input:["text"],note:"GLM \u901A\u7528\uFF1Athinking \u5F00\u5173\uFF08\u65E0 effort \u6863\uFF09\uFF0C\u5F00=High\uFF1Beffort \u9636\u68AF\u4EC5 GLM-5.2+ \u652F\u6301\uFF08\u89C1\u4E0A\u4E24\u6761\u76EE\uFF09\u3002\u6CE8\u610F GLM-4.7/GLM-4.5V \u4E3A\u5F3A\u5236\u601D\u8003\uFF0C\u4F20 disabled \u4F1A\u62A5\u9519\uFF08\u8BF7\u624B\u52A8\u5220 Off \u6863\uFF09\u3002\u89C6\u89C9\u7EBF\u89C1 glm-vision \u6761\u76EE\u3002"},{id:"kimi-k3",patterns:["kimi-k3"],efforts:{low:"low",high:"high",max:"max"},defaultEffort:"max",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,note:"Kimi K3 \u6863\u4F4D\uFF1ALow / High / Max(\u9ED8\u8BA4 Max)\uFF0C\u8D70\u9876\u5C42 reasoning_effort\uFF1B\u59CB\u7EC8\u63A8\u7406\u3001\u52FF\u4F20 thinking \u5BF9\u8C61\u3002\u539F\u751F\u89C6\u89C9\u7406\u89E3\uFF0C1M \u4E0A\u4E0B\u6587\uFF08\u6700\u5927\u8F93\u51FA\u5B98\u65B9\u672A\u5355\u72EC\u5217\uFF0C\u4E0D\u63D0\u4F9B\uFF09\u3002"},{id:"kimi-k2-vision",patterns:["kimi-k2.6","kimi-k2.5"],efforts:{off:null,high:"high"},defaultEffort:"high",compat:{thinkingFormat:"deepseek"},input:["text","image"],contextWindow:262144,note:"Kimi K2.5/K2.6 \u89C6\u89C9\u4EE3\uFF1Athinking.type \u5F00\u5173\uFF08\u9ED8\u8BA4\u5F00\u3001\u53EF\u5173\uFF09\uFF0C\u5F00=High\uFF1B\u5E26\u89C6\u89C9\uFF0C256K\u3002K2.7 Code \u59CB\u7EC8\u601D\u8003\uFF0C\u89C1\u5355\u72EC\u6761\u76EE\u3002"},{id:"kimi-k27-code",patterns:["kimi-k2.7"],efforts:{high:"high"},defaultEffort:"high",compat:{thinkingFormat:"deepseek"},input:["text","image"],contextWindow:262144,note:"Kimi K2.7 Code\uFF08\u542B\u9AD8\u901F\u7248\uFF09\uFF1A\u59CB\u7EC8\u601D\u8003\u2014\u2014thinking.type \u4EC5\u63A5\u53D7 enabled\uFF08\u4F20 disabled \u62A5\u9519\uFF09\uFF0C\u65E0 Off \u6863\uFF1B\u5E26\u89C6\u89C9\uFF0C256K\u3002"},{id:"kimi-for-coding",patterns:["kimi-for-coding"],efforts:{low:"low",high:"high",max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1048576,maxTokens:32768,note:"Kimi for Coding\uFF1AMoonshot \u7F16\u7801\u4E13\u7EBF\u8D70 anthropic-messages \u534F\u8BAE\u3001\u81EA\u9002\u5E94\u601D\u8003\uFF0C\u6863\u4F4D Low / High / Max\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF09\uFF1B\u5E26\u56FE\u8F93\u5165\uFF0C1M \u4E0A\u4E0B\u6587 / 32,768 \u8F93\u51FA\u3002\u9AD8\u901F\u7248\uFF08-highspeed\uFF09\u65E0 effort \u63A7\u4EF6\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF09\u3002"},{id:"kimi-moonshot-v1-vision",patterns:["moonshot-v1-8k-vision","moonshot-v1-32k-vision","moonshot-v1-128k-vision"],efforts:!1,input:["text","image"],note:"Moonshot V1 \u89C6\u89C9\u65E7\u4EE3\uFF088k/32k/128k \u5404\u4E00\uFF09\uFF1A\u65E0\u601D\u8003\u63A7\u4EF6\uFF08\u751F\u6210\u6A21\u578B\uFF09\u3001\u652F\u6301\u56FE\u7247\u8F93\u5165\uFF1B\u8BE5\u7EBF\u5DF2\u505C\u6B62\u5BF9\u65B0\u7528\u6237\u5F00\u653E\uFF082026-08-31 \u5168\u91CF\u4E0B\u7EBF\uFF0C\u7F51\u5173\u6B8B\u7559\u4ECD\u53EF\u547D\u4E2D\uFF09\u3002"},{id:"kimi",patterns:["kimi","moonshot"],efforts:{off:null,high:"high"},compat:{thinkingFormat:"deepseek"},input:["text"],contextWindow:262144,note:"Kimi \u901A\u7528\uFF1Athinking \u5F00\u5173\uFF08\u65E0 effort \u6863\uFF09\uFF0C\u5F00=High\u3002k2 \u7CFB\u5217 2026-05-25 \u4E0B\u7EBF\u3001kimi-latest 2026-01-28 \u4E0B\u7EBF\u3001moonshot-v1 \u7CFB 2026-08-31 \u5168\u91CF\u4E0B\u7EBF\uFF08\u7F51\u5173\u6B8B\u7559\u4ECD\u53EF\u547D\u4E2D\uFF1Bmoonshot-v1 \u672C\u8EAB\u975E\u601D\u8003\u6A21\u578B\uFF09\u3002\u89C6\u89C9\u4EE3\u4E0E K2.7 Code \u89C1\u5355\u72EC\u6761\u76EE\u3002"},{id:"hunyuan-hy3",patterns:["hy3"],efforts:{low:"low",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],contextWindow:262144,note:"\u6DF7\u5143 hy3\uFF1A\u5F00\u6E90\u5951\u7EA6\u7ECF chat_template_kwargs.reasoning_effort = no_think(\u9ED8\u8BA4)/low/high\uFF1B\u5B98\u65B9\u6A21\u578B\u5361 256K \u4E0A\u4E0B\u6587\uFF08295B MoE\uFF0C2026 \u5F00\u6E90\uFF09\u3002"},{id:"hunyuan-hy4",patterns:["hy4-preview","hy-4-preview"],efforts:{off:"no_think",high:"high"},defaultEffort:"high",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},contextWindow:1e6,note:"\u6DF7\u5143 Hy4 preview\uFF1A\u5B98\u65B9 README\u2014\u2014reasoning \u9ED8\u8BA4 high\uFF08\u6DF1\u5EA6\u601D\u8003\uFF09\uFF0C\u5173\u95ED\u7ECF chat_template_kwargs.reasoning_effort=no_think\uFF1B\u5B98\u65B9\u89C4\u683C\u8868 1M \u4E0A\u4E0B\u6587\uFF08770B-A49B MoE\uFF0CGated DSA\uFF09\u3002low \u6863\u5B98\u65B9\u672A\u5217\uFF0C\u5982\u6709\u8BF7\u624B\u8C03\uFF1B\u89C6\u89C9\u672A\u58F0\u660E\uFF0C\u6309\u9700\u624B\u52FE\u3002\u6765\u6E90\uFF1ATencent-Hunyuan/Hy4-preview \u5B98\u65B9 README\u3002"},{id:"step-5-preview",patterns:["step-5"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1e6,maxTokens:65536,note:'\u9636\u8DC3 Step-5-Preview\uFF08\u5B98\u65B9 id \u5373 step-5-preview\uFF0C\u65E0\u88F8 step-5\uFF1Bpattern \u53D6\u5BB6\u65CF\u4E3B\u5E72\u4EE5\u517C\u5BB9\u7F51\u5173\u5199\u6CD5\uFF09\uFF1A\u6863\u4F4D Low / Medium(\u5B98\u65B9\u6807"\u9ED8\u8BA4\u63A8\u8350") / High\uFF0C\u601D\u8003\u4E0D\u53EF\u5173\u95ED\uFF1B\u539F\u751F\u56FE\u7247 + \u89C6\u9891\u8F93\u5165\uFF1B1M \u4E0A\u4E0B\u6587\u300164K \u6700\u5927\u8F93\u51FA\uFF08\u5B98\u65B9\u53E6\u6CE8 max_tokens \u9ED8\u8BA4 INF\u3001\u4E0E 64K \u4E0A\u9650\u5E76\u5B58\uFF0C\u4EE5\u7AEF\u70B9\u5B9E\u6D4B\u4E3A\u51C6\uFF09\u3002'},{id:"step-3-7",patterns:["step-3.7","step-3.6"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:262144,note:"\u9636\u8DC3 Step-3.6/3.7 \u6863\u4F4D\uFF1ALow / Medium(\u9ED8\u8BA4\u63A8\u8350) / High\uFF0C\u539F\u751F\u56FE\u7247+\u89C6\u9891\u7406\u89E3\u3002\u4E0A\u4E0B\u6587\u4E3A\u8F93\u5165+\u8F93\u51FA\u603B\u548C\u4E0A\u9650\u3002"},{id:"step-3-5",patterns:["step-3.5"],efforts:{low:"low",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],contextWindow:262144,note:"\u9636\u8DC3 Step-3.5 Flash \u6863\u4F4D\uFF1ALow / High\uFF08\u7EAF\u6587\u672C\u63A8\u7406\u65D7\u8230\uFF09\u3002\u4E0A\u4E0B\u6587\u4E3A\u8F93\u5165+\u8F93\u51FA\u603B\u548C\u4E0A\u9650\u3002"},{id:"step",patterns:["step-3","step-2"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],note:"\u9636\u8DC3 Step \u6863\u4F4D\uFF1ALow / Medium / High\uFF08\u9ED8\u8BA4 Medium\uFF0C\u4E0D\u53EF\u5173\u95ED\uFF09\u30023.6/3.7 \u89C6\u89C9\u4EE3\u89C1\u5355\u72EC\u6761\u76EE\u3002"},{id:"doubao",patterns:["doubao","seed"],efforts:{off:null,low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],note:"\u8C46\u5305\u6863\u4F4D\uFF1AOff / Low / Medium / High\u2014\u2014effort \u9636\u68AF\u4ECD\u662F\u793E\u533A\u8BC1\u636E\u3001\u5B98\u65B9 Ark \u6587\u6863\u660E\u5217\u7684\u4E3A thinking.type \u5F00\u5173\uFF082026-08-24 \u590D\u6838\u4ECD\u672A\u89C1\u5230 effort \u5B98\u65B9\u660E\u6587\uFF09\u3002seed \u4EE3\u6536\u56FE\uFF081.5-pro \u4F8B\u5916\uFF09\u3002"},{id:"minimax-m2",patterns:["minimax-m2"],efforts:!1,input:["text"],contextWindow:204800,maxTokens:131072,note:"MiniMax-M2 / M2.5\uFF08\u542B -highspeed\uFF09\uFF1A\u65E0\u601D\u8003\u63A7\u4EF6\u3001\u65E0 effort \u53C2\u6570\uFF08M3 \u624D\u5F15\u5165 thinking \u53C2\u6570\uFF09\uFF0C\u7EAF\u6587\u672C\uFF0C204,800 / 131,072\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF1BM3 \u89C1\u4E0B\u6761\uFF09\u3002"},{id:"minimax-m3",patterns:["minimax-m3"],efforts:{off:null,high:"high"},compat:{thinkingFormat:"deepseek"},input:["text","image"],contextWindow:1048576,maxTokens:512e3,note:"MiniMax-M3\uFF1A\u5B98\u65B9 thinking \u53C2\u6570 enabled/adaptive/disabled\uFF08\u65E0 effort \u6863\uFF09\uFF0C\u5F00=High\u3001\u5173=disabled\uFF1B\u539F\u751F\u591A\u6A21\u6001\uFF08\u56FE/\u89C6\u9891\uFF0C\u6838\u5FC3\u8BCD\u8868\u4EC5\u542B\u56FE\uFF09\uFF0C1M \u4E0A\u4E0B\u6587 / 512,000 \u8F93\u51FA\uFF082026-10 \u6821\u51C6\u8865\u5BB9\u91CF\uFF09\u3002"},{id:"mimo-v2-6",patterns:["mimo-v2.6","mimo-v2.5"],efforts:{off:"none",low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,maxTokens:131072,note:"\u5C0F\u7C73 MiMo v2.6 \u7CFB\u5217\uFF08mimo-v2.6-pro / -flash / -pro-ultraspeed\uFF1B1M \u4E0A\u4E0B\u6587 / 128K \u6700\u5927\u8F93\u51FA\u3001\u539F\u751F\u5168\u6A21\u6001\uFF09\u4E0E\u5176\u524D\u4EE3 mimo-v2.5\u3002\u5B98\u65B9\u6587\u6863\uFF1Athinking.type\uFF08enabled/disabled\uFF0C\u9ED8\u8BA4 enabled\uFF09+ reasoning.effort\uFF08none \u5173\u95ED\uFF1B\u5176\u4F59\u5408\u6CD5\u503C\u5747\u5F00\u542F\uFF0C\u4E14**\u73B0\u9636\u6BB5\u6682\u672A\u533A\u5206\u63A8\u7406\u5F3A\u5EA6**\u2014\u2014minimal \u5F52\u4E00\u4E3A low\u3001xhigh/max/ultra \u5F52\u4E00\u4E3A high\uFF09\uFF0C\u56E0\u6B64\u8FD9\u91CC\u58F0\u660E\u7684\u662F\u7AEF\u70B9**\u63A5\u53D7**\u7684\u6863\u4F4D Off / Low / Medium / High\uFF08xhigh\u3001max \u4E0D\u58F0\u660E\uFF0C\u7AEF\u70B9\u53EA\u4F1A\u6298\u53E0\u4E3A high\uFF09\u3002\u601D\u8003\u6A21\u5F0F\u4E0B temperature / top_p \u4E0D\u53EF\u81EA\u5B9A\u4E49\uFF08\u5F3A\u5236 1.0 / 0.95\uFF09\uFF1B\u5E26\u5DE5\u5177\u8C03\u7528\u7684\u5386\u53F2\u8F6E\u5FC5\u987B\u5B8C\u6574\u56DE\u4F20 reasoning_content\uFF0C\u5426\u5219 400\u3002mimo-v2.5 \u4E0E v2.5-pro \u5B98\u65B9\u5B9A\u4E8E 2026-10-21 \u4E0B\u7EBF\u3002"},{id:"mimo-v2-5-pro",patterns:["mimo-v2.5-pro"],efforts:{off:"none",low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],contextWindow:1048576,maxTokens:131072,note:"\u5C0F\u7C73 MiMo v2.5-Pro\uFF1A\u8BE5\u5BB6\u65CF\u552F\u4E00\u7684**\u7EAF\u6587\u672C**\u6210\u5458\uFF08\u5B98\u65B9\u80FD\u529B\u8868\u672A\u5217\u5168\u6A21\u6001\u7406\u89E3\uFF09\uFF0C1M \u4E0A\u4E0B\u6587 / 128K \u6700\u5927\u8F93\u51FA\uFF0C\u63A8\u7406\u5951\u7EA6\u4E0E v2.6 \u7CFB\u5217\u76F8\u540C\uFF08thinking.type + reasoning.effort\uFF0Cnone \u5173\u95ED\u3001\u5176\u4F59\u6863\u4F4D\u6682\u4E0D\u533A\u5206\u5F3A\u5EA6\uFF09\u3002\u5B98\u65B9\u5B9A\u4E8E 2026-10-21 \u4E0B\u7EBF\u3002"},{id:"baidu-ernie",patterns:["ernie"],efforts:!1,input:["text"],contextWindow:131072,note:"\u767E\u5EA6\u5343\u5E06 ERNIE \u7CFB\uFF1A\u5B98\u65B9 OpenAI \u517C\u5BB9\u63A5\u53E3\u65E0 reasoning_effort \u53C2\u6570\u2014\u2014\u601D\u8003\u7531\u6A21\u578B\u53D8\u4F53\u51B3\u5B9A\uFF08-Thinking \u7CFB\u5217\u59CB\u7EC8\u601D\u8003\u3001\u666E\u901A\u7CFB\u5217\u4E0D\u601D\u8003\uFF09\uFF0C\u52FF\u52FE\u601D\u8003\u6863\u3002ERNIE 4.5 Turbo VL \u652F\u6301\u56FE\u7247\uFF0C\u6309\u9700\u624B\u52FE\uFF1B\u53C2\u8003\u5BB9\u91CF\u53D6 Turbo 128K \u6863\u3002"},{id:"fireworks-ember",patterns:["ember-1"],efforts:{off:"none",low:"low",medium:"medium",high:"high",max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1048576,maxTokens:131072,note:"Fireworks ember-1\uFF1Aanthropic-messages \u534F\u8BAE\u81EA\u9002\u5E94\u601D\u8003\uFF0C\u6863\u4F4D None(\u5173) / Low / Medium / High / Max\uFF08off \u663E\u5F0F none \u62FC\u5199\uFF09\uFF1B\u5E26\u56FE\u8F93\u5165\uFF0C1M \u4E0A\u4E0B\u6587 / 131,072 \u8F93\u51FA\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF09\u3002"},{id:"thinkingmachines-inkling",patterns:["inkling"],efforts:{off:"none",minimal:"minimal",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:524288,maxTokens:131072,note:"Thinking Machines Inkling\uFF1A\u5168\u6863 Minimal / Low / Medium(\u9ED8\u8BA4) / High / XHigh / Max\uFF0Coff \u663E\u5F0F none\uFF1B\u5E26\u56FE\u8F93\u5165\uFF0C512K \u4E0A\u4E0B\u6587 / 131,072 \u8F93\u51FA\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF1Btogether \u4E2D\u7EE7\u4FA7 effort \u53C2\u6570\u672A\u5F00\u653E\uFF0C\u9700\u652F\u6301\u65B9\u8F6C\u53D1\uFF09\u3002"},{id:"antling-ring",patterns:["ring-2.6"],efforts:{high:"high",xhigh:"xhigh"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],contextWindow:262144,maxTokens:65536,note:"\u8682\u8681 Ling Ring-2.6-1T\uFF1A\u6863\u4F4D High / XHigh\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF09\uFF1B262,144 / 65,536\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF09\u3002"},{id:"antling-ling",patterns:["ling-2.6"],efforts:!1,input:["text"],note:"\u8682\u8681 Ling-2.6\uFF08\u542B -flash\uFF09\uFF1A\u975E\u601D\u8003\u6A21\u578B\uFF0C\u65E0 effort \u63A7\u4EF6\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF1BRing-2.6 \u601D\u8003\u7EBF\u89C1\u4E0A\u6761\uFF09\u3002"},{id:"openai-gpt-image",patterns:["gpt-image","dall-e","dalle"],efforts:!1,imageGen:!0,note:"OpenAI \u751F\u56FE\u7CFB\uFF08gpt-image-1 / DALL\xB7E 3\uFF09\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"google-imagen",patterns:["imagen","flash-image","pro-image","nano-banana"],efforts:!1,imageGen:!0,note:'Google \u751F\u56FE\u7CFB\uFF08Imagen / Gemini-Image "nano banana"\uFF09\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002'},{id:"black-forest-flux",patterns:["flux"],efforts:!1,imageGen:!0,note:"FLUX \u7CFB\uFF08FLUX.1 schnell/dev/pro \u7B49\uFF09\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"stability-sd",patterns:["stable-diffusion","sdxl","sd3"],efforts:!1,imageGen:!0,note:"Stability \u751F\u56FE\u7CFB\uFF08Stable Diffusion / SDXL / SD3\uFF09\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"zhipu-cogview",patterns:["cogview"],efforts:!1,imageGen:!0,note:"\u667A\u8C31 CogView \u751F\u56FE\u7CFB\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"aliyun-wanx",patterns:["wanx"],efforts:!1,imageGen:!0,note:"\u963F\u91CC\u4E07\u76F8 Wanx \u751F\u56FE\u7CFB\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"bytedance-seedream",patterns:["seedream","seededit"],efforts:!1,imageGen:!0,note:"\u5B57\u8282 Seedream / SeedEdit \u751F\u56FE\u7CFB\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"qwen-image",patterns:["qwen-image"],efforts:!1,imageGen:!0,note:"\u901A\u4E49\u5343\u95EE Qwen-Image \u751F\u56FE\u7CFB\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"midjourney",patterns:["midjourney","niji"],efforts:!1,imageGen:!0,note:"Midjourney / Niji \u751F\u56FE\u7CFB\uFF08\u4E2D\u8F6C\u5E38\u89C1\uFF09\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"}],Qi={off:null,low:"low",medium:"medium",high:"high"},Um={"openai-completions":Qi,"openai-responses":Qi,"anthropic-messages":Qi,deepseek:{off:"none",low:"low",high:"high",max:"max"}},jm={low:"low",medium:"medium",high:"high"};function Ln(e){return(e??"").toLowerCase().trim()}function Cd(e){return e!==void 0&&/[a-z0-9]/.test(e)}function $t(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g," ").replace(/([a-z])(\d)/g,"$1 $2")}function ea(e,t,n){let r=t===0?void 0:e[t-1],o=e[t+n];return!Cd(r)&&!Cd(o)}function ta(e,t){let n=$t(e)+" "+$t(t??""),r;for(let o of Wm)for(let i of o.patterns){let a=$t(i),s=n.indexOf(a);for(;s>=0;){if(ea(n,s,a.length)){(r===void 0||a.length>r.length)&&(r={entry:o,length:a.length});break}s=n.indexOf(a,s+1)}}return r?.entry}var zm={"deepseek.com":"deepseek","anthropic.com":"anthropic-messages"};function $m(e){let t=Ln(e.api);if(t.length>0)return t;let n=e.baseURL;if(n!==void 0&&n.length>0)try{let o=new URL(n).hostname.toLowerCase().split(".");if(o.length>=2){let i=zm[o.slice(-2).join(".")];if(i!==void 0)return i}}catch{}return"openai-completions"}var pr="openai-completions",Vm="openai-responses",na="anthropic-messages";function Zi(e){if(e===void 0||e.length===0)return!1;let t="";try{t=new URL(e).hostname.toLowerCase()}catch{return!1}if(t.startsWith("[")){let n=t.slice(1,-1);return n==="::1"||n==="::"||n.startsWith("fe80:")||n.startsWith("fc")||n.startsWith("fd")}return!!(t==="localhost"||t.endsWith(".local")||t.endsWith(".internal")||/^(127\.|10\.|192\.168\.)/.test(t)||/^172\.(1[6-9]|2[0-9]|3[01])\./.test(t))}function Ym(e,t){let n=Ln(t),r={...e};if(delete r.supportsMidConvoEffort,delete r.allowedFallbackModels,n===na){for(let o of["thinkingFormat","supportsReasoningEffort","thinkingTokenBudgetField","supportsThinkingTokenBudget","vllmPriority"])delete r[o];return r.forceAdaptiveThinking===void 0?void 0:{forceAdaptiveThinking:r.forceAdaptiveThinking}}if(n===pr)return delete r.forceAdaptiveThinking,Object.keys(r).length===0?void 0:r}var Hd=["supportsReasoningEffort","thinkingFormat","thinkingTokenBudgetField","supportsThinkingTokenBudget","vllmPriority"],Nd=["forceAdaptiveThinking"];function ra(e,t){let n=Ln(t),r;if(n===pr)r=Nd;else if(n===Vm)r=[...Hd,...Nd];else if(n===na)r=Hd;else return;let o=!1,i={...e};for(let a of r)a in i&&(delete i[a],o=!0);return o?i:void 0}function Jm(e,t){let n=Ln(t.api);if(n===pr){let r=e.compat;r!==void 0&&(r=Ym(r,n)??void 0);let o=e.efforts!==!1;return r===void 0?o&&Zi(t.baseURL)?{thinkingTokenBudgetField:"thinking_token_budget"}:void 0:o&&r.thinkingTokenBudgetField===void 0&&r.supportsThinkingTokenBudget!==!0&&Zi(t.baseURL)?{...r,thinkingTokenBudgetField:"thinking_token_budget"}:r}if(n===na&&e.anthropicAdaptive===!0)return{forceAdaptiveThinking:!0}}var Xm=["openai.com","openai.azure.com","deepseek.com","openrouter.ai","z.ai","bigmodel.cn","moonshot.ai","moonshot.cn","aliyuncs.com","anthropic.com","x.ai","together.ai","together.xyz","nvidia.com","cerebras.ai","cloudflare.com","chutes.ai","opencode.ai","ant-ling.com"];function oa(e){if(Ln(e.api)!==pr)return!1;let t=e.baseURL;if(t===void 0||t.length===0)return!1;try{let n=new URL(t).hostname.toLowerCase();return n.includes(".")?!Xm.some(r=>n===r||n.endsWith("."+r)):!1}catch{return!1}}function Id(e,t,n){return e===void 0||!n||e.supportsDeveloperRole!==void 0||!oa(t)?e:{...e,supportsDeveloperRole:!1}}var Od={off:null,low:"low",medium:"medium",high:"high"},Qm=["vl","vision","omni","4o","pixtral","internvl"];function ia(e){let t=$t(e);for(let n of Qm){let r=$t(n),o=t.indexOf(r);for(;o>=0;){if(ea(t,o,r.length))return["text","image"];o=t.indexOf(r,o+1)}}}var Zm=["dall-e","dalle","gpt-image","imagen","flux","stable-diffusion","sdxl","sd3","cogview","wanx","seedream","seededit","midjourney","niji","nano-banana","image-gen","imagegen","qwen-image","grok-2-image"];function eg(e){let t=$t(e);for(let n of Zm){let r=$t(n),o=t.indexOf(r);for(;o>=0;){if(ea(t,o,r.length))return!0;o=t.indexOf(r,o+1)}}return!1}function tg(e){if(e===void 0)return;let t=e.map(n=>n.toLowerCase());if(t.some(n=>Gm.includes(n)))return t.includes("image")?["text","image"]:["text"]}function gt(e,t,n){let r=ta(e,t.displayName),o,i,a,s,d;r?.imageGen===!0&&(a=!0),r?.input!==void 0&&(o=r.input,i="knowledge"),r?.contextWindow!==void 0&&(s=r.contextWindow),r?.maxTokens!==void 0&&(d=r.maxTokens);let l=tg(n?.input);l!==void 0&&(o=l,i="endpoint");let c=n?.output;if(c!==void 0&&(a=c.includes("image")&&!c.includes("text")),n?.contextLength!==void 0&&Number.isFinite(n.contextLength)&&n.contextLength>0&&(s=n.contextLength),o===void 0){let A=ia(e);A!==void 0&&(o=A,i="heuristic")}a===void 0&&eg(e)&&(a=!0),a===!0&&(o=void 0,i=void 0);let p={...o===void 0?{}:{input:o},...i===void 0?{}:{inputSource:i},...a===void 0?{}:{imageGen:a},...s===void 0?{}:{contextWindow:s},...d===void 0?{}:{maxTokens:d}},m=n===void 0?{}:{endpoint:{reasoning:n.reasoning,source:n.source}};if(n?.reasoning===!1)return{efforts:!1,matched:!1,source:"endpoint:"+(n.source??"listing"),confidence:"high",...m,...p};if(r!==void 0){let A=Id(Jm(r,t),t,r.efforts!==!1);return{efforts:r.efforts,...r.efforts!==!1&&r.defaultEffort!==void 0&&r.efforts[r.defaultEffort]!==void 0?{defaultEffort:r.defaultEffort}:{},...A===void 0?{}:{compat:A},matched:!0,entryId:r.id,source:r.id,confidence:"high",...m,...p}}let u=$m(t),f=Um[u]??jm,y=Ln(t.api)===pr?{thinkingFormat:"openai",supportsReasoningEffort:!0}:void 0,g=y!==void 0&&Zi(t.baseURL)?{...y,thinkingTokenBudgetField:"thinking_token_budget"}:y,T=Id(g,t,!0);return n?.reasoning===!0?{efforts:{...Od},...Od.medium!==void 0?{defaultEffort:"medium"}:{},...T===void 0?{}:{compat:T},matched:!1,source:"endpoint:"+(n.source??"listing"),confidence:"medium",...m,...p}:{efforts:f,...f.medium!==void 0?{defaultEffort:"medium"}:{},...T===void 0?{}:{compat:T},matched:!1,source:"protocol:"+u,confidence:"low",...m,...p}}var Pt=(e,t)=>typeof e[t]=="boolean";function ng(e,t){if(Array.isArray(e)){for(let n of e)if(z(n)&&n.id===t)return n}}function rg(e){if(!z(e))return{reasoning:"unknown",source:null};let t=e.supported_features;if(Array.isArray(t)&&t.includes("reasoning"))return{...Ue(e),reasoning:!0,source:"supported_features"};let n=e.supported_parameters;if(Array.isArray(n)&&(n.includes("reasoning")||n.includes("include_reasoning")||n.includes("reasoning_effort")))return{...Ue(e),reasoning:!0,source:"supported_parameters"};if(Pt(e,"supports_reasoning"))return{...Ue(e),reasoning:e.supports_reasoning,source:"supports_reasoning"};if(Pt(e,"supportsReasoning"))return{...Ue(e),reasoning:e.supportsReasoning,source:"supportsReasoning"};if(Pt(e,"can_reason"))return{...Ue(e),reasoning:e.can_reason,source:"can_reason"};if(Pt(e,"reasoning"))return{...Ue(e),reasoning:e.reasoning,source:"reasoning"};let r=e.reasoning_effort;if(r===!1)return{...Ue(e),reasoning:!1,source:"reasoning_effort"};if(typeof r=="string"&&r.trim().length>0||e.supports_reasoning_effort===!0)return{...Ue(e),reasoning:!0,source:"reasoning_effort"};let o=z(e.capabilities)?e.capabilities:void 0;if(o!==void 0){let i=o.thinking,a=z(i)&&typeof i.supported=="boolean"?i.supported:void 0,s=o.effort,d=z(s)&&typeof s.supported=="boolean"?s.supported:void 0;if(d===!0)return{...Ue(e),reasoning:!0,source:"capabilities.effort.supported"};if(a===!0)return{...Ue(e),reasoning:!0,source:"capabilities.thinking.supported"};if(a===!1)return{...Ue(e),reasoning:!1,source:"capabilities.thinking.supported"};if(d===!1)return{...Ue(e),reasoning:!1,source:"capabilities.effort.supported"}}return{...Ue(e),reasoning:"unknown",source:null}}function Ue(e){let t={},n=s=>{if(!Array.isArray(s))return;let d=s.filter(l=>typeof l=="string");return d.length>0?d.map(l=>l.toLowerCase()):[]},r=z(e.architecture)?e.architecture:void 0,o=n(r?.input_modalities);if(o===void 0&&(o=n(e.input_modalities)),o===void 0){let s=z(e.modalities)?e.modalities:void 0;o=n(s?.input)}if(o===void 0){let s=e.capabilities,d=l=>Array.isArray(l)&&l.some(c=>typeof c=="string"&&c.toLowerCase()==="vision");if(d(e.supported_features)||d(s))o=["image"];else if(z(s)){let l=[];for(let c of["image_input","video_input","pdf_input","file_input"]){let p=z(s[c])?s[c]:void 0;if(p===void 0||typeof p.supported!="boolean")continue;let m=c.replace(/_input$/,"");p.supported===!0?l.push(m):l.length===0&&l.push("text")}l.length>0&&(o=l)}}o===void 0&&(Pt(e,"supports_vision")?o=e.supports_vision===!0?["image"]:[]:Pt(e,"supportsVision")?o=e.supportsVision===!0?["image"]:[]:(Pt(e,"supports_images")||Pt(e,"supportsImages"))&&(o=e.supports_images===!0||e.supportsImages===!0?["image"]:[])),o!==void 0&&(t.input=o.length===0?["text"]:o);let i=n(r?.output_modalities);if(i===void 0&&(i=n(e.output_modalities)),i===void 0){let s=z(e.modalities)?e.modalities:void 0;i=n(s?.output)}i!==void 0&&(t.output=i);let a=e.context_length;if(typeof a=="number"&&Number.isFinite(a)&&a>0)t.contextLength=a;else{let d=(z(e.top_provider)?e.top_provider:void 0)?.context_length;if(typeof d=="number"&&Number.isFinite(d)&&d>0)t.contextLength=d;else{let l=e.max_input_tokens;if(typeof l=="number"&&Number.isFinite(l)&&l>0)t.contextLength=l;else{let p=(z(e.limit)?e.limit:void 0)?.context;typeof p=="number"&&Number.isFinite(p)&&p>0&&(t.contextLength=p)}}}return t}function _d(e,t){let n=ng(e,t);return n===void 0?{found:!1,signal:{reasoning:"unknown",source:null}}:{found:!0,signal:rg(n)}}function Pe(e){let n=e?.value?.providers;return typeof n!="object"||n===null||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n).filter(([,r])=>typeof r=="object"&&r!==null&&!Array.isArray(r)))}function ao(e){if(!z(e))return;let t=e.providers;return z(t)?t:void 0}function Fd(e,t){for(let n of[e?.user,e?.base]){let r=ao(n)?.[t];if(z(r)&&r.models!==void 0)return r.models}}function Vt(e){return ao(e?.user)}function so(e,t){let n=e.find(o=>o.id===t);if(n===void 0)return;let r=n.reasoningEfforts;if(r===!1)return!1;if(typeof r=="object"&&r!==null&&!Array.isArray(r))return r}function lo(e,t){let r=e.find(i=>i.id===t)?.input;if(!Array.isArray(r))return;let o=r.filter(i=>typeof i=="string");return o.length>0?o:void 0}function co(e,t){let r=e.find(o=>o.id===t)?.compat;if(z(r))return{...r}}function sa(e,t){return e.find(r=>r.id===t)?.[Ze]===!0}function uo(e,t){let r=e.find(o=>o.id===t)?.name;return typeof r=="string"&&r.length>0?r:void 0}function fo(e,t){let r=e.find(o=>o.id===t)?.[hn];return typeof r=="string"&&r.length>0?r:void 0}var og=3e4,ig=15e3,aa=new Map,io=new Map;async function ag(e){let t=aa.get(e);if(t!==void 0&&Date.now()-t.at<og)return t.data;let n=io.get(e);if(n!==void 0)return n;let r=(async()=>{try{let o=await fetch(`${Xs}?route=${encodeURIComponent(e)}`,{method:"GET",signal:AbortSignal.timeout(ig)});if(!o.ok)return;let i=await o.json();return i?.ok?(aa.set(e,{at:Date.now(),data:i.data}),i.data):void 0}catch{return}finally{io.delete(e)}})();return io.set(e,r),r}function da(){aa.clear(),io.clear()}async function sg(e,t){let n=await ag(e);return n===void 0?{reasoning:"unknown",source:null}:_d(n,t).signal}function po(e,t=()=>le(e),n,r,o,i){return{async suggest(a,s,d,l){let c=Pe((await t()).namespace),p=zt(c,a),m={api:p.api??l?.api,baseURL:p.baseURL??l?.baseURL,displayName:d??p.displayName},u=c[a]===void 0?void 0:await sg(a,s),f=gt(s,m,u);return f.efforts===void 0?{ok:!1,error:"no-suggestion"}:{ok:!0,suggestion:{efforts:f.efforts,...f.compat===void 0?{}:{compat:f.compat},...f.defaultEffort===void 0?{}:{defaultEffort:f.defaultEffort},...f.input===void 0?{}:{input:f.input},...f.inputSource===void 0?{}:{inputSource:f.inputSource},...f.imageGen===void 0?{}:{imageGen:f.imageGen},...f.contextWindow===void 0?{}:{contextWindow:f.contextWindow},...f.maxTokens===void 0?{}:{maxTokens:f.maxTokens},matched:f.matched,source:f.source,confidence:f.confidence,...f.endpoint===void 0?{}:{endpoint:f.endpoint}}}},commit(a,s,d){if(i?.()===!0){n?.(a,s,d.efforts,d.compat,d.input,d.defaultEffort,d.imageGen);return}r?.(a,s,{efforts:d.efforts,...d.compat===void 0?{}:{compat:d.compat},...d.input===void 0?{}:{input:d.input},...d.imageGen===void 0?{}:{imageGen:d.imageGen},...d.defaultEffort===void 0?{}:{defaultEffort:d.defaultEffort}})},withdraw(a,s){o?.(a,s)},stageEfforts(a,s,d,l,c,p,m){n?.(a,s,d,l,c,p,m)},async writeEfforts(a,s,d,l,c,p,m){if(r!==void 0)return r(a,s,{efforts:d,...l===void 0?{}:{compat:l},...c===void 0?{}:{input:c},...m===void 0?{}:{imageGen:m},...p===void 0?{}:{defaultEffort:p}}),{ok:!0,staged:!0};let f=(await mr(e,a,[{modelId:s,efforts:d,...l===void 0?{}:{compat:l},...c===void 0?{}:{input:c},...m===void 0?{}:{imageGen:m},...p===void 0?{}:{defaultEffort:p}}],t))[0]??{ok:!1,error:"no-result"};return f.ok?{ok:!0}:f.modelNotFound===!0?{ok:!1,error:"model-not-found"}:{ok:!1,error:f.error??"conflict"}}}}async function mr(e,t,n,r=()=>le(e),o){if(n.length===0)return[];let i=!1;for(let a=0;a<3;a++)try{let s=a===0?await r():await le(e,{fresh:!0});if(s.namespace===void 0)return n.map(()=>({ok:!1,error:"no-namespace"}));let d=Fd(s.namespace,t);if(!Array.isArray(d))return n.map(()=>({ok:!1,modelNotFound:!0}));if(!d.every(z))return n.map(()=>({ok:!1,error:"invalid-models"}));let c=d.map(u=>u),p=[];for(let u of n){let f=c.findIndex(y=>y.id===u.modelId);if(f<0){p.push(u.modelId);continue}c[f]=dg(c[f],u,i?void 0:u.compat)}if(p.length>0)return n.map(u=>p.includes(u.modelId)?{ok:!1,modelNotFound:!0}:{ok:!1,error:"model-not-found"});if(o?.()===!0)return n.map(()=>({ok:!1,aborted:!0}));let m=await e.settings.mutate(Re,[{op:"set",path:["providers",t,"models"],value:c}],s.namespace.revision);if(!m.ok){if(a===0&&m.error.code==="settings/conflict")continue;let u=m.error.code==="settings/rejected"&&Rd(m.error.message);if(!i&&u&&n.some(f=>f.compat!==void 0)){i=!0;continue}return n.map(()=>({ok:!1,error:m.error.message}))}return n.map(()=>({ok:!0}))}catch(s){return n.map(()=>({ok:!1,error:s instanceof Error?s.message:String(s)}))}return n.map(()=>({ok:!1,error:"conflict"}))}function dg(e,t,n){let r={...e},o=t.efforts!=="keep",i=t.efforts==="keep"?void 0:t.efforts;if(o)if(i===void 0)delete r.reasoningEfforts,r[Qe]=!0;else if(delete r[Qe],delete r[gn],i===!1)r.reasoningEfforts=!1;else{r.reasoningEfforts={...i};let s={...z(e.compat)?e.compat:{},...n??{}};Object.keys(s).length>0&&(r.compat=s)}return t.input!==void 0&&(t.input===null?(delete r.input,r[mt]=!0):(delete r[mt],r.input=[...t.input])),t.imageGen!==void 0&&(t.imageGen===!0?(r[Ze]=!0,delete r.input,delete r[mt]):delete r[Ze]),t.defaultEffort!==void 0&&(t.defaultEffort===null?delete r[hn]:r[hn]=t.defaultEffort),r}function la(e,t){for(let n of[e?.user,e?.base]){let r=ao(n)?.[t];if(!z(r))continue;let o=r.headers;if(o===void 0)continue;if(!z(o))return;let i={};for(let[a,s]of Object.entries(o))typeof s=="string"&&(i[a]=s);return i}}async function gr(e,t,n){if(typeof t!="string"||t.length===0)return{ok:!1,error:"no-route"};let r=!1;for(let o=0;o<2;o+=1)try{let i=o===0?await le(e):await le(e,{fresh:!0});if(i.namespace===void 0)return{ok:!1,error:"no-namespace"};if(i.writable!==!0)return{ok:!1,error:"read-only"};if(!et(i.namespace,t)){r=!0;continue}let a=await e.settings.mutate(Re,[{op:"set",path:["providers",t,"headers"],value:{...n}}],i.namespace.revision);if(!a.ok){if(o===0&&a.error.code==="settings/conflict")continue;return{ok:!1,error:a.error.message}}return{ok:!0}}catch(i){return{ok:!1,error:i instanceof Error?i.message:String(i)}}return r?{ok:!1,error:"no-route"}:{ok:!1,error:"conflict"}}function et(e,t){if(Object.prototype.hasOwnProperty.call(Pe(e),t))return!0;for(let n of[e?.user,e?.base]){let r=ao(n);if(r!==void 0&&Object.prototype.hasOwnProperty.call(r,t))return!0}return!1}async function le(e,t={}){let n=t.fresh===!0?void 0:lg(e,t.allowStale===!0);if(n!==void 0)return n;let r=await e.settings.describe();return r.ok?{namespace:r.value.namespaces.find(i=>i.ns===Re),writable:r.value.writable,source:"wire"}:{namespace:void 0,writable:!1,source:"wire"}}var Dd=new WeakMap;function lg(e,t=!1){let n=e.scope;if(n===void 0)return;let r=n.getSnapshot();if(r===void 0)return;if(r.status==="ready"&&typeof r.revision=="number"){let i={namespace:{ns:Re,schema:{},value:r.value,user:r.user,base:r.base,revision:r.revision,applies:"live",secrets:[]},writable:r.writable===!0,source:"scope"};return Dd.set(n,i),i}if(!t||n===void 0)return;let o=Dd.get(n);if(o!==void 0)return{...o,source:"scope-stale"}}var ca=new Map;function Kd(e){let t=ca,n=!1,r,o=0,i=new Set,a=()=>{for(let d of[...i])d()},s=()=>{if(n)return Promise.resolve();if(r!==void 0)return r;let d=o;return r=le(e,{fresh:!0}).then(l=>{if(d!==o||l.namespace===void 0)return;let c=new Map;for(let[p,m]of Object.entries(Pe(l.namespace))){let u=new Map,f=Array.isArray(m.models)?m.models:[];for(let y of f){if(!z(y)||typeof y.id!="string"||y.id.length===0)continue;let g={};if(Array.isArray(y.input)){let A=y.input.filter(x=>typeof x=="string");A.length>0&&(g.input=A)}y[Ze]===!0&&(g.imageGen=!0);let T=y.contextWindow;typeof T=="number"&&Number.isFinite(T)&&T>0&&(g.contextWindow=T),(g.input!==void 0||g.imageGen!==void 0||g.contextWindow!==void 0)&&u.set(y.id,g)}u.size>0&&c.set(p,u)}t=c,n=!0,a()}).catch(()=>{}).finally(()=>{d===o&&(r=void 0)}),r};return{getSnapshot:()=>t,subscribe(d){return i.add(d),()=>{i.delete(d)}},load:s,invalidate(){o+=1,n=!1,r=void 0,i.size>0&&s()}}}var cg=new Intl.NumberFormat("en-US"),ug=/^(\d+(?:\.\d+)?)([kmbt])?$/i,fg={k:1e3,m:1e6,b:1e9,t:1e12};function ht(e){let t=e.replace(/[,_\s]/g,"");if(t==="")return;let n=ug.exec(t);if(n===null)return;let r=n[2]===void 0?1:fg[n[2].toLowerCase()],o=Math.round(Number(n[1])*r);return Number.isFinite(o)&&o>0?o:void 0}function lt(e){return e===void 0?"":cg.format(e)}function Bd(e){if(e===void 0||!Number.isFinite(e)||e<=0)return"";let t=1024,n=t*1024,r=n*1024,o=r*1024,i=s=>Number.isInteger(s)?String(s):s.toFixed(1).replace(/\.0$/,""),a=[{floor:1e12,binary:o,decimal:1e12,suffix:"T"},{floor:1e9,binary:r,decimal:1e9,suffix:"B"},{floor:1e6,binary:n,decimal:1e6,suffix:"M"},{floor:1e3,binary:t,decimal:1e3,suffix:"K"}];for(let s of a){if(e<s.floor)continue;if(e%s.binary===0)return`${e/s.binary}${s.suffix}`;if(e%s.decimal===0)return`${e/s.decimal}${s.suffix}`;let d=u=>Math.round(u*10)/10,l=e/s.binary,c=e/s.decimal,p=Math.abs(e-d(l)*s.binary),m=Math.abs(e-d(c)*s.decimal);return p<=m?`${i(l)}${s.suffix}`:`${i(c)}${s.suffix}`}return String(e)}var Gd="dsh-model-think-level.slider.efforts",ua="breSelectWired",pg=400;function mg(e){return e===void 0?Promise.resolve(void 0):new Promise(t=>{let n=!1,r=i=>{n||(n=!0,t(i))},o=setTimeout(()=>r(void 0),pg);e.then(i=>{clearTimeout(o),r(i)},()=>{clearTimeout(o),r(void 0)})})}function fa(e){return typeof e=="object"&&e!==null&&e.ok===!1}function pa(e){if(!fa(e))return;let t=e.error,n=typeof t?.code=="string"?t.code:"settings/rejected",r=typeof t?.message=="string"?t.message:"";return r.length>0?`${n}: ${r}`:n}function Yt(e,t){return`${e}/${t}`}function Wd(){try{let e=window.localStorage.getItem(Gd);if(e===null)return{};let t=JSON.parse(e);if(typeof t!="object"||t===null||Array.isArray(t))return{};let n={};for(let[r,o]of Object.entries(t))r.length>0&&typeof o=="string"&&o.trim().length>0&&(n[r]=o);return n}catch{return{}}}function gg(e){try{window.localStorage.setItem(Gd,JSON.stringify(e))}catch{}}function hg(e,t,n){let r=Wd();r[Yt(e,t)]=n,gg(r)}function bg(e,t){return Wd()[Yt(e,t)]}function mo(e,t,n){let o=e.groups.find(i=>i.id===t)?.models.find(i=>i.id===n)?.reasoning?.efforts;return o===void 0?[]:o.map(i=>i.id)}function yg(e,t,n){return e.groups.find(o=>o.id===t)?.models.find(o=>o.id===n)?.reasoning?.defaultEffort}function vg(e){if(!(e.length<2))return e[Math.floor((e.length-1)/2)]}function wg(e,t){return e===null||e.provider!==t.provider||e.model!==t.model}async function qd(e,t,n,r,o){let i=mo(e,t,n);if(i.length===0)return;let a=Yt(t,n),s=r.get(a);if(s!==void 0&&i.includes(s))return s;let d=await mg(o?.configuredEffort===void 0?void 0:o.configuredEffort(t,n));if(d!==void 0&&i.includes(d))return d;let l=bg(t,n);if(l!==void 0&&i.includes(l))return l;let c=gt(n,{}).defaultEffort;if(c!==void 0&&i.includes(c))return c;let p=yg(e,t,n);return p!==void 0&&i.includes(p)?p:vg(i)}function Ud(e,t){let n=e;if(n[ua]===!0)return()=>{};let r=Object.prototype.hasOwnProperty.call(n,"select"),o=e.select,i=new Map,a=new Set,s=new Map,d=3,l=0,c=0,p=async(y,g)=>{if(g.reasoningEffort!==void 0){let O=await o.call(e,g);return!fa(O)&&st()&&(i.set(Yt(g.provider,g.model),g.reasoningEffort),hg(g.provider,g.model,g.reasoningEffort)),O}let T=e.store.getSnapshot();if(!wg(T.current,g)){if(st()){let O=Yt(g.provider,g.model);i.delete(O),a.add(O)}return o.call(e,g)}if(!st())return o.call(e,g);let A=await qd(T,g.provider,g.model,i,t);if(l!==y)return;let x=e.store.getSnapshot(),H=x.current!==null&&x.current.provider===g.provider&&x.current.model===g.model;return!st()||A===void 0||!mo(x,g.provider,g.model).includes(A)?H?void 0:o.call(e,g):o.call(e,{...g,reasoningEffort:A})},m=async y=>{let g=++l;try{return await p(g,y)}finally{g>c&&(c=g)}},u=()=>{let y=e.store.getSnapshot(),g=y.current;if(g===null||g.reasoningEffort!==void 0||!st())return;let T=Yt(g.provider,g.model);if(a.has(T))return;if(mo(y,g.provider,g.model).length===0){a.add(T);return}a.add(T);let A=l;qd(y,g.provider,g.model,i,t).then(async x=>{if(x===void 0){a.delete(T);return}if(!st()){a.delete(T);return}if(l!==A)return;if(l!==c){a.delete(T);return}let H=e.store.getSnapshot(),O=H.current;if(O===null||O.reasoningEffort!==void 0||Yt(O.provider,O.model)!==T||!mo(H,O.provider,O.model).includes(x))return;let J=await o.call(e,{provider:O.provider,model:O.model,reasoningEffort:x});if(fa(J))throw J}).catch(()=>{let x=(s.get(T)??0)+1;s.set(T,x),x<d&&(a.delete(T),u())})},f=e.store.subscribe(u);return u(),n[ua]=!0,e.select=m,()=>{delete n[ua],f(),r?e.select=o:delete n.select}}var xg=1e4;function jd(e){if(e.current===null)return[];let r=e.groups.find(o=>o.id===e.current?.provider)?.models.find(o=>o.id===e.current?.model)?.reasoning?.efforts;return r!==void 0&&r.length>=2?r:[]}function kg(e){return e.current}function zd(e,t){let n=kg(t),r=e.findIndex(s=>s.id===n?.reasoningEffort);if(r>=0)return r;let i=t.groups.find(s=>s.id===n?.provider)?.models.find(s=>s.id===n?.model)?.reasoning?.defaultEffort,a=i===void 0?-1:e.findIndex(s=>s.id===i);return a>=0?a:Math.floor((e.length-1)/2)}function Eg(e){return e?.models??[]}function _t(e){let t=e;return t.name??t.label??t.title??e.id}function ma(e){if(typeof document>"u"||!e.isConnected||e.getClientRects().length===0)return!1;let t=e.getBoundingClientRect();return t.width>0||t.height>0}function Tg(){let[e,t]=(0,M.useState)(null),n=(0,M.useRef)(0),r=(0,M.useCallback)(()=>{window.clearTimeout(n.current),t(null)},[]),o=(0,M.useCallback)((i,a)=>{window.clearTimeout(n.current);let s=i.currentTarget;s.scrollWidth<=s.clientWidth+1||(n.current=window.setTimeout(()=>{ma(s)&&(s.scrollWidth<=s.clientWidth+1||t({target:s,text:a}))},300))},[]);return(0,M.useEffect)(()=>()=>{window.clearTimeout(n.current),t(null)},[]),(0,M.useEffect)(()=>{if(e===null)return;let i=e.target,a=()=>{t(null)};window.addEventListener("pointerdown",a,!0),window.addEventListener("keydown",a,!0),window.addEventListener("scroll",a,!0),window.addEventListener("wheel",a,{capture:!0,passive:!0}),window.addEventListener("resize",a);let s=typeof MutationObserver>"u"?null:new MutationObserver(()=>{ma(i)||a()});return s?.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden"]}),()=>{window.removeEventListener("pointerdown",a,!0),window.removeEventListener("keydown",a,!0),window.removeEventListener("scroll",a,!0),window.removeEventListener("wheel",a,!0),window.removeEventListener("resize",a),s?.disconnect()}},[e]),{tip:e,onEnter:o,onLeave:r}}function Sg({state:e}){if(typeof document>"u")return null;let t=e.target;if(!ma(t))return null;let n=t.getBoundingClientRect();if(n.top>window.innerHeight||n.bottom<0)return null;let r=Math.max(12,Math.min(n.right,window.innerWidth-12));return(0,Yd.createPortal)((0,M.createElement)("div",{className:"bre-tip",role:"tooltip",style:{top:Math.min(n.bottom+6,window.innerHeight-40),right:Math.max(12,window.innerWidth-r)}},e.text),document.body)}var $d=new Map;function Mg(e,t){let n=t??e.input;if(Array.isArray(n)&&n.length>0)return n.includes("image");let r=JSON.stringify([e.id,e.name]),o=$d.get(r);if(o!==void 0)return o;let i=ta(e.id,e.name)?.input,a=i!==void 0?i.includes("image"):(ia(e.id)??[]).includes("image");return $d.set(r,a),a}function Vd(e,t){return t?.imageGen===!0?!0:e.inputImageGen===!0}function Lg(e){let t=e.reasoning?.efforts;return Array.isArray(t)&&t.length>0}function Ag(e){return(0,M.createElement)("svg",{className:"bre-tag-icon",width:13,height:13,viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":e},(0,M.createElement)("path",{d:"M1.8 8s2.4-4.2 6.2-4.2S14.2 8 14.2 8s-2.4 4.2-6.2 4.2S1.8 8 1.8 8z",stroke:"currentColor",strokeWidth:1.3,strokeLinejoin:"round"}),(0,M.createElement)("circle",{cx:8,cy:8,r:1.8,fill:"currentColor"}))}function Rg(e){return(0,M.createElement)("svg",{className:"bre-tag-icon",width:13,height:13,viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":e},(0,M.createElement)("path",{d:"M8 1.9l1.35 3.75L13.1 7l-3.75 1.35L8 12.1 6.65 8.35 2.9 7l3.75-1.35z",fill:"currentColor"}))}function Cg(e){return(0,M.createElement)("svg",{className:"bre-tag-icon",width:13,height:13,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":e},(0,M.createElement)("path",{d:"M9.4 12.7H3.6a1.7 1.7 0 0 1-1.7-1.7V5.1a1.7 1.7 0 0 1 1.7-1.7h4.2"}),(0,M.createElement)("path",{d:"M2.6 10.6 5.3 8.5l1.8 1.5 1.6-1.3 2.3 2"}),(0,M.createElement)("path",{d:"M12.4 2.2l.75 2.05L15.2 5l-2.05.75L12.4 7.8l-.75-2.05L9.6 5l2.05-.75Z",fill:"currentColor",stroke:"none"}))}var Hg=["#22c55e","#a3e635","#eab308","#f97316","#ef4444"],Wx=Hg.map(e=>[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]);function Ng(e,t,n,r=!1){let o=[];return Mg(e,n)&&o.push((0,M.createElement)("span",{key:"vision",className:"bre-tag",title:t("tagVision")},Ag(t("tagVision")))),Lg(e)&&o.push((0,M.createElement)("span",{key:"thinking",className:"bre-tag",title:t("tagThinking")},Rg(t("tagThinking")))),r&&o.push((0,M.createElement)("span",{key:"imageGen",className:"bre-tag",title:t("tagImageGen")},Cg(t("tagImageGen")))),o.length===0?null:(0,M.createElement)("span",{className:"bre-option-tags"},...o)}function Ig(e,t){let n=Bd(e);return n===""?null:(0,M.createElement)("span",{className:"bre-option-cap",title:t("contextWindowLabel")},n)}function Jd(e){let{directory:t,t:n,configuredInputs:r}=e,o=(0,M.useSyncExternalStore)(k=>t.store.subscribe(k),()=>t.store.getSnapshot()),i=(0,M.useSyncExternalStore)(k=>r?.subscribe(k)??(()=>{}),()=>r?.getSnapshot()??ca),a=jd(o),[s,d]=(0,M.useState)(()=>{let k=t.store.getSnapshot(),K=jd(k);return K[zd(K,k)]?.id??""}),[l,c]=(0,M.useState)(""),[p,m]=(0,M.useState)(null),[u,f]=(0,M.useState)(!1),[y,g]=(0,M.useState)(null),T=(0,M.useRef)(null),A=(0,M.useRef)(""),x=(0,M.useRef)(!1),H=o.current!==null&&a.length>=2,O=u,J=y??o.error,U=t.select,v=(0,M.useCallback)(()=>setTimeout(()=>{x.current&&(x.current=!1,f(!1),g(n("sliderCommitSlow")))},xg),[n]);(0,M.useLayoutEffect)(()=>{if(x.current||de.current)return;let k=zd(a,o),K=a[k]?.id??"";A.current=K,d(ue=>ue===K?ue:K),g(null)},[H,a,o]),(0,M.useEffect)(()=>{t.load().catch(()=>{})},[t]),(0,M.useEffect)(()=>{r?.load().catch(()=>{})},[r]);let b=o.current,N=o.groups.find(k=>k.id===b?.provider),E=N?.models.find(k=>k.id===b?.model)?.name??(b===null?n("triggerFallback"):b.model),I=b===null?"":_t(N??{id:b.provider}),F=a.find(k=>k.id===s)?.name??n("effortDefault"),G=(0,M.useSyncExternalStore)(wn,vn),W=(0,M.useSyncExternalStore)(En,ar),h=(0,M.useSyncExternalStore)(Tn,sr),L=(0,M.useCallback)((k,K)=>i.get(k)?.get(K),[i]),P=(0,M.useCallback)((k,K)=>Vd(K,L(k,K.id)),[L]),_=(0,M.useCallback)((k,K)=>Eg(k).filter(ue=>!P(K,ue)),[P]),Y=o.groups.filter(k=>_(k,k.id).length>0&&!W.includes(k.id)).map(k=>k.id),oe=xn(_i(Y),G),ee=p!==null&&oe.includes(p)?p:b!==null&&oe.includes(b.provider)?b.provider:oe[0]??null,se=l.trim().toLowerCase(),te=se!=="",ge=te?oe.flatMap(k=>Ui(_(o.groups.find(K=>K.id===k),k),h[k]??[]).filter(K=>(K.name??K.id).toLowerCase().includes(se)||K.id.toLowerCase().includes(se)).map(K=>({provider:k,choice:K}))):[],j=te?ge:ee===null?[]:Ui(_(o.groups.find(k=>k.id===ee),ee),h[ee]??[]).map(k=>({provider:ee,choice:k})),ne=b===null?"":b.provider+"/"+b.model,fe=n("sliderNoCurrent"),ve=(0,M.useCallback)(()=>{let k=T.current?.closest('[role="menu"], [role="group"]');k!=null&&(k.tabIndex=-1,k.focus({preventScroll:!0}))},[]),$=(0,M.useCallback)(async(k,K)=>{if(x.current)return;let ue=t.store.getSnapshot().current;if(te&&c(""),ue!==null&&ue.provider===k&&ue.model===K)return;x.current=!0,ve(),f(!0),g(null);let Ke=v();try{let Be=await U({provider:k,model:K}),at=pa(Be);if(at!==void 0)throw new Error(at)}catch(Be){g(Be instanceof Error?Be.message:String(Be))}finally{clearTimeout(Ke),x.current=!1,f(!1)}},[v,t,ve,te,U]),X=(0,M.useCallback)(async k=>{if(x.current||k===o.current?.reasoningEffort&&o.status!=="error")return;x.current=!0;let K=A.current;ve(),f(!0),g(null),d(k);let ue=v();try{let Ke=o.current;if(Ke===null)throw new Error(n("sliderNoCurrent"));let Be=await U({provider:Ke.provider,model:Ke.model,reasoningEffort:k}),at=pa(Be);if(at!==void 0)throw new Error(at);let jt=t.store.getSnapshot(),Ys=a.find(xm=>xm.id===jt.current?.reasoningEffort)?.id??k;A.current=Ys,d(Ys)}catch(Ke){A.current=K,d(K),g(Ke instanceof Error?Ke.message:String(Ke))}finally{clearTimeout(ue),x.current=!1,f(!1)}},[v,t,ve,a,U,o.current,o.status,n]),Z=(0,M.useRef)(null),he=(0,M.useRef)(null),xe=(0,M.useRef)(null),de=(0,M.useRef)(!1),we=(0,M.useRef)(null),Ne=(0,M.useRef)(null),Ae=(0,M.useRef)(null),[Ct,Xe]=(0,M.useState)(null),[S,V]=(0,M.useState)(null),ie=Math.max(0,a.findIndex(k=>k.id===s)),be=Ct??ie,ke=(S??(a.length>1?be/(a.length-1):0))*100,ce=k=>{let K=Z.current;if(K===null)return 0;let ue=K.getBoundingClientRect();return ue.width<=0?0:Math.min(1,Math.max(0,(k-ue.left)/ue.width))},Le=k=>a.length>1?Math.round(k*(a.length-1)):0,Fe=k=>{Ne.current=k;let K=k*100;he.current!==null&&(he.current.style.clipPath=`inset(0 ${100-K}% 0 0)`),xe.current!==null&&(xe.current.style.left=`${K}%`)},it=k=>{if(a.length===0)return;let K=ce(k);Ae.current===null&&(Ae.current=requestAnimationFrame(()=>{Ae.current=null,de.current&&Ne.current!==null&&Fe(Ne.current)})),Ne.current=K;let ue=Le(K);ue!==we.current&&(we.current=ue,Xe(ue),V(K))},Wt=()=>{we.current=null,Ne.current=null,Ae.current!==null&&(cancelAnimationFrame(Ae.current),Ae.current=null),Xe(null),V(null)},pn=k=>{if(H){if(k.preventDefault(),de.current=!0,typeof k.currentTarget.setPointerCapture=="function")try{k.currentTarget.setPointerCapture(k.pointerId)}catch{}we.current=Le(ce(k.clientX)),it(k.clientX),Xe(we.current),V(Ne.current)}},Se=k=>{de.current&&it(k.clientX)},jr=k=>{if(!de.current)return;if(de.current=!1,typeof k.currentTarget.releasePointerCapture=="function"&&k.currentTarget.hasPointerCapture?.(k.pointerId)===!0)try{k.currentTarget.releasePointerCapture(k.pointerId)}catch{}let K=Le(ce(k.clientX)),ue=a[K];if(ue===void 0){Wt();return}X(ue.id).finally(Wt)},Ai=k=>{if(!H)return;let K;if(k.key==="ArrowRight"||k.key==="ArrowUp"?K=Math.min(a.length-1,be+1):k.key==="ArrowLeft"||k.key==="ArrowDown"?K=Math.max(0,be-1):k.key==="Home"?K=0:k.key==="End"&&(K=a.length-1),K===void 0)return;k.preventDefault();let ue=a[K];ue!==void 0&&X(ue.id)},{tip:mn,onEnter:Ut,onLeave:rr}=Tg(),zr=(0,M.createElement)("div",{className:"bre-menu-head"},(0,M.createElement)("span",{className:"bre-row-label"},n("modelRowLabel")),(0,M.createElement)("span",{className:"bre-menu-cur"},(0,M.createElement)("span",{className:"bre-menu-name","aria-label":b===null?E:I+" \xB7 "+E,onMouseEnter:k=>{Ut(k,b===null?E:I+" \xB7 "+E)},onMouseLeave:rr},E),I===""?null:(0,M.createElement)("span",{className:"bre-menu-prov"},I))),C=(0,M.createElement)("div",{className:"bre-menu-search"},(0,M.createElement)("div",{className:"bre-menu-search-box"},(0,M.createElement)("span",{className:"bre-menu-search-icon","aria-hidden":!0},(0,M.createElement)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,M.createElement)("circle",{cx:"7",cy:"7",r:"4.5"}),(0,M.createElement)("path",{d:"M10.5 10.5L14 14",strokeLinecap:"round"}))),(0,M.createElement)("input",{type:"text",className:"bre-menu-search-input",role:"searchbox",placeholder:n("modelSearchPlaceholder"),"aria-label":n("modelSearchPlaceholder"),value:l,spellCheck:!1,autoComplete:"off",onChange:k=>{c(k.currentTarget.value)},onKeyDown:k=>{k.key!=="Escape"||l===""||(k.preventDefault(),k.stopPropagation(),c(""))}}),l===""?null:(0,M.createElement)("button",{type:"button",className:"bre-menu-search-clear",title:n("modelSearchClear"),"aria-label":n("modelSearchClear"),onClick:()=>{c("")}},(0,M.createElement)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,M.createElement)("path",{d:"M4 4L12 12M12 4L4 12",strokeLinecap:"round"}))))),ae=(0,M.createElement)("div",{className:"bre-providers",role:"group","aria-label":n("modelRowLabel")},...oe.map(k=>{let K=o.groups.find(ue=>ue.id===k);return(0,M.createElement)("button",{key:k,type:"button",className:"bre-provider"+(k===ee?" is-open":"")+(k===b?.provider?" is-current":""),disabled:O,"aria-expanded":k===ee,onMouseLeave:rr,onClick:()=>{m(k),c("")}},(0,M.createElement)("span",{className:"bre-option-name","aria-label":_t(K),onMouseEnter:ue=>{Ut(ue,_t(K))}},_t(K)),(0,M.createElement)("span",{className:"bre-provider-count"},String(_(K,k).length)))}),...oe.length===0?[(0,M.createElement)("div",{key:"no-providers",className:"bre-empty"},fe)]:[]),Me=(0,M.createElement)("div",{className:"bre-provider-models",role:"group","aria-label":n("modelRowLabel")},...j.length===0?[(0,M.createElement)("div",{key:"no-models",className:"bre-empty"},te?n("modelSearchNoMatches"):fe)]:j.map(({provider:k,choice:K})=>{let ue=k+"/"+K.id,Ke=ue===ne,Be=K.name??K.id,at=te?_t(o.groups.find(jt=>jt.id===k))+" \xB7 "+Be:Be;return(0,M.createElement)("button",{key:ue,type:"button",className:"bre-option"+(Ke?" is-active":""),disabled:O,"aria-pressed":Ke,onMouseLeave:rr,onClick:()=>{$(k,K.id)}},(0,M.createElement)("span",{className:"bre-option-name","aria-label":at,onMouseEnter:jt=>{Ut(jt,at)}},te?(0,M.createElement)("span",{className:"bre-option-origin"},_t(o.groups.find(jt=>jt.id===k))+" \xB7 "):null,Be),Ig(L(k,K.id)?.contextWindow,n),Ng(K,n,L(k,K.id)?.input,Vd(K,L(k,K.id))))})),Ie=(0,M.createElement)("div",{className:"bre-menu-foot"},H?(0,M.createElement)("div",{className:"bre-menu-slider"},(0,M.createElement)("div",{className:"bre-effort-slider-head","aria-hidden":!0},(0,M.createElement)("span",{className:"bre-effort-slider-head-label"},n("effortRowLabel")),(0,M.createElement)("span",{className:"bre-effort-slider-head-value"},a[be]?.name??F)),(0,M.createElement)("div",{className:"bre-effort-slider",ref:Z,role:"slider",tabIndex:0,"aria-label":n("effortRowLabel"),"aria-valuemin":0,"aria-valuemax":a.length-1,"aria-valuenow":be,"aria-valuetext":a[be]?.name,"aria-disabled":O||void 0,"data-bre-dragging":Ct===null?void 0:"true",onPointerDown:pn,onPointerMove:Se,onPointerUp:jr,onPointerCancel:jr,onKeyDown:Ai},(0,M.createElement)("span",{className:"bre-effort-slider-fill",ref:he,style:{clipPath:`inset(0 ${100-ke}% 0 0)`}}),...a.map((k,K)=>K===be?null:(0,M.createElement)("span",{key:"tick-"+k.id,className:"bre-effort-slider-tick",style:{left:a.length>1?`${K/(a.length-1)*100}%`:"0%"}})),(0,M.createElement)("span",{className:"bre-effort-slider-thumb",ref:xe,style:{left:`${ke}%`}})),(0,M.createElement)("div",{className:"bre-effort-slider-labels","aria-hidden":!0},...a.map((k,K)=>(0,M.createElement)("span",{key:k.id,className:"bre-effort-slider-label"+(K===0?" is-first":"")+(K===a.length-1?" is-last":"")+(K===be?" is-on":""),style:{left:a.length>1?`${K/(a.length-1)*100}%`:"0%"}},k.name)))):(0,M.createElement)("span",{className:"bre-row-value is-muted"},n("sliderNoLevels")));return(0,M.createElement)("div",{className:"bre-slider-body",ref:T},(0,M.createElement)("div",{className:"bre-card"},zr,C,(0,M.createElement)("div",{className:"bre-panel bre-panel-models"},ae,Me),Ie),J===null?null:(0,M.createElement)("div",{className:"bre-model-error",role:"status"},J),mn===null?null:(0,M.createElement)(Sg,{key:"tip",state:mn}))}var ye=require("react"),Qd='section[role="group"]',ha='button[role="menuitemradio"]';function Zd(e){return e.querySelector(Qd)!==null}function ga(e){return Array.from(e.querySelectorAll(ha)).filter(t=>!t.disabled&&t.style.display!=="none")}function Og(e){let t=e.getAttribute("aria-labelledby");return(t===null?null:e.ownerDocument.getElementById(t))?.textContent?.toLowerCase()??""}function Xd(e,t,n=new Map){let r=d=>{n.has(d)||n.set(d,d.style.display),d.style.display="none"},o=d=>{let l=n.get(d);l!==void 0&&(d.style.display=l,n.delete(d))};for(let d of[...n.keys()])d.isConnected||n.delete(d);let i=t.trim().toLowerCase().split(/\s+/).filter(Boolean),a=Array.from(e.querySelectorAll(Qd)),s=0;if(i.length===0){for(let d of[...n.keys()])o(d);for(let d of a)s+=d.querySelectorAll(ha).length;return s}for(let d of a){let l=Og(d),c=Array.from(d.querySelectorAll(ha)),p=0;for(let m of c){let u=(m.getAttribute("title")??"").toLowerCase(),f=(m.textContent??"").toLowerCase(),y=`${l} ${u} ${f}`;i.every(g=>y.includes(g))?(o(m),p+=1):r(m)}p>0?(o(d),s+=p):r(d)}return s}function el({menu:e,t}){let[n,r]=(0,ye.useState)(""),[o,i]=(0,ye.useState)(0),a=(0,ye.useRef)(null),s=(0,ye.useRef)(""),d=(0,ye.useRef)(new Map),l=(0,ye.useCallback)(u=>{s.current=u;let f=Xd(e,u,d.current);i(f)},[e]);(0,ye.useEffect)(()=>()=>{Xd(e,"",d.current)},[e]),(0,ye.useEffect)(()=>{let u=new MutationObserver(()=>{s.current.trim().length!==0&&l(s.current)});return u.observe(e,{childList:!0,subtree:!0}),()=>{u.disconnect()}},[e,l]),(0,ye.useEffect)(()=>{let u=f=>{if(s.current.trim().length===0)return;let y=f.key;if(!(y==="ArrowDown"||y==="ArrowUp")&&!(y==="Home"||y==="End"||y==="PageUp"||y==="PageDown")||f.target===a.current||f.target instanceof Node&&!e.contains(f.target))return;let A=ga(e);if(A.length===0)return;let x=A.findIndex(O=>O===document.activeElement),H;y==="Home"||y==="PageUp"?H=0:y==="End"||y==="PageDown"?H=A.length-1:y==="ArrowDown"?H=x===-1?0:(x+1)%A.length:H=x===-1?A.length-1:(x-1+A.length)%A.length,f.preventDefault(),f.stopPropagation(),A[H]?.focus()};return e.addEventListener("keydown",u,!0),()=>{e.removeEventListener("keydown",u,!0)}},[e]);let c=u=>{let f=u.key;if(f==="ArrowDown"){u.preventDefault(),u.stopPropagation(),ga(e)[0]?.focus();return}if(n.trim().length>0&&(f==="ArrowUp"||f==="Home"||f==="PageUp"||f==="End"||f==="PageDown")){let y=ga(e);y.length>0&&(u.preventDefault(),u.stopPropagation(),y[f==="ArrowUp"||f==="End"||f==="PageDown"?y.length-1:0]?.focus());return}f==="Escape"&&n.length>0&&(u.preventDefault(),u.stopPropagation(),r(""),l(""))},p=()=>{r(""),l(""),a.current?.focus({preventScroll:!0})},m=o===0&&n.trim().length>0;return(0,ye.createElement)("div",{className:"bre-model-search-box"+(m?" has-empty":""),"data-bre-search":"1"},(0,ye.createElement)("div",{className:"bre-search-input-wrapper"},(0,ye.createElement)("span",{className:"bre-search-icon","aria-hidden":"true"},(0,ye.createElement)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,ye.createElement)("circle",{cx:"7",cy:"7",r:"4.5"}),(0,ye.createElement)("path",{d:"M10.5 10.5L14 14",strokeLinecap:"round"}))),(0,ye.createElement)("input",{ref:a,type:"text",className:"bre-search-input",role:"searchbox",placeholder:t("modelSearchPlaceholder"),"aria-label":t("modelSearchPlaceholder"),value:n,spellCheck:!1,autoComplete:"off",onChange:u=>{let f=u.currentTarget.value;r(f),l(f)},onKeyDown:c}),n.length>0?(0,ye.createElement)("button",{type:"button",className:"bre-search-clear",title:t("modelSearchClear"),"aria-label":t("modelSearchClear"),onClick:p},(0,ye.createElement)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,ye.createElement)("path",{d:"M4 4L12 12M12 4L4 12",strokeLinecap:"round"}))):null),m?(0,ye.createElement)("div",{className:"bre-search-empty",role:"status"},t("modelSearchNoMatches")):null)}var go=require("react"),tl=require("react-dom"),nl=require("react-dom/client");function ct(){return document.body}function ut(e,t,n){let r=(0,nl.createRoot)(e);return n?.sync===!0?(0,tl.flushSync)(()=>{r.render(t)}):r.render(t),{wrapper:e,root:r}}function He(e){e!==void 0&&(e.root.unmount(),e.wrapper.remove())}var Ge=class extends go.Component{constructor(){super(...arguments);Oe(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n instanceof Error?n.message:String(n)}}componentDidCatch(n,r){console.error("[bre] editor render failed:",n,r.componentStack)}render(){return this.state.error!==null?(0,go.createElement)("div",{style:{color:"#c00",fontSize:"11px",whiteSpace:"pre-wrap",padding:"6px"}},`${this.props.fallbackText}: ${this.state.error}`):this.props.children}};var Pg="conversation.input.model";function rl(e){return e.querySelector("[data-composer-card]")??void 0}function ba(e){return e.querySelector(`[data-slot="${Pg}"]`)??void 0}function ol(e){let t=ba(e)??e;return Array.from(t.querySelectorAll('button[aria-haspopup="menu"]'))}function ya(e){if(e==null)return!1;let t=e.getAttribute("role");return t==="menu"||t==="group"}function va(e){return e.getAttribute("role")==="group"}function il(e,t){let n=e.getAttribute("aria-controls");if(n===null||n.length===0)return;let r=t.getElementById(n);return ya(r)?r:void 0}function wa(e=document){let t=rl(e);if(t===void 0)return;for(let r of ol(t)){let o=il(r,e);if(o!==void 0)return o}let n=ba(t)??t;for(let r of Array.from(n.querySelectorAll('[role="menu"], [role="group"]')))if(r.previousElementSibling?.matches('button[aria-haspopup="menu"]')&&ya(r)&&!(r.getAttribute("role")==="group"&&r.querySelector('[role="menuitemradio"], section[role="group"]')===null))return r}function xa(e=document){let t=rl(e);if(t===void 0)return;let n=ba(t),r=ol(t),o=r[0];if(o!==void 0){for(let i of r)if(il(i,e)!==void 0)return i;for(let i of r)if(ya(i.nextElementSibling))return i;return n===void 0?r.at(-1):o}}function al(){return wa()}function sl(){return xa()}var _g=()=>{(0,dl.flushSync)(()=>{window.dispatchEvent(new Event("resize"))})};function ll(e){let{menuOf:t,triggerOf:n,t:r,refreshed:o,sliderEnabled:i,directory:a}=e,s,d,l,c,p,m,u,f,y=()=>{f?.removeAttribute("data-bre-provider"),f=void 0},g=()=>{let w=n();f!==void 0&&f!==w&&y();let E=m?.store.getSnapshot(),I=E?.current;if(w===void 0||I===null||I===void 0){w===f&&y();return}let F=E?.groups.find(W=>W.id===I.provider),G=F===void 0?I.provider:_t(F);if(G.trim()===""){w===f&&y();return}w.dataset.breProvider=G,f=w},T=()=>{let w=a();w!==m&&(u?.(),u=void 0,m=w,w!==void 0&&(u=w.store.subscribe(g))),g()},A=()=>{He(l),l=void 0},x=new Map,H=()=>{for(let[E,I]of x)E.style.display=I;x.clear();let w=t();w!==void 0&&w.getAttribute("tabindex")==="-1"&&w.removeAttribute("tabindex")},O=w=>w.getAttribute("aria-hidden")!=="true"||w.childElementCount>0?!1:(w.textContent??"").trim()==="",J=(w,E)=>{for(let G of Array.from(x.keys()))(!G.isConnected||G.parentElement!==w)&&x.delete(G);let I=[];for(let G of Array.from(w.children))G!==E&&(O(G)||I.push(G));let F=document.activeElement;F!==null&&F!==E&&!E.contains(F)&&I.some(G=>G.contains(F))&&(w.tabIndex=-1,w.focus({preventScroll:!0}));for(let G of I)x.has(G)||x.set(G,G.style.display),G.style.display!=="none"&&(G.style.display="none")},U=w=>{let E=w.querySelector('section[role="group"]'),I=E?.parentElement,F=I!=null&&I.parentElement===w?I:E;if(l===void 0){let G=document.createElement("div");G.dataset.plugin=Te,G.dataset.breSearch="1",w.insertBefore(G,F),l=ut(G,(0,hr.createElement)(Ge,{fallbackText:r("modelSearchFailed"),children:o(()=>(0,hr.createElement)(el,{menu:w,t:r}))}),{sync:!0});return}if(l.wrapper.parentElement!==w){w.insertBefore(l.wrapper,F);return}F!==null&&l.wrapper.nextSibling!==F&&w.insertBefore(l.wrapper,F)},v=w=>{if(!i()){He(s),s=void 0,d=void 0,w.classList.remove("bre-model-menu-host"),H();for(let W of Array.from(w.children))W.getAttribute("role")==="menuitem"&&(W.style.display="");return}let E=a();if(E===void 0)return;if(s!==void 0&&d!==E&&(He(s),s=void 0,d=void 0),s===void 0){d=E;let W=document.createElement("div");W.dataset.plugin=Te,W.dataset.breSlider="1",w.insertBefore(W,w.firstChild),s=ut(W,(0,hr.createElement)(Ge,{fallbackText:r("renderFailed"),children:o(()=>(0,hr.createElement)(Jd,{directory:E,configuredInputs:e.configuredInputs,t:r}))}),{sync:!0})}else(s.wrapper.parentElement!==w||w.firstChild!==s.wrapper)&&w.insertBefore(s.wrapper,w.firstChild);w.classList.add("bre-model-menu-host");let I=Array.from(w.children).filter(W=>W.getAttribute("role")==="menuitem"),F=s.wrapper;if(va(w)){F.style.display="",J(w,F);return}if(H(),Array.from(w.querySelectorAll('[role="menuitemradio"]')).some(W=>!F.contains(W)))s.wrapper.contains(document.activeElement)&&(w.tabIndex=-1,w.focus({preventScroll:!0})),s.wrapper.style.display="none";else{s.wrapper.style.display="";for(let W of I)W.style.display="none"}};return{reconcile:()=>{T();let w=t();if(w===void 0){s!==void 0&&(i()?s.wrapper.remove():(He(s),s=void 0,d=void 0)),A(),c=void 0,p=void 0,H();return}let E=va(w),I=E&&i(),F=!E&&Zd(w);F?U(w):A(),v(w),(F!==c||I!==p)&&(c=F,p=I,(F||I||i())&&_g())},dispose:()=>{u?.(),u=void 0,m=void 0,y(),He(s),s=void 0,d=void 0,A(),H(),c=void 0,p=void 0}}}var Dg=350;function cl(e){let t,n,r=0,o=()=>{if(t!==void 0)return Promise.resolve();let s=r;return n??(n=le(e.api).then(d=>{if(d.namespace===void 0){n=void 0;return}let l=new Map;for(let[c,p]of Object.entries(Pe(d.namespace))){let m=Array.isArray(p.models)?p.models:[];for(let u of m){if(typeof u!="object"||u===null||Array.isArray(u))continue;let f=u.id,y=u[hn];typeof f=="string"&&typeof y=="string"&&y.length>0&&l.set(`${c}/${f}`,y)}}s===r?t=l:n=void 0}).catch(()=>{s===r&&(n=void 0)})),n};return{of:async(s,d)=>{if(t===void 0){let l=o();await new Promise(c=>{let p=!1,m=()=>{p||(p=!0,c())},u=setTimeout(m,Dg);l.then(()=>{clearTimeout(u),m()},()=>{clearTimeout(u),m()})})}return t?.get(`${s}/${d}`)},invalidate:()=>{r+=1,t=void 0,n=void 0}}}function Fg(e){let t=e.input;return Array.isArray(t)&&t.length>0?!0:e[mt]===!0||e[Ze]===!0}function ka(e,t=()=>!0,n={},r=0){let o=n.efforts!==!1,i=n.modalities!==!1;if(!z(e))return;let a={};for(let s of Object.keys(e)){if(!t(s))continue;let d=e[s],l=z(d)&&Array.isArray(d.models)?d.models:void 0;if(l===void 0||l.length===0)continue;let c=l,p=[],m=!1;for(let u of c){if(!z(u)){p.push(u);continue}let f=u,y=f.reasoningEfforts!==void 0||f[Qe]===!0,g=Fg(f);if((y||!o)&&(g||!i)){let U=Kg(f,e,s);U!==void 0?(m=!0,p.push(U)):p.push(f);continue}let T=typeof f.id=="string"?f.id:"";if(T.length===0){p.push(f);continue}let A=zt(e,s),x=typeof f.name=="string"?f.name:void 0,H=gt(T,{...A,displayName:x??A.displayName});if(H.efforts===void 0){p.push(f);continue}let O={...f},J=!1;if(!y&&o&&H.confidence!=="low"&&(J=!0,O.reasoningEfforts=H.efforts,O[gn]=r,H.compat!==void 0)){let U=z(f.compat)?f.compat:{};O.compat={...U,...H.compat}}if(!g&&i&&(H.imageGen===!0?(J=!0,O[Ze]=!0):H.input!==void 0&&(J=!0,O.input=[...H.input])),!J){p.push(f);continue}m=!0,p.push(O)}m&&(a[s]={models:p})}return Object.keys(a).length===0?void 0:{providers:a}}function Ea(e){if(!z(e))return;let t={};for(let[n,r]of Object.entries(e)){if(!z(r))continue;let o=typeof r.api=="string"?r.api:"";if(o.length===0)continue;let i={},a=z(r.compat)?ra(r.compat,o):void 0;a!==void 0&&(i.compat=a);let s=Array.isArray(r.models)?r.models:void 0;if(s!==void 0&&s.length>0){let d=[],l=!1;for(let c of s){if(!z(c)||!z(c.compat)){d.push(c);continue}let p=ra(c.compat,o);if(p===void 0){d.push(c);continue}l=!0,d.push({...c,compat:p})}l&&(i.models=d)}Object.keys(i).length>0&&(t[n]=i)}return Object.keys(t).length===0?void 0:{providers:t}}function Kg(e,t,n){if(!z(e.reasoningEfforts)||e[Qe]===!0)return;let r=e.compat,o=z(r)?{...r}:{};if(o.supportsDeveloperRole===void 0&&oa(zt(t,n)))return{...e,compat:{...o,supportsDeveloperRole:!1}}}function ul(e){let t,n=0,r=()=>{if(t!==void 0)return t;let i=(async()=>{try{let a=await fetch(Zs,{method:"GET"});if(!a.ok)return;let s=await a.json();return s?.ok!==!0?void 0:{autofill:s.data?.autofill!==!1,modalityAutofill:s.data?.modalityAutofill!==!1}}catch{return}})().then(a=>(a===void 0&&t===i&&(t=void 0),a??{autofill:!0,modalityAutofill:!0}));return t=i,i},o=async i=>{let a=n;try{let s=await r();if(a!==n||!s.autofill)return;let d=i??await le(e.api),l=d.namespace;if(a!==n||l===void 0||d.writable!==!0)return;let c=Vt(l);if(c===void 0||ka(c,()=>!0,{modalities:s.modalityAutofill},l.revision)===void 0)return;let m=d.source==="scope"?await le(e.api,{fresh:!0}):d,u=m.namespace;if(a!==n||u===void 0||m.writable!==!0)return;let f=Vt(u);if(f===void 0)return;let y=ka(f,()=>!0,{modalities:s.modalityAutofill},u.revision);if(y===void 0)return;let g=y.providers,T=Object.entries(g).map(([x,H])=>({op:"set",path:["providers",x,"models"],value:H.models})),A=await e.api.settings.mutate(Re,T,u.revision);A.ok||console.error(`[bre] idle autofill refused: ${A.error.message}`)}catch(s){console.error(`[bre] idle autofill failed: ${s instanceof Error?s.message:String(s)}`)}};return{run:()=>{o()},invalidate:()=>{n+=1,t=void 0}}}function fl(e){let t=async n=>{let r=n??await le(e.api),o=r.namespace;if(o===void 0||r.writable!==!0)return;let i=Vt(o);if(i===void 0||Ea(i)===void 0)return;let a=r.source==="scope"?await le(e.api,{fresh:!0}):r,s=a.namespace;if(s===void 0||a.writable!==!0)return;let d=Vt(s);if(d===void 0)return;let l=Ea(d);if(l===void 0)return;let c=l.providers,p=[];for(let[u,f]of Object.entries(c))for(let y of["compat","models"])f[y]!==void 0&&p.push({op:"set",path:["providers",u,y],value:f[y]});if(p.length===0)return;let m=await e.api.settings.mutate(Re,p,s.revision);m.ok||console.error(`[bre] compat cleanup refused: ${m.error.message}`)};return{run:n=>{t(n).catch(r=>{console.error(`[bre] compat cleanup failed: ${r instanceof Error?r.message:String(r)}`)})}}}var Ks=require("react"),Ip=require("react-dom"),Op=require("react-dom/client");var me=require("react");var Dt=Pd;function Jt(e){let t={};for(let n of Dt){if(e===void 0){t[n]={on:!1,wire:""};continue}if(e===!1){t[n]=n==="off"?{on:!0,wire:""}:{on:!1,wire:""};continue}let r=e[n];t[n]={on:r!==void 0,wire:r===null?"":typeof r=="string"?r:""}}return t}function An(e){let t=!1,n=!1,r={};for(let o of Dt){let i=e[o];if(!i.on)continue;if(o==="off"){t=!0;let s=i.wire.trim();r.off=s.length===0?null:s;continue}n=!0;let a=i.wire.trim();r[o]=a.length===0?o:a}return n?r:t?!1:void 0}function br(e,t){if(e===t)return!0;if(e===!1||e===void 0||t===!1||t===void 0)return!1;let n=Dt.filter(o=>e[o]!==void 0),r=Dt.filter(o=>t[o]!==void 0);return n.length!==r.length?!1:n.every(o=>e[o]===t[o])}function pl(e,t){if(!(e===void 0||e===!1)&&!("off"in e)){if(t==="zai"||t==="deepseek")return"thinking-disabled";if(t==="qwen")return"enable-thinking-false"}}var Ta="bre:auto-effort",ml=Promise.resolve();function gl(e){ml=ml.then(e,e).then(()=>{},()=>{})}function hl(e,t=document){t.dispatchEvent(new CustomEvent(Ta,{detail:{route:e}}))}function bl(e,t=document){let n=r=>{let o=r.detail;typeof o?.route!="string"||o.route.length===0||e(o.route)};return t.addEventListener(Ta,n),()=>{t.removeEventListener(Ta,n)}}var D=require("react/jsx-runtime"),Bg=["M3.4 4.2h9.2","M8 4.2v8.2","M5.9 12.4h4.2"],qg=["M4.4 3.4h7.2a1.9 1.9 0 0 1 1.9 1.9v5.4a1.9 1.9 0 0 1-1.9 1.9H4.4a1.9 1.9 0 0 1-1.9-1.9V5.3a1.9 1.9 0 0 1 1.9-1.9Z","M6.2 7.2a.9.9 0 1 0 0-1.8.9.9 0 0 0 0 1.8Z","M2.9 11.2 6.1 8.4l2.1 1.9 1.8-1.5 2.7 2.4"],Gg=["M9.4 12.7H3.6a1.7 1.7 0 0 1-1.7-1.7V5.1a1.7 1.7 0 0 1 1.7-1.7h4.2","M2.6 10.6 5.3 8.5l1.8 1.5 1.6-1.3 2.3 2","M12.4 2.2l.75 2.05L15.2 5l-2.05.75L12.4 7.8l-.75-2.05L9.6 5l2.05-.75Z"],Wg=["M8 3.2 13.6 12.8H2.4L8 3.2Z","M8 6.9v2.5","M8 11.3h.01"],Ug=["M8 2.6 9.1 6.4 12.9 7.5 9.1 8.6 8 12.4 6.9 8.6 3.1 7.5 6.9 6.4Z","M12.3 2.4v1.9M11.35 3.35h1.9"],jg=["M4.5 6.5 8 10 11.5 6.5"],zg=["M6.5 4.5 10 8 6.5 11.5"];function Rn({paths:e}){return(0,D.jsx)("svg",{viewBox:"0 0 16 16",width:12,height:12,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.map(t=>(0,D.jsx)("path",{d:t},t))})}function Et(e,t){return t===!0?{declared:!1,image:!1,imageGen:!0}:e===void 0||e.length===0?{declared:!1,image:!1,imageGen:!1}:{declared:!0,image:e.includes("image"),imageGen:!1}}function bo(e){return e.imageGen?{input:null,imageGen:!0}:e.declared?{input:e.image?["text","image"]:["text"],imageGen:!1}:{input:null,imageGen:!1}}function ho(e,t,n){return e.imageGen!==(n===!0)?!1:e.imageGen?!0:e.declared?t===void 0?!1:e.image?t.includes("image"):!t.includes("image"):t===void 0}function Sa(e,t,n){let r=e?t:!1;return e&&r===void 0&&n===void 0?"keep":r}function yo(e){let t=e.appliedCompat;return e.initialCompat?.supportsThinkingTokenBudget===!0&&e.initialCompat?.thinkingTokenBudgetField===void 0&&t?.thinkingTokenBudgetField===void 0&&(e.routeApi??"").toLowerCase()==="openai-completions"&&(t={...t??{},thinkingTokenBudgetField:"thinking_token_budget"}),{efforts:e.efforts,...t===void 0?{}:{compat:t},...e.input===void 0?{}:{input:e.input},...e.imageGen===void 0?{}:{imageGen:e.imageGen},...e.defaultEffort===void 0?{}:{defaultEffort:e.defaultEffort}}}function vo({route:e,routeApi:t,routeBaseURL:n,modelId:r,modelName:o,efforts:i,effortsUnset:a=!1,input:s,imageGen:d,compat:l,defaultEffort:c,index:p,staged:m=!1,officialInputTypes:u=!1,api:f,readOnly:y,t:g}){let[T,A]=(0,me.useState)(()=>Jt(i)),[x,H]=(0,me.useState)(()=>Et(s,d)),[O,J]=(0,me.useState)(()=>i!==!1),[U,v]=(0,me.useState)(()=>c??""),[b,N]=(0,me.useState)(!1),[w,E]=(0,me.useState)(void 0),[I,F]=(0,me.useState)(()=>Dt.some(C=>T[C].on&&T[C].wire.trim()!==(C==="off"?"":C))),G=(0,me.useRef)(void 0),W=(0,me.useRef)(void 0);W.current===void 0&&(W.current=f.readCapacities?.()??{});let[h,L]=(0,me.useState)(()=>lt(W.current?.contextWindow)),[P,_]=(0,me.useState)(()=>lt(W.current?.maxTokens)),[Y,oe]=(0,me.useState)(void 0),ee=(0,me.useRef)(!1),se=(0,me.useRef)(i),te=(0,me.useRef)(s),ge=(0,me.useRef)(d),j=(0,me.useRef)(c),ne=(0,me.useRef)(void 0),fe=(0,me.useRef)(i);fe.current=i;let ve=(0,me.useRef)(a);ve.current=a,(0,me.useEffect)(()=>bl(C=>{if(C!==e||fe.current!==void 0||ve.current)return;let ae=ne.current;ae!==void 0&&gl(ae)}),[e]),(0,me.useEffect)(()=>{br(se.current,i)||(se.current=i,ee.current||(A(Jt(i)),J(i!==!1))),(te.current!==s||ge.current!==d)&&(te.current=s,ge.current=d,ee.current||H(Et(s,d))),j.current!==c&&(j.current=c,ee.current||v(c??""))},[i,s,d,c]);let $=Dt.filter(C=>T[C].on),X=U===(c??"")?void 0:U===""?null:U,Z=O?An(T):!1,he=!br(Z,i)||!ho(x,s,d)||X!==void 0,xe=(0,me.useRef)(void 0),de=()=>{ee.current=!0},we=(C,ae,Me,Ie=O)=>{let k=Sa(Ie,An(C),i),ue=!ho(ae,s,d)?bo(ae):void 0,Ke=Me===(c??"")?void 0:Me===""?null:Me,Be=yo({efforts:k,input:ue?.input,imageGen:ue?.imageGen,defaultEffort:Ke,appliedCompat:G.current,routeApi:t,initialCompat:l}),at=JSON.stringify(Be);xe.current!==at&&(xe.current=at,f.commit(e,r,Be))},Ne=(C,ae)=>{de();let Me=!ae&&U===C?"":U;Me!==U&&v(Me);let Ie={...T,[C]:{...T[C],on:ae}};ae&&C!=="off"&&Ie[C].wire.trim().length===0&&(Ie[C]={...Ie[C],wire:C}),A(Ie),we(Ie,x,Me),E(void 0)},Ae=C=>{de(),J(C);let ae=C?U:"";ae!==U&&v(ae),we(T,x,ae,C),E(void 0)},Ct=(C,ae)=>{de();let Me={...T,[C]:{...T[C],wire:ae}};A(Me),we(Me,x,U),E(void 0)},Xe=C=>{de();let ae={declared:!0,image:C,imageGen:!1};H(ae),we(T,ae,U),E(void 0)},S=()=>{de();let C={declared:!1,image:!1,imageGen:!1};H(C),we(T,C,U),E(void 0)},V=C=>{de();let ae=C?{declared:!1,image:!1,imageGen:!0}:{declared:!1,image:!1,imageGen:!1};H(ae),we(T,ae,U),E(void 0)},ie=C=>{de(),v(C),we(T,x,C),E(void 0)},be=(C,ae)=>{let Me=ae.slice(0,20),Ie=C==="context"?Me:h,k=C==="output"?Me:P;oe(C),C==="context"?L(Me):_(Me),f.setCapacities?.({contextWindow:ht(Ie),maxTokens:ht(k)})},ke=C=>{C==="context"?L(ae=>lt(ht(ae))):_(ae=>lt(ht(ae))),oe(void 0)},ce=C=>{de();let ae=C.efforts!==!1;J(ae);let Me=Jt(C.efforts);A(Me);let Ie=C.imageGen===!0?Et(void 0,!0):C.input===void 0?x:Et(C.input);Ie!==x&&H(Ie);let k=U===""&&C.defaultEffort!==void 0?C.defaultEffort:U;if(k!==U&&v(k),G.current=C.compat,C.contextWindow!==void 0||C.maxTokens!==void 0){f.fillCapacities?.(C.contextWindow,C.maxTokens);let K=f.readCapacities?.();L(lt(K?.contextWindow)),_(lt(K?.maxTokens))}E(void 0),we(Me,Ie,k,ae)},Le=async()=>{if(!(y||b)){N(!0),E(void 0);try{let C=m?await f.suggest(e,r,o,{...t===void 0?{}:{api:t},...n===void 0?{}:{baseURL:n}}):await f.suggest(e,r,o);if(!C.ok){E({kind:"error",text:C.error==="no-suggestion"?g("noSuggestion"):C.error});return}ce(C.suggestion)}catch(C){E({kind:"error",text:g("writeError",{message:String(C)})})}finally{N(!1)}}};(0,me.useEffect)(()=>{ne.current=Le});let Fe=()=>{ee.current=!1,f.withdraw(e,r),A(Jt(i)),J(i!==!1),H(Et(s,d)),v(c??""),G.current=void 0;let C=W.current??{};L(lt(C.contextWindow)),_(lt(C.maxTokens)),oe(void 0),f.setCapacities?.({contextWindow:C.contextWindow,maxTokens:C.maxTokens}),E(void 0),xe.current=void 0},it=(0,me.useMemo)(()=>gt(r,{...t===void 0?{}:{api:t},...n===void 0?{}:{baseURL:n}}).compat?.thinkingFormat,[r,t,n]),Wt=G.current?.thinkingFormat??it,pn=pl(i,Wt),Se=y||b,jr=O?$.length===0?g("stateUndeclared"):g("stateDeclared",{count:$.length,default:g(U===""?"defaultEffortUnset":"level_"+U)}):g("thinkingModeOff"),Ai=U!==""&&!$.includes(U)?[...$,U]:$,mn=ht(h),Ut=ht(P),rr=mn!==void 0&&Ut!==void 0&&Ut>mn,zr=(0,D.jsxs)(D.Fragment,{children:[rr?(0,D.jsxs)("p",{className:"bre-effort-note bre-warn",children:[(0,D.jsx)(Rn,{paths:Wg}),g("capacityRule")]}):null,(0,D.jsxs)("div",{className:"bre-effort-cols",children:[(0,D.jsxs)("div",{className:"bre-effort-sec",children:[(0,D.jsx)("span",{className:"bre-effort-label",children:g("contextWindowLabel")}),(0,D.jsxs)("span",{className:"bre-cap-box",children:[(0,D.jsx)("input",{type:"text",inputMode:"text",className:"bre-cap-input",value:Y==="context"?h:lt(mn),disabled:Se,placeholder:g("capacityBlank"),"aria-label":g("contextWindowLabel")+" "+String(p+1),onFocus:()=>{oe("context")},onBlur:()=>{ke("context")},onChange:C=>{be("context",C.target.value)}}),(0,D.jsx)("span",{className:"bre-cap-unit",children:g("tokensUnit")})]}),(0,D.jsx)("p",{className:"bre-effort-note",children:g("capacityInherit")})]}),(0,D.jsxs)("div",{className:"bre-effort-sec",children:[(0,D.jsx)("span",{className:"bre-effort-label",children:g("maxTokensLabel")}),(0,D.jsxs)("span",{className:"bre-cap-box",children:[(0,D.jsx)("input",{type:"text",inputMode:"text",className:"bre-cap-input",value:Y==="output"?P:lt(Ut),disabled:Se,placeholder:g("capacityBlank"),"aria-label":g("maxTokensLabel")+" "+String(p+1),onFocus:()=>{oe("output")},onBlur:()=>{ke("output")},onChange:C=>{be("output",C.target.value)}}),(0,D.jsx)("span",{className:"bre-cap-unit",children:g("tokensUnit")})]}),(0,D.jsx)("p",{className:"bre-effort-note",children:g("capacityUnitsHint")})]})]})]});return(0,D.jsxs)("div",{className:"bre-effort-editor","data-plugin":Te,children:[(0,D.jsxs)("div",{className:"bre-effort-modality",children:[(0,D.jsx)("span",{className:"bre-effort-label",children:g("inputModality")}),(0,D.jsxs)("div",{className:"bre-pillrow",role:"group","aria-label":g("inputModality"),children:[(0,D.jsxs)("button",{type:"button",className:x.declared?"bre-lvl bre-lvl--opt is-on":"bre-lvl bre-lvl--opt",disabled:Se,"aria-pressed":x.declared,"aria-label":g("modalityText")+" "+String(p+1),title:g("modalityText"),onClick:()=>{x.declared?S():Xe(!1)},children:[(0,D.jsx)(Rn,{paths:Bg}),g("modalityText")]}),(0,D.jsxs)("button",{type:"button",className:x.declared&&x.image?"bre-lvl bre-lvl--opt is-on":"bre-lvl bre-lvl--opt",disabled:Se,"aria-pressed":x.declared&&x.image,"aria-label":g("modalityImage")+" "+String(p+1),title:g("modalityImage"),onClick:()=>{Xe(!(x.declared&&x.image))},children:[(0,D.jsx)(Rn,{paths:qg}),g("modalityImage")]}),(0,D.jsxs)("button",{type:"button",className:x.imageGen?"bre-lvl bre-lvl--opt is-on":"bre-lvl bre-lvl--opt",disabled:Se,"aria-pressed":x.imageGen,"aria-label":g("modalityImageGen")+" "+String(p+1),title:g("modalityImageGen"),onClick:()=>{V(!x.imageGen)},children:[(0,D.jsx)(Rn,{paths:Gg}),g("modalityImageGen")]})]}),(0,D.jsx)("p",{className:"bre-effort-note",children:x.imageGen?g("modalityImageGenHint"):x.declared?g("modalityDeclared"):g("modalityInherit")})]}),(0,D.jsxs)("div",{className:"bre-effort-top",children:[(0,D.jsxs)("label",{className:"bre-thinking-switch",children:[(0,D.jsx)("input",{type:"checkbox",checked:O,disabled:Se,"aria-label":g("thinkingMode")+" "+String(p+1),onChange:C=>{Ae(C.target.checked)}}),(0,D.jsx)("span",{className:"bre-effort-switch-track","aria-hidden":"true"}),(0,D.jsx)("span",{className:"bre-effort-title",children:g("thinkingMode")})]}),(0,D.jsx)("span",{className:"bre-effort-state",children:jr})]}),O?(0,D.jsxs)(D.Fragment,{children:[i===!1?(0,D.jsx)("p",{className:"bre-effort-note bre-effort-note--top",children:g("reasoningDisabled")}):null,pn===void 0?null:(0,D.jsx)("p",{className:"bre-effort-note bre-effort-note--top",children:g(pn==="thinking-disabled"?"defaultRiskDisabled":"defaultRiskQwen")})]}):null,O?(0,D.jsxs)("div",{className:"bre-effort-card",children:[(0,D.jsxs)("div",{className:"bre-effort-sec",children:[(0,D.jsxs)("div",{className:"bre-effort-labelrow",children:[(0,D.jsx)("span",{className:"bre-effort-label",children:g("levelsLabel")}),(0,D.jsx)("span",{className:"bre-effort-grow"}),(0,D.jsxs)("button",{type:"button",className:"bre-effort-adapt",disabled:Se,onClick:()=>{Le()},children:[(0,D.jsx)(Rn,{paths:Ug}),g("autoAdapt")]})]}),(0,D.jsx)("div",{className:"bre-pillrow",role:"group","aria-label":g("levelsLabel"),children:Dt.map(C=>{let ae=T[C];return(0,D.jsx)("button",{type:"button",className:ae.on?"bre-lvl is-on":"bre-lvl",disabled:Se,"aria-pressed":ae.on,"aria-label":g("level_"+C)+" "+String(p+1),title:g("level_"+C),onClick:()=>{Ne(C,!ae.on)},children:g("level_"+C)},C)})}),(0,D.jsx)("p",{className:"bre-effort-hint",children:g("levelsHint")}),$.length===0?null:(0,D.jsxs)("button",{type:"button",className:"bre-effort-wiretoggle",disabled:Se,"aria-expanded":I,onClick:()=>{F(!I)},children:[(0,D.jsx)(Rn,{paths:I?jg:zg}),g(I?"wireHide":"wireShow")]}),$.length===0||!I?null:(0,D.jsxs)("div",{className:"bre-wire",children:[(0,D.jsx)("div",{className:"bre-wire-grid",children:$.map(C=>(0,D.jsxs)(me.Fragment,{children:[(0,D.jsx)("span",{className:"bre-wire-name",children:g("level_"+C)}),(0,D.jsx)("input",{type:"text",className:"bre-effort-wire",value:T[C].wire,disabled:Se,placeholder:g("wirePlaceholder"),"aria-label":g("level_"+C)+" "+g("wireValue"),onChange:ae=>{Ct(C,ae.target.value)}})]},C))}),(0,D.jsx)("p",{className:"bre-effort-note",children:g("wireHint")})]})]}),$.length===0?null:(0,D.jsx)("div",{className:"bre-effort-cols",children:(0,D.jsxs)("div",{className:"bre-effort-sec",children:[(0,D.jsx)("span",{className:"bre-effort-label",children:g("defaultEffortLabel")}),(0,D.jsxs)("select",{className:"bre-effort-select",value:U,disabled:Se,"aria-label":g("defaultEffortLabel"),onChange:C=>{ie(C.target.value)},children:[(0,D.jsx)("option",{value:"",children:g("followMemory")}),Ai.map(C=>(0,D.jsx)("option",{value:C,children:g("level_"+C)},C))]}),(0,D.jsx)("p",{className:"bre-effort-note",children:g("defaultEffortHint")})]})}),m?(0,D.jsx)("p",{className:"bre-effort-note",children:g("stagedHint")}):null,An(T)===void 0&&i!==void 0?(0,D.jsx)("p",{className:"bre-effort-note",children:g("bareHint")}):null,(0,D.jsx)("span",{className:"bre-effort-sep"}),zr,w===void 0?null:(0,D.jsx)("p",{className:"bre-effort-message bre-"+w.kind,role:w.kind==="error"?"alert":"status",children:w.text}),(0,D.jsx)("div",{className:"bre-effort-actions",children:(0,D.jsx)("button",{type:"button",className:"bre-secondary-button",disabled:Se||!he,onClick:Fe,children:g("reset")})})]}):(0,D.jsxs)("div",{className:"bre-effort-card bre-effort-card--capacity",children:[zr,w===void 0?null:(0,D.jsx)("p",{className:"bre-effort-message bre-"+w.kind,role:w.kind==="error"?"alert":"status",children:w.text})]})]})}function pe(e,t,n){e.getAttribute(t)!==n&&e.setAttribute(t,n)}function ft(e,t){e!==void 0&&e.hidden!==t&&(e.hidden=t)}function _e(e,t,n){e.classList.contains(t)!==n&&(n?e.classList.add(t):e.classList.remove(t))}function yr(e,t){e!==void 0&&e.textContent!==t&&(e.textContent=t)}var Ft="data-bre-auto-effort",Ma='[class*="modelCatalog"]',$g='[class*="modelListHead"]',Vg='button[class*="linkButton"]',Yg="bre-auto-effort",Jg="bre-auto-effort-note",Xg="data-bre-auto-effort-phase",vl="bre-auto-effort-note-text",wl="bre-auto-effort-note-detail",Qg=3e3;function Zg(e){return e.blocked==="busy"?null:e.failed!==void 0?{phase:"failed",count:0,missed:0,detail:e.failed}:e.blocked!==void 0?{phase:"blocked",count:0,missed:0,detail:""}:e.held>0?{phase:"done",count:e.held,missed:e.unsuggested,detail:""}:e.unsuggested>0?{phase:"unsuggested",count:0,missed:e.unsuggested,detail:""}:{phase:"empty",count:0,missed:0,detail:""}}function La(e){return Array.from(e.querySelectorAll(Ma)).filter(t=>(t.parentElement?.closest(Ma)??null)===null)}function wo(e,t,n){let r=new Map;for(let s of t)s.route.length!==0&&s.catalogue.isConnected&&r.set(s.catalogue,s.route);let o=n.t("autoAdaptAll");for(let[s,d]of r){let l=s.querySelector($g)??s,c=l.querySelector(`[${Ft}]`)??th();kl.set(c,n);let p=eh(l);p!==null?p.nextElementSibling!==c&&p.after(c):l.lastElementChild!==c&&l.append(c),ih(c,d,o)}let i=new Set,a=new Set(r.values());for(let s of Array.from(e.querySelectorAll(`[${Ft}]`))){let d=s.closest(Ma),l=s.getAttribute(Ft)??"";if(d===null||!r.has(d)||i.has(d)){s.remove(),l.length>0&&!a.has(l)&&Aa(l);continue}i.add(d)}}function Aa(e){let t=Xt.get(e);t!==void 0&&(t.timer!==null&&clearTimeout(t.timer),t.note.remove(),Xt.delete(e))}function xl(){for(let e of Array.from(document.querySelectorAll(`[${Ft}]`)))e.remove();for(let e of Xt.values())e.timer!==null&&clearTimeout(e.timer),e.note.remove();Xt.clear()}function eh(e){let t=Array.from(e.querySelectorAll(Vg));return t.length===0?null:t[t.length-1]}function th(){let e=document.createElement("button");return e.className=Yg,e.setAttribute("type","button"),e.setAttribute(Ft,""),e.addEventListener("click",()=>{let t=e.getAttribute(Ft)??"";if(t.length===0)return;let n=kl.get(e);n!==void 0&&(hl(t),nh(t,n))}),e}async function nh(e,t){if(t.onRequest===void 0)return;yl(e,{phase:"working",count:0,missed:0,detail:""},t,0);let n;try{n=await t.onRequest(e)}catch(o){n={held:0,unsuggested:0,failed:String(o)}}if(n===void 0){Aa(e);return}let r=Zg(n);r!==null&&yl(e,r,t,Qg)}function yl(e,t,n,r){let o=Xt.get(e);o!==void 0&&!o.note.isConnected&&(o.timer!==null&&clearTimeout(o.timer),Xt.delete(e),o=void 0),o!==void 0&&o.timer!==null&&clearTimeout(o.timer);let i=o?.note??rh();i.setAttribute(Xg,t.phase);let a=i.querySelector(`.${vl}`),s=i.querySelector(`.${wl}`),d=oh(t,n);a.textContent!==d.text&&(a.textContent=d.text),s.textContent!==d.detail&&(s.textContent=d.detail),ft(s,d.detail.length===0),o===void 0&&document.body.append(i);let l=r>0?setTimeout(()=>{Aa(e)},r):null;i.style.setProperty("--bre-note-hold",`${r}ms`),Xt.set(e,{note:i,timer:l})}function rh(){let e=document.createElement("div");return e.className=Jg,e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.innerHTML=`<span class="${vl}"></span><span class="${wl}"></span>`,e}var kl=new WeakMap,Xt=new Map;function oh(e,t){switch(e.phase){case"working":return{text:t.t("autoAdaptWorking"),detail:""};case"done":return{text:t.t("autoAdaptDone",{count:e.count}),detail:e.missed>0?`${t.t("autoAdaptDoneHint",{count:e.count})} ${t.t("autoAdaptUnsuggestedHint")}`:t.t("autoAdaptDoneHint",{count:e.count})};case"empty":return{text:t.t("autoAdaptEmpty"),detail:t.t("autoAdaptEmptyHint")};case"unsuggested":return{text:t.t("autoAdaptUnsuggested"),detail:t.t("autoAdaptUnsuggestedHint")};case"blocked":return{text:t.t("autoAdaptBlocked"),detail:t.t("autoAdaptBlockedHint")};case"failed":return{text:t.t("autoAdaptFailed",{message:e.detail}),detail:e.detail}}}function ih(e,t,n){e.getAttribute(Ft)!==t&&e.setAttribute(Ft,t),e.textContent!==n&&(e.textContent=n),e.getAttribute("title")!==null&&e.removeAttribute("title")}var vr="data-bre-drag-handle",Ra="data-bre-row-head",Ca="data-bre-drop-side",xo="bre-row-dragging",ko="bre-row-drop-target",Al="bre-drag-ghost",Rl="bre-drop-line",El="http://www.w3.org/2000/svg",Tl=8,Sl=28,Ml=12,ah="transform 180ms cubic-bezier(0.2, 0.7, 0.3, 1)",sh='button, a, input, textarea, select, [contenteditable], [role="button"], [role="switch"], [role="checkbox"], [role="textbox"], [role="combobox"]';function Eo(){return{sources:new WeakSet,lists:new WeakSet,line:void 0,sighted:new WeakMap,drag:void 0}}function We(e){return Array.from(e.children).filter(t=>t instanceof HTMLElement)}function dh(e,t){let n=e.style.order;if(n==="")return t;let r=Number.parseInt(n,10);return Number.isNaN(r)?t:r}function Qt(e){return We(e).map((t,n)=>({row:t,key:dh(t,n),index:n})).sort((t,n)=>t.key-n.key||t.index-n.index).map(t=>t.row)}function Cl(e,t){let n=e.filter(a=>t.includes(a)),r=n.map(a=>e.indexOf(a)),o=t.filter(a=>n.includes(a)),i=new Map;e.forEach((a,s)=>i.set(a,s)),r.forEach((a,s)=>{let d=o[s];d!==void 0&&i.set(d,a)});for(let[a,s]of i){let d=String(s);a.style.order!==d&&(a.style.order=d)}}function To(e,t){Cl(Qt(e),t)}function Ha(e,t){let n=We(e),r=n.map(o=>o.offsetTop);t(),n.forEach((o,i)=>{let a=r[i]-o.offsetTop;a!==0&&(o.style.transition="none",o.style.transform=`translateY(${a}px)`,o.offsetHeight,o.style.transition=ah,o.style.transform="")})}function wr(e,t){return Qt(e).map(n=>t(n)).filter(n=>n!==void 0)}function lh(e,t,n){let r=wr(e,t);if(n===void 0||!ch(e,n))return r;let o=new Map;return n.ids.forEach((i,a)=>{o.has(i)||o.set(i,a)}),r.map((i,a)=>({id:i,key:o.get(i)??n.ids.length+a})).sort((i,a)=>i.key-a.key).map(i=>i.id)}function ch(e,t){return t.rows.some(n=>!e.contains(n))}function uh(e,t){let n=[];for(let o of Qt(e)){let i=t(o);i!==void 0&&n.push(i)}let r=[];for(let o of We(e))t(o)!==void 0&&r.push(o);return{ids:n,rows:r}}function Hl(e,t,n){let r=new Map;for(let[s,d]of t.entries())r.has(d)||r.set(d,s);let o=We(e),a=[...o.filter(s=>n(s)!==void 0)].sort((s,d)=>{let l=r.get(n(s))??Number.MAX_SAFE_INTEGER,c=r.get(n(d))??Number.MAX_SAFE_INTEGER;return l-c});Cl(o,a)}function So(e){for(let t of e)t.style.order="",t.style.transition="",t.style.transform=""}function Nl(e,t,n,r){let i=e.filter(a=>a!==t).indexOf(n);return i<0?Math.max(0,e.indexOf(t)):r?i+1:i}function Il(e,t){let n,r=Number.POSITIVE_INFINITY;for(let o of e){let i=o.getBoundingClientRect(),a=t<i.top?i.top-t:t>i.bottom?t-i.bottom:0;a<r&&(r=a,n=o)}return n}function fh(e,t){let n=e.getBoundingClientRect();return n.height<=0?!0:t>n.top+n.height/2}function Ol(e,t){let n=e.getBoundingClientRect();return t?n.bottom+Tl/2-1:n.top-Tl/2-1}function Pl(){let e=document.createElementNS(El,"svg");e.setAttribute("width","10"),e.setAttribute("height","14"),e.setAttribute("viewBox","0 0 10 14"),e.setAttribute("fill","none"),e.setAttribute("aria-hidden","true");let t=[[2.5,3],[7.5,3],[2.5,7],[7.5,7],[2.5,11],[7.5,11]];for(let[n,r]of t){let o=document.createElementNS(El,"circle");o.setAttribute("cx",String(n)),o.setAttribute("cy",String(r)),o.setAttribute("r","1.2"),o.setAttribute("fill","currentColor"),e.appendChild(o)}return e}function _l(e,t){let n=document.createElement("div");n.className=Al,n.setAttribute("aria-hidden","true"),n.appendChild(Pl());let r=document.createElement("span");r.className="bre-drag-ghost-name";let o=t??e.querySelector('[class*="rowName"]')?.textContent?.trim();return r.textContent=o===void 0?"":o,n.appendChild(r),n}function ph(e){return!(e instanceof Element)||e.closest(`[${vr}]`)!==null?!1:e.closest(sh)!==null}function Dl(e){return e.parentElement??void 0}function Fl(e){for(let t of We(e))t.classList.remove(ko),t.removeAttribute(Ca)}function Mo(e){let t=e.parentElement;for(;t!==null;){if(ql(t))return t;t=t.parentElement}let n=document.scrollingElement;return n instanceof HTMLElement&&n.scrollHeight>n.clientHeight?n:void 0}function Kl(e){let t=[],n=e.parentElement;for(;n!==null;)ql(n)&&t.push(n),n=n.parentElement;let r=document.scrollingElement;return r instanceof HTMLElement&&r.scrollHeight>r.clientHeight&&!t.includes(r)&&t.push(r),t}function Na(e){let t=[],n=e.parentElement;for(;n!==null;)Bl(n)&&t.push(n),n=n.parentElement;let r=document.scrollingElement;return r instanceof HTMLElement&&!t.includes(r)&&t.push(r),t}function Bl(e){let t=e.style.overflowY,n=t.length>0?t:window.getComputedStyle(e).overflowY;return n==="auto"||n==="scroll"||n==="overlay"}function ql(e){return e.scrollHeight>e.clientHeight&&Bl(e)}function Gl(e,t){let n=e.getBoundingClientRect();return n.height<=0?0:t<n.top+Sl?-Ml:t>n.bottom-Sl?Ml:0}function Wl(e,t,n){if(t.scrollStep===n)return;if(t.scrollStep=n,n===0){t.frame!==void 0&&(window.cancelAnimationFrame(t.frame),t.frame=void 0);return}let r=t.scroller;if(r===void 0||t.frame!==void 0)return;let o=()=>{t.frame=void 0,!(e.drag!==t||t.scrollStep===0)&&(r.scrollTop+=t.scrollStep,t.frame=window.requestAnimationFrame(o))};t.frame=window.requestAnimationFrame(o)}function mh(e){let t=e.line;if(t!==void 0&&t.isConnected)return t;let n=document.createElement("div");return n.className=Rl,n.setAttribute("aria-hidden","true"),document.body.appendChild(n),e.line=n,n}function gh(e,t,n){let r=mh(e),o=t.getBoundingClientRect();r.style.top=`${Ol(t,n)}px`,r.style.left=`${o.left}px`,r.style.width=`${o.width}px`,r.style.display="block",r.setAttribute(Ca,n?"after":"before")}function hh(e){e.line!==void 0&&(e.line.style.display="none")}function bh(e){let t=e.drag;e.drag=void 0,t!==void 0&&(Wl(e,t,0),hh(e),t.row.classList.remove(xo),Fl(t.list),t.dropped||Ha(t.list,()=>{To(t.list,t.before)}))}function yh(e,t,n,r){if(ph(t.target)){t.preventDefault();return}let o=Dl(e),i=n.idOf(e);if(o===void 0||i===void 0){t.preventDefault();return}let a={row:e,list:o,before:Qt(o),scroller:Mo(o),adapter:n,scrollStep:0,frame:void 0,dropped:!1};r.drag=a,e.classList.add(xo);let s=_l(e,n.labelOf(e));Number.isFinite(t.clientX)&&Number.isFinite(t.clientY)&&(s.style.left=`${t.clientX}px`,s.style.top=`${t.clientY}px`),document.body.appendChild(s);let d=t.dataTransfer;if(d!=null)try{d.effectAllowed="move",d.setData("text/plain",i),d.setDragImage(s,Math.round(s.offsetWidth/2),Math.round(s.offsetHeight/2))}catch{}window.setTimeout(()=>{s.remove()},0)}function vh(e,t,n){let r=n.drag;if(r===void 0||r.list!==e)return;let o=t.target,i=o instanceof Element?r.adapter.rowOf(o,e):void 0,a=Qt(e),s=i!==void 0&&a.includes(i)?i:Il(a,t.clientY);if(s===void 0)return;t.preventDefault();let d=t.dataTransfer;d!=null&&(d.dropEffect="move");let l=fh(s,t.clientY),c=Nl(a,r.row,s,l);c!==a.indexOf(r.row)&&Ha(e,()=>{To(e,Di(a,r.row,c))}),Fl(e),s.classList.add(ko),s.setAttribute(Ca,l?"after":"before"),gh(n,s,l),Wl(n,r,r.scroller===void 0?0:Gl(r.scroller,t.clientY))}function wh(e,t){t.lists.has(e)||(t.lists.add(e),e.addEventListener("dragover",n=>{vh(e,n,t)}),e.addEventListener("drop",n=>{let r=t.drag;r===void 0||r.list!==e||(n.preventDefault(),r.dropped=!0,r.adapter.commit(e))}))}function xh(e,t,n,r){r.sources.has(e)||(r.sources.add(e),n.seatDrags&&(e.setAttribute(Ra,"1"),e.setAttribute("draggable","true")),e.addEventListener("dragstart",o=>{yh(t,o,n,r)}),e.addEventListener("dragend",()=>{bh(r)}))}function kh(e,t,n,r){e.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation()}),e.addEventListener("keydown",o=>{if(o.key!=="ArrowUp"&&o.key!=="ArrowDown")return;let i=Dl(t);if(i===void 0)return;let a=Qt(i),s=a.indexOf(t);if(s<0)return;let d=s+(o.key==="ArrowUp"?-1:1);d<0||d>=a.length||(o.preventDefault(),Ha(i,()=>{To(i,Di(a,t,d))}),n.commit(i),e.focus())})}function Ll(e,t,n,r){let o=r.gripLabel(t,n),i=r.gripHint();e.getAttribute(vr)!==n&&e.setAttribute(vr,n),e.getAttribute("aria-label")!==o&&e.setAttribute("aria-label",o),e.getAttribute("title")!==i&&e.setAttribute("title",i)}function Eh(e,t,n,r,o){let i=t.querySelector(`[${vr}]`);if(i!==null){Ll(i,e,n,r);return}r.decorate?.(e,t);let a=document.createElement("span");a.className="bre-drag-grip",a.setAttribute("role","button"),a.setAttribute("tabindex","0"),a.setAttribute("draggable","true"),a.appendChild(Pl()),Ll(a,e,n,r),kh(a,e,r,o),xh(r.seatDrags?t:a,e,r,o),t.insertBefore(a,t.firstChild)}function Lo(e,t,n,r){if(!e.isConnected)return;wh(t,r);for(let i of We(t)){let a=n.idOf(i);if(a===void 0)continue;let s=n.seatOf(i);s!==void 0&&Eh(i,s,a,n,r)}if(r.drag!==void 0)return;let o=lh(t,n.idOf,r.sighted.get(t));Hl(t,n.order(o),n.idOf),r.sighted.set(t,uh(t,n.idOf))}function Ao(e){e.drag=void 0;for(let t of Array.from(document.querySelectorAll(`[${vr}]`)))t.remove();for(let t of Array.from(document.querySelectorAll(`[${Ra}]`)))t.removeAttribute(Ra),t.removeAttribute("draggable");for(let t of Array.from(document.querySelectorAll(`.${xo}, .${ko}`)))t.classList.remove(xo,ko);for(let t of Array.from(document.querySelectorAll(`.${Rl}`)))t.remove();for(let t of Array.from(document.querySelectorAll(`.${Al}`)))t.remove();e.line=void 0}var Ul=["openai","anthropic"];function Ro(e){return e==="anthropic-messages"?"anthropic":"openai"}function jl(e){return e==="openai-completions"||e==="anthropic-messages"||e==="openai-responses"}var Th=40;function zl(e){if(typeof e!="string")return;let t="";for(let n of e){let r=n.codePointAt(0)??0;r<32||r===127||(t+=n)}if(t=t.trim(),t.length!==0)return t.slice(0,Th)}function Tt(e){return typeof e=="string"&&/^[\x21-\x7E]+$/.test(e)}var Sh=12;function $l(e){return e.length===0?"":e.length<Sh?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022":`${e.slice(0,4)}...${e.slice(-4)}`}var Vl="dsh-model-think-level:key-lists:v1";function Yl(){try{return globalThis.localStorage??void 0}catch{return}}function Co(){let e=Yl();if(e===void 0)return{};try{let t=e.getItem(Vl);if(t===null)return{};let n=JSON.parse(t);if(typeof n!="object"||n===null)return{};let r={};for(let[o,i]of Object.entries(n))Mh(i)&&(r[o]=i);return r}catch{return{}}}function Mh(e){if(typeof e!="object"||e===null)return!1;let t=e;if(typeof t.savedAt!="number"||!Number.isFinite(t.savedAt))return!1;let n=t.state;if(typeof n!="object"||n===null)return!1;let r=n;return r.ok===!0&&typeof r.route=="string"&&Array.isArray(r.entries)}function Jl(e){let t=Yl();if(t===void 0)return;let n=Object.entries(e).sort((r,o)=>o[1].savedAt-r[1].savedAt).slice(0,64);try{t.setItem(Vl,JSON.stringify(Object.fromEntries(n)))}catch{}}function Xl(e){let t=Co()[e];if(t===void 0||t.state.route!==e)return;let n=Date.now()-t.savedAt;if(!(n>=0)||n>2592e6){Lh(e);return}return t.state}function Ia(e,t){if(t.ok!==!0||t.route!==e)return;let n=Co();n[e]={savedAt:Date.now(),state:{...t,probing:void 0,addedRef:void 0}},Jl(n)}function Lh(e){let t=Co();t[e]!==void 0&&(delete t[e],Jl(t))}function Ql(){return Object.entries(Co()).map(([e,t])=>({route:e,savedAt:t.savedAt})).sort((e,t)=>t.savedAt-e.savedAt)}function Zl(e){for(let t of["error","message"]){let n=e[t];if(typeof n=="string"&&n.length>0)return n}}function ec(e){if(!Array.isArray(e))return;let t=[];for(let n of e)typeof n=="string"&&n.length>0&&t.push(n);return t}function Ah(e){if(!z(e))return;let t=e.ref;if(typeof t!="string"||t.length===0)return;let n=e.alias,r=e.configured,o=e.masked,i=ec(e.models),a=e.protocol,s=e.auto,d=e.rest,l=z(d)&&typeof d.remainingMs=="number"?d.remainingMs:void 0,c=z(d)&&typeof d.failures=="number"?d.failures:void 0;return{ref:t,...typeof n=="string"&&n.length>0?{alias:n}:{},enabled:e.enabled!==!1,configured:typeof r=="boolean"?r:null,...typeof o=="string"&&o.length>0?{masked:o}:{},...i===void 0?{}:{models:i},...jl(a)?{protocol:a}:{},...s===!0?{auto:!0}:{},...l!==void 0&&l>=0&&c!==void 0?{rest:{remainingMs:l,failures:c}}:{}}}function Rh(e){let t=e.entries;if(!Array.isArray(t))return;let n=[];for(let l of t){let c=Ah(l);c!==void 0&&n.push(c)}let r=e.addedRef,o=e.route,i=ec(e.models),a=e.endpoints,s=z(a)&&typeof a.openai=="string"?a.openai:null,d=z(a)&&typeof a.anthropic=="string"?a.anthropic:null;return{ok:!0,route:typeof o=="string"?o:"",entries:n,...typeof r=="string"&&n.some(l=>l.ref===r)?{addedRef:r}:{},...i===void 0?{}:{models:i},...e.probing===!0?{probing:!0}:{},endpoints:{openai:s,anthropic:d}}}async function Ch(e){let t;try{t=await e.json()}catch{t=void 0}if(!z(t))return{ok:!1};if(t.ok===!0){let r=Rh(t);if(r!==void 0)return r}let n=Zl(t);return n===void 0?{ok:!1}:{ok:!1,error:n}}async function tc(e,t){let n=`${Yr}?route=${encodeURIComponent(e)}`;try{let r=await fetch(n,t===void 0?{method:"GET",cache:"no-store",credentials:"same-origin"}:{method:"POST",cache:"no-store",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify(t)});return await Ch(r)}catch{return{ok:!1}}}var xr=new Map,Hh=64,Nh=5e3;function Oa(e){let t=xr.get(e);if(t!==void 0)return t;if(xr.size>=Hh){let r=xr.keys().next().value;r!==void 0&&xr.delete(r)}let n={state:Xl(e),updatedAt:0,revision:0};return xr.set(e,n),n}function Ih(e){return Oa(e).state}function Oh(e,t){let n=Oa(e),r=Date.now()-n.updatedAt;if(t?.preferCache===!0&&n.state!==void 0&&r>=0&&r<Nh)return Promise.resolve(n.state);if(n.read!==void 0)return n.read;let o=n.revision,i=tc(e).then(a=>n.revision!==o?n.state??a:(a.ok&&(n.state=a,n.updatedAt=Date.now(),Ia(e,a)),a)).finally(()=>{n.read===i&&(n.read=void 0)});return n.read=i,i}async function bt(e,t){let n=Oa(e),r=++n.revision;n.read=void 0;let o=await tc(e,t);return o.ok&&n.revision===r&&(n.revision+=1,n.read=void 0,n.state=o,n.updatedAt=Date.now(),Ia(e,o)),o}async function Ph(e){try{let t=await fetch(`${Yr}?route=${encodeURIComponent(e)}&op=endpoints`,{method:"GET",cache:"no-store",credentials:"same-origin"});if(!t.ok)return{ok:!1};let n=await t.json().catch(()=>{});if(!z(n)||n.ok!==!0)return{ok:!1};let r=n.endpoints;return z(r)?{ok:!0,endpoints:{openai:typeof r.openai=="string"?r.openai:null,anthropic:typeof r.anthropic=="string"?r.anthropic:null}}:{ok:!0}}catch{return{ok:!1}}}async function _h(e){try{let n=await(await fetch(`${Yr}?route=${encodeURIComponent(e)}&op=balance`,{method:"GET",cache:"no-store",credentials:"same-origin"})).json().catch(()=>{});if(!z(n)||n.ok!==!0){let o=z(n)?Zl(n):void 0;return o===void 0?{ok:!1}:{ok:!1,error:o}}let r=n.endpoint;return{ok:!0,endpoint:typeof r=="string"&&r.length>0?r:null}}catch{return{ok:!1}}}var De={list:Oh,endpoints:Ph,balanceEndpoint:_h,cached:Ih,add:(e,t,n)=>bt(e,{op:"add",value:t,...n===void 0?{}:{alias:n}}),rename:(e,t,n)=>bt(e,{op:"rename",ref:t,...n===void 0?{}:{alias:n}}),remove:(e,t)=>bt(e,{op:"remove",ref:t}),replace:(e,t,n)=>bt(e,{op:"value",ref:t,value:n}),setScope:(e,t,n)=>bt(e,{op:"scope",ref:t,...n===void 0?{}:{models:n}}),setEnabled:(e,t,n)=>bt(e,{op:"enable",ref:t,enabled:n}),setProtocol:(e,t,n)=>bt(e,{op:"protocol",ref:t,...n===void 0?{}:{protocol:n}}),setEndpoints:(e,t,n)=>bt(e,{op:"endpoints",openai:t??"",anthropic:n??""}),setBalanceEndpoint:(e,t)=>bt(e,{op:"balance",endpoint:t}),probe:e=>bt(e,{op:"probe"}),async reveal(e,t){try{let n=await fetch(`${Vr}?route=${encodeURIComponent(e)}&ref=${encodeURIComponent(t)}`,{method:"GET",cache:"no-store",credentials:"same-origin"});if(!n.ok)return;let r=await n.json();if(!z(r)||r.ok!==!0)return;let o=r.key;return typeof o=="string"&&o.length>0?o:void 0}catch{return}}};var Cn="data-bre-endpoint-rows",St="data-bre-endpoint-row",Pn="data-bre-balance-row",No="data-bre-endpoint-family",nc="data-bre-endpoint-filled",Io="data-bre-endpoint-field",Oo="data-bre-endpoint-title",Nn="data-bre-endpoint-toggle",sc="data-bre-endpoint-count",Po="data-bre-field-order",kr="data-bre-endpoint-serving",rc="data-bre-protocol-watch",oc=new WeakSet,ic="data-bre-row-provider",_a="data-bre-protocol-cards",In="data-bre-protocol-value",Da="data-bre-protocol-source";function tt(e,t){for(let n of t){let r=Array.from(e.querySelectorAll("input[aria-label], select[aria-label]")).find(o=>(o.getAttribute("aria-label")??"").startsWith(n));if(r!==void 0)return r}}function On(e,t){let n=tt(e,t);if(n===void 0)return;let r=n.closest("label");return r!==null&&r.parentElement!==null?r:n.parentElement??void 0}function Pa(e,t){let n=e;for(;n!==null&&n.parentElement!==t;)n=n.parentElement;return n===null||n===t?void 0:n}function Dh(e,t,n){for(let r=t.parentElement;r!==null;r=r.parentElement){if(!r.contains(n)||e!==void 0&&!r.contains(e))continue;let o=Pa(t,r),i=Pa(n,r);if(o===void 0||i===void 0||o===i)continue;let a=e===void 0?void 0:Pa(e,r);return{container:r,protocol:o,url:i,name:a}}}function dc(e,t){let n=tt(e,t);return n instanceof HTMLSelectElement||n instanceof HTMLInputElement?n.value.trim():""}function Fh(e,t){let n=dc(e,t.apiProtocol);return n==="anthropic-messages"||n==="openai-completions"||n==="openai-responses"?n:void 0}function yt(e,t){let n=Fh(e,t);return n===void 0?void 0:Ro(n)}function en(e,t){let n=dc(e,t.routeId);return n.length>0?n:(e.closest(`[${ic}]`)?.getAttribute(ic)??"").trim()}function lc(e,t){return e==="anthropic"?t("keysEndpointAnthropic"):e==="openai"?t("keysEndpointOpenAI"):""}function Kh(e,t){let n=tt(e,t.modelName),r=tt(e,t.apiProtocol),o=tt(e,t.baseUrl);if(r===void 0||o===void 0)return;let i=Dh(n,r,o);if(i===void 0)return;let{container:a,protocol:s,url:d,name:l}=i,c=m=>Array.from(a.children).indexOf(m);if((l===void 0||c(l)<c(s))&&c(s)<c(d)){e.setAttribute(Po,"1");return}a.insertBefore(s,d),l!==void 0&&a.insertBefore(l,s),e.setAttribute(Po,"1")}function cc(e,t){for(let n of Array.from(e.children))if(!(n===t||n.contains(t))&&!n.hasAttribute(No)&&!n.hasAttribute(Nn)&&n instanceof HTMLElement&&(n.textContent??"").trim().length>0)return n}function Zt(e,t){let n=t?"1":"0";e.getAttribute(nc)!==n&&e.setAttribute(nc,n)}function Bh(e,t,n){let r=cc(e,t);if(!n){e.removeAttribute(Io),r?.removeAttribute(Oo);return}e.setAttribute(Io,"1"),r?.setAttribute(Oo,"1")}function uc(e,t,n){let r=tt(e,t.baseUrl);if(r===void 0)return;let o=On(e,t.baseUrl);if(o===void 0)return;let i=lc(yt(e,t),n),a=o.querySelector(`[${No}]`);if(a===null&&i.length>0){a=document.createElement("span"),a.setAttribute(No,"1"),a.className="bre-endpoint-family";let d=r.closest("label");d!==null&&d.contains(r)?d.insertBefore(a,r):o.insertBefore(a,r)}a!==null&&(a.textContent!==i&&(a.textContent=i),ft(a,i.length===0),Zt(a,r instanceof HTMLInputElement&&r.value.trim().length>0)),Bh(o,r,a!==null&&i.length>0);let s=yt(e,t);s===void 0?o.removeAttribute(kr):o.setAttribute(kr,s)}function qh(e,t){let n=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value")?.set;n===void 0?e.value=t:n.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function fc(e,t){for(let n of Array.from(t.querySelectorAll(`[${In}]`))){let r=n.getAttribute(In)===e.value;n.classList.toggle("is-selected",r),n.setAttribute("aria-checked",r?"true":"false"),n.tabIndex=r?0:-1}}function Gh(e,t,n){let r=Array.from(t.querySelectorAll(`[${In}]`)),o=Array.from(e.options).filter(i=>i.value.length>0);return r.length!==o.length?!1:o.every((i,a)=>{let s=r[a];return s!==void 0&&s.getAttribute(In)===i.value&&(s.textContent??"")===pc(i.value,(i.textContent??i.value).trim(),n.t)})}function pc(e,t,n){return e==="openai-completions"?n("keysProtocolShortChat"):e==="openai-responses"?n("keysProtocolShortResponses"):e==="anthropic-messages"?n("keysProtocolShortAnthropic"):t}function ac(e,t,n){t.replaceChildren();for(let r of Array.from(e.options)){let o=r.value;if(o.length===0)continue;let i=document.createElement("button");i.type="button",i.className="bre-protocol-card",i.setAttribute("role","radio"),i.setAttribute(In,o),i.textContent=pc(o,(r.textContent??o).trim(),n.t),i.title=(r.textContent??o).trim(),i.addEventListener("click",()=>{e.value!==o&&(qh(e,o),fc(e,t))}),t.appendChild(i)}}function Wh(e,t,n){let r=tt(e,t.apiProtocol);if(!(r instanceof HTMLSelectElement))return;let o=On(e,t.apiProtocol);if(o===void 0)return;let i=o.querySelector(`[${_a}]`);if(i===null){let a=document.createElement("div");i=a,a.setAttribute(_a,"1"),a.className="bre-protocol-cards",a.setAttribute("role","radiogroup");let s=r.getAttribute("aria-label");s!==null&&a.setAttribute("aria-label",s),r.setAttribute(Da,"1"),r.after(a),ac(r,a,n),a.addEventListener("keydown",d=>{let l=d.key==="ArrowRight"||d.key==="ArrowDown"?1:d.key==="ArrowLeft"||d.key==="ArrowUp"?-1:0,c=Array.from(a.querySelectorAll(`[${In}]`));if(c.length===0)return;if(d.key==="Home"||d.key==="End"){d.preventDefault();let u=d.key==="Home"?c[0]:c[c.length-1];u?.click(),u?.focus();return}if(l===0)return;d.preventDefault();let p=c.findIndex(u=>u.classList.contains("is-selected")),m=c[(Math.max(p,0)+l+c.length)%c.length];m?.click(),m?.focus()})}else Gh(r,i,n)||ac(r,i,n);ft(r,!0),fc(r,i)}function Fa(e,t,n){let r=e===null?0:e.querySelectorAll(`[${St}], [${Pn}]`).length,o=r===0?"":n.t("keysEndpointsCount",{count:r});if(o.length===0){t.hasAttribute("title")&&t.removeAttribute("title");return}t.getAttribute("title")!==o&&t.setAttribute("title",o)}function Uh(e,t,n){let r=e.querySelector(`[${Nn}]`);if(On(e,t.apiProtocol)===void 0){r?.remove(),e.querySelector(`[${sc}]`)?.remove();return}let o=On(e,t.baseUrl);if(o===void 0)return;let i=tt(e,t.baseUrl);if(i===void 0)return;let a=cc(o,i);if(a===void 0||a===r)return;let s=()=>e.querySelector(`[${Cn}]`),d=c=>{let p=n.t("keysMoreEndpoints");c.textContent!==p&&(c.textContent=p);let m=s();c.setAttribute("aria-expanded",m!==null&&!m.hidden?"true":"false"),Fa(m,c,n)};if(r!==null){r.parentElement!==a&&a.append(r),d(r);return}let l=document.createElement("button");l.type="button",l.setAttribute(Nn,"1"),l.className="bre-endpoint-toggle",l.textContent=n.t("keysMoreEndpoints"),l.addEventListener("click",()=>{let c=s();if(c!==null&&(c.hidden=!c.hidden,d(l),!c.hidden)){let p=en(e,t);p.length>0&&$h(c,p,n,e,t)}}),a.append(l),d(l)}var Hn=new WeakMap,mc=1e3,_o=new WeakMap,_n=0,Ho=new Map;function jh(e,t){_n+=1,typeof CustomEvent=="function"&&document.dispatchEvent(new CustomEvent(cr,{detail:{route:e,openai:t.openai??"",anthropic:t.anthropic??""}}))}function zh(e,t){_n+=1,typeof CustomEvent=="function"&&document.dispatchEvent(new CustomEvent(fr,{detail:{route:e,endpoint:t}}))}function Er(e){let t=e.getAttribute(St);return t==="openai"||t==="anthropic"?t:void 0}async function $h(e,t,n,r,o){for(let i of Array.from(e.querySelectorAll(`[${St}], [${Pn}]`)))await gc(i,t,n,r,o)}async function gc(e,t,n,r,o){let i=e.querySelector(".bre-endpoint-url");if(i===null)return;if(e.hasAttribute(Pn)){await hc(e,i,t,n);return}let a=Er(e);if(a===void 0)return;let s=(Hn.get(e)??0)+1;Hn.set(e,s),_o.set(e,{at:Date.now(),epoch:_n});let d=n.client??De,l=await Do(t,d);if(l===void 0||Hn.get(e)!==s||Er(e)!==a||document.activeElement===i)return;await bc(r,o,n,t,yt(r,o),l);let c=l[a];i.value!==c&&(i.value=c);let p=e.querySelector(".bre-endpoint-family");p!==null&&Zt(p,c.length>0)}async function hc(e,t,n,r){let o=(Hn.get(e)??0)+1;Hn.set(e,o),_o.set(e,{at:Date.now(),epoch:_n});let i=r.client??De;if(i.balanceEndpoint===void 0)return;let a=await i.balanceEndpoint(n);if(!a.ok||Hn.get(e)!==o||document.activeElement===t)return;let s=a.endpoint??"";t.value!==s&&(t.value=s);let d=e.querySelector(".bre-endpoint-family");d!==null&&Zt(d,s.length>0)}async function bc(e,t,n,r,o,i,a=!1){if(o===void 0||!a&&i[o].length>0)return;let s=tt(e,t.baseUrl);if(!(s instanceof HTMLInputElement)||document.activeElement===s)return;let d=s.value.trim();if(d.length===0&&!a)return;let l=n.client??De;await Ba(r,l,c=>{if(!(!a&&c[o].length>0)&&c[o]!==d)return{openai:o==="openai"?d:c.openai,anthropic:o==="anthropic"?d:c.anthropic}})}function Ka(e,t,n){let r=On(e,t.baseUrl);if(r===void 0||r.parentElement===null)return;let o=yt(e,t);if(o===void 0)return;let i=r.querySelector(`:scope > [${Cn}]`);i===null&&(i=e.querySelector(`[${Cn}]`),i!==null&&r.appendChild(i)),i===null&&(i=document.createElement("div"),i.setAttribute(Cn,"1"),i.hidden=!0,r.appendChild(i));let a=Ul.filter(p=>p!==o),s=Array.from(i.children).filter(p=>p instanceof HTMLElement&&p.hasAttribute(St));if(!(a.length===s.length&&a.every((p,m)=>Er(s[m])===p)))for(let p of a){let m=i.querySelector(`[${St}="${p}"]`);m===null&&(m=Vh(e,t,n,p)),i.appendChild(m)}for(let p of Array.from(i.querySelectorAll(`[${St}]`))){let m=Er(p);m!==void 0&&m!==o||p.remove()}let l=e.querySelector(`[${Nn}]`);l!==null&&(l.setAttribute("aria-expanded",i.hidden?"false":"true"),Fa(i,l,n));let c=en(e,t);if(c.length>0)for(let p of Array.from(i.querySelectorAll(`[${St}]`))){let m=_o.get(p);(m===void 0||m.epoch!==_n||Date.now()-m.at>=mc)&&gc(p,c,n,e,t)}}function Vh(e,t,n,r){let o=document.createElement("div");o.setAttribute(St,r),o.className="bre-endpoint-row";let i=document.createElement("span");i.className="bre-endpoint-family",i.textContent=lc(r,n.t),Zt(i,!1);let a=document.createElement("input");a.type="url",a.className="bre-text-input bre-endpoint-url",a.spellcheck=!1,a.placeholder="https://\u2026";let s=n.client??De;return a.addEventListener("change",()=>{let d=en(e,t);if(d.length===0)return;let l=a.value.trim();if(l.length>0&&!/^https?:\/\//i.test(l)){a.setAttribute("aria-invalid","true"),a.title=n.t("keysEndpointInvalid");return}a.hasAttribute("aria-invalid")&&a.removeAttribute("aria-invalid"),a.hasAttribute("title")&&a.removeAttribute("title"),Zt(i,l.length>0),(async()=>await Ba(d,s,c=>{let p=Er(o);if(p!==void 0)return{openai:p==="openai"?l:c.openai,anthropic:p==="anthropic"?l:c.anthropic}}))()}),o.append(i,a),o}function yc(e,t,n){let r=e.querySelector(`[${Cn}]`),o=e.querySelector(`[${Pn}]`),i=en(e,t);if(r===null||i.length===0){o?.remove();return}let a=o;a===null&&(a=Yh(e,t,n)),r.lastElementChild!==a&&r.appendChild(a);let s=e.querySelector(`[${Nn}]`);s!==null&&Fa(r,s,n);let d=_o.get(a);if(d===void 0||d.epoch!==_n||Date.now()-d.at>=mc){let l=a.querySelector(".bre-endpoint-url");l!==null&&hc(a,l,i,n)}}function Yh(e,t,n){let r=document.createElement("div");r.setAttribute(Pn,"1"),r.className="bre-endpoint-row bre-balance-row";let o=document.createElement("span");o.className="bre-endpoint-family",o.textContent=n.t("keysEndpointBalance"),Zt(o,!1);let i=document.createElement("input");i.type="url",i.className="bre-text-input bre-endpoint-url",i.spellcheck=!1,i.placeholder="https://\u2026",i.setAttribute("aria-label",n.t("keysEndpointBalance")),i.title=n.t("keysEndpointBalanceHint");let a=n.client??De,s=a.setBalanceEndpoint;return i.addEventListener("change",()=>{let d=en(e,t);if(d.length===0)return;let l=i.value.trim();if(l.length>0&&!/^https?:\/\//i.test(l)){i.setAttribute("aria-invalid","true"),i.title=n.t("keysEndpointInvalid");return}i.hasAttribute("aria-invalid")&&i.removeAttribute("aria-invalid"),i.title=n.t("keysEndpointBalanceHint"),Zt(o,l.length>0),s!==void 0&&(async()=>(await s.call(a,d,l)).ok&&zh(d,l))()}),r.append(o,i),r}async function Jh(e,t,n,r,o){let i=en(e,t),a=tt(e,t.baseUrl);if(i.length===0||!(a instanceof HTMLInputElement))return;let s=n.client??De,d=await Do(i,s);if(d===void 0||yt(e,t)!==o)return;let l=a.value.trim();if(l.length>0&&l!==d[r]){let m=await Ba(i,s,u=>{if(yt(e,t)===o)return{openai:r==="openai"?l:u.openai,anthropic:r==="anthropic"?l:u.anthropic}});if(m===void 0||(d=m,yt(e,t)!==o))return}let c=d[o];if(a.value===c)return;let p=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set;p===void 0?a.value=c:p.call(a,c),a.dispatchEvent(new Event("input",{bubbles:!0})),a.dispatchEvent(new Event("change",{bubbles:!0})),Ka(e,t,n)}async function Ba(e,t,n){let o=(Ho.get(e)??Promise.resolve()).then(async()=>{let i=await Do(e,t);if(i===void 0)return;let a=n(i);if(a===void 0)return;let s=t.setEndpoints;if(typeof s!="function")return;let d=await s.call(t,e,a.openai,a.anthropic);if(!d.ok)return;let l={openai:d.endpoints.openai??"",anthropic:d.endpoints.anthropic??""};return jh(e,d.endpoints),l});Ho.set(e,o);try{return await o}finally{Ho.get(e)===o&&Ho.delete(e)}}async function Do(e,t){if(t.endpoints!==void 0){let r=await t.endpoints(e);return r.ok?{openai:r.endpoints?.openai??"",anthropic:r.endpoints?.anthropic??""}:void 0}let n=await t.list(e);if(n.ok)return{openai:n.endpoints.openai??"",anthropic:n.endpoints.anthropic??""}}function Xh(e,t,n){let r=On(e,t.baseUrl),o=yt(e,t),i=r?.getAttribute(kr);uc(e,t,n.t),Ka(e,t,n),yc(e,t,n),!(r===void 0||i===void 0||o===void 0)&&i!==o&&(i!=="openai"&&i!=="anthropic"||Jh(e,t,n,i,o))}function vc(e,t,n){Kh(e,t),Wh(e,t,n),uc(e,t,n.t),Uh(e,t,n),Ka(e,t,n),yc(e,t,n);let r=tt(e,t.apiProtocol);r instanceof HTMLSelectElement&&!r.hasAttribute(rc)&&(r.setAttribute(rc,"1"),r.addEventListener("change",()=>Xh(e,t,n)));let o=tt(e,t.baseUrl);o instanceof HTMLInputElement&&!oc.has(o)&&(oc.add(o),o.addEventListener("change",()=>{let i=en(e,t),a=yt(e,t);if(i.length===0||a===void 0)return;let s=n.client??De;(async()=>{let d=await Do(i,s);d!==void 0&&yt(e,t)===a&&await bc(e,t,n,i,a,d,!0)})()}))}function Qh(){for(let e of Array.from(document.querySelectorAll(`select[${Da}]`)))e.hidden=!1,e.removeAttribute(Da)}function wc(){Qh();for(let e of Array.from(document.querySelectorAll(`[${Cn}], [${St}], [${Pn}], [${Nn}], [${sc}], [${_a}], [${No}]`)))e.remove();for(let e of Array.from(document.querySelectorAll(`[${Po}], [${Io}], [${Oo}], [${kr}]`)))e.removeAttribute(Po),e.removeAttribute(Io),e.removeAttribute(Oo),e.removeAttribute(kr)}function Dn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var qa="__breLedgerDocument";function Cc(){let e=globalThis;return e[qa]??(e[qa]=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`)}var Bo="bre:held-writes:v1";function $a(){try{return typeof sessionStorage>"u"?void 0:sessionStorage}catch{return}}function vt(e){let t=$a();if(t!==void 0)try{if(e.pending.size===0&&e.queued.size===0){t.removeItem(Bo);return}let n={document:Cc(),committed:[...e.committing].filter(r=>e.queued.has(r)),pending:[...e.pending].map(([r,o])=>[r,[...o]]),queued:[...e.queued].map(([r,o])=>[r,[...o]])};t.setItem(Bo,JSON.stringify(n))}catch{}}function xc(e,t){if(!Array.isArray(e))return;let n=[];for(let r of e){if(!Array.isArray(r)||r.length!==2)return;let[o,i]=r;if(typeof o!="string"||!Array.isArray(i))return;let a=[];for(let s of i){if(!Array.isArray(s)||s.length!==2)return;let[d,l]=s;if(typeof d!="string"||!z(l)||t!==void 0&&!t(l))return;a.push([d,l])}n.push([o,a])}return n}function Zh(e){let t=$a();if(t!==void 0)try{let n=t.getItem(Bo);if(n===null)return;let r=JSON.parse(n);if(r.document!==Cc())return;let o=xc(r.pending),i=xc(r.queued,db);if(o===void 0||i===void 0)return;let a=Array.isArray(r.committed)?r.committed.filter(s=>typeof s=="string"):[];for(let[s,d]of o)e.pending.set(s,new Map(d));for(let[s,d]of i)a.includes(s)&&(e.queued.set(s,new Map(d)),e.committing.add(s))}catch{}}function Hc(e,t){(async()=>{try{await Va(t,e),await Ya(t,e)}catch(n){console.error(`[bre] teardown flush failed: ${n instanceof Error?n.message:String(n)}`)}})()}function Nc(e,t){(async()=>{try{await Va(t,e,!0),await Ya(t,e,!0)}catch(n){console.error(`[bre] unload flush failed: ${n instanceof Error?n.message:String(n)}`)}finally{try{$a()?.removeItem(Bo)}catch{}}})()}function Ic(){let e={disposed:!1,mounted:new Map,describePromise:void 0,pending:new Map,missedScans:new Map,queued:new Map,editing:void 0,flushing:!1,flushFailures:0,nextFlushAt:0,committing:new Set,adapting:new Set,signalsUnavailable:!1,submitWired:new WeakSet,cancelWired:new WeakSet,disclosureWired:new WeakSet,editWired:new WeakSet,addModelWired:new WeakSet,addProviderWired:new WeakSet};return Zh(e),e}async function eb(e,t,n=!1){if(t.flushing)return;t.flushing=!0;let r;try{r=n&&Pc(t)?await le(e.api,{fresh:!0}):void 0;let o=await Va(e,t,!1,r),i=await Ya(e,t,!1,r);o||i?kc(e,t):(t.flushFailures=0,t.nextFlushAt=0)}catch(o){kc(e,t),console.error(`[bre] idle flush failed: ${o instanceof Error?o.message:String(o)}`)}finally{t.flushing=!1}try{e.onIdle?.(r)}catch(o){console.error(`[bre] idle hook failed: ${o instanceof Error?o.message:String(o)}`)}}var Oc=new Set(["no-namespace","invalid-models"]);function kc(e,t){t.flushFailures+=1;let n=Math.min(2**(t.flushFailures-1)*500,3e4);t.nextFlushAt=Date.now()+n,e.onBackoff?.(n)}function Pc(e){return e.queued.size>0||e.pending.size>0}function Fn(e,t,n,r,o,i,a,s){try{let d=e.pending.get(t);if(r===void 0){if(d===void 0)return;d.delete(n),d.size===0&&e.pending.delete(t);return}e.pending.set(t,(d??new Map).set(n,{efforts:r,...o===void 0?{}:{compat:o},...i===void 0?{}:{input:i},...s===void 0?{}:{imageGen:s===!0},...a===void 0?{}:{defaultEffort:a}}))}finally{vt(e)}}function _c(e,t,n,r){e.queued.set(t,(e.queued.get(t)??new Map).set(n,r)),vt(e)}function tb(e,t,n){let r=e.pending.get(t);r!==void 0&&(r.delete(n),r.size===0&&e.pending.delete(t),vt(e))}function nb(e,t,n){let r=e.queued.get(t);r!==void 0&&(r.delete(n),r.size===0&&e.queued.delete(t),vt(e))}function rb(e,t,n){tb(e,t,n),nb(e,t,n)}function ob(e,t){e.queued.delete(t),e.pending.delete(t),e.missedScans.delete(t),e.committing.delete(t),vt(e)}function ib(e,t,n){if(t===void 0)return null;let i=t[Qe]!==!0&&t.reasoningEfforts!==void 0&&typeof t[gn]=="number"||t[Qe]!==!0&&n?.efforts!==void 0&&ab(t.reasoningEfforts,n.efforts)?!1:t.reasoningEfforts!==void 0||t[Qe]===!0||e.efforts==="keep",s=t[mt]!==!0&&n?.input!==void 0&&sb(t.input,n.input)?!1:Array.isArray(t.input)&&t.input.length>0||t[mt]===!0,d=i?"keep":e.efforts,l=s?void 0:e.input,c=t[Ze]===!0,p=e.imageGen!==void 0&&e.imageGen!==c?e.imageGen:void 0,m=e.defaultEffort;return d==="keep"&&l===void 0&&p===void 0&&m===void 0?null:{efforts:d,...e.compat===void 0?{}:{compat:e.compat},...l===void 0?{}:{input:l},...p===void 0?{}:{imageGen:p},...m===void 0?{}:{defaultEffort:m}}}function ab(e,t){if(e===t)return!0;if(!z(e)||!z(t))return!1;let n=Object.keys(t);if(Object.keys(e).length!==n.length)return!1;let r=t;return n.every(o=>e[o]===r[o])}function sb(e,t){if(!Array.isArray(e)||e.length!==t.length)return!1;let n=new Set(t);return e.every(r=>typeof r=="string"&&n.has(r))}function db(e){if(!z(e))return!1;let t=e.efforts;return t===!1||t==="keep"||z(t)}async function lb(e,t,n,r,o=!1,i){let a=i??await e.describeNamespace(),s=Pe(a.namespace),d=[];for(let[m,u]of[...r]){let f=Mn(s,n).find(x=>x.id===m);if(f===void 0||t.pending.get(n)?.get(m)!==u)continue;let y=zt(s,n),g=typeof f.name=="string"?f.name:void 0,T=gt(m,g===void 0?y:{...y,displayName:g}),A=ib(u,f,{...T.efforts===void 0?{}:{efforts:T.efforts},...T.input===void 0?{}:{input:T.input}});if(A===null){Fn(t,n,m,void 0);continue}d.push({modelId:m,efforts:A.efforts,...A.compat===void 0?{}:{compat:A.compat},...A.input===void 0?{}:{input:A.input},...A.imageGen===void 0?{}:{imageGen:A.imageGen},...A.defaultEffort===void 0?{}:{defaultEffort:A.defaultEffort}})}if(d.length===0)return!1;let l=!1,c=await mr(e.api,n,d,()=>l?e.describeNamespace():(l=!0,Promise.resolve(a)),o?void 0:ru),p=!1;return d.forEach((m,u)=>{let f=c[u];if(f?.aborted!==!0){if(f?.ok===!0||f?.modelNotFound===!0){Fn(t,n,m.modelId,void 0);return}if(f?.error!==void 0&&Oc.has(f.error)){Fn(t,n,m.modelId,void 0),console.error(`[bre] staged flush withdrew "${n}"/"${m.modelId}": ${f.error}`);return}p=!0,console.error(`[bre] staged flush write failed for "${n}"/"${m.modelId}": ${f?.error??"unknown"}`)}}),(t.pending.get(n)?.size??0)===0&&t.pending.delete(n),p}async function Va(e,t,n=!1,r){for(let s of[...t.committing])t.queued.has(s)||t.committing.delete(s);if(![...t.queued.keys()].some(s=>t.committing.has(s)||t.signalsUnavailable))return vt(t),!1;let i=r??await e.describeNamespace();if(i.writable!==!0)return vt(t),!1;let a=!1;for(let[s,d]of[...t.queued]){if(!t.committing.has(s)&&!t.signalsUnavailable)continue;let c=[...d].map(([u,f])=>({modelId:u,efforts:f.efforts,...f.compat===void 0?{}:{compat:f.compat},...f.input===void 0?{}:{input:f.input},...f.imageGen===void 0?{}:{imageGen:f.imageGen},...f.defaultEffort===void 0?{}:{defaultEffort:f.defaultEffort}})),p=await mr(e.api,s,c,()=>Promise.resolve(i),n?void 0:ru),m=!1;c.forEach((u,f)=>{let y=p[f];if(y?.aborted===!0){m=!0;return}if(y?.ok===!0||y?.modelNotFound===!0){d.delete(u.modelId);return}if(y?.error!==void 0&&Oc.has(y.error)){d.delete(u.modelId),console.error(`[bre] held write withdrawn for "${s}"/"${u.modelId}": ${y.error}`);return}console.error(`[bre] held write failed for "${s}"/"${u.modelId}": ${y?.error??"unknown"}`)}),d.size===0?(t.queued.delete(s),t.committing.delete(s)):m||(a=!0)}return vt(t),a}async function Ya(e,t,n=!1,r){if(t.pending.size===0)return!1;let o=r??await e.describeNamespace();if(o.writable!==!0)return!1;let i=Pe(o.namespace),a=!1;for(let[s,d]of[...t.pending]){if(d.size===0){t.pending.delete(s);continue}Dn(i,s)&&await lb(e,t,s,d,n,o)&&(a=!0)}return vt(t),a}function je(e,t){for(let n of t){let r=Array.from(e.querySelectorAll("input[aria-label], select[aria-label]")).find(o=>(o.getAttribute("aria-label")??"").startsWith(n));if(r!==void 0&&r.value.trim().length>0)return r.value.trim()}return""}function Mr(e){return e.closest('[class*="editor"], [class*="rowCard"], [class*="addCard"]')??void 0}function cb(e){let t=e.closest('[class*="modelEntry"]');if(t===null){let r=Mr(e);if(r===void 0)return;let o=Array.from(r.querySelectorAll('[class*="modelAdvanced"]'));return o.length===1?o[0]:o.find(i=>i.offsetParent!==null)??o[0]}let n=Array.from(t.querySelectorAll('[class*="modelAdvanced"]'));return n.length===1?n[0]:n.find(r=>r.offsetParent!==null)??n[0]}function Dc(e,t){return Array.from(e.querySelectorAll("button[aria-label]")).find(n=>t.some(r=>(n.getAttribute("aria-label")??"").startsWith(r)))}function Ec(){return new Promise(e=>{if(typeof window.requestAnimationFrame!="function"){e();return}let t,n=()=>{window.clearTimeout(r),t!==void 0&&window.cancelAnimationFrame(t),e()},r=window.setTimeout(n,100);t=window.requestAnimationFrame(n)})}function Ko(e){return e.querySelector('[class*="modelInputTypes"]')!==null}var ub="modelReasoning",Ua="data-bre-reasoning-hidden";function Fc(e){return e.querySelector(`[class*="${ub}"]`)??void 0}function Ja(e){let t=Fc(e);t!==void 0&&t.style.display!=="none"&&(t.setAttribute(Ua,"1"),t.style.display="none")}function Tr(e){let t=Fc(e);t!==void 0&&t.getAttribute(Ua)==="1"&&(t.removeAttribute(Ua),t.style.display==="none"&&(t.style.display=""))}var qo="data-bre-capacity-hidden";function Kc(e,t){return Array.from(e.children).filter(n=>n.nodeType!==1?!1:n.matches(`[class*="${t}"]`))}function fb(e){return Kc(e,"modelField")}function pb(e){return Kc(e,"modelInputTypes")}function Bc(e){return[...fb(e),...pb(e)]}function mb(e){for(let t of e)t.style.display!=="none"&&(t.setAttribute(qo,"1"),t.style.display="none")}function gb(e){for(let t of e)t.getAttribute(qo)==="1"&&(t.removeAttribute(qo),t.style.display==="none"&&(t.style.display=""))}function hb(e){mb(Bc(e))}function Ga(e){gb(Bc(e))}function qc(e){let t=e.querySelector('[class*="modelInputTypes"]');return t===null||t.getAttribute(qo)==="1"?!1:!t.hidden&&t.style.display!=="none"}function Gc(e,t){let n=e.querySelector('[class*="modelInputTypes"]');if(n===null)return;let r=Array.from(n.querySelectorAll('input[type="checkbox"]')),o=r.find(i=>{let a=i.closest("label")?.textContent?.trim();return a!==void 0&&t.includes(a)});return o!==void 0?o:r.length===2?r[1]:void 0}function Lr(e,t,n){if(!qc(e))return!1;let r=Gc(e,n);return r===void 0||r.disabled?!1:(r.checked!==t&&r.click(),!0)}function ja(e,t,n){return t==null||e===void 0||qc(e)&&Lr(e,t.includes("image"),n),t}function Tc(e,t){let n=e.getAttribute("aria-label")??"";if(t.some(o=>n.startsWith(o)))return!0;let r=e.closest("label")?.textContent?.trim()??"";return r.length>0&&t.some(o=>r.includes(o))}function Xa(e,t){let n=[...t.modelId,...t.modelName],r=Array.from(e.querySelectorAll("input")).filter(s=>s.type!=="checkbox"&&s.type!=="radio").filter(s=>s.closest("[data-plugin]")===null).filter(s=>!n.some(d=>(s.getAttribute("aria-label")??"").startsWith(d))),o=r.find(s=>Tc(s,t.contextWindow)),i=r.find(s=>Tc(s,t.maxOutput));if(o!==void 0&&i!==void 0)return{contextWindow:o,maxOutput:i};let a=r.filter(s=>s!==o&&s!==i);return{contextWindow:o??a[0],maxOutput:i??(o!==void 0?a[0]:a[1])}}function Wc(e,t,n){let r=Xa(e,t),o=(i,a)=>i===void 0||i.disabled||a===void 0||!Number.isFinite(a)||a<=0||ht(i.value)!==void 0?!1:Uc(i,String(a));return{contextWindow:o(r.contextWindow,n.contextWindow),maxOutput:o(r.maxOutput,n.maxTokens)}}function Uc(e,t){return e.disabled?!1:(e.value===t||(Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set?.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0}))),!0)}function bb(e,t){let n=Xa(e,t),r=a=>{if(a!==void 0)return ht(a.value)},o=r(n.contextWindow),i=r(n.maxOutput);return{...o===void 0?{}:{contextWindow:o},...i===void 0?{}:{maxTokens:i}}}function yb(e,t,n){let r=Xa(e,t),o=(i,a)=>i===void 0?!1:Uc(i,a===void 0||!Number.isFinite(a)||a<=0?"":String(a));return{contextWindow:"contextWindow"in n?o(r.contextWindow,n.contextWindow):!1,maxOutput:"maxTokens"in n?o(r.maxOutput,n.maxTokens):!1}}async function vb(e,t,n){if(e===void 0)return!1;let r=t.inputImage;if(Ko(e))return Lr(e,!0,r);let o=e.closest('[class*="modelEntry"]')??e;if(o.querySelector('[class*="modelAdvanced"]')!==null)return!1;let i=Dc(o,t.capacity);if(i===void 0||i.disabled)return!1;i.click(),Ko(o)||await n();try{return Ko(o)&&Lr(o,!0,r)}finally{i.click()}}async function wb(e,t,n,r){if(e.matches('[class*="modelAdvanced"]'))return r(e);let o=e.closest('[class*="modelEntry"]')??e;if(o.querySelector('[class*="modelAdvanced"]')!==null)return r(o);let i=Dc(o,t.capacity);if(i===void 0||i.disabled)return!1;i.click(),o.querySelector('[class*="modelAdvanced"]')===null&&await n();try{return o.querySelector('[class*="modelAdvanced"]')!==null?r(o):!1}finally{i.click()}}function xb(e,t,n,r,o){n.disposed||!e.isConnected||nu(e)===void 0||Array.from(e.querySelectorAll("button[aria-label]")).some(a=>o.capacity.some(s=>(a.getAttribute("aria-label")??"").startsWith(s)))||wo(e,kb(e,Pe(r.namespace),o),{t:t.t,onRequest:a=>jc(n,t,a)})}function kb(e,t,n){let r=[];for(let o of La(e)){let i=Mr(o);if(i===void 0)continue;let a=tn(i,t,n);a===void 0||a.staged||r.push({catalogue:o,route:a.route})}return r}function Eb(e,t,n){let r=[],o=new Set;for(let i of e){if(o.has(i.card))continue;o.add(i.card);let a=tn(i.card,t,n);if(a===void 0)continue;let[s]=La(i.card);s!==void 0&&r.push({catalogue:s,route:a.route})}return r}function Tb(e,t,n,r){let o=[],i=new Set;for(let a of r.capacity){let s=Array.from(e.querySelectorAll("button[aria-label]")).filter(d=>(d.getAttribute("aria-label")??"").startsWith(a));for(let d of s){let l=Mr(d);if(l===void 0)continue;let c=d.closest('[class*="modelEntry"]')??l,p=je(c,r.modelId);p.length===0||i.has(p)||tn(l,n,r)?.route===t&&(i.add(p),o.push({id:p,name:je(c,r.modelName),row:c}))}}return o}async function jc(e,t,n,r=[]){if(n.length===0)return{held:0,unsuggested:0,blocked:"unknown-route"};if(e.adapting.has(n))return{held:0,unsuggested:0,blocked:"busy"};e.adapting.add(n);let o=0,i=0;try{da();let a,s=()=>a??(a=t.describeNamespace()),d=await s(),l=Pe(d.namespace);if(d.writable!==!0)return{held:0,unsuggested:0,blocked:"unwritable"};if(!Dn(l,n)&&r.length===0)return{held:0,unsuggested:0,blocked:"unknown-route"};let p=Mn(l,n),m=new Set;for(let v of p){let b=typeof v.id=="string"?v.id:"";b.length>0&&m.add(b)}let u=p.slice();for(let v of r)v.id.length===0||m.has(v.id)||u.push({id:v.id,name:v.name});if(u.length===0)return{held:0,unsuggested:0,blocked:"no-models"};let f=l[n]??{},y=typeof f.api=="string"?f.api:void 0,g=new Set,T=new Map;for(let[v,b]of e.mounted)b.props.route===n&&(T.set(b.props.modelId,v),b.props.efforts!==void 0&&g.add(b.props.modelId));let A=new Map;for(let v of r)v.row!==void 0&&A.set(v.id,v.row);let x=!1,H=(v,b)=>ja(T.get(v),b,t.labels().inputImage),O=async(v,b)=>{if(b.image!==!0)return;let N=T.get(v)??A.get(v);N!==void 0&&await vb(N,t.labels(),Ec)},J=async(v,b,N)=>{let w=b.image===!0,E=N.contextWindow!==void 0||N.maxTokens!==void 0;if(!w&&!E)return;let I=T.get(v)??A.get(v);if(I===void 0)return;let F=t.labels();await wb(I,F,Ec,G=>{w&&Lr(G,!0,F.inputImage),E&&Wc(G,F,N)})},U=po(t.api,s,(v,b,N,w,E,I,F)=>{Fn(e,v,b,N,w,H(b,E),I,F)},(v,b,N)=>{_c(e,v,b,{...N,input:H(b,N.input)})},void 0,()=>x);for(let v of u){let b=typeof v.id=="string"?v.id:"";if(b.length===0)continue;let N=so(u,b),w=lo(u,b),E=v[Ze]===!0,I=N!==void 0||v[Qe]===!0,F=Array.isArray(w)&&w.length>0||v[mt]===!0||E;if(g.has(b)&&!I)continue;if(I&&F){let se=T.get(b)??A.get(b);if(Array.isArray(w)&&w.includes("image")&&se!==void 0){let te=t.labels().inputImage,ge=Gc(se,te);ge!==void 0&&!ge.disabled&&!ge.checked&&Lr(se,!0,te)}continue}let G=co(u,b),W=fo(u,b)??"",h=await U.suggest(n,b,uo(u,b));if(!h.ok){i+=1;continue}let L=h.suggestion,P=L.efforts!==!1,_=L.imageGen===!0?Et(void 0,!0):L.input===void 0?Et(w,E):Et(L.input);if(I){if(!_.image&&!_.imageGen||e.queued.get(n)?.has(b)===!0)continue;await O(b,_),x=!m.has(b),U.commit(n,b,yo({efforts:"keep",...bo(_)})),x&&t.onPendingChanged?.(),x=!1,o+=1;continue}let Y=W!==""?W:L.defaultEffort??W,oe=Y===W?void 0:Y===""?null:Y;x=!m.has(b),await J(b,_,{...L.contextWindow===void 0?{}:{contextWindow:L.contextWindow},...L.maxTokens===void 0?{}:{maxTokens:L.maxTokens}});let ee=ho(_,w,E)?void 0:bo(_);U.commit(n,b,yo({efforts:Sa(P,An(Jt(L.efforts)),N),input:ee?.input,imageGen:ee?.imageGen,defaultEffort:oe,appliedCompat:L.compat,routeApi:y,initialCompat:G})),x&&t.onPendingChanged?.(),x=!1,o+=1}return{held:o,unsuggested:i}}catch(a){return console.warn("[bre] provider-wide adapt failed:",a),{held:o,unsuggested:i,failed:a instanceof Error?a.message:String(a)}}finally{e.adapting.delete(n)}}function Sb(e){return e.querySelector(`[data-plugin="${Te}"]`)!==null}function Mb(e,t){return e.route===t.route&&e.routeDisplayName===t.routeDisplayName&&e.routeApi===t.routeApi&&e.routeBaseURL===t.routeBaseURL&&e.modelId===t.modelId&&e.modelName===t.modelName&&e.index===t.index&&e.readOnly===t.readOnly&&e.defaultEffort===t.defaultEffort&&e.staged===t.staged&&e.officialInputTypes===t.officialInputTypes&&e.effortsUnset===t.effortsUnset&&br(e.efforts,t.efforts)&&Ab(e.input,t.input)&&e.imageGen===t.imageGen&&Lb(e.compat,t.compat)}function Lb(e,t){return e===t?!0:e===void 0||t===void 0?!1:JSON.stringify({...e},Object.keys({...e,...t}).sort())===JSON.stringify({...t},Object.keys({...e,...t}).sort())}function Ab(e,t){if(e===t)return!0;if(e===void 0||t===void 0)return!1;let n=new Set(e);return e.length===t.length&&t.every(r=>n.has(r))}function Rb(e,t){return Array.from(e.querySelectorAll("input[aria-label], select[aria-label]")).some(n=>t.some(r=>(n.getAttribute("aria-label")??"").startsWith(r)))}function tn(e,t,n){let r=e.querySelector('[class*="editorRoute"]')?.textContent?.trim();if(r!==void 0&&r.length>0&&Dn(t,r))return{route:r,staged:!1};if(Rb(e,n.routeId)){let a=je(e,n.routeId);return a.length>0&&!Dn(t,a)?{route:a,staged:!0}:void 0}let o=e.querySelector('[class*="editorTitle"], [class*="rowName"]')?.textContent?.trim();if(o===void 0||o.length===0)return;let i=Object.entries(t).find(([,a])=>a.displayName===o);if(i!==void 0)return{route:i[0],staged:!1};if(Dn(t,o))return{route:o,staged:!1}}function Cb(e,t){let n=e.querySelector('[class*="editorActions"]');if(n===null)return;let r=Array.from(n.querySelectorAll("button"));if(r.length<2)return;let o=(p,m)=>(p.textContent??"").trim()===m,i=n.querySelector('[class*="primaryButton"]'),a=n.querySelector('[class*="secondaryButton"]');if(i!==null&&a!==null)return{submit:i,cancel:a};let s=[...r].reverse().find(p=>t.apply.some(m=>o(p,m))),d=[...r].reverse().find(p=>t.cancel.some(m=>o(p,m)));if(s!==void 0&&d!==void 0)return{submit:s,cancel:d};let l=r[r.length-1],c=r[r.length-2];if(!(l===void 0||c===void 0))return{submit:l,cancel:c}}function qn(e,t,n){t.has(e)||(t.add(e),e.addEventListener("click",n,{capture:!0}))}var Wa=new WeakMap,za=new Set;function zc(){for(let e of Array.from(za))e.release()}var Ar=420,$c=320,Hb=160,Sc=2e3,Nb=150,Vc=new Set(["PageUp","PageDown","Home","End","ArrowUp","ArrowDown"," "]);function Qa(e,t=$c){for(let n of Na(e)){let r=Go.get(n);if(r!==void 0){window.clearTimeout(r.timer),r.timer=window.setTimeout(()=>Mc(n),t);continue}n.style.overflowAnchor!=="none"&&(Go.set(n,{saved:n.style.overflowAnchor,timer:window.setTimeout(()=>Mc(n),t)}),n.style.overflowAnchor="none")}}var Go=new Map;function Mc(e){let t=Go.get(e);t!==void 0&&(Go.delete(e),e.style.overflowAnchor=t.saved)}function Gn(e,t,n=!1){let r=Na(e),o=r[0];if(o===void 0||!e.isConnected)return;let i=performance.now(),a=Wa.get(o);if(a!==void 0)if(n)a.release();else{a.deadline=Math.min(Math.max(a.deadline,i+t),a.startedAt+Sc);return}let s=e.getBoundingClientRect(),d=s.top,l=s.height,c=new Map,p=new Map;for(let x of r){c.set(x,x.scrollTop);let H=x.style.overflowAnchor;H!=="none"&&p.set(x,H),x.style.overflowAnchor="none"}let m=new Set(r),u={deadline:i+t,startedAt:i,frame:void 0,release:()=>{}},f=()=>{if(za.delete(u)){u.frame!==void 0&&(window.cancelAnimationFrame(u.frame),u.frame=void 0);for(let[x,H]of p)x.style.overflowAnchor=H;Wa.delete(o),document.removeEventListener("wheel",y,!0),document.removeEventListener("touchstart",y,!0),document.removeEventListener("pointerdown",y,!0),document.removeEventListener("keydown",g,!0)}};function y(){f()}function g(x){Vc.has(x.key)&&f()}u.release=f,Wa.set(o,u),za.add(u),document.addEventListener("wheel",y,{capture:!0,passive:!0}),document.addEventListener("touchstart",y,{capture:!0,passive:!0}),document.addEventListener("pointerdown",y,{capture:!0}),document.addEventListener("keydown",g,{capture:!0});let T=0,A=()=>{if(u.frame=void 0,T+=1,!e.isConnected||T>=Nb){f();return}let x=e.getBoundingClientRect(),H=Math.abs(x.height-l)>.5;if(!H&&[...m].some(v=>v.scrollTop!==c.get(v))){f();return}let O=[];if(H){for(let v of r){let b=c.get(v);b===void 0||v.scrollTop===b||(O.push(v),v.scrollTop=b,c.set(v,v.scrollTop))}x=e.getBoundingClientRect()}let J=x.top-d;J!==0&&Ib(r,m,c,J,O);let U=performance.now();if(H&&(l=x.height,u.deadline=Math.min(Math.max(u.deadline,U+Hb),u.startedAt+Sc)),U>=u.deadline){f();return}u.frame=window.requestAnimationFrame(A)};u.frame=window.requestAnimationFrame(A)}function Ib(e,t,n,r,o=[]){let i=r;for(let a of new Set([...o,...t,...e])){if(i===0)break;let s=a.scrollTop;if(s!==n.get(a))continue;a.scrollTop=s+i;let d=a.scrollTop;d!==s&&(n.set(a,d),t.add(a),i-=d-s)}}var Yc='[class*="modelList"]',Ob="bre-list-slack",Pb=3e3,Uo,Kn=new WeakMap,Bn=new Set;function Jc(e){if(!(e instanceof Element))return;let t=e.closest(Yc);if(t===null)return;let n=Kl(t).map(r=>({host:r,top:r.scrollTop}));n.length!==0&&(Uo={targets:n,at:performance.now()})}function Mt(){Uo=void 0}function Xc(e){Jc(e.target)}function Qc(e){if(Vc.has(e.key)){Mt();return}Jc(e.target)}var Sr=0;function Zc(){Sr+=1,!(Sr>1)&&(document.addEventListener("click",Xc,!0),document.addEventListener("keydown",Qc,!0),document.addEventListener("focusin",Mt,!0),document.addEventListener("pointerdown",Mt,!0),document.addEventListener("wheel",Mt,{capture:!0,passive:!0}),document.addEventListener("touchstart",Mt,{capture:!0,passive:!0}))}function Wo(e){let t=Kn.get(e);t!==void 0&&(Kn.delete(e),Bn.delete(t),t.scrollTarget.removeEventListener("scroll",t.onScroll),t.spacer.remove())}function _b(e){return e===document.scrollingElement?document:e}function Db(){if(Bn.size!==0)for(let e of Array.from(Bn)){let t=e.host;if(!e.spacer.isConnected){Kn.delete(t),Bn.delete(e),e.scrollTarget.removeEventListener("scroll",e.onScroll);continue}t.scrollTop<=t.scrollHeight-t.clientHeight-e.height&&Wo(t)}}function Lc(e,t){return e.scrollTop>e.scrollHeight-e.clientHeight-t}function Fb(e=performance.now()){let t=Uo;if(!(t===void 0||e-t.at>Pb))for(let n of t.targets){let r=n.host;if(!r.isConnected)continue;let o=Kn.get(r),i=o===void 0?0:o.height,a=r.scrollHeight-r.clientHeight-i,s=n.top-a;if(s<=0){o!==void 0&&!Lc(r,o.height)&&Wo(r);continue}let d=o;if(d===void 0){let l=document.createElement("div");l.className=Ob,l.dataset.plugin=Te,l.setAttribute("aria-hidden","true"),l.style.height="0px",(r===document.scrollingElement?document.body??r:r).appendChild(l);let p=()=>{let m=Kn.get(r);m!==void 0&&!Lc(r,m.height)&&Wo(r)};d={host:r,spacer:l,height:0,onScroll:p,scrollTarget:_b(r)},Kn.set(r,d),Bn.add(d),d.scrollTarget.addEventListener("scroll",p,{passive:!0})}d.height!==s&&(d.height=s,d.spacer.style.height=`${s}px`),r.scrollTop!==n.top&&(r.scrollTop=n.top)}}function eu(){if(Sr=Math.max(0,Sr-1),!(Sr>0)){document.removeEventListener("click",Xc,!0),document.removeEventListener("keydown",Qc,!0),document.removeEventListener("focusin",Mt,!0),document.removeEventListener("pointerdown",Mt,!0),document.removeEventListener("wheel",Mt,!0),document.removeEventListener("touchstart",Mt,!0),Uo=void 0;for(let e of Array.from(Bn))Wo(e.host)}}function tu(e,t=Ar){Fb(),Db();let n=new Set;for(let r of Array.from(e.querySelectorAll(Yc))){let o=r.closest('[class*="rowCard"], [class*="setupCard"], [class*="addCard"]');o===null||n.has(o)||(n.add(o),Gn(o,t))}}function Kb(e,t){qn(e,t,()=>{let n=e.closest('[class*="modelEntry"]')??e.closest('[class*="rowCard"]');n!==null&&Gn(e.closest('[class*="rowCard"]')??n,Ar)})}var Ac="{provider}";function Bb(e,t){let n=t.editProvider.map(o=>{let i=o.indexOf(Ac);return i<0?void 0:{prefix:o.slice(0,i),suffix:o.slice(i+Ac.length)}}).filter(o=>o!==void 0);if(n.length===0)return[];let r=[];for(let o of Array.from(e.querySelectorAll("button[aria-label]"))){let i=o.getAttribute("aria-label")??"";n.some(a=>i.length>a.prefix.length+a.suffix.length&&i.startsWith(a.prefix)&&i.endsWith(a.suffix))&&o.closest("[data-plugin]")===null&&r.push(o)}return r}function qb(e,t){qn(e,t,()=>{let n=e.closest('[class*="rowCard"], [class*="setupCard"], [class*="addCard"]');n!==null&&Gn(n,Ar)})}function Gb(e,t){let n=[];for(let r of Array.from(e.querySelectorAll("button"))){if(r.closest("[data-plugin]")!==null)continue;let o=r.getAttribute("aria-label")??"";if(t.addModel.some(a=>o.startsWith(a))){n.push(r);continue}let i=(r.textContent??"").trim();i.length>0&&t.addModel.some(a=>i===a||i===`+ ${a}`)&&n.push(r)}return n}function Wb(e,t,n){qn(e,n,()=>{t.isConnected&&Gn(t,Ar)})}function Ub(e,t){qn(e,t,()=>{let n=e.closest('[class*="addBlock"]');n!==null&&Gn(n,Ar,!0)})}function nu(e){return e.querySelector('[class*="editorActions"]')??e.querySelector('[class*="modelEntry"]')??void 0}function ru(){return nu(ct())!==void 0}function jb(e,t,n){let r={routeId:t.routeId,modelName:t.modelName,baseUrl:t.baseUrl,apiProtocol:t.apiProtocol},o=new Set;for(let i of e){let a=Array.from(i.querySelectorAll("input[aria-label], select[aria-label]")),s=d=>a.some(l=>d.some(c=>(l.getAttribute("aria-label")??"").startsWith(c)));s(t.apiProtocol)&&s(t.baseUrl)&&o.add(i)}for(let i of o)vc(i,r,{t:n})}var Fo=new WeakMap;function Rc(e,t,n,r=!1){let o=e.describePromise;if(o===void 0)return;let i=Fo.get(e);if(i?.promise===o){i.run=t,i.phase=n,i.reportReadFailure=r;return}let a={promise:o,run:t,phase:n,reportReadFailure:r};Fo.set(e,a);let s=()=>{Fo.get(e)===a&&Fo.delete(e)};o.then(d=>{s(),!e.disposed&&e.describePromise===o&&a.run(d)},d=>{s(),e.describePromise===o&&(e.describePromise=void 0,a.reportReadFailure&&console.error(`[bre] ${a.phase} failed: ${d instanceof Error?d.message:String(d)}`))}).catch(d=>{console.error(`[bre] ${a.phase} failed: ${d instanceof Error?d.message:String(d)}`)})}var zb=['[class*="editor"]','[class*="modelEntry"]','[class*="rowCard"]','[class*="setupCard"]','[class*="addCard"]','button[class*="addButton"]',"button[aria-label]"].join(", ");function Za(e,t,n){if(n.disposed||!e.isConnected)return;let r=t.labels(),o=Array.from(e.querySelectorAll(zb)),i=!1,a=[],s=[],d=[],l=[],c=[];for(let u of o)!i&&u.matches('[class*="editorActions"], [class*="modelEntry"]')&&(i=!0),u.matches('[class*="rowCard"], [class*="setupCard"]')?(a.push(u),s.push(u)):u.matches('[class*="addCard"]')&&s.push(u),u.matches('[class*="editor"], [class*="addCard"], [class*="rowCard"]')&&l.push(u),u.matches('button[class*="addButton"]')&&u.closest("[data-plugin]")===null&&d.push(u),u.matches("button[aria-label]")&&r.capacity.some(f=>(u.getAttribute("aria-label")??"").startsWith(f))&&c.push(u);for(let u of a)for(let f of Bb(u,r))qb(f,n.editWired);for(let u of s)for(let f of Gb(u,r))Wb(f,u,n.addModelWired);for(let u of d)Ub(u,n.addProviderWired);jb(l,r,t.t);let p=c.length>0;if(!i){if(wo(e,[],{t:t.t}),n.mounted.size>0){for(let[f,y]of n.mounted)Tr(f),Ga(f),y.editor.unmount();n.mounted.clear()}let u=n.editing;n.editing=!1,(u!==!1||Pc(n)&&Date.now()>=n.nextFlushAt)&&eb(t,n,u===!0).catch(f=>{console.error(`[bre] idle pass failed: ${f instanceof Error?f.message:String(f)}`)});return}if(n.editing=!0,!p){for(let[f,y]of n.mounted)Tr(f),Ga(f),y.editor.unmount();n.mounted.clear(),n.describePromise??(n.describePromise=t.describeNamespace({allowStale:!0}));let u=r;Rc(n,f=>{xb(e,t,n,f,u)},"empty-catalog seat",!0);return}for(let u of c)Kb(u,n.disclosureWired);n.describePromise??(n.describePromise=t.describeNamespace({allowStale:!0})),Rc(n,u=>{if(n.disposed||!e.isConnected)return;let f=u.namespace,y=Pe(f),g=new Map,T=v=>(g.has(v)||g.set(v,tn(v,y,r)),g.get(v)),A=new Map,x=v=>{let b=A.get(v);if(b!==void 0)return b;let N=Mn(y,v),w=new Set,E=new Set,I=new Map;for(let G of N){let W=G.id;w.add(W),I.has(W)||I.set(W,[G]),G[Qe]===!0&&E.add(W)}let F={models:N,savedModelIds:w,unsetModelIds:E,singletonById:I};return A.set(v,F),F},H=[],O=Array.from(e.querySelectorAll("button[aria-label]")).filter(v=>r.capacity.some(b=>(v.getAttribute("aria-label")??"").startsWith(b)));for(let v of O){let b=Mr(v);if(b===void 0)continue;let N=v.closest('[class*="modelEntry"]')??b,w=je(N,r.modelId);w.length!==0&&H.push({container:cb(v),row:N,modelId:w,card:b})}wo(e,Eb(H,y,r),{t:t.t,onRequest:v=>jc(n,t,v,Tb(e,v,y,r))});let J=new Set(H.map(v=>v.container));for(let[v,b]of n.mounted)J.has(v)||(Tr(v),Ga(v),b.editor.unmount(),n.mounted.delete(v));if(n.pending.size>0){let v=new Map;for(let N of H){let w=T(N.card);if(w===void 0)continue;let E=v.get(w.route);E===void 0&&v.set(w.route,E=new Set),E.add(N.modelId)}let b=new Map;for(let[N,w]of n.pending){if(!Dn(y,N))continue;let E=v.get(N),I=[...w.keys()].filter(F=>!E?.has(F));I.length>0&&b.set(N,new Set(I))}for(let[N,w]of b){let E=n.missedScans.get(N);if(E!==void 0)for(let I of w)E.has(I)&&(Fn(n,N,I,void 0),E.delete(I),w.delete(I))}n.missedScans=b}else n.missedScans=new Map;let U=new Set(H.map(v=>v.card));for(let v of U){let b=T(v);if(b===void 0)continue;let N=b.route,w=Cb(v,r);w===void 0?n.signalsUnavailable=!0:(n.signalsUnavailable=!1,qn(w.submit,n.submitWired,()=>{let E=tn(v,y,r)?.route??N;n.committing.add(E),vt(n)}),qn(w.cancel,n.cancelWired,()=>{let E=tn(v,y,r)?.route??N;ob(n,E)}))}H.forEach((v,b)=>{let N=v.container;if(N===void 0)return;let w=T(v.card);if(w===void 0)return;let{route:E,staged:I}=w,F=y[E]??{},{savedModelIds:G,unsetModelIds:W,singletonById:h}=x(E),L=h.get(v.modelId)??[],P=I||!G.has(v.modelId),_=P?n.pending.get(E)?.get(v.modelId)?.efforts:void 0,Y=P?_==="keep"?void 0:_:so(L,v.modelId),oe=!P&&W.has(v.modelId),ee=P?n.pending.get(E)?.get(v.modelId)?.input:lo(L,v.modelId),se=P?n.pending.get(E)?.get(v.modelId)?.imageGen:sa(L,v.modelId),te=P?n.pending.get(E)?.get(v.modelId)?.compat:co(L,v.modelId),ge=P?n.pending.get(E)?.get(v.modelId)?.defaultEffort??void 0:fo(L,v.modelId),j=P?je(v.row,r.modelName):"",ne=P?j.length>0?j:void 0:uo(L,v.modelId),fe=I?je(v.card,r.apiProtocol):"",ve=I?je(v.card,r.baseUrl):"",$=I&&fe.length>0?fe:typeof F.api=="string"?F.api:void 0,X=I&&ve.length>0?ve:typeof F.baseURL=="string"?F.baseURL:void 0,Z={route:E,routeDisplayName:I?E:typeof F.displayName=="string"?F.displayName:E,...$===void 0?{}:{routeApi:$},...X===void 0?{}:{routeBaseURL:X},modelId:v.modelId,...ne===void 0?{}:{modelName:ne},...Y===void 0?{}:{efforts:Y},...oe?{effortsUnset:oe}:{},...ee===void 0?{}:{input:ee},...se?{imageGen:!0}:{},...te===void 0?{}:{compat:te},...ge===void 0?{}:{defaultEffort:ge},index:b,staged:P,officialInputTypes:Ko(N),api:{...po(t.api,void 0,(de,we,Ne,Ae,Ct,Xe,S)=>{Fn(n,de,we,Ne,Ae,ja(N,Ct,r.inputImage),Xe,S)},(de,we,Ne)=>{_c(n,de,we,{...Ne,input:ja(N,Ne.input,r.inputImage)})},de=>{rb(n,de,v.modelId)},()=>(tn(v.card,y,r)?.staged??I)||!G.has(v.modelId)),fillCapacities:(de,we)=>{Wc(N,r,{...de===void 0?{}:{contextWindow:de},...we===void 0?{}:{maxTokens:we}})},readCapacities:()=>bb(N,r),setCapacities:de=>{yb(N,r,de)}},readOnly:u.writable!==!0,t:t.t};Ja(N),hb(N);let he=n.mounted.get(N);if(he!==void 0){Mb(he.props,Z)||(he.props=Z,he.editor.render(Z));return}if(Sb(N))return;Gn(Mr(N)??v.card,$c);let xe=t.mount(N,Z);n.mounted.set(N,{editor:xe,props:Z})})},"editor reconcile")}var jo=['[class*="rowCard"]','[class*="setupCard"]','[class*="addCard"]','[class*="modelEntry"]','[class*="modelAdvanced"]','[class*="modelList"]','[class*="addBlock"]','p[class*="savedNotice"]'].join(","),$b=[`[data-plugin="${Te}"]`,".bre-effort-slot",".bre-keys-host",".bre-create-host",".bre-editor-tabs",".bre-provider-balance",".bre-auto-effort",".bre-auto-effort-note",".bre-config-host",".bre-drag-ghost",".bre-drop-line",".bre-drag-grip",".bre-provider-switch"].join(",");function iu(e){return e.nodeType===Node.ELEMENT_NODE?e:e.parentElement}function es(e){let t=iu(e);return t!==null&&t.closest($b)!==null}function ou(e){if(e.nodeType!==Node.ELEMENT_NODE)return!1;let t=e;return es(t)?!1:t.matches(jo)||t.querySelector(jo)!==null}function au(e){return e.some(t=>{if(es(t.target))return!1;let n=iu(t.target);if(t.type==="childList"){let r=[...Array.from(t.addedNodes),...Array.from(t.removedNodes)];return r.length>0&&r.every(es)?!1:n!==null&&n.closest(jo)!==null?!0:r.some(ou)}return n!==null&&n.closest(jo)!==null?!0:t.type==="attributes"&&ou(t.target)})}var ns=require("react");var re=require("react"),gu=require("react-dom");var nt=require("react"),lu=require("react-dom"),wt=require("react/jsx-runtime"),su=6,Vb=292,zo=8,Yb=52;function du(e,t){let n=e.getBoundingClientRect(),r=t*Yb+46,o=window.innerWidth||0,i=window.innerHeight||0,a=Math.max(zo,Math.min(n.left,o-Vb-zo)),s=n.bottom+su,d=n.top-su-r,l=i>0&&s+r>i-zo&&d>zo?d:s;return{left:a,top:l}}function cu(e){let{anchor:t,label:n,options:r,selected:o,onPick:i,onClose:a}=e,[s,d]=(0,nt.useState)(()=>du(t,r.length)),l=(0,nt.useRef)(null),c=(0,nt.useRef)([]);(0,nt.useLayoutEffect)(()=>{let u=()=>{d(du(t,r.length))};return u(),window.addEventListener("resize",u),window.addEventListener("scroll",u,!0),()=>{window.removeEventListener("resize",u),window.removeEventListener("scroll",u,!0)}},[t,r.length]),(0,nt.useEffect)(()=>{let u=Math.max(0,r.findIndex(f=>f.value===o));c.current[u]?.focus()},[r,o]),(0,nt.useEffect)(()=>{let u=f=>{let y=f.target;y instanceof Node&&l.current?.contains(y)!==!0&&(t.contains(y)||a())};return document.addEventListener("pointerdown",u,!0),()=>{document.removeEventListener("pointerdown",u,!0)}},[t,a]);let p=(0,nt.useCallback)(u=>{if(r.length===0)return;let f=(u+r.length)%r.length;c.current[f]?.focus()},[r.length]),m=u=>{let f=c.current.findIndex(y=>y===document.activeElement);if(u.key==="Escape"){u.preventDefault(),u.stopPropagation(),a();return}if(u.key==="ArrowDown"){u.preventDefault(),p(f+1);return}if(u.key==="ArrowUp"){u.preventDefault(),p(f<0?r.length-1:f-1);return}if(u.key==="Home"){u.preventDefault(),p(0);return}u.key==="End"&&(u.preventDefault(),p(r.length-1))};return(0,lu.createPortal)((0,wt.jsxs)("div",{ref:l,className:"bre-protocol-menu",style:{left:s.left,top:s.top},onKeyDown:m,children:[(0,wt.jsx)("p",{className:"bre-protocol-menu-title",children:n}),(0,wt.jsx)("ul",{className:"bre-protocol-menu-list",role:"listbox","aria-label":n,children:r.map((u,f)=>{let y=u.value===o;return(0,wt.jsx)("li",{children:(0,wt.jsx)("button",{ref:g=>{c.current[f]=g},type:"button",role:"option","aria-selected":y,"data-protocol-value":u.value,className:"bre-protocol-option",tabIndex:-1,onClick:()=>{i(u.value)},children:(0,wt.jsxs)("span",{className:"bre-protocol-option-text",children:[(0,wt.jsx)("span",{className:"bre-protocol-option-title",children:u.title}),(0,wt.jsx)("span",{className:"bre-protocol-option-hint",children:u.hint})]})})},u.value)})})]}),document.body)}var B=require("react/jsx-runtime"),Jb=200,Xb=["M8 3.9v8.2","M3.9 8h8.2"],uu="M3.9 8.35 6.6 11.05 12.1 5.5",Qb=["M5.75 5.75V4.1A1.6 1.6 0 0 1 7.35 2.5h4.55a1.6 1.6 0 0 1 1.6 1.6v4.55a1.6 1.6 0 0 1-1.6 1.6h-1.65","M4.1 5.75h4.55a1.6 1.6 0 0 1 1.6 1.6v4.55a1.6 1.6 0 0 1-1.6 1.6H4.1a1.6 1.6 0 0 1-1.6-1.6V7.35a1.6 1.6 0 0 1 1.6-1.6Z"],Zb=1600;async function ey(e){try{if(navigator.clipboard?.writeText!==void 0)return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document>"u")return!1;try{let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-1000px",t.style.opacity="0",document.body.appendChild(t),t.select();let n=document.execCommand("copy");return t.remove(),n}catch{return!1}}function ts({paths:e}){return(0,B.jsx)("svg",{viewBox:"0 0 16 16",width:16,height:16,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.map(t=>(0,B.jsx)("path",{d:t},t))})}function ty(e,t){return e.masked!==void 0?e.masked:e.configured===!1?t("keysMissing"):"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"}function fu(e){return e.alias??e.masked??e.ref}function ny(e,t){return e.models===void 0?t("keysScopeAll"):e.models.length===0?t("keysScopeNone"):t("keysScopeCount",{count:e.models.length})}var hu=["openai-completions","openai-responses","anthropic-messages"],pu={openai:null,anthropic:null},ry=2e3,oy=150,iy=300,ay=1500,sy=new Intl.Collator("en",{numeric:!0,sensitivity:"base"});function dy(e,t){return hu.filter(n=>n===t?!0:(e[Ro(n)]??"").length>0)}function bu(e,t){return t(e==="anthropic-messages"?"keysProtocolAnthropic":e==="openai-responses"?"keysProtocolResponses":e==="openai-completions"?"keysProtocolOpenAI":"keysProtocolDefault")}function ly(e,t){return t(e==="anthropic-messages"?"keysProtocolAnthropicHint":e==="openai-responses"?"keysProtocolResponsesHint":e==="openai-completions"?"keysProtocolOpenAIHint":"keysProtocolDefaultHint")}function mu(e,t,n,r=!1){return[void 0,...r?hu:dy(e,t)].map(i=>({value:i??"",title:bu(i,n),hint:ly(i,n)}))}function $o(e){let{route:t,t:n,draft:r}=e,o=e.client??De,[i,a]=(0,re.useState)(()=>o.cached?.(t)?.entries),[s,d]=(0,re.useState)(()=>o.cached?.(t)?.models??[]),[l,c]=(0,re.useState)(void 0),[p,m]=(0,re.useState)(!1),u=i===void 0&&l===void 0;(0,re.useEffect)(()=>{if(m(!1),!u)return;let S=setTimeout(()=>m(!0),Jb);return()=>clearTimeout(S)},[u,t]);let[f,y]=(0,re.useState)(!1),[g,T]=(0,re.useState)(void 0),[A,x]=(0,re.useState)(""),[H,O]=(0,re.useState)(""),[J,U]=(0,re.useState)([]),[v,b]=(0,re.useState)(void 0);(0,re.useEffect)(()=>{r===!0&&T({kind:"add"})},[r]);let[N,w]=(0,re.useState)(void 0),[E,I]=(0,re.useState)(void 0),[F,G]=(0,re.useState)(void 0),W=(0,re.useRef)(void 0);(0,re.useEffect)(()=>()=>{W.current!==void 0&&clearTimeout(W.current)},[]);let[h,L]=(0,re.useState)(void 0),[P,_]=(0,re.useState)(()=>o.cached?.(t)?.endpoints??pu),[Y,oe]=(0,re.useState)(!1),ee=(0,re.useRef)(!1);(0,re.useEffect)(()=>{ee.current=Y},[Y]);let se=(0,re.useRef)(0),te=(0,re.useCallback)((S,V)=>{if(!S.ok){c({kind:"error",text:S.error??n("keysUnreachable")});return}a(S.entries),d(S.models??[]),_(S.endpoints),oe(S.probing===!0),c(V===void 0?void 0:{kind:"status",text:V})},[n]),ge=(0,re.useRef)(t);ge.current=t,(0,re.useEffect)(()=>(ge.current=t,()=>{ge.current=void 0}),[t]);let j=(0,re.useCallback)(async(S,V=!1)=>{let ie=o.cached?.(S)!==void 0,be=await o.list(S,V?{preferCache:!0}:void 0);ge.current===S&&(ie&&!be.ok||te(be,void 0))},[te,o]);(0,re.useEffect)(()=>{j(t,!0)},[j,t]),(0,re.useEffect)(()=>{let S,V,ie=()=>{S===void 0&&(S=setTimeout(()=>{S=void 0,j(t),V===void 0&&(V=setTimeout(()=>{V=void 0,!ee.current&&j(t)},ay))},iy))};return document.addEventListener(ur,ie),()=>{document.removeEventListener(ur,ie),S!==void 0&&clearTimeout(S),V!==void 0&&clearTimeout(V)}},[j,t]),(0,re.useEffect)(()=>{if(!Y){se.current=0;return}let S=!0,V=setInterval(()=>{if(se.current+=1,se.current>oy){oe(!1);return}(async()=>{let ie=await o.list(t);!S||ge.current!==t||(ie.ok?(te(ie,void 0),ie.probing!==!0&&c({kind:"status",text:n("keysProbeDone")})):oe(!1))})()},ry);return()=>{S=!1,clearInterval(V)}},[te,o,Y,t]),(0,re.useEffect)(()=>{let S=!0,V=0,ie=be=>{let ke=be.detail,ce=ke?.route;if(!S||ge.current!==t||ce!==void 0&&ce!==t)return;let Le=++V;if(typeof ke?.openai=="string"&&typeof ke.anthropic=="string"){_({openai:ke.openai||null,anthropic:ke.anthropic||null});return}(async()=>{let Fe=o.endpoints!==void 0?await o.endpoints(t):await o.list(t);!S||ge.current!==t||V!==Le||Fe.ok&&_(Fe.endpoints??pu)})().catch(()=>{})};return document.addEventListener(cr,ie),()=>{S=!1,document.removeEventListener(cr,ie)}},[o,t]);let ne=()=>{T(void 0),x(""),O(""),U([]),b(void 0)},fe=(0,re.useCallback)(async(S,V)=>{let ie=g,be=t;y(!0),w(void 0);try{let ke=await S();if(ge.current!==be)return;te(ke,V),ke.ok&&ie!==void 0&&ie.kind!=="add"&&!ke.entries.some(ce=>ce.ref===ie.ref)&&ne()}finally{y(!1)}},[te,g,t]),ve=(S,V)=>{T({kind:S,ref:V.ref}),x(S==="alias"?V.alias??"":""),O(""),U((V.models??[]).filter(ie=>s.includes(ie))),b(void 0),w(void 0)},$=()=>{if(f||g===void 0)return;let S=g.kind,V=g.ref;if(S!=="alias"&&S!=="scope"&&!Tt(H))return;let ie=zl(A),be=v,ke=t,ce=()=>ge.current!==ke;y(!0),(async()=>{try{if(S==="add"){let Fe=new Set((i??[]).map(Se=>Se.ref)),it=await o.add(t,H,ie);if(ce())return;if(!it.ok){te(it,n("keysAdded"));return}if(te(it,n("keysAdded")),ne(),be===void 0)return;let Wt=it.entries.find(Se=>Se.ref===it.addedRef)??it.entries.find(Se=>!Fe.has(Se.ref)),pn=Wt===void 0?{ok:!1}:await o.setProtocol(t,Wt.ref,be);ce()||te(pn,n("keysAdded"));return}if(V===void 0)return;if(S==="scope"){let Fe=await o.setScope(t,V,J.length===0?void 0:J);ce()||(te(Fe,n("keysScopeSaved")),Fe.ok&&ne());return}let Le=S==="alias"?await o.rename(t,V,ie):await o.replace(t,V,H);ce()||(te(Le,n(S==="alias"?"keysRenamed":"keysReplaced")),Le.ok&&ne())}finally{y(!1)}})()},X=S=>{U(V=>V.includes(S)?V.filter(ie=>ie!==S):[...V,S])},Z=(0,re.useMemo)(()=>[...new Set(s)].sort(sy.compare),[s]),he=(0,re.useMemo)(()=>new Set(J),[J]),xe=()=>{if(g===void 0)return null;let S=g.kind,V=S==="add"||S==="value",ie=S==="scope",be=S==="scope"&&g?.ref!==void 0?i?.find(ce=>ce.ref===g.ref)?.auto===!0:!1,ke=V&&H.length>0&&!Tt(H);return(0,B.jsxs)("div",{className:"bre-keys-form",children:[ie?(0,B.jsx)("div",{className:"bre-keys-chips",role:"group","aria-label":n("keysScope"),children:Z.length===0?(0,B.jsx)("p",{className:"bre-keys-hint",children:n("keysScopeEmpty")}):Z.map(ce=>{let Le=he.has(ce);return(0,B.jsx)("button",{type:"button",className:Le?"bre-keys-chip is-selected":"bre-keys-chip","aria-pressed":Le,disabled:f,onClick:()=>X(ce),children:ce},ce)})}):(0,B.jsxs)("div",{className:"bre-keys-form-fields",children:[S==="value"?null:(0,B.jsx)("input",{className:"bre-text-input bre-keys-name",type:"text",value:A,placeholder:n("keysAliasPlaceholder"),"aria-label":n("keysAlias"),disabled:f,autoFocus:S==="alias",onChange:ce=>x(ce.target.value)}),V?(0,B.jsx)("input",{className:"bre-text-input bre-keys-secret",type:"password",autoComplete:"new-password",spellCheck:!1,value:H,placeholder:n(S==="add"?"keysValuePlaceholder":"keysNewValuePlaceholder"),"aria-label":n("keysValue"),"aria-invalid":ke,disabled:f,autoFocus:!0,onChange:ce=>O(ce.target.value)}):null]}),S==="add"?(0,B.jsx)("div",{className:"bre-keys-chips",role:"group","aria-label":n("keysProtocolCreate"),children:mu(P,void 0,n,r===!0).map(ce=>{let Le=ce.value===""?void 0:ce.value,Fe=v===Le;return(0,B.jsx)("button",{type:"button",className:Fe?"bre-keys-chip is-selected":"bre-keys-chip","aria-pressed":Fe,title:ce.hint,disabled:f,onClick:()=>b(Le),children:ce.title},ce.value)})}):null,S==="add"?(0,B.jsx)("p",{className:"bre-keys-hint",children:n("keysProtocolCreateHint")}):null,ie?(0,B.jsx)("p",{className:"bre-keys-hint",children:n("keysScopeHint")}):null,ie&&be?(0,B.jsx)("p",{className:"bre-keys-hint",children:n("keysScopeAutoHint")}):null,ke?(0,B.jsx)("p",{className:"bre-effort-message bre-error",role:"alert",children:n("keysAddIllegal")}):null,(0,B.jsxs)("div",{className:"bre-keys-form-actions",children:[ie?(0,B.jsx)("button",{type:"button",className:"bre-link-button bre-keys-allmodels",disabled:f,onClick:()=>U([]),children:n("keysScopeAll")}):null,(0,B.jsx)("button",{type:"button",className:"bre-link-button",disabled:f,onClick:ne,children:n("keysCancel")}),(0,B.jsx)("button",{type:"button",className:"bre-primary-button",disabled:f||V&&!Tt(H),onClick:$,children:n(S==="add"?"keysAddConfirm":"keysSave")})]})]})},de=()=>g?.kind==="add"?(0,B.jsx)("li",{className:"bre-keys-form-row",children:xe()}):(0,B.jsx)("li",{className:"bre-keys-add-row",children:(0,B.jsxs)("button",{type:"button",className:"bre-keys-add",disabled:f,onClick:()=>{T({kind:"add"}),x(""),O(""),U([]),w(void 0)},children:[(0,B.jsx)("span",{className:"bre-keys-add-mark","aria-hidden":"true",children:(0,B.jsx)(ts,{paths:Xb})}),n("keysAdd")]})}),we=async S=>{if(F!==void 0)return;let V=t;G(S.ref);try{let ie=await o.reveal(t,S.ref);if(ge.current!==V)return;if(ie===void 0){c({kind:"error",text:n("keysCopyFailed")});return}let be=await ey(ie);if(ge.current!==V)return;if(!be){c({kind:"error",text:n("keysCopyFailed")});return}c(void 0),I(S.ref),W.current!==void 0&&clearTimeout(W.current),W.current=setTimeout(()=>{W.current=void 0,I(void 0)},Zb)}finally{G(void 0)}},Ne=(S,V)=>{let ie=V===""?void 0:V;L(void 0),fe(()=>o.setProtocol(t,S.ref,ie),n("keysProtocolSaved"))},Ae=h===void 0?void 0:i?.find(S=>S.ref===h.ref);if(i===void 0)return l===void 0?(0,B.jsx)("div",{className:"bre-keys","aria-busy":"true",children:p?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)("ul",{className:"bre-keys-list bre-keys-skeleton","aria-hidden":"true",children:[(0,B.jsxs)("li",{className:"bre-keys-skeleton-row",children:[(0,B.jsx)("span",{className:"bre-keys-skeleton-dot"}),(0,B.jsx)("span",{className:"bre-keys-skeleton-bar is-name"}),(0,B.jsx)("span",{className:"bre-keys-skeleton-bar is-mask"})]}),(0,B.jsx)("li",{className:"bre-keys-skeleton-row is-add",children:(0,B.jsx)("span",{className:"bre-keys-skeleton-bar"})})]}),(0,B.jsx)("p",{className:"bre-keys-sr",role:"status",children:n("keysLoading")})]}):null}):(0,B.jsxs)("div",{className:"bre-keys",children:[(0,B.jsx)("p",{className:"bre-effort-message bre-"+l.kind,role:l.kind==="error"?"alert":"status",children:l.text}),(0,B.jsx)("ul",{className:"bre-keys-list",children:de()})]});let Ct=i.reduce((S,V)=>V.enabled?S+1:S,0),Xe=r===!0?null:(0,B.jsx)("button",{type:"button",className:"bre-link-button bre-keys-probe",disabled:f||Y||i.length<2,title:i.length<2?n("keysProbeSingle"):n("keysProbeHint"),onClick:()=>{fe(()=>o.probe(t),void 0)},children:n(Y?"keysProbing":"keysProbe")});return(0,B.jsxs)("div",{className:"bre-keys",children:[Xe===null?null:e.probeHost===void 0?(0,B.jsx)("div",{className:"bre-keys-probe-row",children:Xe}):(0,gu.createPortal)(Xe,e.probeHost),(0,B.jsxs)("ul",{className:"bre-keys-list",children:[i.map(S=>{let V=fu(S),ie=S.enabled&&Ct<=1;return(0,B.jsxs)(re.Fragment,{children:[(0,B.jsxs)("li",{className:S.enabled?"bre-keys-row":"bre-keys-row is-off","data-state":S.configured===!1?"missing":"ready",children:[(0,B.jsx)("button",{type:"button",className:S.enabled?"bre-keys-toggle is-on":"bre-keys-toggle","aria-pressed":S.enabled,"aria-label":n(S.enabled?"keysDisable":"keysEnable",{name:V}),title:n(S.enabled?"keysDisable":"keysEnable",{name:V}),disabled:f||ie,onClick:()=>{fe(()=>o.setEnabled(t,S.ref,!S.enabled),void 0)},children:(0,B.jsx)("span",{className:"bre-keys-toggle-mark","aria-hidden":"true",children:(0,B.jsx)(ts,{paths:[uu]})})}),(0,B.jsx)("button",{type:"button",className:E===S.ref?"bre-keys-copy is-copied":"bre-keys-copy","aria-label":n("keysCopy",{name:V}),title:E===S.ref?n("keysCopied"):n("keysCopy",{name:V}),disabled:f||F===S.ref||S.configured===!1,onClick:()=>{we(S)},children:(0,B.jsx)(ts,{paths:E===S.ref?[uu]:Qb})}),S.alias===void 0?null:(0,B.jsx)("span",{className:"bre-keys-alias",children:S.alias}),(0,B.jsx)("span",{className:S.alias===void 0?"bre-keys-mask bre-keys-mask-plain":"bre-keys-mask",children:ty(S,n)}),(0,B.jsx)("span",{className:N===S.ref?"bre-keys-actions is-confirming":"bre-keys-actions",children:N===S.ref?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("button",{type:"button",className:"bre-link-button bre-keys-danger",disabled:f,onClick:()=>{fe(()=>o.remove(t,S.ref),n("keysRemoved"))},children:n("keysConfirmRemove")}),(0,B.jsx)("button",{type:"button",className:"bre-link-button",disabled:f,onClick:()=>w(void 0),children:n("keysCancel")})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("span",{className:"bre-keys-protocol-wrap",children:(0,B.jsxs)("button",{type:"button",className:"bre-keys-protocol","aria-haspopup":"listbox","aria-expanded":h?.ref===S.ref,"aria-label":n("keysProtocolLabel",{name:V}),title:n("keysProtocolLabel",{name:V}),disabled:f,onClick:be=>{let ke=be.currentTarget;L(ce=>ce?.ref===S.ref?void 0:{ref:S.ref,anchor:ke}),w(void 0)},children:[(0,B.jsx)("span",{className:"bre-keys-protocol-label",children:bu(S.protocol,n)}),(0,B.jsx)("span",{className:"bre-keys-protocol-caret","aria-hidden":"true",children:"\u203A"})]})}),(0,B.jsx)("button",{type:"button",className:"bre-link-button",disabled:f,onClick:()=>ve("alias",S),children:n("keysAlias")}),r===!0?null:(0,B.jsx)("button",{type:"button",className:"bre-link-button bre-keys-scope",disabled:f,title:n("keysScope",{name:V}),onClick:()=>ve("scope",S),children:ny(S,n)}),(0,B.jsx)("button",{type:"button",className:"bre-link-button",disabled:f,onClick:()=>ve("value",S),children:n("keysEdit")}),(0,B.jsx)("button",{type:"button",className:"bre-link-button",disabled:f,onClick:()=>{w(S.ref),T(void 0)},children:n("keysRemove")})]})})]}),g!==void 0&&g.ref===S.ref?(0,B.jsx)("li",{className:"bre-keys-form-row",children:xe()}):null]},S.ref)}),de()]}),r===!0?(0,B.jsx)("p",{className:"bre-keys-note",children:n("keysDraftHint")}):null,l===void 0?null:(0,B.jsx)("p",{className:"bre-effort-message bre-"+l.kind,role:l.kind==="error"?"alert":"status",children:l.text}),h===void 0||Ae===void 0?null:(0,B.jsx)(cu,{anchor:h.anchor,label:n("keysProtocolLabel",{name:fu(Ae)}),options:mu(P,Ae.protocol,n,r===!0),selected:Ae.protocol??"",onPick:S=>Ne(Ae,S),onClose:()=>L(void 0)})]})}var nn="bre-key-managed",cy="bre-keys-host",yu="bre-keys-probe-host",rs="data-bre-key-host",uy="data-bre-key-input",Vo="data-bre-region",Kt=new WeakMap;function fy(e){let t=e.querySelector(`input[${uy}]`);if(t instanceof HTMLInputElement)return t;let n=e.querySelector('input[type="password"]');return n instanceof HTMLInputElement?n:void 0}function vu(e){let t=Kt.get(e)?.host;if(t!==void 0&&t.isConnected)return t;let n=e.nextElementSibling;return n instanceof HTMLElement&&n.hasAttribute(rs)?n:void 0}function wu(e,t){let n=t.route;if(n===void 0||n.length===0||fy(e)===void 0||e.parentElement===null)return;_e(e,nn,!0);let r=Kt.get(e),o=vu(e);o===void 0&&(r!==void 0&&xu(e,r),o=e.ownerDocument.createElement("div"),o.className=cy,e.after(o)),pe(o,rs,n);let i=e.getAttribute(Vo);i===null?o.hasAttribute(Vo)&&o.removeAttribute(Vo):pe(o,Vo,i);let a=Kt.get(e),s=a?.probeHost??e.ownerDocument.createElement("span");a===void 0&&(s.className=yu),s.parentElement!==e&&e.appendChild(s);let d=()=>(0,ns.createElement)(Ge,{fallbackText:t.t("keysPanelFailed")},(0,ns.createElement)($o,{route:n,t:t.t,client:t.client,probeHost:s}));if(a!==void 0&&a.route===n){(a.t!==t.t||a.client!==t.client)&&(a.t=t.t,a.client=t.client,a.mount.root.render(d()));return}a!==void 0&&(Kt.delete(e),a.mount.root.unmount()),Kt.set(e,{route:n,host:o,probeHost:s,mount:ut(o,d(),{sync:!0}),t:t.t,client:t.client})}function xu(e,t){Kt.delete(e),He(t.mount),t.probeHost.remove()}function Yo(e){_e(e,nn,!1);let t=Kt.get(e);t!==void 0&&xu(e,t),vu(e)?.remove();for(let n of Array.from(e.children))n.classList.contains(yu)&&n.remove()}function ku(){for(let e of Array.from(document.querySelectorAll(`[${rs}]`))){let t=e.previousElementSibling;t instanceof HTMLElement&&Kt.has(t)?Yo(t):e.remove()}}var Eu="http://www.w3.org/2000/svg",py="data-bre-icon";function my(e){let t=document.createElementNS(Eu,"path");return t.setAttribute("d",e),t}function Jo(e,t){let n=document.createElementNS(Eu,"svg");return n.setAttribute("viewBox","0 0 16 16"),n.setAttribute("width","16"),n.setAttribute("height","16"),n.setAttribute("fill","none"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","1.5"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),n.setAttribute(py,e),n.append(...t.map(my)),n}var on="bre-key-field",Mu="bre-key-eye",Rr="data-bre-key-input",Lu="data-bre-eye-show",Au="data-bre-eye-hide",Tu=["M1.5 8S4 3.75 8 3.75 14.5 8 14.5 8 12 12.25 8 12.25 1.5 8 1.5 8Z","M6.2 8a1.8 1.8 0 1 0 3.6 0 1.8 1.8 0 0 0-3.6 0Z"],Xo=new WeakMap,rn=new WeakMap;function Qo(e){let t=e.querySelector(`input[${Rr}]`);if(t instanceof HTMLInputElement)return t;let n=e.querySelector('input[type="password"]');return n instanceof HTMLInputElement?n:void 0}function is(e){for(let t of Array.from(e.children))if(t instanceof HTMLButtonElement&&t.classList.contains(Mu))return t}function Ru(e){let t=Qo(e);t!==void 0&&(pe(t,Rr,""),_e(e,on,!0))}function Cu(e,t){let n=Qo(e);if(n===void 0){Wn(e);return}Xo.get(e)?.route!==t.route&&rn.delete(e),Xo.set(e,t),pe(n,Rr,""),_e(e,on,!0);let r=is(e)??hy(e);pe(r,Lu,t.t("keyRevealShow")),pe(r,Au,t.t("keyRevealHide")),os(r,n)}function Wn(e){let t=is(e);t!==void 0&&t.remove(),Xo.delete(e),_e(e,on,!1);let n=e.querySelector(`input[${Rr}]`);n instanceof HTMLInputElement&&(n.removeAttribute(Rr),n.type="password");let r=rn.get(e);rn.delete(e),r!==void 0&&n instanceof HTMLInputElement&&n.value===r&&Cr(n,"")}async function gy(e){try{let t=await fetch(`${Vr}?route=${encodeURIComponent(e)}`,{method:"GET",cache:"no-store",credentials:"same-origin"});if(!t.ok)return;let n=await t.json();return n===null||typeof n!="object"||n.ok!==!0?void 0:typeof n.key=="string"&&n.key.length>0?n.key:void 0}catch{return}}function os(e,t){let n=t.type!=="password";pe(e,"aria-pressed",n?"true":"false");let r=e.getAttribute(n?Au:Lu);r!==null&&(pe(e,"aria-label",r),pe(e,"title",r)),ft(e,t.disabled)}function Cr(e,t){let n=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");n?.set===void 0?e.value=t:n.set.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0}))}function hy(e){let t=document.createElement("button");t.type="button",t.className=Mu,t.append(Su("eye"),Su("eye-off"));let n=async()=>{let r=Qo(e),o=Xo.get(e);if(r===void 0||o===void 0||t.hasAttribute("aria-busy"))return;if(r.type!=="password"){let a=rn.get(e);rn.delete(e),a!==void 0&&r.value===a&&Cr(r,""),r.type="password",os(t,r);return}let i=o.route;if(i!==void 0&&rn.get(e)===void 0&&r.value.length===0){pe(t,"aria-busy","true");let a;try{a=await(o.loadKey??gy)(i)}catch{a=void 0}if(t.hasAttribute("aria-busy")&&t.removeAttribute("aria-busy"),a===void 0){let s=o.t("keyRevealFailed");pe(t,"aria-label",s),pe(t,"title",s);return}if(is(e)!==t||!t.isConnected||Qo(e)!==r||r.value.length>0)return;rn.set(e,a),Cr(r,a)}r.type="text",os(t,r)};return t.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation(),n()}),e.append(t),t}function Su(e){let t=e==="eye-off"?[...Tu,"M2.5 13.5 13.5 2.5"]:Tu;return Jo(e,t)}var ds="bre-editor-tabs",by="bre-editor-tab",Zo="data-bre-tab-id",Nr="bre-tabbed",Lt="data-bre-tab",Hu="data-bre-provider",rt="data-bre-region",Hr="data-bre-editor-body",$n="data-bre-footer",yy="row",vy="path",Ir="data-bre-details";var wy=".bre-headers",xy=".bre-fingerprint",ky="data-bre-fingerprint",Bt="provider",Un="models",jn="fingerprint",zn="advanced",Ey=[Bt,Un,zn,jn],Ty="none",Nu=Ey,Iu=ds,Ou=by,Pu=Zo,ei='[class*="editorActions"], [class*="modelList"], [class*="modelCatalog"], [class*="modelEntry"]',Sy='[class*="modelCatalog"], [class*="modelList"], [class*="modelEntry"]',_u='[class*="rowCard"], [class*="addCard"], li',My='[class*="addPanel"]',as=".bre-create-host";function Du(){return{warned:new WeakSet}}function Vn(e){return e===null?null:e.closest(_u)}function Fu(e){let t=Vn(e);return t!==null&&t.querySelector(as)!==null}function Ku(e){for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.matches(My)&&!t.hidden)return t;return e}function Bu(e,t){if(e.getAttribute(Lt)===t){ss(e);return}let n=Mo(e),r=e.getBoundingClientRect().top,o=n?.scrollTop??0;n!==void 0&&(n.style.overflowAnchor="none"),pe(e,Lt,t),ss(e),n!==void 0&&requestAnimationFrame(()=>{if(n.style.overflowAnchor="",n.scrollTop!==o)return;let i=e.getBoundingClientRect().top-r;i!==0&&(n.scrollTop+=i)})}function ls(e,t,n){if(!e.isConnected)return;let r=new Set;for(let o of Array.from(e.querySelectorAll(ei))){let i=o.closest(_u);i!==null&&r.add(i)}for(let o of Array.from(e.querySelectorAll(`.${Nr}`)))r.has(o)||ti(o);for(let o of r)try{Ny(o,t)}catch(i){n.warned.has(o)||(n.warned.add(o),console.warn("[bre] editor tabs: rolled a provider card back to the official layout:",i)),ti(o)}}function qu(){for(let e of Array.from(document.querySelectorAll(`.${Nr}`))){e.classList.remove(Nr),e.removeAttribute(Lt),e.removeAttribute(Hr);for(let t of Array.from(e.querySelectorAll(`[${rt}]`)))t.removeAttribute(rt)}for(let e of Array.from(document.querySelectorAll(`[${Lt}]`)))e.removeAttribute(Lt);for(let e of Array.from(document.querySelectorAll(`[${rt}]`)))e.removeAttribute(rt);for(let e of Array.from(document.querySelectorAll(`[${Hr}]`)))e.removeAttribute(Hr);for(let e of Array.from(document.querySelectorAll(`[${$n}]`)))e.removeAttribute($n);for(let e of Array.from(document.querySelectorAll(`details[${Ir}]`)))e.removeAttribute("open"),e.removeAttribute(Ir);for(let e of Array.from(document.querySelectorAll(`.${on}`)))Wn(e);for(let e of Array.from(document.querySelectorAll(`.${nn}`)))Yo(e);ku()}function Ly(e){for(let n of Array.from(e.children))if(n instanceof HTMLElement&&!n.matches('[class*="editorHeader"], [class*="editorTitle"], [class*="editorActions"], [class*="editorRoute"]')&&n.matches('[class*="editor"]')&&(n.querySelector(ei)!==null||n.querySelector("input, select")!==null))return n;let t=e.querySelector(ei);for(;t!==null&&t.parentElement!==e;)t=t.parentElement;return t!==null&&t!==e?t:void 0}function Ay(e){let t={header:void 0,models:void 0,actions:void 0,fields:[]};Gu(e,t,0);let{actions:n,fields:r,header:o,models:i}=t;if(!(n===void 0||r.length===0)&&r.some(a=>a.querySelector("input, select, textarea")!==null))return{header:o,models:i,actions:n,fields:r}}var Ry=4;function Gu(e,t,n){if(!(n>Ry)){for(let r of Array.from(e.children))if(r instanceof HTMLElement&&!r.matches('[class*="bre-"], [data-plugin]')){if(t.header===void 0&&r.matches('[class*="editorHeader"], [class*="editorTitle"]')){t.header=r;continue}if(r.matches('[class*="editorActions"]')){t.actions??(t.actions=r);continue}if(r.matches(Sy)){t.models??(t.models=r);continue}if(r.querySelector(ei)!==null){Gu(r,t,n+1);continue}if(r.querySelector('[class*="editorActions"]')!==null){t.actions??(t.actions=r);continue}if(r.querySelector("input, select, textarea")!==null){t.fields.push(r);continue}(r.matches("p, small, em, i")||r.matches('[class*="Hint"], [class*="error"]'))&&t.fields.push(r)}}}function Cy(e,t){if(!t.contains(e))return;pe(e,$n,yy);let n=e.parentElement;for(;n!==null&&(pe(n,$n,vy),n!==t);)n=n.parentElement}function Hy(e){let n=e.querySelector(`[${Hu}]`)?.getAttribute(Hu);return n==null||n===""?void 0:n}function Ny(e,t){let n=Ku(e),r=Ly(n);if(r===void 0){ti(e);return}let o=Ay(r);if(o===void 0){ti(e);return}let i=n.querySelector(wy),a=Hy(n);for(let p of o.fields)pe(p,rt,Bt),Cu(p,{t:t.t,route:a}),wu(p,{t:t.t,route:a});o.header!==void 0&&pe(o.header,rt,Ty),o.models!==void 0&&pe(o.models,rt,Un),pe(r,Hr,""),n.querySelector(as)!==null&&Cy(o.actions,r),i!==null&&pe(i,rt,zn);let s=n.querySelector(xy);s!==null&&pe(s,rt,jn),Oy(r);let d=new Set([Bt]);o.models!==void 0&&d.add(Un),i!==null&&d.add(zn);let l=n.querySelector(as)!==null;s!==null&&!l&&s.getAttribute(ky)==="ready"&&d.add(jn);let c=e.getAttribute(Lt)??Bt;pe(e,Lt,d.has(c)?c:Bt),_e(e,Nr,!0),Iy(e,n,t,d)}function Iy(e,t,n,r){let o=t.querySelector(`.${ds}`);o!==null&&(pe(o,"aria-label",n.t("editorTabsLabel")),yr(an(o,Bt),n.t("editorTabProvider")),yr(an(o,Un),n.t("editorTabModels")),yr(an(o,zn),n.t("editorTabAdvanced")),yr(an(o,jn),n.t("editorTabFingerprint")),ft(an(o,Un),!r.has(Un)),ft(an(o,zn),!r.has(zn)),ft(an(o,jn),!r.has(jn)),ss(e,o))}function ss(e,t){let n=t??Ku(e).querySelector(`.${ds}`);if(n===null)return;let r=e.getAttribute(Lt)??Bt;for(let o of Array.from(n.querySelectorAll(`[${Zo}]`)))pe(o,"aria-selected",o.getAttribute(Zo)===r?"true":"false")}function an(e,t){for(let n of Array.from(e.children))if(n instanceof HTMLElement&&n.getAttribute(Zo)===t)return n}function ti(e){e.classList.remove(Nr),e.removeAttribute(Lt),e.removeAttribute(Hr);for(let t of Array.from(e.querySelectorAll(`[${rt}]`)))t.getAttribute(rt)===Bt&&(Wn(t),Yo(t)),t.removeAttribute(rt);for(let t of Array.from(e.querySelectorAll(`[${$n}]`)))t.removeAttribute($n);Py(e)}function Oy(e){for(let t of Array.from(e.querySelectorAll("details")))t.hasAttribute("open")||(pe(t,Ir,"closed"),pe(t,"open",""))}function Py(e){for(let t of Array.from(e.querySelectorAll(`details[${Ir}]`)))t.removeAttribute("open"),t.removeAttribute(Ir)}var Af=require("react");var ze=require("react");var Ee=require("react");var _y='p[class*="savedNotice"]',ju="data-bre-saved-hidden",Dy="bre-auto-effort-note",Fy="data-bre-auto-effort-phase",Wu="bre-auto-effort-note-text",Yn=new Map,Uu=new WeakMap,Jn=null,ni=null;function zu(e){let t=Array.from(e.querySelectorAll(_y));for(let n of t){let r=n.textContent?.trim()??"";Uu.get(n)!==r&&(Uu.set(n,r),r.length>0&&Ju(r)),!Yn.has(n)&&(Yn.set(n,n.style.display),n.setAttribute(ju,""),n.style.display="none")}for(let[n,r]of Array.from(Yn))n.isConnected&&t.includes(n)||(Vu(n,r),Yn.delete(n))}function $u(){for(let[e,t]of Array.from(Yn))Vu(e,t);Yn.clear(),cs()}function Vu(e,t){e.style.display=t,e.removeAttribute(ju)}function Yu(e){Ju(e)}function Ju(e){if(Jn!==null&&Jn.isConnected&&Jn.textContent===e)return;cs();let t=document.createElement("div");t.className=Dy,t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute(Fy,"done"),t.innerHTML=`<span class="${Wu}"></span>`;let n=t.querySelector(`.${Wu}`);n!==null&&(n.textContent=e),t.style.setProperty("--bre-note-hold","3000ms"),document.body.append(t),Jn=t,ni=setTimeout(()=>{cs()},3e3)}function cs(){ni!==null&&(clearTimeout(ni),ni=null),Jn?.remove(),Jn=null}var sn="data-bre-settle",Xu='[class*="rowActions"] > button:not(.bre-provider-switch):not(.bre-provider-delete)';var xt=null,us=0,ri=0,Or=!1,Xn=null;function Qu(e){return e.className.includes("dangerButton")?"remove":"edit"}function fs(e,t){return Array.from(e.querySelectorAll(Xu)).find(r=>Qu(r)===t)??null}function Ky(e){return typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,16)}function By(e){typeof cancelAnimationFrame=="function"?cancelAnimationFrame(e):clearTimeout(e)}function Zu(e=document){Pr();let t=[];for(let n of Array.from(e.querySelectorAll(Xu))){if(n.disabled)continue;let r=n.closest("li")??n.parentElement;if(r===null)continue;let o=Qu(n);t.some(i=>i.row===r&&i.role===o)||t.push({row:r,role:o})}t.length!==0&&(xt=t,ri=Date.now(),us=ri+8e3,qy(),ef())}function ps(){if(xt===null)return;let e=Date.now();if(e>us){Pr();return}let t=0;if(xt=xt.filter(n=>{if(!n.row.isConnected)return!1;let r=fs(n.row,n.role);return r===null||(r.disabled?(Or=!0,t+=1,r.hasAttribute(sn)||r.setAttribute(sn,"")):Or&&r.hasAttribute(sn)&&r.removeAttribute(sn)),!0}),Or&&t===0){Pr();return}if(!Or&&e-ri>1500){Pr();return}ef()}function ef(){Xn!==null||xt===null||(Xn=Ky(()=>{Xn=null,ps()}))}function qy(){if(xt!==null)for(let e of xt){let t=fs(e.row,e.role);t!==null&&!t.hasAttribute(sn)&&t.setAttribute(sn,"")}}function tf(){Pr()}function Pr(){if(Xn!==null&&(By(Xn),Xn=null),xt!==null)for(let e of xt){let t=fs(e.row,e.role);t!==null&&t.removeAttribute(sn)}xt=null,Or=!1,us=0,ri=0}var Q=require("react/jsx-runtime"),Gy=["claude-cli/2.1.161 (external, cli)","claude-code/1.0.0","Kilo-Code/1.0"];function nf(e,t){let n=()=>t.current+=1,r=Object.entries(e??{}).map(([o,i])=>({id:n(),name:o,value:i}));return r.length===0&&r.push({id:n(),name:"",value:""}),{rows:r}}function rf(e){let t={},n=!1;for(let o of e.rows){let i=o.name.trim();i.length!==0&&(t[i]=o.value,i.toLowerCase()==="user-agent"&&(n=!0))}let r=e.userAgent?.trim();return!n&&r!==void 0&&r.length>0&&(t["user-agent"]=r),t}function oi({route:e,api:t,t:n,onDismiss:r,deferred:o}){let i=(0,Ee.useId)(),[a,s]=(0,Ee.useState)(void 0),[d,l]=(0,Ee.useState)({rows:[]}),[c,p]=(0,Ee.useState)(!1),[m,u]=(0,Ee.useState)(!1),[f,y]=(0,Ee.useState)(!0),[g,T]=(0,Ee.useState)(!1),[A,x]=(0,Ee.useState)(!1),[H,O]=(0,Ee.useState)(void 0),[J,U]=(0,Ee.useState)(void 0),[v,b]=(0,Ee.useState)(!1),N=(0,Ee.useRef)(0),w=(0,Ee.useRef)(null),E=o!==void 0,I=o?.onDraft,F=(0,Ee.useRef)(void 0);(0,Ee.useEffect)(()=>{if(E&&F.current!==void 0)return;F.current=e;let j=!0;return(async()=>{try{let ne=await le(t);if(!j)return;let fe=la(ne.namespace,e);s(fe),l(nf(fe,N)),x(ne.writable!==!0)}catch{j&&x(!0)}finally{j&&y(!1)}})(),()=>{j=!1}},[t,e,E]),(0,Ee.useEffect)(()=>{I!==void 0&&I(rf(d))},[d,I]),(0,Ee.useEffect)(()=>{let j=!0;return(async()=>{try{let fe=await(await fetch(ed,{method:"GET"})).json();j&&fe.ok===!0&&fe.data!==void 0&&U(fe.data)}catch{}})(),()=>{j=!1}},[]),(0,Ee.useEffect)(()=>{let j=w.current;if(j===null)return;let ne=()=>{b(j.dataset.breRegion==="advanced")};ne();let fe=new MutationObserver(ne);return fe.observe(j,{attributes:!0,attributeFilter:["data-bre-region"]}),()=>{fe.disconnect()}},[]);let G=()=>{l(j=>({...j,rows:[...j.rows,{id:N.current+=1,name:"",value:""}]})),O(void 0)},W=(j,ne)=>{l(fe=>({...fe,rows:fe.rows.map(ve=>ve.id===j?{...ve,...ne}:ve)})),O(void 0)},h=j=>{l(ne=>({...ne,rows:ne.rows.filter(fe=>fe.id!==j)})),O(void 0)},L=()=>{l({rows:[{id:N.current+=1,name:"",value:""}]}),O(void 0)},P=()=>{if(l(nf(a,N)),u(!1),O(void 0),o!==void 0){o.onCancel();return}v&&r?.()},_=async j=>{T(!0),O(void 0),Zu();let ne;try{ne=await gr(t,e,j)}catch(ve){ne={ok:!1,error:ve instanceof Error?ve.message:String(ve)}}if(T(!1),!ne.ok){O({kind:"error",text:ne.error==="no-route"?n("headersNoRoute"):ne.error==="read-only"?n("headersReadOnly"):n("headersError",{error:ne.error})});return}s(j),u(!1);let fe=Object.keys(j).length===0?n("headersCleared"):n("headersSaved");if(v){Yu(fe),r?.();return}O({kind:"success",text:fe})},Y=Object.entries(a??{}),oe=A||g,ee=v||E,se=m||ee?d.rows.filter(j=>j.name.trim().length>0).length:Y.length,te=d.rows.some(j=>j.name.trim().length>0||j.value.length>0),ge=c||m||ee;return(0,Q.jsxs)("div",{className:"bre-headers",ref:w,"data-plugin":Te,"data-open":c?"1":"0",children:[(0,Q.jsx)("div",{className:"bre-headers-head",children:m||ee?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)("span",{className:"bre-effort-title",children:n("headersTitle")}),se===0?null:(0,Q.jsx)("span",{className:"bre-headers-count",children:se}),A||!te?null:(0,Q.jsx)("button",{type:"button",className:"bre-headers-clear",disabled:oe,onClick:L,children:n("headersClear")})]}):(0,Q.jsxs)("button",{type:"button",className:"bre-headers-disclosure","aria-expanded":c,"aria-label":`${n("headersTitle")} ${e}`,onClick:()=>{p(!c),O(void 0)},children:[(0,Q.jsx)("span",{className:"bre-effort-title",children:n("headersTitle")}),f||se===0?null:(0,Q.jsx)("span",{className:"bre-headers-count",children:se}),(0,Q.jsx)("span",{className:"bre-headers-chevron","aria-hidden":"true",children:"\u203A"})]})}),ge?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)("p",{className:"bre-effort-note",children:n("headersHint")}),J===void 0?null:(0,Q.jsxs)(Q.Fragment,{children:[J.environment.preferOfficialLayer?(0,Q.jsx)("p",{className:"bre-effort-note bre-warn",children:n("headersConflictPatched")}):null,J.conflicts.length===0&&(J.headerConflicts?.length??0)===0?null:(0,Q.jsx)("p",{className:"bre-effort-note bre-warn",children:n("headersConflictOrigin")}),J.environment.siblings.length===0?null:(0,Q.jsx)("p",{className:"bre-effort-note bre-warn",children:n("headersConflictSiblings",{names:J.environment.siblings.map(j=>j.name).join(", ")})})]}),f?null:m||ee?(0,Q.jsxs)("div",{className:"bre-headers-edit",children:[(0,Q.jsxs)("div",{className:"bre-headers-columns","aria-hidden":"true",children:[(0,Q.jsx)("span",{children:n("headersName")}),(0,Q.jsx)("span",{children:n("headersValue")}),(0,Q.jsx)("span",{})]}),d.rows.map(j=>(0,Q.jsxs)("div",{className:"bre-headers-row",children:[(0,Q.jsx)("input",{type:"text",className:"bre-text-input bre-headers-name",value:j.name,disabled:oe,placeholder:n("headersNamePlaceholder"),"aria-label":n("headersName"),onChange:ne=>{W(j.id,{name:ne.target.value})}}),(0,Q.jsx)("input",{type:"text",className:"bre-text-input bre-headers-value",value:j.value,disabled:oe,list:j.name.trim().toLowerCase()==="user-agent"?i:void 0,placeholder:n("headersValue"),"aria-label":n("headersValue"),onChange:ne=>{W(j.id,{value:ne.target.value})}}),(0,Q.jsx)("button",{type:"button",className:"bre-headers-remove",disabled:oe,"aria-label":`${n("headersRemove")} ${j.name}`,title:n("headersRemove"),onClick:()=>{h(j.id)},children:"\xD7"})]},j.id)),(0,Q.jsx)("button",{type:"button",className:"bre-headers-add",disabled:oe,onClick:G,children:n("headersAdd")}),(0,Q.jsx)("datalist",{id:i,children:Gy.map(j=>(0,Q.jsx)("option",{value:j},j))})]}):(0,Q.jsxs)("div",{className:"bre-headers-rows",children:[Y.length===0?(0,Q.jsx)("p",{className:"bre-effort-note",children:n("headersEmpty")}):Y.map(([j,ne])=>(0,Q.jsxs)("div",{className:"bre-headers-row",children:[(0,Q.jsx)("span",{className:"bre-headers-name",children:j}),(0,Q.jsx)("span",{className:"bre-headers-value bre-headers-masked",children:"\u2022".repeat(Math.min(ne.length,24))})]},j)),A?null:(0,Q.jsx)("div",{className:"bre-effort-actions",children:(0,Q.jsx)("button",{type:"button",className:"bre-secondary-button",disabled:oe,onClick:()=>{u(!0),O(void 0)},children:n("headersEdit")})})]})]}):null,!f&&(ee||m)?(0,Q.jsxs)("div",{className:"bre-effort-actions bre-headers-actions",children:[(0,Q.jsx)("button",{type:"button",className:"bre-secondary-button",disabled:g,onClick:P,children:n("headersCancel")}),E?null:(0,Q.jsx)("button",{type:"button",className:"bre-primary-button",disabled:oe,onClick:()=>{_(rf(d))},children:n("headersSave")})]}):null,H===void 0?null:(0,Q.jsx)("p",{className:"bre-effort-message bre-"+H.kind,role:H.kind==="error"?"alert":"status",children:H.text})]})}var ms=require("react");var Wy={provider:"editorTabProvider",models:"editorTabModels",fingerprint:"editorTabFingerprint",advanced:"editorTabAdvanced"};function ii({host:e,t}){return(0,ms.createElement)("div",{className:Iu,role:"tablist","aria-label":t("editorTabsLabel")},...Nu.map(n=>(0,ms.createElement)("button",{key:n,type:"button",role:"tab",className:Ou,[Pu]:n,onClick:r=>{r.preventDefault(),r.stopPropagation();let o=Vn(e.current);o!==null&&Bu(o,n)}},t(Wy[n]))))}var Uy=15e3;function af(){return{intents:new Map,baseline:new Map,flushing:!1}}function gs(e,t,n){if(t.length===0)return;let r={...n};if(Object.keys(r).length===0){e.intents.delete(t);return}let o=e.intents.get(t);if(o===void 0){e.intents.set(t,{headers:r,declaredBefore:e.baseline.get(t)});return}o.headers=r}function hs(e,t){e.intents.delete(t)}function sf(e,t){let n=e.intents.get(t);n!==void 0&&(n.releasedAt=Date.now())}function df(e,t,n){if(t.length===0)return;e.baseline.set(t,n);let r=e.intents.get(t);r!==void 0&&(r.declaredBefore=n)}function lf(e,t){return t.length>0&&!e.baseline.has(t)}async function cf(e,t){if(e.flushing)return of(e);if(e.intents.size===0)return 0;e.flushing=!0;try{let n=await le(t),r,o=async a=>et(n.namespace,a)?!0:(r??(r=await le(t,{fresh:!0})),et(r.namespace,a)),i=Date.now();for(let[a,s]of Array.from(e.intents)){if(s.declaredBefore===void 0){s.releasedAt!==void 0&&s.noted!==!0&&(s.noted=!0,console.warn("[bre] deferred request headers: nobody said whether this id existed before, so the draft is held:",a));continue}if(s.declaredBefore){e.intents.delete(a);continue}if(!await o(a)){s.releasedAt!==void 0&&i-s.releasedAt>Uy?(e.intents.delete(a),console.info("[bre] deferred request headers: gave up on a draft whose card closed first:",a)):s.releasedAt!==void 0&&console.info("[bre] deferred request headers: waiting for the closed card to declare",a);continue}console.info("[bre] deferred request headers: the route is declared, writing the held draft:",a);let d;try{d=await gr(t,a,s.headers)}catch(l){d={ok:!1,error:l instanceof Error?l.message:String(l)}}if(d.ok){e.intents.delete(a),console.info("[bre] deferred request headers: saved",a,Object.keys(s.headers).length,"header(s)");continue}d.error!=="no-route"&&(e.intents.delete(a),console.error("[bre] deferred request headers: the write was refused:",d.error,a))}}catch(n){console.error("[bre] deferred request headers: could not read the settings document:",n)}finally{e.flushing=!1}return of(e)}function of(e){let t=0;for(let n of e.intents.values())n.releasedAt!==void 0&&(t+=1);return t}var dn=require("react/jsx-runtime");function ff({host:e,api:t,t:n,routeIdLabels:r,staged:o}){let[i,a]=(0,ze.useState)(()=>_r(e.current,r)),s=(0,ze.useRef)(i),d=(0,ze.useRef)(void 0),l=(0,ze.useRef)(new Set),c=(0,ze.useRef)(!1),p=(0,ze.useRef)(null);return p.current===null&&(p.current={onDraft:m=>{d.current=m;let u=s.current;if(u.length===0){!c.current&&Object.keys(m).length>0&&(c.current=!0,console.info("[bre] deferred request headers: holding a draft until the provider id is typed"));return}gs(o,u,m),uf(t,o,u,l.current)},onCancel:()=>{d.current=void 0,hs(o,s.current)}}),(0,ze.useEffect)(()=>{let m=ai(e.current);if(m===null)return;let u=()=>{a(_r(e.current,r))};return m.addEventListener("input",u,!0),()=>{m.removeEventListener("input",u,!0)}},[e,r]),(0,ze.useEffect)(()=>{i.length>0&&uf(t,o,i,l.current)},[t,o,i]),(0,ze.useEffect)(()=>{let m=s.current;if(m===i)return;hs(o,m),s.current=i;let u=d.current;u!==void 0&&i.length>0&&gs(o,i,u)},[i,o]),(0,ze.useEffect)(()=>()=>{sf(o,s.current)},[o]),(0,dn.jsxs)(dn.Fragment,{children:[(0,dn.jsx)(ii,{host:e,t:n}),(0,dn.jsx)(oi,{route:i,api:t,t:n,deferred:p.current})]})}function uf(e,t,n,r){!lf(t,n)||r.has(n)||(r.add(n),(async()=>{try{let o=await le(e);df(t,n,et(o.namespace,n))}catch(o){r.delete(n),console.warn("[bre] deferred request headers: could not read the settings document for this route:",o)}})())}function ai(e){let t=e?.parentElement;return t==null?null:t.parentElement?.closest('[class*="addCard"]')??t}function _r(e,t){let n=e?.parentElement;if(n==null)return"";let r=t(),o=je(n,r).trim();if(o.length>0)return o;let i=ai(e);return i===null||i===n?"":je(i,r).trim()}var ws=require("react");var $e=require("react");var Dr=15e3,jy=3;function mf(){return{intents:new Map,baseline:new Map,baselinePending:new Set,baselineFailures:new Set,activeIntents:new Map,draining:!1,drainAgain:!1}}function bs(e,t,n){if(t.length===0)return;if(n.length===0){ys(e,t);return}let r=e.intents.get(t);if(r===void 0){let o=e.activeIntents.get(t);e.intents.set(t,{drafts:[...n],landed:o?.landed??[],revision:0,declaredBefore:e.baseline.get(t),attempts:0}),e.draining&&(e.drainAgain=!0);return}zy(r.drafts,n)||(r.drafts=[...n],r.revision+=1,r.baselineMissing=!1,e.draining&&(e.drainAgain=!0))}function zy(e,t){return e.length===t.length&&e.every((n,r)=>{let o=t[r];return o!==void 0&&n.ref===o.ref&&n.value===o.value&&n.alias===o.alias&&n.protocol===o.protocol&&n.enabled===o.enabled})}function ys(e,t){e.intents.delete(t),e.draining&&(e.drainAgain=!0)}function gf(e,t){let n=e.intents.get(t);n!==void 0&&(n.releasedAt=Date.now())}function vs(e,t,n){if(t.length===0)return;e.baseline.has(t)||e.baseline.set(t,n),e.baselinePending.delete(t),e.baselineFailures.delete(t);let r=e.intents.get(t);r!==void 0&&(r.declaredBefore=e.baseline.get(t),r.baselineMissing=!1),e.draining&&(e.drainAgain=!0)}function hf(e,t){return $y(e,t)?(e.baselinePending.add(t),!0):!1}function bf(e,t){e.baselinePending.delete(t),e.baseline.has(t)||e.baselineFailures.add(t),e.draining&&(e.drainAgain=!0)}function $y(e,t){return t.length>0&&!e.baseline.has(t)&&!e.baselinePending.has(t)&&!e.baselineFailures.has(t)}async function yf(e,t,n){if(e.draining)return pf(e);if(e.intents.size===0)return 0;e.draining=!0;try{do{e.drainAgain=!1;let r=await le(t),o,i=async s=>et(r.namespace,s)?!0:(o??(o=await le(t,{fresh:!0})),et(o.namespace,s)),a=Date.now();for(let[s,d]of Array.from(e.intents)){if(e.intents.get(s)!==d)continue;let l=d.revision;e.activeIntents.set(s,d);try{if(d.declaredBefore===void 0){if(e.baselinePending.has(s)){d.releasedAt!==void 0&&a-d.releasedAt>Dr&&(e.intents.delete(s),console.error("[bre] deferred api keys: the pre-save baseline timed out; refusing to write held keys:",s));continue}if(e.baselineFailures.has(s)){let m=await i(s);if(e.intents.get(s)!==d)continue;if(d.revision!==l||d.declaredBefore!==void 0){e.drainAgain=!0;continue}m?(d.baselineMissing=!0,d.noted!==!0&&(d.noted=!0,console.error("[bre] deferred api keys: the pre-save baseline failed and this route now exists; refusing to guess ownership:",s)),d.releasedAt!==void 0&&a-d.releasedAt>Dr&&(e.intents.delete(s),console.error("[bre] deferred api keys: the pre-save baseline remained unknown; refusing to write held keys:",s))):(vs(e,s,!1),d.releasedAt!==void 0&&a-d.releasedAt>Dr&&(e.intents.delete(s),console.info("[bre] deferred api keys: gave up on drafts whose card closed first:",s)));continue}d.baselineMissing=!0,d.noted!==!0&&(d.noted=!0,console.error("[bre] deferred api keys: no pre-save baseline is available; refusing to write held keys:",s)),d.releasedAt!==void 0&&a-d.releasedAt>Dr&&e.intents.delete(s);continue}if(d.declaredBefore){e.intents.delete(s);continue}let c=await i(s);if(e.intents.get(s)!==d)continue;if(d.revision!==l){e.drainAgain=!0;continue}if(!c){d.releasedAt!==void 0&&a-d.releasedAt>Dr&&(e.intents.delete(s),console.info("[bre] deferred api keys: gave up on drafts whose card closed first:",s));continue}let p=await Vy(e,s,d,n);if(e.intents.get(s)!==d||d.revision!==l)continue;p&&(e.intents.delete(s),console.info("[bre] deferred api keys: the route is declared, saved the held key list:",s))}finally{e.activeIntents.get(s)===d&&e.activeIntents.delete(s)}}}while(e.drainAgain&&e.intents.size>0)}catch(r){console.error("[bre] deferred api keys: could not read the settings document:",r)}finally{e.draining=!1}return pf(e)}async function Vy(e,t,n,r){let o=n.revision,i=[...n.drafts],a=!1,s=!1,d=()=>e.intents.get(t)!==n?!0:n.revision!==o?(e.drainAgain=!0,!0):!1,l=()=>{a=!0,n.attempts+=1};for(let c of i){if(d())return!1;let p=n.landed.find(m=>m.ref===c.ref);if(p===void 0){let m=await r.add(t,c.value,c.alias);if(!m.ok){if(d())return!1;l();break}let f=(m.addedRef!==void 0&&m.entries.some(x=>x.ref===m.addedRef)?m.addedRef:void 0)??m.entries.map(x=>x.ref).find(x=>!n.landed.some(H=>H.hostRef===x));if(f===void 0){if(d())return!1;l();break}let y=m.entries.find(x=>x.ref===f),{alias:g,protocol:T,...A}=c;if(p={ref:c.ref,hostRef:f,draft:{...A,...y?.alias===void 0?{}:{alias:y.alias},...y?.protocol===void 0?{}:{protocol:y.protocol},enabled:y?.enabled??!0}},n.landed.push(p),s=!0,d())return!1;continue}if(p.draft.value!==c.value){if(!(await r.replace(t,p.hostRef,c.value)).ok){if(d())return!1;l();break}if(p.draft={...p.draft,value:c.value},s=!0,d())return!1}if(p.draft.alias!==c.alias){let{alias:m,...u}=p.draft;if(!(await r.rename(t,p.hostRef,c.alias)).ok){if(d())return!1;l();break}if(p.draft={...u,...c.alias===void 0?{}:{alias:c.alias}},s=!0,d())return!1}}if(!a)for(let c of i){if(d())return!1;let p=n.landed.find(y=>y.ref===c.ref);if(p===void 0||p.draft.protocol===c.protocol)continue;if(!(await r.setProtocol(t,p.hostRef,c.protocol)).ok){if(d())return!1;l();break}let{protocol:u,...f}=p.draft;if(p.draft={...f,...c.protocol===void 0?{}:{protocol:c.protocol}},s=!0,d())return!1}if(!a)for(let c of[!0,!1]){for(let p of i){if(d())return!1;if(p.enabled!==c)continue;let m=n.landed.find(f=>f.ref===p.ref);if(m===void 0||m.draft.enabled===c)continue;if(!(await r.setEnabled(t,m.hostRef,c)).ok){if(d())return!1;l();break}if(m.draft={...m.draft,enabled:c},s=!0,d())return!1}if(a)break}return a?(s&&(n.attempts=0),n.attempts>=jy?(console.error("[bre] deferred api keys: the write was refused; giving up on the held key list:",t),!0):!1):(n.attempts=0,!d())}function pf(e){let t=0;for(let n of e.intents.values())n.releasedAt!==void 0&&(t+=1);return t}var Yy={openai:null,anthropic:null};function Jy(e){let t=new Set(e.map(n=>n.ref));for(let n=1;n<=999;n+=1){let r=`key-${n}`;if(!t.has(r))return r}return`key-${Date.now()}`}function vf(e,t){let n=()=>({ok:!0,route:"",entries:e.drafts.map(a=>({ref:a.ref,...a.alias===void 0?{}:{alias:a.alias},enabled:a.enabled,configured:!0,masked:$l(a.value),...a.protocol===void 0?{}:{protocol:a.protocol}})),endpoints:Yy}),r=a=>(t.onChange(e.drafts),{...n(),...a===void 0?{}:{addedRef:a}}),o=a=>e.drafts.find(s=>s.ref===a),i=(a,s)=>(e.drafts=e.drafts.map(d=>d.ref===a?s:d),r());return{list:async()=>n(),cached:()=>n(),add:async(a,s,d)=>{if(!Tt(s))return{ok:!1,error:t.t("keysAddIllegal")};let l=Jy(e.drafts);return e.drafts=[...e.drafts,{ref:l,value:s,enabled:!0,...d===void 0?{}:{alias:d}}],r(l)},rename:async(a,s,d)=>{let l=o(s);if(l===void 0)return{ok:!1};let{alias:c,...p}=l;return i(s,{...p,...d===void 0?{}:{alias:d}})},replace:async(a,s,d)=>{let l=o(s);return l===void 0||!Tt(d)?{ok:!1,error:t.t("keysAddIllegal")}:i(s,{...l,value:d})},remove:async(a,s)=>(e.drafts=e.drafts.filter(d=>d.ref!==s),r()),setScope:async()=>n(),setEnabled:async(a,s,d)=>{let l=o(s);return l===void 0?{ok:!1}:!d&&!e.drafts.some(c=>c.ref!==s&&c.enabled)?{ok:!1,error:t.t("keysLastEnabledOff")}:i(s,{...l,enabled:d})},setProtocol:async(a,s,d)=>{let l=o(s);if(l===void 0)return{ok:!1};let{protocol:c,...p}=l;return i(s,{...p,...d===void 0?{}:{protocol:d}})},setEndpoints:async()=>n(),probe:async()=>n(),reveal:async(a,s)=>o(s)?.value}}var xf=require("react/jsx-runtime");function wf({host:e,store:t,api:n,t:r,routeIdLabels:o,staged:i,onChange:a}){let[s,d]=(0,$e.useState)(()=>_r(e.current,o)),l=(0,$e.useRef)(s),c=(0,$e.useRef)(new Set),p=(0,$e.useRef)(!1),m=(0,$e.useMemo)(()=>vf(t,{t:r,onChange:u=>{a?.(u);let f=l.current;if(f.length===0){!p.current&&u.length>0&&(p.current=!0,console.info("[bre] deferred api keys: holding the list until the provider id is typed"));return}bs(i,f,u)}}),[a,i,t,r]);return(0,$e.useEffect)(()=>{let u=ai(e.current);if(u===null)return;let f=()=>{d(_r(e.current,o))};return u.addEventListener("input",f,!0),()=>{u.removeEventListener("input",f,!0)}},[e,o]),(0,$e.useEffect)(()=>{s.length>0&&Xy(n,i,s,c.current)},[n,i,s]),(0,$e.useEffect)(()=>{let u=l.current;u!==s&&(ys(i,u),l.current=s),t.drafts.length>0&&s.length>0&&bs(i,s,t.drafts)},[s,i,t]),(0,$e.useEffect)(()=>()=>{gf(i,l.current)},[i]),(0,xf.jsx)($o,{route:s,t:r,client:m,draft:!0})}function Xy(e,t,n,r){r.has(n)||!hf(t,n)||(r.add(n),(async()=>{try{let o=await le(e);vs(t,n,et(o.namespace,n))}catch(o){bf(t,n),console.warn("[bre] deferred api keys: could not read the settings document for this route:",o)}})())}var di="data-bre-create-keys",Qy="bre-keys-host",Zy="data-bre-key-input",si="data-bre-region",Qn=new WeakMap;function kf(e){let t=e.querySelector(`input[${Zy}]`);if(t instanceof HTMLInputElement)return t;let n=e.querySelector('input[type="password"]');return n instanceof HTMLInputElement?n:void 0}function Ef(e){let t=Qn.get(e)?.host;if(t!==void 0&&t.isConnected)return t;let n=e.nextElementSibling;return n instanceof HTMLDivElement&&n.hasAttribute(di)?n:void 0}function Tf(e,t){if(e.closest(`[${di}]`)!==null){Zn(e);return}let n=kf(e);if(n===void 0){Zn(e);return}if(e.parentElement===null)return;_e(e,nn,!0);let r=Qn.get(e),o=Ef(e);o===void 0&&(r!==void 0&&xs(e,r),o=e.ownerDocument.createElement("div"),o.className=Qy,e.after(o)),pe(o,di,"");let i=e.getAttribute(si);if(i===null?o.hasAttribute(si)&&o.removeAttribute(si):pe(o,si,i),r!==void 0&&r.host===o)return;r!==void 0&&xs(e,r);let a={drafts:Tt(n.value)?[{ref:"key-1",value:n.value,enabled:!0}]:[]},s=o,d=ut(o,t.refreshed(()=>(0,ws.createElement)(Ge,{fallbackText:t.t("keysPanelFailed")},(0,ws.createElement)(wf,{host:{current:s},store:a,api:t.api,t:t.t,routeIdLabels:t.routeIdLabels,staged:t.staged,onChange:l=>{let c=kf(e);if(c===void 0||c.disabled)return;let p=l.find(m=>m.enabled)?.value??"";c.value!==p&&Cr(c,p)}}))),{sync:!0});Qn.set(e,{host:o,mount:d})}function xs(e,t){Qn.delete(e),He(t.mount)}function Zn(e){_e(e,nn,!1);let t=Qn.get(e);t!==void 0&&xs(e,t),Ef(e)?.remove()}function Sf(){for(let e of Array.from(document.querySelectorAll(`[${di}]`))){let t=e.previousElementSibling;t instanceof HTMLElement&&Qn.has(t)?Zn(t):e.remove()}}var Es="bre-create-host",ks="bre-add-mode-picker",ev='[class*="addCard"]',tv='[class*="addPanel"]',nv='[class*="addModes"]',Mf="-custom-panel",rv="-custom";function Rf(){return{hosts:new Map}}function Ts(e,t,n){if(!e.isConnected)return;let r=new Set;for(let o of Array.from(e.querySelectorAll(ev)))if(o.isConnected)try{ov(o,t,n),r.add(o)}catch(i){li(o,n);for(let a of Ss(o))try{Zn(a)}catch{}Cf(o,!1),console.warn("[bre] add provider card: left the official form in place:",i)}for(let o of Array.from(n.hosts.keys()))(!r.has(o)||!o.isConnected)&&li(o,n)}function ov(e,t,n){let r=Lf(e,Mf);(r===void 0||r.hidden)&&(lv(e,()=>Qa(e)),r=Lf(e,Mf),r===void 0||r.hidden)||(e.getAttribute("data-bre-add-card")!=="1"&&e.setAttribute("data-bre-add-card","1"),uv(e,r,t,n),sv(e),dv(r,t),Cf(e,!0))}var iv=".field, label",av=".bre-keys-host, .bre-keys, .bre-create-host";function Ss(e){let t=[],n=e.querySelectorAll('input[type="password"], input[data-bre-key-input]');for(let r of Array.from(n)){if(r.closest(av)!==null)continue;let o=r.closest(iv)??r.parentElement;o!==null&&!t.includes(o)&&t.push(o)}return t}function sv(e){for(let t of Ss(e))try{Ru(t)}catch(n){console.warn("[bre] add provider card: could not mark a key field:",n)}}function dv(e,t){for(let n of Ss(e))try{Tf(n,{t:t.t,api:t.api,routeIdLabels:t.routeIdLabels,staged:t.stagedKeys,refreshed:t.refreshed})}catch(r){Zn(n),console.warn("[bre] add provider card: could not mount the key list:",r)}}function Cf(e,t){let n=Hf(e);n!==void 0&&_e(n,ks,t)}function Lf(e,t){for(let n of Array.from(e.querySelectorAll(tv)))if(n.id.endsWith(t))return n}function Hf(e){let t=e.querySelector(nv);if(t!==null){for(let n of Array.from(t.children))if(n instanceof HTMLElement&&n.getAttribute("role")==="tablist")return n}}function lv(e,t){let n=Hf(e);if(n!==void 0){for(let r of Array.from(n.querySelectorAll('[role="tab"]')))if(r.id.endsWith(rv)){if(r.disabled)return;r.getAttribute("aria-selected")!=="true"&&(t(),r.click());return}}}function cv(e){for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.classList.contains(Es))return t}function uv(e,t,n,r){let o=r.hosts.get(e),i=cv(t);if(i!==void 0&&o!==void 0&&o.host===i)return;li(e,r),i!==void 0&&i.remove();let a=e.ownerDocument.createElement("div");a.className=Es,t.insertBefore(a,t.firstChild),Qa(e);let s=ut(a,n.refreshed(()=>(0,Af.createElement)(ff,{host:{current:a},api:n.api,t:n.t,routeIdLabels:n.routeIdLabels,staged:n.staged})),{sync:!0});r.hosts.set(e,{host:a,mount:s})}function li(e,t){let n=t.hosts.get(e);n!==void 0&&(t.hosts.delete(e),He(n.mount))}function Nf(e){for(let t of Array.from(e.hosts.keys()))li(t,e);for(let t of Array.from(document.querySelectorAll(`.${Es}`)))t.remove();for(let t of Array.from(document.querySelectorAll(`.${ks}`)))_e(t,ks,!1);for(let t of Array.from(document.querySelectorAll(`.${on}`)))Wn(t);Sf()}var Fr="data-bre-row-provider",If="{provider}",fv=["rowCard","setupCard"];function Of(){return Eo()}function Ve(e){for(let t of fv)for(let n of Array.from(e.querySelectorAll(`[class*="${t}"]`))){let r=n.parentElement;if(!(r===null||r.tagName!=="UL")&&We(r).length!==0)return r}}function ln(e){return e.querySelector('[class*="rowHead"]')??void 0}function er(e){let t=e.querySelector('[class*="rowName"]')?.textContent?.trim();return t!==void 0&&t.length>0?t:void 0}function pv(e){let t=e.indexOf(If);if(!(t<0))return{prefix:e.slice(0,t),suffix:e.slice(t+If.length)}}function mv(e){let t=e.trim();if(t.length===0)return;let n=/^(.*) \(([^()]*)\)$/.exec(t);if(n!==null){let r=n[2];return r.length===0?void 0:r}return/\s/.test(t)?void 0:t}var gv='[class*="rowCard"], [class*="setupCard"], [class*="addCard"]';function hv(e){let t=e.closest(gv);for(let n=e;n!==null&&n!==t;n=n.parentElement)if(n.matches('[data-plugin], [class*="bre-"]'))return!0;return!1}function Ye(e,t){let n=e.querySelector("[data-bre-provider]")?.getAttribute("data-bre-provider");if(typeof n=="string"&&n.length>0)return n;for(let r of t.editProvider){let o=pv(r);if(o!==void 0)for(let i of Array.from(e.querySelectorAll("button[aria-label]"))){if(hv(i))continue;let a=i.getAttribute("aria-label")??"";if(a.length<=o.prefix.length+o.suffix.length||!a.startsWith(o.prefix)||!a.endsWith(o.suffix))continue;let s=mv(a.slice(o.prefix.length,a.length-o.suffix.length));if(s!==void 0)return s}}}function Ms(e){let t=e.getAttribute(Fr);return t===null||t.length===0?void 0:t}function bv(e){return wr(e,Ms)}function Pf(e,t,n,r=Ve(e)){if(!e.isConnected||r===void 0)return;let o=t.labels();for(let i of We(r)){let a=Ye(i,o);if(a===void 0){i.removeAttribute(Fr);continue}Ms(i)!==a&&i.setAttribute(Fr,a)}Lo(e,r,yv(t),n)}function yv(e){return{rowOf:t=>{let n=t.closest("li");return n instanceof HTMLElement?n:void 0},idOf:Ms,labelOf:er,order:t=>ud(t),commit:t=>{Zr(bv(t))},seatOf:ln,seatDrags:!0,gripLabel:(t,n)=>e.t("providerReorderAria",{provider:er(t)??n}),gripHint:()=>e.t("providerReorderHint")}}function _f(e){Ao(e);let t=Array.from(document.querySelectorAll(`[${Fr}]`));So(t);for(let n of t)n.removeAttribute(Fr)}var tr="data-bre-provider-switch",ci="bre-row-disabled";function Ff(){return{switches:new WeakSet}}function Kf(e,t,n,r=Ve(e)){if(!e.isConnected||r===void 0)return;let o=t.labels();for(let i of Array.from(r.children)){if(!(i instanceof HTMLElement))continue;let a=Ye(i,o);if(a===void 0)continue;let s=ln(i);s!==void 0&&(vv(i,s,a,t,n),i.classList.toggle(ci,!kn(a)))}}function Bf(){for(let e of Array.from(document.querySelectorAll(`[${tr}]`)))e.remove();for(let e of Array.from(document.querySelectorAll(`.${ci}`)))e.classList.remove(ci)}function vv(e,t,n,r,o){let i=t.querySelector(`[${tr}]`);if(i!==null){Df(i,e,n,r);return}let a=document.createElement("button");a.className="bre-provider-switch",a.setAttribute("type","button"),a.setAttribute("role","switch"),a.setAttribute(tr,n),Df(a,e,n,r),wv(a,e,o);let s=t.querySelector('[class*="rowActions"]');s===null?t.appendChild(a):s.insertBefore(a,s.firstChild)}function Df(e,t,n,r){let o=r.t("providerToggleAria",{provider:er(t)??n}),i=r.t("providerToggleHint"),a=kn(n)?"true":"false";e.getAttribute(tr)!==n&&e.setAttribute(tr,n),e.getAttribute("aria-checked")!==a&&e.setAttribute("aria-checked",a),e.getAttribute("aria-label")!==o&&e.setAttribute("aria-label",o),e.getAttribute("title")!==i&&e.setAttribute("title",i)}function wv(e,t,n){n.switches.has(e)||(n.switches.add(e),e.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation();let o=e.getAttribute(tr);if(o===null)return;let i=!kn(o);pd(o,i),e.setAttribute("aria-checked",i?"true":"false"),t.classList.toggle(ci,!i)}))}var xv=["balance","totalbalance","availablebalance","remainingbalance","creditbalance","balanceusd","totalavailable","available","remaining","credits","credit","amount","left","remain","remainingquota","quotaremaining","remainquota","availablequota","points"],kv=new Map(xv.map((e,t)=>[e,t])),w0=(kv.get("totalavailable")??0)+.5;var Ev=new Map([["USD","$"],["US$","$"],["$","$"],["CNY","\xA5"],["RMB","\xA5"],["\xA5","\xA5"],["EUR","\u20AC"],["\u20AC","\u20AC"],["GBP","\xA3"],["\xA3","\xA3"],["JPY","\xA5"],["KRW","\u20A9"],["HKD","HK$"],["TWD","NT$"]]);function Tv(e){let t=e<0?"-":"",n=Math.abs(e),r=Number.isInteger(n)?String(n):n.toFixed(2).replace(/0+$/,"").replace(/\.$/,""),[o="0",i]=r.split("."),a=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");return`${t}${a}${i===void 0?"":`.${i}`}`}function qf(e){let t=Tv(e.amount),n=e.currency?.trim()??"";if(n.length===0)return t;let r=Ev.get(n.toUpperCase());return r!==void 0?`${r}${t}`:`${t} ${n}`}async function Sv(e){try{let t=await fetch(`${Qs}?route=${encodeURIComponent(e)}`,{method:"GET",cache:"no-store",credentials:"same-origin"}),n;try{n=await t.json()}catch{n=void 0}if(!z(n))return{ok:!1};if(n.ok===!0){let i=n.configured!==!1,a=typeof n.amount=="number"&&Number.isFinite(n.amount)?n.amount:void 0,s=typeof n.currency=="string"&&n.currency.length>0?n.currency:void 0;return{ok:!0,configured:i,...a===void 0?{}:{amount:a},...s===void 0?{}:{currency:s}}}let r=typeof n.error=="string"&&n.error.length>0?n.error:void 0,o=typeof n.configured=="boolean"?n.configured:void 0;return{ok:!1,...o===void 0?{}:{configured:o},...r===void 0?{}:{error:r}}}catch{return{ok:!1}}}var Gf={read:Sv};var At="data-bre-provider-balance",Mv="data-bre-provider-switch",ui="data-bre-provider-balance-refresh",Lv=["M13.4 8a5.4 5.4 0 1 1-1.6-3.8","M13.8 2.2v3.5h-3.5"];function Uf(){return{readings:new Map,errors:new Map,requested:new Set,inflight:new Set,pending:new Set,queued:[],visible:!1}}var jf=3;function Ls(e,t,n,r=Ve(e)){if(r===void 0){n.visible=!1,n.queued.length=0;return}n.visible||(n.visible=!0,n.requested.clear());let o=t.labels();for(let i of Array.from(r.children)){if(!(i instanceof HTMLElement))continue;let a=Ye(i,o);if(a===void 0)continue;let s=ln(i);s!==void 0&&(Vf(s,a,t,n),ep(s,a,t,n))}}function zf(e,t){e.requested.delete(t),e.readings.delete(t),e.errors.delete(t),e.inflight.has(t)&&e.pending.add(t);for(let n=e.queued.length-1;n>=0;n-=1)e.queued[n]?.route===t&&e.queued.splice(n,1)}function $f(){for(let e of Array.from(document.querySelectorAll(`[${At}]`)))e.remove()}function Vf(e,t,n,r){let o=r.readings.get(t);if(o!==void 0){Yf(e,t,o,n,r);return}let i=r.errors.get(t);if(i!==void 0){Av(e,t,i,n,r);return}Zf(e)}function Yf(e,t,n,r,o){let i=Jf(e,t,r,o);Xf(i,`${r.t("providerBalanceLabel")} ${qf(n)}`,r.t("providerBalanceHint"),r),Qf(e,i)}function Av(e,t,n,r,o){let i=Jf(e,t,r,o),a=n.length>0?n:r.t("providerBalanceHint");Xf(i,r.t("providerBalanceUnavailable"),a,r),Qf(e,i)}function Jf(e,t,n,r){let o=e.querySelector(`[${At}]`);return o===null?(o=document.createElement("span"),o.className="bre-provider-balance",o.setAttribute(At,t)):o.getAttribute(At)!==t&&o.setAttribute(At,t),(o.querySelector(".bre-provider-balance-text")===null||o.querySelector(`[${ui}]`)===null)&&(o.replaceChildren(),Rv(o,e,n,r)),o}function Rv(e,t,n,r){let o=document.createElement("span");o.className="bre-provider-balance-text";let i=document.createElement("button");i.type="button",i.className="bre-provider-balance-refresh",i.setAttribute(ui,"1"),i.setAttribute("aria-label",n.t("providerBalanceRefresh")),i.title=n.t("providerBalanceRefresh"),i.append(Jo("balance-refresh",Lv)),i.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation();let s=e.getAttribute(At);if(!(s===null||s.length===0)){if(r.inflight.has(s)){r.pending.add(s);return}r.requested.delete(s),ep(t,s,n,r)}}),e.append(o,i)}function Xf(e,t,n,r){let o=e.querySelector(".bre-provider-balance-text");o!==null&&o.textContent!==t&&(o.textContent=t),e.getAttribute("title")!==n&&e.setAttribute("title",n);let i=e.querySelector(`[${ui}]`);if(i!==null){let a=r.t("providerBalanceRefresh");i.getAttribute("aria-label")!==a&&i.setAttribute("aria-label",a),i.getAttribute("title")!==a&&i.setAttribute("title",a)}}function Wf(e,t,n){let r=e.querySelector(`[${At}]`);if(r===null||r.getAttribute(At)!==t)return;let o=r.querySelector(`[${ui}]`);o!==null&&(o.classList.toggle("is-spinning",n),n?o.setAttribute("aria-busy","true"):o.removeAttribute("aria-busy"))}function Qf(e,t){let n=e.querySelector(`[${Mv}]`);if(n!==null){t.nextElementSibling!==n&&n.before(t);return}if(t.parentElement!==null)return;let r=e.querySelector('[class*="rowActions"]');r!==null?r.insertBefore(t,r.firstChild):e.appendChild(t)}function Zf(e){for(let t of Array.from(e.querySelectorAll(`[${At}]`)))t.remove()}function ep(e,t,n,r){r.requested.has(t)||r.inflight.has(t)||(r.requested.add(t),tp(e,t,n,r))}function tp(e,t,n,r){if(r.inflight.size>=jf){r.queued.some(o=>o.route===t)||r.queued.push({head:e,route:t});return}np(e,t,n,r)}function Cv(e,t){for(;t.inflight.size<jf&&t.queued.length>0;){let n=t.queued.shift();if(n===void 0)return;np(n.head,n.route,e,t)}}function np(e,t,n,r){r.inflight.add(t),Wf(e,t,!0),(n.client??Gf).read(t).then(i=>{if(i.ok&&i.configured!==!1&&typeof i.amount=="number"&&Number.isFinite(i.amount)){r.errors.delete(t);let a={amount:i.amount,...i.currency===void 0?{}:{currency:i.currency}};r.readings.set(t,a),e.isConnected&&Yf(e,t,a,n,r);return}if(i.ok&&i.configured===!1){r.readings.delete(t),r.errors.delete(t),e.isConnected&&Zf(e);return}i.configured===!0&&r.errors.set(t,i.error??""),e.isConnected&&Vf(e,t,n,r)}).catch(()=>{}).finally(()=>{r.inflight.delete(t),Wf(e,t,!1),e.isConnected||n.repaint?.(),r.pending.delete(t)&&(r.requested.delete(t),tp(e,t,n,r)),Cv(n,r)})}function rp(){return{requested:new Set,pending:[],running:new Set,visible:!1}}var Hv=2;function op(e){for(;e.visible&&e.running.size<Hv;){let t=e.pending.shift();if(t===void 0)return;e.running.add(t.route),Promise.resolve().then(()=>t.client.list(t.route,{preferCache:!0})).catch(()=>{}).finally(()=>{e.running.delete(t.route),op(e)})}}function As(e,t,n,r=Ve(e)){if(r===void 0){n.visible=!1,n.pending.length=0;return}n.visible||(n.visible=!0,n.requested.clear());let o=t.client;if(o===void 0)return;let i=t.labels();for(let a of Array.from(r.children)){if(!(a instanceof HTMLElement))continue;let s=Ye(a,i);s===void 0||n.requested.has(s)||(n.requested.add(s),n.running.has(s)||n.pending.push({route:s,client:o}))}op(n)}var fi="data-bre-provider-delete",ip='[class*="rowActions"]',ap='[class*="dangerButton"]',Nv="bre-provider-delete";function sp(e,t,n=Ve(e)){if(!e.isConnected||n===void 0)return;let r=t.labels(),o=Iv(n)??t.t("providerRemoveDisabled");for(let i of Array.from(n.children)){if(!(i instanceof HTMLElement))continue;let a=Ye(i,r);if(a===void 0)continue;let s=ln(i);if(s===void 0)continue;let d=s.querySelector(ip);if(d===null)continue;let l=d.querySelector(`[${fi}]`);if(d.querySelector(ap)!==null){l!==null&&l.remove();continue}let c=l??Ov();d.lastElementChild!==c&&d.appendChild(c),Pv(c,a,o,t.t("providerRemoveLocked",{provider:er(i)??a}))}}function dp(){for(let e of Array.from(document.querySelectorAll(`[${fi}]`)))e.remove()}function Iv(e){let n=e.querySelector(`${ip} ${ap}`)?.textContent?.trim()??"";return n.length>0?n:void 0}function Ov(){let e=document.createElement("button");return e.className=Nv,e.setAttribute("type","button"),e.setAttribute("disabled",""),e}function Pv(e,t,n,r){e.getAttribute(fi)!==t&&e.setAttribute(fi,t),e.textContent!==n&&(e.textContent=n),e.getAttribute("aria-label")!==r&&e.setAttribute("aria-label",r),e.getAttribute("title")!==r&&e.setAttribute("title",r)}var pi="data-bre-provider-disabled-group",_v="bre-provider-disabled-seat",lp="bre-provider-disabled-group",Rs="bre-row-folded",Cs="bre-row-hidden";function cp(){return{expanded:!1}}function up(e,t,n,r=Ve(e)){if(!e.isConnected||r===void 0)return;let o=pp(r,t.labels()),i=o.filter(l=>!l.enabled).length,a=mp(r);if(i===0){a!==void 0&&a.remove(),Hs(o,n);return}let s=a??Dv(r,t,n);(s.parentElement!==r||r.lastElementChild!==s)&&r.append(s),Hs(o,n);let d=gp(s);d!==void 0&&hp(d,i,t,n)}function fp(){for(let e of Array.from(document.querySelectorAll(`[${pi}]`)))e.remove();for(let e of Array.from(document.querySelectorAll(`.${Cs}, .${Rs}`)))e.classList.remove(Cs,Rs)}function pp(e,t){let n=[];for(let r of Array.from(e.children)){if(!(r instanceof HTMLElement)||r.getAttribute(pi)!==null)continue;let o=Ye(r,t);o!==void 0&&n.push({row:r,id:o,enabled:kn(o)})}return n}function Hs(e,t){for(let n of e){let r=!n.enabled;n.row.classList.toggle(Rs,r),n.row.classList.toggle(Cs,r&&!t.expanded)}}function mp(e){for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.getAttribute(pi)!==null)return t}function gp(e){return e.querySelector(`button.${lp}`)??void 0}function Dv(e,t,n){let r=document.createElement("li");r.className=_v,r.setAttribute(pi,"");let o=document.createElement("button");return o.className=lp,o.setAttribute("type","button"),o.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),n.expanded=!n.expanded,Fv(e,t,n)}),r.appendChild(o),e.append(r),r}function Fv(e,t,n){let r=pp(e,t.labels());Hs(r,n);let o=mp(e);if(o===void 0)return;let i=r.filter(s=>!s.enabled).length;if(i===0){o.remove();return}let a=gp(o);a!==void 0&&hp(a,i,t,n)}function hp(e,t,n,r){let o=n.t(r.expanded?"providerDisabledGroupHide":"providerDisabledGroupShow",{count:t}),i=n.t("providerDisabledGroupHint"),a=r.expanded?"true":"false";e.textContent!==o&&(e.textContent=o),e.getAttribute("aria-expanded")!==a&&e.setAttribute("aria-expanded",a),e.getAttribute("aria-label")!==o&&e.setAttribute("aria-label",o),e.getAttribute("title")!==i&&e.setAttribute("title",i)}var Kr="data-bre-row-model",Ns="bre-model-grid";function yp(){return Eo()}function Os(e){let t=[];for(let n of Array.from(e.querySelectorAll('[class*="modelList"]')))We(n).filter(o=>o.matches('[class*="modelEntry"]')).length!==0&&t.push(n);return t}function vp(e){for(let t of e){if(t.type!=="childList")continue;let n=t.target;if(n instanceof HTMLElement&&n.matches('[class*="modelList"]')&&We(n).some(r=>r.matches('[class*="modelEntry"]')))return!0;for(let r of[t.addedNodes,t.removedNodes])for(let o of Array.from(r))if(o instanceof HTMLElement&&o.matches('[class*="modelEntry"]'))return!0}return!1}function mi(e){let t=e.getAttribute(Kr);return t===null||t.length===0?void 0:t}function Is(e,t){let n=e.closest("li");if(n!==null)return Ye(n,t.labels())}function bp(e,t){let n=je(e,t.labels().modelName);return n.length>0?n:mi(e)}function Kv(e,t){return{rowOf:n=>{let r=n.closest('[class*="modelEntry"]');return r instanceof HTMLElement?r:void 0},idOf:mi,labelOf:n=>bp(n,t),order:n=>{let r=Is(e,t);return r===void 0?n:xd(r,n)},commit:n=>{let r=Is(n,t);r!==void 0&&yd(r,wr(n,mi))},seatOf:n=>n.querySelector('[class*="modelRow"]')??void 0,seatDrags:!1,gripLabel:(n,r)=>t.t("modelReorderAria",{model:bp(n,t)??r}),gripHint:()=>t.t("modelReorderHint"),decorate:(n,r)=>{r.classList.add(Ns)}}}function wp(e,t,n,r=Os(e)){if(!e.isConnected)return;let o=t.labels();for(let i of r)if(Is(i,t)!==void 0){for(let a of We(i)){let s=je(a,o.modelId);if(s.length===0){a.removeAttribute(Kr);continue}mi(a)!==s&&a.setAttribute(Kr,s)}Lo(e,i,Kv(i,t),n)}}function xp(e){Ao(e);for(let n of Array.from(document.querySelectorAll(`.${Ns}`)))n.classList.remove(Ns);let t=Array.from(document.querySelectorAll(`[${Kr}]`));So(t);for(let n of t)n.removeAttribute(Kr)}var kt=require("react");async function kp(e){try{let t=await e.json();if(typeof t.error=="string"&&t.error.length>0)return t.error}catch{}return`image request failed (${e.status})`}async function Bv(e,t){try{let n=await fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)}),r=await n.json().catch(()=>({}));return n.ok&&r.ok===!0?{ok:!0,data:r}:{ok:!1,error:typeof r.error=="string"?r.error:await kp(n)}}catch(n){return{ok:!1,error:n instanceof Error?n.message:String(n)}}}var nr,qv=0;var Ps=new Set;function Ep(e){return Ps.add(e),()=>{Ps.delete(e)}}function gi(){return nr}function Tp(){qt()}async function qt(){try{let e=await fetch(Hi,{method:"GET"}),t=await e.json();if(e.ok&&t.ok===!0&&typeof t.models<"u"){let n={...t,enabled:t.enabled!==!1};return nr=n,{ok:!0,data:n}}return{ok:!1,error:typeof t.error=="string"?t.error:await kp(e)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function cn(e){let t=await Bv(Hi,{op:"save",...e});if(!t.ok)return t;qv+=1,nr!==void 0&&(nr={...nr,...e,defaults:{...nr.defaults,...e.defaults}});for(let n of Ps)try{n()}catch{}return{ok:!0,data:void 0}}var Gv=["\u6A21\u578B","Models","models"],Mp='[class*="rowCard"], [class*="setupCard"], [class*="addCard"]',Wv='h1,h2,h3,h4,h5,h6,[role="heading"]',Uv=/title|heading/i,jv='nav, button, [role="menu"], [role="menuitem"], [class*="rowName"], [class*="rowCard"]',zv=4;function $v(e,t){let n="";for(let r of e.childNodes)if(r.nodeType===r.TEXT_NODE)n+=r.textContent??"";else if(r.nodeType===r.ELEMENT_NODE){if(r.classList?.contains(Br))continue;return!1}return n.replace(/\s+/g," ").trim()===t}function Vv(e,t){for(let n=e;n!==null;n=n.parentElement){if(n.matches(Wv)||Uv.test(String(n.className??"")))return n;if(n===t)break}return null}function Yv(e,t){for(let n of Gv)for(let r of e.querySelectorAll("*")){if(!$v(r,n)||r.closest(jv)!==null||(r.compareDocumentPosition(t)&zv)===0)continue;let o=Vv(r,e);if(o!==null)return o}return null}var _s;function Lp(e){let t=_s;if(t!==void 0&&t.root===e&&t.row.isConnected)return t.row;let n=e.querySelector(Mp);if(n===null)return null;let r=n.ownerDocument?.body??null;for(let o=n.parentElement;o!==null&&o!==r;o=o.parentElement){let i=Yv(o,n);if(i!==null){let a=Jv(i,o);return a!==null&&(_s={root:e,row:a}),a}}return null}function Jv(e,t){let n=e,r=n.parentElement;for(;r!==null&&r!==t;){let o=Array.from(r.childNodes).filter(a=>a.nodeType===a.TEXT_NODE).map(a=>a.textContent??"").join("").replace(/\s+/g," ").trim();if(Array.from(r.children).filter(a=>!a.classList?.contains(Br)).length>1||o.length>0)return r.querySelector(Mp)!==null?n:r;n=r,r=r.parentElement}return r===t?n:null}var Br="bre-config-host",Fs="bre-config-title-line",Ds={display:"flex",alignItems:"center"},hi=new WeakMap;function Sp(e){e.classList.add(Fs),hi.has(e)||hi.set(e,{display:e.style.display,alignItems:e.style.alignItems}),e.style.display=Ds.display,e.style.alignItems=Ds.alignItems}function Xv(e){return e.classList.contains(Fs)&&e.style.display===Ds.display}function Ap(e){e.classList.remove(Fs);let t=hi.get(e);hi.delete(e),e.style.display=t?.display??"",e.style.alignItems=t?.alignItems??""}function Rp(){return{mounts:new Map}}function Cp(e,t,n){let r=n.mounts.get(e),o=e.querySelector(`:scope > .${Br}`);if(o!==null&&r!==void 0&&r.wrapper===o){Xv(e)||Sp(e);return}Hp(e,n),o?.remove(),Sp(e);let i=e.ownerDocument.createElement("div");i.className=Br,e.appendChild(i);let a=ut(i,(0,kt.createElement)(Zv,{t:t.t,onOpen:t.onOpen}),{sync:!0});n.mounts.set(e,a)}function Hp(e,t){Ap(e);let n=t.mounts.get(e);n!==void 0&&(t.mounts.delete(e),He(n))}function Np(e){for(let t of Array.from(e.mounts.keys()))Hp(t,e);for(let t of Array.from(document.querySelectorAll(`.${Br}`))){let n=t.parentElement;n!==null&&Ap(n),t.remove()}_s=void 0}function Qv(){return(0,kt.createElement)("svg",{className:"bre-config-btn-icon",width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false"},(0,kt.createElement)("path",{d:"M4 6h8m4 0h4M4 12h2m4 0h10M4 18h10m4 0h2"}),(0,kt.createElement)("circle",{cx:14,cy:6,r:2}),(0,kt.createElement)("circle",{cx:8,cy:12,r:2}),(0,kt.createElement)("circle",{cx:16,cy:18,r:2}))}function Zv(e){return(0,kt.useEffect)(()=>{Tp()},[]),(0,kt.createElement)("button",{className:"bre-config-btn",type:"button",title:e.t("configButtonHint"),"aria-label":e.t("configButton"),onClick:()=>e.onOpen()},Qv())}var ew="settings.models",Je={capacity:["modelAdvanced","Model options","Capacities"],modelId:["modelId","Model ID"],modelName:["modelName","Display name"],routeId:["customRoute","Provider ID"],baseUrl:["baseUrl","Base URL"],apiProtocol:["customApi","API protocol"],apply:["apply","Apply"],cancel:["cancel","Cancel"],editProvider:["editProvider","Edit {provider}"],inputImage:["modelInputImage","Image"],contextWindow:["modelContextWindow","contextWindow","Context window","\u4E0A\u4E0B\u6587\u7A97\u53E3"],maxOutput:["modelMaxOutput","maxOutput","maxTokens","Max output","\u6700\u5927\u8F93\u51FA"],addModel:["addModel","Add model","\u6DFB\u52A0\u6A21\u578B"]};function Pp(e){let{ctx:t,api:n,t:r,onIdle:o,refreshed:i}=e,a=()=>{let $=t.locale.bind(ew),X=Z=>{let he=[];for(let xe of Z){let de=$(xe);de!==xe&&de.trim()!==""&&!he.includes(de)&&he.push(de)}return he.length===0?Z:[...he,...Z.filter(xe=>!he.includes(xe))]};return{capacity:X(Je.capacity),modelId:X(Je.modelId),modelName:X(Je.modelName),routeId:X(Je.routeId),baseUrl:X(Je.baseUrl),apiProtocol:X(Je.apiProtocol),apply:X(Je.apply),cancel:X(Je.cancel),editProvider:X(Je.editProvider),inputImage:X(Je.inputImage),contextWindow:X(Je.contextWindow),maxOutput:X(Je.maxOutput),addModel:X(Je.addModel)}},s=120,d=1e3,l=Ic(),c=Of(),p={t:r,labels:a},m=Ff(),u={t:r,labels:a},f=Uf(),y={t:r,labels:a,repaint:()=>te()},g=rp(),T={labels:a,client:De},A={t:r,labels:a},x=cp(),H={t:r,labels:a},O=yp(),J={t:r,labels:a},U=Du(),v={t:r},b=Rf(),N=Rp(),w=af(),E=mf(),I={t:r,api:n,routeIdLabels:()=>a().routeId,staged:w,stagedKeys:E,refreshed:i},F,G,W,h,L=$=>{for(let X of $)for(let Z of Array.from(X.addedNodes)){if(!(Z instanceof HTMLElement))continue;let he=Z.matches('[class*="modelAdvanced"]')?[Z]:Array.from(Z.querySelectorAll('[class*="modelAdvanced"]'));for(let xe of he)Ja(xe)}},P=!1,_={api:n,describeNamespace:$=>le(n,$),t:r,labels:a,onIdle:o,onBackoff:$=>{oe($)},onPendingChanged:()=>{te()},mount($,X){let Z=document.createElement("div");Z.className="bre-effort-slot",Z.dataset.plugin=Te,$.appendChild(Z);let he=(0,Op.createRoot)(Z),xe=de=>{he.render((0,Ks.createElement)(Ge,{fallbackText:r("renderFailed"),children:i(()=>(0,Ks.createElement)(vo,de))}))};return(0,Ip.flushSync)(()=>{xe(X)}),{unmount:()=>{try{he.unmount()}finally{Z.remove()}},render:xe}}},Y=0;function oe($){if(P)return;let X=Date.now()+$;G!==void 0&&X>=Y||(G!==void 0&&window.clearTimeout(G),Y=X,G=window.setTimeout(()=>{G=void 0,Y=0,te()},$))}let ee=()=>{let $=ct(),X=Ve($);if(X===void 0){Ls($,y,f,void 0),As($,T,g,void 0);return}if(Pf($,p,c,X),Kf($,u,m,X),Ls($,y,f,X),As($,T,g,X),sp($,A,X),up($,H,x,X),wp($,J,O,Os($)),e.configSeat!==void 0){let Z=Lp($);Z!==null&&Cp(Z,{t:e.configSeat.t,onOpen:e.configSeat.onOpen},N)}ps(),zu($)},se=($,X)=>{try{X()}catch(Z){console.error(`[bre] ${$} failed:`,Z)}};function te(){P||F!==void 0||(F=window.setTimeout(()=>{F=void 0,se("composer mutation",()=>{h?.()}),se("editor reconcile",()=>{Za(ct(),_,l)}),se("add-card reconcile",()=>{Ts(ct(),I,b)}),se("editor tabs reconcile",()=>{ls(ct(),v,U)}),se("dom decorations",()=>{ee()}),cf(w,n).then($=>{$>0&&oe(d)}),yf(E,n,De).then($=>{$>0&&oe(d)})},s))}let ge=$=>{let Z=$.detail?.route;typeof Z!="string"||Z.length===0||(zf(f,Z),te())},j=$=>{if(P||W!==void 0)return;h=$,se("models page startup",()=>{$(),ee()}),Zc();let X=(Z,he)=>{$(),he&&(se("editor reconcile",()=>{Za(ct(),_,l)}),Ts(ct(),I,b),ls(ct(),v,U),ee(),vp(Z)&&tu(ct()))};W=new MutationObserver(Z=>{let he=au(Z);se("models mutation",()=>{X(Z,he)}),he&&(se("early reasoning hide",()=>{L(Z)}),te())}),W.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden"]}),document.addEventListener(fr,ge),te()},ne=()=>{P=!0,F!==void 0&&(window.clearTimeout(F),F=void 0),G!==void 0&&(window.clearTimeout(G),G=void 0),document.removeEventListener(fr,ge),W?.disconnect(),W=void 0};return{state:l,labels:a,start:j,stopObserver:ne,teardown:()=>{if(!l.disposed){ne(),l.disposed=!0,zc(),Hc(l,_);for(let[$,X]of l.mounted)Tr($),X.editor.unmount();l.mounted.clear(),_f(c),Bf(),$f(),dp(),fp(),xl(),Np(N),$u(),tf(),xp(O),Nf(b),qu(),wc(),eu()}},flushOnUnload:()=>{Nc(l,_)},schedule:te}}var tw=1500,nw=2,rw=8,ow=6e4;function _p(e,t={}){let n=t.delayMs??tw,r=Math.max(1,t.concurrency??nw),o=Math.max(1,t.limit??rw),i=t.minAgeMs??ow,s=(t.now??Date.now)(),d=Ql().filter(u=>s-u.savedAt>=i).slice(0,o).map(u=>u.route),l=!1,c=0,p=()=>{for(;!l&&c<r;){let u=d.shift();if(u===void 0)return;c+=1,Promise.resolve().then(()=>e.list(u,{preferCache:!0})).catch(()=>{}).finally(()=>{c-=1,p()})}},m=setTimeout(()=>{l||p()},n);return()=>{l=!0,clearTimeout(m)}}var Fp=e=>`?route=${encodeURIComponent(e)}`;async function Kp(e){try{let t=await e.json();if(typeof t.error=="string"&&t.error.length>0)return t.error}catch{}return`fingerprint request failed (${e.status})`}async function Bs(e){try{let t=await fetch(`${Ri}${Fp(e)}`,{method:"GET"}),n=await t.json();if(t.ok&&n.ok===!0){let r=n.data;return{ok:!0,data:{bank:r?.bank??{},records:Array.isArray(r?.records)?r.records:[]}}}return{ok:!1,error:typeof n.error=="string"?n.error:await Kp(t)}}catch(t){return{ok:!1,error:t instanceof Error?t.message:String(t)}}}function Bp(e,t,n){let r=new AbortController,o=!1;return{done:(async()=>{let a;try{let s=await fetch(`${Ri}${Fp(e)}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({model:t}),signal:r.signal});if(!s.ok)return{ok:!1,error:await Kp(s)};let d=s.body?.getReader();if(d===void 0)return{ok:!1,error:"the fingerprint route sent no body"};let l=new TextDecoder,c="";for(;;){let{done:m,value:u}=await d.read();if(m)break;c+=l.decode(u,{stream:!0});let f=c.indexOf(`
|
|
4827
|
-
|
|
4828
|
-
`)}}let p=c.trim();if(p.length>0){let m=Dp(p);m!==void 0&&(n(m),m.type==="result"?a={ok:!0,record:m.record}:m.type==="error"&&(a={ok:!1,error:m.error}))}}catch(s){return o?{ok:!1,error:"cancelled"}:{ok:!1,error:s instanceof Error?s.message:String(s)}}return a!==void 0?a:o?{ok:!1,error:"cancelled"}:{ok:!1,error:"the fingerprint route ended without a verdict"}})(),abort:()=>{o=!0,r.abort()}}}function Dp(e){let t;try{t=JSON.parse(e)}catch{return}if(typeof t!="object"||t===null)return;let n=t,r=n.type;if(r==="progress")return{type:"progress",index:Number(n.index??0),ok:n.ok===!0,...typeof n.error=="string"?{error:n.error}:{}};if(r==="result"){let o=n.record;return typeof o!="object"||o===null?void 0:{type:"result",record:o}}if(r==="error")return{type:"error",error:typeof n.error=="string"?n.error:"fingerprint route failed"}}var iw=3,aw=2,sw=15e3,dw=/\b429\b|rate.?limit|too many requests/i,qs=new Map;function lw(e){return qs.get(e)??{run:(t,n,r)=>Bp(t,n,r)}}var Gs=class{constructor(t,n=aw,r=sw){Oe(this,"route",t);Oe(this,"concurrency",n);Oe(this,"backoffMs",r);Oe(this,"listeners",new Set);Oe(this,"recordListeners",new Set);Oe(this,"failureListeners",new Set);Oe(this,"state",{running:new Map,queued:[]});Oe(this,"handles",new Set);Oe(this,"draining",!1);Oe(this,"disposed",!1);Oe(this,"throttled",!1);Oe(this,"backoffUntil",0)}getState(){return this.state}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onRecord(t){return this.recordListeners.add(t),()=>{this.recordListeners.delete(t)}}onFailure(t){return this.failureListeners.add(t),()=>{this.failureListeners.delete(t)}}idle(){return this.state.running.size===0&&this.state.queued.length===0}check(t){this.checkAll([t])}checkAll(t){if(this.disposed)return;let n=[...this.state.queued];for(let r of t)n.includes(r)||this.state.running.has(r)||n.push(r);n.length!==this.state.queued.length&&(this.publish({...this.state,queued:n}),this.drain())}abort(){this.publish({running:new Map,queued:[]});for(let t of[...this.handles])t.abort();this.handles.clear(),this.throttled=!1,this.backoffUntil=0}dispose(){this.disposed||(this.disposed=!0,this.abort(),this.listeners.clear(),this.recordListeners.clear(),this.failureListeners.clear(),bi.delete(this.route),qs.delete(this.route))}setSender(t){qs.set(this.route,t)}publish(t){this.state=t;for(let n of[...this.listeners])n()}limit(){return this.throttled?1:Math.max(1,this.concurrency)}async drain(){if(this.draining||this.disposed)return;this.draining=!0;let t=new Set;try{for(;!this.disposed;){for(;!this.disposed&&t.size<this.limit()&&this.state.queued.length>0&&Date.now()>=this.backoffUntil;){let r=this.state.queued[0];if(r===void 0)break;this.publish({running:new Map(this.state.running).set(r,0),queued:this.state.queued.slice(1)});let o=this.runOne(r).finally(()=>{t.delete(o)});t.add(o)}if(this.disposed||t.size===0||(await Promise.race(t),this.disposed))break;let n=this.backoffUntil-Date.now();n>0&&await new Promise(r=>setTimeout(r,n))}}finally{t.clear(),this.throttled=!1,this.backoffUntil=0,this.draining=!1}}async runOne(t){let n=lw(this.route),r=0,o=n.run(this.route,t,i=>{i.type==="progress"&&(r+=1,this.publish({running:new Map(this.state.running).set(t,Math.min(r,iw)),queued:this.state.queued}))});this.handles.add(o);try{let i=await o.done;if(this.disposed)return;if(i.ok)for(let a of[...this.recordListeners])a(i.record);else{dw.test(i.error)&&(this.throttled=!0,this.backoffUntil=Date.now()+this.backoffMs);for(let a of[...this.failureListeners])a(t,i.error)}}finally{if(this.handles.delete(o),this.state.running.has(t)){let i=new Map(this.state.running);i.delete(t),this.publish({running:i,queued:this.state.queued})}}}},bi=new Map;function qp(e,t){let n=bi.get(e);return n===void 0&&(n=new Gs(e,t?.concurrency,t?.backoffMs),bi.set(e,n)),n}function Gp(){for(let e of[...bi.values()])e.dispose()}function yi(e,t){let n=e?.list?.getSnapshot(),r=n?.current;if(typeof r=="string"&&r.length>0)return r;let o=t?.adapter?.current?.getSnapshot?.()?.key;if(typeof o=="string"&&o.length>0)return o;for(let[i,a]of Object.entries(n?.byId??{}))if(!(a===void 0||(a.retainedBy?.mainView??0)<=0))return typeof a.id=="string"&&a.id.length>0?a.id:i}function Wp(e){let t,n=new Map,r=(a,s)=>{for(let[d,l]of n){if(d===s)continue;let c;try{c=a.directoryFor(l.sessionId)===d}catch{c=!1}c||(l.restore(),n.delete(d))}};return{ensure:()=>{let a=e.ctx,s=a.get?.("sessions"),d=a.get?.("uiSession"),l=a.get?.("modelDirectories"),c=yi(s,d);if(!(c===void 0||l===void 0))try{let p=l.directoryFor(c);return r(l,p),t!==void 0&&t.sessionId===c&&t.directory===p||(n.has(p)||n.set(p,{sessionId:c,restore:Ud(p,{configuredEffort:e.configuredEffort})}),t={sessionId:c,directory:p}),p}catch{t=void 0;return}},dispose:()=>{for(let[,a]of n)a.restore();n.clear()}}}var xi="dsh-model-think-level.auto-continue.enabled",ki="dsh-model-think-level.auto-continue.config";var Ws=Object.freeze({waitSeconds:2,maxRetries:5}),cw="dsh-model-think-level.auto-continue.claim.",uw=10*6e4;function jp(e){try{return window.localStorage.getItem(e)}catch{return null}}function Up(e,t,n,r){return typeof e!="number"||!Number.isFinite(e)?t:Math.min(r,Math.max(n,Math.trunc(e)))}function Us(e){let t=e!==null&&typeof e=="object"?e:{};return Object.freeze({waitSeconds:Up(t.waitSeconds,Ws.waitSeconds,1,3600),maxRetries:Up(t.maxRetries,Ws.maxRetries,1,100)})}function Ei(e){try{return Us(e===null?void 0:JSON.parse(e))}catch{return Ws}}var qr=jp(xi)==="true",Gt=Ei(jp(ki)),vi=new Set,wi=new Set;function Ti(e){for(let t of[...e])t()}function un(){return qr}function Rt(){return Gt}function zp(e){if(qr!==e){qr=e;try{window.localStorage.setItem(xi,String(e))}catch{}Ti(vi)}}function js(e){let t=Us({...Gt,...e});if(!(Gt.waitSeconds===t.waitSeconds&&Gt.maxRetries===t.maxRetries)){Gt=t;try{window.localStorage.setItem(ki,JSON.stringify(t))}catch{}Ti(wi)}}function zs(e){qr!==e&&(qr=e,Ti(vi))}function $s(e){let t=Us(e);Gt.waitSeconds===t.waitSeconds&&Gt.maxRetries===t.maxRetries||(Gt=t,Ti(wi))}function Si(e){return vi.add(e),()=>{vi.delete(e)}}function Mi(e){return wi.add(e),()=>{wi.delete(e)}}function $p(e,t){let n=`${cw}${e}.${t}`;try{let r=window.localStorage.getItem(n);if(r!==null){let o=JSON.parse(r);if(typeof o=="number"&&Number.isFinite(o)&&Date.now()-o<uw)return!1}return window.localStorage.setItem(n,JSON.stringify(Date.now())),!0}catch{return!0}}var fw=new Set(["EMPTY_RESPONSE","RATE_LIMIT","SERVER","TIMEOUT","TRANSPORT"]);function pw(e){return e===408||e===425||e===429||e>=500&&e<=599}var mw=new Set(["user/message","developer/message","system/message","request/header","request/context","step/start","assistant/message","assistant/attempt","tool/call","tool/result"]);function gw(e){let t=!1;for(let n of e.turnEvents)if(n.type!=="turn/end"){if(n.type==="turn/start"){t=!0;continue}if(mw.has(n.type))return!0}return t?!1:"unknown"}function hw(e){let t=e.data;if(typeof t!="object"||t===null)return;let n=t.reason;if(typeof n!="object"||n===null)return typeof n=="string"?n:void 0;let r=n.kind;return typeof r=="string"?r:void 0}function bw(e){let t=e.data;if(typeof t!="object"||t===null)return;let n=t.reason;if(typeof n!="object"||n===null)return;let r=n.error;if(!(typeof r!="object"||r===null))return r}function yw(e){let t=e?.providerRetryAfterMs;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:void 0}function Vp(e){let t=hw(e.turnEnd);if(gw(e)===!1)return{kind:"refuse",detail:`${t??"unreadable reason"}: empty turn`};switch(t){case"max-tokens":return{kind:"continue",reason:"max-tokens",detail:"max-tokens"};case"error":{let n=bw(e.turnEnd),r=typeof n?.code=="string"?n.code:void 0,o=typeof n?.status=="number"?n.status:void 0;if(r!==void 0&&fw.has(r)){let i=yw(n);return{kind:"continue",reason:"transient-error",detail:r,...i!==void 0?{waitMs:i}:{}}}return o!==void 0&&pw(o)?{kind:"continue",reason:"transient-error",detail:`status ${o}`}:{kind:"refuse",detail:r??(o!==void 0?`status ${o}`:"unknown error")}}case"completed":return{kind:"settled",detail:"completed"};case"aborted":return{kind:"settled",detail:"aborted"};case"blocked":return{kind:"settled",detail:"blocked"};case"forked":case"orphaned":return{kind:"refuse",detail:t};default:return{kind:"refuse",detail:t===void 0?"unreadable reason":`unknown reason ${t}`}}}var vw=1e3,ww=500,xw=600,Yp=6e3,kw=12e4,Ew=3e4;function Jp(e){let{ctx:t,t:n}=e,r,o=!1,i=new Set,a=(h,L)=>{let P=setTimeout(()=>{i.delete(P),h()},L);i.add(P)},s=h=>{let L=[];try{L=h.eventSource.getSnapshot().entries??[]}catch{return[]}let P=[];for(let _ of L)_.type!=="event"||_.event===void 0||P.push(_.event);return P},d=h=>{let L=s(h);for(let P=L.length-1;P>=0;P-=1){let _=L[P];if(_.type==="user/message"){if(_.seq<=h.lastUserSeq)break;if(l(h,_)){h.lastUserSeq=_.seq;continue}h.lastUserSeq=_.seq,h.consecutive=0,m(h)}}},l=(h,L)=>{if(h.lastAutoSentText===void 0)return!1;let P=L.data;if(typeof P!="object"||P===null)return!1;let _=P.content??P.message?.content;if(!Array.isArray(_)||_.map(ee=>typeof ee=="object"&&ee!==null&&ee.type==="text"?ee.text:void 0).filter(ee=>typeof ee=="string").join("")!==h.lastAutoSentText)return!1;let oe=typeof L.time=="number"?L.time:h.lastAutoSentAt;return Math.abs(oe-h.lastAutoSentAt)<=Ew},c=(h,L)=>{let P=-1;for(let _=L-1;_>=0;_-=1)if(h[_].type==="turn/end"){P=_;break}return h.slice(P+1,L+1)},p=h=>{let L=Rt().waitSeconds*1e3;return h===void 0?L:Math.max(L,Math.min(h,kw))},m=h=>{h.sendTimer!==void 0&&(clearTimeout(h.sendTimer),i.delete(h.sendTimer),h.sendTimer=void 0),h.pendingSendTurnEndSeq=void 0},u=h=>{h.sendTimer!==void 0&&(clearTimeout(h.sendTimer),i.delete(h.sendTimer));let L=Math.max(0,p(h.pendingRetryAfterMs)-(Date.now()-h.pendingSendScheduledAt)),P=setTimeout(()=>{i.delete(P),h.sendTimer=void 0,O(h,n("autoContinueMessage"))},L);h.sendTimer=P,i.add(P)},f=h=>{try{let L=h.getSnapshot();return{running:L.running===!0,open:L.openState===void 0||L.openState==="open",pending:L.pendingSubmissions?.length??0,subagent:L.subagent!=null}}catch{return}},y=h=>{let L=t.get?.("sessions"),P=t.get?.("uiSession");return yi(L,P)===h.sessionId},g=h=>{if(h.evalTimer!==void 0){h.evalDeadline=Date.now()+Yp;return}h.evalDeadline=Date.now()+Yp,T(h,ww)},T=(h,L)=>{o||r!==h||(h.evalTimer=setTimeout(()=>{h.evalTimer=void 0,H(h)},L),i.add(h.evalTimer))},A=h=>{if(h.historyReady)return;let L=f(h.session);L===void 0||!L.open||(h.historyReady=!0,h.lastHandledTurnEndSeq=Math.max(h.lastHandledTurnEndSeq,w(h.eventSource,"turn/end")))},x=h=>{if(!h.historyReady)return;let L=f(h.session);if(L===void 0||L.running)return;let P=s(h);for(let _=P.length-1;_>=0;_-=1){let Y=P[_];if(Y.type==="turn/end"){Y.seq>h.lastHandledTurnEndSeq&&g(h);return}}},H=h=>{if(o||r!==h||!un())return;let L=f(h.session);if(!h.historyReady||L===void 0||L.running||L.pending>0)return;let P=s(h),_=-1;for(let se=P.length-1;se>=0;se-=1){let te=P[se];if(te.type==="turn/end"&&te.seq>h.lastHandledTurnEndSeq){_=se;break}}if(_<0){Date.now()<h.evalDeadline&&T(h,xw);return}let Y=P[_];h.lastHandledTurnEndSeq=Y.seq,d(h);let oe=Vp({turnEnd:Y,turnEvents:c(P,_)});if(oe.kind==="settled"){h.consecutive=0;return}if(oe.kind==="refuse")return;let ee=Rt().maxRetries;if(h.consecutive>=ee){console.info(`[dsh-model-think-level] auto-continue: streak cap (${ee}) reached, standing down (${oe.detail})`);return}$p(h.sessionId,Y.seq)&&(h.pendingSendTurnEndSeq=Y.seq,h.pendingSendScheduledAt=Date.now(),h.pendingRetryAfterMs=oe.waitMs,u(h))},O=async(h,L)=>{if(o||r!==h)return;let P=h.pendingSendTurnEndSeq;if(h.pendingSendTurnEndSeq=void 0,P===void 0||P!==h.lastHandledTurnEndSeq||!un()||h.consecutive>=Rt().maxRetries)return;let _=f(h.session);if(!(_===void 0||_.running||_.pending>0)&&y(h))try{let Y=await h.session.prompt([{type:"text",text:L}],"queue");if(Y?.ok!==!0){h.consecutive+=1,console.warn(`[dsh-model-think-level] auto-continue: prompt refused ${J(Y)}`);return}h.consecutive+=1,h.lastAutoSentAt=Date.now(),h.lastAutoSentText=L}catch(Y){h.consecutive+=1,console.warn("[dsh-model-think-level] auto-continue: prompt failed:",Y)}},J=h=>{let L=h?.error;if(L===void 0)return"without an error";let P=typeof L.code=="string"?L.code:"unknown",_=typeof L.message=="string"?L.message:"";return _.length>0?`${P}: ${_}`:P},U=h=>{let L=f(h.session);L!==void 0&&(A(h),h.wasRunning&&!L.running&&g(h),h.wasRunning=L.running)},v=()=>{let h=r;if(h!==void 0){r=void 0;for(let L of h.unsubs)try{L()}catch{}h.evalTimer!==void 0&&(clearTimeout(h.evalTimer),i.delete(h.evalTimer),h.evalTimer=void 0),h.sendTimer!==void 0&&(clearTimeout(h.sendTimer),i.delete(h.sendTimer),h.sendTimer=void 0)}},b=h=>{let L=f(h.session);if(L===void 0||L.subagent)return;let P={sessionId:h.sessionId,session:h.session,eventSource:h.eventSource,wasRunning:N(h.session),lastUserSeq:w(h.eventSource,"user/message"),historyReady:L.open,lastHandledTurnEndSeq:L.open?w(h.eventSource,"turn/end"):0,consecutive:0,pendingSendTurnEndSeq:void 0,pendingSendScheduledAt:0,pendingRetryAfterMs:void 0,lastAutoSentAt:0,lastAutoSentText:void 0,unsubs:[],evalDeadline:0,evalTimer:void 0,sendTimer:void 0};r=P;try{P.unsubs.push(h.session.subscribe(()=>U(P)))}catch{v();return}try{P.unsubs.push(h.eventSource.subscribe(()=>{d(P),A(P),x(P)}))}catch(_){v(),console.warn("[dsh-model-think-level] auto-continue: event source unusable:",_);return}},N=h=>{try{return h.getSnapshot().running===!0}catch{return!1}},w=(h,L)=>{let P=0,_=[];try{_=h.getSnapshot().entries??[]}catch{return 0}for(let Y of _)Y.type!=="event"||Y.event===void 0||Y.event.type===L&&Y.event.seq>P&&(P=Y.event.seq);return P},E=()=>{if(o)return;let h=t.get?.("sessions"),L=t.get?.("uiSession"),P=yi(h,L);if(P===void 0||h===void 0||typeof h.binding!="function"){v();return}let _;try{_=h.binding(P)}catch{_=void 0}if(_===void 0||_.session===void 0){v();return}r!==void 0&&r.session===_.session||(v(),b(_))},I=setInterval(E,vw);E();let F;try{F=t.on?.("connection/reset",()=>{v()})}catch{}let G=Si(()=>{let h=r;un()||h===void 0||(m(h),h.evalTimer!==void 0&&(clearTimeout(h.evalTimer),i.delete(h.evalTimer),h.evalTimer=void 0))}),W=Mi(()=>{let h=r;h?.pendingSendTurnEndSeq!==void 0&&(!un()||h.consecutive>=Rt().maxRetries?m(h):u(h))});return{dispose:()=>{o=!0,G(),W(),F?.(),clearInterval(I),v();for(let h of i)clearTimeout(h);i.clear()}}}var pt=require("react");var q=require("react");function Xp(e){let t=[];for(let i of e){let a=i.timing?.durationMs;typeof a=="number"&&Number.isFinite(a)&&a>0&&t.push(a)}if(t.length===0)return;t.sort((i,a)=>i-a);let n=t.length>>1,o=(t.length%2===1?t[n]:(t[n-1]+t[n])/2)/1e3;return o>=75?{unit:"minutes",value:Math.max(1,Math.round(o/60))}:{unit:"seconds",value:Math.max(5,Math.round(o/5)*5)}}var Tw=/^(gpt-|chatgpt-|o[134](-|$)|claude-)/;function Sw(e){let t=String(e??"").trim(),n=t.lastIndexOf("/");return n===-1?t:t.slice(n+1)}function Qp(e){let t=Sw(e).toLowerCase();return t.length>0&&Tw.test(t)}var Zp={running:new Map,queued:[]};function Wr(e){return typeof e!="number"||!Number.isFinite(e)?"\u2014":`${Math.round(e*100)}%`}function Mw(e){return!Number.isFinite(e)||e<=0?"\u2014":new Date(e).toLocaleString()}function em(e){return typeof e!="number"||!Number.isFinite(e)||e<0?"\u2014":(Math.round(e/100)/10).toFixed(1)}function Lw(e,t){return t===void 0?e("fpCostUnknown",{count:3}):t.unit==="minutes"?e("fpCostMinutes",{count:3,minutes:t.value}):e("fpCost",{count:3,seconds:t.value})}function tm({route:e,api:t,t:n,ctx:r,host:o}){let[i]=(0,q.useState)(()=>Fu(o.current)),[a,s]=(0,q.useState)([]),[d,l]=(0,q.useState)(new Map),[c,p]=(0,q.useState)(void 0),[m,u]=(0,q.useState)(void 0),[f,y]=(0,q.useState)(new Set),g=(0,q.useCallback)(E=>{y(I=>{let F=new Set(I);return F.has(E)?F.delete(E):F.add(E),F})},[]),T=(0,q.useMemo)(()=>i?void 0:qp(e),[i,e]),A=(0,q.useSyncExternalStore)((0,q.useCallback)(E=>T?.subscribe(E)??(()=>{}),[T]),(0,q.useCallback)(()=>T?.getState()??Zp,[T]),(0,q.useCallback)(()=>Zp,[]));(0,q.useEffect)(()=>{if(T!==void 0)return T.onRecord(E=>{u(void 0),l(I=>{let F=new Map(I);return F.set(E.model,E),F})})},[T]),(0,q.useEffect)(()=>{if(T!==void 0)return T.onFailure((E,I)=>{u({model:E,error:I})})},[T]);let x=(0,q.useCallback)(async()=>{if(i)return;let I=(await le(t)).namespace?.value?.providers,F=Mn(I,e).map(W=>W.id).filter(W=>typeof W=="string"&&W.length>0).filter(Qp);s(F.map(W=>({model:W})));let G=await Bs(e);G.ok?(p(void 0),l(new Map(G.data.records.map(W=>[W.model,W])))):p(G.error)},[t,i,e]);if((0,q.useEffect)(()=>{i||x()},[i,x]),(0,q.useEffect)(()=>{if(!(i||r===void 0))return r.remote.$on("settings/document-updated",()=>{x()})},[i,r,x]),i)return null;let H=a.length,O=a.filter(E=>d.has(E.model)).length,J=a.filter(E=>d.get(E.model)?.status==="identified").length,U=a.filter(E=>d.get(E.model)?.status==="doubtful").length,v=a.filter(E=>d.get(E.model)?.status==="failed").length,b=A.running.size>0,N=A.running.size+A.queued.length,w=(0,q.useMemo)(()=>Xp([...d.values()]),[d]);return(0,q.createElement)("div",{className:"bre-fingerprint","data-bre-fingerprint":H>0?"ready":"none"},(0,q.createElement)("div",{className:"bre-fp-head"},(0,q.createElement)("span",{className:"bre-fp-title"},n("fpTitle")),(0,q.createElement)("span",{className:"bre-fp-count"},n("fpCount",{count:H})),(0,q.createElement)("span",{className:"bre-fp-summary",role:"status","aria-live":"polite"},b?n("fpRunning",{done:A.running.size,total:N}):O===0?n("fpSummaryNone"):n("fpSummary",{identified:J,doubtful:U,failed:v})),(0,q.createElement)("span",{className:"grow"}),(0,q.createElement)("button",{type:"button",className:"bre-fp-all",disabled:b||H===0,onClick:()=>{T?.checkAll(a.map(E=>E.model))}},n("fpDetectAll"))),(0,q.createElement)("p",{className:"bre-fp-intro"},n("fpIntro")),c!==void 0?(0,q.createElement)("p",{className:"bre-fp-error"},n("fpLoadFailed",{error:c})):null,m!==void 0?(0,q.createElement)("p",{className:"bre-fp-error",role:"alert"},n("fpRunFailed",{error:`${m.model}: ${m.error}`})):null,(0,q.createElement)("div",{className:"bre-fp-rows"},...a.map(E=>Rw(E,{t:n,runner:T,runnerState:A,records:d,route:e,expanded:f,estimate:w,onToggle:g}))))}function Aw(e){return(0,q.createElement)("svg",{className:"bre-fp-chev"+(e?" is-open":""),viewBox:"0 0 16 16",width:12,height:12,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,focusable:!1},(0,q.createElement)("path",{d:e?"M4.5 6.5 8 10 11.5 6.5":"M6.5 4.5 10 8 6.5 11.5"}))}function Rw(e,t){let{t:n,runner:r,runnerState:o,records:i,expanded:a,estimate:s,onToggle:d}=t,l=i.get(e.model),c=o.running.get(e.model),p=o.queued.indexOf(e.model),m=c!==void 0,u=p>=0,f=a.has(e.model),y=m?{className:"is-running",text:n("fpStateRunning",{done:c,total:3})}:u?{className:"is-queued",text:n("fpQueued",{position:p+1})}:l===void 0?{className:"is-idle",text:n("fpStateUnchecked")}:l.status==="failed"?{className:"is-failed",text:n("fpStateFailed")}:l.status==="doubtful"?{className:"is-doubtful",text:n("fpStateDoubtful",{probability:Wr(l.probability)})}:{className:"is-identified",text:n("fpStateIdentified",{model:l.predictionName??l.prediction??e.model,probability:Wr(l.probability)})},g=l===void 0?"fpDetect":l.status==="failed"?"fpRetry":"fpRetest";return(0,q.createElement)("div",{className:"bre-fp-row",key:e.model,"data-bre-fp-open":f?"1":void 0},(0,q.createElement)("div",{className:"bre-fp-row-head"},(0,q.createElement)("button",{type:"button",className:"bre-fp-fold","aria-expanded":f,"aria-label":n(f?"fpDetailHide":"fpDetailShow")+" "+e.model,title:n(f?"fpDetailHide":"fpDetailShow"),onClick:()=>{d(e.model)}},Aw(f),(0,q.createElement)("span",{className:"bre-fp-model"},e.model)),(0,q.createElement)("span",{className:`bre-fp-badge ${y.className}`},y.text),(0,q.createElement)("span",{className:"grow"}),(0,q.createElement)("span",{className:"bre-fp-evidence"},l===void 0?Lw(n,s):n("fpEvidence",{used:l.usedOutputs,total:3})),(0,q.createElement)("button",{type:"button",className:"bre-fp-action",disabled:m||u,onClick:()=>{r?.check(e.model)}},n(g))),!f||l===void 0?null:l.status!=="failed"?Hw(l,n):Cw(l,n))}function nm(e,t){return e===void 0||e.length===0?null:(0,q.createElement)("div",{className:"bre-fp-chals",title:t("fpChallengeTitle")},...e.map(n=>{let r=n.skipped===!0?" is-skipped":n.accepted?" is-counted":" is-rejected",o=n.skipped===!0?t("fpChallengeSkipped",{index:n.index,numbers:n.expected}):n.accepted?t("fpChallengeCounted",{index:n.index,numbers:n.expected}):t("fpChallengeRejected",{index:n.index,parsed:n.parsed,numbers:n.expected});return(0,q.createElement)("span",{className:`bre-fp-chal${r}`,key:n.index},o)}))}function Cw(e,t){let n=e.challenges,r=n!==void 0&&n.length>0;return e.error===void 0&&!r?null:(0,q.createElement)("div",{className:"bre-fp-body"},e.error===void 0?null:(0,q.createElement)("p",{className:"bre-fp-error"},e.error),nm(n,t))}function Hw(e,t){let n=e.top??[],r=e.timing;return(0,q.createElement)("div",{className:"bre-fp-body"},(0,q.createElement)("div",{className:"bre-fp-family"},(0,q.createElement)("span",{className:"bre-fp-k"},t("fpFamily")),(0,q.createElement)("span",{className:"bre-fp-v"},`${e.familyPrediction??"\u2014"} \xB7 ${Wr(e.familyProbability)}`),(0,q.createElement)("span",{className:"bre-fp-k"},t("fpSimilarity")),(0,q.createElement)("span",{className:"bre-fp-v"},Wr(e.top?.[0]?.similarity)),(0,q.createElement)("span",{className:"grow"}),(0,q.createElement)("span",{className:"bre-fp-k"},t("fpCheckedAt",{time:Mw(e.checkedAt)}))),nm(e.challenges,t),r!==void 0?(0,q.createElement)("p",{className:"bre-fp-timing"},t("fpTiming",{first:em(r.firstTokenMs),total:em(r.durationMs),rate:r.charsPerSecond===void 0?"\u2014":String(Math.round(r.charsPerSecond))})):null,(0,q.createElement)("div",{className:"bre-fp-k",style:{marginTop:"8px"}},t("fpCandidates")),(0,q.createElement)("div",{className:"bre-fp-bars"},...n.map((o,i)=>(0,q.createElement)("div",{className:"bre-fp-bar",key:o.model},(0,q.createElement)("span",{className:"bre-fp-bar-name"},o.model),(0,q.createElement)("span",{className:`bre-fp-bar-fill${i===0?" is-top":""}`,style:{width:`${Math.max(2,Math.round(o.probability*100))}%`}}),(0,q.createElement)("span",{className:"bre-fp-bar-value"},Wr(o.probability))))),(0,q.createElement)("p",{className:"bre-fp-note"},t("fpClosedSet")))}var rm="settings.models.provider-card";function Nw(e){if(e===null)return;let t=e.querySelector('[class*="editorActions"]');if(t===null)return;let n=Array.from(t.querySelectorAll("button")),r=t.querySelector('button[class*="secondaryButton"]')??n.at(-2)??null;r!==null&&(r instanceof HTMLButtonElement&&r.disabled||r.click())}function Iw({provider:e,api:t,t:n,ctx:r}){let o=(0,pt.useRef)(null),i=e?.provider,a=(0,pt.useCallback)(()=>{Nw(Vn(o.current))},[]);return(0,pt.useLayoutEffect)(()=>{let s=o.current,d=Vn(s);if(s===null||d===null)return;let l=d,c=()=>d.querySelector('[class*="_editor"]')!==null,p=()=>{let u=c()?"1":"0";s.dataset.edit!==u&&(s.dataset.edit=u)};p();let m=new MutationObserver(p);return m.observe(l,{childList:!0,subtree:!0}),()=>{m.disconnect()}},[i]),typeof i!="string"||i.length===0?null:(0,pt.createElement)("div",{ref:o,className:"bre-headers-host","data-bre-provider":i},(0,pt.createElement)(ii,{host:o,t:n}),(0,pt.createElement)(oi,{route:i,api:t,t:n,onDismiss:a}),(0,pt.createElement)(tm,{route:i,api:t,t:n,ctx:r,host:o}))}function om(e,t,n){let r=e,o=r.slots?.inject(rm,()=>{r.slots?.register({name:rm,key:Re,inject:()=>({api:t,t:n,ctx:e})},Iw)});return typeof o=="function"?o:()=>{}}var ot=require("react");function im(e){let{t}=e,n=(0,ot.useSyncExternalStore)(Xr,st),r=()=>{id(!n)};return(0,ot.createElement)("div",{className:"bre-slider-setting"},(0,ot.createElement)("div",{className:"bre-slider-setting-row"},(0,ot.createElement)("div",{className:"bre-slider-setting-copy"},(0,ot.createElement)("div",{className:"bre-slider-setting-title"},t("sliderToggleTitle")),(0,ot.createElement)("div",{className:"bre-slider-setting-description"},t("sliderToggleDescription"))),(0,ot.createElement)("div",{className:"bre-slider-setting-control"},(0,ot.createElement)("span",{className:"bre-slider-setting-state"},t(n?"settingOn":"settingOff")),(0,ot.createElement)("button",{type:"button",role:"switch","aria-label":t("sliderToggleAria"),"aria-checked":n,className:"bre-slider-setting-switch"+(n?" is-on":""),onClick:r},(0,ot.createElement)("span",{className:"bre-slider-setting-switch-knob","aria-hidden":!0})))))}function am(e,t){let n=e,r=n.slots?.inject("settings.models.footer",()=>{n.slots?.register({name:"settings.models.footer",id:Te+"-slider-toggle",order:15,inject:()=>({t})},im)});return typeof r=="function"?r:()=>{}}var R=require("react"),fm=require("react-dom/client");var Li=[{label:"1K",value:"1024x1024",edge:1024},{label:"2K",value:"2048x2048",edge:2048},{label:"4K",value:"4096x4096",edge:4096}];function Ow(e){let t=/^(\d{2,5})x(\d{2,5})$/.exec(e.trim());if(t!==null)return Math.max(Number(t[1]),Number(t[2]))}function Pw(e){let t=Ow(e),n=Li[0];if(t===void 0)return n;let r=Number.POSITIVE_INFINITY;for(let o of Li){let i=Math.abs(o.edge-t);i<r&&(n=o,r=i)}return n}function sm(e){return Pw(e).value}var _w=[5,10,15,30,60];function Dw(e){let t=_w.map(n=>n*6e4);return t.includes(e)?t:[e,...t]}function Fw(e){let{api:t,t:n}=e,[r,o]=(0,R.useState)(()=>gi()),[i,a]=(0,R.useState)(void 0),[s,d]=(0,R.useState)(void 0),[l,c]=(0,R.useState)(void 0),[p,m]=(0,R.useState)(!1);(0,R.useEffect)(()=>{let b=!0;return qt().then(N=>{b&&(N.ok?o(N.data):a(N.error))}),()=>{b=!1}},[]);let[u,f]=(0,R.useState)({});(0,R.useEffect)(()=>{let b=!0;return le(t).then(N=>{let w={};for(let[E,I]of Object.entries(Pe(N.namespace))){let F=typeof I.displayName=="string"?I.displayName.trim():"";F.length>0&&(w[E]=F)}b&&f(w)}).catch(()=>{}),()=>{b=!1}},[t]);let y=(0,R.useCallback)(()=>{qt().then(b=>{b.ok&&o(b.data)})},[]),g=(0,R.useCallback)(b=>{b.length!==0&&(d("default"),cn({defaultModel:b}).then(N=>{d(void 0),N.ok?(c(void 0),y()):c(N.error)}))},[y]),T=(0,R.useCallback)(b=>{d("enabled"),cn({enabled:b}).then(N=>{d(void 0),N.ok?(c(void 0),y()):c(N.error)})},[y]),A=(0,R.useCallback)(b=>{if(r===void 0)return;let N=Number(b);!Number.isFinite(N)||N<6e4||N>36e5||N!==r.defaults.timeoutMs&&cn({defaults:{timeoutMs:N}}).then(w=>{w.ok?(c(void 0),y()):c(w.error)})},[r,y]);if(r===void 0)return(0,R.createElement)("div",{className:"bre-config-loading","aria-busy":!0},(0,R.createElement)("div",{className:"bre-config-loading-text"},i===void 0?n("imagegenLoading"):`${n("imagegenLoadFailed")}: ${i}`),(0,R.createElement)("div",{className:"bre-config-skeleton"},...[0,1,2].map(b=>(0,R.createElement)("div",{key:b,className:"bre-config-skeleton-row"}))));let x=r.models,H=x.length===0,O="bre-config-imagegen-body",J=r.enabled?r.tool.error:void 0,U=new Map;for(let b of x)U.set(b.label,(U.get(b.label)??0)+1);let v=b=>{if((U.get(b.label)??0)<2)return b.label;let N=u[b.route]??b.providerLabel??b.route;return`${b.label} \xB7 ${N}`};return(0,R.createElement)("div",{className:"bre-config-card"},(0,R.createElement)("div",{className:"bre-config-card-head"},(0,R.createElement)("button",{type:"button",className:"bre-config-expand","aria-expanded":p,"aria-controls":O,title:n(p?"imagegenCollapse":"imagegenExpand"),onClick:()=>m(b=>!b)},(0,R.createElement)("span",{className:"bre-config-card-title"},n("imagegenSectionTitle")),(0,R.createElement)("span",{className:"bre-config-card-hint"},r.enabled?n("imagegenEnabledHint"):n("imagegenDisabledHint"))),(0,R.createElement)("span",{className:"bre-config-card-state"},r.enabled?n("cardStateOn"):n("cardStateOff")),(0,R.createElement)("label",{className:"bre-config-switch",title:n("imagegenEnable")},(0,R.createElement)("input",{type:"checkbox",className:"bre-config-switch-input",role:"switch","aria-label":n("imagegenEnable"),checked:r.enabled,disabled:s==="enabled",onChange:b=>T(b.target.checked)}),(0,R.createElement)("span",{className:"bre-config-switch-track","aria-hidden":!0})),(0,R.createElement)("span",{className:"bre-config-chevron","aria-hidden":!0,"data-open":String(p),onClick:()=>m(b=>!b)},"\u203A")),l!==void 0&&(0,R.createElement)("div",{className:"bre-config-notice"},l),p&&(0,R.createElement)("div",{className:"bre-config-card-body",id:O},J!==void 0&&(0,R.createElement)("div",{className:"bre-config-notice bre-config-notice-warn"},(0,R.createElement)("div",null,n("imagegenToolMissing")),(0,R.createElement)("div",{className:"bre-config-notice-why"},n("imagegenToolMissingWhy",{reason:J}))),(0,R.createElement)("div",{className:"bre-config-defaults"},(0,R.createElement)("label",null,n("imagegenDefaultsLabel")),(0,R.createElement)("select",{className:"bre-config-select",value:sm(r.defaults.size),"aria-label":n("imagegenSizeLabel"),onChange:b=>{cn({defaults:{size:b.target.value}}).then(y)}},Li.map(b=>(0,R.createElement)("option",{key:b.label,value:b.value},b.label))),(0,R.createElement)("select",{className:"bre-config-select",value:r.defaults.quality,"aria-label":n("imagegenQualityLabel"),onChange:b=>{cn({defaults:{quality:b.target.value}}).then(y)}},["low","medium","high","auto"].map(b=>(0,R.createElement)("option",{key:b,value:b},b))),(0,R.createElement)("select",{className:"bre-config-select",value:String(r.defaults.n),"aria-label":n("imagegenCountLabel"),onChange:b=>{cn({defaults:{n:Number(b.target.value)}}).then(y)}},[1,2,3,4].map(b=>(0,R.createElement)("option",{key:b,value:String(b)},`n=${b}`))),(0,R.createElement)("label",{className:"bre-config-timeout",title:n("imagegenTimeoutHint")},(0,R.createElement)("span",{className:"bre-config-timeout-label"},n("imagegenTimeoutLabel")),(0,R.createElement)("select",{className:"bre-config-select",value:String(r.defaults.timeoutMs),"aria-label":n("imagegenTimeoutLabel"),onChange:b=>{A(b.target.value)}},Dw(r.defaults.timeoutMs).map(b=>(0,R.createElement)("option",{key:b,value:String(b)},n("imagegenTimeoutMinutes",{minutes:Math.round(b/6e4)})))))),!H&&(0,R.createElement)("div",{className:"bre-config-default-row"},(0,R.createElement)("label",{className:"bre-config-default-label"},n("imagegenDefaultModelLabel")),(0,R.createElement)("select",{className:"bre-config-select bre-config-default-select",value:r.defaultModel??"","aria-label":n("imagegenDefaultModelLabel"),disabled:s==="default",onChange:b=>g(b.target.value)},r.defaultModel===null&&(0,R.createElement)("option",{value:"",disabled:!0},n("imagegenDefaultModelNone")),x.map(b=>(0,R.createElement)("option",{key:b.id,value:b.id},v(b)))))))}function Kw(e){let{t}=e,n=(0,R.useSyncExternalStore)(Si,un),r=(0,R.useSyncExternalStore)(Mi,Rt),[o,i]=(0,R.useState)(String(r.waitSeconds)),[a,s]=(0,R.useState)(String(r.maxRetries));(0,R.useEffect)(()=>{i(String(r.waitSeconds))},[r.waitSeconds]),(0,R.useEffect)(()=>{s(String(r.maxRetries))},[r.maxRetries]);let d=()=>{js({waitSeconds:o.trim()===""?r.waitSeconds:Number(o)}),i(String(Rt().waitSeconds))},l=()=>{js({maxRetries:a.trim()===""?r.maxRetries:Number(a)}),s(String(Rt().maxRetries))},[c,p]=(0,R.useState)(!1),m="bre-config-auto-continue-body";return(0,R.createElement)("div",{className:"bre-config-card bre-config-auto-card"},(0,R.createElement)("div",{className:"bre-config-card-head"},(0,R.createElement)("button",{type:"button",className:"bre-config-expand","aria-expanded":c,"aria-controls":m,title:t(c?"autoContinueCollapse":"autoContinueExpand"),onClick:()=>p(u=>!u)},(0,R.createElement)("span",{className:"bre-config-card-title"},t("autoContinueSectionTitle")),!c&&(0,R.createElement)("span",{className:"bre-config-card-hint bre-config-auto-summary"},t("autoContinueHint",{seconds:r.waitSeconds,count:r.maxRetries}))),(0,R.createElement)("span",{className:"bre-config-card-state"},t(n?"cardStateOn":"cardStateOff")),(0,R.createElement)("label",{className:"bre-config-switch",title:t("autoContinueAria")},(0,R.createElement)("input",{type:"checkbox",className:"bre-config-switch-input",role:"switch","aria-label":t("autoContinueAria"),checked:n,onChange:u=>{zp(u.target.checked)}}),(0,R.createElement)("span",{className:"bre-config-switch-track","aria-hidden":!0})),(0,R.createElement)("span",{className:"bre-config-chevron","aria-hidden":!0,"data-open":String(c),onClick:()=>p(u=>!u)},"\u203A")),c&&(0,R.createElement)("div",{className:"bre-config-card-body",id:m},(0,R.createElement)("div",{className:"bre-config-auto-fields"},(0,R.createElement)("label",{className:"bre-config-auto-field"},(0,R.createElement)("span",{className:"bre-config-auto-label"},t("autoContinueWaitLabel")),(0,R.createElement)("span",{className:"bre-config-auto-control"},(0,R.createElement)("input",{type:"number",className:"bre-config-auto-input",min:1,max:3600,step:1,value:o,"aria-label":`${t("autoContinueWaitLabel")} (${t("autoContinueSecondsUnit")})`,title:`${1}\u2013${3600} ${t("autoContinueSecondsUnit")}`,onChange:u=>i(u.target.value),onBlur:d,onKeyDown:u=>{u.key==="Enter"&&u.currentTarget.blur()}}),(0,R.createElement)("span",{className:"bre-config-auto-unit","aria-hidden":!0},t("autoContinueSecondsUnit")))),(0,R.createElement)("label",{className:"bre-config-auto-field"},(0,R.createElement)("span",{className:"bre-config-auto-label"},t("autoContinueRetriesLabel")),(0,R.createElement)("span",{className:"bre-config-auto-control"},(0,R.createElement)("input",{type:"number",className:"bre-config-auto-input",min:1,max:100,step:1,value:a,"aria-label":`${t("autoContinueRetriesLabel")} (${t("autoContinueRetriesUnit")})`,title:`${1}\u2013${100} ${t("autoContinueRetriesUnit")}`,onChange:u=>s(u.target.value),onBlur:l,onKeyDown:u=>{u.key==="Enter"&&u.currentTarget.blur()}}),(0,R.createElement)("span",{className:"bre-config-auto-unit","aria-hidden":!0},t("autoContinueRetriesUnit")))))))}function Bw(e){let{t,onClose:n}=e,r=(0,R.useRef)(null);return(0,R.useEffect)(()=>{let o=i=>{i.key==="Escape"&&n()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[n]),(0,R.createElement)("div",{className:"bre-config-backdrop",onMouseDown:o=>{o.target===o.currentTarget&&n()}},(0,R.createElement)("div",{className:"bre-config-pane",ref:r},(0,R.createElement)("div",{className:"bre-config-head"},(0,R.createElement)("span",{className:"bre-config-title"},t("configPaneTitle")),(0,R.createElement)("button",{className:"bre-config-close",type:"button","aria-label":t("configPaneClose"),onClick:n},"\u2715")),(0,R.createElement)("div",{className:"bre-config-body"},(0,R.createElement)(Ge,{fallbackText:t("configPaneFailed")},(0,R.createElement)(Fw,{api:e.api,t:e.t})),(0,R.createElement)(Ge,{fallbackText:t("configPaneFailed")},(0,R.createElement)(Kw,{t:e.t})))))}function pm(e){let t=document.createElement("div");t.className="bre-config-pane-host",document.body.appendChild(t);let n=(0,fm.createRoot)(t),r=!0,o=()=>{r&&(r=!1,He({wrapper:t,root:n}))};return n.render((0,R.createElement)(Bw,{api:e.api,t:e.t,onClose:o})),{close:o}}function mm(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return r.length===0||n.includes(r)}function gm(e,t){let n=e.replace(/^\s+/,"");if(n.length===0)return t.map(a=>({label:a.isDefault?`${a.label}\uFF08\u9ED8\u8BA4\uFF09`:a.label,insertText:a.id,kind:"model",hint:a.id}));let r=n.match(/^(\S+)(\s+[\s\S]*)?$/);if(r===null)return[];let o=r[1];return t.filter(a=>mm(a.id,o)||mm(a.label,o)).map(a=>({label:a.isDefault?`${a.label}\uFF08\u9ED8\u8BA4\uFF09`:a.label,insertText:a.id,kind:"model",hint:a.id}))}var qw="imagegen",Gw=3e4,Ur;function Vs(){Ur=void 0}async function Ww(){if(Ur!==void 0&&Date.now()-Ur.at<Gw)return Ur.models;let e=await qt(),t=e.ok&&e.data.enabled?e.data.models.map(n=>({id:n.id,label:n.label,isDefault:e.data.defaultModel===n.id})):[];return Ur={at:Date.now(),models:t},t}function hm(e){let t;try{t=e.inputTriggers}catch{t=void 0}let n=Ep(Vs);if(t===void 0||typeof t.registerSource!="function")return n;let r=!0;try{t.registerSource({trigger:"/",name:qw,order:900,candidates:o=>{let i=typeof o?.text=="string"?o.text:"";return/^\/?生图(?:\s|$)/.test(i)?Ww().then(a=>gm(i.replace(/^\/?生图/,""),a)):[]}})}catch{r=!1}return()=>{r=!1,n()}}var fn=require("react");var bm="tool.call.images",Uw="generate_image";function jw(e){if(e===void 0||typeof e!="object")return[];let t=e.content??e.resultView?.content;if(!Array.isArray(t))return[];let n=[];for(let r of t)if(r!==null&&typeof r=="object"&&r.type==="image"){let o=r.attachment;o!==void 0&&typeof o.attachmentId=="string"&&n.push({attachment:o})}return n}function zw(e){let t=Array.isArray(e.content)?e.content:[];for(let n of t)if(n!==null&&typeof n=="object"&&n.type==="text"&&typeof n.text=="string")return n.text;return null}function $w(e){let t=e.meta;if(t===void 0||typeof t!="object")return null;let n=[],r=t.paramsUsed;typeof t.model=="string"&&t.model.length>0&&n.push(r===void 0?t.model:`${t.model} \xB7 ${r.size} \xB7 ${r.quality} \xB7 n ${r.n}`);let o=(t.images??[]).map(i=>i.filePath).filter(i=>typeof i=="string");return o.length>0&&n.push(o.join(`
|
|
4854
|
+
/* The advanced pane's disguise switch, the pane's SECOND section. It is not a
|
|
4855
|
+
card of its own: it renders inside the header section's container, under the
|
|
4856
|
+
header table and above the pane's single commit row, and the hairline here is
|
|
4857
|
+
the only thing that separates the two sections \u2014 the same one-item border the
|
|
4858
|
+
header section draws at its own top, so the pane reads as one form with two
|
|
4859
|
+
parts rather than two stacked cards. */
|
|
4860
|
+
.bre-camouflage {
|
|
4861
|
+
display: flex;
|
|
4862
|
+
flex-direction: column;
|
|
4863
|
+
gap: 8px;
|
|
4864
|
+
margin-top: 4px;
|
|
4865
|
+
padding-top: 12px;
|
|
4866
|
+
border-top: 1px solid var(--dsw-alias-border-l2, #0000001a);
|
|
4867
|
+
}
|
|
4868
|
+
.bre-camouflage-options {
|
|
4869
|
+
display: flex;
|
|
4870
|
+
gap: 8px;
|
|
4871
|
+
flex-wrap: wrap;
|
|
4872
|
+
}
|
|
4873
|
+
.bre-camouflage-option { flex: 0 0 auto; }
|
|
4874
|
+
.bre-camouflage-option:disabled { opacity: 0.6; cursor: default; }
|
|
4875
|
+
.bre-camouflage-option[data-active='1'] {
|
|
4876
|
+
border-color: var(--dsw-alias-state-success-primary, #00a870);
|
|
4877
|
+
color: var(--dsw-alias-state-success-primary, #00a870);
|
|
4878
|
+
}
|
|
4879
|
+
|
|
4880
|
+
`;var pr="bre:endpoints-changed",mr="bre:settings-changed",gr="bre:balance-changed";var vr=require("react"),gl=require("react-dom");var A=require("react"),nl=require("react-dom");var $=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function _d(e){let t=e.toLowerCase();return t.includes("compat")||t.includes("thinkingtokenbudget")||t.includes("vllmpriority")||t.includes("supportsmaxoutput")}function Cn(e,t){if(!$(e))return[];let n=e[t];return!$(n)||!Array.isArray(n.models)?[]:n.models.filter($)}function Jt(e,t){if(!$(e))return{};let n=e[t];if(!$(n))return{};let r=typeof n.api=="string"?n.api:void 0,o=typeof n.baseURL=="string"?n.baseURL:void 0,i=typeof n.displayName=="string"?n.displayName:void 0;return{api:r,baseURL:o,displayName:i}}var Gd=["off","minimal","low","medium","high","xhigh","max"],tg=["text","image"];var ng=[{id:"deepseek-v4-vision",patterns:["deepseek-v4-flash-vision","deepseek-v4-vision"],efforts:{off:"none",low:"low",high:"high",max:"max"},defaultEffort:"high",compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,maxTokens:384e3,note:"DeepSeek \u89C6\u89C9\u5B9E\u9A8C\u7248 id\uFF08deepseek-v4-flash-vision-exp\uFF09\u3002\u5B98\u65B9\u76EE\u5F55\u5DF2\u6807\u6CE8\u8BE5\u6A21\u578B\u9000\u5F79\uFF0C\u540D\u5B57\u4ECD\u88AB\u63A5\u53D7\u3001\u7531\u73B0\u884C deepseek-flash \u63D0\u4F9B\u670D\u52A1\u2014\u2014\u56FE\u7247\u8F93\u5165\u73B0\u5DF2\u7531 deepseek-flash \u539F\u751F\u63D0\u4F9B\u3002"},{id:"deepseek-v4-1-flash",patterns:["deepseek-v4.1-flash","deepseek-flash"],efforts:{off:"none",low:"low",high:"high",max:"max"},defaultEffort:"high",compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,maxTokens:384e3,note:'DeepSeek-V4.1-Flash\uFF082026-09-10 \u53D1\u5E03\u7684\u73B0\u884C\u5B98\u65B9\u6A21\u578B\uFF0C\u5B98\u65B9 id \u4E3A deepseek-flash\uFF1B25 \u4E07\u5E76\u53D1\u3001**\u539F\u751F\u56FE\u7247\u8F93\u5165**\uFF09\u3002V4.1 \u7684\u5404\u5199\u6CD5\uFF08deepseek-flash\u3001deepseek-v4.1-flash\u3001deepseek-v4-1-flash\uFF0C\u4EE5\u53CA\u5E26\u65E5\u671F\u540E\u7F00\u7684\u7B2C\u4E09\u65B9\u53D8\u4F53\uFF09\u90FD\u5F52\u6B64\u6761\u2014\u2014\u7EAF\u6587\u672C\u7684 deepseek-v4 \u4E3B\u5E72\u4E0D\u518D\u541E\u6389\u5B83\u4EEC\u3002\u5B98\u65B9\u679A\u4E3E\u540C V4 \u7CFB\uFF1AOff\uFF08thinking:"disabled"\uFF09/ Low / High / Max\uFF0C\u9ED8\u8BA4 High\uFF1B\u5BB9\u91CF 1,048,576 \u4E0A\u4E0B\u6587 / \u6700\u5927\u8F93\u51FA 384K\u3002'},{id:"deepseek-v4",patterns:["deepseek-v4"],efforts:{off:"none",low:"low",high:"high",max:"max"},defaultEffort:"high",compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!0},input:["text"],contextWindow:1048576,maxTokens:384e3,note:'DeepSeek \u5B98\u65B9\u679A\u4E3E Low / High / Max\uFF08\u9ED8\u8BA4 High\uFF1Bminimal\u3001medium\u3001xhigh \u517C\u5BB9\u6620\u5C04\uFF0Cultra\u2192max\uFF09\uFF0COff \u5373 thinking:"disabled"\uFF08Responses API \u4E0B off \u4EE5 reasoning.effort:"none" \u8868\u793A\uFF09\u3002\u672C\u6761\u76EE\u662F V4 \u5BB6\u65CF\u7684**\u7EAF\u6587\u672C**\u6210\u5458\uFF1Adeepseek-v4-pro\uFF08= DeepSeek-V4-Pro-0813\uFF0C\u5B98\u65B9\u4E0D\u652F\u6301\u56FE\u7247\uFF09\u4E0E\u5DF2\u9000\u5F79\u6A21\u578B\u7684\u517C\u5BB9\u522B\u540D deepseek-v4-flash\uFF08deepseek-v4-flash-vision-exp \u53E6\u6709\u89C6\u89C9\u6761\u76EE\uFF09\u3002**\u6536\u56FE\u7684 V4.1-Flash\uFF08\u5B98\u65B9 id deepseek-flash\uFF09\u53E6\u6709\u4E13\u95E8\u6761\u76EE**\uFF0C\u5176 input \u542B image\u3002\u5BB9\u91CF\uFF1A1,048,576 \u4E0A\u4E0B\u6587 / \u6700\u5927\u8F93\u51FA 384K\uFF08393,216\uFF1B\u9ED8\u8BA4\u975E\u601D\u8003 8K\u3001\u601D\u8003 64K\u3001effort=max \u65F6 128K\uFF09\u3002'},{id:"deepseek-v3",patterns:["deepseek-v3","deepseek-chat"],efforts:{off:"none",high:"high",max:"max"},compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!0},input:["text"],contextWindow:163840,maxTokens:65536,note:"DeepSeek V3 \u6863\u4F4D\uFF1AOff / High / Max\u3002\u5B98\u65B9\u5DF2\u505C\u552E V3 \u4EE3\uFF08\u5B9A\u4EF7\u9875\u4EC5\u5269 V4 \u4E09\u578B\uFF09\uFF0C\u5BB9\u91CF\u53D6\u76EE\u5F55\u73B0\u5F79\u503C\u3002"},{id:"deepseek-r1",patterns:["deepseek-r1","deepseek-reasoner"],efforts:{high:"high"},defaultEffort:"high",compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!0},input:["text"],contextWindow:163840,maxTokens:32768,note:"DeepSeek-R1 \u4E3A\u63A8\u7406\u6A21\u578B\uFF0C\u4EC5\u63D0\u4F9B High\u3002\u5B98\u65B9\u5DF2\u4E0B\u67B6 R1 \u4EE3\uFF0C\u5BB9\u91CF\u53D6\u76EE\u5F55 r1-0528 \u503C\u3002"},{id:"openai-gpt-5-2",patterns:["gpt-5.2"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"off",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.2 \u6863\u4F4D\uFF1ANone / Low / Medium / High / XHigh\uFF08\u9ED8\u8BA4 None\uFF09\u3002\u5B98\u65B9\u53E6\u652F\u6301 PDF \u8F93\u5165\uFF08\u6838\u5FC3\u8BCD\u8868\u6682\u4E0D\u542B\uFF09\u3002gpt-5.2-pro \u5B98\u65B9\u9875\u672A\u5355\u5217\u6863\u4F4D\u884C\uFF0C\u6309\u672C\u6761\u76EE\u540C\u6863\u5904\u7406\uFF1Bgpt-5.2-codex \u89C1\u5355\u72EC\u6761\u76EE\u3002"},{id:"openai-gpt-5-2-codex",patterns:["gpt-5.2-codex"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.2-Codex \u6863\u4F4D\uFF1ALow / Medium / High / XHigh\uFF08\u65E0 None \u6863\uFF0C\u52FF\u52FE Off\uFF09\uFF0C\u5E26\u56FE\u8F93\u5165\u3001400K\u3002"},{id:"openai-gpt-5-6",patterns:["gpt-5.6"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:272e3,maxTokens:128e3,note:"GPT-5.6\uFF08\u522B\u540D\u5373 sol\uFF09\u6863\u4F4D\uFF1ANone / Low / Medium(\u9ED8\u8BA4) / High / XHigh / Max\uFF1Bsol/luna/terra \u540C\u6863\uFF0C\u5E26\u56FE\u8F93\u5165\u30022026-10 \u6821\u51C6\uFF1A\u4E0A\u4E0B\u6587\u6309 pi-ai 1.2.0 \u76EE\u5F55\u8BB0 272,000\uFF08\u6B64\u524D\u8BEF\u8BB0 1,050,000\uFF09\u3002"},{id:"openai-gpt-5-5",patterns:["gpt-5.5"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:272e3,maxTokens:128e3,note:"GPT-5.5 \u6863\u4F4D\uFF1ANone / Low / Medium(\u9ED8\u8BA4) / High / XHigh\uFF08\u65E0 Max \u6863\uFF09\uFF0C\u5E26\u56FE\u8F93\u5165\u3002pro \u53D8\u4F53\u4EC5 High(\u9ED8\u8BA4) / XHigh\u30011.05M \u4E0A\u4E0B\u6587\u4E14\u4EC5 Responses API\u30022026-10 \u6821\u51C6\uFF1A\u4E0A\u4E0B\u6587\u6309 pi-ai 1.2.0 \u76EE\u5F55\u8BB0 272,000\uFF08\u6B64\u524D\u8BEF\u8BB0 1,050,000\uFF09\u3002"},{id:"openai-gpt-5-4",patterns:["gpt-5.4"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"off",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:272e3,maxTokens:128e3,note:"GPT-5.4 \u6863\u4F4D\uFF1ANone(\u9ED8\u8BA4) / Low / Medium / High / XHigh\uFF0C\u5E26\u56FE\u8F93\u5165\u3002pro \u53D8\u4F53\u4EC5 Medium/High/XHigh\uFF081.05M\uFF09\uFF1Bmini/nano \u4E3A 400K \u4E0A\u4E0B\u6587\u30022026-10 \u6821\u51C6\uFF1A\u4E0A\u4E0B\u6587\u6309 pi-ai 1.2.0 \u76EE\u5F55\u8BB0 272,000\uFF08\u6B64\u524D\u8BEF\u8BB0 1,050,000\uFF09\u3002"},{id:"openai-gpt-5-3",patterns:["gpt-5.3"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.3-Codex \u6863\u4F4D\uFF1ANone / Low / Medium(\u9ED8\u8BA4) / High / XHigh\uFF0C\u5E26\u56FE\u8F93\u5165\u3001400K\uFF1B2026-10 \u6821\u51C6\uFF1ANone \u6863\u6309 pi-ai 1.2.0 \u76EE\u5F55\u8865\u56DE\uFF08\u6B64\u524D\u6309\u65E7\u6A21\u578B\u9875\u8BB0\u4E3A\u65E0 None\uFF09\u3002gpt-5.3-chat \u4E3A\u975E\u63A8\u7406\u804A\u5929\u6A21\u578B\uFF08\u89C1 chat \u6761\u76EE\uFF09\u3002"},{id:"openai-gpt-5-1",patterns:["gpt-5.1"],efforts:{off:"none",low:"low",medium:"medium",high:"high"},defaultEffort:"off",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.1 \u6863\u4F4D\uFF1ANone / Low / Medium / High\uFF08\u9ED8\u8BA4 None\uFF09\u3002"},{id:"openai-gpt-5-1-codex",patterns:["gpt-5.1-codex"],efforts:{low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.1-Codex \u7CFB\u5217\uFF1A\u5B98\u65B9\u6A21\u578B\u9875\u672A\u5355\u5217 effort \u503C\u57DF\uFF0C\u6309\u540C\u4EE3\u4FDD\u5B88\u6863 Low / Medium / High\uFF08\u65E0 None\uFF1Bxhigh \u672A\u8BC1\u5B9E\uFF09\u3002\u5982\u7AEF\u70B9\u652F\u6301 xhigh/none \u53EF\u624B\u8C03\u3002"},{id:"openai-gpt-5",patterns:["gpt-5"],efforts:{minimal:"minimal",low:"low",medium:"medium",high:"high"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5 \u521D\u4EE3\u6863\u4F4D\uFF1AMinimal / Low / Medium / High\uFF0C\u65E0\u5173\u95ED\u6863\u3002"},{id:"openai-gpt-5-2-chat",patterns:["gpt-5.2-chat"],efforts:{off:null,medium:"medium",xhigh:"xhigh"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:128e3,maxTokens:16384,note:"GPT-5.2-Chat\uFF08\u5B98\u65B9 id gpt-5.2-chat-latest\uFF09\uFF1Api-ai 1.2.0 \u76EE\u5F55\u8BB0\u4E3A\u63A8\u7406\u6A21\u578B\uFF0C\u4EC5 Medium / XHigh \u4E24\u6863\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF0C\u975E\u663E\u5F0F\u5173\u95ED\uFF09\uFF0C128K / 16,384 \u8F93\u51FA\u30022026-10 \u65B0\u589E\u6761\u76EE\u3002"},{id:"openai-chat",patterns:["gpt-5.1-chat-latest","gpt-5.3-chat-latest","gpt-5-chat-latest","gpt-chat-latest","gpt-5-chat","gpt-5.1-chat","gpt-5.3-chat"],efforts:!1,input:["text","image"],contextWindow:128e3,maxTokens:16384,note:"-chat \u7CFB\u5217\uFF08\u5B98\u65B9 id \u4E3A gpt-5.x-chat-latest\uFF09\u4E3A\u975E\u63A8\u7406\u804A\u5929\u6A21\u578B\uFF0C\u4E0D\u652F\u6301 effort \u53C2\u6570\uFF08\u52FF\u52FE\u601D\u8003\u6863\uFF09\uFF1B\u5B98\u65B9\u652F\u6301\u56FE\u7247\u8F93\u5165\uFF0C128K / 16,384 \u8F93\u51FA\u3002gpt-5-chat-latest \u5DF2\u4E8E 2026-07-23 \u4E0B\u67B6\u3001gpt-chat-latest \u5DF2\u65E0\u5B98\u65B9\u9875\u9762\uFF08\u4FDD\u7559\u6A21\u5F0F\u4F9B\u7F51\u5173\uFF09\u3002gpt-5.2-chat \u53E6\u6709\u63A8\u7406\u6761\u76EE\u3002"},{id:"openai-o",patterns:["o1","o3","o4"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:2e5,maxTokens:1e5,note:"OpenAI o \u7CFB\u6863\u4F4D\uFF1ALow / Medium / High\u3002\u5B98\u65B9\u5DF2\u4E8E 2026-06 \u516C\u544A\u9000\u5F79\uFF08o1/o1-pro/o3-mini/o4-mini 2026-10-23 \u79FB\u9664\u3001o3/o3-pro 2026-12-11\uFF09\uFF0C\u7F51\u5173\u6B8B\u7559\u4ECD\u53EF\u547D\u4E2D\uFF1B\u591A\u6570 o \u7CFB\u7AEF\u70B9\u6536\u56FE\uFF08o3-mini \u4F8B\u5916\uFF09\u3002"},{id:"openai-gpt-oss",patterns:["gpt-oss"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"low",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],contextWindow:131072,maxTokens:131072,note:"GPT-OSS \u5F00\u6E90\u6743\u91CD\uFF08Ollama/vLLM \u5E38\u89C1\uFF09\uFF1Areasoning effort Low / Medium / High\uFF0C\u7EAF\u6587\u672C\uFF0C131K \u4E0A\u4E0B\u6587 / 131K \u8F93\u51FA\u30022026-09 \u590D\u6838\uFF1A\u5B98\u65B9\u6A21\u578B\u9875\u73B0\u5728\u5199 Chat Completions = Not supported\u3001\u65E0\u56FE\u7247\u8F93\u5165\uFF08\u9ED8\u8BA4 Low \u6765\u81EA\u5B98\u65B9 CLI\uFF0C\u4E0D\u662F API \u9875\uFF09\uFF0C\u56E0\u6B64\u8FD9\u91CC\u4E0D\u518D\u58F0\u660E Off\u3002"},{id:"openai-gpt-6",patterns:["gpt-6-luna","gpt-6-sol","gpt-6-terra","gpt-6.1"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:272e3,maxTokens:128e3,note:'GPT-6 \u7CFB\uFF08luna/sol/terra\uFF0C2026-10 \u6821\u51C6\u65B0\u589E\uFF09\uFF1Api-ai 1.2.0 \u76EE\u5F55\u5168\u6863 None / Low / Medium / High / XHigh / Max\uFF0C\u5E26\u56FE\u8F93\u5165\uFF0C272,000 \u4E0A\u4E0B\u6587 / 128,000 \u8F93\u51FA\u3002gpt-6-astra \u89C1\u5355\u72EC\u6761\u76EE\uFF08\u88F8 "gpt-6" \u4E0E 6.1-sol \u7531 astra \u6761\u76EE\u627F\u63A5\uFF0Coff \u4EE5\u7701\u7565\u8868\u8FBE\uFF0C"none" \u672A\u8BC1\u5B9E\u53EF\u624B\u8C03\uFF09\u3002'},{id:"openai-gpt-6-astra",patterns:["gpt-6-astra","gpt-6","gpt-6.1-sol"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:272e3,maxTokens:128e3,note:'GPT-6 Astra \u6863\u4F4D\uFF1ALow / Medium / High / XHigh / Max\u2014\u2014**\u6CA1\u6709 None \u6863**\uFF08\u5B98\u65B9\u539F\u6587\uFF1A\u8BBE\u4E3A none \u8FD4\u56DE HTTP 400\uFF09\uFF0C\u56E0\u6B64\u672C\u6761\u76EE\u4E0D\u58F0\u660E Off\u3002\u5E26\u56FE\u8F93\u5165\uFF1B2026-10 \u6821\u51C6\uFF1A\u4E0A\u4E0B\u6587\u6309 pi-ai 1.2.0 \u76EE\u5F55\u8BB0 272,000\uFF08\u6B64\u524D\u8BEF\u8BB0 1,050,000\uFF09\u3002\u5DE5\u5177\u8C03\u7528\u9700\u8D70 Responses API\u3002gpt-6 luna/sol/terra \u89C1\u5355\u72EC\u6761\u76EE\uFF1B\u88F8 "gpt-6" \u4E0E 6.1-sol\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF09\u7531\u672C\u6761\u76EE\u627F\u63A5\u3002'},{id:"openai-gpt-daybreak",patterns:["gpt-daybreak"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:105e4,maxTokens:128e3,note:"GPT-Daybreak\uFF08blue-latest 1.05M / red-latest 400K\uFF0C2026-10 \u65B0\u589E\uFF09\uFF1Api-ai 1.2.0 \u76EE\u5F55\u5168\u6863 None / Low / Medium / High / XHigh / Max\uFF0C\u5E26\u56FE\u8F93\u5165 / 128,000 \u8F93\u51FA\u3002"},{id:"openai-gpt-realtime",patterns:["gpt-realtime"],efforts:{minimal:"minimal",low:"low",medium:"medium",high:"high",xhigh:"xhigh"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:128e3,maxTokens:32e3,note:"GPT-Realtime 2.1\uFF082026-10 \u65B0\u589E\uFF09\uFF1Api-ai 1.2.0 \u76EE\u5F55\u6863\u4F4D Minimal / Low / Medium / High / XHigh\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF09\uFF0C128,000 \u4E0A\u4E0B\u6587 / 32,000 \u8F93\u51FA\u3002"},{id:"openai-gpt-5-6-cyber",patterns:["gpt-5.6-cyber"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.6-Cyber\uFF1A\u5B98\u65B9\u6A21\u578B\u9875\u672A\u5355\u5217 effort \u503C\u57DF\uFF08\u4E0D\u7B49\u4E8E\u4E0D\u652F\u6301\uFF09\uFF0C\u6545\u6309\u540C\u4EE3\u4FDD\u5B88\u6863 Low / Medium / High / XHigh\uFF1B\u8BE5\u578B\u53F7\u4EC5 Responses API\uFF0C\u5E26\u56FE\u8F93\u5165\u3001400K \u4E0A\u4E0B\u6587\u3002\u5B98\u65B9\u652F\u6301\u7684\u5176\u4ED6\u6863\u4F4D\u53EF\u624B\u8C03\u540E\u5E94\u7528\u3002"},{id:"openai-gpt-4o",patterns:["gpt-4o"],efforts:!1,input:["text","image"],contextWindow:128e3,maxTokens:16384,note:"GPT-4o \u4EE3\u9645\uFF1A\u975E\u63A8\u7406\u6A21\u578B\uFF0C\u4E0D\u652F\u6301 effort \u53C2\u6570\uFF08\u52FF\u52FE\u601D\u8003\u6863\uFF09\uFF1B\u56FE\u7247\u8F93\u5165\u5168\u7CFB\u6807\u914D\uFF0C128K / 16,384 \u8F93\u51FA\u3002"},{id:"openai-gpt-4-1",patterns:["gpt-4.1"],efforts:!1,input:["text","image"],contextWindow:1047576,maxTokens:32768,note:"GPT-4.1 \u5168\u7CFB\uFF08\u542B mini/nano\uFF09\uFF1A\u975E\u63A8\u7406\u6A21\u578B\uFF0C\u4E0D\u652F\u6301 effort \u53C2\u6570\uFF1B\u5B98\u65B9 1,047,576 \u4E0A\u4E0B\u6587 / 32,768 \u8F93\u51FA\uFF0C\u5168\u7CFB\u5E26\u56FE\u8F93\u5165\u3002"},{id:"openai-gpt-4-turbo-preview",patterns:["gpt-4-turbo-preview"],efforts:!1,input:["text"],contextWindow:128e3,maxTokens:4096,note:"GPT-4 Turbo Preview\uFF1A\u975E\u63A8\u7406\u6A21\u578B\uFF0C\u7EAF\u6587\u672C\u8F93\u5165\uFF08\u6B63\u5F0F turbo \u5FEB\u7167\u652F\u6301\u56FE\u7247\uFF0C\u89C1\u4E0B\u6761\uFF09\uFF0C128K\u3002"},{id:"openai-gpt-4-turbo",patterns:["gpt-4-turbo"],efforts:!1,input:["text","image"],contextWindow:128e3,maxTokens:4096,note:"GPT-4 Turbo\uFF1A\u975E\u63A8\u7406\u6A21\u578B\uFF0C\u5B98\u65B9\u652F\u6301\u56FE\u7247\u8F93\u5165\uFF0C128K / 4,096 \u8F93\u51FA\u3002"},{id:"openai-gpt",patterns:["gpt-4","gpt-3.5"],efforts:!1,input:["text"],note:"GPT-4/3.5 \u4EE3\u9645\uFF1A\u975E\u63A8\u7406\u6A21\u578B\uFF0C\u4E0D\u652F\u6301 effort \u53C2\u6570\uFF08\u52FF\u52FE\u601D\u8003\u6863\uFF09\u3002gpt-4-turbo/4.1 \u8D77\u652F\u6301\u56FE\u7247\uFF0C\u89C1\u5355\u72EC\u6761\u76EE\uFF1B\u65B0\u4EE3\u8BF7\u7528 GPT-5 \u7CFB\uFF08\u89C1 openai-chat/gpt-5.x \u6761\u76EE\uFF09\u3002"},{id:"anthropic-claude-5-5",patterns:["claude-haiku-5.5","claude-opus-5-5","claude-sonnet-5-5","haiku-5.5","claude-5-5"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},defaultEffort:"high",compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude 5.5 \u4EE3\uFF08Haiku 5.5 / Opus 5.5 / Sonnet 5.5\uFF09\uFF1Api-ai 1.2.0 \u5B98\u65B9\u76EE\u5F55\u5168\u6863 Low / Medium / High(\u9ED8\u8BA4) / XHigh / Max\uFF0C\u81EA\u9002\u5E94\u601D\u8003\uFF0C1M \u4E0A\u4E0B\u6587 / 128K \u8F93\u51FA\u3002off/minimal \u4EE5\u7701\u7565\u8868\u8FBE\uFF08\u76EE\u5F55\u5C06\u4E24\u952E\u8BB0\u4E3A null\uFF0C\u975E\u663E\u5F0F\u5173\u95ED\uFF09\u3002"},{id:"anthropic-claude-5",patterns:["claude-fable-5","claude-mythos-5","claude-opus-5","claude-sonnet-5"],efforts:{xhigh:"xhigh",max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude 5 \u4EE3\uFF08Fable 5 / Mythos 5 / Opus 5 / Sonnet 5\uFF09\uFF1A2026-10 \u6821\u51C6\u2014\u2014pi-ai 1.2.0 \u5B98\u65B9\u76EE\u5F55\u5DF2\u6536\u7D27\u4E3A XHigh / Max\uFF08low/medium/high \u6863\u5DF2\u4ECE\u8BE5\u4EE3 effort \u76EE\u5F55\u79FB\u9664\uFF1BFable 5 \u4E0E Opus 5 \u53E6\u63A5\u53D7\u4EE5\u7701\u7565\u8868\u8FBE\u7684 off\uFF0CSonnet 5 \u65E0 off\uFF09\u30021M \u4E0A\u4E0B\u6587 / 128K \u8F93\u51FA\uFF08Batch 300K\uFF09\u3002\u5B98\u65B9\u652F\u6301 PDF \u8F93\u5165\u3002\u6CE8\u610F\uFF1AAnthropic \u5B98\u65B9 OpenAI \u517C\u5BB9\u5C42\u4F1A\u5FFD\u7565 effort \u53C2\u6570\uFF0C\u58F0\u660E\u5728\u7B2C\u4E09\u65B9\u7F51\u5173\u6620\u5C04\u65F6\u751F\u6548\u3002"},{id:"anthropic-claude-5-1",patterns:["claude-fable-5-1","claude-mythos-5-1"],efforts:{xhigh:"xhigh",max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude Fable 5.1 / Mythos 5.1\uFF1A2026-10 \u6821\u51C6\u2014\u2014pi-ai 1.2.0 \u76EE\u5F55\u6863\u4F4D XHigh / Max\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF09\uFF0C\u81EA\u9002\u5E94\u601D\u8003\u5E38\u5F00\uFF08\u4E0D\u63A5\u53D7 enabled/disabled\uFF09\u30021M \u4E0A\u4E0B\u6587 / 128K \u8F93\u51FA\uFF1BFable 5.1 \u652F\u6301\u4F1A\u8BDD\u4E2D\u9014\u6539\u6863\uFF08\u9700 beta header\uFF0C\u672C\u63D2\u4EF6\u4E0D\u6D89\u53CA\uFF09\u3002"},{id:"anthropic-claude-mythos-preview",patterns:["claude-mythos-preview"],efforts:{low:"low",medium:"medium",high:"high",max:"max"},defaultEffort:"high",compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude Mythos Preview\uFF1A\u5B98\u65B9\u6863\u4F4D Low / Medium / High / Max\uFF08\u65E0 XHigh\uFF09\uFF0C1M \u4E0A\u4E0B\u6587\u3002pi-ai 1.2.0 \u76EE\u5F55\u65E0 mythos \u6761\u76EE\uFF0C\u672C\u6863\u4F4D\u6CBF\u7528\u5B98\u65B9 effort \u77E9\u9635\u3002"},{id:"anthropic-claude-opus-4-high",patterns:["claude-opus-4-8","claude-opus-4-7"],efforts:{xhigh:"xhigh",max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude Opus 4.7/4.8\uFF1A2026-10 \u6821\u51C6\u2014\u2014pi-ai 1.2.0 \u5B98\u65B9\u76EE\u5F55\u6863\u4F4D\u4EC5 XHigh / Max\uFF08low/medium/high \u5DF2\u4ECE\u8BE5\u4EE3\u76EE\u5F55\u79FB\u9664\uFF1Bxhigh \u4E3A\u5B98\u65B9\u63A8\u8350\u7684\u7F16\u7801\u8D77\u6B65\u6863\uFF09\u30021M \u4E0A\u4E0B\u6587\u3002"},{id:"anthropic-claude-4-6",patterns:["claude-opus-4-6","claude-sonnet-4-6"],efforts:{max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude 4.6 \u4EE3\uFF08Opus 4.6 / Sonnet 4.6\uFF09\uFF1A2026-10 \u6821\u51C6\u2014\u2014pi-ai 1.2.0 \u5B98\u65B9\u76EE\u5F55\u4EC5\u5269 Max \u4E00\u6863\uFF08low/medium/high/xhigh \u5747\u5DF2\u4ECE\u76EE\u5F55\u79FB\u9664\uFF09\u30021M \u4E0A\u4E0B\u6587\u3002"},{id:"anthropic-claude-opus-4-5",patterns:["claude-opus-4-5"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"high",compat:{supportsReasoningEffort:!0},input:["text","image"],contextWindow:2e5,maxTokens:64e3,note:"Claude Opus 4.5\uFF1A\u5B98\u65B9 effort \u652F\u6301\u5217\u8868\uFF0820251101 \u5FEB\u7167\uFF09\uFF0C\u6863\u4F4D Low / Medium / High\uFF08\u65E0 XHigh/Max\uFF09\uFF0C\u53EF\u4E0E budget_tokens \u5E76\u7528\uFF1B200K / 64K\u3002"},{id:"anthropic-claude",patterns:["claude"],efforts:!1,input:["text","image"],contextWindow:2e5,maxTokens:64e3,note:"Claude 3.x \u4E0E Sonnet 4.5 / Haiku 4.5\uFF1A\u5B98\u65B9 effort \u53C2\u6570\u4E0D\u652F\u6301\uFF08\u4EC5 5.5/5/5.1 \u4EE3\u3001Opus 4.5/4.6/4.7/4.8\u3001Sonnet 4.6 \u652F\u6301\uFF09\uFF0C\u601D\u8003\u7531 thinking.type \u63A7\u5236\u2014\u2014\u52FF\u52FE\u601D\u8003\u6863\u3002\u53C2\u8003\u5BB9\u91CF 200K / 64K\uFF08Haiku 3.5 \u4E3A\u7EAF\u6587\u672C\uFF0C\u6309\u9700\u53D6\u6D88\u56FE\u7247\uFF09\u3002Haiku 5.5 \u53CA\u6574\u4E2A 5.5 \u4EE3\u89C1\u4E0A\u65B9 anthropic-claude-5-5 \u6761\u76EE\u3002"},{id:"google-gemini",patterns:["gemini"],efforts:{low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,maxTokens:65536,note:"Gemini \u901A\u7528\u5B89\u5168\u6863\uFF1ALow / Medium / High\uFF08\u5B98\u65B9 OpenAI \u517C\u5BB9\u6620\u5C04\u8868\u53E6\u6536 minimal\uFF1A2.5 \u7CFB\u6620\u5C04\u4E3A 1,024 \u9884\u7B97\u30013.1 Flash-Lite/3 Flash \u539F\u751F minimal\u30013.1 Pro \u843D low\uFF09\u3002none \u4EC5\u80FD\u5173 2.5 \u975E Pro\uFF1B2.5 Pro \u4E0E 3 \u4EE3\u4E0D\u53EF\u5173\uFF1B\u5404\u578B\u9ED8\u8BA4\u4E0D\u4E00\uFF08flash-lite \u9ED8\u8BA4\u5173\uFF09\u3002\u5B98\u65B9\u53E6\u6536\u97F3\u9891/\u89C6\u9891/PDF\u3002Gemma-4 \u89C1\u4E0B\u6761\u3002"},{id:"google-gemma-4",patterns:["gemma-4"],efforts:{off:null,minimal:"MINIMAL",high:"HIGH"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:262144,maxTokens:32768,note:"Gemma 4\uFF0826b/31b-it\uFF09\uFF1A\u4E09\u6863 Minimal / High\uFF08\u6863\u4F4D\u7EBF\u4E3A\u5B98\u65B9\u5927\u5199\u679A\u4E3E\u62FC\u5199\uFF09\uFF0Coff \u4EE5\u7701\u7565\u8868\u8FBE\uFF1BLow/Medium \u4E0D\u88AB\u63A5\u53D7\u3002\u5E26\u56FE\u8F93\u5165\uFF0C262,144 / 32,768\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF09\u3002"},{id:"xai-grok-4-7",patterns:["grok-4.7"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:5e5,maxTokens:5e5,note:'Grok 4.7\uFF1A\u6863\u4F4D Low / Medium / High / XHigh\uFF0C\u601D\u8003\u4E0D\u53EF\u5173\u95ED\uFF08off \u4EC5\u4EE5\u7701\u7565\u8868\u8FBE\uFF09\uFF1B\u5E26\u56FE\u8F93\u5165\uFF0C500K \u4E0A\u4E0B\u6587 / 500K \u8F93\u51FA\uFF082026-10 \u6821\u51C6\uFF1Api-ai 1.2.0 \u5B98\u65B9\u76EE\u5F55\u786E\u8BA4\u6863\u4F4D\u4E0E\u5BB9\u91CF\uFF0C"\u4E0A\u6E38 404"\u4E0E"\u6863\u4F4D\u672A\u8BC1\u5B9E"\u4E24\u6761\u65E7\u8BB0\u5F55\u4F5C\u5E9F\uFF09\u3002grok-4.5 \u4F20 xhigh \u88AB\u9759\u9ED8\u6309 High \u5904\u7406\u7684\u8BF4\u660E\u89C1\u5176\u6761\u76EE\u3002'},{id:"xai-grok-high",patterns:["grok-4.6"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"high",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:5e5,note:'Grok 4.6 \u6863\u4F4D\uFF1ALow / Medium / High(\u9ED8\u8BA4) / XHigh\uFF0C\u601D\u8003\u4E0D\u53EF\u5173\u95ED\uFF1B\u5E26\u56FE\u8F93\u5165\u3001500K \u4E0A\u4E0B\u6587\u3002Grok 4.7 \u89C1\u4E0A\u4E00\u6761\uFF08\u6B64\u524D\u8BB0\u4E3A"\u4E0D\u5B58\u5728"\uFF0C\u5DF2\u968F\u53D1\u5E03\u4F5C\u5E9F\uFF09\u3002'},{id:"xai-grok-4-5",patterns:["grok-4.5"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"high",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:5e5,note:"Grok 4.5 \u6863\u4F4D\uFF1ALow / Medium / High(\u9ED8\u8BA4)\uFF0C\u601D\u8003\u4E0D\u53EF\u5173\u95ED\uFF1B\u5E26\u56FE\u8F93\u5165\u3002\u4F20\u5165 xhigh \u4F1A\u88AB\u5B98\u65B9\u9759\u9ED8\u6309 High \u5904\u7406\u3002"},{id:"xai-grok-4-3",patterns:["grok-4.3"],efforts:{off:"none",low:"low",medium:"medium",high:"high"},defaultEffort:"low",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1e6,maxTokens:3e4,note:"Grok 4.3\uFF1A\u5B98\u65B9\u56DB\u7EA7 reasoning effort\uFF08None / Low(\u9ED8\u8BA4) / Medium / High\uFF09\uFF0C1M \u4E0A\u4E0B\u6587 / 30,000 \u8F93\u51FA\uFF082026-10 \u6821\u51C6\uFF1AXHigh \u6863\u6309 pi-ai 1.2.0 \u76EE\u5F55\u79FB\u9664\u2014\u2014\u5B83\u81EA 4.6 \u8D77\u624D\u52A0\u5165\uFF1B\u5E26\u56FE\u8F93\u5165\uFF09\u3002grok-4-fast \u7B49\u65E7 slug 2026-05-15 \u8D77\u81EA\u52A8\u91CD\u5B9A\u5411\u5230\u672C\u578B\u53F7\u3002"},{id:"xai-grok",patterns:["grok"],efforts:{low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],note:"Grok \u901A\u7528\u6863\u4F4D\uFF1ALow / Medium / High\u3002\u521D\u4EE3 grok-4\u3001grok-4.20 \u4E0E grok-build-0.1 \u4E0D\u63A5\u53D7\u8BE5\u53C2\u6570\uFF08grok-4 \u7CFB\u4E0E grok-3 \u5DF2\u4E8E 2026-05-15 \u9000\u5F79\u5E76\u91CD\u5B9A\u5411\u81F3 4.3\uFF09\uFF1Bgrok-4.20-multi-agent \u7684\u56DB\u6863\u63A7\u5236\u7684\u662F agent \u6570\u91CF\u800C\u975E\u601D\u8003\u6DF1\u5EA6\u3002\u65B0\u65E7\u4EE3\u9645\u8BF7\u4F18\u5148\u9009 4.5/4.6/4.3\uFF1B\u591A\u6A21\u6001\u53D8\u4F53\u6309\u9700\u52FE\u9009\u56FE\u7247\u3002"},{id:"mistral-magistral",patterns:["magistral"],efforts:{off:"none",high:"high"},defaultEffort:"off",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:262144,maxTokens:16384,note:'Magistral\uFF08magistral-medium-latest\uFF09\uFF1A2026-10 \u6821\u51C6\u2014\u2014pi-ai 1.2.0 \u76EE\u5F55\u663E\u793A\u73B0\u5F79 magistral \u8D70 mistral-conversations \u534F\u8BAE\u5E76\u63A5\u53D7 effort\uFF08None / High \u4E24\u6863\uFF0C\u9ED8\u8BA4 None\uFF09\uFF0C\u5E26\u56FE\u8F93\u5165\uFF0C262,144 / 16,384\u3002\u65E9\u524D"\u8BE5\u7EBF\u65E0 effort \u53C2\u6570\u4E14\u5DF2\u5F03\u7528"\u7684\u8BB0\u5F55\u4F5C\u5E9F\u3002'},{id:"mistral-medium-3",patterns:["mistral-medium-3.5","mistral-large-4","mistral-medium-2604","mistral-medium-latest","mistral-small-latest","mistral-small-2603"],efforts:{off:"none",high:"high"},defaultEffort:"off",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],note:"Mistral \u73B0\u5F79\u63A8\u7406\u6863\uFF082026-10 \u6269\u5145\uFF09\uFF1ANone / High \u4E24\u6863\uFF0C\u5B98\u65B9 reasoning_effort \u679A\u4E3E\u5373 none/high\uFF1B\u73B0\u5F79\u578B\u53F7 mistral-large-4\uFF081M\uFF09\u3001mistral-medium-3.5\uFF082604/latest\uFF09\u3001mistral-small-2603\uFF08Small 4\uFF09\u7ECF\u5B83\u63A7\u5236\uFF0C\u5747\u5E26\u89C6\u89C9\u3002\u5BB9\u91CF\uFF1Alarge-4 262,144 \u8F93\u51FA\u3001medium 262,144 \u8F93\u51FA\u3001small 256,000 \u8F93\u51FA\uFF08\u4E0A\u4E0B\u6587\u5747 262,144\uFF09\u3002\u975E\u63A8\u7406\u65E7\u6B3E\u89C1\u4E0B\u6761\u3002"},{id:"mistral-legacy",patterns:["mistral-large-2411","mistral-large-latest","mistral-large-2512","mistral-medium-2505","mistral-medium-2508","mistral-small-2506","mistral-nemo","devstral","ministral","codestral","pixtral","voxtral"],efforts:!1,input:["text","image"],note:"Mistral \u975E\u63A8\u7406\u7EBF\uFF082026-10 \u65B0\u589E\u6761\u76EE\uFF09\uFF1Alarge-2411/2512/latest\u3001medium-2505/2508\u3001small-2506\u3001nemo \u53CA devstral/ministral/codestral/pixtral/voxtral \u7B49\u4E13\u7528\u7EBF\u5747\u4E0D\u63A5\u53D7 effort \u53C2\u6570\uFF08\u52FF\u52FE\u601D\u8003\u6863\uFF09\u3002\u591A\u6570\u73B0\u5F79\u6B3E\u5E26\u89C6\u89C9\uFF08large-2411 \u4E3A\u7EAF\u6587\u672C\uFF09\u3002"},{id:"qwen-vision",patterns:["qwen-vl","qwen2-vl","qwen2-5-vl","qwen3-vl","qvq"],efforts:{off:null,high:"high"},defaultEffort:"high",compat:{thinkingFormat:"qwen"},input:["text","image"],contextWindow:131072,maxTokens:8192,note:"\u901A\u4E49\u89C6\u89C9\u7EBF\uFF08Qwen-VL/QvQ\uFF09\uFF1Aenable_thinking \u5F00\u5173\uFF08\u5F00=High\uFF09\uFF0C\u6536\u56FE\u3002qwen3-vl \u5BB9\u91CF\u66F4\u5927\uFF0C\u6309\u9700\u4E0A\u8C03\u3002"},{id:"qwen-3-8",patterns:["qwen3.8"],efforts:{off:null,low:"low",medium:"medium",xhigh:"xhigh"},defaultEffort:"xhigh",compat:{thinkingFormat:"qwen",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1e6,note:"Qwen 3.8 \u7CFB\uFF1A\u5B98\u65B9 reasoning_effort \u6863\u4F4D XHigh(\u9ED8\u8BA4) / Medium / Low\uFF0Cthinking \u9ED8\u8BA4\u5F00\u3001\u53EF\u6309\u8BF7\u6C42\u5173\u95ED\uFF1B\u539F\u751F\u591A\u6A21\u6001\uFF08qwen3.8-max \u56FE\u50CF/\u89C6\u9891\u7406\u89E3\uFF0C\u89C6\u9891\u672A\u5165\u6838\u5FC3\u8BCD\u8868\uFF09\u30021M \u6863\u4E0A\u4E0B\u6587\u300227B \u4E0E Flash-Next \u5F00\u6E90\u6B3E\u89C1\u5355\u72EC\u6761\u76EE\u3002"},{id:"qwen-3-8-27b",patterns:["qwen3.8-27b"],efforts:{off:null,low:"low",medium:"medium",xhigh:"xhigh"},defaultEffort:"xhigh",compat:{thinkingFormat:"qwen",supportsReasoningEffort:!0},input:["text","image"],contextWindow:262144,note:"Qwen3.8-27B\uFF08dense\uFF0C2026-08-14 \u5F00\u6E90\uFF09\uFF1A\u5B98\u65B9 reasoning_effort \u6863\u4F4D XHigh(\u9ED8\u8BA4) / Medium / Low\uFF0Cthinking \u9ED8\u8BA4\u5F00\u3001\u53EF\u6309\u8BF7\u6C42\u5173\uFF1B\u539F\u751F\u56FE\u50CF+\u89C6\u9891\u7406\u89E3\uFF08\u89C6\u9891\u672A\u5165\u6838\u5FC3\u8BCD\u8868\uFF09\u3002262,144 \u539F\u751F\u4E0A\u4E0B\u6587\u3001\u5B98\u65B9\u58F0\u660E\u53EF\u6269\u81F3 1M\u3002\u6765\u6E90\uFF1AHF Qwen/Qwen3.8-27B \u6A21\u578B\u5361\u3002"},{id:"qwen-3-8-flash-next",patterns:["qwen3.8-flash-next"],efforts:{off:null,low:"low",medium:"medium",xhigh:"xhigh"},defaultEffort:"xhigh",compat:{thinkingFormat:"qwen",supportsReasoningEffort:!0},input:["text","image"],contextWindow:262144,note:"Qwen3.8-Flash-Next\uFF08125B-A6B \u5B9E\u9A8C\u67B6\u6784\uFF0CQwen4 \u524D\u8EAB\uFF09\uFF1A\u5B98\u65B9 reasoning_effort \u6863\u4F4D XHigh(\u9ED8\u8BA4) / Medium / Low + enable_thinking \u5F00\u5173\uFF1B\u539F\u751F\u89C6\u89C9\uFF08Vision Encoder\uFF09\u3002262,144 \u539F\u751F\u4E0A\u4E0B\u6587\u3001\u53EF\u6269\u81F3 1M\u3002\u6765\u6E90\uFF1AHF \u6A21\u578B\u5361\u4E0E qwen.ai \u5B98\u65B9\u535A\u5BA2\u3002"},{id:"qwen",patterns:["qwen","qwq"],efforts:{off:null,high:"high"},defaultEffort:"high",compat:{thinkingFormat:"qwen"},input:["text"],contextWindow:1e6,maxTokens:65536,note:"\u901A\u4E49\u5343\u95EE\uFF1Aenable_thinking \u5F00\u5173\uFF08\u65E0 effort \u6863\uFF09\uFF0C\u5F00=High\uFF1B\u73B0\u5F79\u65D7\u8230\u4E3A qwen3.8 \u7CFB\uFF081M \u6863\u4E0A\u4E0B\u6587\uFF0C\u89C1 qwen-3-8 \u6761\u76EE\uFF09\u30023.6/3.7 \u4EE3\u7684 Plus/Flash \u4EA6\u9ED8\u8BA4\u591A\u6A21\u6001\uFF08\u56FE\u7247/\u89C6\u9891\uFF09\uFF0C\u5982\u63A5\u5165\u8BF7\u6309\u9700\u52FE\u9009\u56FE\u7247\uFF1B\u89C6\u89C9\u7EBF\u89C1 qwen-vision \u6761\u76EE\u3002"},{id:"glm-vision",patterns:["glm-4v","glm-4-6v","glm-4-5v","glm-5v"],efforts:{off:null,high:"high"},defaultEffort:"high",compat:{thinkingFormat:"zai"},input:["text","image"],contextWindow:131072,maxTokens:32768,note:"\u667A\u8C31\u89C6\u89C9\u7EBF\uFF08GLM-4V/4.5V/4.6V/5V\uFF09\uFF1Athinking \u5F00\u5173\uFF08\u5F00=High\uFF09\uFF0C\u6536\u56FE\u3002GLM-4.5V \u4E3A\u5F3A\u5236\u601D\u8003\uFF08\u4F20 disabled \u62A5\u9519\uFF0C\u8BF7\u624B\u52A8\u5220 Off \u6863\uFF09\u3002"},{id:"glm-5-3-flash",patterns:["glm-5.3-flash","glm-5.3-flashx"],efforts:{low:"low",high:"high",max:"max"},defaultEffort:"max",compat:{thinkingFormat:"zai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,maxTokens:131072,note:"GLM-5.3-Flash\uFF08320B\uFF0C\u5B98\u65B9\u6587\u6863 vlm \u5206\u7C7B\uFF09\uFF1A\u5F3A\u5236\u601D\u8003\uFF08thinking.type \u4EC5 enabled\uFF0C\u4E0D\u652F\u6301\u5173\u95ED\uFF09\uFF0C\u6587\u672C\u53C2\u6570\u4E0E GLM-5.3 \u4E00\u81F4\u2014\u2014\u6863\u4F4D Low / High / Max\u3002\u8F93\u5165\u6A21\u6001\uFF1A\u89C6\u9891\u3001\u56FE\u50CF\u3001\u6587\u672C\u3001\u6587\u4EF6\uFF08\u89C6\u9891/\u6587\u4EF6\u672A\u5165\u6838\u5FC3\u8BCD\u8868\uFF0C\u56FE\u7247\u53EF\u52FE\uFF09\u3002\u5B98\u65B9 1M \u4E0A\u4E0B\u6587 / 128K \u6700\u5927\u8F93\u51FA\u3002\u6765\u6E90\uFF1Adocs.bigmodel.cn \u6A21\u578B\u9875\u3002"},{id:"glm-5-3",patterns:["glm-5.3"],efforts:{low:"low",high:"high",max:"max"},defaultEffort:"max",compat:{thinkingFormat:"zai",supportsReasoningEffort:!0},input:["text"],contextWindow:1048576,maxTokens:131072,note:"GLM-5.3 \u6863\u4F4D\uFF1ALow / High / Max\uFF08\u5F3A\u5236\u601D\u8003\uFF0C\u5176\u4F59\u503C\u62A5\u9519\uFF09\u3002\u5B98\u65B9\u5BB9\u91CF 1M / 128K\u3002"},{id:"glm-5-2",patterns:["glm-5.2"],efforts:{off:"none",minimal:"minimal",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},defaultEffort:"max",compat:{thinkingFormat:"zai",supportsReasoningEffort:!0},input:["text"],contextWindow:1048576,maxTokens:131072,note:"GLM-5.2 \u6863\u4F4D\uFF1ANone / Minimal / Low / Medium / High / XHigh / Max\uFF08\u5B98\u65B9\u6620\u5C04\uFF1ALow\xB7Medium\u2192High\u3001XHigh\u2192Max\u3001None\xB7Minimal=\u505C\u6B62\u601D\u8003\uFF09\u3002\u89C6\u89C9\u7EBF\u89C1 glm-vision \u6761\u76EE\u3002"},{id:"glm",patterns:["glm","zhipu","chatglm"],efforts:{off:null,high:"high"},defaultEffort:"high",compat:{thinkingFormat:"zai"},input:["text"],note:"GLM \u901A\u7528\uFF1Athinking \u5F00\u5173\uFF08\u65E0 effort \u6863\uFF09\uFF0C\u5F00=High\uFF1Beffort \u9636\u68AF\u4EC5 GLM-5.2+ \u652F\u6301\uFF08\u89C1\u4E0A\u4E24\u6761\u76EE\uFF09\u3002\u6CE8\u610F GLM-4.7/GLM-4.5V \u4E3A\u5F3A\u5236\u601D\u8003\uFF0C\u4F20 disabled \u4F1A\u62A5\u9519\uFF08\u8BF7\u624B\u52A8\u5220 Off \u6863\uFF09\u3002\u89C6\u89C9\u7EBF\u89C1 glm-vision \u6761\u76EE\u3002"},{id:"kimi-k3",patterns:["kimi-k3"],efforts:{low:"low",high:"high",max:"max"},defaultEffort:"max",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,note:"Kimi K3 \u6863\u4F4D\uFF1ALow / High / Max(\u9ED8\u8BA4 Max)\uFF0C\u8D70\u9876\u5C42 reasoning_effort\uFF1B\u59CB\u7EC8\u63A8\u7406\u3001\u52FF\u4F20 thinking \u5BF9\u8C61\u3002\u539F\u751F\u89C6\u89C9\u7406\u89E3\uFF0C1M \u4E0A\u4E0B\u6587\uFF08\u6700\u5927\u8F93\u51FA\u5B98\u65B9\u672A\u5355\u72EC\u5217\uFF0C\u4E0D\u63D0\u4F9B\uFF09\u3002"},{id:"kimi-k2-vision",patterns:["kimi-k2.6","kimi-k2.5"],efforts:{off:null,high:"high"},defaultEffort:"high",compat:{thinkingFormat:"deepseek"},input:["text","image"],contextWindow:262144,note:"Kimi K2.5/K2.6 \u89C6\u89C9\u4EE3\uFF1Athinking.type \u5F00\u5173\uFF08\u9ED8\u8BA4\u5F00\u3001\u53EF\u5173\uFF09\uFF0C\u5F00=High\uFF1B\u5E26\u89C6\u89C9\uFF0C256K\u3002K2.7 Code \u59CB\u7EC8\u601D\u8003\uFF0C\u89C1\u5355\u72EC\u6761\u76EE\u3002"},{id:"kimi-k27-code",patterns:["kimi-k2.7"],efforts:{high:"high"},defaultEffort:"high",compat:{thinkingFormat:"deepseek"},input:["text","image"],contextWindow:262144,note:"Kimi K2.7 Code\uFF08\u542B\u9AD8\u901F\u7248\uFF09\uFF1A\u59CB\u7EC8\u601D\u8003\u2014\u2014thinking.type \u4EC5\u63A5\u53D7 enabled\uFF08\u4F20 disabled \u62A5\u9519\uFF09\uFF0C\u65E0 Off \u6863\uFF1B\u5E26\u89C6\u89C9\uFF0C256K\u3002"},{id:"kimi-for-coding",patterns:["kimi-for-coding"],efforts:{low:"low",high:"high",max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1048576,maxTokens:32768,note:"Kimi for Coding\uFF1AMoonshot \u7F16\u7801\u4E13\u7EBF\u8D70 anthropic-messages \u534F\u8BAE\u3001\u81EA\u9002\u5E94\u601D\u8003\uFF0C\u6863\u4F4D Low / High / Max\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF09\uFF1B\u5E26\u56FE\u8F93\u5165\uFF0C1M \u4E0A\u4E0B\u6587 / 32,768 \u8F93\u51FA\u3002\u9AD8\u901F\u7248\uFF08-highspeed\uFF09\u65E0 effort \u63A7\u4EF6\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF09\u3002"},{id:"kimi-moonshot-v1-vision",patterns:["moonshot-v1-8k-vision","moonshot-v1-32k-vision","moonshot-v1-128k-vision"],efforts:!1,input:["text","image"],note:"Moonshot V1 \u89C6\u89C9\u65E7\u4EE3\uFF088k/32k/128k \u5404\u4E00\uFF09\uFF1A\u65E0\u601D\u8003\u63A7\u4EF6\uFF08\u751F\u6210\u6A21\u578B\uFF09\u3001\u652F\u6301\u56FE\u7247\u8F93\u5165\uFF1B\u8BE5\u7EBF\u5DF2\u505C\u6B62\u5BF9\u65B0\u7528\u6237\u5F00\u653E\uFF082026-08-31 \u5168\u91CF\u4E0B\u7EBF\uFF0C\u7F51\u5173\u6B8B\u7559\u4ECD\u53EF\u547D\u4E2D\uFF09\u3002"},{id:"kimi",patterns:["kimi","moonshot"],efforts:{off:null,high:"high"},compat:{thinkingFormat:"deepseek"},input:["text"],contextWindow:262144,note:"Kimi \u901A\u7528\uFF1Athinking \u5F00\u5173\uFF08\u65E0 effort \u6863\uFF09\uFF0C\u5F00=High\u3002k2 \u7CFB\u5217 2026-05-25 \u4E0B\u7EBF\u3001kimi-latest 2026-01-28 \u4E0B\u7EBF\u3001moonshot-v1 \u7CFB 2026-08-31 \u5168\u91CF\u4E0B\u7EBF\uFF08\u7F51\u5173\u6B8B\u7559\u4ECD\u53EF\u547D\u4E2D\uFF1Bmoonshot-v1 \u672C\u8EAB\u975E\u601D\u8003\u6A21\u578B\uFF09\u3002\u89C6\u89C9\u4EE3\u4E0E K2.7 Code \u89C1\u5355\u72EC\u6761\u76EE\u3002"},{id:"hunyuan-hy3",patterns:["hy3"],efforts:{low:"low",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],contextWindow:262144,note:"\u6DF7\u5143 hy3\uFF1A\u5F00\u6E90\u5951\u7EA6\u7ECF chat_template_kwargs.reasoning_effort = no_think(\u9ED8\u8BA4)/low/high\uFF1B\u5B98\u65B9\u6A21\u578B\u5361 256K \u4E0A\u4E0B\u6587\uFF08295B MoE\uFF0C2026 \u5F00\u6E90\uFF09\u3002"},{id:"hunyuan-hy4",patterns:["hy4-preview","hy-4-preview"],efforts:{off:"no_think",high:"high"},defaultEffort:"high",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},contextWindow:1e6,note:"\u6DF7\u5143 Hy4 preview\uFF1A\u5B98\u65B9 README\u2014\u2014reasoning \u9ED8\u8BA4 high\uFF08\u6DF1\u5EA6\u601D\u8003\uFF09\uFF0C\u5173\u95ED\u7ECF chat_template_kwargs.reasoning_effort=no_think\uFF1B\u5B98\u65B9\u89C4\u683C\u8868 1M \u4E0A\u4E0B\u6587\uFF08770B-A49B MoE\uFF0CGated DSA\uFF09\u3002low \u6863\u5B98\u65B9\u672A\u5217\uFF0C\u5982\u6709\u8BF7\u624B\u8C03\uFF1B\u89C6\u89C9\u672A\u58F0\u660E\uFF0C\u6309\u9700\u624B\u52FE\u3002\u6765\u6E90\uFF1ATencent-Hunyuan/Hy4-preview \u5B98\u65B9 README\u3002"},{id:"step-5-preview",patterns:["step-5"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1e6,maxTokens:65536,note:'\u9636\u8DC3 Step-5-Preview\uFF08\u5B98\u65B9 id \u5373 step-5-preview\uFF0C\u65E0\u88F8 step-5\uFF1Bpattern \u53D6\u5BB6\u65CF\u4E3B\u5E72\u4EE5\u517C\u5BB9\u7F51\u5173\u5199\u6CD5\uFF09\uFF1A\u6863\u4F4D Low / Medium(\u5B98\u65B9\u6807"\u9ED8\u8BA4\u63A8\u8350") / High\uFF0C\u601D\u8003\u4E0D\u53EF\u5173\u95ED\uFF1B\u539F\u751F\u56FE\u7247 + \u89C6\u9891\u8F93\u5165\uFF1B1M \u4E0A\u4E0B\u6587\u300164K \u6700\u5927\u8F93\u51FA\uFF08\u5B98\u65B9\u53E6\u6CE8 max_tokens \u9ED8\u8BA4 INF\u3001\u4E0E 64K \u4E0A\u9650\u5E76\u5B58\uFF0C\u4EE5\u7AEF\u70B9\u5B9E\u6D4B\u4E3A\u51C6\uFF09\u3002'},{id:"step-3-7",patterns:["step-3.7","step-3.6"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:262144,note:"\u9636\u8DC3 Step-3.6/3.7 \u6863\u4F4D\uFF1ALow / Medium(\u9ED8\u8BA4\u63A8\u8350) / High\uFF0C\u539F\u751F\u56FE\u7247+\u89C6\u9891\u7406\u89E3\u3002\u4E0A\u4E0B\u6587\u4E3A\u8F93\u5165+\u8F93\u51FA\u603B\u548C\u4E0A\u9650\u3002"},{id:"step-3-5",patterns:["step-3.5"],efforts:{low:"low",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],contextWindow:262144,note:"\u9636\u8DC3 Step-3.5 Flash \u6863\u4F4D\uFF1ALow / High\uFF08\u7EAF\u6587\u672C\u63A8\u7406\u65D7\u8230\uFF09\u3002\u4E0A\u4E0B\u6587\u4E3A\u8F93\u5165+\u8F93\u51FA\u603B\u548C\u4E0A\u9650\u3002"},{id:"step",patterns:["step-3","step-2"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],note:"\u9636\u8DC3 Step \u6863\u4F4D\uFF1ALow / Medium / High\uFF08\u9ED8\u8BA4 Medium\uFF0C\u4E0D\u53EF\u5173\u95ED\uFF09\u30023.6/3.7 \u89C6\u89C9\u4EE3\u89C1\u5355\u72EC\u6761\u76EE\u3002"},{id:"doubao",patterns:["doubao","seed"],efforts:{off:null,low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],note:"\u8C46\u5305\u6863\u4F4D\uFF1AOff / Low / Medium / High\u2014\u2014effort \u9636\u68AF\u4ECD\u662F\u793E\u533A\u8BC1\u636E\u3001\u5B98\u65B9 Ark \u6587\u6863\u660E\u5217\u7684\u4E3A thinking.type \u5F00\u5173\uFF082026-08-24 \u590D\u6838\u4ECD\u672A\u89C1\u5230 effort \u5B98\u65B9\u660E\u6587\uFF09\u3002seed \u4EE3\u6536\u56FE\uFF081.5-pro \u4F8B\u5916\uFF09\u3002"},{id:"minimax-m2",patterns:["minimax-m2"],efforts:!1,input:["text"],contextWindow:204800,maxTokens:131072,note:"MiniMax-M2 / M2.5\uFF08\u542B -highspeed\uFF09\uFF1A\u65E0\u601D\u8003\u63A7\u4EF6\u3001\u65E0 effort \u53C2\u6570\uFF08M3 \u624D\u5F15\u5165 thinking \u53C2\u6570\uFF09\uFF0C\u7EAF\u6587\u672C\uFF0C204,800 / 131,072\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF1BM3 \u89C1\u4E0B\u6761\uFF09\u3002"},{id:"minimax-m3",patterns:["minimax-m3"],efforts:{off:null,high:"high"},compat:{thinkingFormat:"deepseek"},input:["text","image"],contextWindow:1048576,maxTokens:512e3,note:"MiniMax-M3\uFF1A\u5B98\u65B9 thinking \u53C2\u6570 enabled/adaptive/disabled\uFF08\u65E0 effort \u6863\uFF09\uFF0C\u5F00=High\u3001\u5173=disabled\uFF1B\u539F\u751F\u591A\u6A21\u6001\uFF08\u56FE/\u89C6\u9891\uFF0C\u6838\u5FC3\u8BCD\u8868\u4EC5\u542B\u56FE\uFF09\uFF0C1M \u4E0A\u4E0B\u6587 / 512,000 \u8F93\u51FA\uFF082026-10 \u6821\u51C6\u8865\u5BB9\u91CF\uFF09\u3002"},{id:"mimo-v2-6",patterns:["mimo-v2.6","mimo-v2.5"],efforts:{off:"none",low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,maxTokens:131072,note:"\u5C0F\u7C73 MiMo v2.6 \u7CFB\u5217\uFF08mimo-v2.6-pro / -flash / -pro-ultraspeed\uFF1B1M \u4E0A\u4E0B\u6587 / 128K \u6700\u5927\u8F93\u51FA\u3001\u539F\u751F\u5168\u6A21\u6001\uFF09\u4E0E\u5176\u524D\u4EE3 mimo-v2.5\u3002\u5B98\u65B9\u6587\u6863\uFF1Athinking.type\uFF08enabled/disabled\uFF0C\u9ED8\u8BA4 enabled\uFF09+ reasoning.effort\uFF08none \u5173\u95ED\uFF1B\u5176\u4F59\u5408\u6CD5\u503C\u5747\u5F00\u542F\uFF0C\u4E14**\u73B0\u9636\u6BB5\u6682\u672A\u533A\u5206\u63A8\u7406\u5F3A\u5EA6**\u2014\u2014minimal \u5F52\u4E00\u4E3A low\u3001xhigh/max/ultra \u5F52\u4E00\u4E3A high\uFF09\uFF0C\u56E0\u6B64\u8FD9\u91CC\u58F0\u660E\u7684\u662F\u7AEF\u70B9**\u63A5\u53D7**\u7684\u6863\u4F4D Off / Low / Medium / High\uFF08xhigh\u3001max \u4E0D\u58F0\u660E\uFF0C\u7AEF\u70B9\u53EA\u4F1A\u6298\u53E0\u4E3A high\uFF09\u3002\u601D\u8003\u6A21\u5F0F\u4E0B temperature / top_p \u4E0D\u53EF\u81EA\u5B9A\u4E49\uFF08\u5F3A\u5236 1.0 / 0.95\uFF09\uFF1B\u5E26\u5DE5\u5177\u8C03\u7528\u7684\u5386\u53F2\u8F6E\u5FC5\u987B\u5B8C\u6574\u56DE\u4F20 reasoning_content\uFF0C\u5426\u5219 400\u3002mimo-v2.5 \u4E0E v2.5-pro \u5B98\u65B9\u5B9A\u4E8E 2026-10-21 \u4E0B\u7EBF\u3002"},{id:"mimo-v2-5-pro",patterns:["mimo-v2.5-pro"],efforts:{off:"none",low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],contextWindow:1048576,maxTokens:131072,note:"\u5C0F\u7C73 MiMo v2.5-Pro\uFF1A\u8BE5\u5BB6\u65CF\u552F\u4E00\u7684**\u7EAF\u6587\u672C**\u6210\u5458\uFF08\u5B98\u65B9\u80FD\u529B\u8868\u672A\u5217\u5168\u6A21\u6001\u7406\u89E3\uFF09\uFF0C1M \u4E0A\u4E0B\u6587 / 128K \u6700\u5927\u8F93\u51FA\uFF0C\u63A8\u7406\u5951\u7EA6\u4E0E v2.6 \u7CFB\u5217\u76F8\u540C\uFF08thinking.type + reasoning.effort\uFF0Cnone \u5173\u95ED\u3001\u5176\u4F59\u6863\u4F4D\u6682\u4E0D\u533A\u5206\u5F3A\u5EA6\uFF09\u3002\u5B98\u65B9\u5B9A\u4E8E 2026-10-21 \u4E0B\u7EBF\u3002"},{id:"baidu-ernie",patterns:["ernie"],efforts:!1,input:["text"],contextWindow:131072,note:"\u767E\u5EA6\u5343\u5E06 ERNIE \u7CFB\uFF1A\u5B98\u65B9 OpenAI \u517C\u5BB9\u63A5\u53E3\u65E0 reasoning_effort \u53C2\u6570\u2014\u2014\u601D\u8003\u7531\u6A21\u578B\u53D8\u4F53\u51B3\u5B9A\uFF08-Thinking \u7CFB\u5217\u59CB\u7EC8\u601D\u8003\u3001\u666E\u901A\u7CFB\u5217\u4E0D\u601D\u8003\uFF09\uFF0C\u52FF\u52FE\u601D\u8003\u6863\u3002ERNIE 4.5 Turbo VL \u652F\u6301\u56FE\u7247\uFF0C\u6309\u9700\u624B\u52FE\uFF1B\u53C2\u8003\u5BB9\u91CF\u53D6 Turbo 128K \u6863\u3002"},{id:"fireworks-ember",patterns:["ember-1"],efforts:{off:"none",low:"low",medium:"medium",high:"high",max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1048576,maxTokens:131072,note:"Fireworks ember-1\uFF1Aanthropic-messages \u534F\u8BAE\u81EA\u9002\u5E94\u601D\u8003\uFF0C\u6863\u4F4D None(\u5173) / Low / Medium / High / Max\uFF08off \u663E\u5F0F none \u62FC\u5199\uFF09\uFF1B\u5E26\u56FE\u8F93\u5165\uFF0C1M \u4E0A\u4E0B\u6587 / 131,072 \u8F93\u51FA\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF09\u3002"},{id:"thinkingmachines-inkling",patterns:["inkling"],efforts:{off:"none",minimal:"minimal",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:524288,maxTokens:131072,note:"Thinking Machines Inkling\uFF1A\u5168\u6863 Minimal / Low / Medium(\u9ED8\u8BA4) / High / XHigh / Max\uFF0Coff \u663E\u5F0F none\uFF1B\u5E26\u56FE\u8F93\u5165\uFF0C512K \u4E0A\u4E0B\u6587 / 131,072 \u8F93\u51FA\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF1Btogether \u4E2D\u7EE7\u4FA7 effort \u53C2\u6570\u672A\u5F00\u653E\uFF0C\u9700\u652F\u6301\u65B9\u8F6C\u53D1\uFF09\u3002"},{id:"antling-ring",patterns:["ring-2.6"],efforts:{high:"high",xhigh:"xhigh"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],contextWindow:262144,maxTokens:65536,note:"\u8682\u8681 Ling Ring-2.6-1T\uFF1A\u6863\u4F4D High / XHigh\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF09\uFF1B262,144 / 65,536\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF09\u3002"},{id:"antling-ling",patterns:["ling-2.6"],efforts:!1,input:["text"],note:"\u8682\u8681 Ling-2.6\uFF08\u542B -flash\uFF09\uFF1A\u975E\u601D\u8003\u6A21\u578B\uFF0C\u65E0 effort \u63A7\u4EF6\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF1BRing-2.6 \u601D\u8003\u7EBF\u89C1\u4E0A\u6761\uFF09\u3002"},{id:"openai-gpt-image",patterns:["gpt-image","dall-e","dalle"],efforts:!1,imageGen:!0,note:"OpenAI \u751F\u56FE\u7CFB\uFF08gpt-image-1 / DALL\xB7E 3\uFF09\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"google-imagen",patterns:["imagen","flash-image","pro-image","nano-banana"],efforts:!1,imageGen:!0,note:'Google \u751F\u56FE\u7CFB\uFF08Imagen / Gemini-Image "nano banana"\uFF09\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002'},{id:"black-forest-flux",patterns:["flux"],efforts:!1,imageGen:!0,note:"FLUX \u7CFB\uFF08FLUX.1 schnell/dev/pro \u7B49\uFF09\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"stability-sd",patterns:["stable-diffusion","sdxl","sd3"],efforts:!1,imageGen:!0,note:"Stability \u751F\u56FE\u7CFB\uFF08Stable Diffusion / SDXL / SD3\uFF09\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"zhipu-cogview",patterns:["cogview"],efforts:!1,imageGen:!0,note:"\u667A\u8C31 CogView \u751F\u56FE\u7CFB\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"aliyun-wanx",patterns:["wanx"],efforts:!1,imageGen:!0,note:"\u963F\u91CC\u4E07\u76F8 Wanx \u751F\u56FE\u7CFB\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"bytedance-seedream",patterns:["seedream","seededit"],efforts:!1,imageGen:!0,note:"\u5B57\u8282 Seedream / SeedEdit \u751F\u56FE\u7CFB\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"qwen-image",patterns:["qwen-image"],efforts:!1,imageGen:!0,note:"\u901A\u4E49\u5343\u95EE Qwen-Image \u751F\u56FE\u7CFB\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"midjourney",patterns:["midjourney","niji"],efforts:!1,imageGen:!0,note:"Midjourney / Niji \u751F\u56FE\u7CFB\uFF08\u4E2D\u8F6C\u5E38\u89C1\uFF09\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"}],na={off:null,low:"low",medium:"medium",high:"high"},rg={"openai-completions":na,"openai-responses":na,"anthropic-messages":na,deepseek:{off:"none",low:"low",high:"high",max:"max"}},og={low:"low",medium:"medium",high:"high"};function Hn(e){return(e??"").toLowerCase().trim()}function Dd(e){return e!==void 0&&/[a-z0-9]/.test(e)}function Xt(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g," ").replace(/([a-z])(\d)/g,"$1 $2")}function oa(e,t,n){let r=t===0?void 0:e[t-1],o=e[t+n];return!Dd(r)&&!Dd(o)}function ia(e,t){let n=Xt(e)+" "+Xt(t??""),r;for(let o of ng)for(let i of o.patterns){let a=Xt(i),s=n.indexOf(a);for(;s>=0;){if(oa(n,s,a.length)){(r===void 0||a.length>r.length)&&(r={entry:o,length:a.length});break}s=n.indexOf(a,s+1)}}return r?.entry}var ig={"deepseek.com":"deepseek","anthropic.com":"anthropic-messages"};function ag(e){let t=Hn(e.api);if(t.length>0)return t;let n=e.baseURL;if(n!==void 0&&n.length>0)try{let o=new URL(n).hostname.toLowerCase().split(".");if(o.length>=2){let i=ig[o.slice(-2).join(".")];if(i!==void 0)return i}}catch{}return"openai-completions"}var hr="openai-completions",sg="openai-responses",aa="anthropic-messages";function ra(e){if(e===void 0||e.length===0)return!1;let t="";try{t=new URL(e).hostname.toLowerCase()}catch{return!1}if(t.startsWith("[")){let n=t.slice(1,-1);return n==="::1"||n==="::"||n.startsWith("fe80:")||n.startsWith("fc")||n.startsWith("fd")}return!!(t==="localhost"||t.endsWith(".local")||t.endsWith(".internal")||/^(127\.|10\.|192\.168\.)/.test(t)||/^172\.(1[6-9]|2[0-9]|3[01])\./.test(t))}function dg(e,t){let n=Hn(t),r={...e};if(delete r.supportsMidConvoEffort,delete r.allowedFallbackModels,n===aa){for(let o of["thinkingFormat","supportsReasoningEffort","thinkingTokenBudgetField","supportsThinkingTokenBudget","vllmPriority"])delete r[o];return r.forceAdaptiveThinking===void 0?void 0:{forceAdaptiveThinking:r.forceAdaptiveThinking}}if(n===hr)return delete r.forceAdaptiveThinking,Object.keys(r).length===0?void 0:r}var Fd=["supportsReasoningEffort","thinkingFormat","thinkingTokenBudgetField","supportsThinkingTokenBudget","vllmPriority"],Kd=["forceAdaptiveThinking"];function sa(e,t){let n=Hn(t),r;if(n===hr)r=Kd;else if(n===sg)r=[...Fd,...Kd];else if(n===aa)r=Fd;else return;let o=!1,i={...e};for(let a of r)a in i&&(delete i[a],o=!0);return o?i:void 0}function lg(e,t){let n=Hn(t.api);if(n===hr){let r=e.compat;r!==void 0&&(r=dg(r,n)??void 0);let o=e.efforts!==!1;return r===void 0?o&&ra(t.baseURL)?{thinkingTokenBudgetField:"thinking_token_budget"}:void 0:o&&r.thinkingTokenBudgetField===void 0&&r.supportsThinkingTokenBudget!==!0&&ra(t.baseURL)?{...r,thinkingTokenBudgetField:"thinking_token_budget"}:r}if(n===aa&&e.anthropicAdaptive===!0)return{forceAdaptiveThinking:!0}}var cg=["openai.com","openai.azure.com","deepseek.com","openrouter.ai","z.ai","bigmodel.cn","moonshot.ai","moonshot.cn","aliyuncs.com","anthropic.com","x.ai","together.ai","together.xyz","nvidia.com","cerebras.ai","cloudflare.com","chutes.ai","opencode.ai","ant-ling.com"];function da(e){if(Hn(e.api)!==hr)return!1;let t=e.baseURL;if(t===void 0||t.length===0)return!1;try{let n=new URL(t).hostname.toLowerCase();return n.includes(".")?!cg.some(r=>n===r||n.endsWith("."+r)):!1}catch{return!1}}function qd(e,t,n){return e===void 0||!n||e.supportsDeveloperRole!==void 0||!da(t)?e:{...e,supportsDeveloperRole:!1}}var Bd={off:null,low:"low",medium:"medium",high:"high"},ug=["vl","vision","omni","4o","pixtral","internvl"];function la(e){let t=Xt(e);for(let n of ug){let r=Xt(n),o=t.indexOf(r);for(;o>=0;){if(oa(t,o,r.length))return["text","image"];o=t.indexOf(r,o+1)}}}var fg=["dall-e","dalle","gpt-image","imagen","flux","stable-diffusion","sdxl","sd3","cogview","wanx","seedream","seededit","midjourney","niji","nano-banana","image-gen","imagegen","qwen-image","grok-2-image"];function pg(e){let t=Xt(e);for(let n of fg){let r=Xt(n),o=t.indexOf(r);for(;o>=0;){if(oa(t,o,r.length))return!0;o=t.indexOf(r,o+1)}}return!1}function mg(e){if(e===void 0)return;let t=e.map(n=>n.toLowerCase());if(t.some(n=>tg.includes(n)))return t.includes("image")?["text","image"]:["text"]}function bt(e,t,n){let r=ia(e,t.displayName),o,i,a,s,d;r?.imageGen===!0&&(a=!0),r?.input!==void 0&&(o=r.input,i="knowledge"),r?.contextWindow!==void 0&&(s=r.contextWindow),r?.maxTokens!==void 0&&(d=r.maxTokens);let l=mg(n?.input);l!==void 0&&(o=l,i="endpoint");let c=n?.output;if(c!==void 0&&(a=c.includes("image")&&!c.includes("text")),n?.contextLength!==void 0&&Number.isFinite(n.contextLength)&&n.contextLength>0&&(s=n.contextLength),o===void 0){let L=la(e);L!==void 0&&(o=L,i="heuristic")}a===void 0&&pg(e)&&(a=!0),a===!0&&(o=void 0,i=void 0);let p={...o===void 0?{}:{input:o},...i===void 0?{}:{inputSource:i},...a===void 0?{}:{imageGen:a},...s===void 0?{}:{contextWindow:s},...d===void 0?{}:{maxTokens:d}},m=n===void 0?{}:{endpoint:{reasoning:n.reasoning,source:n.source}};if(n?.reasoning===!1)return{efforts:!1,matched:!1,source:"endpoint:"+(n.source??"listing"),confidence:"high",...m,...p};if(r!==void 0){let L=qd(lg(r,t),t,r.efforts!==!1);return{efforts:r.efforts,...r.efforts!==!1&&r.defaultEffort!==void 0&&r.efforts[r.defaultEffort]!==void 0?{defaultEffort:r.defaultEffort}:{},...L===void 0?{}:{compat:L},matched:!0,entryId:r.id,source:r.id,confidence:"high",...m,...p}}let u=ag(t),f=rg[u]??og,y=Hn(t.api)===hr?{thinkingFormat:"openai",supportsReasoningEffort:!0}:void 0,g=y!==void 0&&ra(t.baseURL)?{...y,thinkingTokenBudgetField:"thinking_token_budget"}:y,E=qd(g,t,!0);return n?.reasoning===!0?{efforts:{...Bd},...Bd.medium!==void 0?{defaultEffort:"medium"}:{},...E===void 0?{}:{compat:E},matched:!1,source:"endpoint:"+(n.source??"listing"),confidence:"medium",...m,...p}:{efforts:f,...f.medium!==void 0?{defaultEffort:"medium"}:{},...E===void 0?{}:{compat:E},matched:!1,source:"protocol:"+u,confidence:"low",...m,...p}}var Dt=(e,t)=>typeof e[t]=="boolean";function gg(e,t){if(Array.isArray(e)){for(let n of e)if($(n)&&n.id===t)return n}}function hg(e){if(!$(e))return{reasoning:"unknown",source:null};let t=e.supported_features;if(Array.isArray(t)&&t.includes("reasoning"))return{...ze(e),reasoning:!0,source:"supported_features"};let n=e.supported_parameters;if(Array.isArray(n)&&(n.includes("reasoning")||n.includes("include_reasoning")||n.includes("reasoning_effort")))return{...ze(e),reasoning:!0,source:"supported_parameters"};if(Dt(e,"supports_reasoning"))return{...ze(e),reasoning:e.supports_reasoning,source:"supports_reasoning"};if(Dt(e,"supportsReasoning"))return{...ze(e),reasoning:e.supportsReasoning,source:"supportsReasoning"};if(Dt(e,"can_reason"))return{...ze(e),reasoning:e.can_reason,source:"can_reason"};if(Dt(e,"reasoning"))return{...ze(e),reasoning:e.reasoning,source:"reasoning"};let r=e.reasoning_effort;if(r===!1)return{...ze(e),reasoning:!1,source:"reasoning_effort"};if(typeof r=="string"&&r.trim().length>0||e.supports_reasoning_effort===!0)return{...ze(e),reasoning:!0,source:"reasoning_effort"};let o=$(e.capabilities)?e.capabilities:void 0;if(o!==void 0){let i=o.thinking,a=$(i)&&typeof i.supported=="boolean"?i.supported:void 0,s=o.effort,d=$(s)&&typeof s.supported=="boolean"?s.supported:void 0;if(d===!0)return{...ze(e),reasoning:!0,source:"capabilities.effort.supported"};if(a===!0)return{...ze(e),reasoning:!0,source:"capabilities.thinking.supported"};if(a===!1)return{...ze(e),reasoning:!1,source:"capabilities.thinking.supported"};if(d===!1)return{...ze(e),reasoning:!1,source:"capabilities.effort.supported"}}return{...ze(e),reasoning:"unknown",source:null}}function ze(e){let t={},n=s=>{if(!Array.isArray(s))return;let d=s.filter(l=>typeof l=="string");return d.length>0?d.map(l=>l.toLowerCase()):[]},r=$(e.architecture)?e.architecture:void 0,o=n(r?.input_modalities);if(o===void 0&&(o=n(e.input_modalities)),o===void 0){let s=$(e.modalities)?e.modalities:void 0;o=n(s?.input)}if(o===void 0){let s=e.capabilities,d=l=>Array.isArray(l)&&l.some(c=>typeof c=="string"&&c.toLowerCase()==="vision");if(d(e.supported_features)||d(s))o=["image"];else if($(s)){let l=[];for(let c of["image_input","video_input","pdf_input","file_input"]){let p=$(s[c])?s[c]:void 0;if(p===void 0||typeof p.supported!="boolean")continue;let m=c.replace(/_input$/,"");p.supported===!0?l.push(m):l.length===0&&l.push("text")}l.length>0&&(o=l)}}o===void 0&&(Dt(e,"supports_vision")?o=e.supports_vision===!0?["image"]:[]:Dt(e,"supportsVision")?o=e.supportsVision===!0?["image"]:[]:(Dt(e,"supports_images")||Dt(e,"supportsImages"))&&(o=e.supports_images===!0||e.supportsImages===!0?["image"]:[])),o!==void 0&&(t.input=o.length===0?["text"]:o);let i=n(r?.output_modalities);if(i===void 0&&(i=n(e.output_modalities)),i===void 0){let s=$(e.modalities)?e.modalities:void 0;i=n(s?.output)}i!==void 0&&(t.output=i);let a=e.context_length;if(typeof a=="number"&&Number.isFinite(a)&&a>0)t.contextLength=a;else{let d=($(e.top_provider)?e.top_provider:void 0)?.context_length;if(typeof d=="number"&&Number.isFinite(d)&&d>0)t.contextLength=d;else{let l=e.max_input_tokens;if(typeof l=="number"&&Number.isFinite(l)&&l>0)t.contextLength=l;else{let p=($(e.limit)?e.limit:void 0)?.context;typeof p=="number"&&Number.isFinite(p)&&p>0&&(t.contextLength=p)}}}return t}function Wd(e,t){let n=gg(e,t);return n===void 0?{found:!1,signal:{reasoning:"unknown",source:null}}:{found:!0,signal:hg(n)}}function _e(e){let n=e?.value?.providers;return typeof n!="object"||n===null||Array.isArray(n)?{}:Object.fromEntries(Object.entries(n).filter(([,r])=>typeof r=="object"&&r!==null&&!Array.isArray(r)))}function fo(e){if(!$(e))return;let t=e.providers;return $(t)?t:void 0}function jd(e,t){for(let n of[e?.user,e?.base]){let r=fo(n)?.[t];if($(r)&&r.models!==void 0)return r.models}}function Qt(e){return fo(e?.user)}function po(e,t){let n=e.find(o=>o.id===t);if(n===void 0)return;let r=n.reasoningEfforts;if(r===!1)return!1;if(typeof r=="object"&&r!==null&&!Array.isArray(r))return r}function mo(e,t){let r=e.find(i=>i.id===t)?.input;if(!Array.isArray(r))return;let o=r.filter(i=>typeof i=="string");return o.length>0?o:void 0}function go(e,t){let r=e.find(o=>o.id===t)?.compat;if($(r))return{...r}}function ua(e,t){return e.find(r=>r.id===t)?.[tt]===!0}function ho(e,t){let r=e.find(o=>o.id===t)?.name;return typeof r=="string"&&r.length>0?r:void 0}function bo(e,t){let r=e.find(o=>o.id===t)?.[wn];return typeof r=="string"&&r.length>0?r:void 0}var bg=3e4,yg=15e3,ca=new Map,uo=new Map;async function vg(e){let t=ca.get(e);if(t!==void 0&&Date.now()-t.at<bg)return t.data;let n=uo.get(e);if(n!==void 0)return n;let r=(async()=>{try{let o=await fetch(`${od}?route=${encodeURIComponent(e)}`,{method:"GET",signal:AbortSignal.timeout(yg)});if(!o.ok)return;let i=await o.json();return i?.ok?(ca.set(e,{at:Date.now(),data:i.data}),i.data):void 0}catch{return}finally{uo.delete(e)}})();return uo.set(e,r),r}function fa(){ca.clear(),uo.clear()}async function wg(e,t){let n=await vg(e);return n===void 0?{reasoning:"unknown",source:null}:Wd(n,t).signal}function yo(e,t=()=>de(e),n,r,o,i){return{async suggest(a,s,d,l){let c=_e((await t()).namespace),p=Jt(c,a),m={api:p.api??l?.api,baseURL:p.baseURL??l?.baseURL,displayName:d??p.displayName},u=c[a]===void 0?void 0:await wg(a,s),f=bt(s,m,u);return f.efforts===void 0?{ok:!1,error:"no-suggestion"}:{ok:!0,suggestion:{efforts:f.efforts,...f.compat===void 0?{}:{compat:f.compat},...f.defaultEffort===void 0?{}:{defaultEffort:f.defaultEffort},...f.input===void 0?{}:{input:f.input},...f.inputSource===void 0?{}:{inputSource:f.inputSource},...f.imageGen===void 0?{}:{imageGen:f.imageGen},...f.contextWindow===void 0?{}:{contextWindow:f.contextWindow},...f.maxTokens===void 0?{}:{maxTokens:f.maxTokens},matched:f.matched,source:f.source,confidence:f.confidence,...f.endpoint===void 0?{}:{endpoint:f.endpoint}}}},commit(a,s,d){if(i?.()===!0){n?.(a,s,d.efforts,d.compat,d.input,d.defaultEffort,d.imageGen);return}r?.(a,s,{efforts:d.efforts,...d.compat===void 0?{}:{compat:d.compat},...d.input===void 0?{}:{input:d.input},...d.imageGen===void 0?{}:{imageGen:d.imageGen},...d.defaultEffort===void 0?{}:{defaultEffort:d.defaultEffort}})},withdraw(a,s){o?.(a,s)},stageEfforts(a,s,d,l,c,p,m){n?.(a,s,d,l,c,p,m)},async writeEfforts(a,s,d,l,c,p,m){if(r!==void 0)return r(a,s,{efforts:d,...l===void 0?{}:{compat:l},...c===void 0?{}:{input:c},...m===void 0?{}:{imageGen:m},...p===void 0?{}:{defaultEffort:p}}),{ok:!0,staged:!0};let f=(await br(e,a,[{modelId:s,efforts:d,...l===void 0?{}:{compat:l},...c===void 0?{}:{input:c},...m===void 0?{}:{imageGen:m},...p===void 0?{}:{defaultEffort:p}}],t))[0]??{ok:!1,error:"no-result"};return f.ok?{ok:!0}:f.modelNotFound===!0?{ok:!1,error:"model-not-found"}:{ok:!1,error:f.error??"conflict"}}}}async function br(e,t,n,r=()=>de(e),o){if(n.length===0)return[];let i=!1;for(let a=0;a<3;a++)try{let s=a===0?await r():await de(e,{fresh:!0});if(s.namespace===void 0)return n.map(()=>({ok:!1,error:"no-namespace"}));let d=jd(s.namespace,t);if(!Array.isArray(d))return n.map(()=>({ok:!1,modelNotFound:!0}));if(!d.every($))return n.map(()=>({ok:!1,error:"invalid-models"}));let c=d.map(u=>u),p=[];for(let u of n){let f=c.findIndex(y=>y.id===u.modelId);if(f<0){p.push(u.modelId);continue}c[f]=xg(c[f],u,i?void 0:u.compat)}if(p.length>0)return n.map(u=>p.includes(u.modelId)?{ok:!1,modelNotFound:!0}:{ok:!1,error:"model-not-found"});if(o?.()===!0)return n.map(()=>({ok:!1,aborted:!0}));let m=await e.settings.mutate(Ce,[{op:"set",path:["providers",t,"models"],value:c}],s.namespace.revision);if(!m.ok){if(a===0&&m.error.code==="settings/conflict")continue;let u=m.error.code==="settings/rejected"&&_d(m.error.message);if(!i&&u&&n.some(f=>f.compat!==void 0)){i=!0;continue}return n.map(()=>({ok:!1,error:m.error.message}))}return n.map(()=>({ok:!0}))}catch(s){return n.map(()=>({ok:!1,error:s instanceof Error?s.message:String(s)}))}return n.map(()=>({ok:!1,error:"conflict"}))}function xg(e,t,n){let r={...e},o=t.efforts!=="keep",i=t.efforts==="keep"?void 0:t.efforts;if(o)if(i===void 0)delete r.reasoningEfforts,r[et]=!0;else if(delete r[et],delete r[vn],i===!1)r.reasoningEfforts=!1;else{r.reasoningEfforts={...i};let s={...$(e.compat)?e.compat:{},...n??{}};Object.keys(s).length>0&&(r.compat=s)}return t.input!==void 0&&(t.input===null?(delete r.input,r[ht]=!0):(delete r[ht],r.input=[...t.input])),t.imageGen!==void 0&&(t.imageGen===!0?(r[tt]=!0,delete r.input,delete r[ht]):delete r[tt]),t.defaultEffort!==void 0&&(t.defaultEffort===null?delete r[wn]:r[wn]=t.defaultEffort),r}function pa(e,t){for(let n of[e?.user,e?.base]){let r=fo(n)?.[t];if(!$(r))continue;let o=r.headers;if(o===void 0)continue;if(!$(o))return;let i={};for(let[a,s]of Object.entries(o))typeof s=="string"&&(i[a]=s);return i}}async function yr(e,t,n){if(typeof t!="string"||t.length===0)return{ok:!1,error:"no-route"};let r=!1;for(let o=0;o<2;o+=1)try{let i=o===0?await de(e):await de(e,{fresh:!0});if(i.namespace===void 0)return{ok:!1,error:"no-namespace"};if(i.writable!==!0)return{ok:!1,error:"read-only"};if(!nt(i.namespace,t)){r=!0;continue}let a=await e.settings.mutate(Ce,[{op:"set",path:["providers",t,"headers"],value:{...n}}],i.namespace.revision);if(!a.ok){if(o===0&&a.error.code==="settings/conflict")continue;return{ok:!1,error:a.error.message}}return{ok:!0}}catch(i){return{ok:!1,error:i instanceof Error?i.message:String(i)}}return r?{ok:!1,error:"no-route"}:{ok:!1,error:"conflict"}}function nt(e,t){if(Object.prototype.hasOwnProperty.call(_e(e),t))return!0;for(let n of[e?.user,e?.base]){let r=fo(n);if(r!==void 0&&Object.prototype.hasOwnProperty.call(r,t))return!0}return!1}async function de(e,t={}){let n=t.fresh===!0?void 0:kg(e,t.allowStale===!0);if(n!==void 0)return n;let r=await e.settings.describe();return r.ok?{namespace:r.value.namespaces.find(i=>i.ns===Ce),writable:r.value.writable,source:"wire"}:{namespace:void 0,writable:!1,source:"wire"}}var Ud=new WeakMap;function kg(e,t=!1){let n=e.scope;if(n===void 0)return;let r=n.getSnapshot();if(r===void 0)return;if(r.status==="ready"&&typeof r.revision=="number"){let i={namespace:{ns:Ce,schema:{},value:r.value,user:r.user,base:r.base,revision:r.revision,applies:"live",secrets:[]},writable:r.writable===!0,source:"scope"};return Ud.set(n,i),i}if(!t||n===void 0)return;let o=Ud.get(n);if(o!==void 0)return{...o,source:"scope-stale"}}var ma=new Map;function zd(e){let t=ma,n=!1,r,o=0,i=new Set,a=()=>{for(let d of[...i])d()},s=()=>{if(n)return Promise.resolve();if(r!==void 0)return r;let d=o;return r=de(e,{fresh:!0}).then(l=>{if(d!==o||l.namespace===void 0)return;let c=new Map;for(let[p,m]of Object.entries(_e(l.namespace))){let u=new Map,f=Array.isArray(m.models)?m.models:[];for(let y of f){if(!$(y)||typeof y.id!="string"||y.id.length===0)continue;let g={};if(Array.isArray(y.input)){let L=y.input.filter(w=>typeof w=="string");L.length>0&&(g.input=L)}y[tt]===!0&&(g.imageGen=!0);let E=y.contextWindow;typeof E=="number"&&Number.isFinite(E)&&E>0&&(g.contextWindow=E),(g.input!==void 0||g.imageGen!==void 0||g.contextWindow!==void 0)&&u.set(y.id,g)}u.size>0&&c.set(p,u)}t=c,n=!0,a()}).catch(()=>{}).finally(()=>{d===o&&(r=void 0)}),r};return{getSnapshot:()=>t,subscribe(d){return i.add(d),()=>{i.delete(d)}},load:s,invalidate(){o+=1,n=!1,r=void 0,i.size>0&&s()}}}var Eg=new Intl.NumberFormat("en-US"),Tg=/^(\d+(?:\.\d+)?)([kmbt])?$/i,Sg={k:1e3,m:1e6,b:1e9,t:1e12};function yt(e){let t=e.replace(/[,_\s]/g,"");if(t==="")return;let n=Tg.exec(t);if(n===null)return;let r=n[2]===void 0?1:Sg[n[2].toLowerCase()],o=Math.round(Number(n[1])*r);return Number.isFinite(o)&&o>0?o:void 0}function ut(e){return e===void 0?"":Eg.format(e)}function $d(e){if(e===void 0||!Number.isFinite(e)||e<=0)return"";let t=1024,n=t*1024,r=n*1024,o=r*1024,i=s=>Number.isInteger(s)?String(s):s.toFixed(1).replace(/\.0$/,""),a=[{floor:1e12,binary:o,decimal:1e12,suffix:"T"},{floor:1e9,binary:r,decimal:1e9,suffix:"B"},{floor:1e6,binary:n,decimal:1e6,suffix:"M"},{floor:1e3,binary:t,decimal:1e3,suffix:"K"}];for(let s of a){if(e<s.floor)continue;if(e%s.binary===0)return`${e/s.binary}${s.suffix}`;if(e%s.decimal===0)return`${e/s.decimal}${s.suffix}`;let d=u=>Math.round(u*10)/10,l=e/s.binary,c=e/s.decimal,p=Math.abs(e-d(l)*s.binary),m=Math.abs(e-d(c)*s.decimal);return p<=m?`${i(l)}${s.suffix}`:`${i(c)}${s.suffix}`}return String(e)}var Yd="dsh-model-think-level.slider.efforts",ga="breSelectWired",Mg=400;function Lg(e){return e===void 0?Promise.resolve(void 0):new Promise(t=>{let n=!1,r=i=>{n||(n=!0,t(i))},o=setTimeout(()=>r(void 0),Mg);e.then(i=>{clearTimeout(o),r(i)},()=>{clearTimeout(o),r(void 0)})})}function ha(e){return typeof e=="object"&&e!==null&&e.ok===!1}function ba(e){if(!ha(e))return;let t=e.error,n=typeof t?.code=="string"?t.code:"settings/rejected",r=typeof t?.message=="string"?t.message:"";return r.length>0?`${n}: ${r}`:n}function Zt(e,t){return`${e}/${t}`}function Jd(){try{let e=window.localStorage.getItem(Yd);if(e===null)return{};let t=JSON.parse(e);if(typeof t!="object"||t===null||Array.isArray(t))return{};let n={};for(let[r,o]of Object.entries(t))r.length>0&&typeof o=="string"&&o.trim().length>0&&(n[r]=o);return n}catch{return{}}}function Ag(e){try{window.localStorage.setItem(Yd,JSON.stringify(e))}catch{}}function Rg(e,t,n){let r=Jd();r[Zt(e,t)]=n,Ag(r)}function Cg(e,t){return Jd()[Zt(e,t)]}function vo(e,t,n){let o=e.groups.find(i=>i.id===t)?.models.find(i=>i.id===n)?.reasoning?.efforts;return o===void 0?[]:o.map(i=>i.id)}function Hg(e,t,n){return e.groups.find(o=>o.id===t)?.models.find(o=>o.id===n)?.reasoning?.defaultEffort}function Ng(e){if(!(e.length<2))return e[Math.floor((e.length-1)/2)]}function Og(e,t){return e===null||e.provider!==t.provider||e.model!==t.model}async function Vd(e,t,n,r,o){let i=vo(e,t,n);if(i.length===0)return;let a=Zt(t,n),s=r.get(a);if(s!==void 0&&i.includes(s))return s;let d=await Lg(o?.configuredEffort===void 0?void 0:o.configuredEffort(t,n));if(d!==void 0&&i.includes(d))return d;let l=Cg(t,n);if(l!==void 0&&i.includes(l))return l;let c=bt(n,{}).defaultEffort;if(c!==void 0&&i.includes(c))return c;let p=Hg(e,t,n);return p!==void 0&&i.includes(p)?p:Ng(i)}function Xd(e,t){let n=e;if(n[ga]===!0)return()=>{};let r=Object.prototype.hasOwnProperty.call(n,"select"),o=e.select,i=new Map,a=new Set,s=new Map,d=3,l=0,c=0,p=async(y,g)=>{if(g.reasoningEffort!==void 0){let D=await o.call(e,g);return!ha(D)&<()&&(i.set(Zt(g.provider,g.model),g.reasoningEffort),Rg(g.provider,g.model,g.reasoningEffort)),D}let E=e.store.getSnapshot();if(!Og(E.current,g)){if(lt()){let D=Zt(g.provider,g.model);i.delete(D),a.add(D)}return o.call(e,g)}if(!lt())return o.call(e,g);let L=await Vd(E,g.provider,g.model,i,t);if(l!==y)return;let w=e.store.getSnapshot(),H=w.current!==null&&w.current.provider===g.provider&&w.current.model===g.model;return!lt()||L===void 0||!vo(w,g.provider,g.model).includes(L)?H?void 0:o.call(e,g):o.call(e,{...g,reasoningEffort:L})},m=async y=>{let g=++l;try{return await p(g,y)}finally{g>c&&(c=g)}},u=()=>{let y=e.store.getSnapshot(),g=y.current;if(g===null||g.reasoningEffort!==void 0||!lt())return;let E=Zt(g.provider,g.model);if(a.has(E))return;if(vo(y,g.provider,g.model).length===0){a.add(E);return}a.add(E);let L=l;Vd(y,g.provider,g.model,i,t).then(async w=>{if(w===void 0){a.delete(E);return}if(!lt()){a.delete(E);return}if(l!==L)return;if(l!==c){a.delete(E);return}let H=e.store.getSnapshot(),D=H.current;if(D===null||D.reasoningEffort!==void 0||Zt(D.provider,D.model)!==E||!vo(H,D.provider,D.model).includes(w))return;let te=await o.call(e,{provider:D.provider,model:D.model,reasoningEffort:w});if(ha(te))throw te}).catch(()=>{let w=(s.get(E)??0)+1;s.set(E,w),w<d&&(a.delete(E),u())})},f=e.store.subscribe(u);return u(),n[ga]=!0,e.select=m,()=>{delete n[ga],f(),r?e.select=o:delete n.select}}var Ig=1e4;function Qd(e){if(e.current===null)return[];let r=e.groups.find(o=>o.id===e.current?.provider)?.models.find(o=>o.id===e.current?.model)?.reasoning?.efforts;return r!==void 0&&r.length>=2?r:[]}function Pg(e){return e.current}function Zd(e,t){let n=Pg(t),r=e.findIndex(s=>s.id===n?.reasoningEffort);if(r>=0)return r;let i=t.groups.find(s=>s.id===n?.provider)?.models.find(s=>s.id===n?.model)?.reasoning?.defaultEffort,a=i===void 0?-1:e.findIndex(s=>s.id===i);return a>=0?a:Math.floor((e.length-1)/2)}function _g(e){return e?.models??[]}function Ft(e){let t=e;return t.name??t.label??t.title??e.id}function ya(e){if(typeof document>"u"||!e.isConnected||e.getClientRects().length===0)return!1;let t=e.getBoundingClientRect();return t.width>0||t.height>0}function Dg(){let[e,t]=(0,A.useState)(null),n=(0,A.useRef)(0),r=(0,A.useCallback)(()=>{window.clearTimeout(n.current),t(null)},[]),o=(0,A.useCallback)((i,a)=>{window.clearTimeout(n.current);let s=i.currentTarget;s.scrollWidth<=s.clientWidth+1||(n.current=window.setTimeout(()=>{ya(s)&&(s.scrollWidth<=s.clientWidth+1||t({target:s,text:a}))},300))},[]);return(0,A.useEffect)(()=>()=>{window.clearTimeout(n.current),t(null)},[]),(0,A.useEffect)(()=>{if(e===null)return;let i=e.target,a=()=>{t(null)};window.addEventListener("pointerdown",a,!0),window.addEventListener("keydown",a,!0),window.addEventListener("scroll",a,!0),window.addEventListener("wheel",a,{capture:!0,passive:!0}),window.addEventListener("resize",a);let s=typeof MutationObserver>"u"?null:new MutationObserver(()=>{ya(i)||a()});return s?.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden"]}),()=>{window.removeEventListener("pointerdown",a,!0),window.removeEventListener("keydown",a,!0),window.removeEventListener("scroll",a,!0),window.removeEventListener("wheel",a,!0),window.removeEventListener("resize",a),s?.disconnect()}},[e]),{tip:e,onEnter:o,onLeave:r}}function Fg({state:e}){if(typeof document>"u")return null;let t=e.target;if(!ya(t))return null;let n=t.getBoundingClientRect();if(n.top>window.innerHeight||n.bottom<0)return null;let r=Math.max(12,Math.min(n.right,window.innerWidth-12));return(0,nl.createPortal)((0,A.createElement)("div",{className:"bre-tip",role:"tooltip",style:{top:Math.min(n.bottom+6,window.innerHeight-40),right:Math.max(12,window.innerWidth-r)}},e.text),document.body)}var el=new Map;function Kg(e,t){let n=t??e.input;if(Array.isArray(n)&&n.length>0)return n.includes("image");let r=JSON.stringify([e.id,e.name]),o=el.get(r);if(o!==void 0)return o;let i=ia(e.id,e.name)?.input,a=i!==void 0?i.includes("image"):(la(e.id)??[]).includes("image");return el.set(r,a),a}function tl(e,t){return t?.imageGen===!0?!0:e.inputImageGen===!0}function qg(e){let t=e.reasoning?.efforts;return Array.isArray(t)&&t.length>0}function Bg(e){return(0,A.createElement)("svg",{className:"bre-tag-icon",width:13,height:13,viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":e},(0,A.createElement)("path",{d:"M1.8 8s2.4-4.2 6.2-4.2S14.2 8 14.2 8s-2.4 4.2-6.2 4.2S1.8 8 1.8 8z",stroke:"currentColor",strokeWidth:1.3,strokeLinejoin:"round"}),(0,A.createElement)("circle",{cx:8,cy:8,r:1.8,fill:"currentColor"}))}function Gg(e){return(0,A.createElement)("svg",{className:"bre-tag-icon",width:13,height:13,viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":e},(0,A.createElement)("path",{d:"M8 1.9l1.35 3.75L13.1 7l-3.75 1.35L8 12.1 6.65 8.35 2.9 7l3.75-1.35z",fill:"currentColor"}))}function Wg(e){return(0,A.createElement)("svg",{className:"bre-tag-icon",width:13,height:13,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":e},(0,A.createElement)("path",{d:"M9.4 12.7H3.6a1.7 1.7 0 0 1-1.7-1.7V5.1a1.7 1.7 0 0 1 1.7-1.7h4.2"}),(0,A.createElement)("path",{d:"M2.6 10.6 5.3 8.5l1.8 1.5 1.6-1.3 2.3 2"}),(0,A.createElement)("path",{d:"M12.4 2.2l.75 2.05L15.2 5l-2.05.75L12.4 7.8l-.75-2.05L9.6 5l2.05-.75Z",fill:"currentColor",stroke:"none"}))}var Ug=["#22c55e","#a3e635","#eab308","#f97316","#ef4444"],ok=Ug.map(e=>[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]);function jg(e,t,n,r=!1){let o=[];return Kg(e,n)&&o.push((0,A.createElement)("span",{key:"vision",className:"bre-tag",title:t("tagVision")},Bg(t("tagVision")))),qg(e)&&o.push((0,A.createElement)("span",{key:"thinking",className:"bre-tag",title:t("tagThinking")},Gg(t("tagThinking")))),r&&o.push((0,A.createElement)("span",{key:"imageGen",className:"bre-tag",title:t("tagImageGen")},Wg(t("tagImageGen")))),o.length===0?null:(0,A.createElement)("span",{className:"bre-option-tags"},...o)}function zg(e,t){let n=$d(e);return n===""?null:(0,A.createElement)("span",{className:"bre-option-cap",title:t("contextWindowLabel")},n)}function rl(e){let{directory:t,t:n,configuredInputs:r}=e,o=(0,A.useSyncExternalStore)(k=>t.store.subscribe(k),()=>t.store.getSnapshot()),i=(0,A.useSyncExternalStore)(k=>r?.subscribe(k)??(()=>{}),()=>r?.getSnapshot()??ma),a=Qd(o),[s,d]=(0,A.useState)(()=>{let k=t.store.getSnapshot(),B=Qd(k);return B[Zd(B,k)]?.id??""}),[l,c]=(0,A.useState)(""),[p,m]=(0,A.useState)(null),[u,f]=(0,A.useState)(!1),[y,g]=(0,A.useState)(null),E=(0,A.useRef)(null),L=(0,A.useRef)(""),w=(0,A.useRef)(!1),H=o.current!==null&&a.length>=2,D=u,te=y??o.error,U=t.select,v=(0,A.useCallback)(()=>setTimeout(()=>{w.current&&(w.current=!1,f(!1),g(n("sliderCommitSlow")))},Ig),[n]);(0,A.useLayoutEffect)(()=>{if(w.current||se.current)return;let k=Zd(a,o),B=a[k]?.id??"";L.current=B,d(ce=>ce===B?ce:B),g(null)},[H,a,o]),(0,A.useEffect)(()=>{t.load().catch(()=>{})},[t]),(0,A.useEffect)(()=>{r?.load().catch(()=>{})},[r]);let b=o.current,N=o.groups.find(k=>k.id===b?.provider),T=N?.models.find(k=>k.id===b?.model)?.name??(b===null?n("triggerFallback"):b.model),O=b===null?"":Ft(N??{id:b.provider}),K=a.find(k=>k.id===s)?.name??n("effortDefault"),G=(0,A.useSyncExternalStore)(Tn,En),j=(0,A.useSyncExternalStore)(Ln,lr),h=(0,A.useSyncExternalStore)(An,cr),S=(0,A.useCallback)((k,B)=>i.get(k)?.get(B),[i]),I=(0,A.useCallback)((k,B)=>tl(B,S(k,B.id)),[S]),_=(0,A.useCallback)((k,B)=>_g(k).filter(ce=>!I(B,ce)),[I]),ee=o.groups.filter(k=>_(k,k.id).length>0&&!j.includes(k.id)).map(k=>k.id),Z=Sn(qi(ee),G),oe=p!==null&&Z.includes(p)?p:b!==null&&Z.includes(b.provider)?b.provider:Z[0]??null,re=l.trim().toLowerCase(),X=re!=="",ue=X?Z.flatMap(k=>Vi(_(o.groups.find(B=>B.id===k),k),h[k]??[]).filter(B=>(B.name??B.id).toLowerCase().includes(re)||B.id.toLowerCase().includes(re)).map(B=>({provider:k,choice:B}))):[],ke=X?ue:oe===null?[]:Vi(_(o.groups.find(k=>k.id===oe),oe),h[oe]??[]).map(k=>({provider:oe,choice:k})),Se=b===null?"":b.provider+"/"+b.model,Ae=n("sliderNoCurrent"),V=(0,A.useCallback)(()=>{let k=E.current?.closest('[role="menu"], [role="group"]');k!=null&&(k.tabIndex=-1,k.focus({preventScroll:!0}))},[]),P=(0,A.useCallback)(async(k,B)=>{if(w.current)return;let ce=t.store.getSnapshot().current;if(X&&c(""),ce!==null&&ce.provider===k&&ce.model===B)return;w.current=!0,V(),f(!0),g(null);let Be=v();try{let Ge=await U({provider:k,model:B}),dt=ba(Ge);if(dt!==void 0)throw new Error(dt)}catch(Ge){g(Ge instanceof Error?Ge.message:String(Ge))}finally{clearTimeout(Be),w.current=!1,f(!1)}},[v,t,V,X,U]),z=(0,A.useCallback)(async k=>{if(w.current||k===o.current?.reasoningEffort&&o.status!=="error")return;w.current=!0;let B=L.current;V(),f(!0),g(null),d(k);let ce=v();try{let Be=o.current;if(Be===null)throw new Error(n("sliderNoCurrent"));let Ge=await U({provider:Be.provider,model:Be.model,reasoningEffort:k}),dt=ba(Ge);if(dt!==void 0)throw new Error(dt);let Yt=t.store.getSnapshot(),nd=a.find(Im=>Im.id===Yt.current?.reasoningEffort)?.id??k;L.current=nd,d(nd)}catch(Be){L.current=B,d(B),g(Be instanceof Error?Be.message:String(Be))}finally{clearTimeout(ce),w.current=!1,f(!1)}},[v,t,V,a,U,o.current,o.status,n]),J=(0,A.useRef)(null),me=(0,A.useRef)(null),ve=(0,A.useRef)(null),se=(0,A.useRef)(!1),be=(0,A.useRef)(null),Oe=(0,A.useRef)(null),Re=(0,A.useRef)(null),[Nt,Ze]=(0,A.useState)(null),[M,Y]=(0,A.useState)(null),ie=Math.max(0,a.findIndex(k=>k.id===s)),ge=Nt??ie,we=(M??(a.length>1?ge/(a.length-1):0))*100,le=k=>{let B=J.current;if(B===null)return 0;let ce=B.getBoundingClientRect();return ce.width<=0?0:Math.min(1,Math.max(0,(k-ce.left)/ce.width))},Le=k=>a.length>1?Math.round(k*(a.length-1)):0,qe=k=>{Oe.current=k;let B=k*100;me.current!==null&&(me.current.style.clipPath=`inset(0 ${100-B}% 0 0)`),ve.current!==null&&(ve.current.style.left=`${B}%`)},st=k=>{if(a.length===0)return;let B=le(k);Re.current===null&&(Re.current=requestAnimationFrame(()=>{Re.current=null,se.current&&Oe.current!==null&&qe(Oe.current)})),Oe.current=B;let ce=Le(B);ce!==be.current&&(be.current=ce,Ze(ce),Y(B))},$t=()=>{be.current=null,Oe.current=null,Re.current!==null&&(cancelAnimationFrame(Re.current),Re.current=null),Ze(null),Y(null)},bn=k=>{if(H){if(k.preventDefault(),se.current=!0,typeof k.currentTarget.setPointerCapture=="function")try{k.currentTarget.setPointerCapture(k.pointerId)}catch{}be.current=Le(le(k.clientX)),st(k.clientX),Ze(be.current),Y(Oe.current)}},Ee=k=>{se.current&&st(k.clientX)},Jr=k=>{if(!se.current)return;if(se.current=!1,typeof k.currentTarget.releasePointerCapture=="function"&&k.currentTarget.hasPointerCapture?.(k.pointerId)===!0)try{k.currentTarget.releasePointerCapture(k.pointerId)}catch{}let B=Le(le(k.clientX)),ce=a[B];if(ce===void 0){$t();return}z(ce.id).finally($t)},Hi=k=>{if(!H)return;let B;if(k.key==="ArrowRight"||k.key==="ArrowUp"?B=Math.min(a.length-1,ge+1):k.key==="ArrowLeft"||k.key==="ArrowDown"?B=Math.max(0,ge-1):k.key==="Home"?B=0:k.key==="End"&&(B=a.length-1),B===void 0)return;k.preventDefault();let ce=a[B];ce!==void 0&&z(ce.id)},{tip:yn,onEnter:Vt,onLeave:ar}=Dg(),Xr=(0,A.createElement)("div",{className:"bre-menu-head"},(0,A.createElement)("span",{className:"bre-row-label"},n("modelRowLabel")),(0,A.createElement)("span",{className:"bre-menu-cur"},(0,A.createElement)("span",{className:"bre-menu-name","aria-label":b===null?T:O+" \xB7 "+T,onMouseEnter:k=>{Vt(k,b===null?T:O+" \xB7 "+T)},onMouseLeave:ar},T),O===""?null:(0,A.createElement)("span",{className:"bre-menu-prov"},O))),C=(0,A.createElement)("div",{className:"bre-menu-search"},(0,A.createElement)("div",{className:"bre-menu-search-box"},(0,A.createElement)("span",{className:"bre-menu-search-icon","aria-hidden":!0},(0,A.createElement)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,A.createElement)("circle",{cx:"7",cy:"7",r:"4.5"}),(0,A.createElement)("path",{d:"M10.5 10.5L14 14",strokeLinecap:"round"}))),(0,A.createElement)("input",{type:"text",className:"bre-menu-search-input",role:"searchbox",placeholder:n("modelSearchPlaceholder"),"aria-label":n("modelSearchPlaceholder"),value:l,spellCheck:!1,autoComplete:"off",onChange:k=>{c(k.currentTarget.value)},onKeyDown:k=>{k.key!=="Escape"||l===""||(k.preventDefault(),k.stopPropagation(),c(""))}}),l===""?null:(0,A.createElement)("button",{type:"button",className:"bre-menu-search-clear",title:n("modelSearchClear"),"aria-label":n("modelSearchClear"),onClick:()=>{c("")}},(0,A.createElement)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,A.createElement)("path",{d:"M4 4L12 12M12 4L4 12",strokeLinecap:"round"}))))),ae=(0,A.createElement)("div",{className:"bre-providers",role:"group","aria-label":n("modelRowLabel")},...Z.map(k=>{let B=o.groups.find(ce=>ce.id===k);return(0,A.createElement)("button",{key:k,type:"button",className:"bre-provider"+(k===oe?" is-open":"")+(k===b?.provider?" is-current":""),disabled:D,"aria-expanded":k===oe,onMouseLeave:ar,onClick:()=>{m(k),c("")}},(0,A.createElement)("span",{className:"bre-option-name","aria-label":Ft(B),onMouseEnter:ce=>{Vt(ce,Ft(B))}},Ft(B)),(0,A.createElement)("span",{className:"bre-provider-count"},String(_(B,k).length)))}),...Z.length===0?[(0,A.createElement)("div",{key:"no-providers",className:"bre-empty"},Ae)]:[]),Te=(0,A.createElement)("div",{className:"bre-provider-models",role:"group","aria-label":n("modelRowLabel")},...ke.length===0?[(0,A.createElement)("div",{key:"no-models",className:"bre-empty"},X?n("modelSearchNoMatches"):Ae)]:ke.map(({provider:k,choice:B})=>{let ce=k+"/"+B.id,Be=ce===Se,Ge=B.name??B.id,dt=X?Ft(o.groups.find(Yt=>Yt.id===k))+" \xB7 "+Ge:Ge;return(0,A.createElement)("button",{key:ce,type:"button",className:"bre-option"+(Be?" is-active":""),disabled:D,"aria-pressed":Be,onMouseLeave:ar,onClick:()=>{P(k,B.id)}},(0,A.createElement)("span",{className:"bre-option-name","aria-label":dt,onMouseEnter:Yt=>{Vt(Yt,dt)}},X?(0,A.createElement)("span",{className:"bre-option-origin"},Ft(o.groups.find(Yt=>Yt.id===k))+" \xB7 "):null,Ge),zg(S(k,B.id)?.contextWindow,n),jg(B,n,S(k,B.id)?.input,tl(B,S(k,B.id))))})),Ie=(0,A.createElement)("div",{className:"bre-menu-foot"},H?(0,A.createElement)("div",{className:"bre-menu-slider"},(0,A.createElement)("div",{className:"bre-effort-slider-head","aria-hidden":!0},(0,A.createElement)("span",{className:"bre-effort-slider-head-label"},n("effortRowLabel")),(0,A.createElement)("span",{className:"bre-effort-slider-head-value"},a[ge]?.name??K)),(0,A.createElement)("div",{className:"bre-effort-slider",ref:J,role:"slider",tabIndex:0,"aria-label":n("effortRowLabel"),"aria-valuemin":0,"aria-valuemax":a.length-1,"aria-valuenow":ge,"aria-valuetext":a[ge]?.name,"aria-disabled":D||void 0,"data-bre-dragging":Nt===null?void 0:"true",onPointerDown:bn,onPointerMove:Ee,onPointerUp:Jr,onPointerCancel:Jr,onKeyDown:Hi},(0,A.createElement)("span",{className:"bre-effort-slider-fill",ref:me,style:{clipPath:`inset(0 ${100-we}% 0 0)`}}),...a.map((k,B)=>B===ge?null:(0,A.createElement)("span",{key:"tick-"+k.id,className:"bre-effort-slider-tick",style:{left:a.length>1?`${B/(a.length-1)*100}%`:"0%"}})),(0,A.createElement)("span",{className:"bre-effort-slider-thumb",ref:ve,style:{left:`${we}%`}})),(0,A.createElement)("div",{className:"bre-effort-slider-labels","aria-hidden":!0},...a.map((k,B)=>(0,A.createElement)("span",{key:k.id,className:"bre-effort-slider-label"+(B===0?" is-first":"")+(B===a.length-1?" is-last":"")+(B===ge?" is-on":""),style:{left:a.length>1?`${B/(a.length-1)*100}%`:"0%"}},k.name)))):(0,A.createElement)("span",{className:"bre-row-value is-muted"},n("sliderNoLevels")));return(0,A.createElement)("div",{className:"bre-slider-body",ref:E},(0,A.createElement)("div",{className:"bre-card"},Xr,C,(0,A.createElement)("div",{className:"bre-panel bre-panel-models"},ae,Te),Ie),te===null?null:(0,A.createElement)("div",{className:"bre-model-error",role:"status"},te),yn===null?null:(0,A.createElement)(Fg,{key:"tip",state:yn}))}var he=require("react"),il='section[role="group"]',wa='button[role="menuitemradio"]';function al(e){return e.querySelector(il)!==null}function va(e){return Array.from(e.querySelectorAll(wa)).filter(t=>!t.disabled&&t.style.display!=="none")}function $g(e){let t=e.getAttribute("aria-labelledby");return(t===null?null:e.ownerDocument.getElementById(t))?.textContent?.toLowerCase()??""}function ol(e,t,n=new Map){let r=d=>{n.has(d)||n.set(d,d.style.display),d.style.display="none"},o=d=>{let l=n.get(d);l!==void 0&&(d.style.display=l,n.delete(d))};for(let d of[...n.keys()])d.isConnected||n.delete(d);let i=t.trim().toLowerCase().split(/\s+/).filter(Boolean),a=Array.from(e.querySelectorAll(il)),s=0;if(i.length===0){for(let d of[...n.keys()])o(d);for(let d of a)s+=d.querySelectorAll(wa).length;return s}for(let d of a){let l=$g(d),c=Array.from(d.querySelectorAll(wa)),p=0;for(let m of c){let u=(m.getAttribute("title")??"").toLowerCase(),f=(m.textContent??"").toLowerCase(),y=`${l} ${u} ${f}`;i.every(g=>y.includes(g))?(o(m),p+=1):r(m)}p>0?(o(d),s+=p):r(d)}return s}function sl({menu:e,t}){let[n,r]=(0,he.useState)(""),[o,i]=(0,he.useState)(0),a=(0,he.useRef)(null),s=(0,he.useRef)(""),d=(0,he.useRef)(new Map),l=(0,he.useCallback)(u=>{s.current=u;let f=ol(e,u,d.current);i(f)},[e]);(0,he.useEffect)(()=>()=>{ol(e,"",d.current)},[e]),(0,he.useEffect)(()=>{let u=new MutationObserver(()=>{s.current.trim().length!==0&&l(s.current)});return u.observe(e,{childList:!0,subtree:!0}),()=>{u.disconnect()}},[e,l]),(0,he.useEffect)(()=>{let u=f=>{if(s.current.trim().length===0)return;let y=f.key;if(!(y==="ArrowDown"||y==="ArrowUp")&&!(y==="Home"||y==="End"||y==="PageUp"||y==="PageDown")||f.target===a.current||f.target instanceof Node&&!e.contains(f.target))return;let L=va(e);if(L.length===0)return;let w=L.findIndex(D=>D===document.activeElement),H;y==="Home"||y==="PageUp"?H=0:y==="End"||y==="PageDown"?H=L.length-1:y==="ArrowDown"?H=w===-1?0:(w+1)%L.length:H=w===-1?L.length-1:(w-1+L.length)%L.length,f.preventDefault(),f.stopPropagation(),L[H]?.focus()};return e.addEventListener("keydown",u,!0),()=>{e.removeEventListener("keydown",u,!0)}},[e]);let c=u=>{let f=u.key;if(f==="ArrowDown"){u.preventDefault(),u.stopPropagation(),va(e)[0]?.focus();return}if(n.trim().length>0&&(f==="ArrowUp"||f==="Home"||f==="PageUp"||f==="End"||f==="PageDown")){let y=va(e);y.length>0&&(u.preventDefault(),u.stopPropagation(),y[f==="ArrowUp"||f==="End"||f==="PageDown"?y.length-1:0]?.focus());return}f==="Escape"&&n.length>0&&(u.preventDefault(),u.stopPropagation(),r(""),l(""))},p=()=>{r(""),l(""),a.current?.focus({preventScroll:!0})},m=o===0&&n.trim().length>0;return(0,he.createElement)("div",{className:"bre-model-search-box"+(m?" has-empty":""),"data-bre-search":"1"},(0,he.createElement)("div",{className:"bre-search-input-wrapper"},(0,he.createElement)("span",{className:"bre-search-icon","aria-hidden":"true"},(0,he.createElement)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,he.createElement)("circle",{cx:"7",cy:"7",r:"4.5"}),(0,he.createElement)("path",{d:"M10.5 10.5L14 14",strokeLinecap:"round"}))),(0,he.createElement)("input",{ref:a,type:"text",className:"bre-search-input",role:"searchbox",placeholder:t("modelSearchPlaceholder"),"aria-label":t("modelSearchPlaceholder"),value:n,spellCheck:!1,autoComplete:"off",onChange:u=>{let f=u.currentTarget.value;r(f),l(f)},onKeyDown:c}),n.length>0?(0,he.createElement)("button",{type:"button",className:"bre-search-clear",title:t("modelSearchClear"),"aria-label":t("modelSearchClear"),onClick:p},(0,he.createElement)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,he.createElement)("path",{d:"M4 4L12 12M12 4L4 12",strokeLinecap:"round"}))):null),m?(0,he.createElement)("div",{className:"bre-search-empty",role:"status"},t("modelSearchNoMatches")):null)}var wo=require("react"),dl=require("react-dom"),ll=require("react-dom/client");function ft(){return document.body}function pt(e,t,n){let r=(0,ll.createRoot)(e);return n?.sync===!0?(0,dl.flushSync)(()=>{r.render(t)}):r.render(t),{wrapper:e,root:r}}function Ne(e){e!==void 0&&(e.root.unmount(),e.wrapper.remove())}var Ue=class extends wo.Component{constructor(){super(...arguments);Pe(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n instanceof Error?n.message:String(n)}}componentDidCatch(n,r){console.error("[bre] editor render failed:",n,r.componentStack)}render(){return this.state.error!==null?(0,wo.createElement)("div",{style:{color:"#c00",fontSize:"11px",whiteSpace:"pre-wrap",padding:"6px"}},`${this.props.fallbackText}: ${this.state.error}`):this.props.children}};var Vg="conversation.input.model";function cl(e){return e.querySelector("[data-composer-card]")??void 0}function xa(e){return e.querySelector(`[data-slot="${Vg}"]`)??void 0}function ul(e){let t=xa(e)??e;return Array.from(t.querySelectorAll('button[aria-haspopup="menu"]'))}function ka(e){if(e==null)return!1;let t=e.getAttribute("role");return t==="menu"||t==="group"}function Ea(e){return e.getAttribute("role")==="group"}function fl(e,t){let n=e.getAttribute("aria-controls");if(n===null||n.length===0)return;let r=t.getElementById(n);return ka(r)?r:void 0}function Ta(e=document){let t=cl(e);if(t===void 0)return;for(let r of ul(t)){let o=fl(r,e);if(o!==void 0)return o}let n=xa(t)??t;for(let r of Array.from(n.querySelectorAll('[role="menu"], [role="group"]')))if(r.previousElementSibling?.matches('button[aria-haspopup="menu"]')&&ka(r)&&!(r.getAttribute("role")==="group"&&r.querySelector('[role="menuitemradio"], section[role="group"]')===null))return r}function Sa(e=document){let t=cl(e);if(t===void 0)return;let n=xa(t),r=ul(t),o=r[0];if(o!==void 0){for(let i of r)if(fl(i,e)!==void 0)return i;for(let i of r)if(ka(i.nextElementSibling))return i;return n===void 0?r.at(-1):o}}function pl(){return Ta()}function ml(){return Sa()}var Yg=()=>{(0,gl.flushSync)(()=>{window.dispatchEvent(new Event("resize"))})};function hl(e){let{menuOf:t,triggerOf:n,t:r,refreshed:o,sliderEnabled:i,directory:a}=e,s,d,l,c,p,m,u,f,y=()=>{f?.removeAttribute("data-bre-provider"),f=void 0},g=()=>{let x=n();f!==void 0&&f!==x&&y();let T=m?.store.getSnapshot(),O=T?.current;if(x===void 0||O===null||O===void 0){x===f&&y();return}let K=T?.groups.find(j=>j.id===O.provider),G=K===void 0?O.provider:Ft(K);if(G.trim()===""){x===f&&y();return}x.dataset.breProvider=G,f=x},E=()=>{let x=a();x!==m&&(u?.(),u=void 0,m=x,x!==void 0&&(u=x.store.subscribe(g))),g()},L=()=>{Ne(l),l=void 0},w=new Map,H=()=>{for(let[T,O]of w)T.style.display=O;w.clear();let x=t();x!==void 0&&x.getAttribute("tabindex")==="-1"&&x.removeAttribute("tabindex")},D=x=>x.getAttribute("aria-hidden")!=="true"||x.childElementCount>0?!1:(x.textContent??"").trim()==="",te=(x,T)=>{for(let G of Array.from(w.keys()))(!G.isConnected||G.parentElement!==x)&&w.delete(G);let O=[];for(let G of Array.from(x.children))G!==T&&(D(G)||O.push(G));let K=document.activeElement;K!==null&&K!==T&&!T.contains(K)&&O.some(G=>G.contains(K))&&(x.tabIndex=-1,x.focus({preventScroll:!0}));for(let G of O)w.has(G)||w.set(G,G.style.display),G.style.display!=="none"&&(G.style.display="none")},U=x=>{let T=x.querySelector('section[role="group"]'),O=T?.parentElement,K=O!=null&&O.parentElement===x?O:T;if(l===void 0){let G=document.createElement("div");G.dataset.plugin=ye,G.dataset.breSearch="1",x.insertBefore(G,K),l=pt(G,(0,vr.createElement)(Ue,{fallbackText:r("modelSearchFailed"),children:o(()=>(0,vr.createElement)(sl,{menu:x,t:r}))}),{sync:!0});return}if(l.wrapper.parentElement!==x){x.insertBefore(l.wrapper,K);return}K!==null&&l.wrapper.nextSibling!==K&&x.insertBefore(l.wrapper,K)},v=x=>{if(!i()){Ne(s),s=void 0,d=void 0,x.classList.remove("bre-model-menu-host"),H();for(let j of Array.from(x.children))j.getAttribute("role")==="menuitem"&&(j.style.display="");return}let T=a();if(T===void 0)return;if(s!==void 0&&d!==T&&(Ne(s),s=void 0,d=void 0),s===void 0){d=T;let j=document.createElement("div");j.dataset.plugin=ye,j.dataset.breSlider="1",x.insertBefore(j,x.firstChild),s=pt(j,(0,vr.createElement)(Ue,{fallbackText:r("renderFailed"),children:o(()=>(0,vr.createElement)(rl,{directory:T,configuredInputs:e.configuredInputs,t:r}))}),{sync:!0})}else(s.wrapper.parentElement!==x||x.firstChild!==s.wrapper)&&x.insertBefore(s.wrapper,x.firstChild);x.classList.add("bre-model-menu-host");let O=Array.from(x.children).filter(j=>j.getAttribute("role")==="menuitem"),K=s.wrapper;if(Ea(x)){K.style.display="",te(x,K);return}if(H(),Array.from(x.querySelectorAll('[role="menuitemradio"]')).some(j=>!K.contains(j)))s.wrapper.contains(document.activeElement)&&(x.tabIndex=-1,x.focus({preventScroll:!0})),s.wrapper.style.display="none";else{s.wrapper.style.display="";for(let j of O)j.style.display="none"}};return{reconcile:()=>{E();let x=t();if(x===void 0){s!==void 0&&(i()?s.wrapper.remove():(Ne(s),s=void 0,d=void 0)),L(),c=void 0,p=void 0,H();return}let T=Ea(x),O=T&&i(),K=!T&&al(x);K?U(x):L(),v(x),(K!==c||O!==p)&&(c=K,p=O,(K||O||i())&&Yg())},dispose:()=>{u?.(),u=void 0,m=void 0,y(),Ne(s),s=void 0,d=void 0,L(),H(),c=void 0,p=void 0}}}var Jg=350;function bl(e){let t,n,r=0,o=()=>{if(t!==void 0)return Promise.resolve();let s=r;return n??(n=de(e.api).then(d=>{if(d.namespace===void 0){n=void 0;return}let l=new Map;for(let[c,p]of Object.entries(_e(d.namespace))){let m=Array.isArray(p.models)?p.models:[];for(let u of m){if(typeof u!="object"||u===null||Array.isArray(u))continue;let f=u.id,y=u[wn];typeof f=="string"&&typeof y=="string"&&y.length>0&&l.set(`${c}/${f}`,y)}}s===r?t=l:n=void 0}).catch(()=>{s===r&&(n=void 0)})),n};return{of:async(s,d)=>{if(t===void 0){let l=o();await new Promise(c=>{let p=!1,m=()=>{p||(p=!0,c())},u=setTimeout(m,Jg);l.then(()=>{clearTimeout(u),m()},()=>{clearTimeout(u),m()})})}return t?.get(`${s}/${d}`)},invalidate:()=>{r+=1,t=void 0,n=void 0}}}function Xg(e){let t=e.input;return Array.isArray(t)&&t.length>0?!0:e[ht]===!0||e[tt]===!0}function Ma(e,t=()=>!0,n={},r=0){let o=n.efforts!==!1,i=n.modalities!==!1;if(!$(e))return;let a={};for(let s of Object.keys(e)){if(!t(s))continue;let d=e[s],l=$(d)&&Array.isArray(d.models)?d.models:void 0;if(l===void 0||l.length===0)continue;let c=l,p=[],m=!1;for(let u of c){if(!$(u)){p.push(u);continue}let f=u,y=f.reasoningEfforts!==void 0||f[et]===!0,g=Xg(f);if((y||!o)&&(g||!i)){let U=Qg(f,e,s);U!==void 0?(m=!0,p.push(U)):p.push(f);continue}let E=typeof f.id=="string"?f.id:"";if(E.length===0){p.push(f);continue}let L=Jt(e,s),w=typeof f.name=="string"?f.name:void 0,H=bt(E,{...L,displayName:w??L.displayName});if(H.efforts===void 0){p.push(f);continue}let D={...f},te=!1;if(!y&&o&&H.confidence!=="low"&&(te=!0,D.reasoningEfforts=H.efforts,D[vn]=r,H.compat!==void 0)){let U=$(f.compat)?f.compat:{};D.compat={...U,...H.compat}}if(!g&&i&&(H.imageGen===!0?(te=!0,D[tt]=!0):H.input!==void 0&&(te=!0,D.input=[...H.input])),!te){p.push(f);continue}m=!0,p.push(D)}m&&(a[s]={models:p})}return Object.keys(a).length===0?void 0:{providers:a}}function La(e){if(!$(e))return;let t={};for(let[n,r]of Object.entries(e)){if(!$(r))continue;let o=typeof r.api=="string"?r.api:"";if(o.length===0)continue;let i={},a=$(r.compat)?sa(r.compat,o):void 0;a!==void 0&&(i.compat=a);let s=Array.isArray(r.models)?r.models:void 0;if(s!==void 0&&s.length>0){let d=[],l=!1;for(let c of s){if(!$(c)||!$(c.compat)){d.push(c);continue}let p=sa(c.compat,o);if(p===void 0){d.push(c);continue}l=!0,d.push({...c,compat:p})}l&&(i.models=d)}Object.keys(i).length>0&&(t[n]=i)}return Object.keys(t).length===0?void 0:{providers:t}}function Qg(e,t,n){if(!$(e.reasoningEfforts)||e[et]===!0)return;let r=e.compat,o=$(r)?{...r}:{};if(o.supportsDeveloperRole===void 0&&da(Jt(t,n)))return{...e,compat:{...o,supportsDeveloperRole:!1}}}function yl(e){let t,n=0,r=()=>{if(t!==void 0)return t;let i=(async()=>{try{let a=await fetch(ad,{method:"GET"});if(!a.ok)return;let s=await a.json();return s?.ok!==!0?void 0:{autofill:s.data?.autofill!==!1,modalityAutofill:s.data?.modalityAutofill!==!1}}catch{return}})().then(a=>(a===void 0&&t===i&&(t=void 0),a??{autofill:!0,modalityAutofill:!0}));return t=i,i},o=async i=>{let a=n;try{let s=await r();if(a!==n||!s.autofill)return;let d=i??await de(e.api),l=d.namespace;if(a!==n||l===void 0||d.writable!==!0)return;let c=Qt(l);if(c===void 0||Ma(c,()=>!0,{modalities:s.modalityAutofill},l.revision)===void 0)return;let m=d.source==="scope"?await de(e.api,{fresh:!0}):d,u=m.namespace;if(a!==n||u===void 0||m.writable!==!0)return;let f=Qt(u);if(f===void 0)return;let y=Ma(f,()=>!0,{modalities:s.modalityAutofill},u.revision);if(y===void 0)return;let g=y.providers,E=Object.entries(g).map(([w,H])=>({op:"set",path:["providers",w,"models"],value:H.models})),L=await e.api.settings.mutate(Ce,E,u.revision);L.ok||console.error(`[bre] idle autofill refused: ${L.error.message}`)}catch(s){console.error(`[bre] idle autofill failed: ${s instanceof Error?s.message:String(s)}`)}};return{run:()=>{o()},invalidate:()=>{n+=1,t=void 0}}}function vl(e){let t=async n=>{let r=n??await de(e.api),o=r.namespace;if(o===void 0||r.writable!==!0)return;let i=Qt(o);if(i===void 0||La(i)===void 0)return;let a=r.source==="scope"?await de(e.api,{fresh:!0}):r,s=a.namespace;if(s===void 0||a.writable!==!0)return;let d=Qt(s);if(d===void 0)return;let l=La(d);if(l===void 0)return;let c=l.providers,p=[];for(let[u,f]of Object.entries(c))for(let y of["compat","models"])f[y]!==void 0&&p.push({op:"set",path:["providers",u,y],value:f[y]});if(p.length===0)return;let m=await e.api.settings.mutate(Ce,p,s.revision);m.ok||console.error(`[bre] compat cleanup refused: ${m.error.message}`)};return{run:n=>{t(n).catch(r=>{console.error(`[bre] compat cleanup failed: ${r instanceof Error?r.message:String(r)}`)})}}}var js=require("react"),jp=require("react-dom"),zp=require("react-dom/client");var pe=require("react");var Kt=Gd;function en(e){let t={};for(let n of Kt){if(e===void 0){t[n]={on:!1,wire:""};continue}if(e===!1){t[n]=n==="off"?{on:!0,wire:""}:{on:!1,wire:""};continue}let r=e[n];t[n]={on:r!==void 0,wire:r===null?"":typeof r=="string"?r:""}}return t}function Nn(e){let t=!1,n=!1,r={};for(let o of Kt){let i=e[o];if(!i.on)continue;if(o==="off"){t=!0;let s=i.wire.trim();r.off=s.length===0?null:s;continue}n=!0;let a=i.wire.trim();r[o]=a.length===0?o:a}return n?r:t?!1:void 0}function wr(e,t){if(e===t)return!0;if(e===!1||e===void 0||t===!1||t===void 0)return!1;let n=Kt.filter(o=>e[o]!==void 0),r=Kt.filter(o=>t[o]!==void 0);return n.length!==r.length?!1:n.every(o=>e[o]===t[o])}function wl(e,t){if(!(e===void 0||e===!1)&&!("off"in e)){if(t==="zai"||t==="deepseek")return"thinking-disabled";if(t==="qwen")return"enable-thinking-false"}}var Aa="bre:auto-effort",xl=Promise.resolve();function kl(e){xl=xl.then(e,e).then(()=>{},()=>{})}function El(e,t=document){t.dispatchEvent(new CustomEvent(Aa,{detail:{route:e}}))}function Tl(e,t=document){let n=r=>{let o=r.detail;typeof o?.route!="string"||o.route.length===0||e(o.route)};return t.addEventListener(Aa,n),()=>{t.removeEventListener(Aa,n)}}var F=require("react/jsx-runtime"),Zg=["M3.4 4.2h9.2","M8 4.2v8.2","M5.9 12.4h4.2"],eh=["M4.4 3.4h7.2a1.9 1.9 0 0 1 1.9 1.9v5.4a1.9 1.9 0 0 1-1.9 1.9H4.4a1.9 1.9 0 0 1-1.9-1.9V5.3a1.9 1.9 0 0 1 1.9-1.9Z","M6.2 7.2a.9.9 0 1 0 0-1.8.9.9 0 0 0 0 1.8Z","M2.9 11.2 6.1 8.4l2.1 1.9 1.8-1.5 2.7 2.4"],th=["M9.4 12.7H3.6a1.7 1.7 0 0 1-1.7-1.7V5.1a1.7 1.7 0 0 1 1.7-1.7h4.2","M2.6 10.6 5.3 8.5l1.8 1.5 1.6-1.3 2.3 2","M12.4 2.2l.75 2.05L15.2 5l-2.05.75L12.4 7.8l-.75-2.05L9.6 5l2.05-.75Z"],nh=["M8 3.2 13.6 12.8H2.4L8 3.2Z","M8 6.9v2.5","M8 11.3h.01"],rh=["M8 2.6 9.1 6.4 12.9 7.5 9.1 8.6 8 12.4 6.9 8.6 3.1 7.5 6.9 6.4Z","M12.3 2.4v1.9M11.35 3.35h1.9"],oh=["M4.5 6.5 8 10 11.5 6.5"],ih=["M6.5 4.5 10 8 6.5 11.5"];function On({paths:e}){return(0,F.jsx)("svg",{viewBox:"0 0 16 16",width:12,height:12,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.map(t=>(0,F.jsx)("path",{d:t},t))})}function St(e,t){return t===!0?{declared:!1,image:!1,imageGen:!0}:e===void 0||e.length===0?{declared:!1,image:!1,imageGen:!1}:{declared:!0,image:e.includes("image"),imageGen:!1}}function ko(e){return e.imageGen?{input:null,imageGen:!0}:e.declared?{input:e.image?["text","image"]:["text"],imageGen:!1}:{input:null,imageGen:!1}}function xo(e,t,n){return e.imageGen!==(n===!0)?!1:e.imageGen?!0:e.declared?t===void 0?!1:e.image?t.includes("image"):!t.includes("image"):t===void 0}function Ra(e,t,n){let r=e?t:!1;return e&&r===void 0&&n===void 0?"keep":r}function Eo(e){let t=e.appliedCompat;return e.initialCompat?.supportsThinkingTokenBudget===!0&&e.initialCompat?.thinkingTokenBudgetField===void 0&&t?.thinkingTokenBudgetField===void 0&&(e.routeApi??"").toLowerCase()==="openai-completions"&&(t={...t??{},thinkingTokenBudgetField:"thinking_token_budget"}),{efforts:e.efforts,...t===void 0?{}:{compat:t},...e.input===void 0?{}:{input:e.input},...e.imageGen===void 0?{}:{imageGen:e.imageGen},...e.defaultEffort===void 0?{}:{defaultEffort:e.defaultEffort}}}function To({route:e,routeApi:t,routeBaseURL:n,modelId:r,modelName:o,efforts:i,effortsUnset:a=!1,input:s,imageGen:d,compat:l,defaultEffort:c,index:p,staged:m=!1,officialInputTypes:u=!1,api:f,readOnly:y,t:g}){let[E,L]=(0,pe.useState)(()=>en(i)),[w,H]=(0,pe.useState)(()=>St(s,d)),[D,te]=(0,pe.useState)(()=>i!==!1),[U,v]=(0,pe.useState)(()=>c??""),[b,N]=(0,pe.useState)(!1),[x,T]=(0,pe.useState)(void 0),[O,K]=(0,pe.useState)(()=>Kt.some(C=>E[C].on&&E[C].wire.trim()!==(C==="off"?"":C))),G=(0,pe.useRef)(void 0),j=(0,pe.useRef)(void 0);j.current===void 0&&(j.current=f.readCapacities?.()??{});let[h,S]=(0,pe.useState)(()=>ut(j.current?.contextWindow)),[I,_]=(0,pe.useState)(()=>ut(j.current?.maxTokens)),[ee,Z]=(0,pe.useState)(void 0),oe=(0,pe.useRef)(!1),re=(0,pe.useRef)(i),X=(0,pe.useRef)(s),ue=(0,pe.useRef)(d),ke=(0,pe.useRef)(c),Se=(0,pe.useRef)(void 0),Ae=(0,pe.useRef)(i);Ae.current=i;let V=(0,pe.useRef)(a);V.current=a,(0,pe.useEffect)(()=>Tl(C=>{if(C!==e||Ae.current!==void 0||V.current)return;let ae=Se.current;ae!==void 0&&kl(ae)}),[e]),(0,pe.useEffect)(()=>{wr(re.current,i)||(re.current=i,oe.current||(L(en(i)),te(i!==!1))),(X.current!==s||ue.current!==d)&&(X.current=s,ue.current=d,oe.current||H(St(s,d))),ke.current!==c&&(ke.current=c,oe.current||v(c??""))},[i,s,d,c]);let P=Kt.filter(C=>E[C].on),z=U===(c??"")?void 0:U===""?null:U,J=D?Nn(E):!1,me=!wr(J,i)||!xo(w,s,d)||z!==void 0,ve=(0,pe.useRef)(void 0),se=()=>{oe.current=!0},be=(C,ae,Te,Ie=D)=>{let k=Ra(Ie,Nn(C),i),ce=!xo(ae,s,d)?ko(ae):void 0,Be=Te===(c??"")?void 0:Te===""?null:Te,Ge=Eo({efforts:k,input:ce?.input,imageGen:ce?.imageGen,defaultEffort:Be,appliedCompat:G.current,routeApi:t,initialCompat:l}),dt=JSON.stringify(Ge);ve.current!==dt&&(ve.current=dt,f.commit(e,r,Ge))},Oe=(C,ae)=>{se();let Te=!ae&&U===C?"":U;Te!==U&&v(Te);let Ie={...E,[C]:{...E[C],on:ae}};ae&&C!=="off"&&Ie[C].wire.trim().length===0&&(Ie[C]={...Ie[C],wire:C}),L(Ie),be(Ie,w,Te),T(void 0)},Re=C=>{se(),te(C);let ae=C?U:"";ae!==U&&v(ae),be(E,w,ae,C),T(void 0)},Nt=(C,ae)=>{se();let Te={...E,[C]:{...E[C],wire:ae}};L(Te),be(Te,w,U),T(void 0)},Ze=C=>{se();let ae={declared:!0,image:C,imageGen:!1};H(ae),be(E,ae,U),T(void 0)},M=()=>{se();let C={declared:!1,image:!1,imageGen:!1};H(C),be(E,C,U),T(void 0)},Y=C=>{se();let ae=C?{declared:!1,image:!1,imageGen:!0}:{declared:!1,image:!1,imageGen:!1};H(ae),be(E,ae,U),T(void 0)},ie=C=>{se(),v(C),be(E,w,C),T(void 0)},ge=(C,ae)=>{let Te=ae.slice(0,20),Ie=C==="context"?Te:h,k=C==="output"?Te:I;Z(C),C==="context"?S(Te):_(Te),f.setCapacities?.({contextWindow:yt(Ie),maxTokens:yt(k)})},we=C=>{C==="context"?S(ae=>ut(yt(ae))):_(ae=>ut(yt(ae))),Z(void 0)},le=C=>{se();let ae=C.efforts!==!1;te(ae);let Te=en(C.efforts);L(Te);let Ie=C.imageGen===!0?St(void 0,!0):C.input===void 0?w:St(C.input);Ie!==w&&H(Ie);let k=U===""&&C.defaultEffort!==void 0?C.defaultEffort:U;if(k!==U&&v(k),G.current=C.compat,C.contextWindow!==void 0||C.maxTokens!==void 0){f.fillCapacities?.(C.contextWindow,C.maxTokens);let B=f.readCapacities?.();S(ut(B?.contextWindow)),_(ut(B?.maxTokens))}T(void 0),be(Te,Ie,k,ae)},Le=async()=>{if(!(y||b)){N(!0),T(void 0);try{let C=m?await f.suggest(e,r,o,{...t===void 0?{}:{api:t},...n===void 0?{}:{baseURL:n}}):await f.suggest(e,r,o);if(!C.ok){T({kind:"error",text:C.error==="no-suggestion"?g("noSuggestion"):C.error});return}le(C.suggestion)}catch(C){T({kind:"error",text:g("writeError",{message:String(C)})})}finally{N(!1)}}};(0,pe.useEffect)(()=>{Se.current=Le});let qe=()=>{oe.current=!1,f.withdraw(e,r),L(en(i)),te(i!==!1),H(St(s,d)),v(c??""),G.current=void 0;let C=j.current??{};S(ut(C.contextWindow)),_(ut(C.maxTokens)),Z(void 0),f.setCapacities?.({contextWindow:C.contextWindow,maxTokens:C.maxTokens}),T(void 0),ve.current=void 0},st=(0,pe.useMemo)(()=>bt(r,{...t===void 0?{}:{api:t},...n===void 0?{}:{baseURL:n}}).compat?.thinkingFormat,[r,t,n]),$t=G.current?.thinkingFormat??st,bn=wl(i,$t),Ee=y||b,Jr=D?P.length===0?g("stateUndeclared"):g("stateDeclared",{count:P.length,default:g(U===""?"defaultEffortUnset":"level_"+U)}):g("thinkingModeOff"),Hi=U!==""&&!P.includes(U)?[...P,U]:P,yn=yt(h),Vt=yt(I),ar=yn!==void 0&&Vt!==void 0&&Vt>yn,Xr=(0,F.jsxs)(F.Fragment,{children:[ar?(0,F.jsxs)("p",{className:"bre-effort-note bre-warn",children:[(0,F.jsx)(On,{paths:nh}),g("capacityRule")]}):null,(0,F.jsxs)("div",{className:"bre-effort-cols",children:[(0,F.jsxs)("div",{className:"bre-effort-sec",children:[(0,F.jsx)("span",{className:"bre-effort-label",children:g("contextWindowLabel")}),(0,F.jsxs)("span",{className:"bre-cap-box",children:[(0,F.jsx)("input",{type:"text",inputMode:"text",className:"bre-cap-input",value:ee==="context"?h:ut(yn),disabled:Ee,placeholder:g("capacityBlank"),"aria-label":g("contextWindowLabel")+" "+String(p+1),onFocus:()=>{Z("context")},onBlur:()=>{we("context")},onChange:C=>{ge("context",C.target.value)}}),(0,F.jsx)("span",{className:"bre-cap-unit",children:g("tokensUnit")})]}),(0,F.jsx)("p",{className:"bre-effort-note",children:g("capacityInherit")})]}),(0,F.jsxs)("div",{className:"bre-effort-sec",children:[(0,F.jsx)("span",{className:"bre-effort-label",children:g("maxTokensLabel")}),(0,F.jsxs)("span",{className:"bre-cap-box",children:[(0,F.jsx)("input",{type:"text",inputMode:"text",className:"bre-cap-input",value:ee==="output"?I:ut(Vt),disabled:Ee,placeholder:g("capacityBlank"),"aria-label":g("maxTokensLabel")+" "+String(p+1),onFocus:()=>{Z("output")},onBlur:()=>{we("output")},onChange:C=>{ge("output",C.target.value)}}),(0,F.jsx)("span",{className:"bre-cap-unit",children:g("tokensUnit")})]}),(0,F.jsx)("p",{className:"bre-effort-note",children:g("capacityUnitsHint")})]})]})]});return(0,F.jsxs)("div",{className:"bre-effort-editor","data-plugin":ye,children:[(0,F.jsxs)("div",{className:"bre-effort-modality",children:[(0,F.jsx)("span",{className:"bre-effort-label",children:g("inputModality")}),(0,F.jsxs)("div",{className:"bre-pillrow",role:"group","aria-label":g("inputModality"),children:[(0,F.jsxs)("button",{type:"button",className:w.declared?"bre-lvl bre-lvl--opt is-on":"bre-lvl bre-lvl--opt",disabled:Ee,"aria-pressed":w.declared,"aria-label":g("modalityText")+" "+String(p+1),title:g("modalityText"),onClick:()=>{w.declared?M():Ze(!1)},children:[(0,F.jsx)(On,{paths:Zg}),g("modalityText")]}),(0,F.jsxs)("button",{type:"button",className:w.declared&&w.image?"bre-lvl bre-lvl--opt is-on":"bre-lvl bre-lvl--opt",disabled:Ee,"aria-pressed":w.declared&&w.image,"aria-label":g("modalityImage")+" "+String(p+1),title:g("modalityImage"),onClick:()=>{Ze(!(w.declared&&w.image))},children:[(0,F.jsx)(On,{paths:eh}),g("modalityImage")]}),(0,F.jsxs)("button",{type:"button",className:w.imageGen?"bre-lvl bre-lvl--opt is-on":"bre-lvl bre-lvl--opt",disabled:Ee,"aria-pressed":w.imageGen,"aria-label":g("modalityImageGen")+" "+String(p+1),title:g("modalityImageGen"),onClick:()=>{Y(!w.imageGen)},children:[(0,F.jsx)(On,{paths:th}),g("modalityImageGen")]})]}),(0,F.jsx)("p",{className:"bre-effort-note",children:w.imageGen?g("modalityImageGenHint"):w.declared?g("modalityDeclared"):g("modalityInherit")})]}),(0,F.jsxs)("div",{className:"bre-effort-top",children:[(0,F.jsxs)("label",{className:"bre-thinking-switch",children:[(0,F.jsx)("input",{type:"checkbox",checked:D,disabled:Ee,"aria-label":g("thinkingMode")+" "+String(p+1),onChange:C=>{Re(C.target.checked)}}),(0,F.jsx)("span",{className:"bre-effort-switch-track","aria-hidden":"true"}),(0,F.jsx)("span",{className:"bre-effort-title",children:g("thinkingMode")})]}),(0,F.jsx)("span",{className:"bre-effort-state",children:Jr})]}),D?(0,F.jsxs)(F.Fragment,{children:[i===!1?(0,F.jsx)("p",{className:"bre-effort-note bre-effort-note--top",children:g("reasoningDisabled")}):null,bn===void 0?null:(0,F.jsx)("p",{className:"bre-effort-note bre-effort-note--top",children:g(bn==="thinking-disabled"?"defaultRiskDisabled":"defaultRiskQwen")})]}):null,D?(0,F.jsxs)("div",{className:"bre-effort-card",children:[(0,F.jsxs)("div",{className:"bre-effort-sec",children:[(0,F.jsxs)("div",{className:"bre-effort-labelrow",children:[(0,F.jsx)("span",{className:"bre-effort-label",children:g("levelsLabel")}),(0,F.jsx)("span",{className:"bre-effort-grow"}),(0,F.jsxs)("button",{type:"button",className:"bre-effort-adapt",disabled:Ee,onClick:()=>{Le()},children:[(0,F.jsx)(On,{paths:rh}),g("autoAdapt")]})]}),(0,F.jsx)("div",{className:"bre-pillrow",role:"group","aria-label":g("levelsLabel"),children:Kt.map(C=>{let ae=E[C];return(0,F.jsx)("button",{type:"button",className:ae.on?"bre-lvl is-on":"bre-lvl",disabled:Ee,"aria-pressed":ae.on,"aria-label":g("level_"+C)+" "+String(p+1),title:g("level_"+C),onClick:()=>{Oe(C,!ae.on)},children:g("level_"+C)},C)})}),(0,F.jsx)("p",{className:"bre-effort-hint",children:g("levelsHint")}),P.length===0?null:(0,F.jsxs)("button",{type:"button",className:"bre-effort-wiretoggle",disabled:Ee,"aria-expanded":O,onClick:()=>{K(!O)},children:[(0,F.jsx)(On,{paths:O?oh:ih}),g(O?"wireHide":"wireShow")]}),P.length===0||!O?null:(0,F.jsxs)("div",{className:"bre-wire",children:[(0,F.jsx)("div",{className:"bre-wire-grid",children:P.map(C=>(0,F.jsxs)(pe.Fragment,{children:[(0,F.jsx)("span",{className:"bre-wire-name",children:g("level_"+C)}),(0,F.jsx)("input",{type:"text",className:"bre-effort-wire",value:E[C].wire,disabled:Ee,placeholder:g("wirePlaceholder"),"aria-label":g("level_"+C)+" "+g("wireValue"),onChange:ae=>{Nt(C,ae.target.value)}})]},C))}),(0,F.jsx)("p",{className:"bre-effort-note",children:g("wireHint")})]})]}),P.length===0?null:(0,F.jsx)("div",{className:"bre-effort-cols",children:(0,F.jsxs)("div",{className:"bre-effort-sec",children:[(0,F.jsx)("span",{className:"bre-effort-label",children:g("defaultEffortLabel")}),(0,F.jsxs)("select",{className:"bre-effort-select",value:U,disabled:Ee,"aria-label":g("defaultEffortLabel"),onChange:C=>{ie(C.target.value)},children:[(0,F.jsx)("option",{value:"",children:g("followMemory")}),Hi.map(C=>(0,F.jsx)("option",{value:C,children:g("level_"+C)},C))]}),(0,F.jsx)("p",{className:"bre-effort-note",children:g("defaultEffortHint")})]})}),m?(0,F.jsx)("p",{className:"bre-effort-note",children:g("stagedHint")}):null,Nn(E)===void 0&&i!==void 0?(0,F.jsx)("p",{className:"bre-effort-note",children:g("bareHint")}):null,(0,F.jsx)("span",{className:"bre-effort-sep"}),Xr,x===void 0?null:(0,F.jsx)("p",{className:"bre-effort-message bre-"+x.kind,role:x.kind==="error"?"alert":"status",children:x.text}),(0,F.jsx)("div",{className:"bre-effort-actions",children:(0,F.jsx)("button",{type:"button",className:"bre-secondary-button",disabled:Ee||!me,onClick:qe,children:g("reset")})})]}):(0,F.jsxs)("div",{className:"bre-effort-card bre-effort-card--capacity",children:[Xr,x===void 0?null:(0,F.jsx)("p",{className:"bre-effort-message bre-"+x.kind,role:x.kind==="error"?"alert":"status",children:x.text})]})]})}function fe(e,t,n){e.getAttribute(t)!==n&&e.setAttribute(t,n)}function mt(e,t){e!==void 0&&e.hidden!==t&&(e.hidden=t)}function De(e,t,n){e.classList.contains(t)!==n&&(n?e.classList.add(t):e.classList.remove(t))}function xr(e,t){e!==void 0&&e.textContent!==t&&(e.textContent=t)}var qt="data-bre-auto-effort",Ca='[class*="modelCatalog"]',ah='[class*="modelListHead"]',sh='button[class*="linkButton"]',dh="bre-auto-effort",lh="bre-auto-effort-note",ch="data-bre-auto-effort-phase",Ml="bre-auto-effort-note-text",Ll="bre-auto-effort-note-detail",uh=3e3;function fh(e){return e.blocked==="busy"?null:e.failed!==void 0?{phase:"failed",count:0,missed:0,detail:e.failed}:e.blocked!==void 0?{phase:"blocked",count:0,missed:0,detail:""}:e.held>0?{phase:"done",count:e.held,missed:e.unsuggested,detail:""}:e.unsuggested>0?{phase:"unsuggested",count:0,missed:e.unsuggested,detail:""}:{phase:"empty",count:0,missed:0,detail:""}}function Ha(e){return Array.from(e.querySelectorAll(Ca)).filter(t=>(t.parentElement?.closest(Ca)??null)===null)}function So(e,t,n){let r=new Map;for(let s of t)s.route.length!==0&&s.catalogue.isConnected&&r.set(s.catalogue,s.route);let o=n.t("autoAdaptAll");for(let[s,d]of r){let l=s.querySelector(ah)??s,c=l.querySelector(`[${qt}]`)??mh();Rl.set(c,n);let p=ph(l);p!==null?p.nextElementSibling!==c&&p.after(c):l.lastElementChild!==c&&l.append(c),yh(c,d,o)}let i=new Set,a=new Set(r.values());for(let s of Array.from(e.querySelectorAll(`[${qt}]`))){let d=s.closest(Ca),l=s.getAttribute(qt)??"";if(d===null||!r.has(d)||i.has(d)){s.remove(),l.length>0&&!a.has(l)&&Na(l);continue}i.add(d)}}function Na(e){let t=tn.get(e);t!==void 0&&(t.timer!==null&&clearTimeout(t.timer),t.note.remove(),tn.delete(e))}function Al(){for(let e of Array.from(document.querySelectorAll(`[${qt}]`)))e.remove();for(let e of tn.values())e.timer!==null&&clearTimeout(e.timer),e.note.remove();tn.clear()}function ph(e){let t=Array.from(e.querySelectorAll(sh));return t.length===0?null:t[t.length-1]}function mh(){let e=document.createElement("button");return e.className=dh,e.setAttribute("type","button"),e.setAttribute(qt,""),e.addEventListener("click",()=>{let t=e.getAttribute(qt)??"";if(t.length===0)return;let n=Rl.get(e);n!==void 0&&(El(t),gh(t,n))}),e}async function gh(e,t){if(t.onRequest===void 0)return;Sl(e,{phase:"working",count:0,missed:0,detail:""},t,0);let n;try{n=await t.onRequest(e)}catch(o){n={held:0,unsuggested:0,failed:String(o)}}if(n===void 0){Na(e);return}let r=fh(n);r!==null&&Sl(e,r,t,uh)}function Sl(e,t,n,r){let o=tn.get(e);o!==void 0&&!o.note.isConnected&&(o.timer!==null&&clearTimeout(o.timer),tn.delete(e),o=void 0),o!==void 0&&o.timer!==null&&clearTimeout(o.timer);let i=o?.note??hh();i.setAttribute(ch,t.phase);let a=i.querySelector(`.${Ml}`),s=i.querySelector(`.${Ll}`),d=bh(t,n);a.textContent!==d.text&&(a.textContent=d.text),s.textContent!==d.detail&&(s.textContent=d.detail),mt(s,d.detail.length===0),o===void 0&&document.body.append(i);let l=r>0?setTimeout(()=>{Na(e)},r):null;i.style.setProperty("--bre-note-hold",`${r}ms`),tn.set(e,{note:i,timer:l})}function hh(){let e=document.createElement("div");return e.className=lh,e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.innerHTML=`<span class="${Ml}"></span><span class="${Ll}"></span>`,e}var Rl=new WeakMap,tn=new Map;function bh(e,t){switch(e.phase){case"working":return{text:t.t("autoAdaptWorking"),detail:""};case"done":return{text:t.t("autoAdaptDone",{count:e.count}),detail:e.missed>0?`${t.t("autoAdaptDoneHint",{count:e.count})} ${t.t("autoAdaptUnsuggestedHint")}`:t.t("autoAdaptDoneHint",{count:e.count})};case"empty":return{text:t.t("autoAdaptEmpty"),detail:t.t("autoAdaptEmptyHint")};case"unsuggested":return{text:t.t("autoAdaptUnsuggested"),detail:t.t("autoAdaptUnsuggestedHint")};case"blocked":return{text:t.t("autoAdaptBlocked"),detail:t.t("autoAdaptBlockedHint")};case"failed":return{text:t.t("autoAdaptFailed",{message:e.detail}),detail:e.detail}}}function yh(e,t,n){e.getAttribute(qt)!==t&&e.setAttribute(qt,t),e.textContent!==n&&(e.textContent=n),e.getAttribute("title")!==null&&e.removeAttribute("title")}var kr="data-bre-drag-handle",Oa="data-bre-row-head",Ia="data-bre-drop-side",Mo="bre-row-dragging",Lo="bre-row-drop-target",Pl="bre-drag-ghost",_l="bre-drop-line",Cl="http://www.w3.org/2000/svg",Hl=8,Nl=28,Ol=12,vh="transform 180ms cubic-bezier(0.2, 0.7, 0.3, 1)",wh='button, a, input, textarea, select, [contenteditable], [role="button"], [role="switch"], [role="checkbox"], [role="textbox"], [role="combobox"]';function Ao(){return{sources:new WeakSet,lists:new WeakSet,line:void 0,sighted:new WeakMap,drag:void 0}}function je(e){return Array.from(e.children).filter(t=>t instanceof HTMLElement)}function xh(e,t){let n=e.style.order;if(n==="")return t;let r=Number.parseInt(n,10);return Number.isNaN(r)?t:r}function nn(e){return je(e).map((t,n)=>({row:t,key:xh(t,n),index:n})).sort((t,n)=>t.key-n.key||t.index-n.index).map(t=>t.row)}function Dl(e,t){let n=e.filter(a=>t.includes(a)),r=n.map(a=>e.indexOf(a)),o=t.filter(a=>n.includes(a)),i=new Map;e.forEach((a,s)=>i.set(a,s)),r.forEach((a,s)=>{let d=o[s];d!==void 0&&i.set(d,a)});for(let[a,s]of i){let d=String(s);a.style.order!==d&&(a.style.order=d)}}function Ro(e,t){Dl(nn(e),t)}function Pa(e,t){let n=je(e),r=n.map(o=>o.offsetTop);t(),n.forEach((o,i)=>{let a=r[i]-o.offsetTop;a!==0&&(o.style.transition="none",o.style.transform=`translateY(${a}px)`,o.offsetHeight,o.style.transition=vh,o.style.transform="")})}function Er(e,t){return nn(e).map(n=>t(n)).filter(n=>n!==void 0)}function kh(e,t,n){let r=Er(e,t);if(n===void 0||!Eh(e,n))return r;let o=new Map;return n.ids.forEach((i,a)=>{o.has(i)||o.set(i,a)}),r.map((i,a)=>({id:i,key:o.get(i)??n.ids.length+a})).sort((i,a)=>i.key-a.key).map(i=>i.id)}function Eh(e,t){return t.rows.some(n=>!e.contains(n))}function Th(e,t){let n=[];for(let o of nn(e)){let i=t(o);i!==void 0&&n.push(i)}let r=[];for(let o of je(e))t(o)!==void 0&&r.push(o);return{ids:n,rows:r}}function Fl(e,t,n){let r=new Map;for(let[s,d]of t.entries())r.has(d)||r.set(d,s);let o=je(e),a=[...o.filter(s=>n(s)!==void 0)].sort((s,d)=>{let l=r.get(n(s))??Number.MAX_SAFE_INTEGER,c=r.get(n(d))??Number.MAX_SAFE_INTEGER;return l-c});Dl(o,a)}function Tr(e){for(let t of e)t.style.order="",t.style.transition="",t.style.transform=""}function Kl(e,t,n,r){let i=e.filter(a=>a!==t).indexOf(n);return i<0?Math.max(0,e.indexOf(t)):r?i+1:i}function ql(e,t){let n,r=Number.POSITIVE_INFINITY;for(let o of e){let i=o.getBoundingClientRect(),a=t<i.top?i.top-t:t>i.bottom?t-i.bottom:0;a<r&&(r=a,n=o)}return n}function Sh(e,t){let n=e.getBoundingClientRect();return n.height<=0?!0:t>n.top+n.height/2}function Bl(e,t){let n=e.getBoundingClientRect();return t?n.bottom+Hl/2-1:n.top-Hl/2-1}function Gl(){let e=document.createElementNS(Cl,"svg");e.setAttribute("width","10"),e.setAttribute("height","14"),e.setAttribute("viewBox","0 0 10 14"),e.setAttribute("fill","none"),e.setAttribute("aria-hidden","true");let t=[[2.5,3],[7.5,3],[2.5,7],[7.5,7],[2.5,11],[7.5,11]];for(let[n,r]of t){let o=document.createElementNS(Cl,"circle");o.setAttribute("cx",String(n)),o.setAttribute("cy",String(r)),o.setAttribute("r","1.2"),o.setAttribute("fill","currentColor"),e.appendChild(o)}return e}function Wl(e,t){let n=document.createElement("div");n.className=Pl,n.setAttribute("aria-hidden","true"),n.appendChild(Gl());let r=document.createElement("span");r.className="bre-drag-ghost-name";let o=t??e.querySelector('[class*="rowName"]')?.textContent?.trim();return r.textContent=o===void 0?"":o,n.appendChild(r),n}function Mh(e){return!(e instanceof Element)||e.closest(`[${kr}]`)!==null?!1:e.closest(wh)!==null}function Ul(e){return e.parentElement??void 0}function jl(e){for(let t of je(e))t.classList.remove(Lo),t.removeAttribute(Ia)}function Co(e){let t=e.parentElement;for(;t!==null;){if(Vl(t))return t;t=t.parentElement}let n=document.scrollingElement;return n instanceof HTMLElement&&n.scrollHeight>n.clientHeight?n:void 0}function zl(e){let t=[],n=e.parentElement;for(;n!==null;)Vl(n)&&t.push(n),n=n.parentElement;let r=document.scrollingElement;return r instanceof HTMLElement&&r.scrollHeight>r.clientHeight&&!t.includes(r)&&t.push(r),t}function _a(e){let t=[],n=e.parentElement;for(;n!==null;)$l(n)&&t.push(n),n=n.parentElement;let r=document.scrollingElement;return r instanceof HTMLElement&&!t.includes(r)&&t.push(r),t}function $l(e){let t=e.style.overflowY,n=t.length>0?t:window.getComputedStyle(e).overflowY;return n==="auto"||n==="scroll"||n==="overlay"}function Vl(e){return e.scrollHeight>e.clientHeight&&$l(e)}function Yl(e,t){let n=e.getBoundingClientRect();return n.height<=0?0:t<n.top+Nl?-Ol:t>n.bottom-Nl?Ol:0}function Jl(e,t,n){if(t.scrollStep===n)return;if(t.scrollStep=n,n===0){t.frame!==void 0&&(window.cancelAnimationFrame(t.frame),t.frame=void 0);return}let r=t.scroller;if(r===void 0||t.frame!==void 0)return;let o=()=>{t.frame=void 0,!(e.drag!==t||t.scrollStep===0)&&(r.scrollTop+=t.scrollStep,t.frame=window.requestAnimationFrame(o))};t.frame=window.requestAnimationFrame(o)}function Lh(e){let t=e.line;if(t!==void 0&&t.isConnected)return t;let n=document.createElement("div");return n.className=_l,n.setAttribute("aria-hidden","true"),document.body.appendChild(n),e.line=n,n}function Ah(e,t,n){let r=Lh(e),o=t.getBoundingClientRect();r.style.top=`${Bl(t,n)}px`,r.style.left=`${o.left}px`,r.style.width=`${o.width}px`,r.style.display="block",r.setAttribute(Ia,n?"after":"before")}function Rh(e){e.line!==void 0&&(e.line.style.display="none")}function Ch(e){let t=e.drag;e.drag=void 0,t!==void 0&&(Jl(e,t,0),Rh(e),t.row.classList.remove(Mo),jl(t.list),t.dropped||Pa(t.list,()=>{Ro(t.list,t.before)}))}function Hh(e,t,n,r){if(Mh(t.target)){t.preventDefault();return}let o=Ul(e),i=n.idOf(e);if(o===void 0||i===void 0){t.preventDefault();return}let a={row:e,list:o,before:nn(o),scroller:Co(o),adapter:n,scrollStep:0,frame:void 0,dropped:!1};r.drag=a,e.classList.add(Mo);let s=Wl(e,n.labelOf(e));Number.isFinite(t.clientX)&&Number.isFinite(t.clientY)&&(s.style.left=`${t.clientX}px`,s.style.top=`${t.clientY}px`),document.body.appendChild(s);let d=t.dataTransfer;if(d!=null)try{d.effectAllowed="move",d.setData("text/plain",i),d.setDragImage(s,Math.round(s.offsetWidth/2),Math.round(s.offsetHeight/2))}catch{}window.setTimeout(()=>{s.remove()},0)}function Nh(e,t,n){let r=n.drag;if(r===void 0||r.list!==e)return;let o=t.target,i=o instanceof Element?r.adapter.rowOf(o,e):void 0,a=nn(e),s=i!==void 0&&a.includes(i)?i:ql(a,t.clientY);if(s===void 0)return;t.preventDefault();let d=t.dataTransfer;d!=null&&(d.dropEffect="move");let l=Sh(s,t.clientY),c=Kl(a,r.row,s,l);c!==a.indexOf(r.row)&&Pa(e,()=>{Ro(e,Bi(a,r.row,c))}),jl(e),s.classList.add(Lo),s.setAttribute(Ia,l?"after":"before"),Ah(n,s,l),Jl(n,r,r.scroller===void 0?0:Yl(r.scroller,t.clientY))}function Oh(e,t){t.lists.has(e)||(t.lists.add(e),e.addEventListener("dragover",n=>{Nh(e,n,t)}),e.addEventListener("drop",n=>{let r=t.drag;r===void 0||r.list!==e||(n.preventDefault(),r.dropped=!0,r.adapter.commit(e))}))}function Ih(e,t,n,r){r.sources.has(e)||(r.sources.add(e),n.seatDrags&&(e.setAttribute(Oa,"1"),e.setAttribute("draggable","true")),e.addEventListener("dragstart",o=>{Hh(t,o,n,r)}),e.addEventListener("dragend",()=>{Ch(r)}))}function Ph(e,t,n,r){e.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation()}),e.addEventListener("keydown",o=>{if(o.key!=="ArrowUp"&&o.key!=="ArrowDown")return;let i=Ul(t);if(i===void 0)return;let a=nn(i),s=a.indexOf(t);if(s<0)return;let d=s+(o.key==="ArrowUp"?-1:1);d<0||d>=a.length||(o.preventDefault(),Pa(i,()=>{Ro(i,Bi(a,t,d))}),n.commit(i),e.focus())})}function Il(e,t,n,r){let o=r.gripLabel(t,n),i=r.gripHint();e.getAttribute(kr)!==n&&e.setAttribute(kr,n),e.getAttribute("aria-label")!==o&&e.setAttribute("aria-label",o),e.getAttribute("title")!==i&&e.setAttribute("title",i)}function _h(e,t,n,r,o){let i=t.querySelector(`[${kr}]`);if(i!==null){Il(i,e,n,r);return}r.decorate?.(e,t);let a=document.createElement("span");a.className="bre-drag-grip",a.setAttribute("role","button"),a.setAttribute("tabindex","0"),a.setAttribute("draggable","true"),a.appendChild(Gl()),Il(a,e,n,r),Ph(a,e,r,o),Ih(r.seatDrags?t:a,e,r,o),t.insertBefore(a,t.firstChild)}function Ho(e,t,n,r){if(!e.isConnected)return;Oh(t,r);for(let i of je(t)){let a=n.idOf(i);if(a===void 0)continue;let s=n.seatOf(i);s!==void 0&&_h(i,s,a,n,r)}if(r.drag!==void 0)return;let o=kh(t,n.idOf,r.sighted.get(t));Fl(t,n.order(o),n.idOf),r.sighted.set(t,Th(t,n.idOf))}function No(e){e.drag=void 0;for(let t of Array.from(document.querySelectorAll(`[${kr}]`)))t.remove();for(let t of Array.from(document.querySelectorAll(`[${Oa}]`)))t.removeAttribute(Oa),t.removeAttribute("draggable");for(let t of Array.from(document.querySelectorAll(`.${Mo}, .${Lo}`)))t.classList.remove(Mo,Lo);for(let t of Array.from(document.querySelectorAll(`.${_l}`)))t.remove();for(let t of Array.from(document.querySelectorAll(`.${Pl}`)))t.remove();e.line=void 0}var Xl=["openai","anthropic"];function Oo(e){return e==="anthropic-messages"?"anthropic":"openai"}function Ql(e){return e==="openai-completions"||e==="anthropic-messages"||e==="openai-responses"}var Dh=40;function Zl(e){if(typeof e!="string")return;let t="";for(let n of e){let r=n.codePointAt(0)??0;r<32||r===127||(t+=n)}if(t=t.trim(),t.length!==0)return t.slice(0,Dh)}function Mt(e){return typeof e=="string"&&/^[\x21-\x7E]+$/.test(e)}var Fh=12;function ec(e){return e.length===0?"":e.length<Fh?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022":`${e.slice(0,4)}...${e.slice(-4)}`}var tc="dsh-model-think-level:key-lists:v1";function nc(){try{return globalThis.localStorage??void 0}catch{return}}function Io(){let e=nc();if(e===void 0)return{};try{let t=e.getItem(tc);if(t===null)return{};let n=JSON.parse(t);if(typeof n!="object"||n===null)return{};let r={};for(let[o,i]of Object.entries(n))Kh(i)&&(r[o]=i);return r}catch{return{}}}function Kh(e){if(typeof e!="object"||e===null)return!1;let t=e;if(typeof t.savedAt!="number"||!Number.isFinite(t.savedAt))return!1;let n=t.state;if(typeof n!="object"||n===null)return!1;let r=n;return r.ok===!0&&typeof r.route=="string"&&Array.isArray(r.entries)}function rc(e){let t=nc();if(t===void 0)return;let n=Object.entries(e).sort((r,o)=>o[1].savedAt-r[1].savedAt).slice(0,64);try{t.setItem(tc,JSON.stringify(Object.fromEntries(n)))}catch{}}function oc(e){let t=Io()[e];if(t===void 0||t.state.route!==e)return;let n=Date.now()-t.savedAt;if(!(n>=0)||n>2592e6){qh(e);return}return t.state}function Da(e,t){if(t.ok!==!0||t.route!==e)return;let n=Io();n[e]={savedAt:Date.now(),state:{...t,probing:void 0,addedRef:void 0}},rc(n)}function qh(e){let t=Io();t[e]!==void 0&&(delete t[e],rc(t))}function ic(){return Object.entries(Io()).map(([e,t])=>({route:e,savedAt:t.savedAt})).sort((e,t)=>t.savedAt-e.savedAt)}function ac(e){for(let t of["error","message"]){let n=e[t];if(typeof n=="string"&&n.length>0)return n}}function sc(e){if(!Array.isArray(e))return;let t=[];for(let n of e)typeof n=="string"&&n.length>0&&t.push(n);return t}function Bh(e){if(!$(e))return;let t=e.ref;if(typeof t!="string"||t.length===0)return;let n=e.alias,r=e.configured,o=e.masked,i=sc(e.models),a=e.protocol,s=e.auto,d=e.rest,l=$(d)&&typeof d.remainingMs=="number"?d.remainingMs:void 0,c=$(d)&&typeof d.failures=="number"?d.failures:void 0;return{ref:t,...typeof n=="string"&&n.length>0?{alias:n}:{},enabled:e.enabled!==!1,configured:typeof r=="boolean"?r:null,...typeof o=="string"&&o.length>0?{masked:o}:{},...i===void 0?{}:{models:i},...Ql(a)?{protocol:a}:{},...s===!0?{auto:!0}:{},...l!==void 0&&l>=0&&c!==void 0?{rest:{remainingMs:l,failures:c}}:{}}}function Gh(e){let t=e.entries;if(!Array.isArray(t))return;let n=[];for(let l of t){let c=Bh(l);c!==void 0&&n.push(c)}let r=e.addedRef,o=e.route,i=sc(e.models),a=e.endpoints,s=$(a)&&typeof a.openai=="string"?a.openai:null,d=$(a)&&typeof a.anthropic=="string"?a.anthropic:null;return{ok:!0,route:typeof o=="string"?o:"",entries:n,...typeof r=="string"&&n.some(l=>l.ref===r)?{addedRef:r}:{},...i===void 0?{}:{models:i},...e.probing===!0?{probing:!0}:{},endpoints:{openai:s,anthropic:d}}}async function Wh(e){let t;try{t=await e.json()}catch{t=void 0}if(!$(t))return{ok:!1};if(t.ok===!0){let r=Gh(t);if(r!==void 0)return r}let n=ac(t);return n===void 0?{ok:!1}:{ok:!1,error:n}}async function dc(e,t){let n=`${eo}?route=${encodeURIComponent(e)}`;try{let r=await fetch(n,t===void 0?{method:"GET",cache:"no-store",credentials:"same-origin"}:{method:"POST",cache:"no-store",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify(t)});return await Wh(r)}catch{return{ok:!1}}}var Sr=new Map,Uh=64,jh=5e3;function Fa(e){let t=Sr.get(e);if(t!==void 0)return t;if(Sr.size>=Uh){let r=Sr.keys().next().value;r!==void 0&&Sr.delete(r)}let n={state:oc(e),updatedAt:0,revision:0};return Sr.set(e,n),n}function zh(e){return Fa(e).state}function $h(e,t){let n=Fa(e),r=Date.now()-n.updatedAt;if(t?.preferCache===!0&&n.state!==void 0&&r>=0&&r<jh)return Promise.resolve(n.state);if(n.read!==void 0)return n.read;let o=n.revision,i=dc(e).then(a=>n.revision!==o?n.state??a:(a.ok&&(n.state=a,n.updatedAt=Date.now(),Da(e,a)),a)).finally(()=>{n.read===i&&(n.read=void 0)});return n.read=i,i}async function vt(e,t){let n=Fa(e),r=++n.revision;n.read=void 0;let o=await dc(e,t);return o.ok&&n.revision===r&&(n.revision+=1,n.read=void 0,n.state=o,n.updatedAt=Date.now(),Da(e,o)),o}async function Vh(e){try{let t=await fetch(`${eo}?route=${encodeURIComponent(e)}&op=endpoints`,{method:"GET",cache:"no-store",credentials:"same-origin"});if(!t.ok)return{ok:!1};let n=await t.json().catch(()=>{});if(!$(n)||n.ok!==!0)return{ok:!1};let r=n.endpoints;return $(r)?{ok:!0,endpoints:{openai:typeof r.openai=="string"?r.openai:null,anthropic:typeof r.anthropic=="string"?r.anthropic:null}}:{ok:!0}}catch{return{ok:!1}}}async function Yh(e){try{let n=await(await fetch(`${eo}?route=${encodeURIComponent(e)}&op=balance`,{method:"GET",cache:"no-store",credentials:"same-origin"})).json().catch(()=>{});if(!$(n)||n.ok!==!0){let o=$(n)?ac(n):void 0;return o===void 0?{ok:!1}:{ok:!1,error:o}}let r=n.endpoint;return{ok:!0,endpoint:typeof r=="string"&&r.length>0?r:null}}catch{return{ok:!1}}}var Fe={list:$h,endpoints:Vh,balanceEndpoint:Yh,cached:zh,add:(e,t,n)=>vt(e,{op:"add",value:t,...n===void 0?{}:{alias:n}}),rename:(e,t,n)=>vt(e,{op:"rename",ref:t,...n===void 0?{}:{alias:n}}),remove:(e,t)=>vt(e,{op:"remove",ref:t}),replace:(e,t,n)=>vt(e,{op:"value",ref:t,value:n}),setScope:(e,t,n)=>vt(e,{op:"scope",ref:t,...n===void 0?{}:{models:n}}),setEnabled:(e,t,n)=>vt(e,{op:"enable",ref:t,enabled:n}),setProtocol:(e,t,n)=>vt(e,{op:"protocol",ref:t,...n===void 0?{}:{protocol:n}}),setEndpoints:(e,t,n)=>vt(e,{op:"endpoints",openai:t??"",anthropic:n??""}),setBalanceEndpoint:(e,t)=>vt(e,{op:"balance",endpoint:t}),probe:e=>vt(e,{op:"probe"}),async reveal(e,t){try{let n=await fetch(`${Zr}?route=${encodeURIComponent(e)}&ref=${encodeURIComponent(t)}`,{method:"GET",cache:"no-store",credentials:"same-origin"});if(!n.ok)return;let r=await n.json();if(!$(r)||r.ok!==!0)return;let o=r.key;return typeof o=="string"&&o.length>0?o:void 0}catch{return}}};var In="data-bre-endpoint-rows",Lt="data-bre-endpoint-row",Kn="data-bre-balance-row",_o="data-bre-endpoint-family",lc="data-bre-endpoint-filled",Do="data-bre-endpoint-field",Fo="data-bre-endpoint-title",_n="data-bre-endpoint-toggle",mc="data-bre-endpoint-count",Ko="data-bre-field-order",Mr="data-bre-endpoint-serving",cc="data-bre-protocol-watch",uc=new WeakSet,fc="data-bre-row-provider",qa="data-bre-protocol-cards",Dn="data-bre-protocol-value",Ba="data-bre-protocol-source";function rt(e,t){for(let n of t){let r=Array.from(e.querySelectorAll("input[aria-label], select[aria-label]")).find(o=>(o.getAttribute("aria-label")??"").startsWith(n));if(r!==void 0)return r}}function Fn(e,t){let n=rt(e,t);if(n===void 0)return;let r=n.closest("label");return r!==null&&r.parentElement!==null?r:n.parentElement??void 0}function Ka(e,t){let n=e;for(;n!==null&&n.parentElement!==t;)n=n.parentElement;return n===null||n===t?void 0:n}function Jh(e,t,n){for(let r=t.parentElement;r!==null;r=r.parentElement){if(!r.contains(n)||e!==void 0&&!r.contains(e))continue;let o=Ka(t,r),i=Ka(n,r);if(o===void 0||i===void 0||o===i)continue;let a=e===void 0?void 0:Ka(e,r);return{container:r,protocol:o,url:i,name:a}}}function gc(e,t){let n=rt(e,t);return n instanceof HTMLSelectElement||n instanceof HTMLInputElement?n.value.trim():""}function Xh(e,t){let n=gc(e,t.apiProtocol);return n==="anthropic-messages"||n==="openai-completions"||n==="openai-responses"?n:void 0}function wt(e,t){let n=Xh(e,t);return n===void 0?void 0:Oo(n)}function on(e,t){let n=gc(e,t.routeId);return n.length>0?n:(e.closest(`[${fc}]`)?.getAttribute(fc)??"").trim()}function hc(e,t){return e==="anthropic"?t("keysEndpointAnthropic"):e==="openai"?t("keysEndpointOpenAI"):""}function Qh(e,t){let n=rt(e,t.modelName),r=rt(e,t.apiProtocol),o=rt(e,t.baseUrl);if(r===void 0||o===void 0)return;let i=Jh(n,r,o);if(i===void 0)return;let{container:a,protocol:s,url:d,name:l}=i,c=m=>Array.from(a.children).indexOf(m);if((l===void 0||c(l)<c(s))&&c(s)<c(d)){e.setAttribute(Ko,"1");return}a.insertBefore(s,d),l!==void 0&&a.insertBefore(l,s),e.setAttribute(Ko,"1")}function bc(e,t){for(let n of Array.from(e.children))if(!(n===t||n.contains(t))&&!n.hasAttribute(_o)&&!n.hasAttribute(_n)&&n instanceof HTMLElement&&(n.textContent??"").trim().length>0)return n}function rn(e,t){let n=t?"1":"0";e.getAttribute(lc)!==n&&e.setAttribute(lc,n)}function Zh(e,t,n){let r=bc(e,t);if(!n){e.removeAttribute(Do),r?.removeAttribute(Fo);return}e.setAttribute(Do,"1"),r?.setAttribute(Fo,"1")}function yc(e,t,n){let r=rt(e,t.baseUrl);if(r===void 0)return;let o=Fn(e,t.baseUrl);if(o===void 0)return;let i=hc(wt(e,t),n),a=o.querySelector(`[${_o}]`);if(a===null&&i.length>0){a=document.createElement("span"),a.setAttribute(_o,"1"),a.className="bre-endpoint-family";let d=r.closest("label");d!==null&&d.contains(r)?d.insertBefore(a,r):o.insertBefore(a,r)}a!==null&&(a.textContent!==i&&(a.textContent=i),mt(a,i.length===0),rn(a,r instanceof HTMLInputElement&&r.value.trim().length>0)),Zh(o,r,a!==null&&i.length>0);let s=wt(e,t);s===void 0?o.removeAttribute(Mr):o.setAttribute(Mr,s)}function eb(e,t){let n=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value")?.set;n===void 0?e.value=t:n.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function vc(e,t){for(let n of Array.from(t.querySelectorAll(`[${Dn}]`))){let r=n.getAttribute(Dn)===e.value;n.classList.toggle("is-selected",r),n.setAttribute("aria-checked",r?"true":"false"),n.tabIndex=r?0:-1}}function tb(e,t,n){let r=Array.from(t.querySelectorAll(`[${Dn}]`)),o=Array.from(e.options).filter(i=>i.value.length>0);return r.length!==o.length?!1:o.every((i,a)=>{let s=r[a];return s!==void 0&&s.getAttribute(Dn)===i.value&&(s.textContent??"")===wc(i.value,(i.textContent??i.value).trim(),n.t)})}function wc(e,t,n){return e==="openai-completions"?n("keysProtocolShortChat"):e==="openai-responses"?n("keysProtocolShortResponses"):e==="anthropic-messages"?n("keysProtocolShortAnthropic"):t}function pc(e,t,n){t.replaceChildren();for(let r of Array.from(e.options)){let o=r.value;if(o.length===0)continue;let i=document.createElement("button");i.type="button",i.className="bre-protocol-card",i.setAttribute("role","radio"),i.setAttribute(Dn,o),i.textContent=wc(o,(r.textContent??o).trim(),n.t),i.title=(r.textContent??o).trim(),i.addEventListener("click",()=>{e.value!==o&&(eb(e,o),vc(e,t))}),t.appendChild(i)}}function nb(e,t,n){let r=rt(e,t.apiProtocol);if(!(r instanceof HTMLSelectElement))return;let o=Fn(e,t.apiProtocol);if(o===void 0)return;let i=o.querySelector(`[${qa}]`);if(i===null){let a=document.createElement("div");i=a,a.setAttribute(qa,"1"),a.className="bre-protocol-cards",a.setAttribute("role","radiogroup");let s=r.getAttribute("aria-label");s!==null&&a.setAttribute("aria-label",s),r.setAttribute(Ba,"1"),r.after(a),pc(r,a,n),a.addEventListener("keydown",d=>{let l=d.key==="ArrowRight"||d.key==="ArrowDown"?1:d.key==="ArrowLeft"||d.key==="ArrowUp"?-1:0,c=Array.from(a.querySelectorAll(`[${Dn}]`));if(c.length===0)return;if(d.key==="Home"||d.key==="End"){d.preventDefault();let u=d.key==="Home"?c[0]:c[c.length-1];u?.click(),u?.focus();return}if(l===0)return;d.preventDefault();let p=c.findIndex(u=>u.classList.contains("is-selected")),m=c[(Math.max(p,0)+l+c.length)%c.length];m?.click(),m?.focus()})}else tb(r,i,n)||pc(r,i,n);mt(r,!0),vc(r,i)}function Ga(e,t,n){let r=e===null?0:e.querySelectorAll(`[${Lt}], [${Kn}]`).length,o=r===0?"":n.t("keysEndpointsCount",{count:r});if(o.length===0){t.hasAttribute("title")&&t.removeAttribute("title");return}t.getAttribute("title")!==o&&t.setAttribute("title",o)}function rb(e,t,n){let r=e.querySelector(`[${_n}]`);if(Fn(e,t.apiProtocol)===void 0){r?.remove(),e.querySelector(`[${mc}]`)?.remove();return}let o=Fn(e,t.baseUrl);if(o===void 0)return;let i=rt(e,t.baseUrl);if(i===void 0)return;let a=bc(o,i);if(a===void 0||a===r)return;let s=()=>e.querySelector(`[${In}]`),d=c=>{let p=n.t("keysMoreEndpoints");c.textContent!==p&&(c.textContent=p);let m=s();c.setAttribute("aria-expanded",m!==null&&!m.hidden?"true":"false"),Ga(m,c,n)};if(r!==null){r.parentElement!==a&&a.append(r),d(r);return}let l=document.createElement("button");l.type="button",l.setAttribute(_n,"1"),l.className="bre-endpoint-toggle",l.textContent=n.t("keysMoreEndpoints"),l.addEventListener("click",()=>{let c=s();if(c!==null&&(c.hidden=!c.hidden,d(l),!c.hidden)){let p=on(e,t);p.length>0&&ab(c,p,n,e,t)}}),a.append(l),d(l)}var Pn=new WeakMap,xc=1e3,qo=new WeakMap,qn=0,Po=new Map;function ob(e,t){qn+=1,typeof CustomEvent=="function"&&document.dispatchEvent(new CustomEvent(pr,{detail:{route:e,openai:t.openai??"",anthropic:t.anthropic??""}}))}function ib(e,t){qn+=1,typeof CustomEvent=="function"&&document.dispatchEvent(new CustomEvent(gr,{detail:{route:e,endpoint:t}}))}function Lr(e){let t=e.getAttribute(Lt);return t==="openai"||t==="anthropic"?t:void 0}async function ab(e,t,n,r,o){for(let i of Array.from(e.querySelectorAll(`[${Lt}], [${Kn}]`)))await kc(i,t,n,r,o)}async function kc(e,t,n,r,o){let i=e.querySelector(".bre-endpoint-url");if(i===null)return;if(e.hasAttribute(Kn)){await Ec(e,i,t,n);return}let a=Lr(e);if(a===void 0)return;let s=(Pn.get(e)??0)+1;Pn.set(e,s),qo.set(e,{at:Date.now(),epoch:qn});let d=n.client??Fe,l=await Bo(t,d);if(l===void 0||Pn.get(e)!==s||Lr(e)!==a||document.activeElement===i)return;await Tc(r,o,n,t,wt(r,o),l);let c=l[a];i.value!==c&&(i.value=c);let p=e.querySelector(".bre-endpoint-family");p!==null&&rn(p,c.length>0)}async function Ec(e,t,n,r){let o=(Pn.get(e)??0)+1;Pn.set(e,o),qo.set(e,{at:Date.now(),epoch:qn});let i=r.client??Fe;if(i.balanceEndpoint===void 0)return;let a=await i.balanceEndpoint(n);if(!a.ok||Pn.get(e)!==o||document.activeElement===t)return;let s=a.endpoint??"";t.value!==s&&(t.value=s);let d=e.querySelector(".bre-endpoint-family");d!==null&&rn(d,s.length>0)}async function Tc(e,t,n,r,o,i,a=!1){if(o===void 0||!a&&i[o].length>0)return;let s=rt(e,t.baseUrl);if(!(s instanceof HTMLInputElement)||document.activeElement===s)return;let d=s.value.trim();if(d.length===0&&!a)return;let l=n.client??Fe;await Ua(r,l,c=>{if(!(!a&&c[o].length>0)&&c[o]!==d)return{openai:o==="openai"?d:c.openai,anthropic:o==="anthropic"?d:c.anthropic}})}function Wa(e,t,n){let r=Fn(e,t.baseUrl);if(r===void 0||r.parentElement===null)return;let o=wt(e,t);if(o===void 0)return;let i=r.querySelector(`:scope > [${In}]`);i===null&&(i=e.querySelector(`[${In}]`),i!==null&&r.appendChild(i)),i===null&&(i=document.createElement("div"),i.setAttribute(In,"1"),i.hidden=!0,r.appendChild(i));let a=Xl.filter(p=>p!==o),s=Array.from(i.children).filter(p=>p instanceof HTMLElement&&p.hasAttribute(Lt));if(!(a.length===s.length&&a.every((p,m)=>Lr(s[m])===p)))for(let p of a){let m=i.querySelector(`[${Lt}="${p}"]`);m===null&&(m=sb(e,t,n,p)),i.appendChild(m)}for(let p of Array.from(i.querySelectorAll(`[${Lt}]`))){let m=Lr(p);m!==void 0&&m!==o||p.remove()}let l=e.querySelector(`[${_n}]`);l!==null&&(l.setAttribute("aria-expanded",i.hidden?"false":"true"),Ga(i,l,n));let c=on(e,t);if(c.length>0)for(let p of Array.from(i.querySelectorAll(`[${Lt}]`))){let m=qo.get(p);(m===void 0||m.epoch!==qn||Date.now()-m.at>=xc)&&kc(p,c,n,e,t)}}function sb(e,t,n,r){let o=document.createElement("div");o.setAttribute(Lt,r),o.className="bre-endpoint-row";let i=document.createElement("span");i.className="bre-endpoint-family",i.textContent=hc(r,n.t),rn(i,!1);let a=document.createElement("input");a.type="url",a.className="bre-text-input bre-endpoint-url",a.spellcheck=!1,a.placeholder="https://\u2026";let s=n.client??Fe;return a.addEventListener("change",()=>{let d=on(e,t);if(d.length===0)return;let l=a.value.trim();if(l.length>0&&!/^https?:\/\//i.test(l)){a.setAttribute("aria-invalid","true"),a.title=n.t("keysEndpointInvalid");return}a.hasAttribute("aria-invalid")&&a.removeAttribute("aria-invalid"),a.hasAttribute("title")&&a.removeAttribute("title"),rn(i,l.length>0),(async()=>await Ua(d,s,c=>{let p=Lr(o);if(p!==void 0)return{openai:p==="openai"?l:c.openai,anthropic:p==="anthropic"?l:c.anthropic}}))()}),o.append(i,a),o}function Sc(e,t,n){let r=e.querySelector(`[${In}]`),o=e.querySelector(`[${Kn}]`),i=on(e,t);if(r===null||i.length===0){o?.remove();return}let a=o;a===null&&(a=db(e,t,n)),r.lastElementChild!==a&&r.appendChild(a);let s=e.querySelector(`[${_n}]`);s!==null&&Ga(r,s,n);let d=qo.get(a);if(d===void 0||d.epoch!==qn||Date.now()-d.at>=xc){let l=a.querySelector(".bre-endpoint-url");l!==null&&Ec(a,l,i,n)}}function db(e,t,n){let r=document.createElement("div");r.setAttribute(Kn,"1"),r.className="bre-endpoint-row bre-balance-row";let o=document.createElement("span");o.className="bre-endpoint-family",o.textContent=n.t("keysEndpointBalance"),rn(o,!1);let i=document.createElement("input");i.type="url",i.className="bre-text-input bre-endpoint-url",i.spellcheck=!1,i.placeholder="https://\u2026",i.setAttribute("aria-label",n.t("keysEndpointBalance")),i.title=n.t("keysEndpointBalanceHint");let a=n.client??Fe,s=a.setBalanceEndpoint;return i.addEventListener("change",()=>{let d=on(e,t);if(d.length===0)return;let l=i.value.trim();if(l.length>0&&!/^https?:\/\//i.test(l)){i.setAttribute("aria-invalid","true"),i.title=n.t("keysEndpointInvalid");return}i.hasAttribute("aria-invalid")&&i.removeAttribute("aria-invalid"),i.title=n.t("keysEndpointBalanceHint"),rn(o,l.length>0),s!==void 0&&(async()=>(await s.call(a,d,l)).ok&&ib(d,l))()}),r.append(o,i),r}async function lb(e,t,n,r,o){let i=on(e,t),a=rt(e,t.baseUrl);if(i.length===0||!(a instanceof HTMLInputElement))return;let s=n.client??Fe,d=await Bo(i,s);if(d===void 0||wt(e,t)!==o)return;let l=a.value.trim();if(l.length>0&&l!==d[r]){let m=await Ua(i,s,u=>{if(wt(e,t)===o)return{openai:r==="openai"?l:u.openai,anthropic:r==="anthropic"?l:u.anthropic}});if(m===void 0||(d=m,wt(e,t)!==o))return}let c=d[o];if(a.value===c)return;let p=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set;p===void 0?a.value=c:p.call(a,c),a.dispatchEvent(new Event("input",{bubbles:!0})),a.dispatchEvent(new Event("change",{bubbles:!0})),Wa(e,t,n)}async function Ua(e,t,n){let o=(Po.get(e)??Promise.resolve()).then(async()=>{let i=await Bo(e,t);if(i===void 0)return;let a=n(i);if(a===void 0)return;let s=t.setEndpoints;if(typeof s!="function")return;let d=await s.call(t,e,a.openai,a.anthropic);if(!d.ok)return;let l={openai:d.endpoints.openai??"",anthropic:d.endpoints.anthropic??""};return ob(e,d.endpoints),l});Po.set(e,o);try{return await o}finally{Po.get(e)===o&&Po.delete(e)}}async function Bo(e,t){if(t.endpoints!==void 0){let r=await t.endpoints(e);return r.ok?{openai:r.endpoints?.openai??"",anthropic:r.endpoints?.anthropic??""}:void 0}let n=await t.list(e);if(n.ok)return{openai:n.endpoints.openai??"",anthropic:n.endpoints.anthropic??""}}function cb(e,t,n){let r=Fn(e,t.baseUrl),o=wt(e,t),i=r?.getAttribute(Mr);yc(e,t,n.t),Wa(e,t,n),Sc(e,t,n),!(r===void 0||i===void 0||o===void 0)&&i!==o&&(i!=="openai"&&i!=="anthropic"||lb(e,t,n,i,o))}function Mc(e,t,n){Qh(e,t),nb(e,t,n),yc(e,t,n.t),rb(e,t,n),Wa(e,t,n),Sc(e,t,n);let r=rt(e,t.apiProtocol);r instanceof HTMLSelectElement&&!r.hasAttribute(cc)&&(r.setAttribute(cc,"1"),r.addEventListener("change",()=>cb(e,t,n)));let o=rt(e,t.baseUrl);o instanceof HTMLInputElement&&!uc.has(o)&&(uc.add(o),o.addEventListener("change",()=>{let i=on(e,t),a=wt(e,t);if(i.length===0||a===void 0)return;let s=n.client??Fe;(async()=>{let d=await Bo(i,s);d!==void 0&&wt(e,t)===a&&await Tc(e,t,n,i,a,d,!0)})()}))}function ub(){for(let e of Array.from(document.querySelectorAll(`select[${Ba}]`)))e.hidden=!1,e.removeAttribute(Ba)}function Lc(){ub();for(let e of Array.from(document.querySelectorAll(`[${In}], [${Lt}], [${Kn}], [${_n}], [${mc}], [${qa}], [${_o}]`)))e.remove();for(let e of Array.from(document.querySelectorAll(`[${Ko}], [${Do}], [${Fo}], [${Mr}]`)))e.removeAttribute(Ko),e.removeAttribute(Do),e.removeAttribute(Fo),e.removeAttribute(Mr)}function Bn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var ja="__breLedgerDocument";function _c(){let e=globalThis;return e[ja]??(e[ja]=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`)}var Uo="bre:held-writes:v1";function Xa(){try{return typeof sessionStorage>"u"?void 0:sessionStorage}catch{return}}function xt(e){let t=Xa();if(t!==void 0)try{if(e.pending.size===0&&e.queued.size===0){t.removeItem(Uo);return}let n={document:_c(),committed:[...e.committing].filter(r=>e.queued.has(r)),pending:[...e.pending].map(([r,o])=>[r,[...o]]),queued:[...e.queued].map(([r,o])=>[r,[...o]])};t.setItem(Uo,JSON.stringify(n))}catch{}}function Ac(e,t){if(!Array.isArray(e))return;let n=[];for(let r of e){if(!Array.isArray(r)||r.length!==2)return;let[o,i]=r;if(typeof o!="string"||!Array.isArray(i))return;let a=[];for(let s of i){if(!Array.isArray(s)||s.length!==2)return;let[d,l]=s;if(typeof d!="string"||!$(l)||t!==void 0&&!t(l))return;a.push([d,l])}n.push([o,a])}return n}function fb(e){let t=Xa();if(t!==void 0)try{let n=t.getItem(Uo);if(n===null)return;let r=JSON.parse(n);if(r.document!==_c())return;let o=Ac(r.pending),i=Ac(r.queued,xb);if(o===void 0||i===void 0)return;let a=Array.isArray(r.committed)?r.committed.filter(s=>typeof s=="string"):[];for(let[s,d]of o)e.pending.set(s,new Map(d));for(let[s,d]of i)a.includes(s)&&(e.queued.set(s,new Map(d)),e.committing.add(s))}catch{}}function Dc(e,t){(async()=>{try{await Qa(t,e),await Za(t,e)}catch(n){console.error(`[bre] teardown flush failed: ${n instanceof Error?n.message:String(n)}`)}})()}function Fc(e,t){(async()=>{try{await Qa(t,e,!0),await Za(t,e,!0)}catch(n){console.error(`[bre] unload flush failed: ${n instanceof Error?n.message:String(n)}`)}finally{try{Xa()?.removeItem(Uo)}catch{}}})()}function Kc(){let e={disposed:!1,mounted:new Map,describePromise:void 0,pending:new Map,missedScans:new Map,queued:new Map,editing:void 0,flushing:!1,flushFailures:0,nextFlushAt:0,committing:new Set,adapting:new Set,signalsUnavailable:!1,submitWired:new WeakSet,cancelWired:new WeakSet,disclosureWired:new WeakSet,editWired:new WeakSet,addModelWired:new WeakSet,addProviderWired:new WeakSet};return fb(e),e}async function pb(e,t,n=!1){if(t.flushing)return;t.flushing=!0;let r;try{r=n&&Bc(t)?await de(e.api,{fresh:!0}):void 0;let o=await Qa(e,t,!1,r),i=await Za(e,t,!1,r);o||i?Rc(e,t):(t.flushFailures=0,t.nextFlushAt=0)}catch(o){Rc(e,t),console.error(`[bre] idle flush failed: ${o instanceof Error?o.message:String(o)}`)}finally{t.flushing=!1}try{e.onIdle?.(r)}catch(o){console.error(`[bre] idle hook failed: ${o instanceof Error?o.message:String(o)}`)}}var qc=new Set(["no-namespace","invalid-models"]);function Rc(e,t){t.flushFailures+=1;let n=Math.min(2**(t.flushFailures-1)*500,3e4);t.nextFlushAt=Date.now()+n,e.onBackoff?.(n)}function Bc(e){return e.queued.size>0||e.pending.size>0}function Gn(e,t,n,r,o,i,a,s){try{let d=e.pending.get(t);if(r===void 0){if(d===void 0)return;d.delete(n),d.size===0&&e.pending.delete(t);return}e.pending.set(t,(d??new Map).set(n,{efforts:r,...o===void 0?{}:{compat:o},...i===void 0?{}:{input:i},...s===void 0?{}:{imageGen:s===!0},...a===void 0?{}:{defaultEffort:a}}))}finally{xt(e)}}function Gc(e,t,n,r){e.queued.set(t,(e.queued.get(t)??new Map).set(n,r)),xt(e)}function mb(e,t,n){let r=e.pending.get(t);r!==void 0&&(r.delete(n),r.size===0&&e.pending.delete(t),xt(e))}function gb(e,t,n){let r=e.queued.get(t);r!==void 0&&(r.delete(n),r.size===0&&e.queued.delete(t),xt(e))}function hb(e,t,n){mb(e,t,n),gb(e,t,n)}function bb(e,t){e.queued.delete(t),e.pending.delete(t),e.missedScans.delete(t),e.committing.delete(t),xt(e)}function yb(e,t,n){if(t===void 0)return null;let i=t[et]!==!0&&t.reasoningEfforts!==void 0&&typeof t[vn]=="number"||t[et]!==!0&&n?.efforts!==void 0&&vb(t.reasoningEfforts,n.efforts)?!1:t.reasoningEfforts!==void 0||t[et]===!0||e.efforts==="keep",s=t[ht]!==!0&&n?.input!==void 0&&wb(t.input,n.input)?!1:Array.isArray(t.input)&&t.input.length>0||t[ht]===!0,d=i?"keep":e.efforts,l=s?void 0:e.input,c=t[tt]===!0,p=e.imageGen!==void 0&&e.imageGen!==c?e.imageGen:void 0,m=e.defaultEffort;return d==="keep"&&l===void 0&&p===void 0&&m===void 0?null:{efforts:d,...e.compat===void 0?{}:{compat:e.compat},...l===void 0?{}:{input:l},...p===void 0?{}:{imageGen:p},...m===void 0?{}:{defaultEffort:m}}}function vb(e,t){if(e===t)return!0;if(!$(e)||!$(t))return!1;let n=Object.keys(t);if(Object.keys(e).length!==n.length)return!1;let r=t;return n.every(o=>e[o]===r[o])}function wb(e,t){if(!Array.isArray(e)||e.length!==t.length)return!1;let n=new Set(t);return e.every(r=>typeof r=="string"&&n.has(r))}function xb(e){if(!$(e))return!1;let t=e.efforts;return t===!1||t==="keep"||$(t)}async function kb(e,t,n,r,o=!1,i){let a=i??await e.describeNamespace(),s=_e(a.namespace),d=[];for(let[m,u]of[...r]){let f=Cn(s,n).find(w=>w.id===m);if(f===void 0||t.pending.get(n)?.get(m)!==u)continue;let y=Jt(s,n),g=typeof f.name=="string"?f.name:void 0,E=bt(m,g===void 0?y:{...y,displayName:g}),L=yb(u,f,{...E.efforts===void 0?{}:{efforts:E.efforts},...E.input===void 0?{}:{input:E.input}});if(L===null){Gn(t,n,m,void 0);continue}d.push({modelId:m,efforts:L.efforts,...L.compat===void 0?{}:{compat:L.compat},...L.input===void 0?{}:{input:L.input},...L.imageGen===void 0?{}:{imageGen:L.imageGen},...L.defaultEffort===void 0?{}:{defaultEffort:L.defaultEffort}})}if(d.length===0)return!1;let l=!1,c=await br(e.api,n,d,()=>l?e.describeNamespace():(l=!0,Promise.resolve(a)),o?void 0:pu),p=!1;return d.forEach((m,u)=>{let f=c[u];if(f?.aborted!==!0){if(f?.ok===!0||f?.modelNotFound===!0){Gn(t,n,m.modelId,void 0);return}if(f?.error!==void 0&&qc.has(f.error)){Gn(t,n,m.modelId,void 0),console.error(`[bre] staged flush withdrew "${n}"/"${m.modelId}": ${f.error}`);return}p=!0,console.error(`[bre] staged flush write failed for "${n}"/"${m.modelId}": ${f?.error??"unknown"}`)}}),(t.pending.get(n)?.size??0)===0&&t.pending.delete(n),p}async function Qa(e,t,n=!1,r){for(let s of[...t.committing])t.queued.has(s)||t.committing.delete(s);if(![...t.queued.keys()].some(s=>t.committing.has(s)||t.signalsUnavailable))return xt(t),!1;let i=r??await e.describeNamespace();if(i.writable!==!0)return xt(t),!1;let a=!1;for(let[s,d]of[...t.queued]){if(!t.committing.has(s)&&!t.signalsUnavailable)continue;let c=[...d].map(([u,f])=>({modelId:u,efforts:f.efforts,...f.compat===void 0?{}:{compat:f.compat},...f.input===void 0?{}:{input:f.input},...f.imageGen===void 0?{}:{imageGen:f.imageGen},...f.defaultEffort===void 0?{}:{defaultEffort:f.defaultEffort}})),p=await br(e.api,s,c,()=>Promise.resolve(i),n?void 0:pu),m=!1;c.forEach((u,f)=>{let y=p[f];if(y?.aborted===!0){m=!0;return}if(y?.ok===!0||y?.modelNotFound===!0){d.delete(u.modelId);return}if(y?.error!==void 0&&qc.has(y.error)){d.delete(u.modelId),console.error(`[bre] held write withdrawn for "${s}"/"${u.modelId}": ${y.error}`);return}console.error(`[bre] held write failed for "${s}"/"${u.modelId}": ${y?.error??"unknown"}`)}),d.size===0?(t.queued.delete(s),t.committing.delete(s)):m||(a=!0)}return xt(t),a}async function Za(e,t,n=!1,r){if(t.pending.size===0)return!1;let o=r??await e.describeNamespace();if(o.writable!==!0)return!1;let i=_e(o.namespace),a=!1;for(let[s,d]of[...t.pending]){if(d.size===0){t.pending.delete(s);continue}Bn(i,s)&&await kb(e,t,s,d,n,o)&&(a=!0)}return xt(t),a}function $e(e,t){for(let n of t){let r=Array.from(e.querySelectorAll("input[aria-label], select[aria-label]")).find(o=>(o.getAttribute("aria-label")??"").startsWith(n));if(r!==void 0&&r.value.trim().length>0)return r.value.trim()}return""}function Cr(e){return e.closest('[class*="editor"], [class*="rowCard"], [class*="addCard"]')??void 0}function Eb(e){let t=e.closest('[class*="modelEntry"]');if(t===null){let r=Cr(e);if(r===void 0)return;let o=Array.from(r.querySelectorAll('[class*="modelAdvanced"]'));return o.length===1?o[0]:o.find(i=>i.offsetParent!==null)??o[0]}let n=Array.from(t.querySelectorAll('[class*="modelAdvanced"]'));return n.length===1?n[0]:n.find(r=>r.offsetParent!==null)??n[0]}function Wc(e,t){return Array.from(e.querySelectorAll("button[aria-label]")).find(n=>t.some(r=>(n.getAttribute("aria-label")??"").startsWith(r)))}function Cc(){return new Promise(e=>{if(typeof window.requestAnimationFrame!="function"){e();return}let t,n=()=>{window.clearTimeout(r),t!==void 0&&window.cancelAnimationFrame(t),e()},r=window.setTimeout(n,100);t=window.requestAnimationFrame(n)})}function Wo(e){return e.querySelector('[class*="modelInputTypes"]')!==null}var Tb="modelReasoning",Va="data-bre-reasoning-hidden";function Uc(e){return e.querySelector(`[class*="${Tb}"]`)??void 0}function es(e){let t=Uc(e);t!==void 0&&t.style.display!=="none"&&(t.setAttribute(Va,"1"),t.style.display="none")}function Ar(e){let t=Uc(e);t!==void 0&&t.getAttribute(Va)==="1"&&(t.removeAttribute(Va),t.style.display==="none"&&(t.style.display=""))}var jo="data-bre-capacity-hidden";function jc(e,t){return Array.from(e.children).filter(n=>n.nodeType!==1?!1:n.matches(`[class*="${t}"]`))}function Sb(e){return jc(e,"modelField")}function Mb(e){return jc(e,"modelInputTypes")}function zc(e){return[...Sb(e),...Mb(e)]}function Lb(e){for(let t of e)t.style.display!=="none"&&(t.setAttribute(jo,"1"),t.style.display="none")}function Ab(e){for(let t of e)t.getAttribute(jo)==="1"&&(t.removeAttribute(jo),t.style.display==="none"&&(t.style.display=""))}function Rb(e){Lb(zc(e))}function za(e){Ab(zc(e))}function $c(e){let t=e.querySelector('[class*="modelInputTypes"]');return t===null||t.getAttribute(jo)==="1"?!1:!t.hidden&&t.style.display!=="none"}function Vc(e,t){let n=e.querySelector('[class*="modelInputTypes"]');if(n===null)return;let r=Array.from(n.querySelectorAll('input[type="checkbox"]')),o=r.find(i=>{let a=i.closest("label")?.textContent?.trim();return a!==void 0&&t.includes(a)});return o!==void 0?o:r.length===2?r[1]:void 0}function Hr(e,t,n){if(!$c(e))return!1;let r=Vc(e,n);return r===void 0||r.disabled?!1:(r.checked!==t&&r.click(),!0)}function Ya(e,t,n){return t==null||e===void 0||$c(e)&&Hr(e,t.includes("image"),n),t}function Hc(e,t){let n=e.getAttribute("aria-label")??"";if(t.some(o=>n.startsWith(o)))return!0;let r=e.closest("label")?.textContent?.trim()??"";return r.length>0&&t.some(o=>r.includes(o))}function ts(e,t){let n=[...t.modelId,...t.modelName],r=Array.from(e.querySelectorAll("input")).filter(s=>s.type!=="checkbox"&&s.type!=="radio").filter(s=>s.closest("[data-plugin]")===null).filter(s=>!n.some(d=>(s.getAttribute("aria-label")??"").startsWith(d))),o=r.find(s=>Hc(s,t.contextWindow)),i=r.find(s=>Hc(s,t.maxOutput));if(o!==void 0&&i!==void 0)return{contextWindow:o,maxOutput:i};let a=r.filter(s=>s!==o&&s!==i);return{contextWindow:o??a[0],maxOutput:i??(o!==void 0?a[0]:a[1])}}function Yc(e,t,n){let r=ts(e,t),o=(i,a)=>i===void 0||i.disabled||a===void 0||!Number.isFinite(a)||a<=0||yt(i.value)!==void 0?!1:Jc(i,String(a));return{contextWindow:o(r.contextWindow,n.contextWindow),maxOutput:o(r.maxOutput,n.maxTokens)}}function Jc(e,t){return e.disabled?!1:(e.value===t||(Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set?.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0}))),!0)}function Cb(e,t){let n=ts(e,t),r=a=>{if(a!==void 0)return yt(a.value)},o=r(n.contextWindow),i=r(n.maxOutput);return{...o===void 0?{}:{contextWindow:o},...i===void 0?{}:{maxTokens:i}}}function Hb(e,t,n){let r=ts(e,t),o=(i,a)=>i===void 0?!1:Jc(i,a===void 0||!Number.isFinite(a)||a<=0?"":String(a));return{contextWindow:"contextWindow"in n?o(r.contextWindow,n.contextWindow):!1,maxOutput:"maxTokens"in n?o(r.maxOutput,n.maxTokens):!1}}async function Xc(e,t){let n=e,r=n.offsetHeight;if(r<=0)return t();let o=n.style.height,i=n.style.overflow,a=n.style.boxSizing;n.style.boxSizing="border-box",n.style.height=`${r}px`,n.style.overflow="hidden";try{return await t()}finally{n.style.height=o,n.style.overflow=i,n.style.boxSizing=a}}async function Nb(e,t,n){if(e===void 0)return!1;let r=t.inputImage;if(Wo(e))return Hr(e,!0,r);let o=e.closest('[class*="modelEntry"]')??e;if(o.querySelector('[class*="modelAdvanced"]')!==null)return!1;let i=Wc(o,t.capacity);return i===void 0||i.disabled?!1:Xc(o,async()=>{i.click(),Wo(o)||await n();try{return Wo(o)&&Hr(o,!0,r)}finally{i.click()}})}async function Ob(e,t,n,r){if(e.matches('[class*="modelAdvanced"]'))return r(e);let o=e.closest('[class*="modelEntry"]')??e;if(o.querySelector('[class*="modelAdvanced"]')!==null)return r(o);let i=Wc(o,t.capacity);return i===void 0||i.disabled?!1:Xc(o,async()=>{i.click(),o.querySelector('[class*="modelAdvanced"]')===null&&await n();try{return o.querySelector('[class*="modelAdvanced"]')!==null?r(o):!1}finally{i.click()}})}function Ib(e,t,n,r,o){n.disposed||!e.isConnected||fu(e)===void 0||Array.from(e.querySelectorAll("button[aria-label]")).some(a=>o.capacity.some(s=>(a.getAttribute("aria-label")??"").startsWith(s)))||So(e,Pb(e,_e(r.namespace),o),{t:t.t,onRequest:a=>Qc(n,t,a)})}function Pb(e,t,n){let r=[];for(let o of Ha(e)){let i=Cr(o);if(i===void 0)continue;let a=an(i,t,n);a===void 0||a.staged||r.push({catalogue:o,route:a.route})}return r}function _b(e,t,n){let r=[],o=new Set;for(let i of e){if(o.has(i.card))continue;o.add(i.card);let a=an(i.card,t,n);if(a===void 0)continue;let[s]=Ha(i.card);s!==void 0&&r.push({catalogue:s,route:a.route})}return r}function Db(e,t,n,r){let o=[],i=new Set;for(let a of r.capacity){let s=Array.from(e.querySelectorAll("button[aria-label]")).filter(d=>(d.getAttribute("aria-label")??"").startsWith(a));for(let d of s){let l=Cr(d);if(l===void 0)continue;let c=d.closest('[class*="modelEntry"]')??l,p=$e(c,r.modelId);p.length===0||i.has(p)||an(l,n,r)?.route===t&&(i.add(p),o.push({id:p,name:$e(c,r.modelName),row:c}))}}return o}async function Qc(e,t,n,r=[]){if(n.length===0)return{held:0,unsuggested:0,blocked:"unknown-route"};if(e.adapting.has(n))return{held:0,unsuggested:0,blocked:"busy"};e.adapting.add(n);let o=0,i=0;try{fa();let a,s=()=>a??(a=t.describeNamespace()),d=await s(),l=_e(d.namespace);if(d.writable!==!0)return{held:0,unsuggested:0,blocked:"unwritable"};if(!Bn(l,n)&&r.length===0)return{held:0,unsuggested:0,blocked:"unknown-route"};let p=Cn(l,n),m=new Set;for(let v of p){let b=typeof v.id=="string"?v.id:"";b.length>0&&m.add(b)}let u=p.slice();for(let v of r)v.id.length===0||m.has(v.id)||u.push({id:v.id,name:v.name});if(u.length===0)return{held:0,unsuggested:0,blocked:"no-models"};let f=l[n]??{},y=typeof f.api=="string"?f.api:void 0,g=new Set,E=new Map;for(let[v,b]of e.mounted)b.props.route===n&&(E.set(b.props.modelId,v),b.props.efforts!==void 0&&g.add(b.props.modelId));let L=new Map;for(let v of r)v.row!==void 0&&L.set(v.id,v.row);let w=!1,H=(v,b)=>Ya(E.get(v),b,t.labels().inputImage),D=async(v,b)=>{if(b.image!==!0)return;let N=E.get(v)??L.get(v);N!==void 0&&await Nb(N,t.labels(),Cc)},te=async(v,b,N)=>{let x=b.image===!0,T=N.contextWindow!==void 0||N.maxTokens!==void 0;if(!x&&!T)return;let O=E.get(v)??L.get(v);if(O===void 0)return;let K=t.labels();await Ob(O,K,Cc,G=>{x&&Hr(G,!0,K.inputImage),T&&Yc(G,K,N)})},U=yo(t.api,s,(v,b,N,x,T,O,K)=>{Gn(e,v,b,N,x,H(b,T),O,K)},(v,b,N)=>{Gc(e,v,b,{...N,input:H(b,N.input)})},void 0,()=>w);for(let v of u){let b=typeof v.id=="string"?v.id:"";if(b.length===0)continue;let N=po(u,b),x=mo(u,b),T=v[tt]===!0,O=N!==void 0||v[et]===!0,K=Array.isArray(x)&&x.length>0||v[ht]===!0||T;if(g.has(b)&&!O)continue;if(O&&K){let re=E.get(b)??L.get(b);if(Array.isArray(x)&&x.includes("image")&&re!==void 0){let X=t.labels().inputImage,ue=Vc(re,X);ue!==void 0&&!ue.disabled&&!ue.checked&&Hr(re,!0,X)}continue}let G=go(u,b),j=bo(u,b)??"",h=await U.suggest(n,b,ho(u,b));if(!h.ok){i+=1;continue}let S=h.suggestion,I=S.efforts!==!1,_=S.imageGen===!0?St(void 0,!0):S.input===void 0?St(x,T):St(S.input);if(O){if(!_.image&&!_.imageGen||e.queued.get(n)?.has(b)===!0)continue;await D(b,_),w=!m.has(b),U.commit(n,b,Eo({efforts:"keep",...ko(_)})),w&&t.onPendingChanged?.(),w=!1,o+=1;continue}let ee=j!==""?j:S.defaultEffort??j,Z=ee===j?void 0:ee===""?null:ee;w=!m.has(b),await te(b,_,{...S.contextWindow===void 0?{}:{contextWindow:S.contextWindow},...S.maxTokens===void 0?{}:{maxTokens:S.maxTokens}});let oe=xo(_,x,T)?void 0:ko(_);U.commit(n,b,Eo({efforts:Ra(I,Nn(en(S.efforts)),N),input:oe?.input,imageGen:oe?.imageGen,defaultEffort:Z,appliedCompat:S.compat,routeApi:y,initialCompat:G})),w&&t.onPendingChanged?.(),w=!1,o+=1}return{held:o,unsuggested:i}}catch(a){return console.warn("[bre] provider-wide adapt failed:",a),{held:o,unsuggested:i,failed:a instanceof Error?a.message:String(a)}}finally{e.adapting.delete(n)}}function Fb(e){return e.querySelector(`[data-plugin="${ye}"]`)!==null}function Kb(e,t){return e.route===t.route&&e.routeDisplayName===t.routeDisplayName&&e.routeApi===t.routeApi&&e.routeBaseURL===t.routeBaseURL&&e.modelId===t.modelId&&e.modelName===t.modelName&&e.index===t.index&&e.readOnly===t.readOnly&&e.defaultEffort===t.defaultEffort&&e.staged===t.staged&&e.officialInputTypes===t.officialInputTypes&&e.effortsUnset===t.effortsUnset&&wr(e.efforts,t.efforts)&&Bb(e.input,t.input)&&e.imageGen===t.imageGen&&qb(e.compat,t.compat)}function qb(e,t){return e===t?!0:e===void 0||t===void 0?!1:JSON.stringify({...e},Object.keys({...e,...t}).sort())===JSON.stringify({...t},Object.keys({...e,...t}).sort())}function Bb(e,t){if(e===t)return!0;if(e===void 0||t===void 0)return!1;let n=new Set(e);return e.length===t.length&&t.every(r=>n.has(r))}function Gb(e,t){return Array.from(e.querySelectorAll("input[aria-label], select[aria-label]")).some(n=>t.some(r=>(n.getAttribute("aria-label")??"").startsWith(r)))}function an(e,t,n){let r=e.querySelector('[class*="editorRoute"]')?.textContent?.trim();if(r!==void 0&&r.length>0&&Bn(t,r))return{route:r,staged:!1};if(Gb(e,n.routeId)){let a=$e(e,n.routeId);return a.length>0&&!Bn(t,a)?{route:a,staged:!0}:void 0}let o=e.querySelector('[class*="editorTitle"], [class*="rowName"]')?.textContent?.trim();if(o===void 0||o.length===0)return;let i=Object.entries(t).find(([,a])=>a.displayName===o);if(i!==void 0)return{route:i[0],staged:!1};if(Bn(t,o))return{route:o,staged:!1}}function Wb(e,t){let n=e.querySelector('[class*="editorActions"]');if(n===null)return;let r=Array.from(n.querySelectorAll("button"));if(r.length<2)return;let o=(p,m)=>(p.textContent??"").trim()===m,i=n.querySelector('[class*="primaryButton"]'),a=n.querySelector('[class*="secondaryButton"]');if(i!==null&&a!==null)return{submit:i,cancel:a};let s=[...r].reverse().find(p=>t.apply.some(m=>o(p,m))),d=[...r].reverse().find(p=>t.cancel.some(m=>o(p,m)));if(s!==void 0&&d!==void 0)return{submit:s,cancel:d};let l=r[r.length-1],c=r[r.length-2];if(!(l===void 0||c===void 0))return{submit:l,cancel:c}}function Un(e,t,n){t.has(e)||(t.add(e),e.addEventListener("click",n,{capture:!0}))}var $a=new WeakMap,Ja=new Set;function Zc(){for(let e of Array.from(Ja))e.release()}var Nr=420,eu=320,Ub=160,Nc=2e3,jb=150,tu=new Set(["PageUp","PageDown","Home","End","ArrowUp","ArrowDown"," "]);function ns(e,t=eu){for(let n of _a(e)){let r=zo.get(n);if(r!==void 0){window.clearTimeout(r.timer),r.timer=window.setTimeout(()=>Oc(n),t);continue}n.style.overflowAnchor!=="none"&&(zo.set(n,{saved:n.style.overflowAnchor,timer:window.setTimeout(()=>Oc(n),t)}),n.style.overflowAnchor="none")}}var zo=new Map;function Oc(e){let t=zo.get(e);t!==void 0&&(zo.delete(e),e.style.overflowAnchor=t.saved)}function jn(e,t,n=!1){let r=_a(e),o=r[0];if(o===void 0||!e.isConnected)return;let i=performance.now(),a=$a.get(o);if(a!==void 0)if(n)a.release();else{a.deadline=Math.min(Math.max(a.deadline,i+t),a.startedAt+Nc);return}let s=e.getBoundingClientRect(),d=s.top,l=s.height,c=new Map,p=new Map;for(let w of r){c.set(w,w.scrollTop);let H=w.style.overflowAnchor;H!=="none"&&p.set(w,H),w.style.overflowAnchor="none"}let m=new Set(r),u={deadline:i+t,startedAt:i,frame:void 0,release:()=>{}},f=()=>{if(Ja.delete(u)){u.frame!==void 0&&(window.cancelAnimationFrame(u.frame),u.frame=void 0);for(let[w,H]of p)w.style.overflowAnchor=H;$a.delete(o),document.removeEventListener("wheel",y,!0),document.removeEventListener("touchstart",y,!0),document.removeEventListener("pointerdown",y,!0),document.removeEventListener("keydown",g,!0)}};function y(){f()}function g(w){tu.has(w.key)&&f()}u.release=f,$a.set(o,u),Ja.add(u),document.addEventListener("wheel",y,{capture:!0,passive:!0}),document.addEventListener("touchstart",y,{capture:!0,passive:!0}),document.addEventListener("pointerdown",y,{capture:!0}),document.addEventListener("keydown",g,{capture:!0});let E=0,L=()=>{if(u.frame=void 0,E+=1,!e.isConnected||E>=jb){f();return}let w=e.getBoundingClientRect(),H=Math.abs(w.height-l)>.5;if(!H&&[...m].some(v=>v.scrollTop!==c.get(v))){f();return}let D=[];if(H){for(let v of r){let b=c.get(v);b===void 0||v.scrollTop===b||(D.push(v),v.scrollTop=b,c.set(v,v.scrollTop))}w=e.getBoundingClientRect()}let te=w.top-d;te!==0&&zb(r,m,c,te,D);let U=performance.now();if(H&&(l=w.height,u.deadline=Math.min(Math.max(u.deadline,U+Ub),u.startedAt+Nc)),U>=u.deadline){f();return}u.frame=window.requestAnimationFrame(L)};u.frame=window.requestAnimationFrame(L)}function zb(e,t,n,r,o=[]){let i=r;for(let a of new Set([...o,...t,...e])){if(i===0)break;let s=a.scrollTop;if(s!==n.get(a))continue;a.scrollTop=s+i;let d=a.scrollTop;d!==s&&(n.set(a,d),t.add(a),i-=d-s)}}var rs='[class*="modelList"]',$b="bre-list-slack",nu=3e3,Vb='button[class*="iconButtonDanger"]',Or,Bt=new WeakMap,Wn=new Set;function ru(e){if(!(e instanceof Element))return;let t=e.closest(rs);if(t===null)return;let n=zl(t).map(r=>({host:r,top:r.scrollTop}));n.length!==0&&(Or={targets:n,at:performance.now()})}function At(){Or=void 0}function ou(e){ru(e.target),lu(e.target)}function iu(e){if(tu.has(e.key)){At();return}ru(e.target),lu(e.target)}var Rr=0;function au(){Rr+=1,!(Rr>1)&&(document.addEventListener("click",ou,!0),document.addEventListener("keydown",iu,!0),document.addEventListener("focusin",At,!0),document.addEventListener("pointerdown",At,!0),document.addEventListener("wheel",At,{capture:!0,passive:!0}),document.addEventListener("touchstart",At,{capture:!0,passive:!0}))}function $o(e){let t=Bt.get(e);t!==void 0&&(Bt.delete(e),Wn.delete(t),t.scrollTarget.removeEventListener("scroll",t.onScroll),t.spacer.remove())}function Yb(e){return e===document.scrollingElement?document:e}function Jb(){if(Wn.size!==0)for(let e of Array.from(Wn)){let t=e.host;if(!e.spacer.isConnected){Bt.delete(t),Wn.delete(e),e.scrollTarget.removeEventListener("scroll",e.onScroll);continue}t.scrollTop<=t.scrollHeight-t.clientHeight-e.height&&$o(t)}}function su(e,t){return e.scrollTop>e.scrollHeight-e.clientHeight-t}function du(e,t){let n=Bt.get(e);if(n!==void 0)return n.height!==t&&(n.height=t,n.spacer.style.height=`${t}px`),n;let r=document.createElement("div");r.className=$b,r.dataset.plugin=ye,r.setAttribute("aria-hidden","true"),r.style.height=`${t}px`,(e===document.scrollingElement?document.body??e:e).appendChild(r);let i=()=>{let s=Bt.get(e);s!==void 0&&!su(e,s.height)&&$o(e)},a={host:e,spacer:r,height:t,onScroll:i,scrollTarget:Yb(e)};return Bt.set(e,a),Wn.add(a),a.scrollTarget.addEventListener("scroll",i,{passive:!0}),a}function lu(e){if(!(e instanceof Element))return;let t=e.closest(Vb);if(t===null)return;let n=t.closest(rs);if(n===null)return;let r=t.closest('[class*="modelEntry"]');if(r===null)return;let o=Or;if(o===void 0||performance.now()-o.at>nu)return;let i=Number.parseFloat(getComputedStyle(n).rowGap)||0,a=r.getBoundingClientRect().height+i;if(!(a<=0))for(let{host:s,top:d}of o.targets){if(!s.isConnected)continue;let l=Bt.get(s),c=l===void 0?0:l.height,p=s.scrollHeight-s.clientHeight-c-d;p>=a||du(s,Math.max(c,a-p))}}function Xb(e=performance.now()){let t=Or;if(!(t===void 0||e-t.at>nu))for(let n of t.targets){let r=n.host;if(!r.isConnected)continue;let o=Bt.get(r),i=o===void 0?0:o.height,a=r.scrollHeight-r.clientHeight-i,s=n.top-a;if(s<=0){o!==void 0&&!su(r,o.height)&&$o(r);continue}du(r,s),r.scrollTop!==n.top&&(r.scrollTop=n.top)}}function cu(){if(Rr=Math.max(0,Rr-1),!(Rr>0)){document.removeEventListener("click",ou,!0),document.removeEventListener("keydown",iu,!0),document.removeEventListener("focusin",At,!0),document.removeEventListener("pointerdown",At,!0),document.removeEventListener("wheel",At,!0),document.removeEventListener("touchstart",At,!0),Or=void 0;for(let e of Array.from(Wn))$o(e.host)}}function uu(e,t=Nr){Xb(),Jb();let n=new Set;for(let r of Array.from(e.querySelectorAll(rs))){let o=r.closest('[class*="rowCard"], [class*="setupCard"], [class*="addCard"]');o===null||n.has(o)||(n.add(o),jn(o,t))}}function Qb(e,t){Un(e,t,()=>{let n=e.closest('[class*="modelEntry"]')??e.closest('[class*="rowCard"]');n!==null&&jn(e.closest('[class*="rowCard"]')??n,Nr)})}var Ic="{provider}";function Zb(e,t){let n=t.editProvider.map(o=>{let i=o.indexOf(Ic);return i<0?void 0:{prefix:o.slice(0,i),suffix:o.slice(i+Ic.length)}}).filter(o=>o!==void 0);if(n.length===0)return[];let r=[];for(let o of Array.from(e.querySelectorAll("button[aria-label]"))){let i=o.getAttribute("aria-label")??"";n.some(a=>i.length>a.prefix.length+a.suffix.length&&i.startsWith(a.prefix)&&i.endsWith(a.suffix))&&o.closest("[data-plugin]")===null&&r.push(o)}return r}function ey(e,t){Un(e,t,()=>{let n=e.closest('[class*="rowCard"], [class*="setupCard"], [class*="addCard"]');n!==null&&jn(n,Nr)})}function ty(e,t){let n=[];for(let r of Array.from(e.querySelectorAll("button"))){if(r.closest("[data-plugin]")!==null)continue;let o=r.getAttribute("aria-label")??"";if(t.addModel.some(a=>o.startsWith(a))){n.push(r);continue}let i=(r.textContent??"").trim();i.length>0&&t.addModel.some(a=>i===a||i===`+ ${a}`)&&n.push(r)}return n}function ny(e,t,n){Un(e,n,()=>{t.isConnected&&jn(t,Nr)})}function ry(e,t){Un(e,t,()=>{let n=e.closest('[class*="addBlock"]');n!==null&&jn(n,Nr,!0)})}function fu(e){return e.querySelector('[class*="editorActions"]')??e.querySelector('[class*="modelEntry"]')??void 0}function pu(){return fu(ft())!==void 0}function oy(e,t,n){let r={routeId:t.routeId,modelName:t.modelName,baseUrl:t.baseUrl,apiProtocol:t.apiProtocol},o=new Set;for(let i of e){let a=Array.from(i.querySelectorAll("input[aria-label], select[aria-label]")),s=d=>a.some(l=>d.some(c=>(l.getAttribute("aria-label")??"").startsWith(c)));s(t.apiProtocol)&&s(t.baseUrl)&&o.add(i)}for(let i of o)Mc(i,r,{t:n})}var Go=new WeakMap;function Pc(e,t,n,r=!1){let o=e.describePromise;if(o===void 0)return;let i=Go.get(e);if(i?.promise===o){i.run=t,i.phase=n,i.reportReadFailure=r;return}let a={promise:o,run:t,phase:n,reportReadFailure:r};Go.set(e,a);let s=()=>{Go.get(e)===a&&Go.delete(e)};o.then(d=>{s(),!e.disposed&&e.describePromise===o&&a.run(d)},d=>{s(),e.describePromise===o&&(e.describePromise=void 0,a.reportReadFailure&&console.error(`[bre] ${a.phase} failed: ${d instanceof Error?d.message:String(d)}`))}).catch(d=>{console.error(`[bre] ${a.phase} failed: ${d instanceof Error?d.message:String(d)}`)})}var iy=['[class*="editor"]','[class*="modelEntry"]','[class*="rowCard"]','[class*="setupCard"]','[class*="addCard"]','button[class*="addButton"]',"button[aria-label]"].join(", ");function os(e,t,n){if(n.disposed||!e.isConnected)return;let r=t.labels(),o=Array.from(e.querySelectorAll(iy)),i=!1,a=[],s=[],d=[],l=[],c=[];for(let u of o)!i&&u.matches('[class*="editorActions"], [class*="modelEntry"]')&&(i=!0),u.matches('[class*="rowCard"], [class*="setupCard"]')?(a.push(u),s.push(u)):u.matches('[class*="addCard"]')&&s.push(u),u.matches('[class*="editor"], [class*="addCard"], [class*="rowCard"]')&&l.push(u),u.matches('button[class*="addButton"]')&&u.closest("[data-plugin]")===null&&d.push(u),u.matches("button[aria-label]")&&r.capacity.some(f=>(u.getAttribute("aria-label")??"").startsWith(f))&&c.push(u);for(let u of a)for(let f of Zb(u,r))ey(f,n.editWired);for(let u of s)for(let f of ty(u,r))ny(f,u,n.addModelWired);for(let u of d)ry(u,n.addProviderWired);oy(l,r,t.t);let p=c.length>0;if(!i){if(So(e,[],{t:t.t}),n.mounted.size>0){for(let[f,y]of n.mounted)Ar(f),za(f),y.editor.unmount();n.mounted.clear()}let u=n.editing;n.editing=!1,(u!==!1||Bc(n)&&Date.now()>=n.nextFlushAt)&&pb(t,n,u===!0).catch(f=>{console.error(`[bre] idle pass failed: ${f instanceof Error?f.message:String(f)}`)});return}if(n.editing=!0,!p){for(let[f,y]of n.mounted)Ar(f),za(f),y.editor.unmount();n.mounted.clear(),n.describePromise??(n.describePromise=t.describeNamespace({allowStale:!0}));let u=r;Pc(n,f=>{Ib(e,t,n,f,u)},"empty-catalog seat",!0);return}for(let u of c)Qb(u,n.disclosureWired);n.describePromise??(n.describePromise=t.describeNamespace({allowStale:!0})),Pc(n,u=>{if(n.disposed||!e.isConnected)return;let f=u.namespace,y=_e(f),g=new Map,E=v=>(g.has(v)||g.set(v,an(v,y,r)),g.get(v)),L=new Map,w=v=>{let b=L.get(v);if(b!==void 0)return b;let N=Cn(y,v),x=new Set,T=new Set,O=new Map;for(let G of N){let j=G.id;x.add(j),O.has(j)||O.set(j,[G]),G[et]===!0&&T.add(j)}let K={models:N,savedModelIds:x,unsetModelIds:T,singletonById:O};return L.set(v,K),K},H=[],D=Array.from(e.querySelectorAll("button[aria-label]")).filter(v=>r.capacity.some(b=>(v.getAttribute("aria-label")??"").startsWith(b)));for(let v of D){let b=Cr(v);if(b===void 0)continue;let N=v.closest('[class*="modelEntry"]')??b,x=$e(N,r.modelId);x.length!==0&&H.push({container:Eb(v),row:N,modelId:x,card:b})}So(e,_b(H,y,r),{t:t.t,onRequest:v=>Qc(n,t,v,Db(e,v,y,r))});let te=new Set(H.map(v=>v.container));for(let[v,b]of n.mounted)te.has(v)||(Ar(v),za(v),b.editor.unmount(),n.mounted.delete(v));if(n.pending.size>0){let v=new Map;for(let N of H){let x=E(N.card);if(x===void 0)continue;let T=v.get(x.route);T===void 0&&v.set(x.route,T=new Set),T.add(N.modelId)}let b=new Map;for(let[N,x]of n.pending){if(!Bn(y,N))continue;let T=v.get(N),O=[...x.keys()].filter(K=>!T?.has(K));O.length>0&&b.set(N,new Set(O))}for(let[N,x]of b){let T=n.missedScans.get(N);if(T!==void 0)for(let O of x)T.has(O)&&(Gn(n,N,O,void 0),T.delete(O),x.delete(O))}n.missedScans=b}else n.missedScans=new Map;let U=new Set(H.map(v=>v.card));for(let v of U){let b=E(v);if(b===void 0)continue;let N=b.route,x=Wb(v,r);x===void 0?n.signalsUnavailable=!0:(n.signalsUnavailable=!1,Un(x.submit,n.submitWired,()=>{let T=an(v,y,r)?.route??N;n.committing.add(T),xt(n)}),Un(x.cancel,n.cancelWired,()=>{let T=an(v,y,r)?.route??N;bb(n,T)}))}H.forEach((v,b)=>{let N=v.container;if(N===void 0)return;let x=E(v.card);if(x===void 0)return;let{route:T,staged:O}=x,K=y[T]??{},{savedModelIds:G,unsetModelIds:j,singletonById:h}=w(T),S=h.get(v.modelId)??[],I=O||!G.has(v.modelId),_=I?n.pending.get(T)?.get(v.modelId)?.efforts:void 0,ee=I?_==="keep"?void 0:_:po(S,v.modelId),Z=!I&&j.has(v.modelId),oe=I?n.pending.get(T)?.get(v.modelId)?.input:mo(S,v.modelId),re=I?n.pending.get(T)?.get(v.modelId)?.imageGen:ua(S,v.modelId),X=I?n.pending.get(T)?.get(v.modelId)?.compat:go(S,v.modelId),ue=I?n.pending.get(T)?.get(v.modelId)?.defaultEffort??void 0:bo(S,v.modelId),ke=I?$e(v.row,r.modelName):"",Se=I?ke.length>0?ke:void 0:ho(S,v.modelId),Ae=O?$e(v.card,r.apiProtocol):"",V=O?$e(v.card,r.baseUrl):"",P=O&&Ae.length>0?Ae:typeof K.api=="string"?K.api:void 0,z=O&&V.length>0?V:typeof K.baseURL=="string"?K.baseURL:void 0,J={route:T,routeDisplayName:O?T:typeof K.displayName=="string"?K.displayName:T,...P===void 0?{}:{routeApi:P},...z===void 0?{}:{routeBaseURL:z},modelId:v.modelId,...Se===void 0?{}:{modelName:Se},...ee===void 0?{}:{efforts:ee},...Z?{effortsUnset:Z}:{},...oe===void 0?{}:{input:oe},...re?{imageGen:!0}:{},...X===void 0?{}:{compat:X},...ue===void 0?{}:{defaultEffort:ue},index:b,staged:I,officialInputTypes:Wo(N),api:{...yo(t.api,void 0,(se,be,Oe,Re,Nt,Ze,M)=>{Gn(n,se,be,Oe,Re,Ya(N,Nt,r.inputImage),Ze,M)},(se,be,Oe)=>{Gc(n,se,be,{...Oe,input:Ya(N,Oe.input,r.inputImage)})},se=>{hb(n,se,v.modelId)},()=>(an(v.card,y,r)?.staged??O)||!G.has(v.modelId)),fillCapacities:(se,be)=>{Yc(N,r,{...se===void 0?{}:{contextWindow:se},...be===void 0?{}:{maxTokens:be}})},readCapacities:()=>Cb(N,r),setCapacities:se=>{Hb(N,r,se)}},readOnly:u.writable!==!0,t:t.t};es(N),Rb(N);let me=n.mounted.get(N);if(me!==void 0){Kb(me.props,J)||(me.props=J,me.editor.render(J));return}if(Fb(N))return;jn(Cr(N)??v.card,eu);let ve=t.mount(N,J);n.mounted.set(N,{editor:ve,props:J})})},"editor reconcile")}var Vo=['[class*="rowCard"]','[class*="setupCard"]','[class*="addCard"]','[class*="modelEntry"]','[class*="modelAdvanced"]','[class*="modelList"]','[class*="addBlock"]','p[class*="savedNotice"]'].join(","),ay=[`[data-plugin="${ye}"]`,".bre-effort-slot",".bre-keys-host",".bre-create-host",".bre-editor-tabs",".bre-provider-balance",".bre-auto-effort",".bre-auto-effort-note",".bre-config-host",".bre-drag-ghost",".bre-drop-line",".bre-drag-grip",".bre-provider-switch"].join(",");function gu(e){return e.nodeType===Node.ELEMENT_NODE?e:e.parentElement}function is(e){let t=gu(e);return t!==null&&t.closest(ay)!==null}function mu(e){if(e.nodeType!==Node.ELEMENT_NODE)return!1;let t=e;return is(t)?!1:t.matches(Vo)||t.querySelector(Vo)!==null}function hu(e){return e.some(t=>{if(is(t.target))return!1;let n=gu(t.target);if(t.type==="childList"){let r=[...Array.from(t.addedNodes),...Array.from(t.removedNodes)];return r.length>0&&r.every(is)?!1:n!==null&&n.closest(Vo)!==null?!0:r.some(mu)}return n!==null&&n.closest(Vo)!==null?!0:t.type==="attributes"&&mu(t.target)})}var ss=require("react");var ne=require("react"),Su=require("react-dom");var ot=require("react"),vu=require("react-dom"),kt=require("react/jsx-runtime"),bu=6,sy=292,Yo=8,dy=52;function yu(e,t){let n=e.getBoundingClientRect(),r=t*dy+46,o=window.innerWidth||0,i=window.innerHeight||0,a=Math.max(Yo,Math.min(n.left,o-sy-Yo)),s=n.bottom+bu,d=n.top-bu-r,l=i>0&&s+r>i-Yo&&d>Yo?d:s;return{left:a,top:l}}function wu(e){let{anchor:t,label:n,options:r,selected:o,onPick:i,onClose:a}=e,[s,d]=(0,ot.useState)(()=>yu(t,r.length)),l=(0,ot.useRef)(null),c=(0,ot.useRef)([]);(0,ot.useLayoutEffect)(()=>{let u=()=>{d(yu(t,r.length))};return u(),window.addEventListener("resize",u),window.addEventListener("scroll",u,!0),()=>{window.removeEventListener("resize",u),window.removeEventListener("scroll",u,!0)}},[t,r.length]),(0,ot.useEffect)(()=>{let u=Math.max(0,r.findIndex(f=>f.value===o));c.current[u]?.focus()},[r,o]),(0,ot.useEffect)(()=>{let u=f=>{let y=f.target;y instanceof Node&&l.current?.contains(y)!==!0&&(t.contains(y)||a())};return document.addEventListener("pointerdown",u,!0),()=>{document.removeEventListener("pointerdown",u,!0)}},[t,a]);let p=(0,ot.useCallback)(u=>{if(r.length===0)return;let f=(u+r.length)%r.length;c.current[f]?.focus()},[r.length]),m=u=>{let f=c.current.findIndex(y=>y===document.activeElement);if(u.key==="Escape"){u.preventDefault(),u.stopPropagation(),a();return}if(u.key==="ArrowDown"){u.preventDefault(),p(f+1);return}if(u.key==="ArrowUp"){u.preventDefault(),p(f<0?r.length-1:f-1);return}if(u.key==="Home"){u.preventDefault(),p(0);return}u.key==="End"&&(u.preventDefault(),p(r.length-1))};return(0,vu.createPortal)((0,kt.jsxs)("div",{ref:l,className:"bre-protocol-menu",style:{left:s.left,top:s.top},onKeyDown:m,children:[(0,kt.jsx)("p",{className:"bre-protocol-menu-title",children:n}),(0,kt.jsx)("ul",{className:"bre-protocol-menu-list",role:"listbox","aria-label":n,children:r.map((u,f)=>{let y=u.value===o;return(0,kt.jsx)("li",{children:(0,kt.jsx)("button",{ref:g=>{c.current[f]=g},type:"button",role:"option","aria-selected":y,"data-protocol-value":u.value,className:"bre-protocol-option",tabIndex:-1,onClick:()=>{i(u.value)},children:(0,kt.jsxs)("span",{className:"bre-protocol-option-text",children:[(0,kt.jsx)("span",{className:"bre-protocol-option-title",children:u.title}),(0,kt.jsx)("span",{className:"bre-protocol-option-hint",children:u.hint})]})})},u.value)})})]}),document.body)}var q=require("react/jsx-runtime"),ly=200,cy=["M8 3.9v8.2","M3.9 8h8.2"],xu="M3.9 8.35 6.6 11.05 12.1 5.5",uy=["M5.75 5.75V4.1A1.6 1.6 0 0 1 7.35 2.5h4.55a1.6 1.6 0 0 1 1.6 1.6v4.55a1.6 1.6 0 0 1-1.6 1.6h-1.65","M4.1 5.75h4.55a1.6 1.6 0 0 1 1.6 1.6v4.55a1.6 1.6 0 0 1-1.6 1.6H4.1a1.6 1.6 0 0 1-1.6-1.6V7.35a1.6 1.6 0 0 1 1.6-1.6Z"],fy=1600;async function py(e){try{if(navigator.clipboard?.writeText!==void 0)return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document>"u")return!1;try{let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.top="-1000px",t.style.opacity="0",document.body.appendChild(t),t.select();let n=document.execCommand("copy");return t.remove(),n}catch{return!1}}function as({paths:e}){return(0,q.jsx)("svg",{viewBox:"0 0 16 16",width:16,height:16,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.map(t=>(0,q.jsx)("path",{d:t},t))})}function my(e,t){return e.masked!==void 0?e.masked:e.configured===!1?t("keysMissing"):"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"}function ku(e){return e.alias??e.masked??e.ref}function gy(e,t){return e.models===void 0?t("keysScopeAll"):e.models.length===0?t("keysScopeNone"):t("keysScopeCount",{count:e.models.length})}var Mu=["openai-completions","openai-responses","anthropic-messages"],Eu={openai:null,anthropic:null},hy=2e3,by=150,yy=300,vy=1500,wy=new Intl.Collator("en",{numeric:!0,sensitivity:"base"});function xy(e,t){return Mu.filter(n=>n===t?!0:(e[Oo(n)]??"").length>0)}function Lu(e,t){return t(e==="anthropic-messages"?"keysProtocolAnthropic":e==="openai-responses"?"keysProtocolResponses":e==="openai-completions"?"keysProtocolOpenAI":"keysProtocolDefault")}function ky(e,t){return t(e==="anthropic-messages"?"keysProtocolAnthropicHint":e==="openai-responses"?"keysProtocolResponsesHint":e==="openai-completions"?"keysProtocolOpenAIHint":"keysProtocolDefaultHint")}function Tu(e,t,n,r=!1){return[void 0,...r?Mu:xy(e,t)].map(i=>({value:i??"",title:Lu(i,n),hint:ky(i,n)}))}function Jo(e){let{route:t,t:n,draft:r}=e,o=e.client??Fe,[i,a]=(0,ne.useState)(()=>o.cached?.(t)?.entries),[s,d]=(0,ne.useState)(()=>o.cached?.(t)?.models??[]),[l,c]=(0,ne.useState)(void 0),[p,m]=(0,ne.useState)(!1),u=i===void 0&&l===void 0;(0,ne.useEffect)(()=>{if(m(!1),!u)return;let M=setTimeout(()=>m(!0),ly);return()=>clearTimeout(M)},[u,t]);let[f,y]=(0,ne.useState)(!1),[g,E]=(0,ne.useState)(void 0),[L,w]=(0,ne.useState)(""),[H,D]=(0,ne.useState)(""),[te,U]=(0,ne.useState)([]),[v,b]=(0,ne.useState)(void 0);(0,ne.useEffect)(()=>{r===!0&&E({kind:"add"})},[r]);let[N,x]=(0,ne.useState)(void 0),[T,O]=(0,ne.useState)(void 0),[K,G]=(0,ne.useState)(void 0),j=(0,ne.useRef)(void 0);(0,ne.useEffect)(()=>()=>{j.current!==void 0&&clearTimeout(j.current)},[]);let[h,S]=(0,ne.useState)(void 0),[I,_]=(0,ne.useState)(()=>o.cached?.(t)?.endpoints??Eu),[ee,Z]=(0,ne.useState)(!1),oe=(0,ne.useRef)(!1);(0,ne.useEffect)(()=>{oe.current=ee},[ee]);let re=(0,ne.useRef)(0),X=(0,ne.useCallback)((M,Y)=>{if(!M.ok){c({kind:"error",text:M.error??n("keysUnreachable")});return}a(M.entries),d(M.models??[]),_(M.endpoints),Z(M.probing===!0),c(Y===void 0?void 0:{kind:"status",text:Y})},[n]),ue=(0,ne.useRef)(t);ue.current=t,(0,ne.useEffect)(()=>(ue.current=t,()=>{ue.current=void 0}),[t]);let ke=(0,ne.useCallback)(async(M,Y=!1)=>{let ie=o.cached?.(M)!==void 0,ge=await o.list(M,Y?{preferCache:!0}:void 0);ue.current===M&&(ie&&!ge.ok||X(ge,void 0))},[X,o]);(0,ne.useEffect)(()=>{ke(t,!0)},[ke,t]),(0,ne.useEffect)(()=>{let M,Y,ie=()=>{M===void 0&&(M=setTimeout(()=>{M=void 0,ke(t),Y===void 0&&(Y=setTimeout(()=>{Y=void 0,!oe.current&&ke(t)},vy))},yy))};return document.addEventListener(mr,ie),()=>{document.removeEventListener(mr,ie),M!==void 0&&clearTimeout(M),Y!==void 0&&clearTimeout(Y)}},[ke,t]),(0,ne.useEffect)(()=>{if(!ee){re.current=0;return}let M=!0,Y=setInterval(()=>{if(re.current+=1,re.current>by){Z(!1);return}(async()=>{let ie=await o.list(t);!M||ue.current!==t||(ie.ok?(X(ie,void 0),ie.probing!==!0&&c({kind:"status",text:n("keysProbeDone")})):Z(!1))})()},hy);return()=>{M=!1,clearInterval(Y)}},[X,o,ee,t]),(0,ne.useEffect)(()=>{let M=!0,Y=0,ie=ge=>{let we=ge.detail,le=we?.route;if(!M||ue.current!==t||le!==void 0&&le!==t)return;let Le=++Y;if(typeof we?.openai=="string"&&typeof we.anthropic=="string"){_({openai:we.openai||null,anthropic:we.anthropic||null});return}(async()=>{let qe=o.endpoints!==void 0?await o.endpoints(t):await o.list(t);!M||ue.current!==t||Y!==Le||qe.ok&&_(qe.endpoints??Eu)})().catch(()=>{})};return document.addEventListener(pr,ie),()=>{M=!1,document.removeEventListener(pr,ie)}},[o,t]);let Se=()=>{E(void 0),w(""),D(""),U([]),b(void 0)},Ae=(0,ne.useCallback)(async(M,Y)=>{let ie=g,ge=t;y(!0),x(void 0);try{let we=await M();if(ue.current!==ge)return;X(we,Y),we.ok&&ie!==void 0&&ie.kind!=="add"&&!we.entries.some(le=>le.ref===ie.ref)&&Se()}finally{y(!1)}},[X,g,t]),V=(M,Y)=>{E({kind:M,ref:Y.ref}),w(M==="alias"?Y.alias??"":""),D(""),U((Y.models??[]).filter(ie=>s.includes(ie))),b(void 0),x(void 0)},P=()=>{if(f||g===void 0)return;let M=g.kind,Y=g.ref;if(M!=="alias"&&M!=="scope"&&!Mt(H))return;let ie=Zl(L),ge=v,we=t,le=()=>ue.current!==we;y(!0),(async()=>{try{if(M==="add"){let qe=new Set((i??[]).map(Ee=>Ee.ref)),st=await o.add(t,H,ie);if(le())return;if(!st.ok){X(st,n("keysAdded"));return}if(X(st,n("keysAdded")),Se(),ge===void 0)return;let $t=st.entries.find(Ee=>Ee.ref===st.addedRef)??st.entries.find(Ee=>!qe.has(Ee.ref)),bn=$t===void 0?{ok:!1}:await o.setProtocol(t,$t.ref,ge);le()||X(bn,n("keysAdded"));return}if(Y===void 0)return;if(M==="scope"){let qe=await o.setScope(t,Y,te.length===0?void 0:te);le()||(X(qe,n("keysScopeSaved")),qe.ok&&Se());return}let Le=M==="alias"?await o.rename(t,Y,ie):await o.replace(t,Y,H);le()||(X(Le,n(M==="alias"?"keysRenamed":"keysReplaced")),Le.ok&&Se())}finally{y(!1)}})()},z=M=>{U(Y=>Y.includes(M)?Y.filter(ie=>ie!==M):[...Y,M])},J=(0,ne.useMemo)(()=>[...new Set(s)].sort(wy.compare),[s]),me=(0,ne.useMemo)(()=>new Set(te),[te]),ve=()=>{if(g===void 0)return null;let M=g.kind,Y=M==="add"||M==="value",ie=M==="scope",ge=M==="scope"&&g?.ref!==void 0?i?.find(le=>le.ref===g.ref)?.auto===!0:!1,we=Y&&H.length>0&&!Mt(H);return(0,q.jsxs)("div",{className:"bre-keys-form",children:[ie?(0,q.jsx)("div",{className:"bre-keys-chips",role:"group","aria-label":n("keysScope"),children:J.length===0?(0,q.jsx)("p",{className:"bre-keys-hint",children:n("keysScopeEmpty")}):J.map(le=>{let Le=me.has(le);return(0,q.jsx)("button",{type:"button",className:Le?"bre-keys-chip is-selected":"bre-keys-chip","aria-pressed":Le,disabled:f,onClick:()=>z(le),children:le},le)})}):(0,q.jsxs)("div",{className:"bre-keys-form-fields",children:[M==="value"?null:(0,q.jsx)("input",{className:"bre-text-input bre-keys-name",type:"text",value:L,placeholder:n("keysAliasPlaceholder"),"aria-label":n("keysAlias"),disabled:f,autoFocus:M==="alias",onChange:le=>w(le.target.value)}),Y?(0,q.jsx)("input",{className:"bre-text-input bre-keys-secret",type:"password",autoComplete:"new-password",spellCheck:!1,value:H,placeholder:n(M==="add"?"keysValuePlaceholder":"keysNewValuePlaceholder"),"aria-label":n("keysValue"),"aria-invalid":we,disabled:f,autoFocus:!0,onChange:le=>D(le.target.value)}):null]}),M==="add"?(0,q.jsx)("div",{className:"bre-keys-chips",role:"group","aria-label":n("keysProtocolCreate"),children:Tu(I,void 0,n,r===!0).map(le=>{let Le=le.value===""?void 0:le.value,qe=v===Le;return(0,q.jsx)("button",{type:"button",className:qe?"bre-keys-chip is-selected":"bre-keys-chip","aria-pressed":qe,title:le.hint,disabled:f,onClick:()=>b(Le),children:le.title},le.value)})}):null,M==="add"?(0,q.jsx)("p",{className:"bre-keys-hint",children:n("keysProtocolCreateHint")}):null,ie?(0,q.jsx)("p",{className:"bre-keys-hint",children:n("keysScopeHint")}):null,ie&&ge?(0,q.jsx)("p",{className:"bre-keys-hint",children:n("keysScopeAutoHint")}):null,we?(0,q.jsx)("p",{className:"bre-effort-message bre-error",role:"alert",children:n("keysAddIllegal")}):null,(0,q.jsxs)("div",{className:"bre-keys-form-actions",children:[ie?(0,q.jsx)("button",{type:"button",className:"bre-link-button bre-keys-allmodels",disabled:f,onClick:()=>U([]),children:n("keysScopeAll")}):null,(0,q.jsx)("button",{type:"button",className:"bre-link-button",disabled:f,onClick:Se,children:n("keysCancel")}),(0,q.jsx)("button",{type:"button",className:"bre-primary-button",disabled:f||Y&&!Mt(H),onClick:P,children:n(M==="add"?"keysAddConfirm":"keysSave")})]})]})},se=()=>g?.kind==="add"?(0,q.jsx)("li",{className:"bre-keys-form-row",children:ve()}):(0,q.jsx)("li",{className:"bre-keys-add-row",children:(0,q.jsxs)("button",{type:"button",className:"bre-keys-add",disabled:f,onClick:()=>{E({kind:"add"}),w(""),D(""),U([]),x(void 0)},children:[(0,q.jsx)("span",{className:"bre-keys-add-mark","aria-hidden":"true",children:(0,q.jsx)(as,{paths:cy})}),n("keysAdd")]})}),be=async M=>{if(K!==void 0)return;let Y=t;G(M.ref);try{let ie=await o.reveal(t,M.ref);if(ue.current!==Y)return;if(ie===void 0){c({kind:"error",text:n("keysCopyFailed")});return}let ge=await py(ie);if(ue.current!==Y)return;if(!ge){c({kind:"error",text:n("keysCopyFailed")});return}c(void 0),O(M.ref),j.current!==void 0&&clearTimeout(j.current),j.current=setTimeout(()=>{j.current=void 0,O(void 0)},fy)}finally{G(void 0)}},Oe=(M,Y)=>{let ie=Y===""?void 0:Y;S(void 0),Ae(()=>o.setProtocol(t,M.ref,ie),n("keysProtocolSaved"))},Re=h===void 0?void 0:i?.find(M=>M.ref===h.ref);if(i===void 0)return l===void 0?(0,q.jsx)("div",{className:"bre-keys","aria-busy":"true",children:p?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)("ul",{className:"bre-keys-list bre-keys-skeleton","aria-hidden":"true",children:[(0,q.jsxs)("li",{className:"bre-keys-skeleton-row",children:[(0,q.jsx)("span",{className:"bre-keys-skeleton-dot"}),(0,q.jsx)("span",{className:"bre-keys-skeleton-bar is-name"}),(0,q.jsx)("span",{className:"bre-keys-skeleton-bar is-mask"})]}),(0,q.jsx)("li",{className:"bre-keys-skeleton-row is-add",children:(0,q.jsx)("span",{className:"bre-keys-skeleton-bar"})})]}),(0,q.jsx)("p",{className:"bre-keys-sr",role:"status",children:n("keysLoading")})]}):null}):(0,q.jsxs)("div",{className:"bre-keys",children:[(0,q.jsx)("p",{className:"bre-effort-message bre-"+l.kind,role:l.kind==="error"?"alert":"status",children:l.text}),(0,q.jsx)("ul",{className:"bre-keys-list",children:se()})]});let Nt=i.reduce((M,Y)=>Y.enabled?M+1:M,0),Ze=r===!0?null:(0,q.jsx)("button",{type:"button",className:"bre-link-button bre-keys-probe",disabled:f||ee||i.length<2,title:i.length<2?n("keysProbeSingle"):n("keysProbeHint"),onClick:()=>{Ae(()=>o.probe(t),void 0)},children:n(ee?"keysProbing":"keysProbe")});return(0,q.jsxs)("div",{className:"bre-keys",children:[Ze===null?null:e.probeHost===void 0?(0,q.jsx)("div",{className:"bre-keys-probe-row",children:Ze}):(0,Su.createPortal)(Ze,e.probeHost),(0,q.jsxs)("ul",{className:"bre-keys-list",children:[i.map(M=>{let Y=ku(M),ie=M.enabled&&Nt<=1;return(0,q.jsxs)(ne.Fragment,{children:[(0,q.jsxs)("li",{className:M.enabled?"bre-keys-row":"bre-keys-row is-off","data-state":M.configured===!1?"missing":"ready",children:[(0,q.jsx)("button",{type:"button",className:M.enabled?"bre-keys-toggle is-on":"bre-keys-toggle","aria-pressed":M.enabled,"aria-label":n(M.enabled?"keysDisable":"keysEnable",{name:Y}),title:n(M.enabled?"keysDisable":"keysEnable",{name:Y}),disabled:f||ie,onClick:()=>{Ae(()=>o.setEnabled(t,M.ref,!M.enabled),void 0)},children:(0,q.jsx)("span",{className:"bre-keys-toggle-mark","aria-hidden":"true",children:(0,q.jsx)(as,{paths:[xu]})})}),(0,q.jsxs)("span",{className:"bre-keys-value",children:[M.alias===void 0?null:(0,q.jsx)("span",{className:"bre-keys-alias",children:M.alias}),(0,q.jsx)("span",{className:M.alias===void 0?"bre-keys-mask bre-keys-mask-plain":"bre-keys-mask",children:my(M,n)}),(0,q.jsx)("button",{type:"button",className:T===M.ref?"bre-keys-copy is-copied":"bre-keys-copy","aria-label":n("keysCopy",{name:Y}),title:T===M.ref?n("keysCopied"):n("keysCopy",{name:Y}),disabled:f||K===M.ref||M.configured===!1,onClick:()=>{be(M)},children:(0,q.jsx)(as,{paths:T===M.ref?[xu]:uy})})]}),(0,q.jsx)("span",{className:N===M.ref?"bre-keys-actions is-confirming":"bre-keys-actions",children:N===M.ref?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("button",{type:"button",className:"bre-link-button bre-keys-danger",disabled:f,onClick:()=>{Ae(()=>o.remove(t,M.ref),n("keysRemoved"))},children:n("keysConfirmRemove")}),(0,q.jsx)("button",{type:"button",className:"bre-link-button",disabled:f,onClick:()=>x(void 0),children:n("keysCancel")})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("span",{className:"bre-keys-protocol-wrap",children:(0,q.jsxs)("button",{type:"button",className:"bre-keys-protocol","aria-haspopup":"listbox","aria-expanded":h?.ref===M.ref,"aria-label":n("keysProtocolLabel",{name:Y}),title:n("keysProtocolLabel",{name:Y}),disabled:f,onClick:ge=>{let we=ge.currentTarget;S(le=>le?.ref===M.ref?void 0:{ref:M.ref,anchor:we}),x(void 0)},children:[(0,q.jsx)("span",{className:"bre-keys-protocol-label",children:Lu(M.protocol,n)}),(0,q.jsx)("span",{className:"bre-keys-protocol-caret","aria-hidden":"true",children:"\u203A"})]})}),r===!0?null:(0,q.jsx)("button",{type:"button",className:"bre-link-button bre-keys-scope",disabled:f,title:n("keysScope",{name:Y}),onClick:()=>V("scope",M),children:gy(M,n)}),(0,q.jsx)("button",{type:"button",className:"bre-link-button",disabled:f,onClick:()=>V("alias",M),children:n("keysAlias")}),(0,q.jsx)("button",{type:"button",className:"bre-link-button",disabled:f,onClick:()=>V("value",M),children:n("keysEdit")}),(0,q.jsx)("button",{type:"button",className:"bre-link-button",disabled:f,onClick:()=>{x(M.ref),E(void 0)},children:n("keysRemove")})]})})]}),g!==void 0&&g.ref===M.ref?(0,q.jsx)("li",{className:"bre-keys-form-row",children:ve()}):null]},M.ref)}),se()]}),r===!0?(0,q.jsx)("p",{className:"bre-keys-note",children:n("keysDraftHint")}):null,l===void 0?null:(0,q.jsx)("p",{className:"bre-effort-message bre-"+l.kind,role:l.kind==="error"?"alert":"status",children:l.text}),h===void 0||Re===void 0?null:(0,q.jsx)(wu,{anchor:h.anchor,label:n("keysProtocolLabel",{name:ku(Re)}),options:Tu(I,Re.protocol,n,r===!0),selected:Re.protocol??"",onPick:M=>Oe(Re,M),onClose:()=>S(void 0)})]})}var sn="bre-key-managed",Ey="bre-keys-host",Au="bre-keys-probe-host",ds="data-bre-key-host",Ty="data-bre-key-input",Xo="data-bre-region",Gt=new WeakMap;function Sy(e){let t=e.querySelector(`input[${Ty}]`);if(t instanceof HTMLInputElement)return t;let n=e.querySelector('input[type="password"]');return n instanceof HTMLInputElement?n:void 0}function Ru(e){let t=Gt.get(e)?.host;if(t!==void 0&&t.isConnected)return t;let n=e.nextElementSibling;return n instanceof HTMLElement&&n.hasAttribute(ds)?n:void 0}function Cu(e,t){let n=t.route;if(n===void 0||n.length===0||Sy(e)===void 0||e.parentElement===null)return;De(e,sn,!0);let r=Gt.get(e),o=Ru(e);o===void 0&&(r!==void 0&&Hu(e,r),o=e.ownerDocument.createElement("div"),o.className=Ey,e.after(o)),fe(o,ds,n);let i=e.getAttribute(Xo);i===null?o.hasAttribute(Xo)&&o.removeAttribute(Xo):fe(o,Xo,i);let a=Gt.get(e),s=a?.probeHost??e.ownerDocument.createElement("span");a===void 0&&(s.className=Au),s.parentElement!==e&&e.appendChild(s);let d=()=>(0,ss.createElement)(Ue,{fallbackText:t.t("keysPanelFailed")},(0,ss.createElement)(Jo,{route:n,t:t.t,client:t.client,probeHost:s}));if(a!==void 0&&a.route===n){(a.t!==t.t||a.client!==t.client)&&(a.t=t.t,a.client=t.client,a.mount.root.render(d()));return}a!==void 0&&(Gt.delete(e),a.mount.root.unmount()),Gt.set(e,{route:n,host:o,probeHost:s,mount:pt(o,d(),{sync:!0}),t:t.t,client:t.client})}function Hu(e,t){Gt.delete(e),Ne(t.mount),t.probeHost.remove()}function Qo(e){De(e,sn,!1);let t=Gt.get(e);t!==void 0&&Hu(e,t),Ru(e)?.remove();for(let n of Array.from(e.children))n.classList.contains(Au)&&n.remove()}function Nu(){for(let e of Array.from(document.querySelectorAll(`[${ds}]`))){let t=e.previousElementSibling;t instanceof HTMLElement&&Gt.has(t)?Qo(t):e.remove()}}var Ou="http://www.w3.org/2000/svg",My="data-bre-icon";function Ly(e){let t=document.createElementNS(Ou,"path");return t.setAttribute("d",e),t}function Zo(e,t){let n=document.createElementNS(Ou,"svg");return n.setAttribute("viewBox","0 0 16 16"),n.setAttribute("width","16"),n.setAttribute("height","16"),n.setAttribute("fill","none"),n.setAttribute("stroke","currentColor"),n.setAttribute("stroke-width","1.5"),n.setAttribute("stroke-linecap","round"),n.setAttribute("stroke-linejoin","round"),n.setAttribute("aria-hidden","true"),n.setAttribute("focusable","false"),n.setAttribute(My,e),n.append(...t.map(Ly)),n}var ln="bre-key-field",_u="bre-key-eye",Ir="data-bre-key-input",Du="data-bre-eye-show",Fu="data-bre-eye-hide",Iu=["M1.5 8S4 3.75 8 3.75 14.5 8 14.5 8 12 12.25 8 12.25 1.5 8 1.5 8Z","M6.2 8a1.8 1.8 0 1 0 3.6 0 1.8 1.8 0 0 0-3.6 0Z"],ei=new WeakMap,dn=new WeakMap;function ti(e){let t=e.querySelector(`input[${Ir}]`);if(t instanceof HTMLInputElement)return t;let n=e.querySelector('input[type="password"]');return n instanceof HTMLInputElement?n:void 0}function cs(e){for(let t of Array.from(e.children))if(t instanceof HTMLButtonElement&&t.classList.contains(_u))return t}function Ku(e){let t=ti(e);t!==void 0&&(fe(t,Ir,""),De(e,ln,!0))}function qu(e,t){let n=ti(e);if(n===void 0){zn(e);return}ei.get(e)?.route!==t.route&&dn.delete(e),ei.set(e,t),fe(n,Ir,""),De(e,ln,!0);let r=cs(e)??Ry(e);fe(r,Du,t.t("keyRevealShow")),fe(r,Fu,t.t("keyRevealHide")),ls(r,n)}function zn(e){let t=cs(e);t!==void 0&&t.remove(),ei.delete(e),De(e,ln,!1);let n=e.querySelector(`input[${Ir}]`);n instanceof HTMLInputElement&&(n.removeAttribute(Ir),n.type="password");let r=dn.get(e);dn.delete(e),r!==void 0&&n instanceof HTMLInputElement&&n.value===r&&Pr(n,"")}async function Ay(e){try{let t=await fetch(`${Zr}?route=${encodeURIComponent(e)}`,{method:"GET",cache:"no-store",credentials:"same-origin"});if(!t.ok)return;let n=await t.json();return n===null||typeof n!="object"||n.ok!==!0?void 0:typeof n.key=="string"&&n.key.length>0?n.key:void 0}catch{return}}function ls(e,t){let n=t.type!=="password";fe(e,"aria-pressed",n?"true":"false");let r=e.getAttribute(n?Fu:Du);r!==null&&(fe(e,"aria-label",r),fe(e,"title",r)),mt(e,t.disabled)}function Pr(e,t){let n=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");n?.set===void 0?e.value=t:n.set.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0}))}function Ry(e){let t=document.createElement("button");t.type="button",t.className=_u,t.append(Pu("eye"),Pu("eye-off"));let n=async()=>{let r=ti(e),o=ei.get(e);if(r===void 0||o===void 0||t.hasAttribute("aria-busy"))return;if(r.type!=="password"){let a=dn.get(e);dn.delete(e),a!==void 0&&r.value===a&&Pr(r,""),r.type="password",ls(t,r);return}let i=o.route;if(i!==void 0&&dn.get(e)===void 0&&r.value.length===0){fe(t,"aria-busy","true");let a;try{a=await(o.loadKey??Ay)(i)}catch{a=void 0}if(t.hasAttribute("aria-busy")&&t.removeAttribute("aria-busy"),a===void 0){let s=o.t("keyRevealFailed");fe(t,"aria-label",s),fe(t,"title",s);return}if(cs(e)!==t||!t.isConnected||ti(e)!==r||r.value.length>0)return;dn.set(e,a),Pr(r,a)}r.type="text",ls(t,r)};return t.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation(),n()}),e.append(t),t}function Pu(e){let t=e==="eye-off"?[...Iu,"M2.5 13.5 13.5 2.5"]:Iu;return Zo(e,t)}var ps="bre-editor-tabs",Cy="bre-editor-tab",ni="data-bre-tab-id",Dr="bre-tabbed",Rt="data-bre-tab",Bu="data-bre-provider",it="data-bre-region",_r="data-bre-editor-body",Jn="data-bre-footer",Hy="row",Ny="path",Fr="data-bre-details";var Oy=".bre-headers",Iy=".bre-fingerprint",Py="data-bre-fingerprint",Wt="provider",$n="models",Vn="fingerprint",Yn="advanced",_y=[Wt,$n,Yn,Vn],Dy="none",Gu=_y,Wu=ps,Uu=Cy,ju=ni,ri='[class*="editorActions"], [class*="modelList"], [class*="modelCatalog"], [class*="modelEntry"]',Fy='[class*="modelCatalog"], [class*="modelList"], [class*="modelEntry"]',zu='[class*="rowCard"], [class*="addCard"], li',Ky='[class*="addPanel"]',us=".bre-create-host";function $u(){return{warned:new WeakSet}}function Xn(e){return e===null?null:e.closest(zu)}function Vu(e){let t=Xn(e);return t!==null&&t.querySelector(us)!==null}function Yu(e){for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.matches(Ky)&&!t.hidden)return t;return e}function Ju(e,t){if(e.getAttribute(Rt)===t){fs(e);return}let n=Co(e),r=e.getBoundingClientRect().top,o=n?.scrollTop??0;n!==void 0&&(n.style.overflowAnchor="none"),fe(e,Rt,t),fs(e),n!==void 0&&requestAnimationFrame(()=>{if(n.style.overflowAnchor="",n.scrollTop!==o)return;let i=e.getBoundingClientRect().top-r;i!==0&&(n.scrollTop+=i)})}function ms(e,t,n){if(!e.isConnected)return;let r=new Set;for(let o of Array.from(e.querySelectorAll(ri))){let i=o.closest(zu);i!==null&&r.add(i)}for(let o of Array.from(e.querySelectorAll(`.${Dr}`)))r.has(o)||oi(o);for(let o of r)try{jy(o,t)}catch(i){n.warned.has(o)||(n.warned.add(o),console.warn("[bre] editor tabs: rolled a provider card back to the official layout:",i)),oi(o)}}function Xu(){for(let e of Array.from(document.querySelectorAll(`.${Dr}`))){e.classList.remove(Dr),e.removeAttribute(Rt),e.removeAttribute(_r);for(let t of Array.from(e.querySelectorAll(`[${it}]`)))t.removeAttribute(it)}for(let e of Array.from(document.querySelectorAll(`[${Rt}]`)))e.removeAttribute(Rt);for(let e of Array.from(document.querySelectorAll(`[${it}]`)))e.removeAttribute(it);for(let e of Array.from(document.querySelectorAll(`[${_r}]`)))e.removeAttribute(_r);for(let e of Array.from(document.querySelectorAll(`[${Jn}]`)))e.removeAttribute(Jn);for(let e of Array.from(document.querySelectorAll(`details[${Fr}]`)))e.removeAttribute("open"),e.removeAttribute(Fr);for(let e of Array.from(document.querySelectorAll(`.${ln}`)))zn(e);for(let e of Array.from(document.querySelectorAll(`.${sn}`)))Qo(e);Nu()}function qy(e){for(let n of Array.from(e.children))if(n instanceof HTMLElement&&!n.matches('[class*="editorHeader"], [class*="editorTitle"], [class*="editorActions"], [class*="editorRoute"]')&&n.matches('[class*="editor"]')&&(n.querySelector(ri)!==null||n.querySelector("input, select")!==null))return n;let t=e.querySelector(ri);for(;t!==null&&t.parentElement!==e;)t=t.parentElement;return t!==null&&t!==e?t:void 0}function By(e){let t={header:void 0,models:void 0,actions:void 0,fields:[]};Qu(e,t,0);let{actions:n,fields:r,header:o,models:i}=t;if(!(n===void 0||r.length===0)&&r.some(a=>a.querySelector("input, select, textarea")!==null))return{header:o,models:i,actions:n,fields:r}}var Gy=4;function Qu(e,t,n){if(!(n>Gy)){for(let r of Array.from(e.children))if(r instanceof HTMLElement&&!r.matches('[class*="bre-"], [data-plugin]')){if(t.header===void 0&&r.matches('[class*="editorHeader"], [class*="editorTitle"]')){t.header=r;continue}if(r.matches('[class*="editorActions"]')){t.actions??(t.actions=r);continue}if(r.matches(Fy)){t.models??(t.models=r);continue}if(r.querySelector(ri)!==null){Qu(r,t,n+1);continue}if(r.querySelector('[class*="editorActions"]')!==null){t.actions??(t.actions=r);continue}if(r.querySelector("input, select, textarea")!==null){t.fields.push(r);continue}(r.matches("p, small, em, i")||r.matches('[class*="Hint"], [class*="error"]'))&&t.fields.push(r)}}}function Wy(e,t){if(!t.contains(e))return;fe(e,Jn,Hy);let n=e.parentElement;for(;n!==null&&(fe(n,Jn,Ny),n!==t);)n=n.parentElement}function Uy(e){let n=e.querySelector(`[${Bu}]`)?.getAttribute(Bu);return n==null||n===""?void 0:n}function jy(e,t){let n=Yu(e),r=qy(n);if(r===void 0){oi(e);return}let o=By(r);if(o===void 0){oi(e);return}let i=Array.from(n.querySelectorAll(Oy)),a=i[0]??null,s=Uy(n);for(let m of o.fields)fe(m,it,Wt),qu(m,{t:t.t,route:s}),Cu(m,{t:t.t,route:s});o.header!==void 0&&fe(o.header,it,Dy),o.models!==void 0&&fe(o.models,it,$n),fe(r,_r,""),n.querySelector(us)!==null&&Wy(o.actions,r);for(let m of i)fe(m,it,Yn);let d=n.querySelector(Iy);d!==null&&fe(d,it,Vn),$y(r);let l=new Set([Wt]);o.models!==void 0&&l.add($n),a!==null&&l.add(Yn);let c=n.querySelector(us)!==null;d!==null&&!c&&d.getAttribute(Py)==="ready"&&l.add(Vn);let p=e.getAttribute(Rt)??Wt;fe(e,Rt,l.has(p)?p:Wt),De(e,Dr,!0),zy(e,n,t,l)}function zy(e,t,n,r){let o=t.querySelector(`.${ps}`);o!==null&&(fe(o,"aria-label",n.t("editorTabsLabel")),xr(cn(o,Wt),n.t("editorTabProvider")),xr(cn(o,$n),n.t("editorTabModels")),xr(cn(o,Yn),n.t("editorTabAdvanced")),xr(cn(o,Vn),n.t("editorTabFingerprint")),mt(cn(o,$n),!r.has($n)),mt(cn(o,Yn),!r.has(Yn)),mt(cn(o,Vn),!r.has(Vn)),fs(e,o))}function fs(e,t){let n=t??Yu(e).querySelector(`.${ps}`);if(n===null)return;let r=e.getAttribute(Rt)??Wt;for(let o of Array.from(n.querySelectorAll(`[${ni}]`)))fe(o,"aria-selected",o.getAttribute(ni)===r?"true":"false")}function cn(e,t){for(let n of Array.from(e.children))if(n instanceof HTMLElement&&n.getAttribute(ni)===t)return n}function oi(e){e.classList.remove(Dr),e.removeAttribute(Rt),e.removeAttribute(_r);for(let t of Array.from(e.querySelectorAll(`[${it}]`)))t.getAttribute(it)===Wt&&(zn(t),Qo(t)),t.removeAttribute(it);for(let t of Array.from(e.querySelectorAll(`[${Jn}]`)))t.removeAttribute(Jn);Vy(e)}function $y(e){for(let t of Array.from(e.querySelectorAll("details")))t.hasAttribute("open")||(fe(t,Fr,"closed"),fe(t,"open",""))}function Vy(e){for(let t of Array.from(e.querySelectorAll(`details[${Fr}]`)))t.removeAttribute("open"),t.removeAttribute(Fr)}var qf=require("react");var Ve=require("react");var xe=require("react");var Yy='p[class*="savedNotice"]',tf="data-bre-saved-hidden",Jy="bre-auto-effort-note",Xy="data-bre-auto-effort-phase",Zu="bre-auto-effort-note-text",Qn=new Map,ef=new WeakMap,Zn=null,ii=null;function nf(e){let t=Array.from(e.querySelectorAll(Yy));for(let n of t){let r=n.textContent?.trim()??"";ef.get(n)!==r&&(ef.set(n,r),r.length>0&&sf(r)),!Qn.has(n)&&(Qn.set(n,n.style.display),n.setAttribute(tf,""),n.style.display="none")}for(let[n,r]of Array.from(Qn))n.isConnected&&t.includes(n)||(of(n,r),Qn.delete(n))}function rf(){for(let[e,t]of Array.from(Qn))of(e,t);Qn.clear(),gs()}function of(e,t){e.style.display=t,e.removeAttribute(tf)}function af(e){sf(e)}function sf(e){if(Zn!==null&&Zn.isConnected&&Zn.textContent===e)return;gs();let t=document.createElement("div");t.className=Jy,t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute(Xy,"done"),t.innerHTML=`<span class="${Zu}"></span>`;let n=t.querySelector(`.${Zu}`);n!==null&&(n.textContent=e),t.style.setProperty("--bre-note-hold","3000ms"),document.body.append(t),Zn=t,ii=setTimeout(()=>{gs()},3e3)}function gs(){ii!==null&&(clearTimeout(ii),ii=null),Zn?.remove(),Zn=null}var un="data-bre-settle",df='[class*="rowActions"] > button:not(.bre-provider-switch):not(.bre-provider-delete)';var Et=null,hs=0,ai=0,Kr=!1,er=null;function lf(e){return e.className.includes("dangerButton")?"remove":"edit"}function bs(e,t){return Array.from(e.querySelectorAll(df)).find(r=>lf(r)===t)??null}function Qy(e){return typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,16)}function Zy(e){typeof cancelAnimationFrame=="function"?cancelAnimationFrame(e):clearTimeout(e)}function cf(e=document){qr();let t=[];for(let n of Array.from(e.querySelectorAll(df))){if(n.disabled)continue;let r=n.closest("li")??n.parentElement;if(r===null)continue;let o=lf(n);t.some(i=>i.row===r&&i.role===o)||t.push({row:r,role:o})}t.length!==0&&(Et=t,ai=Date.now(),hs=ai+8e3,ev(),uf())}function ys(){if(Et===null)return;let e=Date.now();if(e>hs){qr();return}let t=0;if(Et=Et.filter(n=>{if(!n.row.isConnected)return!1;let r=bs(n.row,n.role);return r===null||(r.disabled?(Kr=!0,t+=1,r.hasAttribute(un)||r.setAttribute(un,"")):Kr&&r.hasAttribute(un)&&r.removeAttribute(un)),!0}),Kr&&t===0){qr();return}if(!Kr&&e-ai>1500){qr();return}uf()}function uf(){er!==null||Et===null||(er=Qy(()=>{er=null,ys()}))}function ev(){if(Et!==null)for(let e of Et){let t=bs(e.row,e.role);t!==null&&!t.hasAttribute(un)&&t.setAttribute(un,"")}}function ff(){qr()}function qr(){if(er!==null&&(Zy(er),er=null),Et!==null)for(let e of Et){let t=bs(e.row,e.role);t!==null&&t.removeAttribute(un)}Et=null,Kr=!1,hs=0,ai=0}var Q=require("react/jsx-runtime"),tv=["claude-cli/2.1.161 (external, cli)","claude-code/1.0.0","Kilo-Code/1.0"];function pf(e,t){let n=()=>t.current+=1,r=Object.entries(e??{}).map(([o,i])=>({id:n(),name:o,value:i}));return r.length===0&&r.push({id:n(),name:"",value:""}),{rows:r}}function mf(e){let t={},n=!1;for(let o of e.rows){let i=o.name.trim();i.length!==0&&(t[i]=o.value,i.toLowerCase()==="user-agent"&&(n=!0))}let r=e.userAgent?.trim();return!n&&r!==void 0&&r.length>0&&(t["user-agent"]=r),t}function si({route:e,api:t,t:n,onDismiss:r,deferred:o,extras:i,onCommitExtras:a,onResetExtras:s}){let d=(0,xe.useId)(),[l,c]=(0,xe.useState)(void 0),[p,m]=(0,xe.useState)({rows:[]}),[u,f]=(0,xe.useState)(!1),[y,g]=(0,xe.useState)(!1),[E,L]=(0,xe.useState)(!0),[w,H]=(0,xe.useState)(!1),[D,te]=(0,xe.useState)(!1),[U,v]=(0,xe.useState)(void 0),[b,N]=(0,xe.useState)(void 0),[x,T]=(0,xe.useState)(!1),O=(0,xe.useRef)(0),K=(0,xe.useRef)(null),G=o!==void 0,j=o?.onDraft,h=(0,xe.useRef)(void 0);(0,xe.useEffect)(()=>{if(G&&h.current!==void 0)return;h.current=e;let V=!0;return(async()=>{try{let P=await de(t);if(!V)return;let z=pa(P.namespace,e);c(z),m(pf(z,O)),te(P.writable!==!0)}catch{V&&te(!0)}finally{V&&L(!1)}})(),()=>{V=!1}},[t,e,G]),(0,xe.useEffect)(()=>{j!==void 0&&j(mf(p))},[p,j]),(0,xe.useEffect)(()=>{let V=!0;return(async()=>{try{let z=await(await fetch(sd,{method:"GET"})).json();V&&z.ok===!0&&z.data!==void 0&&N(z.data)}catch{}})(),()=>{V=!1}},[]),(0,xe.useEffect)(()=>{let V=K.current;if(V===null)return;let P=()=>{T(V.dataset.breRegion==="advanced")};P();let z=new MutationObserver(P);return z.observe(V,{attributes:!0,attributeFilter:["data-bre-region"]}),()=>{z.disconnect()}},[]);let S=()=>{m(V=>({...V,rows:[...V.rows,{id:O.current+=1,name:"",value:""}]})),v(void 0)},I=(V,P)=>{m(z=>({...z,rows:z.rows.map(J=>J.id===V?{...J,...P}:J)})),v(void 0)},_=V=>{m(P=>({...P,rows:P.rows.filter(z=>z.id!==V)})),v(void 0)},ee=()=>{m({rows:[{id:O.current+=1,name:"",value:""}]}),v(void 0)},Z=()=>{if(s?.(),m(pf(l,O)),g(!1),v(void 0),o!==void 0){o.onCancel();return}x&&r?.()},oe=async V=>{H(!0),v(void 0),cf();let P;try{P=await yr(t,e,V)}catch(J){P={ok:!1,error:J instanceof Error?J.message:String(J)}}if(!P.ok){H(!1),v({kind:"error",text:P.error==="no-route"?n("headersNoRoute"):P.error==="read-only"?n("headersReadOnly"):n("headersError",{error:P.error})});return}if(c(V),g(!1),a!==void 0)try{await a()}catch{H(!1),v({kind:"error",text:n("camouflageError")});return}H(!1);let z=Object.keys(V).length===0?n("headersCleared"):n("headersSaved");if(x){af(z),r?.();return}v({kind:"success",text:z})},re=Object.entries(l??{}),X=D||w,ue=x||G,ke=y||ue?p.rows.filter(V=>V.name.trim().length>0).length:re.length,Se=p.rows.some(V=>V.name.trim().length>0||V.value.length>0),Ae=u||y||ue;return(0,Q.jsxs)("div",{className:"bre-headers",ref:K,"data-plugin":ye,"data-open":u?"1":"0",children:[(0,Q.jsx)("div",{className:"bre-headers-head",children:y||ue?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)("span",{className:"bre-effort-title",children:n("headersTitle")}),ke===0?null:(0,Q.jsx)("span",{className:"bre-headers-count",children:ke}),D||!Se?null:(0,Q.jsx)("button",{type:"button",className:"bre-headers-clear",disabled:X,onClick:ee,children:n("headersClear")})]}):(0,Q.jsxs)("button",{type:"button",className:"bre-headers-disclosure","aria-expanded":u,"aria-label":`${n("headersTitle")} ${e}`,onClick:()=>{f(!u),v(void 0)},children:[(0,Q.jsx)("span",{className:"bre-effort-title",children:n("headersTitle")}),E||ke===0?null:(0,Q.jsx)("span",{className:"bre-headers-count",children:ke}),(0,Q.jsx)("span",{className:"bre-headers-chevron","aria-hidden":"true",children:"\u203A"})]})}),Ae?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)("p",{className:"bre-effort-note",children:n("headersHint")}),b===void 0?null:(0,Q.jsxs)(Q.Fragment,{children:[b.environment.preferOfficialLayer?(0,Q.jsx)("p",{className:"bre-effort-note bre-warn",children:n("headersConflictPatched")}):null,b.conflicts.length===0&&(b.headerConflicts?.length??0)===0?null:(0,Q.jsx)("p",{className:"bre-effort-note bre-warn",children:n("headersConflictOrigin")}),b.environment.siblings.length===0?null:(0,Q.jsx)("p",{className:"bre-effort-note bre-warn",children:n("headersConflictSiblings",{names:b.environment.siblings.map(V=>V.name).join(", ")})})]}),E?null:y||ue?(0,Q.jsxs)("div",{className:"bre-headers-edit",children:[(0,Q.jsxs)("div",{className:"bre-headers-columns","aria-hidden":"true",children:[(0,Q.jsx)("span",{children:n("headersName")}),(0,Q.jsx)("span",{children:n("headersValue")}),(0,Q.jsx)("span",{})]}),p.rows.map(V=>(0,Q.jsxs)("div",{className:"bre-headers-row",children:[(0,Q.jsx)("input",{type:"text",className:"bre-text-input bre-headers-name",value:V.name,disabled:X,placeholder:n("headersNamePlaceholder"),"aria-label":n("headersName"),onChange:P=>{I(V.id,{name:P.target.value})}}),(0,Q.jsx)("input",{type:"text",className:"bre-text-input bre-headers-value",value:V.value,disabled:X,list:V.name.trim().toLowerCase()==="user-agent"?d:void 0,placeholder:n("headersValue"),"aria-label":n("headersValue"),onChange:P=>{I(V.id,{value:P.target.value})}}),(0,Q.jsx)("button",{type:"button",className:"bre-headers-remove",disabled:X,"aria-label":`${n("headersRemove")} ${V.name}`,title:n("headersRemove"),onClick:()=>{_(V.id)},children:"\xD7"})]},V.id)),(0,Q.jsx)("button",{type:"button",className:"bre-headers-add",disabled:X,onClick:S,children:n("headersAdd")}),(0,Q.jsx)("datalist",{id:d,children:tv.map(V=>(0,Q.jsx)("option",{value:V},V))})]}):(0,Q.jsxs)("div",{className:"bre-headers-rows",children:[re.length===0?(0,Q.jsx)("p",{className:"bre-effort-note",children:n("headersEmpty")}):re.map(([V,P])=>(0,Q.jsxs)("div",{className:"bre-headers-row",children:[(0,Q.jsx)("span",{className:"bre-headers-name",children:V}),(0,Q.jsx)("span",{className:"bre-headers-value bre-headers-masked",children:"\u2022".repeat(Math.min(P.length,24))})]},V)),D?null:(0,Q.jsx)("div",{className:"bre-effort-actions",children:(0,Q.jsx)("button",{type:"button",className:"bre-secondary-button",disabled:X,onClick:()=>{g(!0),v(void 0)},children:n("headersEdit")})})]})]}):null,!E&&(ue||y)?(0,Q.jsxs)(Q.Fragment,{children:[i,(0,Q.jsxs)("div",{className:"bre-effort-actions bre-headers-actions",children:[(0,Q.jsx)("button",{type:"button",className:"bre-secondary-button",disabled:w,onClick:Z,children:n("headersCancel")}),G?null:(0,Q.jsx)("button",{type:"button",className:"bre-primary-button",disabled:X,onClick:()=>{oe(mf(p))},children:n("headersSave")})]})]}):null,U===void 0?null:(0,Q.jsx)("p",{className:"bre-effort-message bre-"+U.kind,role:U.kind==="error"?"alert":"status",children:U.text})]})}var Me=require("react");var Ke=require("react/jsx-runtime"),nv=[{value:void 0,labelKey:"camouflageOff"},{value:"codex",labelKey:"camouflageCodex"},{value:"claude",labelKey:"camouflageClaude"}];function rv(e){return e==="codex"||e==="claude"}function gf(e){let t=e.data;if(typeof t!="object"||t===null)return;let n=t,r={},o=n.providers;if(typeof o=="object"&&o!==null&&!Array.isArray(o))for(let[i,a]of Object.entries(o))rv(a)&&(r[i]=a);return{presets:["codex","claude"],providers:r,installed:n.installed===!0}}function vs({t:e,value:t,installed:n,disabled:r=!1,onChange:o}){return(0,Ke.jsxs)("div",{className:"bre-camouflage","data-plugin":ye,"data-open":"1",children:[(0,Ke.jsxs)("div",{className:"bre-headers-head",children:[(0,Ke.jsx)("span",{className:"bre-effort-title",children:e("camouflageTitle")}),t===void 0?null:(0,Ke.jsx)("span",{className:"bre-headers-count",children:e(t==="codex"?"camouflageCodex":"camouflageClaude")})]}),(0,Ke.jsx)("p",{className:"bre-effort-note",children:e("camouflageHint")}),n?null:(0,Ke.jsx)("p",{className:"bre-effort-note bre-warn",children:e("camouflageUnavailable")}),(0,Ke.jsx)("div",{className:"bre-camouflage-options",role:"radiogroup","aria-label":e("camouflageTitle"),children:nv.map(i=>(0,Ke.jsx)("button",{type:"button",role:"radio","aria-checked":t===i.value,className:"bre-secondary-button bre-camouflage-option","data-active":t===i.value?"1":"0",disabled:r,onClick:()=>{o(i.value)},children:e(i.labelKey)},i.value??"off"))})]})}function ws(e,t){let[n,r]=(0,Me.useState)(void 0),[o,i]=(0,Me.useState)(void 0),[a,s]=(0,Me.useState)(!0),[d,l]=(0,Me.useState)(!0),c=(0,Me.useRef)(void 0),p=(0,Me.useRef)(void 0),m=(0,Me.useRef)(!0);(0,Me.useEffect)(()=>(m.current=!0,()=>{m.current=!1}),[]),(0,Me.useEffect)(()=>{if(e===""){l(!1);return}let g=!1;return l(!0),fetch(Ii,{method:"GET"}).then(async E=>await E.json()).then(E=>{if(g||!m.current)return;let L=gf(E);if(L===void 0)return;let w=L.providers[e];c.current=w,p.current=w,r(w),i(w),s(L.installed)}).catch(()=>{}).finally(()=>{!g&&m.current&&l(!1)}),()=>{g=!0}},[e]);let u=(0,Me.useCallback)(g=>{p.current=g,i(g)},[]),f=(0,Me.useCallback)(()=>{p.current=c.current,i(c.current)},[]),y=(0,Me.useCallback)(async g=>{let E=g===void 0?p.current:g.preset;if(e===""||E===c.current)return;let L=await fetch(Ii,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({route:e,preset:E??null})}),w=await L.json();if(!L.ok||w.ok!==!0)throw new Error("camouflage write rejected");let H=gf(w);c.current=E,p.current=E,r(E),i(E),H!==void 0&&s(H.installed)},[e]);return{value:o,saved:n,installed:a,loading:d,setValue:u,reset:f,commit:y}}function hf({route:e,t}){let n=ws(e,t),[r,o]=(0,Me.useState)(void 0),i=(0,Me.useCallback)(a=>{n.setValue(a),o(void 0),n.commit({preset:a}).then(()=>{o(void 0)}).catch(()=>{n.setValue(void 0),o({kind:"error",text:t("camouflageError")})})},[n,t]);return(0,Ke.jsxs)(Ke.Fragment,{children:[(0,Ke.jsx)(vs,{t,value:n.value,installed:n.installed,disabled:n.loading||e==="",onChange:i}),r===void 0?null:(0,Ke.jsx)("p",{className:"bre-effort-message bre-"+r.kind,role:r.kind==="error"?"alert":"status",children:r.text})]})}var xs=require("react");var ov={provider:"editorTabProvider",models:"editorTabModels",fingerprint:"editorTabFingerprint",advanced:"editorTabAdvanced"};function di({host:e,t}){return(0,xs.createElement)("div",{className:Wu,role:"tablist","aria-label":t("editorTabsLabel")},...Gu.map(n=>(0,xs.createElement)("button",{key:n,type:"button",role:"tab",className:Uu,[ju]:n,onClick:r=>{r.preventDefault(),r.stopPropagation();let o=Xn(e.current);o!==null&&Ju(o,n)}},t(ov[n]))))}var iv=15e3;function yf(){return{intents:new Map,baseline:new Map,flushing:!1}}function ks(e,t,n){if(t.length===0)return;let r={...n};if(Object.keys(r).length===0){e.intents.delete(t);return}let o=e.intents.get(t);if(o===void 0){e.intents.set(t,{headers:r,declaredBefore:e.baseline.get(t)});return}o.headers=r}function Es(e,t){e.intents.delete(t)}function vf(e,t){let n=e.intents.get(t);n!==void 0&&(n.releasedAt=Date.now())}function wf(e,t,n){if(t.length===0)return;e.baseline.set(t,n);let r=e.intents.get(t);r!==void 0&&(r.declaredBefore=n)}function xf(e,t){return t.length>0&&!e.baseline.has(t)}async function kf(e,t){if(e.flushing)return bf(e);if(e.intents.size===0)return 0;e.flushing=!0;try{let n=await de(t),r,o=async a=>nt(n.namespace,a)?!0:(r??(r=await de(t,{fresh:!0})),nt(r.namespace,a)),i=Date.now();for(let[a,s]of Array.from(e.intents)){if(s.declaredBefore===void 0){s.releasedAt!==void 0&&s.noted!==!0&&(s.noted=!0,console.warn("[bre] deferred request headers: nobody said whether this id existed before, so the draft is held:",a));continue}if(s.declaredBefore){e.intents.delete(a);continue}if(!await o(a)){s.releasedAt!==void 0&&i-s.releasedAt>iv?(e.intents.delete(a),console.info("[bre] deferred request headers: gave up on a draft whose card closed first:",a)):s.releasedAt!==void 0&&console.info("[bre] deferred request headers: waiting for the closed card to declare",a);continue}console.info("[bre] deferred request headers: the route is declared, writing the held draft:",a);let d;try{d=await yr(t,a,s.headers)}catch(l){d={ok:!1,error:l instanceof Error?l.message:String(l)}}if(d.ok){e.intents.delete(a),console.info("[bre] deferred request headers: saved",a,Object.keys(s.headers).length,"header(s)");continue}d.error!=="no-route"&&(e.intents.delete(a),console.error("[bre] deferred request headers: the write was refused:",d.error,a))}}catch(n){console.error("[bre] deferred request headers: could not read the settings document:",n)}finally{e.flushing=!1}return bf(e)}function bf(e){let t=0;for(let n of e.intents.values())n.releasedAt!==void 0&&(t+=1);return t}var Ut=require("react/jsx-runtime");function Tf({host:e,api:t,t:n,routeIdLabels:r,staged:o}){let[i,a]=(0,Ve.useState)(()=>Br(e.current,r)),s=(0,Ve.useRef)(i),d=(0,Ve.useRef)(void 0),l=(0,Ve.useRef)(new Set),c=(0,Ve.useRef)(!1),p=(0,Ve.useRef)(null);return p.current===null&&(p.current={onDraft:m=>{d.current=m;let u=s.current;if(u.length===0){!c.current&&Object.keys(m).length>0&&(c.current=!0,console.info("[bre] deferred request headers: holding a draft until the provider id is typed"));return}ks(o,u,m),Ef(t,o,u,l.current)},onCancel:()=>{d.current=void 0,Es(o,s.current)}}),(0,Ve.useEffect)(()=>{let m=li(e.current);if(m===null)return;let u=()=>{a(Br(e.current,r))};return m.addEventListener("input",u,!0),()=>{m.removeEventListener("input",u,!0)}},[e,r]),(0,Ve.useEffect)(()=>{i.length>0&&Ef(t,o,i,l.current)},[t,o,i]),(0,Ve.useEffect)(()=>{let m=s.current;if(m===i)return;Es(o,m),s.current=i;let u=d.current;u!==void 0&&i.length>0&&ks(o,i,u)},[i,o]),(0,Ve.useEffect)(()=>()=>{vf(o,s.current)},[o]),(0,Ut.jsxs)(Ut.Fragment,{children:[(0,Ut.jsx)(di,{host:e,t:n}),(0,Ut.jsx)(si,{route:i,api:t,t:n,deferred:p.current,extras:(0,Ut.jsx)(hf,{route:i,t:n})})]})}function Ef(e,t,n,r){!xf(t,n)||r.has(n)||(r.add(n),(async()=>{try{let o=await de(e);wf(t,n,nt(o.namespace,n))}catch(o){r.delete(n),console.warn("[bre] deferred request headers: could not read the settings document for this route:",o)}})())}function li(e){let t=e?.parentElement;return t==null?null:t.parentElement?.closest('[class*="addCard"]')??t}function Br(e,t){let n=e?.parentElement;if(n==null)return"";let r=t(),o=$e(n,r).trim();if(o.length>0)return o;let i=li(e);return i===null||i===n?"":$e(i,r).trim()}var Ls=require("react");var Ye=require("react");var Gr=15e3,av=3;function Mf(){return{intents:new Map,baseline:new Map,baselinePending:new Set,baselineFailures:new Set,activeIntents:new Map,draining:!1,drainAgain:!1}}function Ts(e,t,n){if(t.length===0)return;if(n.length===0){Ss(e,t);return}let r=e.intents.get(t);if(r===void 0){let o=e.activeIntents.get(t);e.intents.set(t,{drafts:[...n],landed:o?.landed??[],revision:0,declaredBefore:e.baseline.get(t),attempts:0}),e.draining&&(e.drainAgain=!0);return}sv(r.drafts,n)||(r.drafts=[...n],r.revision+=1,r.baselineMissing=!1,e.draining&&(e.drainAgain=!0))}function sv(e,t){return e.length===t.length&&e.every((n,r)=>{let o=t[r];return o!==void 0&&n.ref===o.ref&&n.value===o.value&&n.alias===o.alias&&n.protocol===o.protocol&&n.enabled===o.enabled})}function Ss(e,t){e.intents.delete(t),e.draining&&(e.drainAgain=!0)}function Lf(e,t){let n=e.intents.get(t);n!==void 0&&(n.releasedAt=Date.now())}function Ms(e,t,n){if(t.length===0)return;e.baseline.has(t)||e.baseline.set(t,n),e.baselinePending.delete(t),e.baselineFailures.delete(t);let r=e.intents.get(t);r!==void 0&&(r.declaredBefore=e.baseline.get(t),r.baselineMissing=!1),e.draining&&(e.drainAgain=!0)}function Af(e,t){return dv(e,t)?(e.baselinePending.add(t),!0):!1}function Rf(e,t){e.baselinePending.delete(t),e.baseline.has(t)||e.baselineFailures.add(t),e.draining&&(e.drainAgain=!0)}function dv(e,t){return t.length>0&&!e.baseline.has(t)&&!e.baselinePending.has(t)&&!e.baselineFailures.has(t)}async function Cf(e,t,n){if(e.draining)return Sf(e);if(e.intents.size===0)return 0;e.draining=!0;try{do{e.drainAgain=!1;let r=await de(t),o,i=async s=>nt(r.namespace,s)?!0:(o??(o=await de(t,{fresh:!0})),nt(o.namespace,s)),a=Date.now();for(let[s,d]of Array.from(e.intents)){if(e.intents.get(s)!==d)continue;let l=d.revision;e.activeIntents.set(s,d);try{if(d.declaredBefore===void 0){if(e.baselinePending.has(s)){d.releasedAt!==void 0&&a-d.releasedAt>Gr&&(e.intents.delete(s),console.error("[bre] deferred api keys: the pre-save baseline timed out; refusing to write held keys:",s));continue}if(e.baselineFailures.has(s)){let m=await i(s);if(e.intents.get(s)!==d)continue;if(d.revision!==l||d.declaredBefore!==void 0){e.drainAgain=!0;continue}m?(d.baselineMissing=!0,d.noted!==!0&&(d.noted=!0,console.error("[bre] deferred api keys: the pre-save baseline failed and this route now exists; refusing to guess ownership:",s)),d.releasedAt!==void 0&&a-d.releasedAt>Gr&&(e.intents.delete(s),console.error("[bre] deferred api keys: the pre-save baseline remained unknown; refusing to write held keys:",s))):(Ms(e,s,!1),d.releasedAt!==void 0&&a-d.releasedAt>Gr&&(e.intents.delete(s),console.info("[bre] deferred api keys: gave up on drafts whose card closed first:",s)));continue}d.baselineMissing=!0,d.noted!==!0&&(d.noted=!0,console.error("[bre] deferred api keys: no pre-save baseline is available; refusing to write held keys:",s)),d.releasedAt!==void 0&&a-d.releasedAt>Gr&&e.intents.delete(s);continue}if(d.declaredBefore){e.intents.delete(s);continue}let c=await i(s);if(e.intents.get(s)!==d)continue;if(d.revision!==l){e.drainAgain=!0;continue}if(!c){d.releasedAt!==void 0&&a-d.releasedAt>Gr&&(e.intents.delete(s),console.info("[bre] deferred api keys: gave up on drafts whose card closed first:",s));continue}let p=await lv(e,s,d,n);if(e.intents.get(s)!==d||d.revision!==l)continue;p&&(e.intents.delete(s),console.info("[bre] deferred api keys: the route is declared, saved the held key list:",s))}finally{e.activeIntents.get(s)===d&&e.activeIntents.delete(s)}}}while(e.drainAgain&&e.intents.size>0)}catch(r){console.error("[bre] deferred api keys: could not read the settings document:",r)}finally{e.draining=!1}return Sf(e)}async function lv(e,t,n,r){let o=n.revision,i=[...n.drafts],a=!1,s=!1,d=()=>e.intents.get(t)!==n?!0:n.revision!==o?(e.drainAgain=!0,!0):!1,l=()=>{a=!0,n.attempts+=1};for(let c of i){if(d())return!1;let p=n.landed.find(m=>m.ref===c.ref);if(p===void 0){let m=await r.add(t,c.value,c.alias);if(!m.ok){if(d())return!1;l();break}let f=(m.addedRef!==void 0&&m.entries.some(w=>w.ref===m.addedRef)?m.addedRef:void 0)??m.entries.map(w=>w.ref).find(w=>!n.landed.some(H=>H.hostRef===w));if(f===void 0){if(d())return!1;l();break}let y=m.entries.find(w=>w.ref===f),{alias:g,protocol:E,...L}=c;if(p={ref:c.ref,hostRef:f,draft:{...L,...y?.alias===void 0?{}:{alias:y.alias},...y?.protocol===void 0?{}:{protocol:y.protocol},enabled:y?.enabled??!0}},n.landed.push(p),s=!0,d())return!1;continue}if(p.draft.value!==c.value){if(!(await r.replace(t,p.hostRef,c.value)).ok){if(d())return!1;l();break}if(p.draft={...p.draft,value:c.value},s=!0,d())return!1}if(p.draft.alias!==c.alias){let{alias:m,...u}=p.draft;if(!(await r.rename(t,p.hostRef,c.alias)).ok){if(d())return!1;l();break}if(p.draft={...u,...c.alias===void 0?{}:{alias:c.alias}},s=!0,d())return!1}}if(!a)for(let c of i){if(d())return!1;let p=n.landed.find(y=>y.ref===c.ref);if(p===void 0||p.draft.protocol===c.protocol)continue;if(!(await r.setProtocol(t,p.hostRef,c.protocol)).ok){if(d())return!1;l();break}let{protocol:u,...f}=p.draft;if(p.draft={...f,...c.protocol===void 0?{}:{protocol:c.protocol}},s=!0,d())return!1}if(!a)for(let c of[!0,!1]){for(let p of i){if(d())return!1;if(p.enabled!==c)continue;let m=n.landed.find(f=>f.ref===p.ref);if(m===void 0||m.draft.enabled===c)continue;if(!(await r.setEnabled(t,m.hostRef,c)).ok){if(d())return!1;l();break}if(m.draft={...m.draft,enabled:c},s=!0,d())return!1}if(a)break}return a?(s&&(n.attempts=0),n.attempts>=av?(console.error("[bre] deferred api keys: the write was refused; giving up on the held key list:",t),!0):!1):(n.attempts=0,!d())}function Sf(e){let t=0;for(let n of e.intents.values())n.releasedAt!==void 0&&(t+=1);return t}var cv={openai:null,anthropic:null};function uv(e){let t=new Set(e.map(n=>n.ref));for(let n=1;n<=999;n+=1){let r=`key-${n}`;if(!t.has(r))return r}return`key-${Date.now()}`}function Hf(e,t){let n=()=>({ok:!0,route:"",entries:e.drafts.map(a=>({ref:a.ref,...a.alias===void 0?{}:{alias:a.alias},enabled:a.enabled,configured:!0,masked:ec(a.value),...a.protocol===void 0?{}:{protocol:a.protocol}})),endpoints:cv}),r=a=>(t.onChange(e.drafts),{...n(),...a===void 0?{}:{addedRef:a}}),o=a=>e.drafts.find(s=>s.ref===a),i=(a,s)=>(e.drafts=e.drafts.map(d=>d.ref===a?s:d),r());return{list:async()=>n(),cached:()=>n(),add:async(a,s,d)=>{if(!Mt(s))return{ok:!1,error:t.t("keysAddIllegal")};let l=uv(e.drafts);return e.drafts=[...e.drafts,{ref:l,value:s,enabled:!0,...d===void 0?{}:{alias:d}}],r(l)},rename:async(a,s,d)=>{let l=o(s);if(l===void 0)return{ok:!1};let{alias:c,...p}=l;return i(s,{...p,...d===void 0?{}:{alias:d}})},replace:async(a,s,d)=>{let l=o(s);return l===void 0||!Mt(d)?{ok:!1,error:t.t("keysAddIllegal")}:i(s,{...l,value:d})},remove:async(a,s)=>(e.drafts=e.drafts.filter(d=>d.ref!==s),r()),setScope:async()=>n(),setEnabled:async(a,s,d)=>{let l=o(s);return l===void 0?{ok:!1}:!d&&!e.drafts.some(c=>c.ref!==s&&c.enabled)?{ok:!1,error:t.t("keysLastEnabledOff")}:i(s,{...l,enabled:d})},setProtocol:async(a,s,d)=>{let l=o(s);if(l===void 0)return{ok:!1};let{protocol:c,...p}=l;return i(s,{...p,...d===void 0?{}:{protocol:d}})},setEndpoints:async()=>n(),probe:async()=>n(),reveal:async(a,s)=>o(s)?.value}}var Of=require("react/jsx-runtime");function Nf({host:e,store:t,api:n,t:r,routeIdLabels:o,staged:i,onChange:a}){let[s,d]=(0,Ye.useState)(()=>Br(e.current,o)),l=(0,Ye.useRef)(s),c=(0,Ye.useRef)(new Set),p=(0,Ye.useRef)(!1),m=(0,Ye.useMemo)(()=>Hf(t,{t:r,onChange:u=>{a?.(u);let f=l.current;if(f.length===0){!p.current&&u.length>0&&(p.current=!0,console.info("[bre] deferred api keys: holding the list until the provider id is typed"));return}Ts(i,f,u)}}),[a,i,t,r]);return(0,Ye.useEffect)(()=>{let u=li(e.current);if(u===null)return;let f=()=>{d(Br(e.current,o))};return u.addEventListener("input",f,!0),()=>{u.removeEventListener("input",f,!0)}},[e,o]),(0,Ye.useEffect)(()=>{s.length>0&&fv(n,i,s,c.current)},[n,i,s]),(0,Ye.useEffect)(()=>{let u=l.current;u!==s&&(Ss(i,u),l.current=s),t.drafts.length>0&&s.length>0&&Ts(i,s,t.drafts)},[s,i,t]),(0,Ye.useEffect)(()=>()=>{Lf(i,l.current)},[i]),(0,Of.jsx)(Jo,{route:s,t:r,client:m,draft:!0})}function fv(e,t,n,r){r.has(n)||!Af(t,n)||(r.add(n),(async()=>{try{let o=await de(e);Ms(t,n,nt(o.namespace,n))}catch(o){Rf(t,n),console.warn("[bre] deferred api keys: could not read the settings document for this route:",o)}})())}var ui="data-bre-create-keys",pv="bre-keys-host",mv="data-bre-key-input",ci="data-bre-region",tr=new WeakMap;function If(e){let t=e.querySelector(`input[${mv}]`);if(t instanceof HTMLInputElement)return t;let n=e.querySelector('input[type="password"]');return n instanceof HTMLInputElement?n:void 0}function Pf(e){let t=tr.get(e)?.host;if(t!==void 0&&t.isConnected)return t;let n=e.nextElementSibling;return n instanceof HTMLDivElement&&n.hasAttribute(ui)?n:void 0}function _f(e,t){if(e.closest(`[${ui}]`)!==null){nr(e);return}let n=If(e);if(n===void 0){nr(e);return}if(e.parentElement===null)return;De(e,sn,!0);let r=tr.get(e),o=Pf(e);o===void 0&&(r!==void 0&&As(e,r),o=e.ownerDocument.createElement("div"),o.className=pv,e.after(o)),fe(o,ui,"");let i=e.getAttribute(ci);if(i===null?o.hasAttribute(ci)&&o.removeAttribute(ci):fe(o,ci,i),r!==void 0&&r.host===o)return;r!==void 0&&As(e,r);let a={drafts:Mt(n.value)?[{ref:"key-1",value:n.value,enabled:!0}]:[]},s=o,d=pt(o,t.refreshed(()=>(0,Ls.createElement)(Ue,{fallbackText:t.t("keysPanelFailed")},(0,Ls.createElement)(Nf,{host:{current:s},store:a,api:t.api,t:t.t,routeIdLabels:t.routeIdLabels,staged:t.staged,onChange:l=>{let c=If(e);if(c===void 0||c.disabled)return;let p=l.find(m=>m.enabled)?.value??"";c.value!==p&&Pr(c,p)}}))),{sync:!0});tr.set(e,{host:o,mount:d})}function As(e,t){tr.delete(e),Ne(t.mount)}function nr(e){De(e,sn,!1);let t=tr.get(e);t!==void 0&&As(e,t),Pf(e)?.remove()}function Df(){for(let e of Array.from(document.querySelectorAll(`[${ui}]`))){let t=e.previousElementSibling;t instanceof HTMLElement&&tr.has(t)?nr(t):e.remove()}}var Cs="bre-create-host",Rs="bre-add-mode-picker",gv='[class*="addCard"]',hv='[class*="addPanel"]',bv='[class*="addModes"]',Ff="-custom-panel",yv="-custom";function Bf(){return{hosts:new Map}}function Hs(e,t,n){if(!e.isConnected)return;let r=new Set;for(let o of Array.from(e.querySelectorAll(gv)))if(o.isConnected)try{vv(o,t,n),r.add(o)}catch(i){fi(o,n);for(let a of Ns(o))try{nr(a)}catch{}Gf(o,!1),console.warn("[bre] add provider card: left the official form in place:",i)}for(let o of Array.from(n.hosts.keys()))(!r.has(o)||!o.isConnected)&&fi(o,n)}function vv(e,t,n){let r=Kf(e,Ff);(r===void 0||r.hidden)&&(Tv(e,()=>ns(e)),r=Kf(e,Ff),r===void 0||r.hidden)||(e.getAttribute("data-bre-add-card")!=="1"&&e.setAttribute("data-bre-add-card","1"),Mv(e,r,t,n),kv(e),Ev(r,t),Gf(e,!0))}var wv=".field, label",xv=".bre-keys-host, .bre-keys, .bre-create-host";function Ns(e){let t=[],n=e.querySelectorAll('input[type="password"], input[data-bre-key-input]');for(let r of Array.from(n)){if(r.closest(xv)!==null)continue;let o=r.closest(wv)??r.parentElement;o!==null&&!t.includes(o)&&t.push(o)}return t}function kv(e){for(let t of Ns(e))try{Ku(t)}catch(n){console.warn("[bre] add provider card: could not mark a key field:",n)}}function Ev(e,t){for(let n of Ns(e))try{_f(n,{t:t.t,api:t.api,routeIdLabels:t.routeIdLabels,staged:t.stagedKeys,refreshed:t.refreshed})}catch(r){nr(n),console.warn("[bre] add provider card: could not mount the key list:",r)}}function Gf(e,t){let n=Wf(e);n!==void 0&&De(n,Rs,t)}function Kf(e,t){for(let n of Array.from(e.querySelectorAll(hv)))if(n.id.endsWith(t))return n}function Wf(e){let t=e.querySelector(bv);if(t!==null){for(let n of Array.from(t.children))if(n instanceof HTMLElement&&n.getAttribute("role")==="tablist")return n}}function Tv(e,t){let n=Wf(e);if(n!==void 0){for(let r of Array.from(n.querySelectorAll('[role="tab"]')))if(r.id.endsWith(yv)){if(r.disabled)return;r.getAttribute("aria-selected")!=="true"&&(t(),r.click());return}}}function Sv(e){for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.classList.contains(Cs))return t}function Mv(e,t,n,r){let o=r.hosts.get(e),i=Sv(t);if(i!==void 0&&o!==void 0&&o.host===i)return;fi(e,r),i!==void 0&&i.remove();let a=e.ownerDocument.createElement("div");a.className=Cs,t.insertBefore(a,t.firstChild),ns(e);let s=pt(a,n.refreshed(()=>(0,qf.createElement)(Tf,{host:{current:a},api:n.api,t:n.t,routeIdLabels:n.routeIdLabels,staged:n.staged})),{sync:!0});r.hosts.set(e,{host:a,mount:s})}function fi(e,t){let n=t.hosts.get(e);n!==void 0&&(t.hosts.delete(e),Ne(n.mount))}function Uf(e){for(let t of Array.from(e.hosts.keys()))fi(t,e);for(let t of Array.from(document.querySelectorAll(`.${Cs}`)))t.remove();for(let t of Array.from(document.querySelectorAll(`.${Rs}`)))De(t,Rs,!1);for(let t of Array.from(document.querySelectorAll(`.${ln}`)))zn(t);Df()}var Wr="data-bre-row-provider",jf="{provider}",Lv=["rowCard","setupCard"];function zf(){return Ao()}function Je(e){for(let t of Lv)for(let n of Array.from(e.querySelectorAll(`[class*="${t}"]`))){let r=n.parentElement;if(!(r===null||r.tagName!=="UL")&&je(r).length!==0)return r}}function fn(e){return e.querySelector('[class*="rowHead"]')??void 0}function rr(e){let t=e.querySelector('[class*="rowName"]')?.textContent?.trim();return t!==void 0&&t.length>0?t:void 0}function Av(e){let t=e.indexOf(jf);if(!(t<0))return{prefix:e.slice(0,t),suffix:e.slice(t+jf.length)}}function Rv(e){let t=e.trim();if(t.length===0)return;let n=/^(.*) \(([^()]*)\)$/.exec(t);if(n!==null){let r=n[2];return r.length===0?void 0:r}return/\s/.test(t)?void 0:t}var Cv='[class*="rowCard"], [class*="setupCard"], [class*="addCard"]';function Hv(e){let t=e.closest(Cv);for(let n=e;n!==null&&n!==t;n=n.parentElement)if(n.matches('[data-plugin], [class*="bre-"]'))return!0;return!1}function Xe(e,t){let n=e.querySelector("[data-bre-provider]")?.getAttribute("data-bre-provider");if(typeof n=="string"&&n.length>0)return n;for(let r of t.editProvider){let o=Av(r);if(o!==void 0)for(let i of Array.from(e.querySelectorAll("button[aria-label]"))){if(Hv(i))continue;let a=i.getAttribute("aria-label")??"";if(a.length<=o.prefix.length+o.suffix.length||!a.startsWith(o.prefix)||!a.endsWith(o.suffix))continue;let s=Rv(a.slice(o.prefix.length,a.length-o.suffix.length));if(s!==void 0)return s}}}function Os(e){let t=e.getAttribute(Wr);return t===null||t.length===0?void 0:t}function Nv(e){return Er(e,Os)}function $f(e,t,n,r=Je(e)){if(!e.isConnected||r===void 0)return;let o=t.labels();for(let i of je(r)){let a=Xe(i,o);if(a===void 0){i.removeAttribute(Wr);continue}Os(i)!==a&&i.setAttribute(Wr,a)}Ho(e,r,Ov(t),n)}function Ov(e){return{rowOf:t=>{let n=t.closest("li");return n instanceof HTMLElement?n:void 0},idOf:Os,labelOf:rr,order:t=>yd(t),commit:t=>{oo(Nv(t))},seatOf:fn,seatDrags:!0,gripLabel:(t,n)=>e.t("providerReorderAria",{provider:rr(t)??n}),gripHint:()=>e.t("providerReorderHint")}}function Vf(e){No(e);let t=Array.from(document.querySelectorAll(`[${Wr}]`));Tr(t);for(let n of t)n.removeAttribute(Wr)}var or="data-bre-provider-switch",pi="bre-row-disabled";function Jf(){return{switches:new WeakSet}}function Xf(e,t,n,r=Je(e)){if(!e.isConnected||r===void 0)return;let o=t.labels();for(let i of Array.from(r.children)){if(!(i instanceof HTMLElement))continue;let a=Xe(i,o);if(a===void 0)continue;let s=fn(i);s!==void 0&&(Iv(i,s,a,t,n),i.classList.toggle(pi,!Mn(a)))}}function Qf(){for(let e of Array.from(document.querySelectorAll(`[${or}]`)))e.remove();for(let e of Array.from(document.querySelectorAll(`.${pi}`)))e.classList.remove(pi)}function Iv(e,t,n,r,o){let i=t.querySelector(`[${or}]`);if(i!==null){Yf(i,e,n,r);return}let a=document.createElement("button");a.className="bre-provider-switch",a.setAttribute("type","button"),a.setAttribute("role","switch"),a.setAttribute(or,n),Yf(a,e,n,r),Pv(a,e,o);let s=t.querySelector('[class*="rowActions"]');s===null?t.appendChild(a):s.insertBefore(a,s.firstChild)}function Yf(e,t,n,r){let o=r.t("providerToggleAria",{provider:rr(t)??n}),i=r.t("providerToggleHint"),a=Mn(n)?"true":"false";e.getAttribute(or)!==n&&e.setAttribute(or,n),e.getAttribute("aria-checked")!==a&&e.setAttribute("aria-checked",a),e.getAttribute("aria-label")!==o&&e.setAttribute("aria-label",o),e.getAttribute("title")!==i&&e.setAttribute("title",i)}function Pv(e,t,n){n.switches.has(e)||(n.switches.add(e),e.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation();let o=e.getAttribute(or);if(o===null)return;let i=!Mn(o);wd(o,i),e.setAttribute("aria-checked",i?"true":"false"),t.classList.toggle(pi,!i)}))}var _v=["balance","totalbalance","availablebalance","remainingbalance","creditbalance","balanceusd","totalavailable","available","remaining","credits","credit","amount","left","remain","remainingquota","quotaremaining","remainquota","availablequota","points"],Dv=new Map(_v.map((e,t)=>[e,t])),F0=(Dv.get("totalavailable")??0)+.5;var Fv=new Map([["USD","$"],["US$","$"],["$","$"],["CNY","\xA5"],["RMB","\xA5"],["\xA5","\xA5"],["EUR","\u20AC"],["\u20AC","\u20AC"],["GBP","\xA3"],["\xA3","\xA3"],["JPY","\xA5"],["KRW","\u20A9"],["HKD","HK$"],["TWD","NT$"]]);function Kv(e){let t=e<0?"-":"",n=Math.abs(e),r=Number.isInteger(n)?String(n):n.toFixed(2).replace(/0+$/,"").replace(/\.$/,""),[o="0",i]=r.split("."),a=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");return`${t}${a}${i===void 0?"":`.${i}`}`}function Zf(e){let t=Kv(e.amount),n=e.currency?.trim()??"";if(n.length===0)return t;let r=Fv.get(n.toUpperCase());return r!==void 0?`${r}${t}`:`${t} ${n}`}async function qv(e){try{let t=await fetch(`${id}?route=${encodeURIComponent(e)}`,{method:"GET",cache:"no-store",credentials:"same-origin"}),n;try{n=await t.json()}catch{n=void 0}if(!$(n))return{ok:!1};if(n.ok===!0){let i=n.configured!==!1,a=typeof n.amount=="number"&&Number.isFinite(n.amount)?n.amount:void 0,s=typeof n.currency=="string"&&n.currency.length>0?n.currency:void 0;return{ok:!0,configured:i,...a===void 0?{}:{amount:a},...s===void 0?{}:{currency:s}}}let r=typeof n.error=="string"&&n.error.length>0?n.error:void 0,o=typeof n.configured=="boolean"?n.configured:void 0;return{ok:!1,...o===void 0?{}:{configured:o},...r===void 0?{}:{error:r}}}catch{return{ok:!1}}}var ep={read:qv};var Ct="data-bre-provider-balance",Bv="data-bre-provider-switch",mi="data-bre-provider-balance-refresh",Gv=["M13.4 8a5.4 5.4 0 1 1-1.6-3.8","M13.8 2.2v3.5h-3.5"];function np(){return{readings:new Map,errors:new Map,requested:new Set,inflight:new Set,pending:new Set,queued:[],visible:!1}}var rp=3;function Is(e,t,n,r=Je(e)){if(r===void 0){n.visible=!1,n.queued.length=0;return}n.visible||(n.visible=!0,n.requested.clear());let o=t.labels();for(let i of Array.from(r.children)){if(!(i instanceof HTMLElement))continue;let a=Xe(i,o);if(a===void 0)continue;let s=fn(i);s!==void 0&&(ap(s,a,t,n),fp(s,a,t,n))}}function op(e,t){e.requested.delete(t),e.readings.delete(t),e.errors.delete(t),e.inflight.has(t)&&e.pending.add(t);for(let n=e.queued.length-1;n>=0;n-=1)e.queued[n]?.route===t&&e.queued.splice(n,1)}function ip(){for(let e of Array.from(document.querySelectorAll(`[${Ct}]`)))e.remove()}function ap(e,t,n,r){let o=r.readings.get(t);if(o!==void 0){sp(e,t,o,n,r);return}let i=r.errors.get(t);if(i!==void 0){Wv(e,t,i,n,r);return}up(e)}function sp(e,t,n,r,o){let i=dp(e,t,r,o);lp(i,`${r.t("providerBalanceLabel")} ${Zf(n)}`,r.t("providerBalanceHint"),r),cp(e,i)}function Wv(e,t,n,r,o){let i=dp(e,t,r,o),a=n.length>0?n:r.t("providerBalanceHint");lp(i,r.t("providerBalanceUnavailable"),a,r),cp(e,i)}function dp(e,t,n,r){let o=e.querySelector(`[${Ct}]`);return o===null?(o=document.createElement("span"),o.className="bre-provider-balance",o.setAttribute(Ct,t)):o.getAttribute(Ct)!==t&&o.setAttribute(Ct,t),(o.querySelector(".bre-provider-balance-text")===null||o.querySelector(`[${mi}]`)===null)&&(o.replaceChildren(),Uv(o,e,n,r)),o}function Uv(e,t,n,r){let o=document.createElement("span");o.className="bre-provider-balance-text";let i=document.createElement("button");i.type="button",i.className="bre-provider-balance-refresh",i.setAttribute(mi,"1"),i.setAttribute("aria-label",n.t("providerBalanceRefresh")),i.title=n.t("providerBalanceRefresh"),i.append(Zo("balance-refresh",Gv)),i.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation();let s=e.getAttribute(Ct);if(!(s===null||s.length===0)){if(r.inflight.has(s)){r.pending.add(s);return}r.requested.delete(s),fp(t,s,n,r)}}),e.append(o,i)}function lp(e,t,n,r){let o=e.querySelector(".bre-provider-balance-text");o!==null&&o.textContent!==t&&(o.textContent=t),e.getAttribute("title")!==n&&e.setAttribute("title",n);let i=e.querySelector(`[${mi}]`);if(i!==null){let a=r.t("providerBalanceRefresh");i.getAttribute("aria-label")!==a&&i.setAttribute("aria-label",a),i.getAttribute("title")!==a&&i.setAttribute("title",a)}}function tp(e,t,n){let r=e.querySelector(`[${Ct}]`);if(r===null||r.getAttribute(Ct)!==t)return;let o=r.querySelector(`[${mi}]`);o!==null&&(o.classList.toggle("is-spinning",n),n?o.setAttribute("aria-busy","true"):o.removeAttribute("aria-busy"))}function cp(e,t){let n=e.querySelector(`[${Bv}]`);if(n!==null){t.nextElementSibling!==n&&n.before(t);return}if(t.parentElement!==null)return;let r=e.querySelector('[class*="rowActions"]');r!==null?r.insertBefore(t,r.firstChild):e.appendChild(t)}function up(e){for(let t of Array.from(e.querySelectorAll(`[${Ct}]`)))t.remove()}function fp(e,t,n,r){r.requested.has(t)||r.inflight.has(t)||(r.requested.add(t),pp(e,t,n,r))}function pp(e,t,n,r){if(r.inflight.size>=rp){r.queued.some(o=>o.route===t)||r.queued.push({head:e,route:t});return}mp(e,t,n,r)}function jv(e,t){for(;t.inflight.size<rp&&t.queued.length>0;){let n=t.queued.shift();if(n===void 0)return;mp(n.head,n.route,e,t)}}function mp(e,t,n,r){r.inflight.add(t),tp(e,t,!0),(n.client??ep).read(t).then(i=>{if(i.ok&&i.configured!==!1&&typeof i.amount=="number"&&Number.isFinite(i.amount)){r.errors.delete(t);let a={amount:i.amount,...i.currency===void 0?{}:{currency:i.currency}};r.readings.set(t,a),e.isConnected&&sp(e,t,a,n,r);return}if(i.ok&&i.configured===!1){r.readings.delete(t),r.errors.delete(t),e.isConnected&&up(e);return}i.configured===!0&&r.errors.set(t,i.error??""),e.isConnected&&ap(e,t,n,r)}).catch(()=>{}).finally(()=>{r.inflight.delete(t),tp(e,t,!1),e.isConnected||n.repaint?.(),r.pending.delete(t)&&(r.requested.delete(t),pp(e,t,n,r)),jv(n,r)})}function gp(){return{requested:new Set,pending:[],running:new Set,visible:!1}}var zv=2;function hp(e){for(;e.visible&&e.running.size<zv;){let t=e.pending.shift();if(t===void 0)return;e.running.add(t.route),Promise.resolve().then(()=>t.client.list(t.route,{preferCache:!0})).catch(()=>{}).finally(()=>{e.running.delete(t.route),hp(e)})}}function Ps(e,t,n,r=Je(e)){if(r===void 0){n.visible=!1,n.pending.length=0;return}n.visible||(n.visible=!0,n.requested.clear());let o=t.client;if(o===void 0)return;let i=t.labels();for(let a of Array.from(r.children)){if(!(a instanceof HTMLElement))continue;let s=Xe(a,i);s===void 0||n.requested.has(s)||(n.requested.add(s),n.running.has(s)||n.pending.push({route:s,client:o}))}hp(n)}var gi="data-bre-provider-delete",bp='[class*="rowActions"]',yp='[class*="dangerButton"]',$v="bre-provider-delete";function vp(e,t,n=Je(e)){if(!e.isConnected||n===void 0)return;let r=t.labels(),o=Vv(n)??t.t("providerRemoveDisabled");for(let i of Array.from(n.children)){if(!(i instanceof HTMLElement))continue;let a=Xe(i,r);if(a===void 0)continue;let s=fn(i);if(s===void 0)continue;let d=s.querySelector(bp);if(d===null)continue;let l=d.querySelector(`[${gi}]`);if(d.querySelector(yp)!==null){l!==null&&l.remove();continue}let c=l??Yv();d.lastElementChild!==c&&d.appendChild(c),Jv(c,a,o,t.t("providerRemoveLocked",{provider:rr(i)??a}))}}function wp(){for(let e of Array.from(document.querySelectorAll(`[${gi}]`)))e.remove()}function Vv(e){let n=e.querySelector(`${bp} ${yp}`)?.textContent?.trim()??"";return n.length>0?n:void 0}function Yv(){let e=document.createElement("button");return e.className=$v,e.setAttribute("type","button"),e.setAttribute("disabled",""),e}function Jv(e,t,n,r){e.getAttribute(gi)!==t&&e.setAttribute(gi,t),e.textContent!==n&&(e.textContent=n),e.getAttribute("aria-label")!==r&&e.setAttribute("aria-label",r),e.getAttribute("title")!==r&&e.setAttribute("title",r)}var hi="data-bre-provider-disabled-group",Xv="bre-provider-disabled-seat",xp="bre-provider-disabled-group",_s="bre-row-folded",Ds="bre-row-hidden";function kp(){return{expanded:!1}}function Ep(e,t,n,r=Je(e)){if(!e.isConnected||r===void 0)return;let o=Sp(r,t.labels()),i=o.filter(l=>!l.enabled).length,a=Mp(r);if(i===0){a!==void 0&&a.remove(),Fs(o,n);return}let s=a??Qv(r,t,n);(s.parentElement!==r||r.lastElementChild!==s)&&r.append(s),Fs(o,n);let d=Lp(s);d!==void 0&&Ap(d,i,t,n)}function Tp(){for(let e of Array.from(document.querySelectorAll(`[${hi}]`)))e.remove();for(let e of Array.from(document.querySelectorAll(`.${Ds}, .${_s}`)))e.classList.remove(Ds,_s)}function Sp(e,t){let n=[];for(let r of Array.from(e.children)){if(!(r instanceof HTMLElement)||r.getAttribute(hi)!==null)continue;let o=Xe(r,t);o!==void 0&&n.push({row:r,id:o,enabled:Mn(o)})}return n}function Fs(e,t){for(let n of e){let r=!n.enabled;n.row.classList.toggle(_s,r),n.row.classList.toggle(Ds,r&&!t.expanded)}}function Mp(e){for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.getAttribute(hi)!==null)return t}function Lp(e){return e.querySelector(`button.${xp}`)??void 0}function Qv(e,t,n){let r=document.createElement("li");r.className=Xv,r.setAttribute(hi,"");let o=document.createElement("button");return o.className=xp,o.setAttribute("type","button"),o.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),n.expanded=!n.expanded,Zv(e,t,n)}),r.appendChild(o),e.append(r),r}function Zv(e,t,n){let r=Sp(e,t.labels());Fs(r,n);let o=Mp(e);if(o===void 0)return;let i=r.filter(s=>!s.enabled).length;if(i===0){o.remove();return}let a=Lp(o);a!==void 0&&Ap(a,i,t,n)}function Ap(e,t,n,r){let o=n.t(r.expanded?"providerDisabledGroupHide":"providerDisabledGroupShow",{count:t}),i=n.t("providerDisabledGroupHint"),a=r.expanded?"true":"false";e.textContent!==o&&(e.textContent=o),e.getAttribute("aria-expanded")!==a&&e.setAttribute("aria-expanded",a),e.getAttribute("aria-label")!==o&&e.setAttribute("aria-label",o),e.getAttribute("title")!==i&&e.setAttribute("title",i)}var pn="data-bre-row-model",Ur="bre-model-grid";function Cp(){return Ao()}function qs(e){let t=[];for(let n of Array.from(e.querySelectorAll('[class*="modelList"]')))je(n).filter(o=>o.matches('[class*="modelEntry"]')).length!==0&&t.push(n);return t}function Hp(e){for(let t of e){if(t.type!=="childList")continue;let n=t.target;if(n instanceof HTMLElement&&n.matches('[class*="modelList"]')&&je(n).some(r=>r.matches('[class*="modelEntry"]')))return!0;for(let r of[t.addedNodes,t.removedNodes])for(let o of Array.from(r))if(o instanceof HTMLElement&&o.matches('[class*="modelEntry"]'))return!0}return!1}function bi(e){let t=e.getAttribute(pn);return t===null||t.length===0?void 0:t}function Ks(e,t){let n=e.closest("li");if(n!==null)return Xe(n,t.labels())}function Rp(e,t){let n=$e(e,t.labels().modelName);return n.length>0?n:bi(e)}function ew(e,t){return{rowOf:n=>{let r=n.closest('[class*="modelEntry"]');return r instanceof HTMLElement?r:void 0},idOf:bi,labelOf:n=>Rp(n,t),order:n=>{let r=Ks(e,t);return r===void 0?n:Ad(r,n)},commit:n=>{let r=Ks(n,t);r!==void 0&&Sd(r,Er(n,bi))},seatOf:n=>n.querySelector('[class*="modelRow"]')??void 0,seatDrags:!1,gripLabel:(n,r)=>t.t("modelReorderAria",{model:Rp(n,t)??r}),gripHint:()=>t.t("modelReorderHint"),decorate:(n,r)=>{r.classList.add(Ur)}}}function Np(e,t,n,r=qs(e)){if(!e.isConnected)return;let o=t.labels();for(let i of r){if(i.querySelector('[class*="modelDragHandle"]')!==null){for(let s of Array.from(i.querySelectorAll(`.${Ur}`))){for(let d of Array.from(s.querySelectorAll("[data-bre-drag-handle]")))d.remove();s.classList.remove(Ur)}let a=Array.from(i.querySelectorAll(`[${pn}]`));Tr(a);for(let s of a)s.removeAttribute(pn);continue}if(Ks(i,t)!==void 0){for(let a of je(i)){let s=$e(a,o.modelId);if(s.length===0){a.removeAttribute(pn);continue}bi(a)!==s&&a.setAttribute(pn,s)}Ho(e,i,ew(i,t),n)}}}function Op(e){No(e);for(let n of Array.from(document.querySelectorAll(`.${Ur}`)))n.classList.remove(Ur);let t=Array.from(document.querySelectorAll(`[${pn}]`));Tr(t);for(let n of t)n.removeAttribute(pn)}var Tt=require("react");async function Ip(e){try{let t=await e.json();if(typeof t.error=="string"&&t.error.length>0)return t.error}catch{}return`image request failed (${e.status})`}async function tw(e,t){try{let n=await fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)}),r=await n.json().catch(()=>({}));return n.ok&&r.ok===!0?{ok:!0,data:r}:{ok:!1,error:typeof r.error=="string"?r.error:await Ip(n)}}catch(n){return{ok:!1,error:n instanceof Error?n.message:String(n)}}}var ir,nw=0;var Bs=new Set;function Pp(e){return Bs.add(e),()=>{Bs.delete(e)}}function yi(){return ir}function _p(){jt()}async function jt(){try{let e=await fetch(Pi,{method:"GET"}),t=await e.json();if(e.ok&&t.ok===!0&&typeof t.models<"u"){let n={...t,enabled:t.enabled!==!1};return ir=n,{ok:!0,data:n}}return{ok:!1,error:typeof t.error=="string"?t.error:await Ip(e)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function mn(e){let t=await tw(Pi,{op:"save",...e});if(!t.ok)return t;nw+=1,ir!==void 0&&(ir={...ir,...e,defaults:{...ir.defaults,...e.defaults}});for(let n of Bs)try{n()}catch{}return{ok:!0,data:void 0}}var rw=["\u6A21\u578B","Models","models"],Fp='[class*="rowCard"], [class*="setupCard"], [class*="addCard"]',ow='h1,h2,h3,h4,h5,h6,[role="heading"]',iw=/title|heading/i,aw='nav, button, [role="menu"], [role="menuitem"], [class*="rowName"], [class*="rowCard"]',sw=4;function dw(e,t){let n="";for(let r of e.childNodes)if(r.nodeType===r.TEXT_NODE)n+=r.textContent??"";else if(r.nodeType===r.ELEMENT_NODE){if(r.classList?.contains(jr))continue;return!1}return n.replace(/\s+/g," ").trim()===t}function lw(e,t){for(let n=e;n!==null;n=n.parentElement){if(n.matches(ow)||iw.test(String(n.className??"")))return n;if(n===t)break}return null}function cw(e,t){for(let n of rw)for(let r of e.querySelectorAll("*")){if(!dw(r,n)||r.closest(aw)!==null||(r.compareDocumentPosition(t)&sw)===0)continue;let o=lw(r,e);if(o!==null)return o}return null}var Gs;function Kp(e){let t=Gs;if(t!==void 0&&t.root===e&&t.row.isConnected)return t.row;let n=e.querySelector(Fp);if(n===null)return null;let r=n.ownerDocument?.body??null;for(let o=n.parentElement;o!==null&&o!==r;o=o.parentElement){let i=cw(o,n);if(i!==null){let a=uw(i,o);return a!==null&&(Gs={root:e,row:a}),a}}return null}function uw(e,t){let n=e,r=n.parentElement;for(;r!==null&&r!==t;){let o=Array.from(r.childNodes).filter(a=>a.nodeType===a.TEXT_NODE).map(a=>a.textContent??"").join("").replace(/\s+/g," ").trim();if(Array.from(r.children).filter(a=>!a.classList?.contains(jr)).length>1||o.length>0)return r.querySelector(Fp)!==null?n:r;n=r,r=r.parentElement}return r===t?n:null}var jr="bre-config-host",Us="bre-config-title-line",Ws={display:"flex",alignItems:"center"},vi=new WeakMap;function Dp(e){e.classList.add(Us),vi.has(e)||vi.set(e,{display:e.style.display,alignItems:e.style.alignItems}),e.style.display=Ws.display,e.style.alignItems=Ws.alignItems}function fw(e){return e.classList.contains(Us)&&e.style.display===Ws.display}function qp(e){e.classList.remove(Us);let t=vi.get(e);vi.delete(e),e.style.display=t?.display??"",e.style.alignItems=t?.alignItems??""}function Bp(){return{mounts:new Map}}function Gp(e,t,n){let r=n.mounts.get(e),o=e.querySelector(`:scope > .${jr}`);if(o!==null&&r!==void 0&&r.wrapper===o){fw(e)||Dp(e);return}Wp(e,n),o?.remove(),Dp(e);let i=e.ownerDocument.createElement("div");i.className=jr,e.appendChild(i);let a=pt(i,(0,Tt.createElement)(mw,{t:t.t,onOpen:t.onOpen}),{sync:!0});n.mounts.set(e,a)}function Wp(e,t){qp(e);let n=t.mounts.get(e);n!==void 0&&(t.mounts.delete(e),Ne(n))}function Up(e){for(let t of Array.from(e.mounts.keys()))Wp(t,e);for(let t of Array.from(document.querySelectorAll(`.${jr}`))){let n=t.parentElement;n!==null&&qp(n),t.remove()}Gs=void 0}function pw(){return(0,Tt.createElement)("svg",{className:"bre-config-btn-icon",width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false"},(0,Tt.createElement)("path",{d:"M4 6h8m4 0h4M4 12h2m4 0h10M4 18h10m4 0h2"}),(0,Tt.createElement)("circle",{cx:14,cy:6,r:2}),(0,Tt.createElement)("circle",{cx:8,cy:12,r:2}),(0,Tt.createElement)("circle",{cx:16,cy:18,r:2}))}function mw(e){return(0,Tt.useEffect)(()=>{_p()},[]),(0,Tt.createElement)("button",{className:"bre-config-btn",type:"button",title:e.t("configButtonHint"),"aria-label":e.t("configButton"),onClick:()=>e.onOpen()},pw())}var gw="settings.models",Qe={capacity:["modelAdvanced","Model options","Capacities"],modelId:["modelId","Model ID"],modelName:["modelName","Display name"],routeId:["customRoute","Provider ID"],baseUrl:["baseUrl","Base URL"],apiProtocol:["customApi","API protocol"],apply:["apply","Apply"],cancel:["cancel","Cancel"],editProvider:["editProvider","Edit {provider}"],inputImage:["modelInputImage","Image"],contextWindow:["modelContextWindow","contextWindow","Context window","\u4E0A\u4E0B\u6587\u7A97\u53E3"],maxOutput:["modelMaxOutput","maxOutput","maxTokens","Max output","\u6700\u5927\u8F93\u51FA"],addModel:["addModel","Add model","\u6DFB\u52A0\u6A21\u578B"]};function $p(e){let{ctx:t,api:n,t:r,onIdle:o,refreshed:i}=e,a=()=>{let P=t.locale.bind(gw),z=J=>{let me=[];for(let ve of J){let se=P(ve);se!==ve&&se.trim()!==""&&!me.includes(se)&&me.push(se)}return me.length===0?J:[...me,...J.filter(ve=>!me.includes(ve))]};return{capacity:z(Qe.capacity),modelId:z(Qe.modelId),modelName:z(Qe.modelName),routeId:z(Qe.routeId),baseUrl:z(Qe.baseUrl),apiProtocol:z(Qe.apiProtocol),apply:z(Qe.apply),cancel:z(Qe.cancel),editProvider:z(Qe.editProvider),inputImage:z(Qe.inputImage),contextWindow:z(Qe.contextWindow),maxOutput:z(Qe.maxOutput),addModel:z(Qe.addModel)}},s=120,d=1e3,l=Kc(),c=zf(),p={t:r,labels:a},m=Jf(),u={t:r,labels:a},f=np(),y={t:r,labels:a,repaint:()=>X()},g=gp(),E={labels:a,client:Fe},L={t:r,labels:a},w=kp(),H={t:r,labels:a},D=Cp(),te={t:r,labels:a},U=$u(),v={t:r},b=Bf(),N=Bp(),x=yf(),T=Mf(),O={t:r,api:n,routeIdLabels:()=>a().routeId,staged:x,stagedKeys:T,refreshed:i},K,G,j,h,S=P=>{for(let z of P)for(let J of Array.from(z.addedNodes)){if(!(J instanceof HTMLElement))continue;let me=J.matches('[class*="modelAdvanced"]')?[J]:Array.from(J.querySelectorAll('[class*="modelAdvanced"]'));for(let ve of me)es(ve)}},I=!1,_={api:n,describeNamespace:P=>de(n,P),t:r,labels:a,onIdle:o,onBackoff:P=>{Z(P)},onPendingChanged:()=>{X()},mount(P,z){let J=document.createElement("div");J.className="bre-effort-slot",J.dataset.plugin=ye,P.appendChild(J);let me=(0,zp.createRoot)(J),ve=se=>{me.render((0,js.createElement)(Ue,{fallbackText:r("renderFailed"),children:i(()=>(0,js.createElement)(To,se))}))};return(0,jp.flushSync)(()=>{ve(z)}),{unmount:()=>{try{me.unmount()}finally{J.remove()}},render:ve}}},ee=0;function Z(P){if(I)return;let z=Date.now()+P;G!==void 0&&z>=ee||(G!==void 0&&window.clearTimeout(G),ee=z,G=window.setTimeout(()=>{G=void 0,ee=0,X()},P))}let oe=()=>{let P=ft(),z=Je(P);if(z===void 0){Is(P,y,f,void 0),Ps(P,E,g,void 0);return}if($f(P,p,c,z),Xf(P,u,m,z),Is(P,y,f,z),Ps(P,E,g,z),vp(P,L,z),Ep(P,H,w,z),Np(P,te,D,qs(P)),e.configSeat!==void 0){let J=Kp(P);J!==null&&Gp(J,{t:e.configSeat.t,onOpen:e.configSeat.onOpen},N)}ys(),nf(P)},re=(P,z)=>{try{z()}catch(J){console.error(`[bre] ${P} failed:`,J)}};function X(){I||K!==void 0||(K=window.setTimeout(()=>{K=void 0,re("composer mutation",()=>{h?.()}),re("editor reconcile",()=>{os(ft(),_,l)}),re("add-card reconcile",()=>{Hs(ft(),O,b)}),re("editor tabs reconcile",()=>{ms(ft(),v,U)}),re("dom decorations",()=>{oe()}),kf(x,n).then(P=>{P>0&&Z(d)}),Cf(T,n,Fe).then(P=>{P>0&&Z(d)})},s))}let ue=P=>{let J=P.detail?.route;typeof J!="string"||J.length===0||(op(f,J),X())},ke=P=>{if(I||j!==void 0)return;h=P,re("models page startup",()=>{P(),oe()}),au();let z=(J,me)=>{P(),me&&(re("editor reconcile",()=>{os(ft(),_,l)}),Hs(ft(),O,b),ms(ft(),v,U),oe(),Hp(J)&&uu(ft()))};j=new MutationObserver(J=>{let me=hu(J);re("models mutation",()=>{z(J,me)}),me&&(re("early reasoning hide",()=>{S(J)}),X())}),j.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden"]}),document.addEventListener(gr,ue),X()},Se=()=>{I=!0,K!==void 0&&(window.clearTimeout(K),K=void 0),G!==void 0&&(window.clearTimeout(G),G=void 0),document.removeEventListener(gr,ue),j?.disconnect(),j=void 0};return{state:l,labels:a,start:ke,stopObserver:Se,teardown:()=>{if(!l.disposed){Se(),l.disposed=!0,Zc(),Dc(l,_);for(let[P,z]of l.mounted)Ar(P),z.editor.unmount();l.mounted.clear(),Vf(c),Qf(),ip(),wp(),Tp(),Al(),Up(N),rf(),ff(),Op(D),Uf(b),Xu(),Lc(),cu()}},flushOnUnload:()=>{Fc(l,_)},schedule:X}}var hw=1500,bw=2,yw=8,vw=6e4;function Vp(e,t={}){let n=t.delayMs??hw,r=Math.max(1,t.concurrency??bw),o=Math.max(1,t.limit??yw),i=t.minAgeMs??vw,s=(t.now??Date.now)(),d=ic().filter(u=>s-u.savedAt>=i).slice(0,o).map(u=>u.route),l=!1,c=0,p=()=>{for(;!l&&c<r;){let u=d.shift();if(u===void 0)return;c+=1,Promise.resolve().then(()=>e.list(u,{preferCache:!0})).catch(()=>{}).finally(()=>{c-=1,p()})}},m=setTimeout(()=>{l||p()},n);return()=>{l=!0,clearTimeout(m)}}var Jp=e=>`?route=${encodeURIComponent(e)}`;async function Xp(e){try{let t=await e.json();if(typeof t.error=="string"&&t.error.length>0)return t.error}catch{}return`fingerprint request failed (${e.status})`}async function zs(e){try{let t=await fetch(`${Ni}${Jp(e)}`,{method:"GET"}),n=await t.json();if(t.ok&&n.ok===!0){let r=n.data;return{ok:!0,data:{bank:r?.bank??{},records:Array.isArray(r?.records)?r.records:[]}}}return{ok:!1,error:typeof n.error=="string"?n.error:await Xp(t)}}catch(t){return{ok:!1,error:t instanceof Error?t.message:String(t)}}}function Qp(e,t,n){let r=new AbortController,o=!1;return{done:(async()=>{let a;try{let s=await fetch(`${Ni}${Jp(e)}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({model:t}),signal:r.signal});if(!s.ok)return{ok:!1,error:await Xp(s)};let d=s.body?.getReader();if(d===void 0)return{ok:!1,error:"the fingerprint route sent no body"};let l=new TextDecoder,c="";for(;;){let{done:m,value:u}=await d.read();if(m)break;c+=l.decode(u,{stream:!0});let f=c.indexOf(`
|
|
4881
|
+
`);for(;f>=0;){let y=c.slice(0,f).trim();if(c=c.slice(f+1),y.length>0){let g=Yp(y);g!==void 0&&(n(g),g.type==="result"?a={ok:!0,record:g.record}:g.type==="error"&&(a={ok:!1,error:g.error}))}f=c.indexOf(`
|
|
4882
|
+
`)}}let p=c.trim();if(p.length>0){let m=Yp(p);m!==void 0&&(n(m),m.type==="result"?a={ok:!0,record:m.record}:m.type==="error"&&(a={ok:!1,error:m.error}))}}catch(s){return o?{ok:!1,error:"cancelled"}:{ok:!1,error:s instanceof Error?s.message:String(s)}}return a!==void 0?a:o?{ok:!1,error:"cancelled"}:{ok:!1,error:"the fingerprint route ended without a verdict"}})(),abort:()=>{o=!0,r.abort()}}}function Yp(e){let t;try{t=JSON.parse(e)}catch{return}if(typeof t!="object"||t===null)return;let n=t,r=n.type;if(r==="progress")return{type:"progress",index:Number(n.index??0),ok:n.ok===!0,...typeof n.error=="string"?{error:n.error}:{}};if(r==="result"){let o=n.record;return typeof o!="object"||o===null?void 0:{type:"result",record:o}}if(r==="error")return{type:"error",error:typeof n.error=="string"?n.error:"fingerprint route failed"}}var ww=3,xw=2,kw=15e3,Ew=/\b429\b|rate.?limit|too many requests/i,$s=new Map;function Tw(e){return $s.get(e)??{run:(t,n,r)=>Qp(t,n,r)}}var Vs=class{constructor(t,n=xw,r=kw){Pe(this,"route",t);Pe(this,"concurrency",n);Pe(this,"backoffMs",r);Pe(this,"listeners",new Set);Pe(this,"recordListeners",new Set);Pe(this,"failureListeners",new Set);Pe(this,"state",{running:new Map,queued:[]});Pe(this,"handles",new Set);Pe(this,"draining",!1);Pe(this,"disposed",!1);Pe(this,"throttled",!1);Pe(this,"backoffUntil",0)}getState(){return this.state}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onRecord(t){return this.recordListeners.add(t),()=>{this.recordListeners.delete(t)}}onFailure(t){return this.failureListeners.add(t),()=>{this.failureListeners.delete(t)}}idle(){return this.state.running.size===0&&this.state.queued.length===0}check(t){this.checkAll([t])}checkAll(t){if(this.disposed)return;let n=[...this.state.queued];for(let r of t)n.includes(r)||this.state.running.has(r)||n.push(r);n.length!==this.state.queued.length&&(this.publish({...this.state,queued:n}),this.drain())}abort(){this.publish({running:new Map,queued:[]});for(let t of[...this.handles])t.abort();this.handles.clear(),this.throttled=!1,this.backoffUntil=0}dispose(){this.disposed||(this.disposed=!0,this.abort(),this.listeners.clear(),this.recordListeners.clear(),this.failureListeners.clear(),wi.delete(this.route),$s.delete(this.route))}setSender(t){$s.set(this.route,t)}publish(t){this.state=t;for(let n of[...this.listeners])n()}limit(){return this.throttled?1:Math.max(1,this.concurrency)}async drain(){if(this.draining||this.disposed)return;this.draining=!0;let t=new Set;try{for(;!this.disposed;){for(;!this.disposed&&t.size<this.limit()&&this.state.queued.length>0&&Date.now()>=this.backoffUntil;){let r=this.state.queued[0];if(r===void 0)break;this.publish({running:new Map(this.state.running).set(r,0),queued:this.state.queued.slice(1)});let o=this.runOne(r).finally(()=>{t.delete(o)});t.add(o)}if(this.disposed||t.size===0||(await Promise.race(t),this.disposed))break;let n=this.backoffUntil-Date.now();n>0&&await new Promise(r=>setTimeout(r,n))}}finally{t.clear(),this.throttled=!1,this.backoffUntil=0,this.draining=!1}}async runOne(t){let n=Tw(this.route),r=0,o=n.run(this.route,t,i=>{i.type==="progress"&&(r+=1,this.publish({running:new Map(this.state.running).set(t,Math.min(r,ww)),queued:this.state.queued}))});this.handles.add(o);try{let i=await o.done;if(this.disposed)return;if(i.ok)for(let a of[...this.recordListeners])a(i.record);else{Ew.test(i.error)&&(this.throttled=!0,this.backoffUntil=Date.now()+this.backoffMs);for(let a of[...this.failureListeners])a(t,i.error)}}finally{if(this.handles.delete(o),this.state.running.has(t)){let i=new Map(this.state.running);i.delete(t),this.publish({running:i,queued:this.state.queued})}}}},wi=new Map;function Zp(e,t){let n=wi.get(e);return n===void 0&&(n=new Vs(e,t?.concurrency,t?.backoffMs),wi.set(e,n)),n}function em(){for(let e of[...wi.values()])e.dispose()}function xi(e,t){let n=e?.list?.getSnapshot(),r=n?.current;if(typeof r=="string"&&r.length>0)return r;let o=t?.adapter?.current?.getSnapshot?.()?.key;if(typeof o=="string"&&o.length>0)return o;for(let[i,a]of Object.entries(n?.byId??{}))if(!(a===void 0||(a.retainedBy?.mainView??0)<=0))return typeof a.id=="string"&&a.id.length>0?a.id:i}function tm(e){let t,n=new Map,r=(a,s)=>{for(let[d,l]of n){if(d===s)continue;let c;try{c=a.directoryFor(l.sessionId)===d}catch{c=!1}c||(l.restore(),n.delete(d))}};return{ensure:()=>{let a=e.ctx,s=a.get?.("sessions"),d=a.get?.("uiSession"),l=a.get?.("modelDirectories"),c=xi(s,d);if(!(c===void 0||l===void 0))try{let p=l.directoryFor(c);return r(l,p),t!==void 0&&t.sessionId===c&&t.directory===p||(n.has(p)||n.set(p,{sessionId:c,restore:Xd(p,{configuredEffort:e.configuredEffort})}),t={sessionId:c,directory:p}),p}catch{t=void 0;return}},dispose:()=>{for(let[,a]of n)a.restore();n.clear()}}}var Ti="dsh-model-think-level.auto-continue.enabled",Si="dsh-model-think-level.auto-continue.config";var Ys=Object.freeze({waitSeconds:2,maxRetries:5}),Sw="dsh-model-think-level.auto-continue.claim.",Mw=10*6e4;function rm(e){try{return window.localStorage.getItem(e)}catch{return null}}function nm(e,t,n,r){return typeof e!="number"||!Number.isFinite(e)?t:Math.min(r,Math.max(n,Math.trunc(e)))}function Js(e){let t=e!==null&&typeof e=="object"?e:{};return Object.freeze({waitSeconds:nm(t.waitSeconds,Ys.waitSeconds,1,3600),maxRetries:nm(t.maxRetries,Ys.maxRetries,1,100)})}function Mi(e){try{return Js(e===null?void 0:JSON.parse(e))}catch{return Ys}}var zr=rm(Ti)==="true",zt=Mi(rm(Si)),ki=new Set,Ei=new Set;function Li(e){for(let t of[...e])t()}function gn(){return zr}function Ht(){return zt}function om(e){if(zr!==e){zr=e;try{window.localStorage.setItem(Ti,String(e))}catch{}Li(ki)}}function Xs(e){let t=Js({...zt,...e});if(!(zt.waitSeconds===t.waitSeconds&&zt.maxRetries===t.maxRetries)){zt=t;try{window.localStorage.setItem(Si,JSON.stringify(t))}catch{}Li(Ei)}}function Qs(e){zr!==e&&(zr=e,Li(ki))}function Zs(e){let t=Js(e);zt.waitSeconds===t.waitSeconds&&zt.maxRetries===t.maxRetries||(zt=t,Li(Ei))}function Ai(e){return ki.add(e),()=>{ki.delete(e)}}function Ri(e){return Ei.add(e),()=>{Ei.delete(e)}}function im(e,t){let n=`${Sw}${e}.${t}`;try{let r=window.localStorage.getItem(n);if(r!==null){let o=JSON.parse(r);if(typeof o=="number"&&Number.isFinite(o)&&Date.now()-o<Mw)return!1}return window.localStorage.setItem(n,JSON.stringify(Date.now())),!0}catch{return!0}}var Lw=new Set(["EMPTY_RESPONSE","RATE_LIMIT","SERVER","TIMEOUT","TRANSPORT"]);function Aw(e){return e===408||e===425||e===429||e>=500&&e<=599}var Rw=new Set(["user/message","developer/message","system/message","request/header","request/context","step/start","assistant/message","assistant/attempt","tool/call","tool/result"]);function Cw(e){let t=!1;for(let n of e.turnEvents)if(n.type!=="turn/end"){if(n.type==="turn/start"){t=!0;continue}if(Rw.has(n.type))return!0}return t?!1:"unknown"}function Hw(e){let t=e.data;if(typeof t!="object"||t===null)return;let n=t.reason;if(typeof n!="object"||n===null)return typeof n=="string"?n:void 0;let r=n.kind;return typeof r=="string"?r:void 0}function Nw(e){let t=e.data;if(typeof t!="object"||t===null)return;let n=t.reason;if(typeof n!="object"||n===null)return;let r=n.error;if(!(typeof r!="object"||r===null))return r}function Ow(e){let t=e?.providerRetryAfterMs;return typeof t=="number"&&Number.isFinite(t)&&t>0?t:void 0}function am(e){let t=Hw(e.turnEnd);if(Cw(e)===!1)return{kind:"refuse",detail:`${t??"unreadable reason"}: empty turn`};switch(t){case"max-tokens":return{kind:"continue",reason:"max-tokens",detail:"max-tokens"};case"error":{let n=Nw(e.turnEnd),r=typeof n?.code=="string"?n.code:void 0,o=typeof n?.status=="number"?n.status:void 0;if(r!==void 0&&Lw.has(r)){let i=Ow(n);return{kind:"continue",reason:"transient-error",detail:r,...i!==void 0?{waitMs:i}:{}}}return o!==void 0&&Aw(o)?{kind:"continue",reason:"transient-error",detail:`status ${o}`}:{kind:"refuse",detail:r??(o!==void 0?`status ${o}`:"unknown error")}}case"completed":return{kind:"settled",detail:"completed"};case"aborted":return{kind:"settled",detail:"aborted"};case"blocked":return{kind:"settled",detail:"blocked"};case"forked":case"orphaned":return{kind:"refuse",detail:t};default:return{kind:"refuse",detail:t===void 0?"unreadable reason":`unknown reason ${t}`}}}var Iw=1e3,Pw=500,_w=600,sm=6e3,Dw=12e4,Fw=3e4;function dm(e){let{ctx:t,t:n}=e,r,o=!1,i=new Set,a=(h,S)=>{let I=setTimeout(()=>{i.delete(I),h()},S);i.add(I)},s=h=>{let S=[];try{S=h.eventSource.getSnapshot().entries??[]}catch{return[]}let I=[];for(let _ of S)_.type!=="event"||_.event===void 0||I.push(_.event);return I},d=h=>{let S=s(h),I=h.lastUserSeq;for(let _ of S){if(_.type!=="user/message"||_.seq<=I)continue;h.lastUserSeq=Math.max(h.lastUserSeq,_.seq);let ee=l(h,_);h.lastAutoSentText=void 0,!ee&&(h.consecutive=0,m(h))}},l=(h,S)=>{if(h.lastAutoSentText===void 0)return!1;let I=S.data;if(typeof I!="object"||I===null)return!1;let _=I.content??I.message?.content;if(!Array.isArray(_)||_.map(oe=>typeof oe=="object"&&oe!==null&&oe.type==="text"?oe.text:void 0).filter(oe=>typeof oe=="string").join("")!==h.lastAutoSentText)return!1;let Z=typeof S.time=="number"?S.time:h.lastAutoSentAt;return Math.abs(Z-h.lastAutoSentAt)<=Fw},c=(h,S)=>{let I=-1;for(let _=S-1;_>=0;_-=1)if(h[_].type==="turn/end"){I=_;break}return h.slice(I+1,S+1)},p=h=>{let S=Ht().waitSeconds*1e3;return h===void 0?S:Math.max(S,Math.min(h,Dw))},m=h=>{h.sendTimer!==void 0&&(clearTimeout(h.sendTimer),i.delete(h.sendTimer),h.sendTimer=void 0),h.pendingSendTurnEndSeq=void 0},u=h=>{h.sendTimer!==void 0&&(clearTimeout(h.sendTimer),i.delete(h.sendTimer));let S=Math.max(0,p(h.pendingRetryAfterMs)-(Date.now()-h.pendingSendScheduledAt)),I=setTimeout(()=>{i.delete(I),h.sendTimer=void 0,D(h,n("autoContinueMessage"))},S);h.sendTimer=I,i.add(I)},f=h=>{try{let S=h.getSnapshot();return{running:S.running===!0,open:S.openState===void 0||S.openState==="open",pending:S.pendingSubmissions?.length??0,subagent:S.subagent!=null}}catch{return}},y=h=>{let S=t.get?.("sessions"),I=t.get?.("uiSession");return xi(S,I)===h.sessionId},g=h=>{if(h.evalTimer!==void 0){h.evalDeadline=Date.now()+sm;return}h.evalDeadline=Date.now()+sm,E(h,Pw)},E=(h,S)=>{o||r!==h||(h.evalTimer=setTimeout(()=>{h.evalTimer=void 0,H(h)},S),i.add(h.evalTimer))},L=h=>{if(h.historyReady)return;let S=f(h.session);S===void 0||!S.open||(h.historyReady=!0,h.lastHandledTurnEndSeq=Math.max(h.lastHandledTurnEndSeq,x(h.eventSource,"turn/end")))},w=h=>{if(!h.historyReady)return;let S=f(h.session);if(S===void 0||S.running)return;let I=s(h);for(let _=I.length-1;_>=0;_-=1){let ee=I[_];if(ee.type==="turn/end"){ee.seq>h.lastHandledTurnEndSeq&&g(h);return}}},H=h=>{if(o||r!==h||!gn())return;let S=f(h.session);if(!h.historyReady||S===void 0||!S.open||S.subagent||S.running||S.pending>0)return;let I=s(h),_=-1;for(let re=I.length-1;re>=0;re-=1){let X=I[re];if(X.type==="turn/end"&&X.seq>h.lastHandledTurnEndSeq){_=re;break}}if(_<0){Date.now()<h.evalDeadline&&E(h,_w);return}let ee=I[_];if(h.lastHandledTurnEndSeq=ee.seq,d(h),I.some(re=>re.seq>ee.seq&&(re.type==="user/message"||re.type==="turn/start")))return;let Z=am({turnEnd:ee,turnEvents:c(I,_)});if(Z.kind==="settled"){h.consecutive=0;return}if(Z.kind==="refuse")return;let oe=Ht().maxRetries;if(h.consecutive>=oe){console.info(`[dsh-model-think-level] auto-continue: streak cap (${oe}) reached, standing down (${Z.detail})`);return}im(h.sessionId,ee.seq)&&(h.pendingSendTurnEndSeq=ee.seq,h.pendingSendScheduledAt=Date.now(),h.pendingRetryAfterMs=Z.waitMs,u(h))},D=async(h,S)=>{if(o||r!==h)return;d(h);let I=h.pendingSendTurnEndSeq;if(h.pendingSendTurnEndSeq=void 0,I===void 0||I!==h.lastHandledTurnEndSeq||!gn()||h.consecutive>=Ht().maxRetries)return;let _=f(h.session);if(!(_===void 0||!_.open||_.subagent||_.running||_.pending>0||!y(h)||s(h).some(Z=>Z.seq>I&&(Z.type==="user/message"||Z.type==="turn/start"||Z.type==="turn/end")))){h.lastAutoSentAt=Date.now(),h.lastAutoSentText=S;try{let Z=await h.session.prompt([{type:"text",text:S}],"queue");if(Z?.ok!==!0){h.consecutive+=1,h.lastAutoSentText=void 0,console.warn(`[dsh-model-think-level] auto-continue: prompt refused ${te(Z)}`);return}h.consecutive+=1}catch(Z){h.consecutive+=1,h.lastAutoSentText=void 0,console.warn("[dsh-model-think-level] auto-continue: prompt failed:",Z)}}},te=h=>{let S=h?.error;if(S===void 0)return"without an error";let I=typeof S.code=="string"?S.code:"unknown",_=typeof S.message=="string"?S.message:"";return _.length>0?`${I}: ${_}`:I},U=h=>{let S=f(h.session);S!==void 0&&(L(h),(!S.open||S.subagent||S.running||S.pending>0)&&m(h),S.pending>0&&(h.lastHandledTurnEndSeq=Math.max(h.lastHandledTurnEndSeq,x(h.eventSource,"turn/end")),h.evalTimer!==void 0&&(clearTimeout(h.evalTimer),i.delete(h.evalTimer),h.evalTimer=void 0),h.evalDeadline=0),h.wasRunning&&!S.running&&g(h),h.wasRunning=S.running)},v=()=>{let h=r;if(h!==void 0){r=void 0;for(let S of h.unsubs)try{S()}catch{}h.evalTimer!==void 0&&(clearTimeout(h.evalTimer),i.delete(h.evalTimer),h.evalTimer=void 0),h.sendTimer!==void 0&&(clearTimeout(h.sendTimer),i.delete(h.sendTimer),h.sendTimer=void 0)}},b=h=>{let S=f(h.session);if(S===void 0||S.subagent)return;let I={sessionId:h.sessionId,session:h.session,eventSource:h.eventSource,wasRunning:N(h.session),lastUserSeq:x(h.eventSource,"user/message"),historyReady:S.open,lastHandledTurnEndSeq:S.open?x(h.eventSource,"turn/end"):0,consecutive:0,pendingSendTurnEndSeq:void 0,pendingSendScheduledAt:0,pendingRetryAfterMs:void 0,lastAutoSentAt:0,lastAutoSentText:void 0,unsubs:[],evalDeadline:0,evalTimer:void 0,sendTimer:void 0};r=I;try{I.unsubs.push(h.session.subscribe(()=>U(I)))}catch{v();return}try{I.unsubs.push(h.eventSource.subscribe(()=>{d(I),L(I),w(I)}))}catch(_){v(),console.warn("[dsh-model-think-level] auto-continue: event source unusable:",_);return}},N=h=>{try{return h.getSnapshot().running===!0}catch{return!1}},x=(h,S)=>{let I=0,_=[];try{_=h.getSnapshot().entries??[]}catch{return 0}for(let ee of _)ee.type!=="event"||ee.event===void 0||ee.event.type===S&&ee.event.seq>I&&(I=ee.event.seq);return I},T=()=>{if(o)return;let h=t.get?.("sessions"),S=t.get?.("uiSession"),I=xi(h,S);if(I===void 0||h===void 0||typeof h.binding!="function"){v();return}let _;try{_=h.binding(I)}catch{_=void 0}if(_===void 0||_.session===void 0){v();return}r!==void 0&&r.session===_.session||(v(),b(_))},O=setInterval(T,Iw);T();let K;try{K=t.on?.("connection/reset",()=>{v()})}catch{}let G=Ai(()=>{let h=r;gn()||h===void 0||(m(h),h.evalTimer!==void 0&&(clearTimeout(h.evalTimer),i.delete(h.evalTimer),h.evalTimer=void 0))}),j=Ri(()=>{let h=r;h?.pendingSendTurnEndSeq!==void 0&&(!gn()||h.consecutive>=Ht().maxRetries?m(h):u(h))});return{dispose:()=>{o=!0,G(),j(),K?.(),clearInterval(O),v();for(let h of i)clearTimeout(h);i.clear()}}}var gt=require("react");var ed=require("react/jsx-runtime");function lm({route:e,api:t,t:n,onDismiss:r}){let o=ws(e,n);return(0,ed.jsx)(si,{route:e,api:t,t:n,onDismiss:r,extras:(0,ed.jsx)(vs,{t:n,value:o.value,installed:o.installed,disabled:o.loading,onChange:o.setValue}),onCommitExtras:o.commit,onResetExtras:o.reset})}var W=require("react");function cm(e){let t=[];for(let i of e){let a=i.timing?.durationMs;typeof a=="number"&&Number.isFinite(a)&&a>0&&t.push(a)}if(t.length===0)return;t.sort((i,a)=>i-a);let n=t.length>>1,o=(t.length%2===1?t[n]:(t[n-1]+t[n])/2)/1e3;return o>=75?{unit:"minutes",value:Math.max(1,Math.round(o/60))}:{unit:"seconds",value:Math.max(5,Math.round(o/5)*5)}}var Kw=/^(gpt-|chatgpt-|o[134](-|$)|claude-)/;function qw(e){let t=String(e??"").trim(),n=t.lastIndexOf("/");return n===-1?t:t.slice(n+1)}function um(e){let t=qw(e).toLowerCase();return t.length>0&&Kw.test(t)}var fm={running:new Map,queued:[]};function Vr(e){return typeof e!="number"||!Number.isFinite(e)?"\u2014":`${Math.round(e*100)}%`}function Bw(e){return!Number.isFinite(e)||e<=0?"\u2014":new Date(e).toLocaleString()}function pm(e){return typeof e!="number"||!Number.isFinite(e)||e<0?"\u2014":(Math.round(e/100)/10).toFixed(1)}function Gw(e,t){return t===void 0?e("fpCostUnknown",{count:3}):t.unit==="minutes"?e("fpCostMinutes",{count:3,minutes:t.value}):e("fpCost",{count:3,seconds:t.value})}function mm({route:e,api:t,t:n,ctx:r,host:o}){let[i]=(0,W.useState)(()=>Vu(o.current)),[a,s]=(0,W.useState)([]),[d,l]=(0,W.useState)(new Map),[c,p]=(0,W.useState)(void 0),[m,u]=(0,W.useState)(void 0),[f,y]=(0,W.useState)(new Set),g=(0,W.useCallback)(T=>{y(O=>{let K=new Set(O);return K.has(T)?K.delete(T):K.add(T),K})},[]),E=(0,W.useMemo)(()=>i?void 0:Zp(e),[i,e]),L=(0,W.useSyncExternalStore)((0,W.useCallback)(T=>E?.subscribe(T)??(()=>{}),[E]),(0,W.useCallback)(()=>E?.getState()??fm,[E]),(0,W.useCallback)(()=>fm,[]));(0,W.useEffect)(()=>{if(E!==void 0)return E.onRecord(T=>{u(void 0),l(O=>{let K=new Map(O);return K.set(T.model,T),K})})},[E]),(0,W.useEffect)(()=>{if(E!==void 0)return E.onFailure((T,O)=>{u({model:T,error:O})})},[E]);let w=(0,W.useCallback)(async()=>{if(i)return;let O=(await de(t)).namespace?.value?.providers,K=Cn(O,e).map(j=>j.id).filter(j=>typeof j=="string"&&j.length>0).filter(um);s(K.map(j=>({model:j})));let G=await zs(e);G.ok?(p(void 0),l(new Map(G.data.records.map(j=>[j.model,j])))):p(G.error)},[t,i,e]);if((0,W.useEffect)(()=>{i||w()},[i,w]),(0,W.useEffect)(()=>{if(!(i||r===void 0))return r.remote.$on("settings/document-updated",()=>{w()})},[i,r,w]),i)return null;let H=a.length,D=a.filter(T=>d.has(T.model)).length,te=a.filter(T=>d.get(T.model)?.status==="identified").length,U=a.filter(T=>d.get(T.model)?.status==="doubtful").length,v=a.filter(T=>d.get(T.model)?.status==="failed").length,b=L.running.size>0,N=L.running.size+L.queued.length,x=(0,W.useMemo)(()=>cm([...d.values()]),[d]);return(0,W.createElement)("div",{className:"bre-fingerprint","data-bre-fingerprint":H>0?"ready":"none"},(0,W.createElement)("div",{className:"bre-fp-head"},(0,W.createElement)("span",{className:"bre-fp-title"},n("fpTitle")),(0,W.createElement)("span",{className:"bre-fp-count"},n("fpCount",{count:H})),(0,W.createElement)("span",{className:"bre-fp-summary",role:"status","aria-live":"polite"},b?n("fpRunning",{done:L.running.size,total:N}):D===0?n("fpSummaryNone"):n("fpSummary",{identified:te,doubtful:U,failed:v})),(0,W.createElement)("span",{className:"grow"}),(0,W.createElement)("button",{type:"button",className:"bre-fp-all",disabled:b||H===0,onClick:()=>{E?.checkAll(a.map(T=>T.model))}},n("fpDetectAll"))),(0,W.createElement)("p",{className:"bre-fp-intro"},n("fpIntro")),c!==void 0?(0,W.createElement)("p",{className:"bre-fp-error"},n("fpLoadFailed",{error:c})):null,m!==void 0?(0,W.createElement)("p",{className:"bre-fp-error",role:"alert"},n("fpRunFailed",{error:`${m.model}: ${m.error}`})):null,(0,W.createElement)("div",{className:"bre-fp-rows"},...a.map(T=>Uw(T,{t:n,runner:E,runnerState:L,records:d,route:e,expanded:f,estimate:x,onToggle:g}))))}function Ww(e){return(0,W.createElement)("svg",{className:"bre-fp-chev"+(e?" is-open":""),viewBox:"0 0 16 16",width:12,height:12,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,focusable:!1},(0,W.createElement)("path",{d:e?"M4.5 6.5 8 10 11.5 6.5":"M6.5 4.5 10 8 6.5 11.5"}))}function Uw(e,t){let{t:n,runner:r,runnerState:o,records:i,expanded:a,estimate:s,onToggle:d}=t,l=i.get(e.model),c=o.running.get(e.model),p=o.queued.indexOf(e.model),m=c!==void 0,u=p>=0,f=a.has(e.model),y=m?{className:"is-running",text:n("fpStateRunning",{done:c,total:3})}:u?{className:"is-queued",text:n("fpQueued",{position:p+1})}:l===void 0?{className:"is-idle",text:n("fpStateUnchecked")}:l.status==="failed"?{className:"is-failed",text:n("fpStateFailed")}:l.status==="doubtful"?{className:"is-doubtful",text:n("fpStateDoubtful",{probability:Vr(l.probability)})}:{className:"is-identified",text:n("fpStateIdentified",{model:l.predictionName??l.prediction??e.model,probability:Vr(l.probability)})},g=l===void 0?"fpDetect":l.status==="failed"?"fpRetry":"fpRetest";return(0,W.createElement)("div",{className:"bre-fp-row",key:e.model,"data-bre-fp-open":f?"1":void 0},(0,W.createElement)("div",{className:"bre-fp-row-head"},(0,W.createElement)("button",{type:"button",className:"bre-fp-fold","aria-expanded":f,"aria-label":n(f?"fpDetailHide":"fpDetailShow")+" "+e.model,title:n(f?"fpDetailHide":"fpDetailShow"),onClick:()=>{d(e.model)}},Ww(f),(0,W.createElement)("span",{className:"bre-fp-model"},e.model)),(0,W.createElement)("span",{className:`bre-fp-badge ${y.className}`},y.text),(0,W.createElement)("span",{className:"grow"}),(0,W.createElement)("span",{className:"bre-fp-evidence"},l===void 0?Gw(n,s):n("fpEvidence",{used:l.usedOutputs,total:3})),(0,W.createElement)("button",{type:"button",className:"bre-fp-action",disabled:m||u,onClick:()=>{r?.check(e.model)}},n(g))),!f||l===void 0?null:l.status!=="failed"?zw(l,n):jw(l,n))}function gm(e,t){return e===void 0||e.length===0?null:(0,W.createElement)("div",{className:"bre-fp-chals",title:t("fpChallengeTitle")},...e.map(n=>{let r=n.skipped===!0?" is-skipped":n.accepted?" is-counted":" is-rejected",o=n.skipped===!0?t("fpChallengeSkipped",{index:n.index,numbers:n.expected}):n.accepted?t("fpChallengeCounted",{index:n.index,numbers:n.expected}):t("fpChallengeRejected",{index:n.index,parsed:n.parsed,numbers:n.expected});return(0,W.createElement)("span",{className:`bre-fp-chal${r}`,key:n.index},o)}))}function jw(e,t){let n=e.challenges,r=n!==void 0&&n.length>0;return e.error===void 0&&!r?null:(0,W.createElement)("div",{className:"bre-fp-body"},e.error===void 0?null:(0,W.createElement)("p",{className:"bre-fp-error"},e.error),gm(n,t))}function zw(e,t){let n=e.top??[],r=e.timing;return(0,W.createElement)("div",{className:"bre-fp-body"},(0,W.createElement)("div",{className:"bre-fp-family"},(0,W.createElement)("span",{className:"bre-fp-k"},t("fpFamily")),(0,W.createElement)("span",{className:"bre-fp-v"},`${e.familyPrediction??"\u2014"} \xB7 ${Vr(e.familyProbability)}`),(0,W.createElement)("span",{className:"bre-fp-k"},t("fpSimilarity")),(0,W.createElement)("span",{className:"bre-fp-v"},Vr(e.top?.[0]?.similarity)),(0,W.createElement)("span",{className:"grow"}),(0,W.createElement)("span",{className:"bre-fp-k"},t("fpCheckedAt",{time:Bw(e.checkedAt)}))),gm(e.challenges,t),r!==void 0?(0,W.createElement)("p",{className:"bre-fp-timing"},t("fpTiming",{first:pm(r.firstTokenMs),total:pm(r.durationMs),rate:r.charsPerSecond===void 0?"\u2014":String(Math.round(r.charsPerSecond))})):null,(0,W.createElement)("div",{className:"bre-fp-k",style:{marginTop:"8px"}},t("fpCandidates")),(0,W.createElement)("div",{className:"bre-fp-bars"},...n.map((o,i)=>(0,W.createElement)("div",{className:"bre-fp-bar",key:o.model},(0,W.createElement)("span",{className:"bre-fp-bar-name"},o.model),(0,W.createElement)("span",{className:`bre-fp-bar-fill${i===0?" is-top":""}`,style:{width:`${Math.max(2,Math.round(o.probability*100))}%`}}),(0,W.createElement)("span",{className:"bre-fp-bar-value"},Vr(o.probability))))),(0,W.createElement)("p",{className:"bre-fp-note"},t("fpClosedSet")))}var hm="settings.models.provider-card";function $w(e){if(e===null)return;let t=e.querySelector('[class*="editorActions"]');if(t===null)return;let n=Array.from(t.querySelectorAll("button")),r=t.querySelector('button[class*="secondaryButton"]')??n.at(-2)??null;r!==null&&(r instanceof HTMLButtonElement&&r.disabled||r.click())}function Vw({provider:e,api:t,t:n,ctx:r}){let o=(0,gt.useRef)(null),i=e?.provider,a=(0,gt.useCallback)(()=>{$w(Xn(o.current))},[]);return(0,gt.useLayoutEffect)(()=>{let s=o.current,d=Xn(s);if(s===null||d===null)return;let l=d,c=()=>d.querySelector('[class*="_editor"]')!==null,p=()=>{let u=c()?"1":"0";s.dataset.edit!==u&&(s.dataset.edit=u)};p();let m=new MutationObserver(p);return m.observe(l,{childList:!0,subtree:!0}),()=>{m.disconnect()}},[i]),typeof i!="string"||i.length===0?null:(0,gt.createElement)("div",{ref:o,className:"bre-headers-host","data-bre-provider":i},(0,gt.createElement)(di,{host:o,t:n}),(0,gt.createElement)(lm,{route:i,api:t,t:n,onDismiss:a}),(0,gt.createElement)(mm,{route:i,api:t,t:n,ctx:r,host:o}))}function bm(e,t,n){let r=e,o=r.slots?.inject(hm,()=>{r.slots?.register({name:hm,key:Ce,inject:()=>({api:t,t:n,ctx:e})},Vw)});return typeof o=="function"?o:()=>{}}var at=require("react");function ym(e){let{t}=e,n=(0,at.useSyncExternalStore)(no,lt),r=()=>{fd(!n)};return(0,at.createElement)("div",{className:"bre-slider-setting"},(0,at.createElement)("div",{className:"bre-slider-setting-row"},(0,at.createElement)("div",{className:"bre-slider-setting-copy"},(0,at.createElement)("div",{className:"bre-slider-setting-title"},t("sliderToggleTitle")),(0,at.createElement)("div",{className:"bre-slider-setting-description"},t("sliderToggleDescription"))),(0,at.createElement)("div",{className:"bre-slider-setting-control"},(0,at.createElement)("span",{className:"bre-slider-setting-state"},t(n?"settingOn":"settingOff")),(0,at.createElement)("button",{type:"button",role:"switch","aria-label":t("sliderToggleAria"),"aria-checked":n,className:"bre-slider-setting-switch"+(n?" is-on":""),onClick:r},(0,at.createElement)("span",{className:"bre-slider-setting-switch-knob","aria-hidden":!0})))))}function vm(e,t){let n=e,r=n.slots?.inject("settings.models.footer",()=>{n.slots?.register({name:"settings.models.footer",id:ye+"-slider-toggle",order:15,inject:()=>({t})},ym)});return typeof r=="function"?r:()=>{}}var R=require("react"),Sm=require("react-dom/client");var Ci=[{label:"1K",value:"1024x1024",edge:1024},{label:"2K",value:"2048x2048",edge:2048},{label:"4K",value:"4096x4096",edge:4096}];function Yw(e){let t=/^(\d{2,5})x(\d{2,5})$/.exec(e.trim());if(t!==null)return Math.max(Number(t[1]),Number(t[2]))}function Jw(e){let t=Yw(e),n=Ci[0];if(t===void 0)return n;let r=Number.POSITIVE_INFINITY;for(let o of Ci){let i=Math.abs(o.edge-t);i<r&&(n=o,r=i)}return n}function wm(e){return Jw(e).value}var Xw=[5,10,15,30,60];function Qw(e){let t=Xw.map(n=>n*6e4);return t.includes(e)?t:[e,...t]}function Zw(e){let{api:t,t:n}=e,[r,o]=(0,R.useState)(()=>yi()),[i,a]=(0,R.useState)(void 0),[s,d]=(0,R.useState)(void 0),[l,c]=(0,R.useState)(void 0),[p,m]=(0,R.useState)(!1);(0,R.useEffect)(()=>{let b=!0;return jt().then(N=>{b&&(N.ok?o(N.data):a(N.error))}),()=>{b=!1}},[]);let[u,f]=(0,R.useState)({});(0,R.useEffect)(()=>{let b=!0;return de(t).then(N=>{let x={};for(let[T,O]of Object.entries(_e(N.namespace))){let K=typeof O.displayName=="string"?O.displayName.trim():"";K.length>0&&(x[T]=K)}b&&f(x)}).catch(()=>{}),()=>{b=!1}},[t]);let y=(0,R.useCallback)(()=>{jt().then(b=>{b.ok&&o(b.data)})},[]),g=(0,R.useCallback)(b=>{b.length!==0&&(d("default"),mn({defaultModel:b}).then(N=>{d(void 0),N.ok?(c(void 0),y()):c(N.error)}))},[y]),E=(0,R.useCallback)(b=>{d("enabled"),mn({enabled:b}).then(N=>{d(void 0),N.ok?(c(void 0),y()):c(N.error)})},[y]),L=(0,R.useCallback)(b=>{if(r===void 0)return;let N=Number(b);!Number.isFinite(N)||N<6e4||N>36e5||N!==r.defaults.timeoutMs&&mn({defaults:{timeoutMs:N}}).then(x=>{x.ok?(c(void 0),y()):c(x.error)})},[r,y]);if(r===void 0)return(0,R.createElement)("div",{className:"bre-config-loading","aria-busy":!0},(0,R.createElement)("div",{className:"bre-config-loading-text"},i===void 0?n("imagegenLoading"):`${n("imagegenLoadFailed")}: ${i}`),(0,R.createElement)("div",{className:"bre-config-skeleton"},...[0,1,2].map(b=>(0,R.createElement)("div",{key:b,className:"bre-config-skeleton-row"}))));let w=r.models,H=w.length===0,D="bre-config-imagegen-body",te=r.enabled?r.tool.error:void 0,U=new Map;for(let b of w)U.set(b.label,(U.get(b.label)??0)+1);let v=b=>{if((U.get(b.label)??0)<2)return b.label;let N=u[b.route]??b.providerLabel??b.route;return`${b.label} \xB7 ${N}`};return(0,R.createElement)("div",{className:"bre-config-card"},(0,R.createElement)("div",{className:"bre-config-card-head"},(0,R.createElement)("button",{type:"button",className:"bre-config-expand","aria-expanded":p,"aria-controls":D,title:n(p?"imagegenCollapse":"imagegenExpand"),onClick:()=>m(b=>!b)},(0,R.createElement)("span",{className:"bre-config-card-title"},n("imagegenSectionTitle")),(0,R.createElement)("span",{className:"bre-config-card-hint"},r.enabled?n("imagegenEnabledHint"):n("imagegenDisabledHint"))),(0,R.createElement)("span",{className:"bre-config-card-state"},r.enabled?n("cardStateOn"):n("cardStateOff")),(0,R.createElement)("label",{className:"bre-config-switch",title:n("imagegenEnable")},(0,R.createElement)("input",{type:"checkbox",className:"bre-config-switch-input",role:"switch","aria-label":n("imagegenEnable"),checked:r.enabled,disabled:s==="enabled",onChange:b=>E(b.target.checked)}),(0,R.createElement)("span",{className:"bre-config-switch-track","aria-hidden":!0})),(0,R.createElement)("span",{className:"bre-config-chevron","aria-hidden":!0,"data-open":String(p),onClick:()=>m(b=>!b)},"\u203A")),l!==void 0&&(0,R.createElement)("div",{className:"bre-config-notice"},l),p&&(0,R.createElement)("div",{className:"bre-config-card-body",id:D},te!==void 0&&(0,R.createElement)("div",{className:"bre-config-notice bre-config-notice-warn"},(0,R.createElement)("div",null,n("imagegenToolMissing")),(0,R.createElement)("div",{className:"bre-config-notice-why"},n("imagegenToolMissingWhy",{reason:te}))),(0,R.createElement)("div",{className:"bre-config-defaults"},(0,R.createElement)("label",null,n("imagegenDefaultsLabel")),(0,R.createElement)("select",{className:"bre-config-select",value:wm(r.defaults.size),"aria-label":n("imagegenSizeLabel"),onChange:b=>{mn({defaults:{size:b.target.value}}).then(y)}},Ci.map(b=>(0,R.createElement)("option",{key:b.label,value:b.value},b.label))),(0,R.createElement)("select",{className:"bre-config-select",value:r.defaults.quality,"aria-label":n("imagegenQualityLabel"),onChange:b=>{mn({defaults:{quality:b.target.value}}).then(y)}},["low","medium","high","auto"].map(b=>(0,R.createElement)("option",{key:b,value:b},b))),(0,R.createElement)("select",{className:"bre-config-select",value:String(r.defaults.n),"aria-label":n("imagegenCountLabel"),onChange:b=>{mn({defaults:{n:Number(b.target.value)}}).then(y)}},[1,2,3,4].map(b=>(0,R.createElement)("option",{key:b,value:String(b)},`n=${b}`))),(0,R.createElement)("label",{className:"bre-config-timeout",title:n("imagegenTimeoutHint")},(0,R.createElement)("span",{className:"bre-config-timeout-label"},n("imagegenTimeoutLabel")),(0,R.createElement)("select",{className:"bre-config-select",value:String(r.defaults.timeoutMs),"aria-label":n("imagegenTimeoutLabel"),onChange:b=>{L(b.target.value)}},Qw(r.defaults.timeoutMs).map(b=>(0,R.createElement)("option",{key:b,value:String(b)},n("imagegenTimeoutMinutes",{minutes:Math.round(b/6e4)})))))),!H&&(0,R.createElement)("div",{className:"bre-config-default-row"},(0,R.createElement)("label",{className:"bre-config-default-label"},n("imagegenDefaultModelLabel")),(0,R.createElement)("select",{className:"bre-config-select bre-config-default-select",value:r.defaultModel??"","aria-label":n("imagegenDefaultModelLabel"),disabled:s==="default",onChange:b=>g(b.target.value)},r.defaultModel===null&&(0,R.createElement)("option",{value:"",disabled:!0},n("imagegenDefaultModelNone")),w.map(b=>(0,R.createElement)("option",{key:b.id,value:b.id},v(b)))))))}function ex(e){let{t}=e,n=(0,R.useSyncExternalStore)(Ai,gn),r=(0,R.useSyncExternalStore)(Ri,Ht),[o,i]=(0,R.useState)(String(r.waitSeconds)),[a,s]=(0,R.useState)(String(r.maxRetries));(0,R.useEffect)(()=>{i(String(r.waitSeconds))},[r.waitSeconds]),(0,R.useEffect)(()=>{s(String(r.maxRetries))},[r.maxRetries]);let d=()=>{Xs({waitSeconds:o.trim()===""?r.waitSeconds:Number(o)}),i(String(Ht().waitSeconds))},l=()=>{Xs({maxRetries:a.trim()===""?r.maxRetries:Number(a)}),s(String(Ht().maxRetries))},[c,p]=(0,R.useState)(!1),m="bre-config-auto-continue-body";return(0,R.createElement)("div",{className:"bre-config-card bre-config-auto-card"},(0,R.createElement)("div",{className:"bre-config-card-head"},(0,R.createElement)("button",{type:"button",className:"bre-config-expand","aria-expanded":c,"aria-controls":m,title:t(c?"autoContinueCollapse":"autoContinueExpand"),onClick:()=>p(u=>!u)},(0,R.createElement)("span",{className:"bre-config-card-title"},t("autoContinueSectionTitle")),!c&&(0,R.createElement)("span",{className:"bre-config-card-hint bre-config-auto-summary"},t("autoContinueHint",{seconds:r.waitSeconds,count:r.maxRetries}))),(0,R.createElement)("span",{className:"bre-config-card-state"},t(n?"cardStateOn":"cardStateOff")),(0,R.createElement)("label",{className:"bre-config-switch",title:t("autoContinueAria")},(0,R.createElement)("input",{type:"checkbox",className:"bre-config-switch-input",role:"switch","aria-label":t("autoContinueAria"),checked:n,onChange:u=>{om(u.target.checked)}}),(0,R.createElement)("span",{className:"bre-config-switch-track","aria-hidden":!0})),(0,R.createElement)("span",{className:"bre-config-chevron","aria-hidden":!0,"data-open":String(c),onClick:()=>p(u=>!u)},"\u203A")),c&&(0,R.createElement)("div",{className:"bre-config-card-body",id:m},(0,R.createElement)("div",{className:"bre-config-auto-fields"},(0,R.createElement)("label",{className:"bre-config-auto-field"},(0,R.createElement)("span",{className:"bre-config-auto-label"},t("autoContinueWaitLabel")),(0,R.createElement)("span",{className:"bre-config-auto-control"},(0,R.createElement)("input",{type:"number",className:"bre-config-auto-input",min:1,max:3600,step:1,value:o,"aria-label":`${t("autoContinueWaitLabel")} (${t("autoContinueSecondsUnit")})`,title:`${1}\u2013${3600} ${t("autoContinueSecondsUnit")}`,onChange:u=>i(u.target.value),onBlur:d,onKeyDown:u=>{u.key==="Enter"&&u.currentTarget.blur()}}),(0,R.createElement)("span",{className:"bre-config-auto-unit","aria-hidden":!0},t("autoContinueSecondsUnit")))),(0,R.createElement)("label",{className:"bre-config-auto-field"},(0,R.createElement)("span",{className:"bre-config-auto-label"},t("autoContinueRetriesLabel")),(0,R.createElement)("span",{className:"bre-config-auto-control"},(0,R.createElement)("input",{type:"number",className:"bre-config-auto-input",min:1,max:100,step:1,value:a,"aria-label":`${t("autoContinueRetriesLabel")} (${t("autoContinueRetriesUnit")})`,title:`${1}\u2013${100} ${t("autoContinueRetriesUnit")}`,onChange:u=>s(u.target.value),onBlur:l,onKeyDown:u=>{u.key==="Enter"&&u.currentTarget.blur()}}),(0,R.createElement)("span",{className:"bre-config-auto-unit","aria-hidden":!0},t("autoContinueRetriesUnit")))))))}function tx(e){let{t,onClose:n}=e,r=(0,R.useRef)(null);return(0,R.useEffect)(()=>{let o=i=>{i.key==="Escape"&&n()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[n]),(0,R.createElement)("div",{className:"bre-config-backdrop",onMouseDown:o=>{o.target===o.currentTarget&&n()}},(0,R.createElement)("div",{className:"bre-config-pane",ref:r},(0,R.createElement)("div",{className:"bre-config-head"},(0,R.createElement)("span",{className:"bre-config-title"},t("configPaneTitle")),(0,R.createElement)("button",{className:"bre-config-close",type:"button","aria-label":t("configPaneClose"),onClick:n},"\u2715")),(0,R.createElement)("div",{className:"bre-config-body"},(0,R.createElement)(Ue,{fallbackText:t("configPaneFailed")},(0,R.createElement)(Zw,{api:e.api,t:e.t})),(0,R.createElement)(Ue,{fallbackText:t("configPaneFailed")},(0,R.createElement)(ex,{t:e.t})))))}function Mm(e){let t=document.createElement("div");t.className="bre-config-pane-host",document.body.appendChild(t);let n=(0,Sm.createRoot)(t),r=!0,o=()=>{r&&(r=!1,Ne({wrapper:t,root:n}))};return n.render((0,R.createElement)(tx,{api:e.api,t:e.t,onClose:o})),{close:o}}function Lm(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return r.length===0||n.includes(r)}function Am(e,t){let n=e.replace(/^\s+/,"");if(n.length===0)return t.map(a=>({label:a.isDefault?`${a.label}\uFF08\u9ED8\u8BA4\uFF09`:a.label,insertText:a.id,kind:"model",hint:a.id}));let r=n.match(/^(\S+)(\s+[\s\S]*)?$/);if(r===null)return[];let o=r[1];return t.filter(a=>Lm(a.id,o)||Lm(a.label,o)).map(a=>({label:a.isDefault?`${a.label}\uFF08\u9ED8\u8BA4\uFF09`:a.label,insertText:a.id,kind:"model",hint:a.id}))}var nx="imagegen",rx=3e4,Yr;function td(){Yr=void 0}async function ox(){if(Yr!==void 0&&Date.now()-Yr.at<rx)return Yr.models;let e=await jt(),t=e.ok&&e.data.enabled?e.data.models.map(n=>({id:n.id,label:n.label,isDefault:e.data.defaultModel===n.id})):[];return Yr={at:Date.now(),models:t},t}function Rm(e){let t;try{t=e.inputTriggers}catch{t=void 0}let n=Pp(td);if(t===void 0||typeof t.registerSource!="function")return n;let r=!0;try{t.registerSource({trigger:"/",name:nx,order:900,candidates:o=>{let i=typeof o?.text=="string"?o.text:"";return/^\/?生图(?:\s|$)/.test(i)?ox().then(a=>Am(i.replace(/^\/?生图/,""),a)):[]}})}catch{r=!1}return()=>{r=!1,n()}}var hn=require("react");var Cm="tool.call.images",ix="generate_image";function ax(e){if(e===void 0||typeof e!="object")return[];let t=e.content??e.resultView?.content;if(!Array.isArray(t))return[];let n=[];for(let r of t)if(r!==null&&typeof r=="object"&&r.type==="image"){let o=r.attachment;o!==void 0&&typeof o.attachmentId=="string"&&n.push({attachment:o})}return n}function sx(e){let t=Array.isArray(e.content)?e.content:[];for(let n of t)if(n!==null&&typeof n=="object"&&n.type==="text"&&typeof n.text=="string")return n.text;return null}function dx(e){let t=e.meta;if(t===void 0||typeof t!="object")return null;let n=[],r=t.paramsUsed;typeof t.model=="string"&&t.model.length>0&&n.push(r===void 0?t.model:`${t.model} \xB7 ${r.size} \xB7 ${r.quality} \xB7 n ${r.n}`);let o=(t.images??[]).map(i=>i.filePath).filter(i=>typeof i=="string");return o.length>0&&n.push(o.join(`
|
|
4829
4883
|
`)),Array.isArray(t.revisions)&&t.revisions.length>0&&n.push(t.revisions.join("\u3001")),n.length>0?n.join(`
|
|
4830
|
-
`):null}function
|
|
4884
|
+
`):null}function lx(e){let t=e.block;if(!(t!==void 0&&typeof t=="object"&&"kind"in t))return(0,hn.createElement)("div",{className:"bre-image-card","aria-busy":!0},(0,hn.createElement)("span",{className:"bre-image-card-running"},e.t("imagegenCardRunning")));let r=ax(t);if(r.length===0){let i=sx(t);return(0,hn.createElement)("div",{className:"bre-image-card"},i===null?null:(0,hn.createElement)("div",{className:"bre-image-card-caption"},i))}let o=dx(t);return(0,hn.createElement)("div",{className:"bre-image-card"},typeof e.renderSlot=="function"&&typeof e.loadImage=="function"?e.renderSlot(Cm,{images:r,loadImage:e.loadImage,align:"start"}):null,o===null?null:(0,hn.createElement)("div",{className:"bre-image-card-caption"},o))}function cx(e,t,n){if(e===void 0)return()=>{};let r;try{let o=e.register.bind(e),i=e.inject("tool.call.toolview",()=>o({name:"tool.call.toolview",key:t,children:{[Cm]:{kind:"single",scope:"session"}}},a=>lx({...a,t:n})));typeof i=="function"&&(r=i)}catch{return()=>{}}return()=>{r?.()}}function Hm(e,t){let n=e.slots;e.effect(()=>{let r,o,i=!0,a=s=>{i&&(typeof s!="string"||s.length===0||s!==o&&(r?.(),o=s,r=cx(n,s,t)))};return a(ix),a(yi()?.tool.name),jt().then(s=>{s.ok&&a(s.data.tool.name)}).catch(()=>{}),()=>{i=!1,r?.()}},"dsh-model-think-level: image tool card")}var Om=200,ux=ye,fx=["slots","locale","connection","remote","remote.settings"];function px(e){e.effect(()=>e.locale.register(_i,{zh:cd,en:ld}),"dsh-model-think-level: dictionaries");let t=document.createElement("style");t.dataset.plugin=ye,t.dataset.pluginStyles=ye,t.textContent=Pd,document.head.appendChild(t),e.effect(()=>()=>t.remove(),"dsh-model-think-level: stylesheet"),e.effect(()=>Vp(Fe),"dsh-model-think-level: key list revalidation");let n=(()=>{try{let g=e.get?.("configForms");try{let L=g?.get?.(Ce);if(L!==void 0)return L}catch{}return e.get?.("settingsScope")?.bind?.({namespace:Ce})}catch{return}})(),r=n===void 0?{settings:e.remote.settings}:{settings:e.remote.settings,scope:n},o=e.locale.bind(_i),i=()=>{let g=e.locale;return typeof g.subscribe=="function"&&typeof g.getSnapshot=="function"?g:void 0},a=g=>{let E=i();return E===void 0?g():(0,Nm.createElement)(dd,{locale:E,children:g})},s=bl({api:r}),d=zd(r),l=tm({ctx:e,configuredEffort:s.of}),c=hl({menuOf:pl,triggerOf:ml,t:o,refreshed:a,sliderEnabled:lt,directory:l.ensure,configuredInputs:d}),p=yl({api:r}),m=vl({api:r}),u,f=$p({ctx:e,api:r,t:o,onIdle:g=>{m.run(g),p.run(g)},refreshed:a,configSeat:{t:o,onOpen:()=>{u?.close(),u=Mm({api:r,t:o})}}}),y=()=>{l.ensure(),c.reconcile()};e.effect(()=>(f.start(y),()=>{f.teardown(),c.dispose(),l.dispose(),u?.close(),u=void 0}),"dsh-model-think-level: DOM injector"),e.effect(()=>{let g=()=>{f.flushOnUnload(),ta(),em()};return window.addEventListener("pagehide",g),()=>{window.removeEventListener("pagehide",g)}},"dsh-model-think-level: ledger flush on unload"),e.effect(()=>Id(),"dsh-model-think-level: order file sync"),e.effect(()=>{let g=!1,L=rd(()=>{g&&(g=!1,document.dispatchEvent(new CustomEvent(mr,{detail:{ns:Ce}}))),f.state.describePromise=void 0,s.invalidate(),d.invalidate(),p.invalidate(),td(),f.schedule()},Om),w=[e.remote.$on("settings/document-updated",H=>{H===Ce&&(g=!0,L.schedule())}),e.on("connection/reset",L.schedule)];return()=>{L.dispose();for(let H of w)H()}},"dsh-model-think-level: pushed invalidations"),e.effect(()=>{let g=D=>{D.key===to?pd(D.newValue!=="false"):D.key===ro?bd(kn(D.newValue)):D.key===io?xd(vd(D.newValue)):D.key===ao?Md(ji(D.newValue)):D.key===Ti?Qs(D.newValue==="true"):D.key===Si?Zs(Mi(D.newValue)):D.key===null&&(Qs(!1),Zs(Mi(null)))};window.addEventListener("storage",g);let E=no(()=>{f.schedule()}),L=Tn(()=>{f.schedule()}),w=Ln(()=>{f.schedule()}),H=An(()=>{f.schedule()});return()=>{window.removeEventListener("storage",g),E(),L(),w(),H()}},"dsh-model-think-level: client preferences"),e.effect(()=>vm(e,o),"dsh-model-think-level: footer slot activation"),e.effect(()=>bm(e,r,o),"dsh-model-think-level: provider-card slot activation"),e.effect(()=>Rm(e),"dsh-model-think-level: imagegen completion source"),Hm(e,o),e.effect(()=>{let g=dm({ctx:e,t:o});return()=>g.dispose()},"dsh-model-think-level: auto-continue watcher")}
|
|
4831
4885
|
|
|
4832
4886
|
return module.exports;
|
|
4833
4887
|
}
|