dsh-model-think-level 1.1.0 → 1.1.1

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/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 Wt=Object.defineProperty;var qa=Object.getOwnPropertyDescriptor;var Ba=Object.getOwnPropertyNames;var Ua=Object.prototype.hasOwnProperty;var ja=(e,t,n)=>t in e?Wt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Ga=(e,t)=>{for(var n in t)Wt(e,n,{get:t[n],enumerable:!0})},za=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ba(t))!Ua.call(e,o)&&o!==n&&Wt(e,o,{get:()=>t[o],enumerable:!(r=qa(t,o))||r.enumerable});return e};var $a=e=>za(Wt({},"__esModule",{value:!0}),e);var no=(e,t,n)=>ja(e,typeof t!="symbol"?t+"":t,n);var rf={};Ga(rf,{EffortEditor:()=>fn,apply:()=>nf,baselineModelsOf:()=>ii,compatOf:()=>rn,createEditorApi:()=>an,defaultEffortOf:()=>sn,describeNamespace:()=>ne,effortsOf:()=>tn,findModelMenu:()=>$r,findModelTrigger:()=>Vr,inject:()=>tf,inputOf:()=>nn,name:()=>ef,nameOf:()=>on,providerHeadersOf:()=>mr,providersOf:()=>ye,userProvidersOf:()=>pr,writeModelRows:()=>xt,writeProviderHeaders:()=>gr});module.exports=$a(rf);var Ta=require("react");var X="dsh-model-think-level",ro="/dsh-model-think-level/raw-models";var qt="/dsh-model-think-level/provider-key",oo="/dsh-model-think-level/key-index",io="/dsh-model-think-level/autofill-config",so="/dsh-model-think-level/headers-config",ie="llm-pi-ai",le="reasoningEffortsUnset",xe="inputUnset",Qe="reasoningEffortsAutofilled",Ze="defaultEffort",Gn=X;var gt=require("react");function ao(e){let{locale:t}=e,n=(0,gt.useCallback)(o=>t.subscribe(o),[t]),r=(0,gt.useCallback)(()=>t.getSnapshot().revision??0,[t]);return(0,gt.useSyncExternalStore)(n,r),e.children()}var lo={reasoningEffort:"Reasoning effort",thinkingMode:"Thinking",thinkingModeOff:"Off \u2014 this model is declared as not reasoning.",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",pendingSave:"Modified \u2014 it will be written when you save this card.",pendingHint:"Cancel or reload discards it, exactly like the card's own fields.",appliedHint:"Applied suggestion from {source} \xB7 confidence: {confidence}",inputHintEndpoint:"Modality advice comes from the endpoint listing.",inputHintKnowledge:"Modality advice comes from the knowledge base.",inputHintHeuristic:"Modality guessed from the name alone (low confidence) \u2014 verify.",referenceTitle:"Reference capacities (hints only, never auto-filled)",contextWindowLabel:"Context window",maxTokensLabel:"Max output",inputModality:"Input modalities",modalityImage:"Image input",modalityInherit:"Not declared \u2014 the provider default applies (usually text-only).",clearDeclaration:"Clear declaration",confidence_high:"high",confidence_medium:"medium",confidence_low:"low \u2014 verify before relying on it",noSuggestion:"No suggestion is available for this model.",conflict:"The settings document kept changing under this edit. Wait a moment, then apply again.",writeError:"Failed: {message}",renderFailed:"Reasoning-effort editor failed to render",wirePlaceholder:"Wire value",wireValue:"value",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",sliderEffortAria:"Reasoning effort",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",sliderEffortTitle:"Reasoning effort \xB7 {name}",sliderEffortTitleError:"Reasoning effort failed: {error}",sliderNoCurrent:"No model selected.",compatTitle:"Endpoint compatibility",budgetFieldLabel:"Thinking budget field",budgetFieldHint:"Which parameter carries the thinking-token budget: some vLLM and self-hosted endpoints read thinking_token_budget, others thinking_budget or thinking_budget_tokens. Unset sends none of them.",budgetUnset:"Not set",defaultEffortLabel:"Default effort",defaultEffortUnset:"Follow memory",defaultEffortHint:"The level every new session starts this model at \u2014 it outranks the remembered levels. Within a session, a level you pick by hand always wins. Empty follows the memory chain.",clearDefaultEffort:"Clear pick",priorityLabel:"vLLM priority",priorityPlaceholder:"e.g. 0",priorityHint:"Scheduler priority for endpoints started with --priority, where lower runs first. Leave empty to send nothing.",priorityInvalid:"Priority must be an integer \u2014 it is not saved until fixed.",maxOutputLabel:"max_output_tokens in requests",maxOutputUnset:"Unset \u2014 follow the protocol default",maxOutputOn:"Send it",maxOutputOff:"Omit it",maxOutputHint:'For Responses-protocol gateways only, and only when a request carries an output cap: some of them reject the parameter, so "Omit it" keeps the cap out of the request entirely. Unset is the safe choice.',aliasMigrated:"Legacy alias detected \u2014 saving writes the explicit budget field.",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",keyRevealShow:"Show key",keyRevealHide:"Hide key",keyRevealFailed:"Stored key unavailable",keysLoading:"Loading keys\u2026",keysAdd:"Add another key",keysAddConfirm:"Add",keysEnable:"Use {name}",keysEnabled:"Enabled",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.",keysEnabledNote:"{name} is now in use.",keysUnreachable:"The plugin\u2019s key route did not answer.",keysPanelFailed:"Key manager failed to render",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",headersSaved:"Saved.",headersCleared:"Cleared \u2014 this route sends no extra request headers.",headersReadOnly:"The settings document is not writable.",headersUserAgentTitle:"User-Agent (taken over at the fetch layer)",headersUserAgentHint:"The official adapter discards a configured user-agent \u2014 the name is reserved for client attribution \u2014 so this plugin adds it at the request layer. Filling it in really does replace the outgoing User-Agent.",headersUserAgentClear:"Do not override",headersUserAgentPlaceholder:"e.g. claude-cli/2.1.161 (external, cli)",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.",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."},uo={reasoningEffort:"\u601D\u8003\u5F3A\u5EA6",thinkingMode:"\u601D\u8003",thinkingModeOff:"\u5DF2\u5173\u95ED\u2014\u2014\u8BE5\u6A21\u578B\u58F0\u660E\u4E3A\u4E0D\u601D\u8003\u3002",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",pendingSave:"\u5DF2\u4FEE\u6539\u2014\u2014\u70B9\u5361\u7247\u300C\u4FDD\u5B58\u300D\u65F6\u4E00\u8D77\u5199\u5165\u3002",pendingHint:"\u70B9\u300C\u53D6\u6D88\u300D\u6216\u5237\u65B0\u9875\u9762\u4F1A\u4E00\u5E76\u4E22\u5F03\uFF0C\u4E0E\u5361\u7247\u81EA\u8EAB\u7684\u5B57\u6BB5\u4E00\u81F4\u3002",appliedHint:"\u5DF2\u6309 {source} \u5E94\u7528\u5EFA\u8BAE \xB7 \u7F6E\u4FE1\u5EA6\uFF1A{confidence}",inputHintEndpoint:"\u6A21\u6001\u5EFA\u8BAE\u6765\u81EA\u7AEF\u70B9\u5217\u8868\u3002",inputHintKnowledge:"\u6A21\u6001\u5EFA\u8BAE\u6765\u81EA\u77E5\u8BC6\u5E93\u3002",inputHintHeuristic:"\u6A21\u6001\u5EFA\u8BAE\u4EC5\u6309\u547D\u540D\u63A8\u65AD\uFF08\u4F4E\u7F6E\u4FE1\u5EA6\uFF09\uFF0C\u8BF7\u6838\u5BF9\u3002",referenceTitle:"\u53C2\u8003\u5BB9\u91CF\uFF08\u4EC5\u63D0\u793A\uFF0C\u4E0D\u81EA\u52A8\u586B\u5145\uFF09",contextWindowLabel:"\u4E0A\u4E0B\u6587\u7A97\u53E3",maxTokensLabel:"\u6700\u5927\u8F93\u51FA",inputModality:"\u8F93\u5165\u6A21\u6001",modalityImage:"\u56FE\u7247\u8F93\u5165",modalityInherit:"\u672A\u58F0\u660E\u2014\u2014\u7EE7\u627F\u63D0\u4F9B\u65B9\u9ED8\u8BA4\uFF08\u901A\u5E38\u4EC5\u6587\u672C\uFF09\u3002",clearDeclaration:"\u6E05\u9664\u58F0\u660E",confidence_high:"\u9AD8",confidence_medium:"\u4E2D",confidence_low:"\u4F4E\uFF08\u5EFA\u8BAE\u6838\u5BF9\uFF09",noSuggestion:"\u6CA1\u6709\u9002\u7528\u4E8E\u8BE5\u6A21\u578B\u7684\u5EFA\u8BAE\u3002",conflict:"\u8BBE\u7F6E\u6587\u6863\u5728\u4FDD\u5B58\u671F\u95F4\u6301\u7EED\u53D8\u5316\uFF0C\u8BF7\u7A0D\u5019\u518D\u6B21\u5E94\u7528\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",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",sliderEffortAria:"\u601D\u8003\u5F3A\u5EA6",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",sliderEffortTitle:"\u601D\u8003\u5F3A\u5EA6 \xB7 {name}",sliderEffortTitleError:"\u601D\u8003\u5F3A\u5EA6\u8BBE\u7F6E\u5931\u8D25\uFF1A{error}",sliderNoCurrent:"\u5F53\u524D\u65E0\u9009\u62E9\u4E2D\u7684\u6A21\u578B\u3002",compatTitle:"\u7AEF\u70B9\u517C\u5BB9",budgetFieldLabel:"\u601D\u8003\u9884\u7B97\u5B57\u6BB5",budgetFieldHint:"\u601D\u8003 token \u9884\u7B97\u7528\u54EA\u4E2A\u53C2\u6570\u53D1\u9001\uFF1A\u90E8\u5206 vLLM\uFF0F\u81EA\u5EFA\u7AEF\u70B9\u8BFB thinking_token_budget\uFF0C\u53E6\u4E00\u4E9B\u8BFB thinking_budget \u6216 thinking_budget_tokens\u3002\u672A\u8BBE\u7F6E\u8868\u793A\u4E09\u4E2A\u90FD\u4E0D\u53D1\u9001\u3002",budgetUnset:"\u672A\u8BBE\u7F6E",defaultEffortLabel:"\u9ED8\u8BA4\u601D\u8003\u5F3A\u5EA6",defaultEffortUnset:"\u8DDF\u968F\u8BB0\u5FC6",defaultEffortHint:"\u6BCF\u4E2A\u65B0\u4F1A\u8BDD\u6253\u5F00\u8BE5\u6A21\u578B\u65F6\u4F7F\u7528\u7684\u6863\u4F4D\u2014\u2014\u4F18\u5148\u4E8E\u8BB0\u4F4F\u7684\u4E0A\u6B21\u6863\u4F4D\u3002\u4F1A\u8BDD\u5185\u624B\u52A8\u9009\u62E9\u7684\u6863\u4F4D\u59CB\u7EC8\u6700\u9AD8\u3002\u7559\u7A7A\u5219\u8DDF\u968F\u8BB0\u5FC6\u94FE\u3002",clearDefaultEffort:"\u6E05\u9664\u9009\u62E9",priorityLabel:"vLLM \u4F18\u5148\u7EA7",priorityPlaceholder:"\u4F8B\u5982 0",priorityHint:"\u4EE5 --priority \u542F\u52A8\u7684\u7AEF\u70B9\u7684\u8C03\u5EA6\u4F18\u5148\u7EA7\uFF0C\u6570\u503C\u8D8A\u5C0F\u8D8A\u5148\u6267\u884C\u3002\u7559\u7A7A\u8868\u793A\u4E0D\u53D1\u9001\u3002",priorityInvalid:"\u4F18\u5148\u7EA7\u5FC5\u987B\u662F\u6574\u6570\u2014\u2014\u4FEE\u6B63\u524D\u4E0D\u4F1A\u4FDD\u5B58\u3002",maxOutputLabel:"\u8BF7\u6C42\u4E2D\u7684 max_output_tokens",maxOutputUnset:"\u672A\u8BBE\u7F6E\u2014\u2014\u8DDF\u968F\u534F\u8BAE\u9ED8\u8BA4",maxOutputOn:"\u53D1\u9001",maxOutputOff:"\u4E0D\u53D1\u9001",maxOutputHint:'\u4EC5\u5BF9 Responses \u534F\u8BAE\u7684\u7F51\u5173\u751F\u6548\uFF0C\u4E14\u53EA\u5728\u8BF7\u6C42\u5E26\u8F93\u51FA\u4E0A\u9650\u65F6\u624D\u8D77\u4F5C\u7528\uFF1A\u90E8\u5206\u7F51\u5173\u4F1A\u62D2\u6536\u8BE5\u53C2\u6570\uFF0C\u9009"\u4E0D\u53D1\u9001"\u53EF\u8BA9\u8BF7\u6C42\u5B8C\u5168\u4E0D\u643A\u5E26\u8F93\u51FA\u4E0A\u9650\u3002\u672A\u8BBE\u7F6E\u662F\u6700\u5B89\u5168\u7684\u9009\u62E9\u3002',aliasMigrated:"\u68C0\u6D4B\u5230\u65E7\u522B\u540D\u2014\u2014\u4FDD\u5B58\u65F6\u4F1A\u5199\u5165\u663E\u5F0F\u9884\u7B97\u5B57\u6BB5\u3002",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",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}",keysEnabled:"\u542F\u7528",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",keysEnabledNote:"\u5DF2\u542F\u7528 {name}\u3002",keysUnreachable:"\u63D2\u4EF6\u7684\u5BC6\u94A5\u63A5\u53E3\u6CA1\u6709\u54CD\u5E94\u3002",keysPanelFailed:"\u5BC6\u94A5\u7BA1\u7406\u9762\u677F\u6E32\u67D3\u5931\u8D25",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",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",headersUserAgentTitle:"User-Agent\uFF08\u7531\u63D2\u4EF6\u5728\u8BF7\u6C42\u5C42\u63A5\u7BA1\uFF09",headersUserAgentHint:"\u5B98\u65B9\u9002\u914D\u5668\u4F1A\u4E22\u5F03\u914D\u7F6E\u7684 user-agent\uFF08\u8BE5\u540D\u79F0\u4FDD\u7559\u7ED9\u5BA2\u6237\u7AEF\u5F52\u5C5E\u6807\u8BC6\uFF09\uFF0C\u6240\u4EE5\u7531\u63D2\u4EF6\u5728\u8BF7\u6C42\u5C42\u8865\u4E0A\u3002\u586B\u4E86\u5C31\u4F1A\u771F\u6B63\u66FF\u6362\u4E0A\u884C\u8BF7\u6C42\u5934\u91CC\u7684 User-Agent\u3002",headersUserAgentClear:"\u4E0D\u8986\u76D6",headersUserAgentPlaceholder:"\u4F8B\u5982 claude-cli/2.1.161 (external, cli)",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",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"};var Bt="dsh-model-think-level.slider.enabled",Va=["dsh-reasoning-effort.enabled","@dsh-external/dsh-reasoning-effort.enabled"],ht=Ya();function Ya(){try{let e=window.localStorage.getItem(Bt),t=e===null?Va.map(n=>window.localStorage.getItem(n)).find(n=>n!==null):null;return(e??t??null)!=="false"}catch{return!0}}var zn=new Set;function fo(){for(let e of[...zn])e()}function fe(){return ht}function co(e){if(ht!==e){ht=e;try{window.localStorage.setItem(Bt,String(e))}catch{}fo()}}function po(e){ht!==e&&(ht=e,fo())}function Ut(e){return zn.add(e),()=>{zn.delete(e)}}var jt="dsh-model-think-level.provider-order",mo=["deepseek-account","deepseek-official"];function tt(e){if(e===null)return[];try{let t=JSON.parse(e);return Array.isArray(t)?Vn(t.filter(n=>typeof n=="string")):[]}catch{return[]}}function Vn(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 et=(()=>{try{return tt(window.localStorage.getItem(jt))}catch{return[]}})(),$n=new Set;function go(){for(let e of[...$n])e()}function ho(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Yn(){return et}function bo(e){let t=Vn(e);if(!ho(et,t)){et=t;try{window.localStorage.setItem(jt,JSON.stringify(et))}catch{}go()}}function yo(e){let t=Vn(e);ho(et,t)||(et=t,go())}function Gt(e){return $n.add(e),()=>{$n.delete(e)}}function Jn(e){let t=n=>{let r=mo.indexOf(n);return r<0?mo.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 nt(e,t){let n=new Map;for(let s of t)n.has(s)||n.set(s,n.size);let r=[],o=[];e.forEach((s,a)=>{n.has(s)&&(r.push(a),o.push(s))}),o.sort((s,a)=>n.get(s)-n.get(a));let i=[...e];return r.forEach((s,a)=>{i[s]=o[a]}),i}function wo(e){return nt(Jn(e),Yn())}function Xn(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 zt="dsh-model-think-level.providers.disabled",Qn=new Set,He=Ja();function Ja(){try{return tt(window.localStorage.getItem(zt))}catch{return[]}}function vo(e){return tt(e)}function xo(){return He}function rt(e){return!He.includes(e)}function ko(e,t){let n=!He.includes(e);t!==n&&To(t?He.filter(r=>r!==e):[...He,e],!0)}function Eo(e){To(e,!1)}function $t(e){return Qn.add(e),()=>{Qn.delete(e)}}function Xa(e,t){return e.length!==t.length?!1:e.every(n=>t.includes(n))}function To(e,t){if(!Xa(He,e)){if(He=[...new Set(e)],t)try{window.localStorage.setItem(zt,JSON.stringify(He))}catch{}for(let n of[...Qn])n()}}var Vt="dsh-model-think-level.model-order";function er(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=Lo(o.filter(s=>typeof s=="string"));i.length>0&&(n[r]=i)}return n}catch{return{}}}function Lo(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 Be=(()=>{try{return er(window.localStorage.getItem(Vt))}catch{return{}}})(),Zn=new Set;function Mo(){for(let e of[...Zn])e()}function Qa(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Za(){try{window.localStorage.setItem(Vt,JSON.stringify(Be))}catch{}}function So(){return Be}function Ao(e){return Be[e]??ed}var ed=[];function Ro(e,t){if(e.length===0)return;let n=Lo(t),r=Ao(e);if(Qa(r,n)&&(n.length>0||!(e in Be)))return;let o={...Be};n.length===0?delete o[e]:o[e]=n,Be=o,Za(),Mo()}function Ho(e){Be=e,Mo()}function Yt(e){return Zn.add(e),()=>{Zn.delete(e)}}function td(e,t){return nt(e,t)}function Oo(e,t){return nt(t,Ao(e))}function No(e,t){if(e.length===0||t.length===0)return e;let n=new Map(e.map(r=>[r.id,r]));return td(e.map(r=>r.id),t).map(r=>n.get(r))}var _o=`
7
+ "use strict";var Vt=Object.defineProperty;var Rd=Object.getOwnPropertyDescriptor;var Hd=Object.getOwnPropertyNames;var Od=Object.prototype.hasOwnProperty;var _d=(e,t,n)=>t in e?Vt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Nd=(e,t)=>{for(var n in t)Vt(e,n,{get:t[n],enumerable:!0})},Dd=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Hd(t))!Od.call(e,o)&&o!==n&&Vt(e,o,{get:()=>t[o],enumerable:!(r=Rd(t,o))||r.enumerable});return e};var Cd=e=>Dd(Vt({},"__esModule",{value:!0}),e);var ko=(e,t,n)=>_d(e,typeof t!="symbol"?t+"":t,n);var cc={};Nd(cc,{EffortEditor:()=>wn,apply:()=>fc,baselineModelsOf:()=>Ti,compatOf:()=>cn,createEditorApi:()=>gn,defaultEffortOf:()=>mn,describeNamespace:()=>re,effortsOf:()=>un,findModelMenu:()=>mo,findModelTrigger:()=>go,inject:()=>uc,inputOf:()=>fn,name:()=>lc,nameOf:()=>pn,providerHeadersOf:()=>Sr,providersOf:()=>we,routeIsDeclared:()=>Ye,userProvidersOf:()=>Mr,writeModelRows:()=>St,writeProviderHeaders:()=>At});module.exports=Cd(cc);var cd=require("react");var ne="dsh-model-think-level",Eo="/dsh-model-think-level/raw-models";var Yt="/dsh-model-think-level/provider-key",To="/dsh-model-think-level/key-index",Lo="/dsh-model-think-level/autofill-config",Mo="/dsh-model-think-level/headers-config",le="llm-pi-ai",ge="reasoningEffortsUnset",Oe="inputUnset",nt="reasoningEffortsAutofilled",rt="defaultEffort",or=ne;var kt=require("react");function So(e){let{locale:t}=e,n=(0,kt.useCallback)(o=>t.subscribe(o),[t]),r=(0,kt.useCallback)(()=>t.getSnapshot().revision??0,[t]);return(0,kt.useSyncExternalStore)(n,r),e.children()}var Ao={reasoningEffort:"Reasoning effort",thinkingMode:"Thinking",thinkingModeOff:"Off \u2014 this model is declared as not reasoning.",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",pendingSave:"Modified \u2014 it will be written when you save this card.",pendingHint:"Cancel or reload discards it, exactly like the card's own fields.",appliedHint:"Applied suggestion from {source} \xB7 confidence: {confidence}",inputHintEndpoint:"Modality advice comes from the endpoint listing.",inputHintKnowledge:"Modality advice comes from the knowledge base.",inputHintHeuristic:"Modality guessed from the name alone (low confidence) \u2014 verify.",referenceTitle:"Reference capacities (hints only, never auto-filled)",contextWindowLabel:"Context window",maxTokensLabel:"Max output",inputModality:"Input modalities",modalityImage:"Image input",modalityInherit:"Not declared \u2014 the provider default applies (usually text-only).",clearDeclaration:"Clear declaration",confidence_high:"high",confidence_medium:"medium",confidence_low:"low \u2014 verify before relying on it",noSuggestion:"No suggestion is available for this model.",conflict:"The settings document kept changing under this edit. Wait a moment, then apply again.",writeError:"Failed: {message}",renderFailed:"Reasoning-effort editor failed to render",wirePlaceholder:"Wire value",wireValue:"value",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",sliderEffortAria:"Reasoning effort",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",sliderEffortTitle:"Reasoning effort \xB7 {name}",sliderEffortTitleError:"Reasoning effort failed: {error}",sliderNoCurrent:"No model selected.",compatTitle:"Endpoint compatibility",budgetFieldLabel:"Thinking budget field",budgetFieldHint:"Which parameter carries the thinking-token budget: some vLLM and self-hosted endpoints read thinking_token_budget, others thinking_budget or thinking_budget_tokens. Unset sends none of them.",budgetUnset:"Not set",defaultEffortLabel:"Default effort",defaultEffortUnset:"Follow memory",defaultEffortHint:"The level every new session starts this model at \u2014 it outranks the remembered levels. Within a session, a level you pick by hand always wins. Empty follows the memory chain.",clearDefaultEffort:"Clear pick",priorityLabel:"vLLM priority",priorityPlaceholder:"e.g. 0",priorityHint:"Scheduler priority for endpoints started with --priority, where lower runs first. Leave empty to send nothing.",priorityInvalid:"Priority must be an integer \u2014 it is not saved until fixed.",maxOutputLabel:"max_output_tokens in requests",maxOutputUnset:"Unset \u2014 follow the protocol default",maxOutputOn:"Send it",maxOutputOff:"Omit it",maxOutputHint:'For Responses-protocol gateways only, and only when a request carries an output cap: some of them reject the parameter, so "Omit it" keeps the cap out of the request entirely. Unset is the safe choice.',aliasMigrated:"Legacy alias detected \u2014 saving writes the explicit budget field.",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",keyRevealShow:"Show key",keyRevealHide:"Hide key",keyRevealFailed:"Stored key unavailable",keysLoading:"Loading keys\u2026",keysAdd:"Add another key",keysAddConfirm:"Add",keysEnable:"Use {name}",keysEnabled:"Enabled",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.",keysEnabledNote:"{name} is now in use.",keysUnreachable:"The plugin\u2019s key route did not answer.",keysPanelFailed:"Key manager failed to render",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",headersSaved:"Saved.",headersCleared:"Cleared \u2014 this route sends no extra request headers.",headersReadOnly:"The settings document is not writable.",headersUserAgentTitle:"User-Agent (taken over at the fetch layer)",headersUserAgentHint:"The official adapter discards a configured user-agent \u2014 the name is reserved for client attribution \u2014 so this plugin adds it at the request layer. Filling it in really does replace the outgoing User-Agent.",headersUserAgentClear:"Do not override",headersUserAgentPlaceholder:"e.g. claude-cli/2.1.161 (external, cli)",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.",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."},Ro={reasoningEffort:"\u601D\u8003\u5F3A\u5EA6",thinkingMode:"\u601D\u8003",thinkingModeOff:"\u5DF2\u5173\u95ED\u2014\u2014\u8BE5\u6A21\u578B\u58F0\u660E\u4E3A\u4E0D\u601D\u8003\u3002",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",pendingSave:"\u5DF2\u4FEE\u6539\u2014\u2014\u70B9\u5361\u7247\u300C\u4FDD\u5B58\u300D\u65F6\u4E00\u8D77\u5199\u5165\u3002",pendingHint:"\u70B9\u300C\u53D6\u6D88\u300D\u6216\u5237\u65B0\u9875\u9762\u4F1A\u4E00\u5E76\u4E22\u5F03\uFF0C\u4E0E\u5361\u7247\u81EA\u8EAB\u7684\u5B57\u6BB5\u4E00\u81F4\u3002",appliedHint:"\u5DF2\u6309 {source} \u5E94\u7528\u5EFA\u8BAE \xB7 \u7F6E\u4FE1\u5EA6\uFF1A{confidence}",inputHintEndpoint:"\u6A21\u6001\u5EFA\u8BAE\u6765\u81EA\u7AEF\u70B9\u5217\u8868\u3002",inputHintKnowledge:"\u6A21\u6001\u5EFA\u8BAE\u6765\u81EA\u77E5\u8BC6\u5E93\u3002",inputHintHeuristic:"\u6A21\u6001\u5EFA\u8BAE\u4EC5\u6309\u547D\u540D\u63A8\u65AD\uFF08\u4F4E\u7F6E\u4FE1\u5EA6\uFF09\uFF0C\u8BF7\u6838\u5BF9\u3002",referenceTitle:"\u53C2\u8003\u5BB9\u91CF\uFF08\u4EC5\u63D0\u793A\uFF0C\u4E0D\u81EA\u52A8\u586B\u5145\uFF09",contextWindowLabel:"\u4E0A\u4E0B\u6587\u7A97\u53E3",maxTokensLabel:"\u6700\u5927\u8F93\u51FA",inputModality:"\u8F93\u5165\u6A21\u6001",modalityImage:"\u56FE\u7247\u8F93\u5165",modalityInherit:"\u672A\u58F0\u660E\u2014\u2014\u7EE7\u627F\u63D0\u4F9B\u65B9\u9ED8\u8BA4\uFF08\u901A\u5E38\u4EC5\u6587\u672C\uFF09\u3002",clearDeclaration:"\u6E05\u9664\u58F0\u660E",confidence_high:"\u9AD8",confidence_medium:"\u4E2D",confidence_low:"\u4F4E\uFF08\u5EFA\u8BAE\u6838\u5BF9\uFF09",noSuggestion:"\u6CA1\u6709\u9002\u7528\u4E8E\u8BE5\u6A21\u578B\u7684\u5EFA\u8BAE\u3002",conflict:"\u8BBE\u7F6E\u6587\u6863\u5728\u4FDD\u5B58\u671F\u95F4\u6301\u7EED\u53D8\u5316\uFF0C\u8BF7\u7A0D\u5019\u518D\u6B21\u5E94\u7528\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",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",sliderEffortAria:"\u601D\u8003\u5F3A\u5EA6",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",sliderEffortTitle:"\u601D\u8003\u5F3A\u5EA6 \xB7 {name}",sliderEffortTitleError:"\u601D\u8003\u5F3A\u5EA6\u8BBE\u7F6E\u5931\u8D25\uFF1A{error}",sliderNoCurrent:"\u5F53\u524D\u65E0\u9009\u62E9\u4E2D\u7684\u6A21\u578B\u3002",compatTitle:"\u7AEF\u70B9\u517C\u5BB9",budgetFieldLabel:"\u601D\u8003\u9884\u7B97\u5B57\u6BB5",budgetFieldHint:"\u601D\u8003 token \u9884\u7B97\u7528\u54EA\u4E2A\u53C2\u6570\u53D1\u9001\uFF1A\u90E8\u5206 vLLM\uFF0F\u81EA\u5EFA\u7AEF\u70B9\u8BFB thinking_token_budget\uFF0C\u53E6\u4E00\u4E9B\u8BFB thinking_budget \u6216 thinking_budget_tokens\u3002\u672A\u8BBE\u7F6E\u8868\u793A\u4E09\u4E2A\u90FD\u4E0D\u53D1\u9001\u3002",budgetUnset:"\u672A\u8BBE\u7F6E",defaultEffortLabel:"\u9ED8\u8BA4\u601D\u8003\u5F3A\u5EA6",defaultEffortUnset:"\u8DDF\u968F\u8BB0\u5FC6",defaultEffortHint:"\u6BCF\u4E2A\u65B0\u4F1A\u8BDD\u6253\u5F00\u8BE5\u6A21\u578B\u65F6\u4F7F\u7528\u7684\u6863\u4F4D\u2014\u2014\u4F18\u5148\u4E8E\u8BB0\u4F4F\u7684\u4E0A\u6B21\u6863\u4F4D\u3002\u4F1A\u8BDD\u5185\u624B\u52A8\u9009\u62E9\u7684\u6863\u4F4D\u59CB\u7EC8\u6700\u9AD8\u3002\u7559\u7A7A\u5219\u8DDF\u968F\u8BB0\u5FC6\u94FE\u3002",clearDefaultEffort:"\u6E05\u9664\u9009\u62E9",priorityLabel:"vLLM \u4F18\u5148\u7EA7",priorityPlaceholder:"\u4F8B\u5982 0",priorityHint:"\u4EE5 --priority \u542F\u52A8\u7684\u7AEF\u70B9\u7684\u8C03\u5EA6\u4F18\u5148\u7EA7\uFF0C\u6570\u503C\u8D8A\u5C0F\u8D8A\u5148\u6267\u884C\u3002\u7559\u7A7A\u8868\u793A\u4E0D\u53D1\u9001\u3002",priorityInvalid:"\u4F18\u5148\u7EA7\u5FC5\u987B\u662F\u6574\u6570\u2014\u2014\u4FEE\u6B63\u524D\u4E0D\u4F1A\u4FDD\u5B58\u3002",maxOutputLabel:"\u8BF7\u6C42\u4E2D\u7684 max_output_tokens",maxOutputUnset:"\u672A\u8BBE\u7F6E\u2014\u2014\u8DDF\u968F\u534F\u8BAE\u9ED8\u8BA4",maxOutputOn:"\u53D1\u9001",maxOutputOff:"\u4E0D\u53D1\u9001",maxOutputHint:'\u4EC5\u5BF9 Responses \u534F\u8BAE\u7684\u7F51\u5173\u751F\u6548\uFF0C\u4E14\u53EA\u5728\u8BF7\u6C42\u5E26\u8F93\u51FA\u4E0A\u9650\u65F6\u624D\u8D77\u4F5C\u7528\uFF1A\u90E8\u5206\u7F51\u5173\u4F1A\u62D2\u6536\u8BE5\u53C2\u6570\uFF0C\u9009"\u4E0D\u53D1\u9001"\u53EF\u8BA9\u8BF7\u6C42\u5B8C\u5168\u4E0D\u643A\u5E26\u8F93\u51FA\u4E0A\u9650\u3002\u672A\u8BBE\u7F6E\u662F\u6700\u5B89\u5168\u7684\u9009\u62E9\u3002',aliasMigrated:"\u68C0\u6D4B\u5230\u65E7\u522B\u540D\u2014\u2014\u4FDD\u5B58\u65F6\u4F1A\u5199\u5165\u663E\u5F0F\u9884\u7B97\u5B57\u6BB5\u3002",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",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}",keysEnabled:"\u542F\u7528",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",keysEnabledNote:"\u5DF2\u542F\u7528 {name}\u3002",keysUnreachable:"\u63D2\u4EF6\u7684\u5BC6\u94A5\u63A5\u53E3\u6CA1\u6709\u54CD\u5E94\u3002",keysPanelFailed:"\u5BC6\u94A5\u7BA1\u7406\u9762\u677F\u6E32\u67D3\u5931\u8D25",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",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",headersUserAgentTitle:"User-Agent\uFF08\u7531\u63D2\u4EF6\u5728\u8BF7\u6C42\u5C42\u63A5\u7BA1\uFF09",headersUserAgentHint:"\u5B98\u65B9\u9002\u914D\u5668\u4F1A\u4E22\u5F03\u914D\u7F6E\u7684 user-agent\uFF08\u8BE5\u540D\u79F0\u4FDD\u7559\u7ED9\u5BA2\u6237\u7AEF\u5F52\u5C5E\u6807\u8BC6\uFF09\uFF0C\u6240\u4EE5\u7531\u63D2\u4EF6\u5728\u8BF7\u6C42\u5C42\u8865\u4E0A\u3002\u586B\u4E86\u5C31\u4F1A\u771F\u6B63\u66FF\u6362\u4E0A\u884C\u8BF7\u6C42\u5934\u91CC\u7684 User-Agent\u3002",headersUserAgentClear:"\u4E0D\u8986\u76D6",headersUserAgentPlaceholder:"\u4F8B\u5982 claude-cli/2.1.161 (external, cli)",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",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"};var Jt="dsh-model-think-level.slider.enabled",Id=["dsh-reasoning-effort.enabled","@dsh-external/dsh-reasoning-effort.enabled"],Et=Pd();function Pd(){try{let e=window.localStorage.getItem(Jt),t=e===null?Id.map(n=>window.localStorage.getItem(n)).find(n=>n!==null):null;return(e??t??null)!=="false"}catch{return!0}}var ir=new Set;function Ho(){for(let e of[...ir])e()}function ye(){return Et}function Oo(e){if(Et!==e){Et=e;try{window.localStorage.setItem(Jt,String(e))}catch{}Ho()}}function _o(e){Et!==e&&(Et=e,Ho())}function Xt(e){return ir.add(e),()=>{ir.delete(e)}}var Qt="dsh-model-think-level.provider-order",No=["deepseek-account","deepseek-official"];function it(e){if(e===null)return[];try{let t=JSON.parse(e);return Array.isArray(t)?ar(t.filter(n=>typeof n=="string")):[]}catch{return[]}}function ar(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 ot=(()=>{try{return it(window.localStorage.getItem(Qt))}catch{return[]}})(),sr=new Set;function Do(){for(let e of[...sr])e()}function Co(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function dr(){return ot}function Io(e){let t=ar(e);if(!Co(ot,t)){ot=t;try{window.localStorage.setItem(Qt,JSON.stringify(ot))}catch{}Do()}}function Po(e){let t=ar(e);Co(ot,t)||(ot=t,Do())}function Zt(e){return sr.add(e),()=>{sr.delete(e)}}function lr(e){let t=n=>{let r=No.indexOf(n);return r<0?No.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 st(e,t){let n=new Map;for(let s of t)n.has(s)||n.set(s,n.size);let r=[],o=[];e.forEach((s,a)=>{n.has(s)&&(r.push(a),o.push(s))}),o.sort((s,a)=>n.get(s)-n.get(a));let i=[...e];return r.forEach((s,a)=>{i[s]=o[a]}),i}function Fo(e){return st(lr(e),dr())}function ur(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 en="dsh-model-think-level.providers.disabled",fr=new Set,qe=Fd();function Fd(){try{return it(window.localStorage.getItem(en))}catch{return[]}}function qo(e){return it(e)}function Ko(){return qe}function at(e){return!qe.includes(e)}function Bo(e,t){let n=!qe.includes(e);t!==n&&Uo(t?qe.filter(r=>r!==e):[...qe,e],!0)}function Wo(e){Uo(e,!1)}function tn(e){return fr.add(e),()=>{fr.delete(e)}}function qd(e,t){return e.length!==t.length?!1:e.every(n=>t.includes(n))}function Uo(e,t){if(!qd(qe,e)){if(qe=[...new Set(e)],t)try{window.localStorage.setItem(en,JSON.stringify(qe))}catch{}for(let n of[...fr])n()}}var nn="dsh-model-think-level.model-order";function pr(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=jo(o.filter(s=>typeof s=="string"));i.length>0&&(n[r]=i)}return n}catch{return{}}}function jo(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 Ge=(()=>{try{return pr(window.localStorage.getItem(nn))}catch{return{}}})(),cr=new Set;function Go(){for(let e of[...cr])e()}function Kd(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Bd(){try{window.localStorage.setItem(nn,JSON.stringify(Ge))}catch{}}function zo(){return Ge}function $o(e){return Ge[e]??Wd}var Wd=[];function Vo(e,t){if(e.length===0)return;let n=jo(t),r=$o(e);if(Kd(r,n)&&(n.length>0||!(e in Ge)))return;let o={...Ge};n.length===0?delete o[e]:o[e]=n,Ge=o,Bd(),Go()}function Yo(e){Ge=e,Go()}function rn(e){return cr.add(e),()=>{cr.delete(e)}}function Ud(e,t){return st(e,t)}function Jo(e,t){return st(t,$o(e))}function Xo(e,t){if(e.length===0||t.length===0)return e;let n=new Map(e.map(r=>[r.id,r]));return Ud(e.map(r=>r.id),t).map(r=>n.get(r))}var Qo=`
8
8
  /* The injector's mount wrapper. It \u2014 not the editor inside it \u2014 is the item
9
9
  placed into the official row disclosure's repeat(auto-fit, minmax(160px,1fr))
10
10
  grid (context window and max tokens take two cells), so the span belongs
@@ -1585,6 +1585,28 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
1585
1585
  pair. The section's own visibility stays a pane decision (below). */
1586
1586
  .bre-tabbed .bre-headers-host { display: block; }
1587
1587
 
1588
+ /* The create-provider card's CUSTOM form has no slot to render a bar into: the
1589
+ official page dispatches the provider-card slot inside the catalogue half
1590
+ only, so the create-card pass (injection/add-card.ts) mounts a bar of its own
1591
+ at the top of the form. Same contract as the mount above \u2014 hidden until the
1592
+ pass marks the card, the card's own gap rhythm once it does \u2014 so an
1593
+ untaken-over card is exactly the official one. */
1594
+ .bre-create-host {
1595
+ display: none;
1596
+ }
1597
+ .bre-tabbed .bre-create-host {
1598
+ display: block;
1599
+ }
1600
+
1601
+ /* With the custom API form the only way left to add a provider, the official
1602
+ "How to add" switch has nothing to switch. The pass hides it ONLY once that
1603
+ form is really up: a card that has no custom form to offer, or a takeover
1604
+ that stepped back, keeps the switch \u2014 and with it the official explanation
1605
+ of why the other half is unavailable. */
1606
+ .bre-add-mode-picker {
1607
+ display: none;
1608
+ }
1609
+
1588
1610
  .bre-editor-tab {
1589
1611
  flex: 1 1 0;
1590
1612
  min-width: 0;
@@ -1636,11 +1658,24 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
1636
1658
  display: none !important;
1637
1659
  }
1638
1660
 
1639
- /* The advanced tab: the official body \u2014 fields, model list, action row and the
1640
- editor's own header \u2014 steps aside for the request-header section, which is a
1641
- complete form with its own save/cancel and becomes the pane under the very
1642
- same bar. */
1643
- .bre-tabbed[data-bre-tab='advanced'] [data-bre-editor-body] {
1661
+ /* The advanced tab: the official body \u2014 fields, model list \u2014 steps aside for the
1662
+ request-header section, which is a complete form with its own save/cancel and
1663
+ becomes the pane under the very same bar. What does NOT step aside is the
1664
+ card's own commit row wherever the pass has marked one (data-bre-footer): on
1665
+ the create card that row IS the \u521B\u5EFA\u63D0\u4F9B\u5546 this pane's draft is written with,
1666
+ and a user who has just typed the headers is standing on this tab. An ordinary
1667
+ card keeps the old behaviour \u2014 its body steps aside wholesale, advanced pane
1668
+ and save included, because that pane carries a save of its own. */
1669
+ .bre-tabbed[data-bre-tab='advanced'] [data-bre-editor-body]:not([data-bre-footer]) {
1670
+ display: none !important;
1671
+ }
1672
+
1673
+ /* A card whose commit row is kept: the body and every wrapper on the path to that
1674
+ row stay, but inside them only the path shows. The row is marked 'row' and not
1675
+ 'path' on purpose: a wrapper's unmarked children are exactly the fields and
1676
+ layout the tab is stepping away from, while the row's children are the buttons
1677
+ being kept. Panes the tabs own stay hidden by the region rule above. */
1678
+ .bre-tabbed[data-bre-tab='advanced'] [data-bre-footer='path'] > *:not([data-bre-footer]) {
1644
1679
  display: none !important;
1645
1680
  }
1646
1681
 
@@ -1745,20 +1780,30 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
1745
1780
  strands the fetch link in the middle of the card. So the free space is handed
1746
1781
  to the fetch link's own leading auto margin instead \u2014 an auto margin absorbs
1747
1782
  the space BEFORE justify-content is consulted, whatever the official rule
1748
- says. The fetch link is the button the seat sits after, which is also the
1749
- only control present when the provider is not overridden: the pair then
1750
- simply holds the right edge. align-items centres the taller host links
1751
- against the seat. */
1783
+ says. align-items centres the taller host links against the seat.
1784
+
1785
+ The pin must NOT wait for the seat to exist: a card with no models shows the
1786
+ fetch link alone, and space-between puts a lone child at the START \u2014 so the
1787
+ link sat at the left edge until the first fetch seated the control beside it
1788
+ and shoved it right, the jump the user reported. Hence two selectors: the
1789
+ link that the seat follows, and the fetch link while it is still the LAST
1790
+ control of the head (the seat is a button too, so a last-of-type selector
1791
+ alone would eventually pin the seat instead). Either way the link holds the
1792
+ right edge from the first paint to the last. */
1752
1793
  .bre-tabbed[data-bre-tab='models'] [data-bre-editor-body] [class*='modelListHead'] {
1753
1794
  align-items: center;
1754
1795
  }
1755
- .bre-tabbed[data-bre-tab='models'] [data-bre-editor-body] [class*='modelListHead'] > button:has(+ .bre-auto-effort) {
1796
+ .bre-tabbed[data-bre-tab='models'] [data-bre-editor-body] [class*='modelListHead'] > button:has(+ .bre-auto-effort),
1797
+ .bre-tabbed[data-bre-tab='models'] [data-bre-editor-body] [class*='modelListHead'] > button:not(.bre-auto-effort):last-of-type {
1756
1798
  margin-left: auto;
1757
1799
  }
1758
1800
 
1759
1801
  /* The click's answer, as a bubble at the top of the window that takes itself
1760
- away again. The control is left alone on purpose: its label is what the user
1761
- aimed at, and a button that rewrites itself is a button that moved. The
1802
+ away again \u2014 and the official save line's answer too
1803
+ (injection/saved-notice.ts), which is raised the same way with the same
1804
+ done phase, so one shape covers both. The control is left alone on
1805
+ purpose: its label is what the user aimed at, and a button that rewrites
1806
+ itself is a button that moved. The
1762
1807
  bubble is a fixed overlay on the body \u2014 not a child of the head, which is the
1763
1808
  host's flex row and would take a fourth item \u2014 and it clears the settings
1764
1809
  dialog's opaque overlay for the same reason the drop line does. It follows
@@ -2168,7 +2213,7 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
2168
2213
  .bre-key-eye { transition: none; }
2169
2214
  .bre-keys-mark, .bre-keys-actions, .bre-keys-add { transition: none; }
2170
2215
  }
2171
- `;var vt=require("react"),ti=require("react-dom");var M=require("react"),ur=require("react-dom"),zo=require("react-dom");var Co=["off","minimal","low","medium","high","xhigh","max"],nd=["text","image"];var rd=[{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:105e4,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\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:105e4,maxTokens:128e3,note:"GPT-5.5 \u6863\u4F4D\uFF1ANone / Low / Medium(\u9ED8\u8BA4) / High / XHigh\uFF0C\u5E26\u56FE\u8F93\u5165\u3002pro \u53D8\u4F53\u4EC5 Medium / High(\u9ED8\u8BA4) / XHigh \u4E14\u4EC5 Responses API\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:105e4,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\uFF1Bmini/nano \u4E3A 400K \u4E0A\u4E0B\u6587\u3002"},{id:"openai-gpt-5-3",patterns:["gpt-5.3"],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.3-Codex \u6863\u4F4D\uFF1ALow / Medium / High / XHigh\uFF08\u65E0 None \u6863\uFF09\uFF0C\u5E26\u56FE\u8F93\u5165\u3001400K\uFF1Bgpt-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-chat",patterns:["gpt-5.1-chat-latest","gpt-5.2-chat-latest","gpt-5.3-chat-latest","gpt-5-chat-latest","gpt-chat-latest","gpt-5-chat","gpt-5.1-chat","gpt-5.2-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\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-astra",patterns:["gpt-6-astra","gpt-6"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:105e4,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\uFF0C1,050,000 \u4E0A\u4E0B\u6587 / 128,000 \u8F93\u51FA\uFF1BAI \u5B98\u65B9\u9ED8\u8BA4\u6863\u4F4D\u672A\u516C\u5E03\uFF0C\u6545\u4E0D\u586B\u3002\u5DE5\u5177\u8C03\u7528\u9700\u8D70 Responses API\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",patterns:["claude-fable-5","claude-mythos-5","claude-opus-5","claude-sonnet-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 \u4EE3\uFF08Fable 5 / Mythos 5 / Opus 5 / Sonnet 5\uFF09\u6863\u4F4D\uFF1ALow / Medium / High(\u9ED8\u8BA4) / XHigh / Max\uFF1BFable 5.1 \u4E0E Mythos 5.1 \u89C1\u5355\u72EC\u6761\u76EE\uFF0CMythos Preview \u4EC5\u81F3 Max\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:{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 Fable 5.1 / Mythos 5.1\uFF1A\u5B98\u65B9\u6863\u4F4D Low / Medium / High(\u9ED8\u8BA4) / XHigh / Max\uFF0C\u81EA\u9002\u5E94\u601D\u8003\u5E38\u5F00\uFF08\u4E0D\u63A5\u53D7 enabled/disabled\uFF09\u30021M \u4E0A\u4E0B\u6587 / 128K \u8F93\u51FA\uFF1B\u8FD9\u4E24\u578B\u4E5F\u662F\u5B98\u65B9\u552F\u4E00\u5141\u8BB8\u4F1A\u8BDD\u4E2D\u9014\u6539\u6863\u7684\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\u3002"},{id:"anthropic-claude-opus-4-high",patterns:["claude-opus-4-8","claude-opus-4-7"],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 Opus 4.7/4.8 \u6863\u4F4D\uFF1ALow / Medium / High(\u9ED8\u8BA4) / XHigh / Max\uFF1Bxhigh \u4E3A\u5B98\u65B9\u63A8\u8350\u7684\u7F16\u7801\u8D77\u6B65\u6863\u30021M \u4E0A\u4E0B\u6587\u3002"},{id:"anthropic-claude-4-6",patterns:["claude-opus-4-6","claude-sonnet-4-6"],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 4.6 \u4EE3\u6863\u4F4D\uFF1ALow / Medium / High / Max\uFF08\u65E0 XHigh\u2014\u2014\u5B98\u65B9\u660E\u8A00\u300C\u652F\u6301 max \u7684\u90E8\u5206\u578B\u53F7\u4E0D\u652F\u6301 xhigh\u300D\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 Fable/Mythos 5\u3001Opus 5/4.6-4.8\u3001Sonnet 5/4.6\u3001Opus 4.5 \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\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\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,note:'Grok 4.7\uFF08\u4E0A\u6E38\u5FEB\u7167 grok-4.7-20260916\uFF09\uFF1A\u6863\u4F4D Low / Medium / High / XHigh\u2014\u2014**\u53D6\u81EA\u516C\u5F00\u76EE\u5F55**\uFF08OpenRouter \u7684 supported_parameters\u3001models.dev \u5BF9 docs.x.ai \u7684\u8F6C\u8FF0\uFF09\uFF0C\u672C\u6B21 xAI \u5B98\u65B9\u6587\u6863\u7AD9\u4E0D\u53EF\u8FBE\u3001\u672A\u80FD\u4E00\u624B\u8BC1\u5B9E\uFF1B\u9ED8\u8BA4\u6863\u4F4D\u4E0E"\u80FD\u5426\u5173\u95ED\u601D\u8003"\u540C\u6837\u672A\u8BC1\u5B9E\uFF0C\u6545\u4E0D\u58F0\u660E Off\uFF0C\u4E5F\u4E0D\u5199\u9ED8\u8BA4\u6863\u3002\u5E26\u56FE\u8F93\u5165\uFF08\u76EE\u5F55\u8BB0 text+image+file\uFF0CPDF \u5B58\u7591\uFF09\uFF0C500K \u4E0A\u4E0B\u6587\uFF1B\u6700\u5927\u8F93\u51FA\u5404\u76EE\u5F55\u7ED9\u51FA 450K \u4E0E 500K \u4E24\u79CD\u503C\uFF0C\u6309"\u5206\u6B67\u5373\u4E0D\u5199"\u5904\u7406\u30022026-08 \u90A3\u6B21"grok-4.7 \u4E0D\u5B58\u5728\uFF08\u5B98\u65B9 404\uFF09"\u7684\u7ED3\u8BBA\u5DF2\u968F\u53D1\u5E03\u4F5C\u5E9F\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",xhigh:"xhigh"},defaultEffort:"low",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1e6,note:"Grok 4.3\uFF1A\u5B98\u65B9\u56DB\u7EA7 reasoning effort\uFF08None / Low / Medium / High\uFF09\uFF0C1M \u4E0A\u4E0B\u6587\u3001\u5E26\u56FE\u8F93\u5165\uFF1Bgrok-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:!1,input:["text"],contextWindow:32768,maxTokens:32768,note:"Magistral \u539F\u751F\u601D\u8003\u7EBF\uFF08\u65E0 effort \u53C2\u6570\uFF0C\u4E3A prompt_mode \u8BED\u4E49\uFF09\uFF0C\u5B98\u65B9\u5DF2\u4E8E 2026-07-28 \u58F0\u660E\u5F03\u7528\u3001\u9010\u6B65\u64A4\u51FA\uFF1B\u73B0\u5F79\u63A8\u7406\u8D70 mistral-small-2603 / mistral-medium-3-5 \u7684 reasoning_effort\uFF08\u89C1\u4E0B\u6761\uFF09\u3002"},{id:"mistral-medium-3",patterns:["mistral-medium-3.5","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\uFF1ANone / High\u2014\u2014\u5B98\u65B9 reasoning_effort \u679A\u4E3E\uFF08mistral-common \u534F\u8BAE\u5E93\uFF09\u5373 none/high\uFF1Bmistral-small-2603\uFF08Small 4\uFF09\u4E0E mistral-medium-3-5 \u7ECF\u5B83\u63A7\u5236\uFF0CMedium 3.5 \u5E26\u89C6\u89C9\u3002\u5BB9\u91CF\u672A\u5728\u5B98\u65B9\u76EE\u5F55\u9875\u5355\u5217\uFF0C\u4E0D\u63D0\u4F9B\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"],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-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-m3",patterns:["minimax-m3"],efforts:{off:null,high:"high"},compat:{thinkingFormat:"deepseek"},input:["text","image"],contextWindow:1048576,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\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"}],tr={off:null,low:"low",medium:"medium",high:"high"},od={"openai-completions":tr,"openai-responses":tr,"anthropic-messages":tr,deepseek:{off:"none",low:"low",high:"high",max:"max"}},id={low:"low",medium:"medium",high:"high"};function yt(e){return(e??"").toLowerCase().trim()}function Do(e){return e!==void 0&&/[a-z0-9]/.test(e)}function bt(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g," ")}function Fo(e,t,n){let r=t===0?void 0:e[t-1],o=e[t+n];return!Do(r)&&!Do(o)}function rr(e,t){let n=bt(e)+" "+bt(t??""),r;for(let o of rd)for(let i of o.patterns){let s=bt(i),a=n.indexOf(s);for(;a>=0;){if(Fo(n,a,s.length)){(r===void 0||s.length>r.length)&&(r={entry:o,length:s.length});break}a=n.indexOf(s,a+1)}}return r?.entry}var sd={"deepseek.com":"deepseek","anthropic.com":"anthropic-messages"};function ad(e){let t=yt(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=sd[o.slice(-2).join(".")];if(i!==void 0)return i}}catch{}return"openai-completions"}var Jt="openai-completions",Ko="anthropic-messages";function nr(e){if(e===void 0||e.length===0)return!1;let t="";try{t=new URL(e).hostname.toLowerCase()}catch{return!1}return t==="localhost"||t==="::1"||t.endsWith(".local")||t.endsWith(".internal")||/^(127\.|10\.|192\.168\.)/.test(t)||/^172\.(1[6-9]|2[0-9]|3[01])\./.test(t)?!0:t.includes(":")}function dd(e,t){let n=yt(t),r={...e};if(delete r.supportsMidConvoEffort,delete r.allowedFallbackModels,n===Ko){for(let o of["thinkingFormat","supportsReasoningEffort","thinkingTokenBudgetField","supportsThinkingTokenBudget","vllmPriority","supportsMaxOutputTokens"])delete r[o];return r.forceAdaptiveThinking===void 0?void 0:{forceAdaptiveThinking:r.forceAdaptiveThinking}}if(n==="openai-responses"){for(let o of["thinkingFormat","supportsReasoningEffort","thinkingTokenBudgetField","supportsThinkingTokenBudget","vllmPriority"])delete r[o];return r.supportsMaxOutputTokens===void 0?void 0:{supportsMaxOutputTokens:r.supportsMaxOutputTokens}}if(n===Jt)return delete r.forceAdaptiveThinking,delete r.supportsMaxOutputTokens,Object.keys(r).length===0?void 0:r}function ld(e,t){let n=yt(t.api);if(n===Jt){let r=e.compat;return r!==void 0&&(r=dd(r,n)??void 0),r===void 0&&!nr(t.baseURL)?void 0:r===void 0?{thinkingTokenBudgetField:"thinking_token_budget"}:r.thinkingTokenBudgetField===void 0&&r.supportsThinkingTokenBudget!==!0&&nr(t.baseURL)?{...r,thinkingTokenBudgetField:"thinking_token_budget"}:r}if(n===Ko&&e.anthropicAdaptive===!0)return{forceAdaptiveThinking:!0}}var ud=["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 or(e){if(yt(e.api)!==Jt)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(".")?!ud.some(r=>n===r||n.endsWith("."+r)):!1}catch{return!1}}function Io(e,t,n){return e===void 0||!n||e.supportsDeveloperRole!==void 0||!or(t)?e:{...e,supportsDeveloperRole:!1}}var Po={off:null,low:"low",medium:"medium",high:"high"},fd=["vl","vision","omni","4o","pixtral","internvl"];function ir(e){let t=bt(e);for(let n of fd){let r=bt(n),o=t.indexOf(r);for(;o>=0;){if(Fo(t,o,r.length))return["text","image"];o=t.indexOf(r,o+1)}}}function cd(e){if(e===void 0)return;let t=e.map(n=>n.toLowerCase());if(t.some(n=>nd.includes(n)))return t.includes("image")?["text","image"]:["text"]}function he(e,t,n){let r=rr(e,t.displayName),o,i,s,a;r?.input!==void 0&&(o=r.input,i="knowledge"),r?.contextWindow!==void 0&&(s=r.contextWindow),r?.maxTokens!==void 0&&(a=r.maxTokens);let d=cd(n?.input);if(d!==void 0&&(o=d,i="endpoint"),n?.contextLength!==void 0&&Number.isFinite(n.contextLength)&&n.contextLength>0&&(s=n.contextLength),o===void 0){let y=ir(e);y!==void 0&&(o=y,i="heuristic")}let u={...o===void 0?{}:{input:o},...i===void 0?{}:{inputSource:i},...s===void 0?{}:{contextWindow:s},...a===void 0?{}:{maxTokens:a}},g=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",...g,...u};if(r!==void 0){let y=Io(ld(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}:{},...y===void 0?{}:{compat:y},matched:!0,entryId:r.id,source:r.id,confidence:"high",...g,...u}}let p=ad(t),m=od[p]??id,l=yt(t.api)===Jt?{thinkingFormat:"openai",supportsReasoningEffort:!0}:void 0,c=l!==void 0&&nr(t.baseURL)?{...l,thinkingTokenBudgetField:"thinking_token_budget"}:l,f=Io(c,t,!0);return n?.reasoning===!0?{efforts:{...Po},...Po.medium!==void 0?{defaultEffort:"medium"}:{},...f===void 0?{}:{compat:f},matched:!1,source:"endpoint:"+(n.source??"listing"),confidence:"medium",...g,...u}:{efforts:m,...m.medium!==void 0?{defaultEffort:"medium"}:{},...f===void 0?{}:{compat:f},matched:!1,source:"protocol:"+p,confidence:"low",...g,...u}}var qo="dsh-model-think-level.slider.efforts",sr="breSelectWired";function ar(e){return typeof e=="object"&&e!==null&&e.ok===!1}function dr(e){if(!ar(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 Ue(e,t){return`${e}/${t}`}function Bo(){try{let e=window.localStorage.getItem(qo);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 pd(e){try{window.localStorage.setItem(qo,JSON.stringify(e))}catch{}}function md(e,t,n){let r=Bo();r[Ue(e,t)]=n,pd(r)}function gd(e,t){return Bo()[Ue(e,t)]}function Xt(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 hd(e,t,n){return e.groups.find(o=>o.id===t)?.models.find(o=>o.id===n)?.reasoning?.defaultEffort}function bd(e){if(!(e.length<2))return e[Math.floor((e.length-1)/2)]}function yd(e,t){return e===null||e.provider!==t.provider||e.model!==t.model}async function Wo(e,t,n,r,o){let i=Xt(e,t,n);if(i.length===0)return;let s=Ue(t,n),a=r.get(s);if(a!==void 0&&i.includes(a))return a;let d=await o?.configuredEffort?.(t,n);if(d!==void 0&&i.includes(d))return d;let u=gd(t,n);if(u!==void 0&&i.includes(u))return u;let g=he(n,{}).defaultEffort;if(g!==void 0&&i.includes(g))return g;let p=hd(e,t,n);return p!==void 0&&i.includes(p)?p:bd(i)}function Uo(e,t){let n=e;if(n[sr]===!0)return()=>{};let r=Object.prototype.hasOwnProperty.call(n,"select"),o=e.select,i=new Map,s=new Set,a=new Map,d=3,u=0,g=async l=>{let c=++u;if(l.reasoningEffort!==void 0){let b=await o.call(e,l);return!ar(b)&&fe()&&(i.set(Ue(l.provider,l.model),l.reasoningEffort),md(l.provider,l.model,l.reasoningEffort)),b}let f=e.store.getSnapshot();if(!yd(f.current,l)){if(fe()){let b=Ue(l.provider,l.model);i.delete(b),s.add(b)}return o.call(e,l)}if(!fe())return o.call(e,l);let y=await Wo(f,l.provider,l.model,i,t),k=e.store.getSnapshot();if(!(u!==c||((b,T)=>b===null||T===null?b!==T:b.provider!==T.provider||b.model!==T.model||b.reasoningEffort!==T.reasoningEffort)(k.current,f.current)))return!fe()||y===void 0||!Xt(k,l.provider,l.model).includes(y)?o.call(e,l):o.call(e,{...l,reasoningEffort:y})},p=()=>{let l=e.store.getSnapshot(),c=l.current;if(c===null||c.reasoningEffort!==void 0||!fe())return;let f=Ue(c.provider,c.model);if(s.has(f))return;if(Xt(l,c.provider,c.model).length===0){s.add(f);return}s.add(f);let y=u;Wo(l,c.provider,c.model,i,t).then(async k=>{if(k===void 0){s.delete(f);return}if(!fe()){s.delete(f);return}let h=e.store.getSnapshot(),b=h.current;if(u!==y||b===null||b.reasoningEffort!==void 0||Ue(b.provider,b.model)!==f||!Xt(h,b.provider,b.model).includes(k))return;let T=await o.call(e,{provider:b.provider,model:b.model,reasoningEffort:k});if(ar(T))throw T}).catch(()=>{let k=(a.get(f)??0)+1;a.set(f,k),k<d&&(s.delete(f),p())})},m=e.store.subscribe(p);return p(),n[sr]=!0,e.select=g,()=>{delete n[sr],m(),r?e.select=o:delete n.select}}function wd(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 vd(e){return e.current}function xd(e,t){let n=vd(t),r=e.findIndex(a=>a.id===n?.reasoningEffort);if(r>=0)return r;let i=t.groups.find(a=>a.id===n?.provider)?.models.find(a=>a.id===n?.model)?.reasoning?.defaultEffort,s=i===void 0?-1:e.findIndex(a=>a.id===i);return s>=0?s:Math.floor((e.length-1)/2)}function jo(e){return e.models??[]}function ot(e){let t=e;return t.name??t.label??t.title??e.id}function lr(e){return(0,M.createElement)("span",{className:"bre-row-chevron"+(e?" is-open":""),"aria-hidden":!0},"\u203A")}function kd(){let[e,t]=(0,M.useState)(null),n=(0,M.useRef)(0);(0,M.useEffect)(()=>()=>{window.clearTimeout(n.current)},[]);let r=(0,M.useCallback)(()=>{window.clearTimeout(n.current),t(null)},[]),o=(0,M.useCallback)((i,s)=>{window.clearTimeout(n.current);let a=i.currentTarget;a.scrollWidth<=a.clientWidth+1||(n.current=window.setTimeout(()=>{t({target:a,text:s})},300))},[]);return{tip:e,onEnter:o,onLeave:r}}function Ed({state:e}){if(typeof document>"u")return null;let t=e.target.getBoundingClientRect(),n=Math.max(12,Math.min(t.right,window.innerWidth-12));return(0,zo.createPortal)((0,M.createElement)("div",{className:"bre-tip",role:"tooltip",style:{top:Math.min(t.bottom+6,window.innerHeight-40),right:Math.max(12,window.innerWidth-n)}},e.text),document.body)}function Td(){return(0,M.createElement)("svg",{className:"bre-option-check",width:14,height:14,viewBox:"0 0 16 16",fill:"none","aria-hidden":!0},(0,M.createElement)("path",{d:"M3.5 8.5l3 3 6-7",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"}))}var Go=new Map;function Ld(e){if(Array.isArray(e.input))return e.input.includes("image");let t=Go.get(e.id);if(t!==void 0)return t;let n=rr(e.id,e.name)?.input,r=n!==void 0?n.includes("image"):(ir(e.id)??[]).includes("image");return Go.set(e.id,r),r}function Md(e){let t=e.reasoning?.efforts;return Array.isArray(t)&&t.length>0}function Sd(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 Ad(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 Rd(e,t){let n=[];return Ld(e)&&n.push((0,M.createElement)("span",{key:"vision",className:"bre-tag",title:t("tagVision")},Sd(t("tagVision")))),Md(e)&&n.push((0,M.createElement)("span",{key:"thinking",className:"bre-tag",title:t("tagThinking")},Ad(t("tagThinking")))),n.length===0?null:(0,M.createElement)("span",{className:"bre-option-tags"},...n)}function $o(e){let{directory:t,t:n}=e,r=e.onLayoutChange,o=(0,M.useSyncExternalStore)(L=>t.store.subscribe(L),()=>t.store.getSnapshot()),i=wd(o),[s,a]=(0,M.useState)(""),[d,u]=(0,M.useState)(null),[g,p]=(0,M.useState)(null),[m,l]=(0,M.useState)(!1),[c,f]=(0,M.useState)(null),y=(0,M.useRef)(null),k=(0,M.useRef)(""),h=(0,M.useRef)(!1),b=o.current!==null&&i.length>=2,T=m||o.status==="selecting",w=c??o.error,E=t.select;(0,M.useEffect)(()=>{if(h.current)return;let L=xd(i,o),Y=i[L]?.id??"";k.current=Y,a(Y),f(null)},[b,i,o]),(0,M.useEffect)(()=>{t.load().catch(()=>{})},[t]);let R=o.current,W=o.groups.find(L=>L.id===R?.provider),C=W?.models.find(L=>L.id===R?.model)?.name??(R===null?n("triggerFallback"):R.model),P=R===null?C:ot(W??{id:R.provider})+" \xB7 "+C,A=i.find(L=>L.id===s)?.name??n("effortDefault"),D=(0,M.useSyncExternalStore)(Gt,Yn),V=(0,M.useSyncExternalStore)($t,xo),$=(0,M.useSyncExternalStore)(Yt,So),Q=o.groups.filter(L=>jo(L).length>0&&!V.includes(L.id)).map(L=>L.id),F=nt(Jn(Q),D),K=g!==null&&F.includes(g)?g:R!==null&&F.includes(R.provider)?R.provider:F[0]??null,S=K===null?[]:No(jo(o.groups.find(L=>L.id===K)),$[K]??[]),I=R===null?"":R.provider+"/"+R.model,H=(0,M.useCallback)(L=>{d!==L&&((0,ur.flushSync)(()=>{u(L)}),r?.())},[r,d]),Z=(0,M.useCallback)(()=>{d!==null&&((0,ur.flushSync)(()=>{u(null)}),r?.())},[r,d]),oe=(0,M.useCallback)(()=>{let L=y.current?.closest('[role="menu"]');L!=null&&(L.tabIndex=-1,L.focus({preventScroll:!0}))},[]),Ke=(0,M.useCallback)(async(L,Y)=>{if(h.current)return;let z=t.store.getSnapshot().current;if(Z(),!(z!==null&&z.provider===L&&z.model===Y)){h.current=!0,oe(),l(!0),f(null);try{let se=await E({provider:L,model:Y}),Re=dr(se);if(Re!==void 0)throw new Error(Re)}catch(se){f(se instanceof Error?se.message:String(se))}finally{h.current=!1,l(!1)}}},[Z,t,oe,E]),Xe=(0,M.useCallback)(async L=>{if(h.current||(Z(),L===o.current?.reasoningEffort&&o.status!=="error"))return;h.current=!0;let Y=k.current;oe(),l(!0),f(null),a(L);try{let z=o.current;if(z===null)throw new Error(n("sliderNoCurrent"));let se=await E({provider:z.provider,model:z.model,reasoningEffort:L}),Re=dr(se);if(Re!==void 0)throw new Error(Re);let Ct=t.store.getSnapshot(),mt=i.find(Ft=>Ft.id===Ct.current?.reasoningEffort)?.id??L;k.current=mt,a(mt)}catch(z){k.current=Y,a(Y),f(z instanceof Error?z.message:String(z))}finally{h.current=!1,l(!1)}},[Z,t,oe,i,E,o.current,o.status,n]),{tip:Ae,onEnter:We,onLeave:qe}=kd(),Pt=[(0,M.createElement)("button",{key:"row:model",type:"button",role:"menuitem",className:"bre-row-control"+(d==="model"?" is-open":""),disabled:T,"aria-expanded":d==="model",onMouseLeave:qe,onClick:()=>{H(d==="model"?null:"model")}},(0,M.createElement)("span",{className:"bre-row-label"},n("modelRowLabel")),(0,M.createElement)("span",{className:"bre-row-value","aria-label":P,onMouseEnter:L=>{We(L,P)}},P),lr(d==="model")),d==="model"?(0,M.createElement)("div",{key:"panel:model",className:"bre-panel bre-panel-models"},(0,M.createElement)("div",{className:"bre-providers",role:"group","aria-label":n("modelRowLabel")},...F.map(L=>(0,M.createElement)("button",{key:L,type:"button",className:"bre-provider"+(L===K?" is-open":"")+(L===R?.provider?" is-current":""),disabled:T,"aria-expanded":L===K,onMouseLeave:qe,onClick:()=>{p(L)}},(0,M.createElement)("span",{className:"bre-option-name","aria-label":ot(o.groups.find(Y=>Y.id===L)),onMouseEnter:Y=>{We(Y,ot(o.groups.find(z=>z.id===L)))}},ot(o.groups.find(Y=>Y.id===L))),lr(L===K))),...F.length===0?[(0,M.createElement)("div",{key:"no-providers",className:"bre-empty"},n("sliderNoCurrent"))]:[]),(0,M.createElement)("div",{className:"bre-provider-models",role:"group","aria-label":n("modelRowLabel")},...S.length===0?[(0,M.createElement)("div",{key:"no-models",className:"bre-empty"},n("sliderNoCurrent"))]:S.map(L=>{let Y=K+"/"+L.id,z=Y===I;return(0,M.createElement)("button",{key:Y,type:"button",className:"bre-option"+(z?" is-active":""),disabled:T,"aria-pressed":z,onMouseLeave:qe,onClick:()=>{Ke(K,L.id)}},(0,M.createElement)("span",{className:"bre-option-name","aria-label":L.name??L.id,onMouseEnter:se=>{We(se,L.name??L.id)}},L.name??L.id),Rd(L,n))}))):null,(0,M.createElement)("div",{key:"divider",className:"bre-divider","aria-hidden":!0}),(0,M.createElement)("button",{key:"row:effort",type:"button",role:"menuitem",className:"bre-row-control"+(d==="effort"?" is-open":""),disabled:T||!b,"aria-expanded":b?d==="effort":void 0,onClick:()=>{H(d==="effort"?null:"effort")}},(0,M.createElement)("span",{className:"bre-row-label"},n("effortRowLabel")),(0,M.createElement)("span",{className:"bre-row-value"+(b?"":" is-muted")},b?A:n("sliderNoLevels")),b?lr(d==="effort"):null),d==="effort"&&b?(0,M.createElement)("div",{key:"panel:effort",className:"bre-panel",role:"group","aria-label":n("effortRowLabel")},...i.map(L=>(0,M.createElement)("button",{key:L.id,type:"button",className:"bre-option"+(L.id===s?" is-active":""),disabled:T,"aria-pressed":L.id===s,onClick:()=>{Xe(L.id)}},(0,M.createElement)("span",{className:"bre-option-name"},L.name),L.id===s?Td():null))):null];return(0,M.createElement)("div",{className:"bre-slider-body",ref:y},(0,M.createElement)("div",{className:"bre-card"},...Pt),w===null?null:(0,M.createElement)("div",{className:"bre-model-error",role:"status"},w),Ae===null?null:(0,M.createElement)(Ed,{key:"tip",state:Ae}))}var j=require("react"),Yo='section[role="group"]',cr='button[role="menuitemradio"]';function Jo(e){return e.querySelector(Yo)!==null}function fr(e){return Array.from(e.querySelectorAll(cr)).filter(t=>!t.disabled&&t.style.display!=="none")}function Hd(e){let t=e.getAttribute("aria-labelledby");return(t===null?null:e.ownerDocument.getElementById(t))?.textContent?.toLowerCase()??""}function Vo(e,t,n=new Map){let r=d=>{n.has(d)||n.set(d,d.style.display),d.style.display="none"},o=d=>{let u=n.get(d);u!==void 0&&(d.style.display=u,n.delete(d))};for(let d of[...n.keys()])d.isConnected||n.delete(d);let i=t.trim().toLowerCase().split(/\s+/).filter(Boolean),s=Array.from(e.querySelectorAll(Yo)),a=0;if(i.length===0){for(let d of[...n.keys()])o(d);for(let d of s)a+=d.querySelectorAll(cr).length;return a}for(let d of s){let u=Hd(d),g=Array.from(d.querySelectorAll(cr)),p=0;for(let m of g){let l=(m.getAttribute("title")??"").toLowerCase(),c=(m.textContent??"").toLowerCase(),f=`${u} ${l} ${c}`;i.every(y=>f.includes(y))?(o(m),p+=1):r(m)}p>0?(o(d),a+=p):r(d)}return a}function Xo({menu:e,t}){let[n,r]=(0,j.useState)(""),[o,i]=(0,j.useState)(0),s=(0,j.useRef)(null),a=(0,j.useRef)(""),d=(0,j.useRef)(new Map),u=(0,j.useCallback)(l=>{a.current=l;let c=Vo(e,l,d.current);i(c)},[e]);(0,j.useEffect)(()=>()=>{Vo(e,"",d.current)},[e]),(0,j.useEffect)(()=>{let l=new MutationObserver(()=>{a.current.trim().length!==0&&u(a.current)});return l.observe(e,{childList:!0,subtree:!0}),()=>{l.disconnect()}},[e,u]),(0,j.useEffect)(()=>{let l=c=>{if(a.current.trim().length===0)return;let f=c.key;if(!(f==="ArrowDown"||f==="ArrowUp")&&!(f==="Home"||f==="End"||f==="PageUp"||f==="PageDown")||c.target===s.current||c.target instanceof Node&&!e.contains(c.target))return;let h=fr(e);if(h.length===0)return;let b=h.findIndex(w=>w===document.activeElement),T;f==="Home"||f==="PageUp"?T=0:f==="End"||f==="PageDown"?T=h.length-1:f==="ArrowDown"?T=b===-1?0:(b+1)%h.length:T=b===-1?h.length-1:(b-1+h.length)%h.length,c.preventDefault(),c.stopPropagation(),h[T]?.focus()};return e.addEventListener("keydown",l,!0),()=>{e.removeEventListener("keydown",l,!0)}},[e]);let g=l=>{let c=l.key;if(c==="ArrowDown"){l.preventDefault(),l.stopPropagation(),fr(e)[0]?.focus();return}if(n.trim().length>0&&(c==="ArrowUp"||c==="Home"||c==="PageUp"||c==="End"||c==="PageDown")){let f=fr(e);f.length>0&&(l.preventDefault(),l.stopPropagation(),f[c==="ArrowUp"||c==="End"||c==="PageDown"?f.length-1:0]?.focus());return}c==="Escape"&&n.length>0&&(l.preventDefault(),l.stopPropagation(),r(""),u(""))},p=()=>{r(""),u(""),s.current?.focus({preventScroll:!0})},m=o===0&&n.trim().length>0;return(0,j.createElement)("div",{className:"bre-model-search-box"+(m?" has-empty":""),"data-bre-search":"1"},(0,j.createElement)("div",{className:"bre-search-input-wrapper"},(0,j.createElement)("span",{className:"bre-search-icon","aria-hidden":"true"},(0,j.createElement)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,j.createElement)("circle",{cx:"7",cy:"7",r:"4.5"}),(0,j.createElement)("path",{d:"M10.5 10.5L14 14",strokeLinecap:"round"}))),(0,j.createElement)("input",{ref:s,type:"text",className:"bre-search-input",role:"searchbox",placeholder:t("modelSearchPlaceholder"),"aria-label":t("modelSearchPlaceholder"),value:n,spellCheck:!1,autoComplete:"off",onChange:l=>{let c=l.currentTarget.value;r(c),u(c)},onKeyDown:g}),n.length>0?(0,j.createElement)("button",{type:"button",className:"bre-search-clear",title:t("modelSearchClear"),"aria-label":t("modelSearchClear"),onClick:p},(0,j.createElement)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,j.createElement)("path",{d:"M4 4L12 12M12 4L4 12",strokeLinecap:"round"}))):null),m?(0,j.createElement)("div",{className:"bre-search-empty",role:"status"},t("modelSearchNoMatches")):null)}var Qt=require("react"),Qo=require("react-dom"),Zo=require("react-dom/client");function Oe(){return document.body}function wt(e,t,n){let r=(0,Zo.createRoot)(e);return n?.sync===!0?(0,Qo.flushSync)(()=>{r.render(t)}):r.render(t),{wrapper:e,root:r}}function je(e){e!==void 0&&(e.root.unmount(),e.wrapper.remove())}var ke=class extends Qt.Component{constructor(){super(...arguments);no(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,Qt.createElement)("div",{style:{color:"#c00",fontSize:"11px",whiteSpace:"pre-wrap",padding:"6px"}},`${this.props.fallbackText}: ${this.state.error}`):this.props.children}};var ei=()=>{(0,ti.flushSync)(()=>{window.dispatchEvent(new Event("resize"))})};function ni(e){let{menuOf:t,triggerOf:n,t:r,refreshed:o,sliderEnabled:i,directory:s}=e,a,d,u,g,p,m,l=()=>{m?.removeAttribute("data-bre-provider"),m=void 0},c=()=>{let w=n();m!==void 0&&m!==w&&l();let E=g?.store.getSnapshot(),R=E?.current;if(w===void 0||R===null||R===void 0){w===m&&l();return}let W=E?.groups.find(C=>C.id===R.provider),B=W===void 0?R.provider:ot(W);if(B.trim()===""){w===m&&l();return}w.dataset.breProvider=B,m=w},f=()=>{let w=s();w!==g&&(p?.(),p=void 0,g=w,w!==void 0&&(p=w.store.subscribe(c))),c()},y=()=>{je(d),d=void 0},k=w=>{let E=w.querySelector('section[role="group"]'),R=E?.parentElement,W=R!=null&&R.parentElement===w?R:E;if(d===void 0){let B=document.createElement("div");B.dataset.plugin=X,B.dataset.breSearch="1",w.insertBefore(B,W),d=wt(B,(0,vt.createElement)(ke,{fallbackText:r("modelSearchFailed"),children:o(()=>(0,vt.createElement)(Xo,{menu:w,t:r}))}),{sync:!0});return}if(d.wrapper.parentElement!==w){w.insertBefore(d.wrapper,W);return}W!==null&&d.wrapper.nextSibling!==W&&w.insertBefore(d.wrapper,W)},h=w=>{if(!i()){je(a),a=void 0,w.classList.remove("bre-model-menu-host");for(let C of Array.from(w.children))C.getAttribute("role")==="menuitem"&&(C.style.display="");return}let E=s();if(E===void 0)return;if(a===void 0){let C=document.createElement("div");C.dataset.plugin=X,C.dataset.breSlider="1",w.insertBefore(C,w.firstChild),a=wt(C,(0,vt.createElement)(ke,{fallbackText:r("renderFailed"),children:o(()=>(0,vt.createElement)($o,{directory:E,t:r,onLayoutChange:ei}))}),{sync:!0})}else(a.wrapper.parentElement!==w||w.firstChild!==a.wrapper)&&w.insertBefore(a.wrapper,w.firstChild);w.classList.add("bre-model-menu-host");let R=Array.from(w.children).filter(C=>C.getAttribute("role")==="menuitem"),W=a.wrapper;if(Array.from(w.querySelectorAll('[role="menuitemradio"]')).some(C=>!W.contains(C)))a.wrapper.contains(document.activeElement)&&(w.tabIndex=-1,w.focus({preventScroll:!0})),a.wrapper.style.display="none";else{a.wrapper.style.display="";for(let C of R)C.style.display="none"}};return{reconcile:()=>{f();let w=t();if(w===void 0){je(a),a=void 0,y(),u=void 0;return}let E=Jo(w);E?k(w):y(),h(w),E!==u&&(u=E,(E||i())&&ei())},dispose:()=>{p?.(),p=void 0,g=void 0,l(),je(a),a=void 0,y(),u=void 0}}}var N=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function ri(e){let t=e.toLowerCase();return t.includes("compat")||t.includes("thinkingtokenbudget")||t.includes("vllmpriority")||t.includes("supportsmaxoutput")}function Zt(e,t){if(!N(e))return[];let n=e[t];return!N(n)||!Array.isArray(n.models)?[]:n.models.filter(N)}function Ge(e,t){if(!N(e))return{};let n=e[t];if(!N(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 Ne=(e,t)=>typeof e[t]=="boolean";function Od(e,t){if(Array.isArray(e)){for(let n of e)if(N(n)&&n.id===t)return n}}function Nd(e){if(!N(e))return{reasoning:"unknown",source:null};let t=e.supported_features;if(Array.isArray(t)&&t.includes("reasoning"))return{...be(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{...be(e),reasoning:!0,source:"supported_parameters"};if(Ne(e,"supports_reasoning"))return{...be(e),reasoning:e.supports_reasoning,source:"supports_reasoning"};if(Ne(e,"supportsReasoning"))return{...be(e),reasoning:e.supportsReasoning,source:"supportsReasoning"};if(Ne(e,"can_reason"))return{...be(e),reasoning:e.can_reason,source:"can_reason"};if(Ne(e,"reasoning"))return{...be(e),reasoning:e.reasoning,source:"reasoning"};let r=e.reasoning_effort;if(r!=null&&!(typeof r=="string"&&r.trim().length===0)||e.supports_reasoning_effort===!0)return{...be(e),reasoning:!0,source:"reasoning_effort"};let o=N(e.capabilities)?e.capabilities:void 0;if(o!==void 0){let i=o.thinking;if(N(i)&&typeof i.supported=="boolean")return{...be(e),reasoning:i.supported,source:"capabilities.thinking.supported"};let s=o.effort;if(N(s)&&typeof s.supported=="boolean")return{...be(e),reasoning:s.supported,source:"capabilities.effort.supported"}}return{...be(e),reasoning:"unknown",source:null}}function be(e){let t={},n=s=>{if(!Array.isArray(s))return;let a=s.filter(d=>typeof d=="string");return a.length>0?a.map(d=>d.toLowerCase()):[]},r=N(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=N(e.modalities)?e.modalities:void 0;o=n(s?.input)}if(o===void 0){let s=e.capabilities,a=d=>Array.isArray(d)&&d.some(u=>typeof u=="string"&&u.toLowerCase()==="vision");if(a(e.supported_features)||a(s))o=["image"];else if(N(s)){let d=[];for(let u of["image_input","video_input","pdf_input","file_input"]){let g=N(s[u])?s[u]:void 0;if(g===void 0||typeof g.supported!="boolean")continue;let p=u.replace(/_input$/,"");g.supported===!0?d.push(p):d.length===0&&d.push("text")}d.length>0&&(o=d)}}o===void 0&&(Ne(e,"supports_vision")?o=e.supports_vision===!0?["image"]:[]:Ne(e,"supportsVision")?o=e.supportsVision===!0?["image"]:[]:(Ne(e,"supports_images")||Ne(e,"supportsImages"))&&(o=e.supports_images===!0||e.supportsImages===!0?["image"]:[])),o!==void 0&&(t.input=o.length===0?["text"]:o);let i=e.context_length;if(typeof i=="number"&&Number.isFinite(i)&&i>0)t.contextLength=i;else{let a=(N(e.top_provider)?e.top_provider:void 0)?.context_length;if(typeof a=="number"&&Number.isFinite(a)&&a>0)t.contextLength=a;else{let d=e.max_input_tokens;if(typeof d=="number"&&Number.isFinite(d)&&d>0)t.contextLength=d;else{let g=(N(e.limit)?e.limit:void 0)?.context;typeof g=="number"&&Number.isFinite(g)&&g>0&&(t.contextLength=g)}}}return t}function oi(e,t){let n=Od(e,t);return n===void 0?{found:!1,signal:{reasoning:"unknown",source:null}}:{found:!0,signal:Nd(n)}}function ye(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 en(e){if(!N(e))return;let t=e.providers;return N(t)?t:void 0}function ii(e,t){for(let n of[e?.user,e?.base]){let r=en(n)?.[t];if(N(r)&&r.models!==void 0)return r.models}}function pr(e){return en(e?.user)}function tn(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 nn(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 rn(e,t){let r=e.find(o=>o.id===t)?.compat;if(N(r))return{...r}}function on(e,t){let r=e.find(o=>o.id===t)?.name;return typeof r=="string"&&r.length>0?r:void 0}function sn(e,t){let r=e.find(o=>o.id===t)?.[Ze];return typeof r=="string"&&r.length>0?r:void 0}async function _d(e,t){try{let n=await fetch(`${ro}?route=${encodeURIComponent(e)}`,{method:"GET"});if(!n.ok)return{reasoning:"unknown",source:null};let r=await n.json();return r?.ok?oi(r.data,t).signal:{reasoning:"unknown",source:null}}catch{return{reasoning:"unknown",source:null}}}function an(e,t=()=>ne(e),n,r,o,i){return{async suggest(s,a,d,u){let g=ye((await t()).namespace),p=Ge(g,s),m={api:p.api??u?.api,baseURL:p.baseURL??u?.baseURL,displayName:d??p.displayName},l=g[s]===void 0?void 0:await _d(s,a),c=he(a,m,l);return c.efforts===void 0?{ok:!1,error:"no-suggestion"}:{ok:!0,suggestion:{efforts:c.efforts,...c.compat===void 0?{}:{compat:c.compat},...c.defaultEffort===void 0?{}:{defaultEffort:c.defaultEffort},...c.defaultEffort===void 0?{}:{defaultEffort:c.defaultEffort},...c.input===void 0?{}:{input:c.input},...c.inputSource===void 0?{}:{inputSource:c.inputSource},...c.contextWindow===void 0?{}:{contextWindow:c.contextWindow},...c.maxTokens===void 0?{}:{maxTokens:c.maxTokens},matched:c.matched,source:c.source,confidence:c.confidence,...c.endpoint===void 0?{}:{endpoint:c.endpoint}}}},commit(s,a,d){if(i?.()===!0){n?.(s,a,d.efforts,d.compat,d.input,d.defaultEffort);return}r?.(s,a,{efforts:d.efforts,...d.compat===void 0?{}:{compat:d.compat},...d.input===void 0?{}:{input:d.input},...d.clearCompatKeys===void 0?{}:{clearCompatKeys:d.clearCompatKeys},...d.defaultEffort===void 0?{}:{defaultEffort:d.defaultEffort}})},withdraw(s,a){o?.(s,a)},stageEfforts(s,a,d,u,g,p){n?.(s,a,d,u,g,p)},async writeEfforts(s,a,d,u,g,p,m){if(r!==void 0)return r(s,a,{efforts:d,...u===void 0?{}:{compat:u},...g===void 0?{}:{input:g},...p===void 0?{}:{clearCompatKeys:p},...m===void 0?{}:{defaultEffort:m}}),{ok:!0,staged:!0};let c=(await xt(e,s,[{modelId:a,efforts:d,...u===void 0?{}:{compat:u},...g===void 0?{}:{input:g},...p===void 0?{}:{clearCompatKeys:p},...m===void 0?{}:{defaultEffort:m}}],t))[0]??{ok:!1,error:"no-result"};return c.ok?{ok:!0}:c.modelNotFound===!0?{ok:!1,error:"model-not-found"}:{ok:!1,error:c.error??"conflict"}}}}async function xt(e,t,n,r=()=>ne(e),o){if(n.length===0)return[];let i=!1;for(let s=0;s<3;s++)try{let a=s===0?await r():await ne(e,{fresh:!0});if(a.namespace===void 0)return n.map(()=>({ok:!1,error:"no-namespace"}));let d=ii(a.namespace,t);if(!Array.isArray(d))return n.map(()=>({ok:!1,modelNotFound:!0}));if(!d.every(N))return n.map(()=>({ok:!1,error:"invalid-models"}));let g=d.map(l=>l),p=[];for(let l of n){let c=g.findIndex(f=>f.id===l.modelId);if(c<0){p.push(l.modelId);continue}g[c]=Dd(g[c],l,i?void 0:l.compat)}if(p.length>0)return n.map(l=>p.includes(l.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(ie,[{op:"set",path:["providers",t,"models"],value:g}],a.namespace.revision);if(!m.ok){if(s===0&&m.error.code==="settings/conflict")continue;let l=m.error.code==="settings/rejected"&&ri(m.error.message);if(!i&&l&&n.some(c=>c.compat!==void 0)){i=!0;continue}return n.map(()=>({ok:!1,error:m.error.message}))}return n.map(()=>({ok:!0}))}catch(a){return n.map(()=>({ok:!1,error:a instanceof Error?a.message:String(a)}))}return n.map(()=>({ok:!1,error:"conflict"}))}function Dd(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[le]=!0;else if(delete r[le],delete r[Qe],i===!1)r.reasoningEfforts=!1;else{r.reasoningEfforts={...i};let s=N(e.compat)?e.compat:{},a={...s,...n??{}};for(let d of t.clearCompatKeys??[])delete a[d];(Object.keys(s).length>0||Object.keys(a).length>0)&&(Object.keys(a).length===0?delete r.compat:r.compat=a)}return t.input!==void 0&&(t.input===null?(delete r.input,r[xe]=!0):(delete r[xe],r.input=[...t.input])),t.defaultEffort!==void 0&&(t.defaultEffort===null?delete r[Ze]:r[Ze]=t.defaultEffort),r}function mr(e,t){for(let n of[e?.user,e?.base]){let r=en(n)?.[t];if(!N(r))continue;let o=r.headers;if(o===void 0)continue;if(!N(o))return;let i={};for(let[s,a]of Object.entries(o))typeof a=="string"&&(i[s]=a);return i}}async function gr(e,t,n){if(typeof t!="string"||t.length===0)return{ok:!1,error:"no-route"};for(let r=0;r<2;r+=1)try{let o=r===0?await ne(e):await ne(e,{fresh:!0});if(o.namespace===void 0)return{ok:!1,error:"no-namespace"};if(o.writable!==!0)return{ok:!1,error:"read-only"};if(!Id(o.namespace,t))return{ok:!1,error:"no-route"};let i=await e.settings.mutate(ie,[{op:"set",path:["providers",t,"headers"],value:{...n}}],o.namespace.revision);if(!i.ok){if(r===0&&i.error.code==="settings/conflict")continue;return{ok:!1,error:i.error.message}}return{ok:!0}}catch(o){return{ok:!1,error:o instanceof Error?o.message:String(o)}}return{ok:!1,error:"conflict"}}function Id(e,t){for(let n of[e?.user,e?.base]){let r=en(n);if(r!==void 0&&Object.prototype.hasOwnProperty.call(r,t))return!0}return!1}async function ne(e,t={}){let n=t.fresh===!0?void 0:Pd(e);if(n!==void 0)return n;let r=await e.settings.describe();return r.ok?{namespace:r.value.namespaces.find(i=>i.ns===ie),writable:r.value.writable}:{namespace:void 0,writable:!1}}function Pd(e){let t=e.scope?.getSnapshot();if(!(t===void 0||t.status!=="ready")&&typeof t.revision=="number")return{namespace:{ns:ie,schema:{},value:t.value,user:t.user,base:t.base,revision:t.revision,applies:"live",secrets:[]},writable:t.writable===!0}}function si(e){let t,n,r=0,o=()=>{if(t!==void 0)return Promise.resolve();let a=r;return n??(n=ne(e.api).then(d=>{if(d.namespace===void 0){n=void 0;return}let u=new Map;for(let[g,p]of Object.entries(ye(d.namespace))){let m=Array.isArray(p.models)?p.models:[];for(let l of m){if(typeof l!="object"||l===null||Array.isArray(l))continue;let c=l.id,f=l[Ze];typeof c=="string"&&typeof f=="string"&&f.length>0&&u.set(`${g}/${c}`,f)}}a===r?t=u:n=void 0}).catch(()=>{a===r&&(n=void 0)})),n};return{of:async(a,d)=>(await o(),t?.get(`${a}/${d}`)),invalidate:()=>{r+=1,t=void 0,n=void 0}}}function Cd(e){let t=e.input;return Array.isArray(t)&&t.length>0}function ai(e,t=()=>!0,n={},r=0){let o=n.efforts!==!1,i=n.modalities!==!1;if(!N(e))return;let s={};for(let a of Object.keys(e)){if(!t(a))continue;let d=e[a],u=N(d)&&Array.isArray(d.models)?d.models:void 0;if(u===void 0||u.length===0||!u.every(N))continue;let g=u,p=[],m=!1;for(let l of g){let c=l.reasoningEfforts!==void 0||l[le]===!0,f=Cd(l)||l[xe]===!0;if((c||!o)&&(f||!i)){let E=Fd(l,e,a);E!==void 0?(m=!0,p.push(E)):p.push(l);continue}let y=typeof l.id=="string"?l.id:"";if(y.length===0){p.push(l);continue}let k=Ge(e,a),h=typeof l.name=="string"?l.name:void 0,b=he(y,{...k,displayName:h??k.displayName});if(b.efforts===void 0){p.push(l);continue}let T={...l},w=!1;if(!c&&o&&(w=!0,T.reasoningEfforts=b.efforts,T[Qe]=r,b.compat!==void 0)){let E=N(l.compat)?l.compat:{};T.compat={...E,...b.compat}}if(!f&&i&&b.input!==void 0&&(w=!0,T.input=[...b.input]),!w){p.push(l);continue}m=!0,p.push(T)}m&&(s[a]={models:p})}return Object.keys(s).length===0?void 0:{providers:s}}function Fd(e,t,n){if(!N(e.reasoningEfforts)||e[le]===!0)return;let r=e.compat,o=N(r)?{...r}:{};if(o.supportsDeveloperRole===void 0&&or(Ge(t,n)))return{...e,compat:{...o,supportsDeveloperRole:!1}}}function di(e){let t,n=()=>(t??(t=(async()=>{let o={autofill:!0,modalityAutofill:!0};try{let i=await fetch(io,{method:"GET"});if(!i.ok)return o;let s=await i.json();return s?.ok!==!0?o:{autofill:s.data?.autofill!==!1,modalityAutofill:s.data?.modalityAutofill!==!1}}catch{return o}})()),t),r=async()=>{try{let o=await n();if(!o.autofill)return;let i=await ne(e.api,{fresh:!0}),s=i.namespace;if(s===void 0||i.writable!==!0)return;let a=pr(s);if(a===void 0)return;let d=ai(a,()=>!0,{modalities:o.modalityAutofill},s.revision);if(d===void 0)return;let u=d.providers,g=Object.entries(u).map(([m,l])=>({op:"set",path:["providers",m,"models"],value:l.models})),p=await e.api.settings.mutate(ie,g,s.revision);p.ok||console.error(`[bre] idle autofill refused: ${p.error.message}`)}catch(o){console.error(`[bre] idle autofill failed: ${o instanceof Error?o.message:String(o)}`)}};return{run:()=>{r()}}}var Gr=require("react"),la=require("react-dom/client");var q=require("react");var ze=Co;function $e(e){let t={};for(let n of ze){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 it(e){let t=!1,n=!1,r={};for(let o of ze){let i=e[o];if(!i.on)continue;if(o==="off"){t=!0;let a=i.wire.trim();r.off=a.length===0?null:a;continue}n=!0;let s=i.wire.trim();r[o]=s.length===0?o:s}return n?r:t?!1:void 0}function kt(e,t){if(e===t)return!0;if(e===!1||e===void 0||t===!1||t===void 0)return!1;let n=ze.filter(o=>e[o]!==void 0),r=ze.filter(o=>t[o]!==void 0);return n.length!==r.length?!1:n.every(o=>e[o]===t[o])}function li(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 hr="bre:auto-effort",ui=Promise.resolve();function fi(e){ui=ui.then(e,e).then(()=>{},()=>{})}function ci(e,t=document){t.dispatchEvent(new CustomEvent(hr,{detail:{route:e}}))}function pi(e,t=document){let n=r=>{let o=r.detail;typeof o?.route!="string"||o.route.length===0||e(o.route)};return t.addEventListener(hr,n),()=>{t.removeEventListener(hr,n)}}var x=require("react/jsx-runtime"),mi=new Intl.NumberFormat("en-US");function Ve(e){return e===void 0||e.length===0?{declared:!1,image:!1}:{declared:!0,image:e.includes("image")}}function ln(e){return e.declared?e.image?["text","image"]:["text"]:null}var Kd={"openai-completions":["thinkingTokenBudgetField","supportsThinkingTokenBudget","vllmPriority"],"openai-responses":["supportsMaxOutputTokens"]};function Wd(e){return Kd[(e??"").toLowerCase()]??[]}function gi(e,t){let n=Wd(e);if(n.length===0)return[];let r=new Set(t===void 0?[]:Object.keys(t));return n.filter(o=>!r.has(o))}function qd(e,t){if(t!==void 0)return{clearCompatKeys:gi(e,t)};let n=gi(e,void 0);return n.length===0?{}:{clearCompatKeys:n}}function dn(e,t){return e.declared?t===void 0?!1:e.image?t.includes("image"):!t.includes("image"):t===void 0}function br(e,t,n){let r=e?t:!1;return e&&r===void 0&&n===void 0?"keep":r}function bi(e){let t={},n=e?.thinkingTokenBudgetField??"";n!==""&&(t.thinkingTokenBudgetField=n);let o=(e?.vllmPriority===void 0?"":String(e.vllmPriority)).trim();o!==""&&/^-?\d+$/.test(o)&&(t.vllmPriority=Number.parseInt(o,10));let i=e?.supportsMaxOutputTokens===void 0?"":String(e.supportsMaxOutputTokens);return i==="true"?t.supportsMaxOutputTokens=!0:i==="false"&&(t.supportsMaxOutputTokens=!1),Object.keys(t).length===0?void 0:t}function hi(e){let t={};e.budgetField!==""&&(t.thinkingTokenBudgetField=e.budgetField);let n=e.priorityText.trim();return n!==""&&/^-?\d+$/.test(n)&&(t.vllmPriority=Number.parseInt(n,10)),e.maxOutput==="true"?t.supportsMaxOutputTokens=!0:e.maxOutput==="false"&&(t.supportsMaxOutputTokens=!1),Object.keys(t).length===0?void 0:t}function un(e){let t=e.appliedCompat,n=e.manualCompat,r=t!==void 0?{...t,...n??{}}:n;return e.initialCompat?.supportsThinkingTokenBudget===!0&&e.initialCompat?.thinkingTokenBudgetField===void 0&&r?.thinkingTokenBudgetField===void 0&&(e.routeApi??"").toLowerCase()==="openai-completions"&&(r={...r??{},thinkingTokenBudgetField:"thinking_token_budget"}),{efforts:e.efforts,...r===void 0?{}:{compat:r},...e.input===void 0?{}:{input:e.input},...qd(e.routeApi,r),...e.defaultEffort===void 0?{}:{defaultEffort:e.defaultEffort}}}function fn({route:e,routeApi:t,routeBaseURL:n,modelId:r,modelName:o,efforts:i,effortsUnset:s=!1,input:a,compat:d,defaultEffort:u,index:g,staged:p=!1,officialInputTypes:m=!1,api:l,readOnly:c,t:f}){let[y,k]=(0,q.useState)(()=>$e(i)),[h,b]=(0,q.useState)(()=>Ve(a)),[T,w]=(0,q.useState)(()=>i!==!1),[E,R]=(0,q.useState)(()=>u??""),[W,B]=(0,q.useState)(!1),[C,P]=(0,q.useState)(void 0),[A,D]=(0,q.useState)(void 0),[V,$]=(0,q.useState)(""),[Q,F]=(0,q.useState)("low"),K=(0,q.useRef)(void 0),[S,I]=(0,q.useState)(()=>d?.thinkingTokenBudgetField??""),[H,Z]=(0,q.useState)(()=>d?.vllmPriority===void 0?"":String(d.vllmPriority)),[oe,Ke]=(0,q.useState)(()=>d?.supportsMaxOutputTokens===void 0?"":String(d.supportsMaxOutputTokens)),Xe=(0,q.useRef)(d),[Ae,We]=(0,q.useState)(void 0),[qe,Pt]=(0,q.useState)(void 0),[L,Y]=(0,q.useState)(void 0),z=(0,q.useRef)(!1),se=(0,q.useRef)(i),Re=(0,q.useRef)(a),Ct=(0,q.useRef)(u),Bn=(0,q.useRef)(void 0),mt=(0,q.useRef)(i);mt.current=i;let Ft=(0,q.useRef)(s);Ft.current=s,(0,q.useEffect)(()=>pi(v=>{if(v!==e||mt.current!==void 0||Ft.current)return;let U=Bn.current;U!==void 0&&fi(U)}),[e]),(0,q.useEffect)(()=>{kt(se.current,i)||(se.current=i,z.current||(k($e(i)),w(i!==!1))),Re.current!==a&&(Re.current=a,z.current||b(Ve(a))),Ct.current!==u&&(Ct.current=u,z.current||R(u??"")),JSON.stringify(Xe.current??null)!==JSON.stringify(d??null)&&(Xe.current=d,z.current||(I(d?.thinkingTokenBudgetField??""),Z(d?.vllmPriority===void 0?"":String(d.vllmPriority)),Ke(d?.supportsMaxOutputTokens===void 0?"":String(d.supportsMaxOutputTokens))))},[i,a,d,u]);let Jr=()=>hi({budgetField:S,priorityText:H,maxOutput:oe}),La=()=>{let v=Jr();return JSON.stringify(v??null)!==JSON.stringify({...d?.thinkingTokenBudgetField===void 0?{}:{thinkingTokenBudgetField:d.thinkingTokenBudgetField},...d?.vllmPriority===void 0?{}:{vllmPriority:d.vllmPriority},...d?.supportsMaxOutputTokens===void 0?{}:{supportsMaxOutputTokens:d.supportsMaxOutputTokens}})},Kt=ze.filter(v=>y[v].on),Ma=E===(u??"")?void 0:E===""?null:E,Sa=T?it(y):!1,Un=!kt(Sa,i)||!dn(h,a)||La()||Ma!==void 0,jn=(0,q.useRef)(void 0),pe=()=>{z.current=!0,D(void 0),$(""),F("low"),We(void 0)},me=(v,U,te,ge=T,de)=>{let Ka=br(ge,it(v),i),Wa=dn(U,a)?void 0:ln(U),eo=un({efforts:Ka,input:Wa,defaultEffort:te===(u??"")?void 0:te===""?null:te,manualCompat:de===void 0?Jr():hi(de),appliedCompat:K.current,routeApi:t,initialCompat:d}),to=JSON.stringify(eo);jn.current!==to&&(jn.current=to,l.commit(e,r,eo))},Aa=(v,U)=>{pe();let te=!U&&E===v?"":E;te!==E&&R(te),k(ge=>{let de={...ge,[v]:{...ge[v],on:U}};return U&&v!=="off"&&de[v].wire.trim().length===0&&(de[v]={...de[v],wire:v}),me(de,h,te),de}),P(void 0)},Ra=v=>{pe(),w(v);let U=v?E:"";U!==E&&R(U),me(y,h,U,v),P(void 0)},Ha=(v,U)=>{pe(),k(te=>{let ge={...te,[v]:{...te[v],wire:U}};return me(ge,h,E),ge}),P(void 0)},Oa=v=>{pe();let U={declared:!0,image:v};b(U),me(y,U,E),P(void 0)},Na=()=>{pe();let v={declared:!1,image:!1};b(v),me(y,v,E),P(void 0)},_a=v=>{pe(),I(v),me(y,h,E,T,{budgetField:v,priorityText:H,maxOutput:oe}),P(void 0)},Da=v=>{pe(),Z(v),me(y,h,E,T,{budgetField:S,priorityText:v,maxOutput:oe}),P(void 0)},Ia=v=>{pe(),Ke(v),me(y,h,E,T,{budgetField:S,priorityText:H,maxOutput:v}),P(void 0)},Xr=v=>{pe(),R(v),me(y,h,v),P(void 0)},Pa=v=>{pe();let U=v.efforts!==!1;w(U);let te=$e(v.efforts);k(te);let ge=v.input===void 0?h:Ve(v.input);v.input!==void 0&&b(ge);let de=E===""&&v.defaultEffort!==void 0?v.defaultEffort:E;de!==E&&R(de),D(v.efforts),$(v.source),F(v.confidence),K.current=v.compat,We(v.inputSource),Pt(v.contextWindow),Y(v.maxTokens),P({kind:"info",text:f("appliedHint",{source:v.source,confidence:f("confidence_"+v.confidence)})}),me(te,ge,de,U)},Qr=async()=>{if(!(c||W)){B(!0),P(void 0);try{let v=p?await l.suggest(e,r,o,{...t===void 0?{}:{api:t},...n===void 0?{}:{baseURL:n}}):await l.suggest(e,r,o);if(!v.ok){P({kind:"error",text:v.error==="no-suggestion"?f("noSuggestion"):v.error});return}Pa(v.suggestion)}catch(v){P({kind:"error",text:f("writeError",{message:String(v)})})}finally{B(!1)}}};(0,q.useEffect)(()=>{Bn.current=Qr});let Ca=()=>{z.current=!1,l.withdraw(e,r),k($e(i)),w(i!==!1),b(Ve(a)),R(u??""),I(d?.thinkingTokenBudgetField??""),Z(d?.vllmPriority===void 0?"":String(d.vllmPriority)),Ke(d?.supportsMaxOutputTokens===void 0?"":String(d.supportsMaxOutputTokens)),D(void 0),$(""),F("low"),K.current=void 0,We(void 0),Pt(void 0),Y(void 0),P(void 0),jn.current=void 0},Fa=K.current?.thinkingFormat??he(r,{...t===void 0?{}:{api:t},...n===void 0?{}:{baseURL:n}}).compat?.thinkingFormat,Zr=li(i,Fa),ae=c||W;return(0,x.jsxs)("div",{className:"bre-effort-editor","data-plugin":X,children:[(0,x.jsxs)("label",{className:"bre-modality-row bre-thinking-switch",children:[(0,x.jsx)("input",{type:"checkbox",checked:T,disabled:ae,"aria-label":f("thinkingMode")+" "+String(g+1),onChange:v=>{Ra(v.target.checked)}}),(0,x.jsx)("span",{className:"bre-effort-level",children:f("thinkingMode")}),T?null:(0,x.jsx)("span",{className:"bre-effort-note",children:f("thinkingModeOff")})]}),T?(0,x.jsxs)("div",{className:"bre-effort-card",children:[(0,x.jsxs)("div",{className:"bre-effort-head",children:[(0,x.jsx)("span",{className:"bre-effort-title",children:f("reasoningEffort")}),(0,x.jsx)("button",{type:"button",className:"bre-link-button",disabled:ae,onClick:()=>{Qr()},children:f("autoAdapt")})]}),(0,x.jsx)("div",{className:"bre-effort-grid",children:ze.map(v=>{let U=y[v];return(0,x.jsxs)("label",{className:"bre-effort-row",children:[(0,x.jsx)("input",{type:"checkbox",checked:U.on,disabled:ae,"aria-label":f("level_"+v)+" "+String(g+1),onChange:te=>{Aa(v,te.target.checked)}}),(0,x.jsx)("span",{className:"bre-effort-level",children:f("level_"+v)}),U.on?(0,x.jsx)("input",{type:"text",className:"bre-effort-wire",value:U.wire,disabled:ae,placeholder:f("wirePlaceholder"),"aria-label":f("level_"+v)+" "+f("wireValue"),onChange:te=>{Ha(v,te.target.value)}}):(0,x.jsx)("span",{className:"bre-effort-empty"})]},v)})}),Kt.length>0?(0,x.jsxs)("div",{className:"bre-modality",children:[(0,x.jsx)("span",{className:"bre-effort-title",children:f("defaultEffortLabel")}),(0,x.jsxs)("label",{className:"bre-modality-row",children:[(0,x.jsxs)("select",{className:"bre-select",disabled:ae,"aria-label":f("defaultEffortLabel")+" "+String(g+1),value:E,onChange:v=>{Xr(v.target.value)},children:[(0,x.jsx)("option",{value:"",children:f("defaultEffortUnset")}),(E!==""&&!Kt.includes(E)?[...Kt,E]:Kt).map(v=>(0,x.jsx)("option",{value:v,children:f("level_"+v)},v))]}),E!==""?(0,x.jsx)("button",{type:"button",className:"bre-link-button bre-modality-clear",disabled:ae,onClick:()=>{Xr("")},children:f("clearDefaultEffort")}):null]}),(0,x.jsx)("p",{className:"bre-modality-note",children:f("defaultEffortHint")})]}):null,m?null:(0,x.jsxs)("div",{className:"bre-modality",children:[(0,x.jsx)("span",{className:"bre-effort-title",children:f("inputModality")}),(0,x.jsxs)("label",{className:"bre-modality-row",children:[(0,x.jsx)("input",{type:"checkbox",checked:h.declared&&h.image,disabled:ae,"aria-label":f("modalityImage")+" "+String(g+1),onChange:v=>{Oa(v.target.checked)}}),(0,x.jsx)("span",{className:"bre-effort-level",children:f("modalityImage")}),h.declared?(0,x.jsx)("button",{type:"button",className:"bre-link-button bre-modality-clear",disabled:ae,onClick:Na,children:f("clearDeclaration")}):null]}),h.declared?null:(0,x.jsx)("p",{className:"bre-modality-note",children:f("modalityInherit")})]}),(t??"").toLowerCase()==="openai-completions"?(0,x.jsxs)("div",{className:"bre-compat",children:[(0,x.jsx)("span",{className:"bre-effort-title",children:f("compatTitle")}),(0,x.jsxs)("label",{className:"bre-compat-row",children:[(0,x.jsx)("span",{className:"bre-compat-label",children:f("budgetFieldLabel")}),(0,x.jsxs)("select",{className:"bre-select",disabled:ae,"aria-label":f("budgetFieldLabel")+" "+String(g+1),value:S,onChange:v=>{_a(v.target.value)},children:[(0,x.jsx)("option",{value:"",children:f("budgetUnset")}),(0,x.jsx)("option",{value:"thinking_token_budget",children:"thinking_token_budget"}),(0,x.jsx)("option",{value:"thinking_budget",children:"thinking_budget"}),(0,x.jsx)("option",{value:"thinking_budget_tokens",children:"thinking_budget_tokens"})]}),(0,x.jsx)("span",{className:"bre-compat-hint",children:f("budgetFieldHint")})]}),(0,x.jsxs)("div",{className:"bre-compat-row",children:[(0,x.jsxs)("label",{className:"bre-compat-field",children:[(0,x.jsx)("span",{className:"bre-compat-label",children:f("priorityLabel")}),(0,x.jsx)("input",{type:"text",inputMode:"numeric",className:"bre-text-input",value:H,disabled:ae,placeholder:f("priorityPlaceholder"),"aria-label":f("priorityLabel")+" "+String(g+1),onChange:v=>{Da(v.target.value)}})]}),(0,x.jsx)("span",{className:"bre-compat-hint",children:f("priorityHint")}),H.trim()!==""&&!/^-?\d+$/.test(H.trim())?(0,x.jsx)("p",{className:"bre-effort-note bre-error",children:f("priorityInvalid")}):null]}),d?.supportsThinkingTokenBudget===!0&&d?.thinkingTokenBudgetField===void 0?(0,x.jsx)("p",{className:"bre-effort-note",children:f("aliasMigrated")}):null]}):null,(t??"").toLowerCase()==="openai-responses"?(0,x.jsxs)("div",{className:"bre-compat",children:[(0,x.jsx)("span",{className:"bre-effort-title",children:f("compatTitle")}),(0,x.jsxs)("label",{className:"bre-compat-row",children:[(0,x.jsx)("span",{className:"bre-compat-label",children:f("maxOutputLabel")}),(0,x.jsxs)("select",{className:"bre-select",disabled:ae,"aria-label":f("maxOutputLabel")+" "+String(g+1),value:oe,onChange:v=>{Ia(v.target.value)},children:[(0,x.jsx)("option",{value:"",children:f("maxOutputUnset")}),(0,x.jsx)("option",{value:"true",children:f("maxOutputOn")}),(0,x.jsx)("option",{value:"false",children:f("maxOutputOff")})]}),(0,x.jsx)("span",{className:"bre-compat-hint",children:f("maxOutputHint")})]})]}):null,p?(0,x.jsx)("p",{className:"bre-effort-note",children:f("stagedHint")}):null,i===!1?(0,x.jsx)("p",{className:"bre-effort-note",children:f("reasoningDisabled")}):null,Zr===void 0?null:(0,x.jsx)("p",{className:"bre-effort-note",children:f(Zr==="thinking-disabled"?"defaultRiskDisabled":"defaultRiskQwen")}),it(y)===void 0&&i!==void 0?(0,x.jsx)("p",{className:"bre-effort-note",children:f("bareHint")}):null,A!==void 0?(0,x.jsxs)("div",{className:"bre-suggestion",children:[(0,x.jsx)("p",{className:"bre-effort-note",children:f("appliedHint",{source:V,confidence:f("confidence_"+Q)})}),Ae===void 0?null:(0,x.jsx)("p",{className:"bre-effort-note",children:f(Ae==="endpoint"?"inputHintEndpoint":Ae==="knowledge"?"inputHintKnowledge":"inputHintHeuristic")}),qe===void 0&&L===void 0?null:(0,x.jsxs)("div",{className:"bre-reference",children:[(0,x.jsx)("span",{className:"bre-reference-title",children:f("referenceTitle")}),(0,x.jsxs)("span",{className:"bre-reference-values",children:[qe===void 0?null:(0,x.jsxs)("span",{children:[f("contextWindowLabel")," ",(0,x.jsx)("b",{children:mi.format(qe)})]}),L===void 0?null:(0,x.jsxs)("span",{children:[f("maxTokensLabel")," ",(0,x.jsx)("b",{children:mi.format(L)})]})]})]})]}):null,C===void 0?null:(0,x.jsx)("p",{className:"bre-effort-message bre-"+C.kind,role:C.kind==="error"?"alert":"status",children:C.text}),Un?(0,x.jsx)("p",{className:"bre-effort-message bre-info",role:"status",children:f("pendingSave")}):null,Un?(0,x.jsx)("p",{className:"bre-effort-note",children:f("pendingHint")}):null,(0,x.jsx)("div",{className:"bre-effort-actions",children:(0,x.jsx)("button",{type:"button",className:"bre-secondary-button",disabled:ae||!Un,onClick:Ca,children:f("reset")})})]}):null]})}var _e="data-bre-auto-effort",yr='[class*="modelCatalog"]',Bd='[class*="modelListHead"]',Ud='button[class*="linkButton"]',jd="bre-auto-effort",Gd="bre-auto-effort-note",zd="data-bre-auto-effort-phase",wi="bre-auto-effort-note-text",vi="bre-auto-effort-note-detail",$d=3e3;function Vd(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 wr(e){return Array.from(e.querySelectorAll(yr)).filter(t=>(t.parentElement?.closest(yr)??null)===null)}function cn(e,t,n){let r=new Map;for(let a of t)a.route.length!==0&&a.catalogue.isConnected&&r.set(a.catalogue,a.route);let o=n.t("autoAdaptAll");for(let[a,d]of r){let u=a.querySelector(Bd)??a,g=u.querySelector(`[${_e}]`)??Jd();ki.set(g,n);let p=Yd(u);p!==null?p.nextElementSibling!==g&&p.after(g):u.lastElementChild!==g&&u.append(g),el(g,d,o)}let i=new Set,s=new Set(r.values());for(let a of Array.from(e.querySelectorAll(`[${_e}]`))){let d=a.closest(yr),u=a.getAttribute(_e)??"";if(d===null||!r.has(d)||i.has(d)){a.remove(),u.length>0&&!s.has(u)&&vr(u);continue}i.add(d)}}function vr(e){let t=Ye.get(e);t!==void 0&&(t.timer!==null&&clearTimeout(t.timer),t.note.remove(),Ye.delete(e))}function xi(){for(let e of Array.from(document.querySelectorAll(`[${_e}]`)))e.remove();for(let e of Ye.values())e.timer!==null&&clearTimeout(e.timer),e.note.remove();Ye.clear()}function Yd(e){let t=Array.from(e.querySelectorAll(Ud));return t.length===0?null:t[t.length-1]}function Jd(){let e=document.createElement("button");return e.className=jd,e.setAttribute("type","button"),e.setAttribute(_e,""),e.addEventListener("click",()=>{let t=e.getAttribute(_e)??"";if(t.length===0)return;let n=ki.get(e);n!==void 0&&(ci(t),Xd(t,n))}),e}async function Xd(e,t){if(t.onRequest===void 0)return;yi(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){vr(e);return}let r=Vd(n);r!==null&&yi(e,r,t,$d)}function yi(e,t,n,r){let o=Ye.get(e);o!==void 0&&!o.note.isConnected&&(o.timer!==null&&clearTimeout(o.timer),Ye.delete(e),o=void 0),o!==void 0&&o.timer!==null&&clearTimeout(o.timer);let i=o?.note??Qd();i.setAttribute(zd,t.phase);let s=i.querySelector(`.${wi}`),a=i.querySelector(`.${vi}`),d=Zd(t,n);s.textContent!==d.text&&(s.textContent=d.text),a.textContent!==d.detail&&(a.textContent=d.detail),a.hidden=d.detail.length===0,o===void 0&&document.body.append(i);let u=r>0?setTimeout(()=>{vr(e)},r):null;i.style.setProperty("--bre-note-hold",`${r}ms`),Ye.set(e,{note:i,timer:u})}function Qd(){let e=document.createElement("div");return e.className=Gd,e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.innerHTML=`<span class="${wi}"></span><span class="${vi}"></span>`,e}var ki=new WeakMap,Ye=new Map;function Zd(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 el(e,t,n){e.getAttribute(_e)!==t&&e.setAttribute(_e,t),e.textContent!==n&&(e.textContent=n),e.getAttribute("title")!==null&&e.removeAttribute("title")}var Et="data-bre-drag-handle",xr="data-bre-row-head",kr="data-bre-drop-side",pn="bre-row-dragging",mn="bre-row-drop-target",Ai="bre-drag-ghost",Ri="bre-drop-line",Ei="http://www.w3.org/2000/svg",Ti=8,Li=28,Mi=12,tl="transform 180ms cubic-bezier(0.2, 0.7, 0.3, 1)",nl='button, a, input, textarea, select, [contenteditable], [role="button"], [role="switch"], [role="checkbox"], [role="textbox"], [role="combobox"]';function gn(){return{sources:new WeakSet,lists:new WeakSet,line:void 0,sighted:new WeakMap,drag:void 0}}function re(e){return Array.from(e.children).filter(t=>t instanceof HTMLElement)}function rl(e,t){let n=e.style.order;if(n==="")return t;let r=Number.parseInt(n,10);return Number.isNaN(r)?t:r}function Je(e){return re(e).map((t,n)=>({row:t,key:rl(t,n),index:n})).sort((t,n)=>t.key-n.key||t.index-n.index).map(t=>t.row)}function Hi(e,t){let n=e.filter(s=>t.includes(s)),r=n.map(s=>e.indexOf(s)),o=t.filter(s=>n.includes(s)),i=new Map;e.forEach((s,a)=>i.set(s,a)),r.forEach((s,a)=>{let d=o[a];d!==void 0&&i.set(d,s)});for(let[s,a]of i){let d=String(a);s.style.order!==d&&(s.style.order=d)}}function hn(e,t){Hi(Je(e),t)}function Er(e,t){let n=re(e),r=n.map(o=>o.offsetTop);t(),n.forEach((o,i)=>{let s=r[i]-o.offsetTop;s!==0&&(o.style.transition="none",o.style.transform=`translateY(${s}px)`,o.offsetHeight,o.style.transition=tl,o.style.transform="")})}function Tt(e,t){return Je(e).map(n=>t(n)).filter(n=>n!==void 0)}function ol(e,t,n){let r=Tt(e,t);if(n===void 0||!il(e,n))return r;let o=new Map;return n.ids.forEach((i,s)=>{o.has(i)||o.set(i,s)}),r.map((i,s)=>({id:i,key:o.get(i)??n.ids.length+s})).sort((i,s)=>i.key-s.key).map(i=>i.id)}function il(e,t){return t.rows.some(n=>!e.contains(n))}function sl(e,t){let n=[];for(let o of Je(e)){let i=t(o);i!==void 0&&n.push(i)}let r=[];for(let o of re(e))t(o)!==void 0&&r.push(o);return{ids:n,rows:r}}function Oi(e,t,n){let r=new Map;for(let[a,d]of t.entries())r.has(d)||r.set(d,a);let o=re(e),s=[...o.filter(a=>n(a)!==void 0)].sort((a,d)=>{let u=r.get(n(a))??Number.MAX_SAFE_INTEGER,g=r.get(n(d))??Number.MAX_SAFE_INTEGER;return u-g});Hi(o,s)}function bn(e){for(let t of e)t.style.order="",t.style.transition="",t.style.transform=""}function Ni(e,t,n,r){let i=e.filter(s=>s!==t).indexOf(n);return i<0?Math.max(0,e.indexOf(t)):r?i+1:i}function _i(e,t){let n,r=Number.POSITIVE_INFINITY;for(let o of e){let i=o.getBoundingClientRect(),s=t<i.top?i.top-t:t>i.bottom?t-i.bottom:0;s<r&&(r=s,n=o)}return n}function al(e,t){let n=e.getBoundingClientRect();return n.height<=0?!0:t>n.top+n.height/2}function Di(e,t){let n=e.getBoundingClientRect();return t?n.bottom+Ti/2-1:n.top-Ti/2-1}function Ii(){let e=document.createElementNS(Ei,"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(Ei,"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 Pi(e,t){let n=document.createElement("div");n.className=Ai,n.setAttribute("aria-hidden","true"),n.appendChild(Ii());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 dl(e){return!(e instanceof Element)||e.closest(`[${Et}]`)!==null?!1:e.closest(nl)!==null}function Ci(e){return e.parentElement??void 0}function Fi(e){for(let t of re(e))t.classList.remove(mn),t.removeAttribute(kr)}function yn(e){let t=e.parentElement;for(;t!==null;){if(Ki(t))return t;t=t.parentElement}let n=document.scrollingElement;return n instanceof HTMLElement&&n.scrollHeight>n.clientHeight?n:void 0}function Tr(e){let t=[],n=e.parentElement;for(;n!==null;)Ki(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 Ki(e){if(e.scrollHeight<=e.clientHeight)return!1;let t=e.style.overflowY,n=t.length>0?t:window.getComputedStyle(e).overflowY;return n==="auto"||n==="scroll"||n==="overlay"}function Wi(e,t){let n=e.getBoundingClientRect();return n.height<=0?0:t<n.top+Li?-Mi:t>n.bottom-Li?Mi:0}function qi(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 ll(e){let t=e.line;if(t!==void 0&&t.isConnected)return t;let n=document.createElement("div");return n.className=Ri,n.setAttribute("aria-hidden","true"),document.body.appendChild(n),e.line=n,n}function ul(e,t,n){let r=ll(e),o=t.getBoundingClientRect();r.style.top=`${Di(t,n)}px`,r.style.left=`${o.left}px`,r.style.width=`${o.width}px`,r.style.display="block",r.setAttribute(kr,n?"after":"before")}function fl(e){e.line!==void 0&&(e.line.style.display="none")}function cl(e){let t=e.drag;e.drag=void 0,t!==void 0&&(qi(e,t,0),fl(e),t.row.classList.remove(pn),Fi(t.list),t.dropped||Er(t.list,()=>{hn(t.list,t.before)}))}function pl(e,t,n,r){if(dl(t.target)){t.preventDefault();return}let o=Ci(e),i=n.idOf(e);if(o===void 0||i===void 0){t.preventDefault();return}let s={row:e,list:o,before:Je(o),scroller:yn(o),adapter:n,scrollStep:0,frame:void 0,dropped:!1};r.drag=s,e.classList.add(pn);let a=Pi(e,n.labelOf(e));Number.isFinite(t.clientX)&&Number.isFinite(t.clientY)&&(a.style.left=`${t.clientX}px`,a.style.top=`${t.clientY}px`),document.body.appendChild(a);let d=t.dataTransfer;if(d!=null)try{d.effectAllowed="move",d.setData("text/plain",i),d.setDragImage(a,Math.round(a.offsetWidth/2),Math.round(a.offsetHeight/2))}catch{}window.setTimeout(()=>{a.remove()},0)}function ml(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,s=Je(e),a=i!==void 0&&s.includes(i)?i:_i(s,t.clientY);if(a===void 0)return;t.preventDefault();let d=t.dataTransfer;d!=null&&(d.dropEffect="move");let u=al(a,t.clientY),g=Ni(s,r.row,a,u);g!==s.indexOf(r.row)&&Er(e,()=>{hn(e,Xn(s,r.row,g))}),Fi(e),a.classList.add(mn),a.setAttribute(kr,u?"after":"before"),ul(n,a,u),qi(n,r,r.scroller===void 0?0:Wi(r.scroller,t.clientY))}function gl(e,t){t.lists.has(e)||(t.lists.add(e),e.addEventListener("dragover",n=>{ml(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 hl(e,t,n,r){r.sources.has(e)||(r.sources.add(e),n.seatDrags&&(e.setAttribute(xr,"1"),e.setAttribute("draggable","true")),e.addEventListener("dragstart",o=>{pl(t,o,n,r)}),e.addEventListener("dragend",()=>{cl(r)}))}function bl(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=Ci(t);if(i===void 0)return;let s=Je(i),a=s.indexOf(t);if(a<0)return;let d=a+(o.key==="ArrowUp"?-1:1);d<0||d>=s.length||(o.preventDefault(),Er(i,()=>{hn(i,Xn(s,t,d))}),n.commit(i),e.focus())})}function Si(e,t,n,r){let o=r.gripLabel(t,n),i=r.gripHint();e.getAttribute(Et)!==n&&e.setAttribute(Et,n),e.getAttribute("aria-label")!==o&&e.setAttribute("aria-label",o),e.getAttribute("title")!==i&&e.setAttribute("title",i)}function yl(e,t,n,r,o){let i=t.querySelector(`[${Et}]`);if(i!==null){Si(i,e,n,r);return}r.decorate?.(e,t);let s=document.createElement("span");s.className="bre-drag-grip",s.setAttribute("role","button"),s.setAttribute("tabindex","0"),s.setAttribute("draggable","true"),s.appendChild(Ii()),Si(s,e,n,r),bl(s,e,r,o),hl(r.seatDrags?t:s,e,r,o),t.insertBefore(s,t.firstChild)}function wn(e,t,n,r){if(!e.isConnected)return;gl(t,r);for(let i of re(t)){let s=n.idOf(i);if(s===void 0)continue;let a=n.seatOf(i);a!==void 0&&yl(i,a,s,n,r)}if(r.drag!==void 0)return;let o=ol(t,n.idOf,r.sighted.get(t));Oi(t,n.order(o),n.idOf),r.sighted.set(t,sl(t,n.idOf))}function vn(e){e.drag=void 0;for(let t of Array.from(document.querySelectorAll(`[${Et}]`)))t.remove();for(let t of Array.from(document.querySelectorAll(`[${xr}]`)))t.removeAttribute(xr),t.removeAttribute("draggable");for(let t of Array.from(document.querySelectorAll(`.${pn}, .${mn}`)))t.classList.remove(pn,mn);for(let t of Array.from(document.querySelectorAll(`.${Ri}`)))t.remove();for(let t of Array.from(document.querySelectorAll(`.${Ai}`)))t.remove();e.line=void 0}function st(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Lr="__breLedgerDocument";function $i(){let e=globalThis;return e[Lr]??(e[Lr]=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`)}var xn="bre:held-writes:v1";function Sr(){try{return typeof sessionStorage>"u"?void 0:sessionStorage}catch{return}}function ve(e){let t=Sr();if(t!==void 0)try{if(e.pending.size===0&&e.queued.size===0){t.removeItem(xn);return}let n={document:$i(),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(xn,JSON.stringify(n))}catch{}}function Bi(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 s=[];for(let a of i){if(!Array.isArray(a)||a.length!==2)return;let[d,u]=a;if(typeof d!="string"||!N(u)||t!==void 0&&!t(u))return;s.push([d,u])}n.push([o,s])}return n}function wl(e){let t=Sr();if(t!==void 0)try{let n=t.getItem(xn);if(n===null)return;let r=JSON.parse(n);if(r.document!==$i())return;let o=Bi(r.pending),i=Bi(r.queued,Rl);if(o===void 0||i===void 0)return;let s=Array.isArray(r.committed)?r.committed.filter(a=>typeof a=="string"):[];for(let[a,d]of o)e.pending.set(a,new Map(d));for(let[a,d]of i)s.includes(a)&&(e.queued.set(a,new Map(d)),e.committing.add(a))}catch{}}function Vi(e,t){(async()=>{try{await Ar(t,e),await Rr(t,e)}catch(n){console.error(`[bre] teardown flush failed: ${n instanceof Error?n.message:String(n)}`)}})()}function Yi(e,t){(async()=>{try{await Ar(t,e,!0),await Rr(t,e,!0)}catch(n){console.error(`[bre] unload flush failed: ${n instanceof Error?n.message:String(n)}`)}finally{try{Sr()?.removeItem(xn)}catch{}}})()}function Ji(){let e={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};return wl(e),e}async function vl(e,t){if(!t.flushing){t.flushing=!0;try{let n=await Ar(e,t),r=await Rr(e,t);n||r?Ui(e,t):(t.flushFailures=0,t.nextFlushAt=0)}catch(n){Ui(e,t),console.error(`[bre] idle flush failed: ${n instanceof Error?n.message:String(n)}`)}finally{t.flushing=!1}try{e.onIdle?.()}catch(n){console.error(`[bre] idle hook failed: ${n instanceof Error?n.message:String(n)}`)}}}function Ui(e,t){t.flushFailures+=1;let n=Math.min(2**t.flushFailures*500,3e4);t.nextFlushAt=Date.now()+n,e.onBackoff?.(n)}function xl(e){return e.queued.size>0||e.pending.size>0}function Mt(e,t,n,r,o,i,s){try{let a=e.pending.get(t);if(r===void 0){if(a===void 0)return;a.delete(n),a.size===0&&e.pending.delete(t);return}e.pending.set(t,(a??new Map).set(n,{efforts:r,...o===void 0?{}:{compat:o},...i===void 0?{}:{input:i},...s===void 0?{}:{defaultEffort:s}}))}finally{ve(e)}}function Xi(e,t,n,r){e.queued.set(t,(e.queued.get(t)??new Map).set(n,r)),ve(e)}function kl(e,t,n){let r=e.pending.get(t);r!==void 0&&(r.delete(n),r.size===0&&e.pending.delete(t),ve(e))}function El(e,t,n){let r=e.queued.get(t);r!==void 0&&(r.delete(n),r.size===0&&e.queued.delete(t),ve(e))}function Tl(e,t,n){kl(e,t,n),El(e,t,n)}function Ll(e,t){e.queued.delete(t),e.pending.delete(t),e.missedScans.delete(t),e.committing.delete(t),ve(e)}function Ml(e,t,n){if(t===void 0)return null;let i=t[le]!==!0&&t.reasoningEfforts!==void 0&&typeof t[Qe]=="number"||t[le]!==!0&&n?.efforts!==void 0&&Sl(t.reasoningEfforts,n.efforts)?!1:t.reasoningEfforts!==void 0||t[le]===!0||e.efforts==="keep",a=t[xe]!==!0&&n?.input!==void 0&&Al(t.input,n.input)?!1:Array.isArray(t.input)&&t.input.length>0||t[xe]===!0,d=i?"keep":e.efforts,u=a?void 0:e.input,g=e.defaultEffort;return d==="keep"&&u===void 0&&g===void 0?null:{efforts:d,...e.compat===void 0?{}:{compat:e.compat},...u===void 0?{}:{input:u},...g===void 0?{}:{defaultEffort:g}}}function Sl(e,t){if(e===t)return!0;if(!N(e)||!N(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 Al(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 Rl(e){if(!N(e))return!1;let t=e.efforts;if(t!==!1&&t!=="keep"&&!N(t))return!1;let n=e.clearCompatKeys;return n===void 0||Array.isArray(n)&&n.every(r=>typeof r=="string")}async function Hl(e,t,n,r,o=!1){let i=await e.describeNamespace(),s=ye(i.namespace),a=[];for(let[p,m]of[...r]){let l=Zt(s,n).find(h=>h.id===p);if(l===void 0||t.pending.get(n)?.get(p)!==m)continue;let c=Ge(s,n),f=typeof l.name=="string"?l.name:void 0,y=he(p,f===void 0?c:{...c,displayName:f}),k=Ml(m,l,{...y.efforts===void 0?{}:{efforts:y.efforts},...y.input===void 0?{}:{input:y.input}});if(k===null){Mt(t,n,p,void 0);continue}a.push({modelId:p,efforts:k.efforts,...k.compat===void 0?{}:{compat:k.compat},...k.input===void 0?{}:{input:k.input},...k.defaultEffort===void 0?{}:{defaultEffort:k.defaultEffort}})}if(a.length===0)return!1;let d=!1,u=await xt(e.api,n,a,()=>d?e.describeNamespace():(d=!0,Promise.resolve(i)),o?void 0:as),g=!1;return a.forEach((p,m)=>{let l=u[m];if(l?.aborted!==!0){if(l?.ok===!0||l?.modelNotFound===!0){Mt(t,n,p.modelId,void 0);return}g=!0,console.error(`[bre] staged flush write failed for "${n}"/"${p.modelId}": ${l?.error??"unknown"}`)}}),g}async function Ar(e,t,n=!1){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)||(await e.describeNamespace()).writable!==!0)return ve(t),!1;let i=!1;for(let[s,a]of[...t.queued]){if(!t.committing.has(s)&&!t.signalsUnavailable)continue;let u=[...a].map(([m,l])=>({modelId:m,efforts:l.efforts,...l.compat===void 0?{}:{compat:l.compat},...l.input===void 0?{}:{input:l.input},...l.clearCompatKeys===void 0?{}:{clearCompatKeys:l.clearCompatKeys},...l.defaultEffort===void 0?{}:{defaultEffort:l.defaultEffort}})),g=await xt(e.api,s,u,void 0,n?void 0:as),p=!1;u.forEach((m,l)=>{let c=g[l];if(c?.aborted===!0){p=!0;return}if(c?.ok===!0||c?.modelNotFound===!0){a.delete(m.modelId);return}console.error(`[bre] held write failed for "${s}"/"${m.modelId}": ${c?.error??"unknown"}`)}),a.size===0?(t.queued.delete(s),t.committing.delete(s)):p||(i=!0)}return ve(t),i}async function Rr(e,t,n=!1){if(t.pending.size===0)return!1;let r=await e.describeNamespace();if(r.writable!==!0)return!1;let o=ye(r.namespace),i=!1;for(let[s,a]of[...t.pending]){if(a.size===0){t.pending.delete(s);continue}st(o,s)&&await Hl(e,t,s,a,n)&&(i=!0)}return ve(t),i}function we(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 St(e){return e.closest('[class*="editor"], [class*="rowCard"], [class*="addCard"]')??void 0}function Ol(e){let t=e.closest('[class*="modelEntry"]');if(t===null){let r=St(e);if(r===void 0)return;let o=Array.from(r.querySelectorAll('[class*="modelAdvanced"]'));return o.find(i=>i.offsetParent!==null)??o[0]}let n=Array.from(t.querySelectorAll('[class*="modelAdvanced"]'));return n.find(r=>r.offsetParent!==null)??n[0]}function Nl(e){return e.querySelector('[class*="modelInputTypes"]')!==null}function _l(e,t,n,r,o){!e.isConnected||Or(e)===void 0||Array.from(e.querySelectorAll("button[aria-label]")).some(s=>o.capacity.some(a=>(s.getAttribute("aria-label")??"").startsWith(a)))||cn(e,Dl(e,ye(r.namespace),o),{t:t.t,onRequest:s=>Qi(n,t,s)})}function Dl(e,t,n){let r=[];for(let o of wr(e)){let i=St(o);if(i===void 0)continue;let s=Ee(i,t,n);s===void 0||s.staged||r.push({catalogue:o,route:s.route})}return r}function Il(e,t,n){let r=[],o=new Set;for(let i of e){if(o.has(i.card))continue;o.add(i.card);let s=Ee(i.card,t,n);if(s===void 0)continue;let[a]=wr(i.card);a!==void 0&&r.push({catalogue:a,route:s.route})}return r}function Pl(e,t,n,r){let o=[],i=new Set;for(let s of r.capacity){let a=Array.from(e.querySelectorAll("button[aria-label]")).filter(d=>(d.getAttribute("aria-label")??"").startsWith(s));for(let d of a){let u=St(d);if(u===void 0)continue;let g=d.closest('[class*="modelEntry"]')??u,p=we(g,r.modelId);p.length===0||i.has(p)||Ee(u,n,r)?.route===t&&(i.add(p),o.push({id:p,name:we(g,r.modelName)}))}}return o}async function Qi(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{let s,a=()=>s??(s=t.describeNamespace()),d=await a(),u=ye(d.namespace);if(d.writable!==!0)return{held:0,unsuggested:0,blocked:"unwritable"};if(!st(u,n))return{held:0,unsuggested:0,blocked:"unknown-route"};let g=Zt(u,n),p=new Set;for(let h of g){let b=typeof h.id=="string"?h.id:"";b.length>0&&p.add(b)}let m=g.slice();for(let h of r)h.id.length===0||p.has(h.id)||m.push({id:h.id,name:h.name});if(m.length===0)return{held:0,unsuggested:0,blocked:"no-models"};let l=u[n]??{},c=typeof l.api=="string"?l.api:void 0,f=new Set;for(let h of e.mounted.values())h.props.route===n&&h.props.efforts!==void 0&&f.add(h.props.modelId);let y=!1,k=an(t.api,a,(h,b,T,w,E,R)=>{Mt(e,h,b,T,w,E,R)},(h,b,T)=>{Xi(e,h,b,T)},void 0,()=>y);for(let h of m){let b=typeof h.id=="string"?h.id:"";if(b.length===0)continue;let T=tn(m,b),w=nn(m,b),E=T!==void 0||h[le]===!0,R=Array.isArray(w)&&w.length>0||h[xe]===!0;if(f.has(b)&&!E||E&&R)continue;let W=rn(m,b),B=sn(m,b)??"",C=await k.suggest(n,b,on(m,b));if(!C.ok){i+=1;continue}let P=C.suggestion,A=P.efforts!==!1,D=P.input===void 0?Ve(w):Ve(P.input);if(E){if(!D.image||e.queued.get(n)?.has(b)===!0)continue;y=!p.has(b),k.commit(n,b,un({efforts:"keep",input:ln(D)})),y&&t.onPendingChanged?.(),y=!1,o+=1;continue}let V=P.defaultEffort??B,$=V===B?void 0:V===""?null:V;y=!p.has(b),k.commit(n,b,un({efforts:br(A,it($e(P.efforts)),T),input:dn(D,w)?void 0:ln(D),defaultEffort:$,manualCompat:bi(W),appliedCompat:P.compat,routeApi:c,initialCompat:W})),y&&t.onPendingChanged?.(),y=!1,o+=1}return{held:o,unsuggested:i}}catch(s){return console.warn("[bre] provider-wide adapt failed:",s),{held:o,unsuggested:i,failed:s instanceof Error?s.message:String(s)}}finally{e.adapting.delete(n)}}function Cl(e){return e.querySelector(`[data-plugin="${X}"]`)!==null}function Fl(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&&kt(e.efforts,t.efforts)&&Wl(e.input,t.input)&&Kl(e.compat,t.compat)}function Kl(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 Wl(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 ql(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 Ee(e,t,n){let r=e.querySelector('[class*="editorRoute"]')?.textContent?.trim();if(r!==void 0&&r.length>0&&st(t,r))return{route:r,staged:!1};if(ql(e,n.routeId)){let s=we(e,n.routeId);return s.length>0&&!st(t,s)?{route:s,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(([,s])=>s.displayName===o);if(i!==void 0)return{route:i[0],staged:!1};if(st(t,o))return{route:o,staged:!1}}function Bl(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"]'),s=n.querySelector('[class*="secondaryButton"]');if(i!==null&&s!==null)return{submit:i,cancel:s};let a=[...r].reverse().find(p=>t.apply.some(m=>o(p,m))),d=[...r].reverse().find(p=>t.cancel.some(m=>o(p,m)));if(a!==void 0&&d!==void 0)return{submit:a,cancel:d};let u=r[r.length-1],g=r[r.length-2];if(!(u===void 0||g===void 0))return{submit:u,cancel:g}}function kn(e,t,n){t.has(e)||(t.add(e),e.addEventListener("click",n,{capture:!0}))}var Mr=new WeakMap,Hr=420,Ul=320,jl=160,ji=2e3,Gl=150,Zi=new Set(["PageUp","PageDown","Home","End","ArrowUp","ArrowDown"," "]);function Tn(e,t){let n=Tr(e),r=n[0];if(r===void 0||!e.isConnected)return;let o=performance.now(),i=Mr.get(r);if(i!==void 0){i.deadline=Math.min(Math.max(i.deadline,o+t),i.startedAt+ji);return}let s=e.getBoundingClientRect(),a=s.top,d=s.height,u=new Map,g=new Map;for(let h of n)u.set(h,h.scrollTop),g.set(h,h.style.overflowAnchor),h.style.overflowAnchor="none";let p=new Set(n),m={deadline:o+t,startedAt:o,frame:void 0,release:()=>{}},l=()=>{m.frame!==void 0&&(window.cancelAnimationFrame(m.frame),m.frame=void 0);for(let[h,b]of g)h.style.overflowAnchor=b;Mr.delete(r),document.removeEventListener("wheel",c,!0),document.removeEventListener("touchstart",c,!0),document.removeEventListener("pointerdown",c,!0),document.removeEventListener("keydown",f,!0)};function c(){l()}function f(h){Zi.has(h.key)&&l()}m.release=l,Mr.set(r,m),document.addEventListener("wheel",c,{capture:!0,passive:!0}),document.addEventListener("touchstart",c,{capture:!0,passive:!0}),document.addEventListener("pointerdown",c,{capture:!0}),document.addEventListener("keydown",f,{capture:!0});let y=0,k=()=>{if(m.frame=void 0,y+=1,!e.isConnected||y>=Gl){l();return}let h=e.getBoundingClientRect(),b=Math.abs(h.height-d)>.5;if(!b&&[...p].some(E=>E.scrollTop!==u.get(E))){l();return}let T=h.top-a;T!==0&&zl(n,p,u,T);let w=performance.now();if(b&&(d=h.height,m.deadline=Math.min(Math.max(m.deadline,w+jl),m.startedAt+ji)),w>=m.deadline){l();return}m.frame=window.requestAnimationFrame(k)};m.frame=window.requestAnimationFrame(k)}function zl(e,t,n,r){let o=r;for(let i of[...t,...e]){if(o===0)break;let s=i.scrollTop;if(s!==n.get(i))continue;i.scrollTop=s+o;let a=i.scrollTop;a!==s&&(n.set(i,a),t.add(i),o-=a-s)}}var es='[class*="modelList"]',$l="bre-list-slack",Vl=3e3,Ln,at=new WeakMap,dt=new Set;function ts(e){if(!(e instanceof Element))return;let t=e.closest(es);if(t===null)return;let n=Tr(t).map(r=>({host:r,top:r.scrollTop}));n.length!==0&&(Ln={targets:n,at:performance.now()})}function Te(){Ln=void 0}function ns(e){ts(e.target)}function rs(e){if(Zi.has(e.key)){Te();return}ts(e.target)}var Lt=0;function os(){Lt+=1,!(Lt>1)&&(document.addEventListener("click",ns,!0),document.addEventListener("keydown",rs,!0),document.addEventListener("focusin",Te,!0),document.addEventListener("pointerdown",Te,!0),document.addEventListener("wheel",Te,{capture:!0,passive:!0}),document.addEventListener("touchstart",Te,{capture:!0,passive:!0}))}function En(e){let t=at.get(e);t!==void 0&&(at.delete(e),dt.delete(t),t.scrollTarget.removeEventListener("scroll",t.onScroll),t.spacer.remove())}function Yl(e){return e===document.scrollingElement?document:e}function Jl(){if(dt.size!==0)for(let e of Array.from(dt)){let t=e.host;if(!e.spacer.isConnected){at.delete(t),dt.delete(e),e.scrollTarget.removeEventListener("scroll",e.onScroll);continue}t.scrollTop<=t.scrollHeight-t.clientHeight-e.height&&En(t)}}function Gi(e,t){return e.scrollTop>e.scrollHeight-e.clientHeight-t}function Xl(e=performance.now()){let t=Ln;if(!(t===void 0||e-t.at>Vl))for(let n of t.targets){let r=n.host;if(!r.isConnected)continue;let o=at.get(r),i=o===void 0?0:o.height,s=r.scrollHeight-r.clientHeight-i,a=n.top-s;if(a<=0){o!==void 0&&!Gi(r,o.height)&&En(r);continue}let d=o;if(d===void 0){let u=document.createElement("div");u.className=$l,u.dataset.plugin=X,u.setAttribute("aria-hidden","true"),u.style.height="0px",(r===document.scrollingElement?document.body??r:r).appendChild(u);let p=()=>{let m=at.get(r);m!==void 0&&!Gi(r,m.height)&&En(r)};d={host:r,spacer:u,height:0,onScroll:p,scrollTarget:Yl(r)},at.set(r,d),dt.add(d),d.scrollTarget.addEventListener("scroll",p,{passive:!0})}d.height!==a&&(d.height=a,d.spacer.style.height=`${a}px`),r.scrollTop!==n.top&&(r.scrollTop=n.top)}}function is(){if(Lt=Math.max(0,Lt-1),!(Lt>0)){document.removeEventListener("click",ns,!0),document.removeEventListener("keydown",rs,!0),document.removeEventListener("focusin",Te,!0),document.removeEventListener("pointerdown",Te,!0),document.removeEventListener("wheel",Te,!0),document.removeEventListener("touchstart",Te,!0),Ln=void 0;for(let e of Array.from(dt))En(e.host)}}function ss(e,t=Hr){Xl(),Jl();let n=new Set;for(let r of Array.from(e.querySelectorAll(es))){let o=r.closest('[class*="rowCard"], [class*="setupCard"], [class*="addCard"]');o===null||n.has(o)||(n.add(o),Tn(o,t))}}function Ql(e,t){kn(e,t,()=>{let n=e.closest('[class*="modelEntry"]')??e.closest('[class*="rowCard"]');n!==null&&Tn(e.closest('[class*="rowCard"]')??n,Hr)})}var zi="{provider}";function Zl(e,t){let n=t.editProvider.map(o=>{let i=o.indexOf(zi);return i<0?void 0:{prefix:o.slice(0,i),suffix:o.slice(i+zi.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(s=>i.length>s.prefix.length+s.suffix.length&&i.startsWith(s.prefix)&&i.endsWith(s.suffix))&&o.closest("[data-plugin]")===null&&r.push(o)}return r}function eu(e,t){kn(e,t,()=>{let n=e.closest('[class*="rowCard"], [class*="setupCard"], [class*="addCard"]');n!==null&&Tn(n,Hr)})}function Or(e){return e.querySelector('[class*="editorActions"]')??e.querySelector('[class*="modelEntry"]')??void 0}function as(){return Or(Oe())!==void 0}function ds(e,t,n){if(!e.isConnected)return;let r=t.labels(),o=Or(e)!==void 0;for(let a of Array.from(e.querySelectorAll('[class*="rowCard"], [class*="setupCard"]')))for(let d of Zl(a,r))eu(d,n.editWired);let i=Array.from(e.querySelectorAll("button[aria-label]")).some(a=>r.capacity.some(d=>(a.getAttribute("aria-label")??"").startsWith(d)));if(!o){if(cn(e,[],{t:t.t}),n.mounted.size>0){for(let[,d]of n.mounted)d.editor.unmount();n.mounted.clear()}let a=n.editing;n.editing=!1,(a!==!1||xl(n)&&Date.now()>=n.nextFlushAt)&&vl(t,n).catch(d=>{console.error(`[bre] idle pass failed: ${d instanceof Error?d.message:String(d)}`)});return}if(n.editing=!0,!i){for(let[,d]of n.mounted)d.editor.unmount();n.mounted.clear(),n.describePromise??(n.describePromise=t.describeNamespace());let a=r;n.describePromise.then(d=>{_l(e,t,n,d,a)}).catch(d=>{console.error(`[bre] empty-catalog seat failed: ${d instanceof Error?d.message:String(d)}`)});return}for(let a of r.capacity)for(let d of Array.from(e.querySelectorAll("button[aria-label]")))(d.getAttribute("aria-label")??"").startsWith(a)&&Ql(d,n.disclosureWired);n.describePromise??(n.describePromise=t.describeNamespace());let s=a=>{if(!e.isConnected)return;let d=a.namespace,u=ye(d),g=[];for(let m of r.capacity){let l=Array.from(e.querySelectorAll("button[aria-label]")).filter(c=>(c.getAttribute("aria-label")??"").startsWith(m));for(let c of l){let f=St(c);if(f===void 0)continue;let y=c.closest('[class*="modelEntry"]')??f,k=we(y,r.modelId);k.length!==0&&g.push({container:Ol(c),row:y,modelId:k,card:f})}}cn(e,Il(g,u,r),{t:t.t,onRequest:m=>Qi(n,t,m,Pl(e,m,u,r))});for(let[m,l]of n.mounted)g.some(c=>c.container===m)||(l.editor.unmount(),n.mounted.delete(m));if(n.pending.size>0){let m=new Map;for(let c of g){let f=Ee(c.card,u,r);if(f===void 0)continue;let y=m.get(f.route);y===void 0&&m.set(f.route,y=new Set),y.add(c.modelId)}let l=new Map;for(let[c,f]of n.pending){if(!st(u,c))continue;let y=m.get(c),k=[...f.keys()].filter(h=>!y?.has(h));k.length>0&&l.set(c,new Set(k))}for(let[c,f]of l){let y=n.missedScans.get(c);if(y!==void 0)for(let k of f)y.has(k)&&(Mt(n,c,k,void 0),y.delete(k))}n.missedScans=l}let p=new Set(g.map(m=>m.card));for(let m of p){let l=Ee(m,u,r);if(l===void 0)continue;let c=l.route,f=Bl(m,r);f===void 0?n.signalsUnavailable=!0:(n.signalsUnavailable=!1,kn(f.submit,n.submitWired,()=>{let y=Ee(m,u,r)?.route??c;n.committing.add(y),ve(n)}),kn(f.cancel,n.cancelWired,()=>{let y=Ee(m,u,r)?.route??c;Ll(n,y)}))}g.forEach((m,l)=>{let c=m.container;if(c===void 0)return;let f=Ee(m.card,u,r);if(f===void 0)return;let{route:y,staged:k}=f,h=u[y]??{},b=Zt(u,y),T=new Set(b.map(H=>H.id)),w=k||!T.has(m.modelId),E=w?n.pending.get(y)?.get(m.modelId)?.efforts:void 0,R=w?E==="keep"?void 0:E:tn(b,m.modelId),W=!w&&b.some(H=>H.id===m.modelId&&H[le]===!0),B=w?n.pending.get(y)?.get(m.modelId)?.input:nn(b,m.modelId),C=w?n.pending.get(y)?.get(m.modelId)?.compat:rn(b,m.modelId),P=w?n.pending.get(y)?.get(m.modelId)?.defaultEffort??void 0:sn(b,m.modelId),A=w?we(m.row,r.modelName):"",D=w?A.length>0?A:void 0:on(b,m.modelId),V=k?we(m.card,r.apiProtocol):"",$=k?we(m.card,r.baseUrl):"",Q=k&&V.length>0?V:typeof h.api=="string"?h.api:void 0,F=k&&$.length>0?$:typeof h.baseURL=="string"?h.baseURL:void 0,K={route:y,routeDisplayName:k?y:typeof h.displayName=="string"?h.displayName:y,...Q===void 0?{}:{routeApi:Q},...F===void 0?{}:{routeBaseURL:F},modelId:m.modelId,...D===void 0?{}:{modelName:D},...R===void 0?{}:{efforts:R},...W?{effortsUnset:W}:{},...B===void 0?{}:{input:B},...C===void 0?{}:{compat:C},...P===void 0?{}:{defaultEffort:P},index:l,staged:w,officialInputTypes:Nl(c),api:an(t.api,void 0,(H,Z,oe,Ke,Xe,Ae)=>{Mt(n,H,Z,oe,Ke,Xe,Ae)},(H,Z,oe)=>{Xi(n,H,Z,oe)},H=>{Tl(n,H,m.modelId)},()=>(Ee(m.card,u,r)?.staged??k)||!T.has(m.modelId)),readOnly:a.writable!==!0,t:t.t},S=n.mounted.get(c);if(S!==void 0){Fl(S.props,K)||(S.props=K,S.editor.render(K));return}if(Cl(c))return;Tn(St(c)??m.card,Ul);let I=t.mount(c,K);n.mounted.set(c,{editor:I,props:K})})};n.describePromise.then(s,()=>{n.describePromise=void 0})}function G(e,t,n){e.getAttribute(t)!==n&&e.setAttribute(t,n)}function At(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 Mn(e,t){e!==void 0&&e.textContent!==t&&(e.textContent=t)}var Nr=require("react");var ee=require("react");function ls(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,40)}function Sn(e){return typeof e=="string"&&/^[\x21-\x7E]+$/.test(e)}function tu(e){for(let t of["error","message"]){let n=e[t];if(typeof n=="string"&&n.length>0)return n}}function nu(e){if(!N(e))return;let t=e.ref;if(typeof t!="string"||t.length===0)return;let n=e.alias,r=e.configured,o=e.masked;return{ref:t,...typeof n=="string"&&n.length>0?{alias:n}:{},enabled:e.enabled===!0,configured:typeof r=="boolean"?r:null,...typeof o=="string"&&o.length>0?{masked:o}:{}}}function ru(e){let t=e.entries;if(!Array.isArray(t))return;let n=[];for(let i of t){let s=nu(i);s!==void 0&&n.push(s)}let r=e.enabledRef,o=e.route;return{ok:!0,route:typeof o=="string"?o:"",enabledRef:typeof r=="string"&&r.length>0?r:null,entries:n}}async function ou(e){let t;try{t=await e.json()}catch{t=void 0}if(!N(t))return{ok:!1};if(t.ok===!0){let r=ru(t);if(r!==void 0)return r}let n=tu(t);return n===void 0?{ok:!1}:{ok:!1,error:n}}async function lt(e,t){let n=`${oo}?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 ou(r)}catch{return{ok:!1}}}var us={list:e=>lt(e),add:(e,t,n)=>lt(e,{op:"add",value:t,...n===void 0?{}:{alias:n}}),enable:(e,t)=>lt(e,{op:"enable",ref:t}),rename:(e,t,n)=>lt(e,{op:"rename",ref:t,...n===void 0?{}:{alias:n}}),remove:(e,t)=>lt(e,{op:"remove",ref:t}),replace:(e,t,n)=>lt(e,{op:"value",ref:t,value:n}),async reveal(e,t){try{let n=await fetch(`${qt}?route=${encodeURIComponent(e)}&ref=${encodeURIComponent(t)}`,{method:"GET",cache:"no-store",credentials:"same-origin"});if(!n.ok)return;let r=await n.json();if(!N(r)||r.ok!==!0)return;let o=r.key;return typeof o=="string"&&o.length>0?o:void 0}catch{return}}};var O=require("react/jsx-runtime"),iu="M3.9 8.35 6.6 11.05 12.1 5.5",su=["M8 3.9v8.2","M3.9 8h8.2"];function fs({paths:e}){return(0,O.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,O.jsx)("path",{d:t},t))})}function au(e,t){return e.masked!==void 0?e.masked:e.configured===!1?t("keysMissing"):"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"}function du(e){return e.alias??e.masked??e.ref}function cs(e){let{route:t,t:n}=e,r=e.client??us,o=(0,ee.useId)(),[i,s]=(0,ee.useState)(void 0),[a,d]=(0,ee.useState)(null),[u,g]=(0,ee.useState)(void 0),[p,m]=(0,ee.useState)(!1),[l,c]=(0,ee.useState)(void 0),[f,y]=(0,ee.useState)(""),[k,h]=(0,ee.useState)(""),[b,T]=(0,ee.useState)(void 0),w=(0,ee.useCallback)((A,D)=>{if(!A.ok){g({kind:"error",text:A.error??n("keysUnreachable")});return}s(A.entries),d(A.enabledRef),g(D===void 0?void 0:{kind:"status",text:D})},[n]);(0,ee.useEffect)(()=>{let A=!0;return(async()=>{let D=await r.list(t);A&&w(D,void 0)})(),()=>{A=!1}},[w,r,t]);let E=(0,ee.useCallback)(async(A,D)=>{m(!0),T(void 0),c(void 0);try{w(await A(),D)}finally{m(!1)}},[w]),R=()=>{c(void 0),y(""),h("")},W=(A,D)=>{c({kind:A,ref:D.ref}),y(A==="alias"?D.alias??"":""),h(""),T(void 0)},B=()=>{if(p||l===void 0)return;let A=l.kind,D=l.ref;if(A!=="alias"&&!Sn(k))return;let V=ls(f);m(!0),(async()=>{try{if(A==="add"){let Q=await r.add(t,k,V);w(Q,n("keysAdded")),Q.ok&&R();return}if(D===void 0)return;let $=A==="alias"?await r.rename(t,D,V):await r.replace(t,D,k);w($,n(A==="alias"?"keysRenamed":"keysReplaced")),$.ok&&R()}finally{m(!1)}})()},C=()=>{if(l===void 0)return null;let A=l.kind,D=A!=="alias",V=D&&k.length>0&&!Sn(k);return(0,O.jsxs)("div",{className:"bre-keys-form",children:[(0,O.jsxs)("div",{className:"bre-keys-form-fields",children:[A==="value"?null:(0,O.jsx)("input",{className:"bre-text-input bre-keys-name",type:"text",value:f,placeholder:n("keysAliasPlaceholder"),"aria-label":n("keysAlias"),disabled:p,autoFocus:A==="alias",onChange:$=>y($.target.value)}),D?(0,O.jsx)("input",{className:"bre-text-input bre-keys-secret",type:"password",autoComplete:"new-password",spellCheck:!1,value:k,placeholder:n(A==="add"?"keysValuePlaceholder":"keysNewValuePlaceholder"),"aria-label":n("keysValue"),"aria-invalid":V,disabled:p,autoFocus:!0,onChange:$=>h($.target.value)}):null]}),V?(0,O.jsx)("p",{className:"bre-effort-message bre-error",role:"alert",children:n("keysAddIllegal")}):null,(0,O.jsxs)("div",{className:"bre-keys-form-actions",children:[(0,O.jsx)("button",{type:"button",className:"bre-link-button",disabled:p,onClick:R,children:n("keysCancel")}),(0,O.jsx)("button",{type:"button",className:"bre-primary-button",disabled:p||D&&!Sn(k),onClick:B,children:n(A==="add"?"keysAddConfirm":"keysSave")})]})]})},P=()=>l?.kind==="add"?(0,O.jsx)("li",{className:"bre-keys-form-row",children:C()}):(0,O.jsx)("li",{className:"bre-keys-add-row",children:(0,O.jsxs)("button",{type:"button",className:"bre-keys-add",disabled:p,onClick:()=>{c({kind:"add"}),y(""),h(""),T(void 0)},children:[(0,O.jsx)("span",{className:"bre-keys-add-mark","aria-hidden":"true",children:(0,O.jsx)(fs,{paths:su})}),n("keysAdd")]})});return i===void 0?u===void 0?(0,O.jsx)("div",{className:"bre-keys"}):(0,O.jsxs)("div",{className:"bre-keys",children:[(0,O.jsx)("p",{className:"bre-effort-message bre-"+u.kind,role:u.kind==="error"?"alert":"status",children:u.text}),(0,O.jsx)("ul",{className:"bre-keys-list",children:P()})]}):(0,O.jsxs)("div",{className:"bre-keys",children:[(0,O.jsxs)("ul",{className:"bre-keys-list",children:[i.map(A=>{let D=du(A);return(0,O.jsxs)(ee.Fragment,{children:[(0,O.jsxs)("li",{className:"bre-keys-row","data-state":A.configured===!1?"missing":"ready",children:[A.alias===void 0?null:(0,O.jsx)("span",{className:"bre-keys-alias",children:A.alias}),(0,O.jsx)("span",{className:A.alias===void 0?"bre-keys-mask bre-keys-mask-plain":"bre-keys-mask",children:au(A,n)}),(0,O.jsx)("span",{className:"bre-keys-actions",children:b===A.ref?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("button",{type:"button",className:"bre-link-button bre-keys-danger",disabled:p,onClick:()=>{E(()=>r.remove(t,A.ref),n("keysRemoved"))},children:n("keysConfirmRemove")}),(0,O.jsx)("button",{type:"button",className:"bre-link-button",disabled:p,onClick:()=>T(void 0),children:n("keysCancel")})]}):(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)("button",{type:"button",className:"bre-link-button",disabled:p,onClick:()=>{T(A.ref),c(void 0)},children:n("keysRemove")}),(0,O.jsx)("button",{type:"button",className:"bre-link-button",disabled:p,onClick:()=>W("alias",A),children:n("keysAlias")}),(0,O.jsx)("button",{type:"button",className:"bre-link-button",disabled:p,onClick:()=>W("value",A),children:n("keysEdit")})]})}),(0,O.jsxs)("label",{className:"bre-keys-enable",title:n("keysEnable",{name:D}),children:[(0,O.jsx)("input",{type:"radio",name:o,className:"bre-keys-enabled",checked:A.enabled,disabled:p,"aria-label":n("keysEnable",{name:D}),onChange:()=>{E(()=>r.enable(t,A.ref),n("keysEnabledNote",{name:D}))}}),(0,O.jsx)("span",{className:"bre-keys-mark","aria-hidden":"true",children:A.enabled?(0,O.jsx)(fs,{paths:[iu]}):null}),(0,O.jsx)("span",{className:"bre-keys-enable-text",children:n("keysEnabled")})]})]}),l!==void 0&&l.ref===A.ref?(0,O.jsx)("li",{className:"bre-keys-form-row",children:C()}):null]},A.ref)}),P()]}),u===void 0?null:(0,O.jsx)("p",{className:"bre-effort-message bre-"+u.kind,role:u.kind==="error"?"alert":"status",children:u.text})]})}var Rn="bre-key-managed",lu="bre-keys-host",_r="data-bre-key-host",uu="data-bre-key-input",An="data-bre-region",Ie=new WeakMap;function fu(e){let t=e.querySelector(`input[${uu}]`);if(t instanceof HTMLInputElement)return t;let n=e.querySelector('input[type="password"]');return n instanceof HTMLInputElement?n:void 0}function ps(e){let t=Ie.get(e)?.host;if(t!==void 0&&t.isConnected)return t;let n=e.nextElementSibling;return n instanceof HTMLElement&&n.hasAttribute(_r)?n:void 0}function ms(e,t){let n=t.route;if(n===void 0||n.length===0||fu(e)===void 0||e.parentElement===null)return;De(e,Rn,!0);let r=Ie.get(e),o=ps(e);o===void 0&&(r!==void 0&&gs(e,r),o=e.ownerDocument.createElement("div"),o.className=lu,e.after(o)),G(o,_r,n);let i=e.getAttribute(An);i===null?o.hasAttribute(An)&&o.removeAttribute(An):G(o,An,i);let s=()=>(0,Nr.createElement)(ke,{fallbackText:t.t("keysPanelFailed")},(0,Nr.createElement)(cs,{route:n,t:t.t,client:t.client})),a=Ie.get(e);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(s()));return}a!==void 0&&(Ie.delete(e),a.mount.root.unmount()),Ie.set(e,{route:n,host:o,mount:wt(o,s(),{sync:!0}),t:t.t,client:t.client})}function gs(e,t){Ie.delete(e),je(t.mount)}function Hn(e){De(e,Rn,!1);let t=Ie.get(e);t!==void 0&&gs(e,t),ps(e)?.remove()}function hs(){for(let e of Array.from(document.querySelectorAll(`[${_r}]`))){let t=e.previousElementSibling;t instanceof HTMLElement&&Ie.has(t)?Hn(t):e.remove()}}var bs="http://www.w3.org/2000/svg",cu="data-bre-icon";function pu(e){let t=document.createElementNS(bs,"path");return t.setAttribute("d",e),t}function ys(e,t){let n=document.createElementNS(bs,"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(cu,e),n.append(...t.map(pu)),n}var Nn="bre-key-field",ks="bre-key-eye",On="data-bre-key-input",Es="data-bre-eye-show",Ts="data-bre-eye-hide",ws=["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"],Pr=new WeakMap;function Dr(e){let t=e.querySelector(`input[${On}]`);if(t instanceof HTMLInputElement)return t;let n=e.querySelector('input[type="password"]');return n instanceof HTMLInputElement?n:void 0}function Ls(e){for(let t of Array.from(e.children))if(t instanceof HTMLButtonElement&&t.classList.contains(ks))return t}function Ms(e,t){let n=Dr(e);if(n===void 0){_n(e);return}Pr.set(e,t),G(n,On,""),De(e,Nn,!0);let r=Ls(e)??gu(e);G(r,Es,t.t("keyRevealShow")),G(r,Ts,t.t("keyRevealHide")),Ir(r,n)}function _n(e){let t=Ls(e);t!==void 0&&t.remove(),Pr.delete(e),De(e,Nn,!1);let n=e.querySelector(`input[${On}]`);n instanceof HTMLInputElement&&(n.removeAttribute(On),n.type="password")}async function mu(e){try{let t=await fetch(`${qt}?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 Ir(e,t){let n=t.type!=="password";G(e,"aria-pressed",n?"true":"false");let r=e.getAttribute(n?Ts:Es);r!==null&&(G(e,"aria-label",r),G(e,"title",r)),At(e,t.disabled)}function vs(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 gu(e){let t=document.createElement("button");t.type="button",t.className=ks,t.append(xs("eye"),xs("eye-off"));let n,r=async()=>{let o=Dr(e),i=Pr.get(e);if(o===void 0||i===void 0)return;if(o.type!=="password"){n!==void 0&&o.value===n&&vs(o,""),n=void 0,o.type="password",Ir(t,o);return}let s=i.route;if(s!==void 0&&n===void 0&&o.value.length===0){G(t,"aria-busy","true");let a;try{a=await(i.loadKey??mu)(s)}catch{a=void 0}if(t.hasAttribute("aria-busy")&&t.removeAttribute("aria-busy"),a===void 0){let d=i.t("keyRevealFailed");G(t,"aria-label",d),G(t,"title",d);return}Dr(e)===o&&o.value.length===0&&(n=a,vs(o,a))}o.type="text",Ir(t,o)};return t.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),r()}),e.append(t),t}function xs(e){let t=e==="eye-off"?[...ws,"M2.5 13.5 13.5 2.5"]:ws;return ys(e,t)}var Cr="bre-editor-tabs",hu="bre-editor-tab",Dn="data-bre-tab-id",Ot="bre-tabbed",Ce="data-bre-tab",Ss="data-bre-provider",ce="data-bre-region",Ht="data-bre-editor-body",Nt="data-bre-details";var bu=".bre-headers",Pe="provider",ut="models",ft="advanced",yu=[Pe,ut,ft],wu="none",As=yu,Rs=Cr,Hs=hu,Os=Dn,In='[class*="editorActions"], [class*="modelList"], [class*="modelCatalog"], [class*="modelEntry"]',vu='[class*="modelCatalog"], [class*="modelList"], [class*="modelEntry"]',Ns='[class*="rowCard"], [class*="addCard"], li';function _s(){return{warned:new WeakSet}}function Cn(e){return e===null?null:e.closest(Ns)}function Ds(e,t){let n=yn(e),r=e.getBoundingClientRect().top,o=n?.scrollTop??0;n!==void 0&&(n.style.overflowAnchor="none"),G(e,Ce,t),Cs(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 Fr(e,t,n){if(!e.isConnected)return;let r=new Set;for(let o of Array.from(e.querySelectorAll(In))){let i=o.closest(Ns);i!==null&&r.add(i)}for(let o of Array.from(e.querySelectorAll(`.${Ot}`)))r.has(o)||Pn(o);for(let o of r)try{Lu(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)),Pn(o)}}function Is(){for(let e of Array.from(document.querySelectorAll(`.${Ot}`))){e.classList.remove(Ot),e.removeAttribute(Ce),e.removeAttribute(Ht);for(let t of Array.from(e.querySelectorAll(`[${ce}]`)))t.removeAttribute(ce)}for(let e of Array.from(document.querySelectorAll(`[${Ce}]`)))e.removeAttribute(Ce);for(let e of Array.from(document.querySelectorAll(`[${ce}]`)))e.removeAttribute(ce);for(let e of Array.from(document.querySelectorAll(`[${Ht}]`)))e.removeAttribute(Ht);for(let e of Array.from(document.querySelectorAll(`details[${Nt}]`)))e.removeAttribute("open"),e.removeAttribute(Nt);for(let e of Array.from(document.querySelectorAll(`.${Nn}`)))_n(e);for(let e of Array.from(document.querySelectorAll(`.${Rn}`)))Hn(e);hs()}function xu(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(In)!==null||n.querySelector("input, select")!==null))return n;let t=e.querySelector(In);for(;t!==null&&t.parentElement!==e;)t=t.parentElement;return t!==null&&t!==e?t:void 0}function ku(e){let t={header:void 0,models:void 0,actions:void 0,fields:[]};Ps(e,t,0);let{actions:n,fields:r,header:o,models:i}=t;if(!(n===void 0||r.length===0)&&r.some(s=>s.querySelector("input, select, textarea")!==null))return{header:o,models:i,actions:n,fields:r}}var Eu=4;function Ps(e,t,n){if(!(n>Eu)){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(vu)){t.models??(t.models=r);continue}if(r.querySelector(In)!==null){Ps(r,t,n+1);continue}if(r.querySelector('[class*="editorActions"]')!==null){t.actions??(t.actions=r);continue}r.querySelector("input, select, textarea")!==null&&t.fields.push(r)}}}function Tu(e){let n=e.querySelector(`[${Ss}]`)?.getAttribute(Ss);return n==null||n===""?void 0:n}function Lu(e,t){let n=xu(e);if(n===void 0){Pn(e);return}let r=ku(n);if(r===void 0){Pn(e);return}let o=e.querySelector(bu),i=Tu(e);for(let d of r.fields)G(d,ce,Pe),Ms(d,{t:t.t,route:i}),ms(d,{t:t.t,route:i});r.header!==void 0&&G(r.header,ce,wu),r.models!==void 0&&G(r.models,ce,ut),G(n,Ht,""),o!==null&&G(o,ce,ft),Su(n);let s=new Set([Pe]);r.models!==void 0&&s.add(ut),o!==null&&s.add(ft);let a=e.getAttribute(Ce)??Pe;G(e,Ce,s.has(a)?a:Pe),De(e,Ot,!0),Mu(e,t,s)}function Mu(e,t,n){let r=e.querySelector(`.${Cr}`);r!==null&&(G(r,"aria-label",t.t("editorTabsLabel")),Mn(Rt(r,Pe),t.t("editorTabProvider")),Mn(Rt(r,ut),t.t("editorTabModels")),Mn(Rt(r,ft),t.t("editorTabAdvanced")),At(Rt(r,ut),!n.has(ut)),At(Rt(r,ft),!n.has(ft)),Cs(e,r))}function Cs(e,t){let n=t??e.querySelector(`.${Cr}`);if(n===null)return;let r=e.getAttribute(Ce)??Pe;for(let o of Array.from(n.querySelectorAll(`[${Dn}]`)))G(o,"aria-selected",o.getAttribute(Dn)===r?"true":"false")}function Rt(e,t){for(let n of Array.from(e.children))if(n instanceof HTMLElement&&n.getAttribute(Dn)===t)return n}function Pn(e){e.classList.remove(Ot),e.removeAttribute(Ce),e.removeAttribute(Ht);for(let t of Array.from(e.querySelectorAll(`[${ce}]`)))t.getAttribute(ce)===Pe&&(_n(t),Hn(t)),t.removeAttribute(ce);Au(e)}function Su(e){for(let t of Array.from(e.querySelectorAll("details")))t.hasAttribute("open")||(G(t,Nt,"closed"),G(t,"open",""))}function Au(e){for(let t of Array.from(e.querySelectorAll(`details[${Nt}]`)))t.removeAttribute("open"),t.removeAttribute(Nt)}var _t="data-bre-row-provider",Fs="{provider}",Ru=["rowCard","setupCard"];function Ks(){return gn()}function Le(e){for(let t of Ru)for(let n of Array.from(e.querySelectorAll(`[class*="${t}"]`))){let r=n.parentElement;if(!(r===null||r.tagName!=="UL")&&re(r).length!==0)return r}}function Dt(e){return e.querySelector('[class*="rowHead"]')??void 0}function ct(e){let t=e.querySelector('[class*="rowName"]')?.textContent?.trim();return t!==void 0&&t.length>0?t:void 0}function Hu(e){let t=e.indexOf(Fs);if(!(t<0))return{prefix:e.slice(0,t),suffix:e.slice(t+Fs.length)}}function Ou(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 Nu='[class*="rowCard"], [class*="setupCard"], [class*="addCard"]';function _u(e){let t=e.closest(Nu);for(let n=e;n!==null&&n!==t;n=n.parentElement)if(n.matches('[data-plugin], [class*="bre-"]'))return!0;return!1}function Me(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=Hu(r);if(o!==void 0)for(let i of Array.from(e.querySelectorAll("button[aria-label]"))){if(_u(i))continue;let s=i.getAttribute("aria-label")??"";if(s.length<=o.prefix.length+o.suffix.length||!s.startsWith(o.prefix)||!s.endsWith(o.suffix))continue;let a=Ou(s.slice(o.prefix.length,s.length-o.suffix.length));if(a!==void 0)return a}}}function Kr(e){let t=e.getAttribute(_t);return t===null||t.length===0?void 0:t}function Du(e){return Tt(e,Kr)}function Ws(e,t,n){if(!e.isConnected)return;let r=Le(e);if(r===void 0)return;let o=t.labels();for(let i of re(r)){let s=Me(i,o);if(s===void 0){i.removeAttribute(_t);continue}Kr(i)!==s&&i.setAttribute(_t,s)}wn(e,r,Iu(t),n)}function Iu(e){return{rowOf:t=>{let n=t.closest("li");return n instanceof HTMLElement?n:void 0},idOf:Kr,labelOf:ct,order:t=>wo(t),commit:t=>{bo(Du(t))},seatOf:Dt,seatDrags:!0,gripLabel:(t,n)=>e.t("providerReorderAria",{provider:ct(t)??n}),gripHint:()=>e.t("providerReorderHint")}}function qs(e){vn(e);let t=Array.from(document.querySelectorAll(`[${_t}]`));bn(t);for(let n of t)n.removeAttribute(_t)}var pt="data-bre-provider-switch",Fn="bre-row-disabled";function Us(){return{switches:new WeakSet}}function js(e,t,n){if(!e.isConnected)return;let r=Le(e);if(r===void 0)return;let o=t.labels();for(let i of Array.from(r.children)){if(!(i instanceof HTMLElement))continue;let s=Me(i,o);if(s===void 0)continue;let a=Dt(i);a!==void 0&&(Pu(i,a,s,t,n),i.classList.toggle(Fn,!rt(s)))}}function Gs(){for(let e of Array.from(document.querySelectorAll(`[${pt}]`)))e.remove();for(let e of Array.from(document.querySelectorAll(`.${Fn}`)))e.classList.remove(Fn)}function Pu(e,t,n,r,o){let i=t.querySelector(`[${pt}]`);if(i!==null){Bs(i,e,n,r);return}let s=document.createElement("button");s.className="bre-provider-switch",s.setAttribute("type","button"),s.setAttribute("role","switch"),s.setAttribute(pt,n),Bs(s,e,n,r),Cu(s,e,o);let a=t.querySelector('[class*="rowActions"]');a===null?t.appendChild(s):a.insertBefore(s,a.firstChild)}function Bs(e,t,n,r){let o=r.t("providerToggleAria",{provider:ct(t)??n}),i=r.t("providerToggleHint"),s=rt(n)?"true":"false";e.getAttribute(pt)!==n&&e.setAttribute(pt,n),e.getAttribute("aria-checked")!==s&&e.setAttribute("aria-checked",s),e.getAttribute("aria-label")!==o&&e.setAttribute("aria-label",o),e.getAttribute("title")!==i&&e.setAttribute("title",i)}function Cu(e,t,n){n.switches.has(e)||(n.switches.add(e),e.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation();let o=e.getAttribute(pt);if(o===null)return;let i=!rt(o);ko(o,i),e.setAttribute("aria-checked",i?"true":"false"),t.classList.toggle(Fn,!i)}))}var Kn="data-bre-provider-delete",zs='[class*="rowActions"]',$s='[class*="dangerButton"]',Fu="bre-provider-delete";function Vs(e,t){if(!e.isConnected)return;let n=Le(e);if(n===void 0)return;let r=t.labels(),o=Ku(n)??t.t("providerRemoveDisabled");for(let i of Array.from(n.children)){if(!(i instanceof HTMLElement))continue;let s=Me(i,r);if(s===void 0)continue;let a=Dt(i);if(a===void 0)continue;let d=a.querySelector(zs);if(d===null)continue;let u=d.querySelector(`[${Kn}]`);if(d.querySelector($s)!==null){u!==null&&u.remove();continue}let g=u??Wu();d.lastElementChild!==g&&d.appendChild(g),qu(g,s,o,t.t("providerRemoveLocked",{provider:ct(i)??s}))}}function Ys(){for(let e of Array.from(document.querySelectorAll(`[${Kn}]`)))e.remove()}function Ku(e){let n=e.querySelector(`${zs} ${$s}`)?.textContent?.trim()??"";return n.length>0?n:void 0}function Wu(){let e=document.createElement("button");return e.className=Fu,e.setAttribute("type","button"),e.setAttribute("disabled",""),e}function qu(e,t,n,r){e.getAttribute(Kn)!==t&&e.setAttribute(Kn,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 Wn="data-bre-provider-disabled-group",Bu="bre-provider-disabled-seat",Js="bre-provider-disabled-group",Wr="bre-row-folded",qr="bre-row-hidden";function Xs(){return{expanded:!1}}function Qs(e,t,n){if(!e.isConnected)return;let r=Le(e);if(r===void 0)return;let o=ea(r,t.labels()),i=o.filter(u=>!u.enabled).length,s=ta(r);if(i===0){s!==void 0&&s.remove(),Br(o,n);return}let a=s??Uu(r,t,n);(a.parentElement!==r||r.lastElementChild!==a)&&r.append(a),Br(o,n);let d=na(a);d!==void 0&&ra(d,i,t,n)}function Zs(){for(let e of Array.from(document.querySelectorAll(`[${Wn}]`)))e.remove();for(let e of Array.from(document.querySelectorAll(`.${qr}, .${Wr}`)))e.classList.remove(qr,Wr)}function ea(e,t){let n=[];for(let r of Array.from(e.children)){if(!(r instanceof HTMLElement)||r.getAttribute(Wn)!==null)continue;let o=Me(r,t);o!==void 0&&n.push({row:r,id:o,enabled:rt(o)})}return n}function Br(e,t){for(let n of e){let r=!n.enabled;n.row.classList.toggle(Wr,r),n.row.classList.toggle(qr,r&&!t.expanded)}}function ta(e){for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.getAttribute(Wn)!==null)return t}function na(e){return e.querySelector(`button.${Js}`)??void 0}function Uu(e,t,n){let r=document.createElement("li");r.className=Bu,r.setAttribute(Wn,"");let o=document.createElement("button");return o.className=Js,o.setAttribute("type","button"),o.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),n.expanded=!n.expanded,ju(e,t,n)}),r.appendChild(o),e.append(r),r}function ju(e,t,n){let r=ea(e,t.labels());Br(r,n);let o=ta(e);if(o===void 0)return;let i=r.filter(a=>!a.enabled).length;if(i===0){o.remove();return}let s=na(o);s!==void 0&&ra(s,i,t,n)}function ra(e,t,n,r){let o=n.t(r.expanded?"providerDisabledGroupHide":"providerDisabledGroupShow",{count:t}),i=n.t("providerDisabledGroupHint"),s=r.expanded?"true":"false";e.textContent!==o&&(e.textContent=o),e.getAttribute("aria-expanded")!==s&&e.setAttribute("aria-expanded",s),e.getAttribute("aria-label")!==o&&e.setAttribute("aria-label",o),e.getAttribute("title")!==i&&e.setAttribute("title",i)}var It="data-bre-row-model",Ur="bre-model-grid";function ia(){return gn()}function Gu(e){let t=[];for(let n of Array.from(e.querySelectorAll('[class*="modelList"]')))re(n).filter(o=>o.matches('[class*="modelEntry"]')).length!==0&&t.push(n);return t}function sa(e){for(let t of e){if(t.type!=="childList")continue;let n=t.target;if(n instanceof HTMLElement&&n.matches('[class*="modelList"]')&&re(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 qn(e){let t=e.getAttribute(It);return t===null||t.length===0?void 0:t}function jr(e,t){let n=e.closest("li");if(n!==null)return Me(n,t.labels())}function oa(e,t){let n=we(e,t.labels().modelName);return n.length>0?n:qn(e)}function zu(e,t){return{rowOf:n=>{let r=n.closest('[class*="modelEntry"]');return r instanceof HTMLElement?r:void 0},idOf:qn,labelOf:n=>oa(n,t),order:n=>{let r=jr(e,t);return r===void 0?n:Oo(r,n)},commit:n=>{let r=jr(n,t);r!==void 0&&Ro(r,Tt(n,qn))},seatOf:n=>n.querySelector('[class*="modelRow"]')??void 0,seatDrags:!1,gripLabel:(n,r)=>t.t("modelReorderAria",{model:oa(n,t)??r}),gripHint:()=>t.t("modelReorderHint"),decorate:(n,r)=>{r.classList.add(Ur)}}}function aa(e,t,n){if(!e.isConnected)return;let r=t.labels();for(let o of Gu(e))if(jr(o,t)!==void 0){for(let i of re(o)){let s=we(i,r.modelId);if(s.length===0){i.removeAttribute(It);continue}qn(i)!==s&&i.setAttribute(It,s)}wn(e,o,zu(o,t),n)}}function da(e){vn(e);for(let n of Array.from(document.querySelectorAll(`.${Ur}`)))n.classList.remove(Ur);let t=Array.from(document.querySelectorAll(`[${It}]`));bn(t);for(let n of t)n.removeAttribute(It)}var $u="settings.models",Se={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}"]};function ua(e){let{ctx:t,api:n,t:r,onIdle:o,refreshed:i}=e,s=()=>{let F=t.locale.bind($u),K=([S,...I])=>{let H=F(S);return H===S||H.trim()===""?I:[H,...I]};return{capacity:K(Se.capacity),modelId:K(Se.modelId),modelName:K(Se.modelName),routeId:K(Se.routeId),baseUrl:K(Se.baseUrl),apiProtocol:K(Se.apiProtocol),apply:K(Se.apply),cancel:K(Se.cancel),editProvider:K(Se.editProvider)}},a=120,d=Ji(),u=Ks(),g={t:r,labels:s},p=Us(),m={t:r,labels:s},l={t:r,labels:s},c=Xs(),f={t:r,labels:s},y=ia(),k={t:r,labels:s},h=_s(),b={t:r},T,w,E,R,W=!1,B={api:n,describeNamespace:()=>ne(n),t:r,labels:s,onIdle:o,onBackoff:F=>{C(F)},onPendingChanged:()=>{A()},mount(F,K){let S=document.createElement("div");S.className="bre-effort-slot",S.dataset.plugin=X,F.appendChild(S);let I=(0,la.createRoot)(S),H=Z=>{I.render((0,Gr.createElement)(ke,{fallbackText:r("renderFailed"),children:i(()=>(0,Gr.createElement)(fn,Z))}))};return H(K),{unmount:()=>{I.unmount()},render:H}}};function C(F){W||w!==void 0||(w=window.setTimeout(()=>{w=void 0,A()},F))}let P=()=>{let F=Oe();Le(F)!==void 0&&(Ws(F,g,u),js(F,m,p),Vs(F,l),Qs(F,f,c),aa(F,k,y))};function A(){W||T!==void 0||(T=window.setTimeout(()=>{T=void 0,R?.(),ds(Oe(),B,d),Fr(Oe(),b,h),P()},a))}let D=F=>{W||E!==void 0||(R=F,F(),P(),os(),E=new MutationObserver(K=>{F(),Fr(Oe(),b,h),P(),sa(K)&&ss(Oe()),A()}),E.observe(document.body,{childList:!0,subtree:!0}),A())},V=()=>{W=!0,T!==void 0&&(window.clearTimeout(T),T=void 0),w!==void 0&&(window.clearTimeout(w),w=void 0),E?.disconnect(),E=void 0};return{state:d,labels:s,start:D,stopObserver:V,teardown:()=>{V(),Vi(d,B);for(let[,F]of d.mounted)F.editor.unmount();d.mounted.clear(),qs(u),Gs(),Ys(),Zs(),xi(),da(y),Is(),is()},flushOnUnload:()=>{Yi(d,B)},schedule:A}}function Vu(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,s]of Object.entries(n?.byId??{}))if(!(s===void 0||(s.retainedBy?.mainView??0)<=0))return typeof s.id=="string"&&s.id.length>0?s.id:i}function fa(e){let t,n=new Map,r=(s,a)=>{for(let[d,u]of n){if(d===a)continue;let g;try{g=s.directoryFor(u.sessionId)===d}catch{g=!1}g||(u.restore(),n.delete(d))}};return{ensure:()=>{let s=e.ctx,a=s.get?.("sessions"),d=s.get?.("uiSession"),u=s.get?.("modelDirectories"),g=Vu(a,d);if(!(g===void 0||u===void 0))try{let p=u.directoryFor(g);return r(u,p),t!==void 0&&t.sessionId===g&&t.directory===p||(n.has(p)||n.set(p,{sessionId:g,restore:Uo(p,{configuredEffort:e.configuredEffort})}),t={sessionId:g,directory:p}),p}catch{t=void 0;return}},dispose:()=>{for(let[,s]of n)s.restore();n.clear()}}}var Yu="conversation.input.model";function ca(e){return e.querySelector("[data-composer-card]")??void 0}function zr(e){return e.querySelector(`[data-slot="${Yu}"]`)??void 0}function pa(e){let t=zr(e)??e;return Array.from(t.querySelectorAll('button[aria-haspopup="menu"]'))}function ma(e,t){let n=e.getAttribute("aria-controls");if(n===null||n.length===0)return;let r=t.getElementById(n);if(r!==null)return r.getAttribute("role")==="menu"?r:void 0}function $r(e=document){let t=ca(e);if(t===void 0)return;for(let r of pa(t)){let o=ma(r,e);if(o!==void 0)return o}let n=zr(t)??t;for(let r of Array.from(n.querySelectorAll('[role="menu"]')))if(r.previousElementSibling?.matches('button[aria-haspopup="menu"]'))return r}function Vr(e=document){let t=ca(e);if(t===void 0)return;let n=zr(t),r=pa(t),o=r[0];if(o!==void 0){for(let i of r)if(ma(i,e)!==void 0)return i;for(let i of r)if(i.nextElementSibling?.matches('[role="menu"]'))return i;return n===void 0?r.at(-1):o}}function ga(){return $r()}function ha(){return Vr()}var Fe=require("react");var J=require("react");var _=require("react/jsx-runtime"),Ju=["claude-cli/2.1.161 (external, cli)","claude-code/1.0.0","Kilo-Code/1.0"];function ba(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 Xu(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 ya({route:e,api:t,t:n}){let r=(0,J.useId)(),[o,i]=(0,J.useState)(void 0),[s,a]=(0,J.useState)({rows:[]}),[d,u]=(0,J.useState)(!1),[g,p]=(0,J.useState)(!1),[m,l]=(0,J.useState)(!0),[c,f]=(0,J.useState)(!1),[y,k]=(0,J.useState)(!1),[h,b]=(0,J.useState)(void 0),[T,w]=(0,J.useState)(void 0),[E,R]=(0,J.useState)(!1),W=(0,J.useRef)(0),B=(0,J.useRef)(null);(0,J.useEffect)(()=>{let S=!0;return(async()=>{try{let I=await ne(t);if(!S)return;let H=mr(I.namespace,e);i(H),a(ba(H,W)),k(I.writable!==!0)}catch{S&&k(!0)}finally{S&&l(!1)}})(),()=>{S=!1}},[t,e]),(0,J.useEffect)(()=>{let S=!0;return(async()=>{try{let H=await(await fetch(so,{method:"GET"})).json();S&&H.ok===!0&&H.data!==void 0&&w(H.data)}catch{}})(),()=>{S=!1}},[]),(0,J.useEffect)(()=>{let S=B.current;if(S===null)return;let I=()=>{R(S.dataset.breRegion==="advanced")};I();let H=new MutationObserver(I);return H.observe(S,{attributes:!0,attributeFilter:["data-bre-region"]}),()=>{H.disconnect()}},[]);let C=()=>{a(S=>({...S,rows:[...S.rows,{id:W.current+=1,name:"",value:""}]})),b(void 0)},P=(S,I)=>{a(H=>({...H,rows:H.rows.map(Z=>Z.id===S?{...Z,...I}:Z)})),b(void 0)},A=S=>{a(I=>({...I,rows:I.rows.filter(H=>H.id!==S)})),b(void 0)},D=()=>{a(ba(o,W)),p(!1),b(void 0)},V=async S=>{f(!0),b(void 0);let I;try{I=await gr(t,e,S)}catch(H){I={ok:!1,error:H instanceof Error?H.message:String(H)}}if(f(!1),!I.ok){b({kind:"error",text:I.error==="no-route"?n("headersNoRoute"):I.error==="read-only"?n("headersReadOnly"):n("headersError",{error:I.error})});return}i(S),p(!1),b({kind:"success",text:Object.keys(S).length===0?n("headersCleared"):n("headersSaved")})},$=Object.entries(o??{}),Q=y||c,F=$.length,K=E;return(0,_.jsxs)("div",{className:"bre-headers",ref:B,"data-plugin":X,"data-open":d?"1":"0",children:[(0,_.jsx)("div",{className:"bre-headers-head",children:g||E?(0,_.jsx)("span",{className:"bre-effort-title",children:n("headersTitle")}):(0,_.jsxs)("button",{type:"button",className:"bre-headers-disclosure","aria-expanded":d,"aria-label":`${n("headersTitle")} ${e}`,onClick:()=>{u(!d),b(void 0)},children:[(0,_.jsx)("span",{className:"bre-effort-title",children:n("headersTitle")}),m||F===0?null:(0,_.jsx)("span",{className:"bre-headers-count",children:F}),(0,_.jsx)("span",{className:"bre-headers-chevron","aria-hidden":"true",children:"\u203A"})]})}),!d&&!g&&!E?null:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)("p",{className:"bre-effort-note",children:n("headersHint")}),T===void 0?null:(0,_.jsxs)(_.Fragment,{children:[T.environment.preferOfficialLayer?(0,_.jsx)("p",{className:"bre-effort-note bre-warn",children:n("headersConflictPatched")}):null,T.conflicts.length===0&&(T.headerConflicts?.length??0)===0?null:(0,_.jsx)("p",{className:"bre-effort-note bre-warn",children:n("headersConflictOrigin")}),T.environment.siblings.length===0?null:(0,_.jsx)("p",{className:"bre-effort-note bre-warn",children:n("headersConflictSiblings",{names:T.environment.siblings.map(S=>S.name).join(", ")})})]}),m?null:g||K?(0,_.jsxs)("div",{className:"bre-headers-edit",children:[(0,_.jsxs)("div",{className:"bre-headers-columns","aria-hidden":"true",children:[(0,_.jsx)("span",{children:n("headersName")}),(0,_.jsx)("span",{children:n("headersValue")}),(0,_.jsx)("span",{})]}),s.rows.map(S=>(0,_.jsxs)("div",{className:"bre-headers-row",children:[(0,_.jsx)("input",{type:"text",className:"bre-text-input bre-headers-name",value:S.name,disabled:Q,placeholder:n("headersNamePlaceholder"),"aria-label":n("headersName"),onChange:I=>{P(S.id,{name:I.target.value})}}),(0,_.jsx)("input",{type:"text",className:"bre-text-input bre-headers-value",value:S.value,disabled:Q,list:S.name.trim().toLowerCase()==="user-agent"?r:void 0,placeholder:n("headersValue"),"aria-label":n("headersValue"),onChange:I=>{P(S.id,{value:I.target.value})}}),(0,_.jsx)("button",{type:"button",className:"bre-link-button bre-headers-remove",disabled:Q,"aria-label":`${n("headersClear")} ${S.name}`,onClick:()=>{A(S.id)},children:"\xD7"})]},S.id)),(0,_.jsx)("button",{type:"button",className:"bre-link-button bre-headers-add",disabled:Q,onClick:C,children:n("headersAdd")}),!1,(0,_.jsx)("datalist",{id:r,children:Ju.map(S=>(0,_.jsx)("option",{value:S},S))}),(0,_.jsx)("p",{className:"bre-effort-note bre-headers-legacy",hidden:!0,children:n("headersUserAgentHint")}),(0,_.jsxs)("div",{className:"bre-effort-actions",children:[(0,_.jsx)("button",{type:"button",className:"bre-primary-button",disabled:Q,onClick:()=>{V(Xu(s))},children:n("headersSave")}),(0,_.jsx)("button",{type:"button",className:"bre-secondary-button",disabled:Q,onClick:D,children:n("headersCancel")})]})]}):(0,_.jsxs)("div",{className:"bre-headers-rows",children:[$.length===0?(0,_.jsx)("p",{className:"bre-effort-note",children:n("headersEmpty")}):$.map(([S,I])=>(0,_.jsxs)("div",{className:"bre-headers-row",children:[(0,_.jsx)("span",{className:"bre-headers-name",children:S}),(0,_.jsx)("span",{className:"bre-headers-value bre-headers-masked",children:"\u2022".repeat(Math.min(I.length,24))})]},S)),y?null:(0,_.jsx)("div",{className:"bre-effort-actions",children:(0,_.jsx)("button",{type:"button",className:"bre-secondary-button",disabled:Q,onClick:()=>{p(!0),b(void 0)},children:n("headersEdit")})})]})]}),h===void 0?null:(0,_.jsx)("p",{className:"bre-effort-message bre-"+h.kind,role:h.kind==="error"?"alert":"status",children:h.text})]})}var Yr=require("react");var Qu={provider:"editorTabProvider",models:"editorTabModels",advanced:"editorTabAdvanced"};function wa({host:e,t}){return(0,Yr.createElement)("div",{className:Rs,role:"tablist","aria-label":t("editorTabsLabel")},...As.map(n=>(0,Yr.createElement)("button",{key:n,type:"button",role:"tab",className:Hs,[Os]:n,onClick:r=>{r.preventDefault(),r.stopPropagation();let o=Cn(e.current);o!==null&&Ds(o,n)}},t(Qu[n]))))}var va="settings.models.provider-card";function Zu({provider:e,api:t,t:n}){let r=(0,Fe.useRef)(null);(0,Fe.useEffect)(()=>{let i=r.current,s=Cn(i);if(i===null||s===null)return;let a=s,d=()=>s.querySelector('[class*="_editor"]')!==null,u=()=>{let p=d()?"1":"0";i.dataset.edit!==p&&(i.dataset.edit=p)};u();let g=new MutationObserver(u);return g.observe(a,{childList:!0,subtree:!0}),()=>{g.disconnect()}},[]);let o=e?.provider;return typeof o!="string"||o.length===0?null:(0,Fe.createElement)("div",{ref:r,className:"bre-headers-host","data-bre-provider":o},(0,Fe.createElement)(wa,{host:r,t:n}),(0,Fe.createElement)(ya,{route:o,api:t,t:n}))}function xa(e,t,n){let r=e,o=r.slots?.inject(va,()=>{r.slots?.register({name:va,key:ie,inject:()=>({api:t,t:n})},Zu)});return typeof o=="function"?o:()=>{}}var ue=require("react");function ka(e){let{t}=e,n=(0,ue.useSyncExternalStore)(Ut,fe),r=()=>{co(!n)};return(0,ue.createElement)("div",{className:"bre-slider-setting"},(0,ue.createElement)("div",{className:"bre-slider-setting-row"},(0,ue.createElement)("div",{className:"bre-slider-setting-copy"},(0,ue.createElement)("div",{className:"bre-slider-setting-title"},t("sliderToggleTitle")),(0,ue.createElement)("div",{className:"bre-slider-setting-description"},t("sliderToggleDescription"))),(0,ue.createElement)("div",{className:"bre-slider-setting-control"},(0,ue.createElement)("span",{className:"bre-slider-setting-state"},t(n?"settingOn":"settingOff")),(0,ue.createElement)("button",{type:"button",role:"switch","aria-label":t("sliderToggleAria"),"aria-checked":n,className:"bre-slider-setting-switch"+(n?" is-on":""),onClick:r},(0,ue.createElement)("span",{className:"bre-slider-setting-switch-knob","aria-hidden":!0})))))}function Ea(e,t){let n=e,r=n.slots?.inject("settings.models.footer",()=>{n.slots?.register({name:"settings.models.footer",id:X+"-slider-toggle",order:15,inject:()=>({t})},ka)});return typeof r=="function"?r:()=>{}}var ef=X,tf=["slots","locale","connection","remote","remote.settings"];function nf(e){e.effect(()=>e.locale.register(Gn,{zh:uo,en:lo}),"dsh-model-think-level: dictionaries");let t=document.createElement("style");t.dataset.plugin=X,t.dataset.pluginStyles=X,t.textContent=_o,document.head.appendChild(t),e.effect(()=>()=>t.remove(),"dsh-model-think-level: stylesheet");let n=(()=>{try{let l=e.get?.("configForms");try{let f=l?.get?.(ie);if(f!==void 0)return f}catch{}return e.get?.("settingsScope")?.bind?.({namespace:ie})}catch{return}})(),r=n===void 0?{settings:e.remote.settings}:{settings:e.remote.settings,scope:n},o=e.locale.bind(Gn),i=()=>{let l=e.locale;return typeof l.subscribe=="function"&&typeof l.getSnapshot=="function"?l:void 0},s=l=>{let c=i();return c===void 0?l():(0,Ta.createElement)(ao,{locale:c,children:l})},a=si({api:r}),d=fa({ctx:e,configuredEffort:a.of}),u=ni({menuOf:ga,triggerOf:ha,t:o,refreshed:s,sliderEnabled:fe,directory:d.ensure}),g=di({api:r}),p=ua({ctx:e,api:r,t:o,onIdle:g.run,refreshed:s}),m=()=>{d.ensure(),u.reconcile()};e.effect(()=>(p.start(m),()=>{p.teardown(),u.dispose(),d.dispose()}),"dsh-model-think-level: DOM injector"),e.effect(()=>{let l=()=>{p.flushOnUnload()};return window.addEventListener("pagehide",l),()=>{window.removeEventListener("pagehide",l)}},"dsh-model-think-level: ledger flush on unload"),e.effect(()=>{let l=()=>{p.state.describePromise=void 0,a.invalidate(),p.schedule()},c=[e.remote.$on("settings/document-updated",f=>{f===ie&&l()}),e.on("connection/reset",l)];return()=>{for(let f of c)f()}},"dsh-model-think-level: pushed invalidations"),e.effect(()=>{let l=h=>{h.key===Bt?po(h.newValue!=="false"):h.key===jt?yo(tt(h.newValue)):h.key===zt?Eo(vo(h.newValue)):h.key===Vt&&Ho(er(h.newValue))};window.addEventListener("storage",l);let c=Ut(()=>{p.schedule()}),f=Gt(()=>{p.schedule()}),y=$t(()=>{p.schedule()}),k=Yt(()=>{p.schedule()});return()=>{window.removeEventListener("storage",l),c(),f(),y(),k()}},"dsh-model-think-level: client preferences"),e.effect(()=>Ea(e,o),"dsh-model-think-level: footer slot activation"),e.effect(()=>xa(e,r,o),"dsh-model-think-level: provider-card slot activation")}
2216
+ `;var Mt=require("react"),vi=require("react-dom");var S=require("react"),Er=require("react-dom"),fi=require("react-dom");var ni=["off","minimal","low","medium","high","xhigh","max"],jd=["text","image"];var Gd=[{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:105e4,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\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:105e4,maxTokens:128e3,note:"GPT-5.5 \u6863\u4F4D\uFF1ANone / Low / Medium(\u9ED8\u8BA4) / High / XHigh\uFF0C\u5E26\u56FE\u8F93\u5165\u3002pro \u53D8\u4F53\u4EC5 Medium / High(\u9ED8\u8BA4) / XHigh \u4E14\u4EC5 Responses API\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:105e4,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\uFF1Bmini/nano \u4E3A 400K \u4E0A\u4E0B\u6587\u3002"},{id:"openai-gpt-5-3",patterns:["gpt-5.3"],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.3-Codex \u6863\u4F4D\uFF1ALow / Medium / High / XHigh\uFF08\u65E0 None \u6863\uFF09\uFF0C\u5E26\u56FE\u8F93\u5165\u3001400K\uFF1Bgpt-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-chat",patterns:["gpt-5.1-chat-latest","gpt-5.2-chat-latest","gpt-5.3-chat-latest","gpt-5-chat-latest","gpt-chat-latest","gpt-5-chat","gpt-5.1-chat","gpt-5.2-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\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-astra",patterns:["gpt-6-astra","gpt-6"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:105e4,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\uFF0C1,050,000 \u4E0A\u4E0B\u6587 / 128,000 \u8F93\u51FA\uFF1BAI \u5B98\u65B9\u9ED8\u8BA4\u6863\u4F4D\u672A\u516C\u5E03\uFF0C\u6545\u4E0D\u586B\u3002\u5DE5\u5177\u8C03\u7528\u9700\u8D70 Responses API\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",patterns:["claude-fable-5","claude-mythos-5","claude-opus-5","claude-sonnet-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 \u4EE3\uFF08Fable 5 / Mythos 5 / Opus 5 / Sonnet 5\uFF09\u6863\u4F4D\uFF1ALow / Medium / High(\u9ED8\u8BA4) / XHigh / Max\uFF1BFable 5.1 \u4E0E Mythos 5.1 \u89C1\u5355\u72EC\u6761\u76EE\uFF0CMythos Preview \u4EC5\u81F3 Max\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:{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 Fable 5.1 / Mythos 5.1\uFF1A\u5B98\u65B9\u6863\u4F4D Low / Medium / High(\u9ED8\u8BA4) / XHigh / Max\uFF0C\u81EA\u9002\u5E94\u601D\u8003\u5E38\u5F00\uFF08\u4E0D\u63A5\u53D7 enabled/disabled\uFF09\u30021M \u4E0A\u4E0B\u6587 / 128K \u8F93\u51FA\uFF1B\u8FD9\u4E24\u578B\u4E5F\u662F\u5B98\u65B9\u552F\u4E00\u5141\u8BB8\u4F1A\u8BDD\u4E2D\u9014\u6539\u6863\u7684\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\u3002"},{id:"anthropic-claude-opus-4-high",patterns:["claude-opus-4-8","claude-opus-4-7"],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 Opus 4.7/4.8 \u6863\u4F4D\uFF1ALow / Medium / High(\u9ED8\u8BA4) / XHigh / Max\uFF1Bxhigh \u4E3A\u5B98\u65B9\u63A8\u8350\u7684\u7F16\u7801\u8D77\u6B65\u6863\u30021M \u4E0A\u4E0B\u6587\u3002"},{id:"anthropic-claude-4-6",patterns:["claude-opus-4-6","claude-sonnet-4-6"],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 4.6 \u4EE3\u6863\u4F4D\uFF1ALow / Medium / High / Max\uFF08\u65E0 XHigh\u2014\u2014\u5B98\u65B9\u660E\u8A00\u300C\u652F\u6301 max \u7684\u90E8\u5206\u578B\u53F7\u4E0D\u652F\u6301 xhigh\u300D\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 Fable/Mythos 5\u3001Opus 5/4.6-4.8\u3001Sonnet 5/4.6\u3001Opus 4.5 \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\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\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,note:'Grok 4.7\uFF08\u4E0A\u6E38\u5FEB\u7167 grok-4.7-20260916\uFF09\uFF1A\u6863\u4F4D Low / Medium / High / XHigh\u2014\u2014**\u53D6\u81EA\u516C\u5F00\u76EE\u5F55**\uFF08OpenRouter \u7684 supported_parameters\u3001models.dev \u5BF9 docs.x.ai \u7684\u8F6C\u8FF0\uFF09\uFF0C\u672C\u6B21 xAI \u5B98\u65B9\u6587\u6863\u7AD9\u4E0D\u53EF\u8FBE\u3001\u672A\u80FD\u4E00\u624B\u8BC1\u5B9E\uFF1B\u9ED8\u8BA4\u6863\u4F4D\u4E0E"\u80FD\u5426\u5173\u95ED\u601D\u8003"\u540C\u6837\u672A\u8BC1\u5B9E\uFF0C\u6545\u4E0D\u58F0\u660E Off\uFF0C\u4E5F\u4E0D\u5199\u9ED8\u8BA4\u6863\u3002\u5E26\u56FE\u8F93\u5165\uFF08\u76EE\u5F55\u8BB0 text+image+file\uFF0CPDF \u5B58\u7591\uFF09\uFF0C500K \u4E0A\u4E0B\u6587\uFF1B\u6700\u5927\u8F93\u51FA\u5404\u76EE\u5F55\u7ED9\u51FA 450K \u4E0E 500K \u4E24\u79CD\u503C\uFF0C\u6309"\u5206\u6B67\u5373\u4E0D\u5199"\u5904\u7406\u30022026-08 \u90A3\u6B21"grok-4.7 \u4E0D\u5B58\u5728\uFF08\u5B98\u65B9 404\uFF09"\u7684\u7ED3\u8BBA\u5DF2\u968F\u53D1\u5E03\u4F5C\u5E9F\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",xhigh:"xhigh"},defaultEffort:"low",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1e6,note:"Grok 4.3\uFF1A\u5B98\u65B9\u56DB\u7EA7 reasoning effort\uFF08None / Low / Medium / High\uFF09\uFF0C1M \u4E0A\u4E0B\u6587\u3001\u5E26\u56FE\u8F93\u5165\uFF1Bgrok-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:!1,input:["text"],contextWindow:32768,maxTokens:32768,note:"Magistral \u539F\u751F\u601D\u8003\u7EBF\uFF08\u65E0 effort \u53C2\u6570\uFF0C\u4E3A prompt_mode \u8BED\u4E49\uFF09\uFF0C\u5B98\u65B9\u5DF2\u4E8E 2026-07-28 \u58F0\u660E\u5F03\u7528\u3001\u9010\u6B65\u64A4\u51FA\uFF1B\u73B0\u5F79\u63A8\u7406\u8D70 mistral-small-2603 / mistral-medium-3-5 \u7684 reasoning_effort\uFF08\u89C1\u4E0B\u6761\uFF09\u3002"},{id:"mistral-medium-3",patterns:["mistral-medium-3.5","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\uFF1ANone / High\u2014\u2014\u5B98\u65B9 reasoning_effort \u679A\u4E3E\uFF08mistral-common \u534F\u8BAE\u5E93\uFF09\u5373 none/high\uFF1Bmistral-small-2603\uFF08Small 4\uFF09\u4E0E mistral-medium-3-5 \u7ECF\u5B83\u63A7\u5236\uFF0CMedium 3.5 \u5E26\u89C6\u89C9\u3002\u5BB9\u91CF\u672A\u5728\u5B98\u65B9\u76EE\u5F55\u9875\u5355\u5217\uFF0C\u4E0D\u63D0\u4F9B\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"],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-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-m3",patterns:["minimax-m3"],efforts:{off:null,high:"high"},compat:{thinkingFormat:"deepseek"},input:["text","image"],contextWindow:1048576,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\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"}],mr={off:null,low:"low",medium:"medium",high:"high"},zd={"openai-completions":mr,"openai-responses":mr,"anthropic-messages":mr,deepseek:{off:"none",low:"low",high:"high",max:"max"}},$d={low:"low",medium:"medium",high:"high"};function Lt(e){return(e??"").toLowerCase().trim()}function Zo(e){return e!==void 0&&/[a-z0-9]/.test(e)}function Tt(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g," ")}function ri(e,t,n){let r=t===0?void 0:e[t-1],o=e[t+n];return!Zo(r)&&!Zo(o)}function hr(e,t){let n=Tt(e)+" "+Tt(t??""),r;for(let o of Gd)for(let i of o.patterns){let s=Tt(i),a=n.indexOf(s);for(;a>=0;){if(ri(n,a,s.length)){(r===void 0||s.length>r.length)&&(r={entry:o,length:s.length});break}a=n.indexOf(s,a+1)}}return r?.entry}var Vd={"deepseek.com":"deepseek","anthropic.com":"anthropic-messages"};function Yd(e){let t=Lt(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=Vd[o.slice(-2).join(".")];if(i!==void 0)return i}}catch{}return"openai-completions"}var on="openai-completions",oi="anthropic-messages";function gr(e){if(e===void 0||e.length===0)return!1;let t="";try{t=new URL(e).hostname.toLowerCase()}catch{return!1}return t==="localhost"||t==="::1"||t.endsWith(".local")||t.endsWith(".internal")||/^(127\.|10\.|192\.168\.)/.test(t)||/^172\.(1[6-9]|2[0-9]|3[01])\./.test(t)?!0:t.includes(":")}function Jd(e,t){let n=Lt(t),r={...e};if(delete r.supportsMidConvoEffort,delete r.allowedFallbackModels,n===oi){for(let o of["thinkingFormat","supportsReasoningEffort","thinkingTokenBudgetField","supportsThinkingTokenBudget","vllmPriority","supportsMaxOutputTokens"])delete r[o];return r.forceAdaptiveThinking===void 0?void 0:{forceAdaptiveThinking:r.forceAdaptiveThinking}}if(n==="openai-responses"){for(let o of["thinkingFormat","supportsReasoningEffort","thinkingTokenBudgetField","supportsThinkingTokenBudget","vllmPriority"])delete r[o];return r.supportsMaxOutputTokens===void 0?void 0:{supportsMaxOutputTokens:r.supportsMaxOutputTokens}}if(n===on)return delete r.forceAdaptiveThinking,delete r.supportsMaxOutputTokens,Object.keys(r).length===0?void 0:r}function Xd(e,t){let n=Lt(t.api);if(n===on){let r=e.compat;return r!==void 0&&(r=Jd(r,n)??void 0),r===void 0&&!gr(t.baseURL)?void 0:r===void 0?{thinkingTokenBudgetField:"thinking_token_budget"}:r.thinkingTokenBudgetField===void 0&&r.supportsThinkingTokenBudget!==!0&&gr(t.baseURL)?{...r,thinkingTokenBudgetField:"thinking_token_budget"}:r}if(n===oi&&e.anthropicAdaptive===!0)return{forceAdaptiveThinking:!0}}var Qd=["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 br(e){if(Lt(e.api)!==on)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(".")?!Qd.some(r=>n===r||n.endsWith("."+r)):!1}catch{return!1}}function ei(e,t,n){return e===void 0||!n||e.supportsDeveloperRole!==void 0||!br(t)?e:{...e,supportsDeveloperRole:!1}}var ti={off:null,low:"low",medium:"medium",high:"high"},Zd=["vl","vision","omni","4o","pixtral","internvl"];function yr(e){let t=Tt(e);for(let n of Zd){let r=Tt(n),o=t.indexOf(r);for(;o>=0;){if(ri(t,o,r.length))return["text","image"];o=t.indexOf(r,o+1)}}}function el(e){if(e===void 0)return;let t=e.map(n=>n.toLowerCase());if(t.some(n=>jd.includes(n)))return t.includes("image")?["text","image"]:["text"]}function Le(e,t,n){let r=hr(e,t.displayName),o,i,s,a;r?.input!==void 0&&(o=r.input,i="knowledge"),r?.contextWindow!==void 0&&(s=r.contextWindow),r?.maxTokens!==void 0&&(a=r.maxTokens);let d=el(n?.input);if(d!==void 0&&(o=d,i="endpoint"),n?.contextLength!==void 0&&Number.isFinite(n.contextLength)&&n.contextLength>0&&(s=n.contextLength),o===void 0){let y=yr(e);y!==void 0&&(o=y,i="heuristic")}let u={...o===void 0?{}:{input:o},...i===void 0?{}:{inputSource:i},...s===void 0?{}:{contextWindow:s},...a===void 0?{}:{maxTokens:a}},g=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",...g,...u};if(r!==void 0){let y=ei(Xd(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}:{},...y===void 0?{}:{compat:y},matched:!0,entryId:r.id,source:r.id,confidence:"high",...g,...u}}let m=Yd(t),p=zd[m]??$d,l=Lt(t.api)===on?{thinkingFormat:"openai",supportsReasoningEffort:!0}:void 0,c=l!==void 0&&gr(t.baseURL)?{...l,thinkingTokenBudgetField:"thinking_token_budget"}:l,f=ei(c,t,!0);return n?.reasoning===!0?{efforts:{...ti},...ti.medium!==void 0?{defaultEffort:"medium"}:{},...f===void 0?{}:{compat:f},matched:!1,source:"endpoint:"+(n.source??"listing"),confidence:"medium",...g,...u}:{efforts:p,...p.medium!==void 0?{defaultEffort:"medium"}:{},...f===void 0?{}:{compat:f},matched:!1,source:"protocol:"+m,confidence:"low",...g,...u}}var si="dsh-model-think-level.slider.efforts",wr="breSelectWired";function vr(e){return typeof e=="object"&&e!==null&&e.ok===!1}function xr(e){if(!vr(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 ze(e,t){return`${e}/${t}`}function ai(){try{let e=window.localStorage.getItem(si);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 tl(e){try{window.localStorage.setItem(si,JSON.stringify(e))}catch{}}function nl(e,t,n){let r=ai();r[ze(e,t)]=n,tl(r)}function rl(e,t){return ai()[ze(e,t)]}function sn(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 ol(e,t,n){return e.groups.find(o=>o.id===t)?.models.find(o=>o.id===n)?.reasoning?.defaultEffort}function il(e){if(!(e.length<2))return e[Math.floor((e.length-1)/2)]}function sl(e,t){return e===null||e.provider!==t.provider||e.model!==t.model}async function ii(e,t,n,r,o){let i=sn(e,t,n);if(i.length===0)return;let s=ze(t,n),a=r.get(s);if(a!==void 0&&i.includes(a))return a;let d=await o?.configuredEffort?.(t,n);if(d!==void 0&&i.includes(d))return d;let u=rl(t,n);if(u!==void 0&&i.includes(u))return u;let g=Le(n,{}).defaultEffort;if(g!==void 0&&i.includes(g))return g;let m=ol(e,t,n);return m!==void 0&&i.includes(m)?m:il(i)}function di(e,t){let n=e;if(n[wr]===!0)return()=>{};let r=Object.prototype.hasOwnProperty.call(n,"select"),o=e.select,i=new Map,s=new Set,a=new Map,d=3,u=0,g=async l=>{let c=++u;if(l.reasoningEffort!==void 0){let k=await o.call(e,l);return!vr(k)&&ye()&&(i.set(ze(l.provider,l.model),l.reasoningEffort),nl(l.provider,l.model,l.reasoningEffort)),k}let f=e.store.getSnapshot();if(!sl(f.current,l)){if(ye()){let k=ze(l.provider,l.model);i.delete(k),s.add(k)}return o.call(e,l)}if(!ye())return o.call(e,l);let y=await ii(f,l.provider,l.model,i,t),v=e.store.getSnapshot();if(!(u!==c||((k,R)=>k===null||R===null?k!==R:k.provider!==R.provider||k.model!==R.model||k.reasoningEffort!==R.reasoningEffort)(v.current,f.current)))return!ye()||y===void 0||!sn(v,l.provider,l.model).includes(y)?o.call(e,l):o.call(e,{...l,reasoningEffort:y})},m=()=>{let l=e.store.getSnapshot(),c=l.current;if(c===null||c.reasoningEffort!==void 0||!ye())return;let f=ze(c.provider,c.model);if(s.has(f))return;if(sn(l,c.provider,c.model).length===0){s.add(f);return}s.add(f);let y=u;ii(l,c.provider,c.model,i,t).then(async v=>{if(v===void 0){s.delete(f);return}if(!ye()){s.delete(f);return}let w=e.store.getSnapshot(),k=w.current;if(u!==y||k===null||k.reasoningEffort!==void 0||ze(k.provider,k.model)!==f||!sn(w,k.provider,k.model).includes(v))return;let R=await o.call(e,{provider:k.provider,model:k.model,reasoningEffort:v});if(vr(R))throw R}).catch(()=>{let v=(a.get(f)??0)+1;a.set(f,v),v<d&&(s.delete(f),m())})},p=e.store.subscribe(m);return m(),n[wr]=!0,e.select=g,()=>{delete n[wr],p(),r?e.select=o:delete n.select}}function al(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 dl(e){return e.current}function ll(e,t){let n=dl(t),r=e.findIndex(a=>a.id===n?.reasoningEffort);if(r>=0)return r;let i=t.groups.find(a=>a.id===n?.provider)?.models.find(a=>a.id===n?.model)?.reasoning?.defaultEffort,s=i===void 0?-1:e.findIndex(a=>a.id===i);return s>=0?s:Math.floor((e.length-1)/2)}function li(e){return e.models??[]}function dt(e){let t=e;return t.name??t.label??t.title??e.id}function kr(e){return(0,S.createElement)("span",{className:"bre-row-chevron"+(e?" is-open":""),"aria-hidden":!0},"\u203A")}function ul(){let[e,t]=(0,S.useState)(null),n=(0,S.useRef)(0);(0,S.useEffect)(()=>()=>{window.clearTimeout(n.current)},[]);let r=(0,S.useCallback)(()=>{window.clearTimeout(n.current),t(null)},[]),o=(0,S.useCallback)((i,s)=>{window.clearTimeout(n.current);let a=i.currentTarget;a.scrollWidth<=a.clientWidth+1||(n.current=window.setTimeout(()=>{t({target:a,text:s})},300))},[]);return{tip:e,onEnter:o,onLeave:r}}function fl({state:e}){if(typeof document>"u")return null;let t=e.target.getBoundingClientRect(),n=Math.max(12,Math.min(t.right,window.innerWidth-12));return(0,fi.createPortal)((0,S.createElement)("div",{className:"bre-tip",role:"tooltip",style:{top:Math.min(t.bottom+6,window.innerHeight-40),right:Math.max(12,window.innerWidth-n)}},e.text),document.body)}function cl(){return(0,S.createElement)("svg",{className:"bre-option-check",width:14,height:14,viewBox:"0 0 16 16",fill:"none","aria-hidden":!0},(0,S.createElement)("path",{d:"M3.5 8.5l3 3 6-7",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"}))}var ui=new Map;function pl(e){if(Array.isArray(e.input))return e.input.includes("image");let t=ui.get(e.id);if(t!==void 0)return t;let n=hr(e.id,e.name)?.input,r=n!==void 0?n.includes("image"):(yr(e.id)??[]).includes("image");return ui.set(e.id,r),r}function ml(e){let t=e.reasoning?.efforts;return Array.isArray(t)&&t.length>0}function gl(e){return(0,S.createElement)("svg",{className:"bre-tag-icon",width:13,height:13,viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":e},(0,S.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,S.createElement)("circle",{cx:8,cy:8,r:1.8,fill:"currentColor"}))}function hl(e){return(0,S.createElement)("svg",{className:"bre-tag-icon",width:13,height:13,viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":e},(0,S.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 bl(e,t){let n=[];return pl(e)&&n.push((0,S.createElement)("span",{key:"vision",className:"bre-tag",title:t("tagVision")},gl(t("tagVision")))),ml(e)&&n.push((0,S.createElement)("span",{key:"thinking",className:"bre-tag",title:t("tagThinking")},hl(t("tagThinking")))),n.length===0?null:(0,S.createElement)("span",{className:"bre-option-tags"},...n)}function ci(e){let{directory:t,t:n}=e,r=e.onLayoutChange,o=(0,S.useSyncExternalStore)(M=>t.store.subscribe(M),()=>t.store.getSnapshot()),i=al(o),[s,a]=(0,S.useState)(""),[d,u]=(0,S.useState)(null),[g,m]=(0,S.useState)(null),[p,l]=(0,S.useState)(!1),[c,f]=(0,S.useState)(null),y=(0,S.useRef)(null),v=(0,S.useRef)(""),w=(0,S.useRef)(!1),k=o.current!==null&&i.length>=2,R=p||o.status==="selecting",h=c??o.error,T=t.select;(0,S.useEffect)(()=>{if(w.current)return;let M=ll(i,o),Z=i[M]?.id??"";v.current=Z,a(Z),f(null)},[k,i,o]),(0,S.useEffect)(()=>{t.load().catch(()=>{})},[t]);let E=o.current,L=o.groups.find(M=>M.id===E?.provider),_=L?.models.find(M=>M.id===E?.model)?.name??(E===null?n("triggerFallback"):E.model),F=E===null?_:dt(L??{id:E.provider})+" \xB7 "+_,A=i.find(M=>M.id===s)?.name??n("effortDefault"),I=(0,S.useSyncExternalStore)(Zt,dr),Q=(0,S.useSyncExternalStore)(tn,Ko),Y=(0,S.useSyncExternalStore)(rn,zo),z=o.groups.filter(M=>li(M).length>0&&!Q.includes(M.id)).map(M=>M.id),oe=st(lr(z),I),B=g!==null&&oe.includes(g)?g:E!==null&&oe.includes(E.provider)?E.provider:oe[0]??null,ee=B===null?[]:Xo(li(o.groups.find(M=>M.id===B)),Y[B]??[]),ae=E===null?"":E.provider+"/"+E.model,O=(0,S.useCallback)(M=>{d!==M&&((0,Er.flushSync)(()=>{u(M)}),r?.())},[r,d]),K=(0,S.useCallback)(()=>{d!==null&&((0,Er.flushSync)(()=>{u(null)}),r?.())},[r,d]),U=(0,S.useCallback)(()=>{let M=y.current?.closest('[role="menu"]');M!=null&&(M.tabIndex=-1,M.focus({preventScroll:!0}))},[]),te=(0,S.useCallback)(async(M,Z)=>{if(w.current)return;let J=t.store.getSnapshot().current;if(K(),!(J!==null&&J.provider===M&&J.model===Z)){w.current=!0,U(),l(!0),f(null);try{let ce=await T({provider:M,model:Z}),Fe=xr(ce);if(Fe!==void 0)throw new Error(Fe)}catch(ce){f(ce instanceof Error?ce.message:String(ce))}finally{w.current=!1,l(!1)}}},[K,t,U,T]),H=(0,S.useCallback)(async M=>{if(w.current||(K(),M===o.current?.reasoningEffort&&o.status!=="error"))return;w.current=!0;let Z=v.current;U(),l(!0),f(null),a(M);try{let J=o.current;if(J===null)throw new Error(n("sliderNoCurrent"));let ce=await T({provider:J.provider,model:J.model,reasoningEffort:M}),Fe=xr(ce);if(Fe!==void 0)throw new Error(Fe);let Gt=t.store.getSnapshot(),xt=i.find(zt=>zt.id===Gt.current?.reasoningEffort)?.id??M;v.current=xt,a(xt)}catch(J){v.current=Z,a(Z),f(J instanceof Error?J.message:String(J))}finally{w.current=!1,l(!1)}},[K,t,U,i,T,o.current,o.status,n]),{tip:q,onEnter:G,onLeave:be}=ul(),jt=[(0,S.createElement)("button",{key:"row:model",type:"button",role:"menuitem",className:"bre-row-control"+(d==="model"?" is-open":""),disabled:R,"aria-expanded":d==="model",onMouseLeave:be,onClick:()=>{O(d==="model"?null:"model")}},(0,S.createElement)("span",{className:"bre-row-label"},n("modelRowLabel")),(0,S.createElement)("span",{className:"bre-row-value","aria-label":F,onMouseEnter:M=>{G(M,F)}},F),kr(d==="model")),d==="model"?(0,S.createElement)("div",{key:"panel:model",className:"bre-panel bre-panel-models"},(0,S.createElement)("div",{className:"bre-providers",role:"group","aria-label":n("modelRowLabel")},...oe.map(M=>(0,S.createElement)("button",{key:M,type:"button",className:"bre-provider"+(M===B?" is-open":"")+(M===E?.provider?" is-current":""),disabled:R,"aria-expanded":M===B,onMouseLeave:be,onClick:()=>{m(M)}},(0,S.createElement)("span",{className:"bre-option-name","aria-label":dt(o.groups.find(Z=>Z.id===M)),onMouseEnter:Z=>{G(Z,dt(o.groups.find(J=>J.id===M)))}},dt(o.groups.find(Z=>Z.id===M))),kr(M===B))),...oe.length===0?[(0,S.createElement)("div",{key:"no-providers",className:"bre-empty"},n("sliderNoCurrent"))]:[]),(0,S.createElement)("div",{className:"bre-provider-models",role:"group","aria-label":n("modelRowLabel")},...ee.length===0?[(0,S.createElement)("div",{key:"no-models",className:"bre-empty"},n("sliderNoCurrent"))]:ee.map(M=>{let Z=B+"/"+M.id,J=Z===ae;return(0,S.createElement)("button",{key:Z,type:"button",className:"bre-option"+(J?" is-active":""),disabled:R,"aria-pressed":J,onMouseLeave:be,onClick:()=>{te(B,M.id)}},(0,S.createElement)("span",{className:"bre-option-name","aria-label":M.name??M.id,onMouseEnter:ce=>{G(ce,M.name??M.id)}},M.name??M.id),bl(M,n))}))):null,(0,S.createElement)("div",{key:"divider",className:"bre-divider","aria-hidden":!0}),(0,S.createElement)("button",{key:"row:effort",type:"button",role:"menuitem",className:"bre-row-control"+(d==="effort"?" is-open":""),disabled:R||!k,"aria-expanded":k?d==="effort":void 0,onClick:()=>{O(d==="effort"?null:"effort")}},(0,S.createElement)("span",{className:"bre-row-label"},n("effortRowLabel")),(0,S.createElement)("span",{className:"bre-row-value"+(k?"":" is-muted")},k?A:n("sliderNoLevels")),k?kr(d==="effort"):null),d==="effort"&&k?(0,S.createElement)("div",{key:"panel:effort",className:"bre-panel",role:"group","aria-label":n("effortRowLabel")},...i.map(M=>(0,S.createElement)("button",{key:M.id,type:"button",className:"bre-option"+(M.id===s?" is-active":""),disabled:R,"aria-pressed":M.id===s,onClick:()=>{H(M.id)}},(0,S.createElement)("span",{className:"bre-option-name"},M.name),M.id===s?cl():null))):null];return(0,S.createElement)("div",{className:"bre-slider-body",ref:y},(0,S.createElement)("div",{className:"bre-card"},...jt),h===null?null:(0,S.createElement)("div",{className:"bre-model-error",role:"status"},h),q===null?null:(0,S.createElement)(fl,{key:"tip",state:q}))}var V=require("react"),mi='section[role="group"]',Lr='button[role="menuitemradio"]';function gi(e){return e.querySelector(mi)!==null}function Tr(e){return Array.from(e.querySelectorAll(Lr)).filter(t=>!t.disabled&&t.style.display!=="none")}function yl(e){let t=e.getAttribute("aria-labelledby");return(t===null?null:e.ownerDocument.getElementById(t))?.textContent?.toLowerCase()??""}function pi(e,t,n=new Map){let r=d=>{n.has(d)||n.set(d,d.style.display),d.style.display="none"},o=d=>{let u=n.get(d);u!==void 0&&(d.style.display=u,n.delete(d))};for(let d of[...n.keys()])d.isConnected||n.delete(d);let i=t.trim().toLowerCase().split(/\s+/).filter(Boolean),s=Array.from(e.querySelectorAll(mi)),a=0;if(i.length===0){for(let d of[...n.keys()])o(d);for(let d of s)a+=d.querySelectorAll(Lr).length;return a}for(let d of s){let u=yl(d),g=Array.from(d.querySelectorAll(Lr)),m=0;for(let p of g){let l=(p.getAttribute("title")??"").toLowerCase(),c=(p.textContent??"").toLowerCase(),f=`${u} ${l} ${c}`;i.every(y=>f.includes(y))?(o(p),m+=1):r(p)}m>0?(o(d),a+=m):r(d)}return a}function hi({menu:e,t}){let[n,r]=(0,V.useState)(""),[o,i]=(0,V.useState)(0),s=(0,V.useRef)(null),a=(0,V.useRef)(""),d=(0,V.useRef)(new Map),u=(0,V.useCallback)(l=>{a.current=l;let c=pi(e,l,d.current);i(c)},[e]);(0,V.useEffect)(()=>()=>{pi(e,"",d.current)},[e]),(0,V.useEffect)(()=>{let l=new MutationObserver(()=>{a.current.trim().length!==0&&u(a.current)});return l.observe(e,{childList:!0,subtree:!0}),()=>{l.disconnect()}},[e,u]),(0,V.useEffect)(()=>{let l=c=>{if(a.current.trim().length===0)return;let f=c.key;if(!(f==="ArrowDown"||f==="ArrowUp")&&!(f==="Home"||f==="End"||f==="PageUp"||f==="PageDown")||c.target===s.current||c.target instanceof Node&&!e.contains(c.target))return;let w=Tr(e);if(w.length===0)return;let k=w.findIndex(h=>h===document.activeElement),R;f==="Home"||f==="PageUp"?R=0:f==="End"||f==="PageDown"?R=w.length-1:f==="ArrowDown"?R=k===-1?0:(k+1)%w.length:R=k===-1?w.length-1:(k-1+w.length)%w.length,c.preventDefault(),c.stopPropagation(),w[R]?.focus()};return e.addEventListener("keydown",l,!0),()=>{e.removeEventListener("keydown",l,!0)}},[e]);let g=l=>{let c=l.key;if(c==="ArrowDown"){l.preventDefault(),l.stopPropagation(),Tr(e)[0]?.focus();return}if(n.trim().length>0&&(c==="ArrowUp"||c==="Home"||c==="PageUp"||c==="End"||c==="PageDown")){let f=Tr(e);f.length>0&&(l.preventDefault(),l.stopPropagation(),f[c==="ArrowUp"||c==="End"||c==="PageDown"?f.length-1:0]?.focus());return}c==="Escape"&&n.length>0&&(l.preventDefault(),l.stopPropagation(),r(""),u(""))},m=()=>{r(""),u(""),s.current?.focus({preventScroll:!0})},p=o===0&&n.trim().length>0;return(0,V.createElement)("div",{className:"bre-model-search-box"+(p?" has-empty":""),"data-bre-search":"1"},(0,V.createElement)("div",{className:"bre-search-input-wrapper"},(0,V.createElement)("span",{className:"bre-search-icon","aria-hidden":"true"},(0,V.createElement)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,V.createElement)("circle",{cx:"7",cy:"7",r:"4.5"}),(0,V.createElement)("path",{d:"M10.5 10.5L14 14",strokeLinecap:"round"}))),(0,V.createElement)("input",{ref:s,type:"text",className:"bre-search-input",role:"searchbox",placeholder:t("modelSearchPlaceholder"),"aria-label":t("modelSearchPlaceholder"),value:n,spellCheck:!1,autoComplete:"off",onChange:l=>{let c=l.currentTarget.value;r(c),u(c)},onKeyDown:g}),n.length>0?(0,V.createElement)("button",{type:"button",className:"bre-search-clear",title:t("modelSearchClear"),"aria-label":t("modelSearchClear"),onClick:m},(0,V.createElement)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,V.createElement)("path",{d:"M4 4L12 12M12 4L4 12",strokeLinecap:"round"}))):null),p?(0,V.createElement)("div",{className:"bre-search-empty",role:"status"},t("modelSearchNoMatches")):null)}var an=require("react"),bi=require("react-dom"),yi=require("react-dom/client");function Me(){return document.body}function $e(e,t,n){let r=(0,yi.createRoot)(e);return n?.sync===!0?(0,bi.flushSync)(()=>{r.render(t)}):r.render(t),{wrapper:e,root:r}}function Ne(e){e!==void 0&&(e.root.unmount(),e.wrapper.remove())}var _e=class extends an.Component{constructor(){super(...arguments);ko(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,an.createElement)("div",{style:{color:"#c00",fontSize:"11px",whiteSpace:"pre-wrap",padding:"6px"}},`${this.props.fallbackText}: ${this.state.error}`):this.props.children}};var wi=()=>{(0,vi.flushSync)(()=>{window.dispatchEvent(new Event("resize"))})};function xi(e){let{menuOf:t,triggerOf:n,t:r,refreshed:o,sliderEnabled:i,directory:s}=e,a,d,u,g,m,p,l=()=>{p?.removeAttribute("data-bre-provider"),p=void 0},c=()=>{let h=n();p!==void 0&&p!==h&&l();let T=g?.store.getSnapshot(),E=T?.current;if(h===void 0||E===null||E===void 0){h===p&&l();return}let L=T?.groups.find(_=>_.id===E.provider),P=L===void 0?E.provider:dt(L);if(P.trim()===""){h===p&&l();return}h.dataset.breProvider=P,p=h},f=()=>{let h=s();h!==g&&(m?.(),m=void 0,g=h,h!==void 0&&(m=h.store.subscribe(c))),c()},y=()=>{Ne(d),d=void 0},v=h=>{let T=h.querySelector('section[role="group"]'),E=T?.parentElement,L=E!=null&&E.parentElement===h?E:T;if(d===void 0){let P=document.createElement("div");P.dataset.plugin=ne,P.dataset.breSearch="1",h.insertBefore(P,L),d=$e(P,(0,Mt.createElement)(_e,{fallbackText:r("modelSearchFailed"),children:o(()=>(0,Mt.createElement)(hi,{menu:h,t:r}))}),{sync:!0});return}if(d.wrapper.parentElement!==h){h.insertBefore(d.wrapper,L);return}L!==null&&d.wrapper.nextSibling!==L&&h.insertBefore(d.wrapper,L)},w=h=>{if(!i()){Ne(a),a=void 0,h.classList.remove("bre-model-menu-host");for(let _ of Array.from(h.children))_.getAttribute("role")==="menuitem"&&(_.style.display="");return}let T=s();if(T===void 0)return;if(a===void 0){let _=document.createElement("div");_.dataset.plugin=ne,_.dataset.breSlider="1",h.insertBefore(_,h.firstChild),a=$e(_,(0,Mt.createElement)(_e,{fallbackText:r("renderFailed"),children:o(()=>(0,Mt.createElement)(ci,{directory:T,t:r,onLayoutChange:wi}))}),{sync:!0})}else(a.wrapper.parentElement!==h||h.firstChild!==a.wrapper)&&h.insertBefore(a.wrapper,h.firstChild);h.classList.add("bre-model-menu-host");let E=Array.from(h.children).filter(_=>_.getAttribute("role")==="menuitem"),L=a.wrapper;if(Array.from(h.querySelectorAll('[role="menuitemradio"]')).some(_=>!L.contains(_)))a.wrapper.contains(document.activeElement)&&(h.tabIndex=-1,h.focus({preventScroll:!0})),a.wrapper.style.display="none";else{a.wrapper.style.display="";for(let _ of E)_.style.display="none"}};return{reconcile:()=>{f();let h=t();if(h===void 0){Ne(a),a=void 0,y(),u=void 0;return}let T=gi(h);T?v(h):y(),w(h),T!==u&&(u=T,(T||i())&&wi())},dispose:()=>{m?.(),m=void 0,g=void 0,l(),Ne(a),a=void 0,y(),u=void 0}}}var C=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function ki(e){let t=e.toLowerCase();return t.includes("compat")||t.includes("thinkingtokenbudget")||t.includes("vllmpriority")||t.includes("supportsmaxoutput")}function dn(e,t){if(!C(e))return[];let n=e[t];return!C(n)||!Array.isArray(n.models)?[]:n.models.filter(C)}function Ve(e,t){if(!C(e))return{};let n=e[t];if(!C(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 Ke=(e,t)=>typeof e[t]=="boolean";function wl(e,t){if(Array.isArray(e)){for(let n of e)if(C(n)&&n.id===t)return n}}function vl(e){if(!C(e))return{reasoning:"unknown",source:null};let t=e.supported_features;if(Array.isArray(t)&&t.includes("reasoning"))return{...Se(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{...Se(e),reasoning:!0,source:"supported_parameters"};if(Ke(e,"supports_reasoning"))return{...Se(e),reasoning:e.supports_reasoning,source:"supports_reasoning"};if(Ke(e,"supportsReasoning"))return{...Se(e),reasoning:e.supportsReasoning,source:"supportsReasoning"};if(Ke(e,"can_reason"))return{...Se(e),reasoning:e.can_reason,source:"can_reason"};if(Ke(e,"reasoning"))return{...Se(e),reasoning:e.reasoning,source:"reasoning"};let r=e.reasoning_effort;if(r!=null&&!(typeof r=="string"&&r.trim().length===0)||e.supports_reasoning_effort===!0)return{...Se(e),reasoning:!0,source:"reasoning_effort"};let o=C(e.capabilities)?e.capabilities:void 0;if(o!==void 0){let i=o.thinking;if(C(i)&&typeof i.supported=="boolean")return{...Se(e),reasoning:i.supported,source:"capabilities.thinking.supported"};let s=o.effort;if(C(s)&&typeof s.supported=="boolean")return{...Se(e),reasoning:s.supported,source:"capabilities.effort.supported"}}return{...Se(e),reasoning:"unknown",source:null}}function Se(e){let t={},n=s=>{if(!Array.isArray(s))return;let a=s.filter(d=>typeof d=="string");return a.length>0?a.map(d=>d.toLowerCase()):[]},r=C(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=C(e.modalities)?e.modalities:void 0;o=n(s?.input)}if(o===void 0){let s=e.capabilities,a=d=>Array.isArray(d)&&d.some(u=>typeof u=="string"&&u.toLowerCase()==="vision");if(a(e.supported_features)||a(s))o=["image"];else if(C(s)){let d=[];for(let u of["image_input","video_input","pdf_input","file_input"]){let g=C(s[u])?s[u]:void 0;if(g===void 0||typeof g.supported!="boolean")continue;let m=u.replace(/_input$/,"");g.supported===!0?d.push(m):d.length===0&&d.push("text")}d.length>0&&(o=d)}}o===void 0&&(Ke(e,"supports_vision")?o=e.supports_vision===!0?["image"]:[]:Ke(e,"supportsVision")?o=e.supportsVision===!0?["image"]:[]:(Ke(e,"supports_images")||Ke(e,"supportsImages"))&&(o=e.supports_images===!0||e.supportsImages===!0?["image"]:[])),o!==void 0&&(t.input=o.length===0?["text"]:o);let i=e.context_length;if(typeof i=="number"&&Number.isFinite(i)&&i>0)t.contextLength=i;else{let a=(C(e.top_provider)?e.top_provider:void 0)?.context_length;if(typeof a=="number"&&Number.isFinite(a)&&a>0)t.contextLength=a;else{let d=e.max_input_tokens;if(typeof d=="number"&&Number.isFinite(d)&&d>0)t.contextLength=d;else{let g=(C(e.limit)?e.limit:void 0)?.context;typeof g=="number"&&Number.isFinite(g)&&g>0&&(t.contextLength=g)}}}return t}function Ei(e,t){let n=wl(e,t);return n===void 0?{found:!1,signal:{reasoning:"unknown",source:null}}:{found:!0,signal:vl(n)}}function we(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 ln(e){if(!C(e))return;let t=e.providers;return C(t)?t:void 0}function Ti(e,t){for(let n of[e?.user,e?.base]){let r=ln(n)?.[t];if(C(r)&&r.models!==void 0)return r.models}}function Mr(e){return ln(e?.user)}function un(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 fn(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 cn(e,t){let r=e.find(o=>o.id===t)?.compat;if(C(r))return{...r}}function pn(e,t){let r=e.find(o=>o.id===t)?.name;return typeof r=="string"&&r.length>0?r:void 0}function mn(e,t){let r=e.find(o=>o.id===t)?.[rt];return typeof r=="string"&&r.length>0?r:void 0}async function xl(e,t){try{let n=await fetch(`${Eo}?route=${encodeURIComponent(e)}`,{method:"GET"});if(!n.ok)return{reasoning:"unknown",source:null};let r=await n.json();return r?.ok?Ei(r.data,t).signal:{reasoning:"unknown",source:null}}catch{return{reasoning:"unknown",source:null}}}function gn(e,t=()=>re(e),n,r,o,i){return{async suggest(s,a,d,u){let g=we((await t()).namespace),m=Ve(g,s),p={api:m.api??u?.api,baseURL:m.baseURL??u?.baseURL,displayName:d??m.displayName},l=g[s]===void 0?void 0:await xl(s,a),c=Le(a,p,l);return c.efforts===void 0?{ok:!1,error:"no-suggestion"}:{ok:!0,suggestion:{efforts:c.efforts,...c.compat===void 0?{}:{compat:c.compat},...c.defaultEffort===void 0?{}:{defaultEffort:c.defaultEffort},...c.defaultEffort===void 0?{}:{defaultEffort:c.defaultEffort},...c.input===void 0?{}:{input:c.input},...c.inputSource===void 0?{}:{inputSource:c.inputSource},...c.contextWindow===void 0?{}:{contextWindow:c.contextWindow},...c.maxTokens===void 0?{}:{maxTokens:c.maxTokens},matched:c.matched,source:c.source,confidence:c.confidence,...c.endpoint===void 0?{}:{endpoint:c.endpoint}}}},commit(s,a,d){if(i?.()===!0){n?.(s,a,d.efforts,d.compat,d.input,d.defaultEffort);return}r?.(s,a,{efforts:d.efforts,...d.compat===void 0?{}:{compat:d.compat},...d.input===void 0?{}:{input:d.input},...d.clearCompatKeys===void 0?{}:{clearCompatKeys:d.clearCompatKeys},...d.defaultEffort===void 0?{}:{defaultEffort:d.defaultEffort}})},withdraw(s,a){o?.(s,a)},stageEfforts(s,a,d,u,g,m){n?.(s,a,d,u,g,m)},async writeEfforts(s,a,d,u,g,m,p){if(r!==void 0)return r(s,a,{efforts:d,...u===void 0?{}:{compat:u},...g===void 0?{}:{input:g},...m===void 0?{}:{clearCompatKeys:m},...p===void 0?{}:{defaultEffort:p}}),{ok:!0,staged:!0};let c=(await St(e,s,[{modelId:a,efforts:d,...u===void 0?{}:{compat:u},...g===void 0?{}:{input:g},...m===void 0?{}:{clearCompatKeys:m},...p===void 0?{}:{defaultEffort:p}}],t))[0]??{ok:!1,error:"no-result"};return c.ok?{ok:!0}:c.modelNotFound===!0?{ok:!1,error:"model-not-found"}:{ok:!1,error:c.error??"conflict"}}}}async function St(e,t,n,r=()=>re(e),o){if(n.length===0)return[];let i=!1;for(let s=0;s<3;s++)try{let a=s===0?await r():await re(e,{fresh:!0});if(a.namespace===void 0)return n.map(()=>({ok:!1,error:"no-namespace"}));let d=Ti(a.namespace,t);if(!Array.isArray(d))return n.map(()=>({ok:!1,modelNotFound:!0}));if(!d.every(C))return n.map(()=>({ok:!1,error:"invalid-models"}));let g=d.map(l=>l),m=[];for(let l of n){let c=g.findIndex(f=>f.id===l.modelId);if(c<0){m.push(l.modelId);continue}g[c]=kl(g[c],l,i?void 0:l.compat)}if(m.length>0)return n.map(l=>m.includes(l.modelId)?{ok:!1,modelNotFound:!0}:{ok:!1,error:"model-not-found"});if(o?.()===!0)return n.map(()=>({ok:!1,aborted:!0}));let p=await e.settings.mutate(le,[{op:"set",path:["providers",t,"models"],value:g}],a.namespace.revision);if(!p.ok){if(s===0&&p.error.code==="settings/conflict")continue;let l=p.error.code==="settings/rejected"&&ki(p.error.message);if(!i&&l&&n.some(c=>c.compat!==void 0)){i=!0;continue}return n.map(()=>({ok:!1,error:p.error.message}))}return n.map(()=>({ok:!0}))}catch(a){return n.map(()=>({ok:!1,error:a instanceof Error?a.message:String(a)}))}return n.map(()=>({ok:!1,error:"conflict"}))}function kl(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[ge]=!0;else if(delete r[ge],delete r[nt],i===!1)r.reasoningEfforts=!1;else{r.reasoningEfforts={...i};let s=C(e.compat)?e.compat:{},a={...s,...n??{}};for(let d of t.clearCompatKeys??[])delete a[d];(Object.keys(s).length>0||Object.keys(a).length>0)&&(Object.keys(a).length===0?delete r.compat:r.compat=a)}return t.input!==void 0&&(t.input===null?(delete r.input,r[Oe]=!0):(delete r[Oe],r.input=[...t.input])),t.defaultEffort!==void 0&&(t.defaultEffort===null?delete r[rt]:r[rt]=t.defaultEffort),r}function Sr(e,t){for(let n of[e?.user,e?.base]){let r=ln(n)?.[t];if(!C(r))continue;let o=r.headers;if(o===void 0)continue;if(!C(o))return;let i={};for(let[s,a]of Object.entries(o))typeof a=="string"&&(i[s]=a);return i}}async function At(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 re(e):await re(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(!Ye(i.namespace,t)){r=!0;continue}let s=await e.settings.mutate(le,[{op:"set",path:["providers",t,"headers"],value:{...n}}],i.namespace.revision);if(!s.ok){if(o===0&&s.error.code==="settings/conflict")continue;return{ok:!1,error:s.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 Ye(e,t){if(Object.prototype.hasOwnProperty.call(we(e),t))return!0;for(let n of[e?.user,e?.base]){let r=ln(n);if(r!==void 0&&Object.prototype.hasOwnProperty.call(r,t))return!0}return!1}async function re(e,t={}){let n=t.fresh===!0?void 0:El(e);if(n!==void 0)return n;let r=await e.settings.describe();return r.ok?{namespace:r.value.namespaces.find(i=>i.ns===le),writable:r.value.writable}:{namespace:void 0,writable:!1}}function El(e){let t=e.scope?.getSnapshot();if(!(t===void 0||t.status!=="ready")&&typeof t.revision=="number")return{namespace:{ns:le,schema:{},value:t.value,user:t.user,base:t.base,revision:t.revision,applies:"live",secrets:[]},writable:t.writable===!0}}function Li(e){let t,n,r=0,o=()=>{if(t!==void 0)return Promise.resolve();let a=r;return n??(n=re(e.api).then(d=>{if(d.namespace===void 0){n=void 0;return}let u=new Map;for(let[g,m]of Object.entries(we(d.namespace))){let p=Array.isArray(m.models)?m.models:[];for(let l of p){if(typeof l!="object"||l===null||Array.isArray(l))continue;let c=l.id,f=l[rt];typeof c=="string"&&typeof f=="string"&&f.length>0&&u.set(`${g}/${c}`,f)}}a===r?t=u:n=void 0}).catch(()=>{a===r&&(n=void 0)})),n};return{of:async(a,d)=>(await o(),t?.get(`${a}/${d}`)),invalidate:()=>{r+=1,t=void 0,n=void 0}}}function Tl(e){let t=e.input;return Array.isArray(t)&&t.length>0}function Mi(e,t=()=>!0,n={},r=0){let o=n.efforts!==!1,i=n.modalities!==!1;if(!C(e))return;let s={};for(let a of Object.keys(e)){if(!t(a))continue;let d=e[a],u=C(d)&&Array.isArray(d.models)?d.models:void 0;if(u===void 0||u.length===0||!u.every(C))continue;let g=u,m=[],p=!1;for(let l of g){let c=l.reasoningEfforts!==void 0||l[ge]===!0,f=Tl(l)||l[Oe]===!0;if((c||!o)&&(f||!i)){let T=Ll(l,e,a);T!==void 0?(p=!0,m.push(T)):m.push(l);continue}let y=typeof l.id=="string"?l.id:"";if(y.length===0){m.push(l);continue}let v=Ve(e,a),w=typeof l.name=="string"?l.name:void 0,k=Le(y,{...v,displayName:w??v.displayName});if(k.efforts===void 0){m.push(l);continue}let R={...l},h=!1;if(!c&&o&&(h=!0,R.reasoningEfforts=k.efforts,R[nt]=r,k.compat!==void 0)){let T=C(l.compat)?l.compat:{};R.compat={...T,...k.compat}}if(!f&&i&&k.input!==void 0&&(h=!0,R.input=[...k.input]),!h){m.push(l);continue}p=!0,m.push(R)}p&&(s[a]={models:m})}return Object.keys(s).length===0?void 0:{providers:s}}function Ll(e,t,n){if(!C(e.reasoningEfforts)||e[ge]===!0)return;let r=e.compat,o=C(r)?{...r}:{};if(o.supportsDeveloperRole===void 0&&br(Ve(t,n)))return{...e,compat:{...o,supportsDeveloperRole:!1}}}function Si(e){let t,n=()=>(t??(t=(async()=>{let o={autofill:!0,modalityAutofill:!0};try{let i=await fetch(Lo,{method:"GET"});if(!i.ok)return o;let s=await i.json();return s?.ok!==!0?o:{autofill:s.data?.autofill!==!1,modalityAutofill:s.data?.modalityAutofill!==!1}}catch{return o}})()),t),r=async()=>{try{let o=await n();if(!o.autofill)return;let i=await re(e.api,{fresh:!0}),s=i.namespace;if(s===void 0||i.writable!==!0)return;let a=Mr(s);if(a===void 0)return;let d=Mi(a,()=>!0,{modalities:o.modalityAutofill},s.revision);if(d===void 0)return;let u=d.providers,g=Object.entries(u).map(([p,l])=>({op:"set",path:["providers",p,"models"],value:l.models})),m=await e.api.settings.mutate(le,g,s.revision);m.ok||console.error(`[bre] idle autofill refused: ${m.error.message}`)}catch(o){console.error(`[bre] idle autofill failed: ${o instanceof Error?o.message:String(o)}`)}};return{run:()=>{r()}}}var co=require("react"),ed=require("react-dom/client");var W=require("react");var Je=ni;function Xe(e){let t={};for(let n of Je){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 lt(e){let t=!1,n=!1,r={};for(let o of Je){let i=e[o];if(!i.on)continue;if(o==="off"){t=!0;let a=i.wire.trim();r.off=a.length===0?null:a;continue}n=!0;let s=i.wire.trim();r[o]=s.length===0?o:s}return n?r:t?!1:void 0}function Rt(e,t){if(e===t)return!0;if(e===!1||e===void 0||t===!1||t===void 0)return!1;let n=Je.filter(o=>e[o]!==void 0),r=Je.filter(o=>t[o]!==void 0);return n.length!==r.length?!1:n.every(o=>e[o]===t[o])}function Ai(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 Ar="bre:auto-effort",Ri=Promise.resolve();function Hi(e){Ri=Ri.then(e,e).then(()=>{},()=>{})}function Oi(e,t=document){t.dispatchEvent(new CustomEvent(Ar,{detail:{route:e}}))}function _i(e,t=document){let n=r=>{let o=r.detail;typeof o?.route!="string"||o.route.length===0||e(o.route)};return t.addEventListener(Ar,n),()=>{t.removeEventListener(Ar,n)}}var x=require("react/jsx-runtime"),Ni=new Intl.NumberFormat("en-US");function Qe(e){return e===void 0||e.length===0?{declared:!1,image:!1}:{declared:!0,image:e.includes("image")}}function bn(e){return e.declared?e.image?["text","image"]:["text"]:null}var Ml={"openai-completions":["thinkingTokenBudgetField","supportsThinkingTokenBudget","vllmPriority"],"openai-responses":["supportsMaxOutputTokens"]};function Sl(e){return Ml[(e??"").toLowerCase()]??[]}function Di(e,t){let n=Sl(e);if(n.length===0)return[];let r=new Set(t===void 0?[]:Object.keys(t));return n.filter(o=>!r.has(o))}function Al(e,t){if(t!==void 0)return{clearCompatKeys:Di(e,t)};let n=Di(e,void 0);return n.length===0?{}:{clearCompatKeys:n}}function hn(e,t){return e.declared?t===void 0?!1:e.image?t.includes("image"):!t.includes("image"):t===void 0}function Rr(e,t,n){let r=e?t:!1;return e&&r===void 0&&n===void 0?"keep":r}function Ii(e){let t={},n=e?.thinkingTokenBudgetField??"";n!==""&&(t.thinkingTokenBudgetField=n);let o=(e?.vllmPriority===void 0?"":String(e.vllmPriority)).trim();o!==""&&/^-?\d+$/.test(o)&&(t.vllmPriority=Number.parseInt(o,10));let i=e?.supportsMaxOutputTokens===void 0?"":String(e.supportsMaxOutputTokens);return i==="true"?t.supportsMaxOutputTokens=!0:i==="false"&&(t.supportsMaxOutputTokens=!1),Object.keys(t).length===0?void 0:t}function Ci(e){let t={};e.budgetField!==""&&(t.thinkingTokenBudgetField=e.budgetField);let n=e.priorityText.trim();return n!==""&&/^-?\d+$/.test(n)&&(t.vllmPriority=Number.parseInt(n,10)),e.maxOutput==="true"?t.supportsMaxOutputTokens=!0:e.maxOutput==="false"&&(t.supportsMaxOutputTokens=!1),Object.keys(t).length===0?void 0:t}function yn(e){let t=e.appliedCompat,n=e.manualCompat,r=t!==void 0?{...t,...n??{}}:n;return e.initialCompat?.supportsThinkingTokenBudget===!0&&e.initialCompat?.thinkingTokenBudgetField===void 0&&r?.thinkingTokenBudgetField===void 0&&(e.routeApi??"").toLowerCase()==="openai-completions"&&(r={...r??{},thinkingTokenBudgetField:"thinking_token_budget"}),{efforts:e.efforts,...r===void 0?{}:{compat:r},...e.input===void 0?{}:{input:e.input},...Al(e.routeApi,r),...e.defaultEffort===void 0?{}:{defaultEffort:e.defaultEffort}}}function wn({route:e,routeApi:t,routeBaseURL:n,modelId:r,modelName:o,efforts:i,effortsUnset:s=!1,input:a,compat:d,defaultEffort:u,index:g,staged:m=!1,officialInputTypes:p=!1,api:l,readOnly:c,t:f}){let[y,v]=(0,W.useState)(()=>Xe(i)),[w,k]=(0,W.useState)(()=>Qe(a)),[R,h]=(0,W.useState)(()=>i!==!1),[T,E]=(0,W.useState)(()=>u??""),[L,P]=(0,W.useState)(!1),[_,F]=(0,W.useState)(void 0),[A,I]=(0,W.useState)(void 0),[Q,Y]=(0,W.useState)(""),[z,oe]=(0,W.useState)("low"),B=(0,W.useRef)(void 0),[ee,ae]=(0,W.useState)(()=>d?.thinkingTokenBudgetField??""),[O,K]=(0,W.useState)(()=>d?.vllmPriority===void 0?"":String(d.vllmPriority)),[U,te]=(0,W.useState)(()=>d?.supportsMaxOutputTokens===void 0?"":String(d.supportsMaxOutputTokens)),H=(0,W.useRef)(d),[q,G]=(0,W.useState)(void 0),[be,jt]=(0,W.useState)(void 0),[M,Z]=(0,W.useState)(void 0),J=(0,W.useRef)(!1),ce=(0,W.useRef)(i),Fe=(0,W.useRef)(a),Gt=(0,W.useRef)(u),tr=(0,W.useRef)(void 0),xt=(0,W.useRef)(i);xt.current=i;let zt=(0,W.useRef)(s);zt.current=s,(0,W.useEffect)(()=>_i(b=>{if(b!==e||xt.current!==void 0||zt.current)return;let $=tr.current;$!==void 0&&Hi($)}),[e]),(0,W.useEffect)(()=>{Rt(ce.current,i)||(ce.current=i,J.current||(v(Xe(i)),h(i!==!1))),Fe.current!==a&&(Fe.current=a,J.current||k(Qe(a))),Gt.current!==u&&(Gt.current=u,J.current||E(u??"")),JSON.stringify(H.current??null)!==JSON.stringify(d??null)&&(H.current=d,J.current||(ae(d?.thinkingTokenBudgetField??""),K(d?.vllmPriority===void 0?"":String(d.vllmPriority)),te(d?.supportsMaxOutputTokens===void 0?"":String(d.supportsMaxOutputTokens))))},[i,a,d,u]);let ho=()=>Ci({budgetField:ee,priorityText:O,maxOutput:U}),pd=()=>{let b=ho();return JSON.stringify(b??null)!==JSON.stringify({...d?.thinkingTokenBudgetField===void 0?{}:{thinkingTokenBudgetField:d.thinkingTokenBudgetField},...d?.vllmPriority===void 0?{}:{vllmPriority:d.vllmPriority},...d?.supportsMaxOutputTokens===void 0?{}:{supportsMaxOutputTokens:d.supportsMaxOutputTokens}})},$t=Je.filter(b=>y[b].on),md=T===(u??"")?void 0:T===""?null:T,gd=R?lt(y):!1,nr=!Rt(gd,i)||!hn(w,a)||pd()||md!==void 0,rr=(0,W.useRef)(void 0),ke=()=>{J.current=!0,I(void 0),Y(""),oe("low"),G(void 0)},Ee=(b,$,se,Te=R,me)=>{let Sd=Rr(Te,lt(b),i),Ad=hn($,a)?void 0:bn($),vo=yn({efforts:Sd,input:Ad,defaultEffort:se===(u??"")?void 0:se===""?null:se,manualCompat:me===void 0?ho():Ci(me),appliedCompat:B.current,routeApi:t,initialCompat:d}),xo=JSON.stringify(vo);rr.current!==xo&&(rr.current=xo,l.commit(e,r,vo))},hd=(b,$)=>{ke();let se=!$&&T===b?"":T;se!==T&&E(se),v(Te=>{let me={...Te,[b]:{...Te[b],on:$}};return $&&b!=="off"&&me[b].wire.trim().length===0&&(me[b]={...me[b],wire:b}),Ee(me,w,se),me}),F(void 0)},bd=b=>{ke(),h(b);let $=b?T:"";$!==T&&E($),Ee(y,w,$,b),F(void 0)},yd=(b,$)=>{ke(),v(se=>{let Te={...se,[b]:{...se[b],wire:$}};return Ee(Te,w,T),Te}),F(void 0)},wd=b=>{ke();let $={declared:!0,image:b};k($),Ee(y,$,T),F(void 0)},vd=()=>{ke();let b={declared:!1,image:!1};k(b),Ee(y,b,T),F(void 0)},xd=b=>{ke(),ae(b),Ee(y,w,T,R,{budgetField:b,priorityText:O,maxOutput:U}),F(void 0)},kd=b=>{ke(),K(b),Ee(y,w,T,R,{budgetField:ee,priorityText:b,maxOutput:U}),F(void 0)},Ed=b=>{ke(),te(b),Ee(y,w,T,R,{budgetField:ee,priorityText:O,maxOutput:b}),F(void 0)},bo=b=>{ke(),E(b),Ee(y,w,b),F(void 0)},Td=b=>{ke();let $=b.efforts!==!1;h($);let se=Xe(b.efforts);v(se);let Te=b.input===void 0?w:Qe(b.input);b.input!==void 0&&k(Te);let me=T===""&&b.defaultEffort!==void 0?b.defaultEffort:T;me!==T&&E(me),I(b.efforts),Y(b.source),oe(b.confidence),B.current=b.compat,G(b.inputSource),jt(b.contextWindow),Z(b.maxTokens),F({kind:"info",text:f("appliedHint",{source:b.source,confidence:f("confidence_"+b.confidence)})}),Ee(se,Te,me,$)},yo=async()=>{if(!(c||L)){P(!0),F(void 0);try{let b=m?await l.suggest(e,r,o,{...t===void 0?{}:{api:t},...n===void 0?{}:{baseURL:n}}):await l.suggest(e,r,o);if(!b.ok){F({kind:"error",text:b.error==="no-suggestion"?f("noSuggestion"):b.error});return}Td(b.suggestion)}catch(b){F({kind:"error",text:f("writeError",{message:String(b)})})}finally{P(!1)}}};(0,W.useEffect)(()=>{tr.current=yo});let Ld=()=>{J.current=!1,l.withdraw(e,r),v(Xe(i)),h(i!==!1),k(Qe(a)),E(u??""),ae(d?.thinkingTokenBudgetField??""),K(d?.vllmPriority===void 0?"":String(d.vllmPriority)),te(d?.supportsMaxOutputTokens===void 0?"":String(d.supportsMaxOutputTokens)),I(void 0),Y(""),oe("low"),B.current=void 0,G(void 0),jt(void 0),Z(void 0),F(void 0),rr.current=void 0},Md=B.current?.thinkingFormat??Le(r,{...t===void 0?{}:{api:t},...n===void 0?{}:{baseURL:n}}).compat?.thinkingFormat,wo=Ai(i,Md),pe=c||L;return(0,x.jsxs)("div",{className:"bre-effort-editor","data-plugin":ne,children:[(0,x.jsxs)("label",{className:"bre-modality-row bre-thinking-switch",children:[(0,x.jsx)("input",{type:"checkbox",checked:R,disabled:pe,"aria-label":f("thinkingMode")+" "+String(g+1),onChange:b=>{bd(b.target.checked)}}),(0,x.jsx)("span",{className:"bre-effort-level",children:f("thinkingMode")}),R?null:(0,x.jsx)("span",{className:"bre-effort-note",children:f("thinkingModeOff")})]}),R?(0,x.jsxs)("div",{className:"bre-effort-card",children:[(0,x.jsxs)("div",{className:"bre-effort-head",children:[(0,x.jsx)("span",{className:"bre-effort-title",children:f("reasoningEffort")}),(0,x.jsx)("button",{type:"button",className:"bre-link-button",disabled:pe,onClick:()=>{yo()},children:f("autoAdapt")})]}),(0,x.jsx)("div",{className:"bre-effort-grid",children:Je.map(b=>{let $=y[b];return(0,x.jsxs)("label",{className:"bre-effort-row",children:[(0,x.jsx)("input",{type:"checkbox",checked:$.on,disabled:pe,"aria-label":f("level_"+b)+" "+String(g+1),onChange:se=>{hd(b,se.target.checked)}}),(0,x.jsx)("span",{className:"bre-effort-level",children:f("level_"+b)}),$.on?(0,x.jsx)("input",{type:"text",className:"bre-effort-wire",value:$.wire,disabled:pe,placeholder:f("wirePlaceholder"),"aria-label":f("level_"+b)+" "+f("wireValue"),onChange:se=>{yd(b,se.target.value)}}):(0,x.jsx)("span",{className:"bre-effort-empty"})]},b)})}),$t.length>0?(0,x.jsxs)("div",{className:"bre-modality",children:[(0,x.jsx)("span",{className:"bre-effort-title",children:f("defaultEffortLabel")}),(0,x.jsxs)("label",{className:"bre-modality-row",children:[(0,x.jsxs)("select",{className:"bre-select",disabled:pe,"aria-label":f("defaultEffortLabel")+" "+String(g+1),value:T,onChange:b=>{bo(b.target.value)},children:[(0,x.jsx)("option",{value:"",children:f("defaultEffortUnset")}),(T!==""&&!$t.includes(T)?[...$t,T]:$t).map(b=>(0,x.jsx)("option",{value:b,children:f("level_"+b)},b))]}),T!==""?(0,x.jsx)("button",{type:"button",className:"bre-link-button bre-modality-clear",disabled:pe,onClick:()=>{bo("")},children:f("clearDefaultEffort")}):null]}),(0,x.jsx)("p",{className:"bre-modality-note",children:f("defaultEffortHint")})]}):null,p?null:(0,x.jsxs)("div",{className:"bre-modality",children:[(0,x.jsx)("span",{className:"bre-effort-title",children:f("inputModality")}),(0,x.jsxs)("label",{className:"bre-modality-row",children:[(0,x.jsx)("input",{type:"checkbox",checked:w.declared&&w.image,disabled:pe,"aria-label":f("modalityImage")+" "+String(g+1),onChange:b=>{wd(b.target.checked)}}),(0,x.jsx)("span",{className:"bre-effort-level",children:f("modalityImage")}),w.declared?(0,x.jsx)("button",{type:"button",className:"bre-link-button bre-modality-clear",disabled:pe,onClick:vd,children:f("clearDeclaration")}):null]}),w.declared?null:(0,x.jsx)("p",{className:"bre-modality-note",children:f("modalityInherit")})]}),(t??"").toLowerCase()==="openai-completions"?(0,x.jsxs)("div",{className:"bre-compat",children:[(0,x.jsx)("span",{className:"bre-effort-title",children:f("compatTitle")}),(0,x.jsxs)("label",{className:"bre-compat-row",children:[(0,x.jsx)("span",{className:"bre-compat-label",children:f("budgetFieldLabel")}),(0,x.jsxs)("select",{className:"bre-select",disabled:pe,"aria-label":f("budgetFieldLabel")+" "+String(g+1),value:ee,onChange:b=>{xd(b.target.value)},children:[(0,x.jsx)("option",{value:"",children:f("budgetUnset")}),(0,x.jsx)("option",{value:"thinking_token_budget",children:"thinking_token_budget"}),(0,x.jsx)("option",{value:"thinking_budget",children:"thinking_budget"}),(0,x.jsx)("option",{value:"thinking_budget_tokens",children:"thinking_budget_tokens"})]}),(0,x.jsx)("span",{className:"bre-compat-hint",children:f("budgetFieldHint")})]}),(0,x.jsxs)("div",{className:"bre-compat-row",children:[(0,x.jsxs)("label",{className:"bre-compat-field",children:[(0,x.jsx)("span",{className:"bre-compat-label",children:f("priorityLabel")}),(0,x.jsx)("input",{type:"text",inputMode:"numeric",className:"bre-text-input",value:O,disabled:pe,placeholder:f("priorityPlaceholder"),"aria-label":f("priorityLabel")+" "+String(g+1),onChange:b=>{kd(b.target.value)}})]}),(0,x.jsx)("span",{className:"bre-compat-hint",children:f("priorityHint")}),O.trim()!==""&&!/^-?\d+$/.test(O.trim())?(0,x.jsx)("p",{className:"bre-effort-note bre-error",children:f("priorityInvalid")}):null]}),d?.supportsThinkingTokenBudget===!0&&d?.thinkingTokenBudgetField===void 0?(0,x.jsx)("p",{className:"bre-effort-note",children:f("aliasMigrated")}):null]}):null,(t??"").toLowerCase()==="openai-responses"?(0,x.jsxs)("div",{className:"bre-compat",children:[(0,x.jsx)("span",{className:"bre-effort-title",children:f("compatTitle")}),(0,x.jsxs)("label",{className:"bre-compat-row",children:[(0,x.jsx)("span",{className:"bre-compat-label",children:f("maxOutputLabel")}),(0,x.jsxs)("select",{className:"bre-select",disabled:pe,"aria-label":f("maxOutputLabel")+" "+String(g+1),value:U,onChange:b=>{Ed(b.target.value)},children:[(0,x.jsx)("option",{value:"",children:f("maxOutputUnset")}),(0,x.jsx)("option",{value:"true",children:f("maxOutputOn")}),(0,x.jsx)("option",{value:"false",children:f("maxOutputOff")})]}),(0,x.jsx)("span",{className:"bre-compat-hint",children:f("maxOutputHint")})]})]}):null,m?(0,x.jsx)("p",{className:"bre-effort-note",children:f("stagedHint")}):null,i===!1?(0,x.jsx)("p",{className:"bre-effort-note",children:f("reasoningDisabled")}):null,wo===void 0?null:(0,x.jsx)("p",{className:"bre-effort-note",children:f(wo==="thinking-disabled"?"defaultRiskDisabled":"defaultRiskQwen")}),lt(y)===void 0&&i!==void 0?(0,x.jsx)("p",{className:"bre-effort-note",children:f("bareHint")}):null,A!==void 0?(0,x.jsxs)("div",{className:"bre-suggestion",children:[(0,x.jsx)("p",{className:"bre-effort-note",children:f("appliedHint",{source:Q,confidence:f("confidence_"+z)})}),q===void 0?null:(0,x.jsx)("p",{className:"bre-effort-note",children:f(q==="endpoint"?"inputHintEndpoint":q==="knowledge"?"inputHintKnowledge":"inputHintHeuristic")}),be===void 0&&M===void 0?null:(0,x.jsxs)("div",{className:"bre-reference",children:[(0,x.jsx)("span",{className:"bre-reference-title",children:f("referenceTitle")}),(0,x.jsxs)("span",{className:"bre-reference-values",children:[be===void 0?null:(0,x.jsxs)("span",{children:[f("contextWindowLabel")," ",(0,x.jsx)("b",{children:Ni.format(be)})]}),M===void 0?null:(0,x.jsxs)("span",{children:[f("maxTokensLabel")," ",(0,x.jsx)("b",{children:Ni.format(M)})]})]})]})]}):null,_===void 0?null:(0,x.jsx)("p",{className:"bre-effort-message bre-"+_.kind,role:_.kind==="error"?"alert":"status",children:_.text}),nr?(0,x.jsx)("p",{className:"bre-effort-message bre-info",role:"status",children:f("pendingSave")}):null,nr?(0,x.jsx)("p",{className:"bre-effort-note",children:f("pendingHint")}):null,(0,x.jsx)("div",{className:"bre-effort-actions",children:(0,x.jsx)("button",{type:"button",className:"bre-secondary-button",disabled:pe||!nr,onClick:Ld,children:f("reset")})})]}):null]})}var Be="data-bre-auto-effort",Hr='[class*="modelCatalog"]',Rl='[class*="modelListHead"]',Hl='button[class*="linkButton"]',Ol="bre-auto-effort",_l="bre-auto-effort-note",Nl="data-bre-auto-effort-phase",Fi="bre-auto-effort-note-text",qi="bre-auto-effort-note-detail",Dl=3e3;function Cl(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 Or(e){return Array.from(e.querySelectorAll(Hr)).filter(t=>(t.parentElement?.closest(Hr)??null)===null)}function vn(e,t,n){let r=new Map;for(let a of t)a.route.length!==0&&a.catalogue.isConnected&&r.set(a.catalogue,a.route);let o=n.t("autoAdaptAll");for(let[a,d]of r){let u=a.querySelector(Rl)??a,g=u.querySelector(`[${Be}]`)??Pl();Bi.set(g,n);let m=Il(u);m!==null?m.nextElementSibling!==g&&m.after(g):u.lastElementChild!==g&&u.append(g),Bl(g,d,o)}let i=new Set,s=new Set(r.values());for(let a of Array.from(e.querySelectorAll(`[${Be}]`))){let d=a.closest(Hr),u=a.getAttribute(Be)??"";if(d===null||!r.has(d)||i.has(d)){a.remove(),u.length>0&&!s.has(u)&&_r(u);continue}i.add(d)}}function _r(e){let t=Ze.get(e);t!==void 0&&(t.timer!==null&&clearTimeout(t.timer),t.note.remove(),Ze.delete(e))}function Ki(){for(let e of Array.from(document.querySelectorAll(`[${Be}]`)))e.remove();for(let e of Ze.values())e.timer!==null&&clearTimeout(e.timer),e.note.remove();Ze.clear()}function Il(e){let t=Array.from(e.querySelectorAll(Hl));return t.length===0?null:t[t.length-1]}function Pl(){let e=document.createElement("button");return e.className=Ol,e.setAttribute("type","button"),e.setAttribute(Be,""),e.addEventListener("click",()=>{let t=e.getAttribute(Be)??"";if(t.length===0)return;let n=Bi.get(e);n!==void 0&&(Oi(t),Fl(t,n))}),e}async function Fl(e,t){if(t.onRequest===void 0)return;Pi(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){_r(e);return}let r=Cl(n);r!==null&&Pi(e,r,t,Dl)}function Pi(e,t,n,r){let o=Ze.get(e);o!==void 0&&!o.note.isConnected&&(o.timer!==null&&clearTimeout(o.timer),Ze.delete(e),o=void 0),o!==void 0&&o.timer!==null&&clearTimeout(o.timer);let i=o?.note??ql();i.setAttribute(Nl,t.phase);let s=i.querySelector(`.${Fi}`),a=i.querySelector(`.${qi}`),d=Kl(t,n);s.textContent!==d.text&&(s.textContent=d.text),a.textContent!==d.detail&&(a.textContent=d.detail),a.hidden=d.detail.length===0,o===void 0&&document.body.append(i);let u=r>0?setTimeout(()=>{_r(e)},r):null;i.style.setProperty("--bre-note-hold",`${r}ms`),Ze.set(e,{note:i,timer:u})}function ql(){let e=document.createElement("div");return e.className=_l,e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.innerHTML=`<span class="${Fi}"></span><span class="${qi}"></span>`,e}var Bi=new WeakMap,Ze=new Map;function Kl(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 Bl(e,t,n){e.getAttribute(Be)!==t&&e.setAttribute(Be,t),e.textContent!==n&&(e.textContent=n),e.getAttribute("title")!==null&&e.removeAttribute("title")}var Ht="data-bre-drag-handle",Nr="data-bre-row-head",Dr="data-bre-drop-side",xn="bre-row-dragging",kn="bre-row-drop-target",$i="bre-drag-ghost",Vi="bre-drop-line",Wi="http://www.w3.org/2000/svg",Ui=8,ji=28,Gi=12,Wl="transform 180ms cubic-bezier(0.2, 0.7, 0.3, 1)",Ul='button, a, input, textarea, select, [contenteditable], [role="button"], [role="switch"], [role="checkbox"], [role="textbox"], [role="combobox"]';function En(){return{sources:new WeakSet,lists:new WeakSet,line:void 0,sighted:new WeakMap,drag:void 0}}function de(e){return Array.from(e.children).filter(t=>t instanceof HTMLElement)}function jl(e,t){let n=e.style.order;if(n==="")return t;let r=Number.parseInt(n,10);return Number.isNaN(r)?t:r}function et(e){return de(e).map((t,n)=>({row:t,key:jl(t,n),index:n})).sort((t,n)=>t.key-n.key||t.index-n.index).map(t=>t.row)}function Yi(e,t){let n=e.filter(s=>t.includes(s)),r=n.map(s=>e.indexOf(s)),o=t.filter(s=>n.includes(s)),i=new Map;e.forEach((s,a)=>i.set(s,a)),r.forEach((s,a)=>{let d=o[a];d!==void 0&&i.set(d,s)});for(let[s,a]of i){let d=String(a);s.style.order!==d&&(s.style.order=d)}}function Tn(e,t){Yi(et(e),t)}function Cr(e,t){let n=de(e),r=n.map(o=>o.offsetTop);t(),n.forEach((o,i)=>{let s=r[i]-o.offsetTop;s!==0&&(o.style.transition="none",o.style.transform=`translateY(${s}px)`,o.offsetHeight,o.style.transition=Wl,o.style.transform="")})}function Ot(e,t){return et(e).map(n=>t(n)).filter(n=>n!==void 0)}function Gl(e,t,n){let r=Ot(e,t);if(n===void 0||!zl(e,n))return r;let o=new Map;return n.ids.forEach((i,s)=>{o.has(i)||o.set(i,s)}),r.map((i,s)=>({id:i,key:o.get(i)??n.ids.length+s})).sort((i,s)=>i.key-s.key).map(i=>i.id)}function zl(e,t){return t.rows.some(n=>!e.contains(n))}function $l(e,t){let n=[];for(let o of et(e)){let i=t(o);i!==void 0&&n.push(i)}let r=[];for(let o of de(e))t(o)!==void 0&&r.push(o);return{ids:n,rows:r}}function Ji(e,t,n){let r=new Map;for(let[a,d]of t.entries())r.has(d)||r.set(d,a);let o=de(e),s=[...o.filter(a=>n(a)!==void 0)].sort((a,d)=>{let u=r.get(n(a))??Number.MAX_SAFE_INTEGER,g=r.get(n(d))??Number.MAX_SAFE_INTEGER;return u-g});Yi(o,s)}function Ln(e){for(let t of e)t.style.order="",t.style.transition="",t.style.transform=""}function Xi(e,t,n,r){let i=e.filter(s=>s!==t).indexOf(n);return i<0?Math.max(0,e.indexOf(t)):r?i+1:i}function Qi(e,t){let n,r=Number.POSITIVE_INFINITY;for(let o of e){let i=o.getBoundingClientRect(),s=t<i.top?i.top-t:t>i.bottom?t-i.bottom:0;s<r&&(r=s,n=o)}return n}function Vl(e,t){let n=e.getBoundingClientRect();return n.height<=0?!0:t>n.top+n.height/2}function Zi(e,t){let n=e.getBoundingClientRect();return t?n.bottom+Ui/2-1:n.top-Ui/2-1}function es(){let e=document.createElementNS(Wi,"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(Wi,"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 ts(e,t){let n=document.createElement("div");n.className=$i,n.setAttribute("aria-hidden","true"),n.appendChild(es());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 Yl(e){return!(e instanceof Element)||e.closest(`[${Ht}]`)!==null?!1:e.closest(Ul)!==null}function ns(e){return e.parentElement??void 0}function rs(e){for(let t of de(e))t.classList.remove(kn),t.removeAttribute(Dr)}function Mn(e){let t=e.parentElement;for(;t!==null;){if(os(t))return t;t=t.parentElement}let n=document.scrollingElement;return n instanceof HTMLElement&&n.scrollHeight>n.clientHeight?n:void 0}function Ir(e){let t=[],n=e.parentElement;for(;n!==null;)os(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 os(e){if(e.scrollHeight<=e.clientHeight)return!1;let t=e.style.overflowY,n=t.length>0?t:window.getComputedStyle(e).overflowY;return n==="auto"||n==="scroll"||n==="overlay"}function is(e,t){let n=e.getBoundingClientRect();return n.height<=0?0:t<n.top+ji?-Gi:t>n.bottom-ji?Gi:0}function ss(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 Jl(e){let t=e.line;if(t!==void 0&&t.isConnected)return t;let n=document.createElement("div");return n.className=Vi,n.setAttribute("aria-hidden","true"),document.body.appendChild(n),e.line=n,n}function Xl(e,t,n){let r=Jl(e),o=t.getBoundingClientRect();r.style.top=`${Zi(t,n)}px`,r.style.left=`${o.left}px`,r.style.width=`${o.width}px`,r.style.display="block",r.setAttribute(Dr,n?"after":"before")}function Ql(e){e.line!==void 0&&(e.line.style.display="none")}function Zl(e){let t=e.drag;e.drag=void 0,t!==void 0&&(ss(e,t,0),Ql(e),t.row.classList.remove(xn),rs(t.list),t.dropped||Cr(t.list,()=>{Tn(t.list,t.before)}))}function eu(e,t,n,r){if(Yl(t.target)){t.preventDefault();return}let o=ns(e),i=n.idOf(e);if(o===void 0||i===void 0){t.preventDefault();return}let s={row:e,list:o,before:et(o),scroller:Mn(o),adapter:n,scrollStep:0,frame:void 0,dropped:!1};r.drag=s,e.classList.add(xn);let a=ts(e,n.labelOf(e));Number.isFinite(t.clientX)&&Number.isFinite(t.clientY)&&(a.style.left=`${t.clientX}px`,a.style.top=`${t.clientY}px`),document.body.appendChild(a);let d=t.dataTransfer;if(d!=null)try{d.effectAllowed="move",d.setData("text/plain",i),d.setDragImage(a,Math.round(a.offsetWidth/2),Math.round(a.offsetHeight/2))}catch{}window.setTimeout(()=>{a.remove()},0)}function tu(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,s=et(e),a=i!==void 0&&s.includes(i)?i:Qi(s,t.clientY);if(a===void 0)return;t.preventDefault();let d=t.dataTransfer;d!=null&&(d.dropEffect="move");let u=Vl(a,t.clientY),g=Xi(s,r.row,a,u);g!==s.indexOf(r.row)&&Cr(e,()=>{Tn(e,ur(s,r.row,g))}),rs(e),a.classList.add(kn),a.setAttribute(Dr,u?"after":"before"),Xl(n,a,u),ss(n,r,r.scroller===void 0?0:is(r.scroller,t.clientY))}function nu(e,t){t.lists.has(e)||(t.lists.add(e),e.addEventListener("dragover",n=>{tu(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 ru(e,t,n,r){r.sources.has(e)||(r.sources.add(e),n.seatDrags&&(e.setAttribute(Nr,"1"),e.setAttribute("draggable","true")),e.addEventListener("dragstart",o=>{eu(t,o,n,r)}),e.addEventListener("dragend",()=>{Zl(r)}))}function ou(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=ns(t);if(i===void 0)return;let s=et(i),a=s.indexOf(t);if(a<0)return;let d=a+(o.key==="ArrowUp"?-1:1);d<0||d>=s.length||(o.preventDefault(),Cr(i,()=>{Tn(i,ur(s,t,d))}),n.commit(i),e.focus())})}function zi(e,t,n,r){let o=r.gripLabel(t,n),i=r.gripHint();e.getAttribute(Ht)!==n&&e.setAttribute(Ht,n),e.getAttribute("aria-label")!==o&&e.setAttribute("aria-label",o),e.getAttribute("title")!==i&&e.setAttribute("title",i)}function iu(e,t,n,r,o){let i=t.querySelector(`[${Ht}]`);if(i!==null){zi(i,e,n,r);return}r.decorate?.(e,t);let s=document.createElement("span");s.className="bre-drag-grip",s.setAttribute("role","button"),s.setAttribute("tabindex","0"),s.setAttribute("draggable","true"),s.appendChild(es()),zi(s,e,n,r),ou(s,e,r,o),ru(r.seatDrags?t:s,e,r,o),t.insertBefore(s,t.firstChild)}function Sn(e,t,n,r){if(!e.isConnected)return;nu(t,r);for(let i of de(t)){let s=n.idOf(i);if(s===void 0)continue;let a=n.seatOf(i);a!==void 0&&iu(i,a,s,n,r)}if(r.drag!==void 0)return;let o=Gl(t,n.idOf,r.sighted.get(t));Ji(t,n.order(o),n.idOf),r.sighted.set(t,$l(t,n.idOf))}function An(e){e.drag=void 0;for(let t of Array.from(document.querySelectorAll(`[${Ht}]`)))t.remove();for(let t of Array.from(document.querySelectorAll(`[${Nr}]`)))t.removeAttribute(Nr),t.removeAttribute("draggable");for(let t of Array.from(document.querySelectorAll(`.${xn}, .${kn}`)))t.classList.remove(xn,kn);for(let t of Array.from(document.querySelectorAll(`.${Vi}`)))t.remove();for(let t of Array.from(document.querySelectorAll(`.${$i}`)))t.remove();e.line=void 0}function ut(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Pr="__breLedgerDocument";function cs(){let e=globalThis;return e[Pr]??(e[Pr]=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`)}var Hn="bre:held-writes:v1";function Kr(){try{return typeof sessionStorage>"u"?void 0:sessionStorage}catch{return}}function Ae(e){let t=Kr();if(t!==void 0)try{if(e.pending.size===0&&e.queued.size===0){t.removeItem(Hn);return}let n={document:cs(),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(Hn,JSON.stringify(n))}catch{}}function as(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 s=[];for(let a of i){if(!Array.isArray(a)||a.length!==2)return;let[d,u]=a;if(typeof d!="string"||!C(u)||t!==void 0&&!t(u))return;s.push([d,u])}n.push([o,s])}return n}function su(e){let t=Kr();if(t!==void 0)try{let n=t.getItem(Hn);if(n===null)return;let r=JSON.parse(n);if(r.document!==cs())return;let o=as(r.pending),i=as(r.queued,hu);if(o===void 0||i===void 0)return;let s=Array.isArray(r.committed)?r.committed.filter(a=>typeof a=="string"):[];for(let[a,d]of o)e.pending.set(a,new Map(d));for(let[a,d]of i)s.includes(a)&&(e.queued.set(a,new Map(d)),e.committing.add(a))}catch{}}function ps(e,t){(async()=>{try{await Br(t,e),await Wr(t,e)}catch(n){console.error(`[bre] teardown flush failed: ${n instanceof Error?n.message:String(n)}`)}})()}function ms(e,t){(async()=>{try{await Br(t,e,!0),await Wr(t,e,!0)}catch(n){console.error(`[bre] unload flush failed: ${n instanceof Error?n.message:String(n)}`)}finally{try{Kr()?.removeItem(Hn)}catch{}}})()}function gs(){let e={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};return su(e),e}async function au(e,t){if(!t.flushing){t.flushing=!0;try{let n=await Br(e,t),r=await Wr(e,t);n||r?ds(e,t):(t.flushFailures=0,t.nextFlushAt=0)}catch(n){ds(e,t),console.error(`[bre] idle flush failed: ${n instanceof Error?n.message:String(n)}`)}finally{t.flushing=!1}try{e.onIdle?.()}catch(n){console.error(`[bre] idle hook failed: ${n instanceof Error?n.message:String(n)}`)}}}function ds(e,t){t.flushFailures+=1;let n=Math.min(2**t.flushFailures*500,3e4);t.nextFlushAt=Date.now()+n,e.onBackoff?.(n)}function du(e){return e.queued.size>0||e.pending.size>0}function Nt(e,t,n,r,o,i,s){try{let a=e.pending.get(t);if(r===void 0){if(a===void 0)return;a.delete(n),a.size===0&&e.pending.delete(t);return}e.pending.set(t,(a??new Map).set(n,{efforts:r,...o===void 0?{}:{compat:o},...i===void 0?{}:{input:i},...s===void 0?{}:{defaultEffort:s}}))}finally{Ae(e)}}function hs(e,t,n,r){e.queued.set(t,(e.queued.get(t)??new Map).set(n,r)),Ae(e)}function lu(e,t,n){let r=e.pending.get(t);r!==void 0&&(r.delete(n),r.size===0&&e.pending.delete(t),Ae(e))}function uu(e,t,n){let r=e.queued.get(t);r!==void 0&&(r.delete(n),r.size===0&&e.queued.delete(t),Ae(e))}function fu(e,t,n){lu(e,t,n),uu(e,t,n)}function cu(e,t){e.queued.delete(t),e.pending.delete(t),e.missedScans.delete(t),e.committing.delete(t),Ae(e)}function pu(e,t,n){if(t===void 0)return null;let i=t[ge]!==!0&&t.reasoningEfforts!==void 0&&typeof t[nt]=="number"||t[ge]!==!0&&n?.efforts!==void 0&&mu(t.reasoningEfforts,n.efforts)?!1:t.reasoningEfforts!==void 0||t[ge]===!0||e.efforts==="keep",a=t[Oe]!==!0&&n?.input!==void 0&&gu(t.input,n.input)?!1:Array.isArray(t.input)&&t.input.length>0||t[Oe]===!0,d=i?"keep":e.efforts,u=a?void 0:e.input,g=e.defaultEffort;return d==="keep"&&u===void 0&&g===void 0?null:{efforts:d,...e.compat===void 0?{}:{compat:e.compat},...u===void 0?{}:{input:u},...g===void 0?{}:{defaultEffort:g}}}function mu(e,t){if(e===t)return!0;if(!C(e)||!C(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 gu(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 hu(e){if(!C(e))return!1;let t=e.efforts;if(t!==!1&&t!=="keep"&&!C(t))return!1;let n=e.clearCompatKeys;return n===void 0||Array.isArray(n)&&n.every(r=>typeof r=="string")}async function bu(e,t,n,r,o=!1){let i=await e.describeNamespace(),s=we(i.namespace),a=[];for(let[m,p]of[...r]){let l=dn(s,n).find(w=>w.id===m);if(l===void 0||t.pending.get(n)?.get(m)!==p)continue;let c=Ve(s,n),f=typeof l.name=="string"?l.name:void 0,y=Le(m,f===void 0?c:{...c,displayName:f}),v=pu(p,l,{...y.efforts===void 0?{}:{efforts:y.efforts},...y.input===void 0?{}:{input:y.input}});if(v===null){Nt(t,n,m,void 0);continue}a.push({modelId:m,efforts:v.efforts,...v.compat===void 0?{}:{compat:v.compat},...v.input===void 0?{}:{input:v.input},...v.defaultEffort===void 0?{}:{defaultEffort:v.defaultEffort}})}if(a.length===0)return!1;let d=!1,u=await St(e.api,n,a,()=>d?e.describeNamespace():(d=!0,Promise.resolve(i)),o?void 0:Ss),g=!1;return a.forEach((m,p)=>{let l=u[p];if(l?.aborted!==!0){if(l?.ok===!0||l?.modelNotFound===!0){Nt(t,n,m.modelId,void 0);return}g=!0,console.error(`[bre] staged flush write failed for "${n}"/"${m.modelId}": ${l?.error??"unknown"}`)}}),g}async function Br(e,t,n=!1){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)||(await e.describeNamespace()).writable!==!0)return Ae(t),!1;let i=!1;for(let[s,a]of[...t.queued]){if(!t.committing.has(s)&&!t.signalsUnavailable)continue;let u=[...a].map(([p,l])=>({modelId:p,efforts:l.efforts,...l.compat===void 0?{}:{compat:l.compat},...l.input===void 0?{}:{input:l.input},...l.clearCompatKeys===void 0?{}:{clearCompatKeys:l.clearCompatKeys},...l.defaultEffort===void 0?{}:{defaultEffort:l.defaultEffort}})),g=await St(e.api,s,u,void 0,n?void 0:Ss),m=!1;u.forEach((p,l)=>{let c=g[l];if(c?.aborted===!0){m=!0;return}if(c?.ok===!0||c?.modelNotFound===!0){a.delete(p.modelId);return}console.error(`[bre] held write failed for "${s}"/"${p.modelId}": ${c?.error??"unknown"}`)}),a.size===0?(t.queued.delete(s),t.committing.delete(s)):m||(i=!0)}return Ae(t),i}async function Wr(e,t,n=!1){if(t.pending.size===0)return!1;let r=await e.describeNamespace();if(r.writable!==!0)return!1;let o=we(r.namespace),i=!1;for(let[s,a]of[...t.pending]){if(a.size===0){t.pending.delete(s);continue}ut(o,s)&&await bu(e,t,s,a,n)&&(i=!0)}return Ae(t),i}function ue(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 Dt(e){return e.closest('[class*="editor"], [class*="rowCard"], [class*="addCard"]')??void 0}function yu(e){let t=e.closest('[class*="modelEntry"]');if(t===null){let r=Dt(e);if(r===void 0)return;let o=Array.from(r.querySelectorAll('[class*="modelAdvanced"]'));return o.find(i=>i.offsetParent!==null)??o[0]}let n=Array.from(t.querySelectorAll('[class*="modelAdvanced"]'));return n.find(r=>r.offsetParent!==null)??n[0]}function wu(e,t){return Array.from(e.querySelectorAll("button[aria-label]")).find(n=>t.some(r=>(n.getAttribute("aria-label")??"").startsWith(r)))}function vu(){return new Promise(e=>{if(typeof window.requestAnimationFrame!="function"){e();return}window.requestAnimationFrame(()=>e())})}function Rn(e){return e.querySelector('[class*="modelInputTypes"]')!==null}function bs(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 s=i.closest("label")?.textContent?.trim();return s!==void 0&&t.includes(s)});return o!==void 0?o:r.length===2?r[1]:void 0}function On(e,t,n){let r=bs(e,n);return r===void 0||r.disabled?!1:(r.checked!==t&&r.click(),!0)}function qr(e,t,n){return t==null||e===void 0?t:On(e,t.includes("image"),n)?void 0:t}async function xu(e,t,n){if(e===void 0)return!1;let r=t.inputImage;if(Rn(e))return On(e,!0,r);let o=e.closest('[class*="modelEntry"]')??e;if(o.querySelector('[class*="modelAdvanced"]')!==null)return!1;let i=wu(o,t.capacity);if(i===void 0||i.disabled)return!1;i.click(),Rn(o)||await n();try{return Rn(o)&&On(o,!0,r)}finally{i.click()}}function ku(e,t,n,r,o){!e.isConnected||jr(e)===void 0||Array.from(e.querySelectorAll("button[aria-label]")).some(s=>o.capacity.some(a=>(s.getAttribute("aria-label")??"").startsWith(a)))||vn(e,Eu(e,we(r.namespace),o),{t:t.t,onRequest:s=>ys(n,t,s)})}function Eu(e,t,n){let r=[];for(let o of Or(e)){let i=Dt(o);if(i===void 0)continue;let s=De(i,t,n);s===void 0||s.staged||r.push({catalogue:o,route:s.route})}return r}function Tu(e,t,n){let r=[],o=new Set;for(let i of e){if(o.has(i.card))continue;o.add(i.card);let s=De(i.card,t,n);if(s===void 0)continue;let[a]=Or(i.card);a!==void 0&&r.push({catalogue:a,route:s.route})}return r}function Lu(e,t,n,r){let o=[],i=new Set;for(let s of r.capacity){let a=Array.from(e.querySelectorAll("button[aria-label]")).filter(d=>(d.getAttribute("aria-label")??"").startsWith(s));for(let d of a){let u=Dt(d);if(u===void 0)continue;let g=d.closest('[class*="modelEntry"]')??u,m=ue(g,r.modelId);m.length===0||i.has(m)||De(u,n,r)?.route===t&&(i.add(m),o.push({id:m,name:ue(g,r.modelName),row:g}))}}return o}async function ys(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{let s,a=()=>s??(s=t.describeNamespace()),d=await a(),u=we(d.namespace);if(d.writable!==!0)return{held:0,unsuggested:0,blocked:"unwritable"};if(!ut(u,n)&&r.length===0)return{held:0,unsuggested:0,blocked:"unknown-route"};let m=dn(u,n),p=new Set;for(let E of m){let L=typeof E.id=="string"?E.id:"";L.length>0&&p.add(L)}let l=m.slice();for(let E of r)E.id.length===0||p.has(E.id)||l.push({id:E.id,name:E.name});if(l.length===0)return{held:0,unsuggested:0,blocked:"no-models"};let c=u[n]??{},f=typeof c.api=="string"?c.api:void 0,y=new Set,v=new Map;for(let[E,L]of e.mounted)L.props.route===n&&(v.set(L.props.modelId,E),L.props.efforts!==void 0&&y.add(L.props.modelId));let w=new Map;for(let E of r)E.row!==void 0&&w.set(E.id,E.row);let k=!1,R=(E,L)=>qr(v.get(E),L,t.labels().inputImage),h=async(E,L)=>{if(L.image!==!0)return!1;let P=v.get(E)??w.get(E);return P===void 0?!1:xu(P,t.labels(),vu)},T=gn(t.api,a,(E,L,P,_,F,A)=>{Nt(e,E,L,P,_,R(L,F),A)},(E,L,P)=>{hs(e,E,L,{...P,input:R(L,P.input)})},void 0,()=>k);for(let E of l){let L=typeof E.id=="string"?E.id:"";if(L.length===0)continue;let P=un(l,L),_=fn(l,L),F=P!==void 0||E[ge]===!0,A=Array.isArray(_)&&_.length>0||E[Oe]===!0;if(y.has(L)&&!F)continue;if(F&&A){let K=v.get(L)??w.get(L);if(Array.isArray(_)&&_.includes("image")&&K!==void 0){let U=t.labels().inputImage,te=bs(K,U);te!==void 0&&!te.disabled&&!te.checked&&On(K,!0,U)}continue}let I=cn(l,L),Q=mn(l,L)??"",Y=await T.suggest(n,L,pn(l,L));if(!Y.ok){i+=1;continue}let z=Y.suggestion,oe=z.efforts!==!1,B=z.input===void 0?Qe(_):Qe(z.input);if(F){if(!B.image||e.queued.get(n)?.has(L)===!0)continue;if(await h(L,B)){o+=1;continue}k=!p.has(L),T.commit(n,L,yn({efforts:"keep",input:bn(B)})),k&&t.onPendingChanged?.(),k=!1,o+=1;continue}let ee=z.defaultEffort??Q,ae=ee===Q?void 0:ee===""?null:ee;k=!p.has(L);let O=await h(L,B);T.commit(n,L,yn({efforts:Rr(oe,lt(Xe(z.efforts)),P),input:O||hn(B,_)?void 0:bn(B),defaultEffort:ae,manualCompat:Ii(I),appliedCompat:z.compat,routeApi:f,initialCompat:I})),k&&t.onPendingChanged?.(),k=!1,o+=1}return{held:o,unsuggested:i}}catch(s){return console.warn("[bre] provider-wide adapt failed:",s),{held:o,unsuggested:i,failed:s instanceof Error?s.message:String(s)}}finally{e.adapting.delete(n)}}function Mu(e){return e.querySelector(`[data-plugin="${ne}"]`)!==null}function Su(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&&Rt(e.efforts,t.efforts)&&Ru(e.input,t.input)&&Au(e.compat,t.compat)}function Au(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 Ru(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 Hu(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 De(e,t,n){let r=e.querySelector('[class*="editorRoute"]')?.textContent?.trim();if(r!==void 0&&r.length>0&&ut(t,r))return{route:r,staged:!1};if(Hu(e,n.routeId)){let s=ue(e,n.routeId);return s.length>0&&!ut(t,s)?{route:s,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(([,s])=>s.displayName===o);if(i!==void 0)return{route:i[0],staged:!1};if(ut(t,o))return{route:o,staged:!1}}function Ou(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=(m,p)=>(m.textContent??"").trim()===p,i=n.querySelector('[class*="primaryButton"]'),s=n.querySelector('[class*="secondaryButton"]');if(i!==null&&s!==null)return{submit:i,cancel:s};let a=[...r].reverse().find(m=>t.apply.some(p=>o(m,p))),d=[...r].reverse().find(m=>t.cancel.some(p=>o(m,p)));if(a!==void 0&&d!==void 0)return{submit:a,cancel:d};let u=r[r.length-1],g=r[r.length-2];if(!(u===void 0||g===void 0))return{submit:u,cancel:g}}function _n(e,t,n){t.has(e)||(t.add(e),e.addEventListener("click",n,{capture:!0}))}var Fr=new WeakMap,Ur=420,_u=320,Nu=160,ls=2e3,Du=150,ws=new Set(["PageUp","PageDown","Home","End","ArrowUp","ArrowDown"," "]);function Dn(e,t){let n=Ir(e),r=n[0];if(r===void 0||!e.isConnected)return;let o=performance.now(),i=Fr.get(r);if(i!==void 0){i.deadline=Math.min(Math.max(i.deadline,o+t),i.startedAt+ls);return}let s=e.getBoundingClientRect(),a=s.top,d=s.height,u=new Map,g=new Map;for(let w of n)u.set(w,w.scrollTop),g.set(w,w.style.overflowAnchor),w.style.overflowAnchor="none";let m=new Set(n),p={deadline:o+t,startedAt:o,frame:void 0,release:()=>{}},l=()=>{p.frame!==void 0&&(window.cancelAnimationFrame(p.frame),p.frame=void 0);for(let[w,k]of g)w.style.overflowAnchor=k;Fr.delete(r),document.removeEventListener("wheel",c,!0),document.removeEventListener("touchstart",c,!0),document.removeEventListener("pointerdown",c,!0),document.removeEventListener("keydown",f,!0)};function c(){l()}function f(w){ws.has(w.key)&&l()}p.release=l,Fr.set(r,p),document.addEventListener("wheel",c,{capture:!0,passive:!0}),document.addEventListener("touchstart",c,{capture:!0,passive:!0}),document.addEventListener("pointerdown",c,{capture:!0}),document.addEventListener("keydown",f,{capture:!0});let y=0,v=()=>{if(p.frame=void 0,y+=1,!e.isConnected||y>=Du){l();return}let w=e.getBoundingClientRect(),k=Math.abs(w.height-d)>.5;if(!k&&[...m].some(T=>T.scrollTop!==u.get(T))){l();return}let R=w.top-a;R!==0&&Cu(n,m,u,R);let h=performance.now();if(k&&(d=w.height,p.deadline=Math.min(Math.max(p.deadline,h+Nu),p.startedAt+ls)),h>=p.deadline){l();return}p.frame=window.requestAnimationFrame(v)};p.frame=window.requestAnimationFrame(v)}function Cu(e,t,n,r){let o=r;for(let i of[...t,...e]){if(o===0)break;let s=i.scrollTop;if(s!==n.get(i))continue;i.scrollTop=s+o;let a=i.scrollTop;a!==s&&(n.set(i,a),t.add(i),o-=a-s)}}var vs='[class*="modelList"]',Iu="bre-list-slack",Pu=3e3,Cn,ft=new WeakMap,ct=new Set;function xs(e){if(!(e instanceof Element))return;let t=e.closest(vs);if(t===null)return;let n=Ir(t).map(r=>({host:r,top:r.scrollTop}));n.length!==0&&(Cn={targets:n,at:performance.now()})}function Ce(){Cn=void 0}function ks(e){xs(e.target)}function Es(e){if(ws.has(e.key)){Ce();return}xs(e.target)}var _t=0;function Ts(){_t+=1,!(_t>1)&&(document.addEventListener("click",ks,!0),document.addEventListener("keydown",Es,!0),document.addEventListener("focusin",Ce,!0),document.addEventListener("pointerdown",Ce,!0),document.addEventListener("wheel",Ce,{capture:!0,passive:!0}),document.addEventListener("touchstart",Ce,{capture:!0,passive:!0}))}function Nn(e){let t=ft.get(e);t!==void 0&&(ft.delete(e),ct.delete(t),t.scrollTarget.removeEventListener("scroll",t.onScroll),t.spacer.remove())}function Fu(e){return e===document.scrollingElement?document:e}function qu(){if(ct.size!==0)for(let e of Array.from(ct)){let t=e.host;if(!e.spacer.isConnected){ft.delete(t),ct.delete(e),e.scrollTarget.removeEventListener("scroll",e.onScroll);continue}t.scrollTop<=t.scrollHeight-t.clientHeight-e.height&&Nn(t)}}function us(e,t){return e.scrollTop>e.scrollHeight-e.clientHeight-t}function Ku(e=performance.now()){let t=Cn;if(!(t===void 0||e-t.at>Pu))for(let n of t.targets){let r=n.host;if(!r.isConnected)continue;let o=ft.get(r),i=o===void 0?0:o.height,s=r.scrollHeight-r.clientHeight-i,a=n.top-s;if(a<=0){o!==void 0&&!us(r,o.height)&&Nn(r);continue}let d=o;if(d===void 0){let u=document.createElement("div");u.className=Iu,u.dataset.plugin=ne,u.setAttribute("aria-hidden","true"),u.style.height="0px",(r===document.scrollingElement?document.body??r:r).appendChild(u);let m=()=>{let p=ft.get(r);p!==void 0&&!us(r,p.height)&&Nn(r)};d={host:r,spacer:u,height:0,onScroll:m,scrollTarget:Fu(r)},ft.set(r,d),ct.add(d),d.scrollTarget.addEventListener("scroll",m,{passive:!0})}d.height!==a&&(d.height=a,d.spacer.style.height=`${a}px`),r.scrollTop!==n.top&&(r.scrollTop=n.top)}}function Ls(){if(_t=Math.max(0,_t-1),!(_t>0)){document.removeEventListener("click",ks,!0),document.removeEventListener("keydown",Es,!0),document.removeEventListener("focusin",Ce,!0),document.removeEventListener("pointerdown",Ce,!0),document.removeEventListener("wheel",Ce,!0),document.removeEventListener("touchstart",Ce,!0),Cn=void 0;for(let e of Array.from(ct))Nn(e.host)}}function Ms(e,t=Ur){Ku(),qu();let n=new Set;for(let r of Array.from(e.querySelectorAll(vs))){let o=r.closest('[class*="rowCard"], [class*="setupCard"], [class*="addCard"]');o===null||n.has(o)||(n.add(o),Dn(o,t))}}function Bu(e,t){_n(e,t,()=>{let n=e.closest('[class*="modelEntry"]')??e.closest('[class*="rowCard"]');n!==null&&Dn(e.closest('[class*="rowCard"]')??n,Ur)})}var fs="{provider}";function Wu(e,t){let n=t.editProvider.map(o=>{let i=o.indexOf(fs);return i<0?void 0:{prefix:o.slice(0,i),suffix:o.slice(i+fs.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(s=>i.length>s.prefix.length+s.suffix.length&&i.startsWith(s.prefix)&&i.endsWith(s.suffix))&&o.closest("[data-plugin]")===null&&r.push(o)}return r}function Uu(e,t){_n(e,t,()=>{let n=e.closest('[class*="rowCard"], [class*="setupCard"], [class*="addCard"]');n!==null&&Dn(n,Ur)})}function jr(e){return e.querySelector('[class*="editorActions"]')??e.querySelector('[class*="modelEntry"]')??void 0}function Ss(){return jr(Me())!==void 0}function As(e,t,n){if(!e.isConnected)return;let r=t.labels(),o=jr(e)!==void 0;for(let a of Array.from(e.querySelectorAll('[class*="rowCard"], [class*="setupCard"]')))for(let d of Wu(a,r))Uu(d,n.editWired);let i=Array.from(e.querySelectorAll("button[aria-label]")).some(a=>r.capacity.some(d=>(a.getAttribute("aria-label")??"").startsWith(d)));if(!o){if(vn(e,[],{t:t.t}),n.mounted.size>0){for(let[,d]of n.mounted)d.editor.unmount();n.mounted.clear()}let a=n.editing;n.editing=!1,(a!==!1||du(n)&&Date.now()>=n.nextFlushAt)&&au(t,n).catch(d=>{console.error(`[bre] idle pass failed: ${d instanceof Error?d.message:String(d)}`)});return}if(n.editing=!0,!i){for(let[,d]of n.mounted)d.editor.unmount();n.mounted.clear(),n.describePromise??(n.describePromise=t.describeNamespace());let a=r;n.describePromise.then(d=>{ku(e,t,n,d,a)}).catch(d=>{console.error(`[bre] empty-catalog seat failed: ${d instanceof Error?d.message:String(d)}`)});return}for(let a of r.capacity)for(let d of Array.from(e.querySelectorAll("button[aria-label]")))(d.getAttribute("aria-label")??"").startsWith(a)&&Bu(d,n.disclosureWired);n.describePromise??(n.describePromise=t.describeNamespace());let s=a=>{if(!e.isConnected)return;let d=a.namespace,u=we(d),g=[];for(let p of r.capacity){let l=Array.from(e.querySelectorAll("button[aria-label]")).filter(c=>(c.getAttribute("aria-label")??"").startsWith(p));for(let c of l){let f=Dt(c);if(f===void 0)continue;let y=c.closest('[class*="modelEntry"]')??f,v=ue(y,r.modelId);v.length!==0&&g.push({container:yu(c),row:y,modelId:v,card:f})}}vn(e,Tu(g,u,r),{t:t.t,onRequest:p=>ys(n,t,p,Lu(e,p,u,r))});for(let[p,l]of n.mounted)g.some(c=>c.container===p)||(l.editor.unmount(),n.mounted.delete(p));if(n.pending.size>0){let p=new Map;for(let c of g){let f=De(c.card,u,r);if(f===void 0)continue;let y=p.get(f.route);y===void 0&&p.set(f.route,y=new Set),y.add(c.modelId)}let l=new Map;for(let[c,f]of n.pending){if(!ut(u,c))continue;let y=p.get(c),v=[...f.keys()].filter(w=>!y?.has(w));v.length>0&&l.set(c,new Set(v))}for(let[c,f]of l){let y=n.missedScans.get(c);if(y!==void 0)for(let v of f)y.has(v)&&(Nt(n,c,v,void 0),y.delete(v))}n.missedScans=l}let m=new Set(g.map(p=>p.card));for(let p of m){let l=De(p,u,r);if(l===void 0)continue;let c=l.route,f=Ou(p,r);f===void 0?n.signalsUnavailable=!0:(n.signalsUnavailable=!1,_n(f.submit,n.submitWired,()=>{let y=De(p,u,r)?.route??c;n.committing.add(y),Ae(n)}),_n(f.cancel,n.cancelWired,()=>{let y=De(p,u,r)?.route??c;cu(n,y)}))}g.forEach((p,l)=>{let c=p.container;if(c===void 0)return;let f=De(p.card,u,r);if(f===void 0)return;let{route:y,staged:v}=f,w=u[y]??{},k=dn(u,y),R=new Set(k.map(O=>O.id)),h=v||!R.has(p.modelId),T=h?n.pending.get(y)?.get(p.modelId)?.efforts:void 0,E=h?T==="keep"?void 0:T:un(k,p.modelId),L=!h&&k.some(O=>O.id===p.modelId&&O[ge]===!0),P=h?n.pending.get(y)?.get(p.modelId)?.input:fn(k,p.modelId),_=h?n.pending.get(y)?.get(p.modelId)?.compat:cn(k,p.modelId),F=h?n.pending.get(y)?.get(p.modelId)?.defaultEffort??void 0:mn(k,p.modelId),A=h?ue(p.row,r.modelName):"",I=h?A.length>0?A:void 0:pn(k,p.modelId),Q=v?ue(p.card,r.apiProtocol):"",Y=v?ue(p.card,r.baseUrl):"",z=v&&Q.length>0?Q:typeof w.api=="string"?w.api:void 0,oe=v&&Y.length>0?Y:typeof w.baseURL=="string"?w.baseURL:void 0,B={route:y,routeDisplayName:v?y:typeof w.displayName=="string"?w.displayName:y,...z===void 0?{}:{routeApi:z},...oe===void 0?{}:{routeBaseURL:oe},modelId:p.modelId,...I===void 0?{}:{modelName:I},...E===void 0?{}:{efforts:E},...L?{effortsUnset:L}:{},...P===void 0?{}:{input:P},..._===void 0?{}:{compat:_},...F===void 0?{}:{defaultEffort:F},index:l,staged:h,officialInputTypes:Rn(c),api:gn(t.api,void 0,(O,K,U,te,H,q)=>{Nt(n,O,K,U,te,qr(c,H,r.inputImage),q)},(O,K,U)=>{hs(n,O,K,{...U,input:qr(c,U.input,r.inputImage)})},O=>{fu(n,O,p.modelId)},()=>(De(p.card,u,r)?.staged??v)||!R.has(p.modelId)),readOnly:a.writable!==!0,t:t.t},ee=n.mounted.get(c);if(ee!==void 0){Su(ee.props,B)||(ee.props=B,ee.editor.render(B));return}if(Mu(c))return;Dn(Dt(c)??p.card,_u);let ae=t.mount(c,B);n.mounted.set(c,{editor:ae,props:B})})};n.describePromise.then(s,()=>{n.describePromise=void 0})}function j(e,t,n){e.getAttribute(t)!==n&&e.setAttribute(t,n)}function Ct(e,t){e!==void 0&&e.hidden!==t&&(e.hidden=t)}function ve(e,t,n){e.classList.contains(t)!==n&&(n?e.classList.add(t):e.classList.remove(t))}function In(e,t){e!==void 0&&e.textContent!==t&&(e.textContent=t)}var Gr=require("react");var ie=require("react");function Rs(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,40)}function Pn(e){return typeof e=="string"&&/^[\x21-\x7E]+$/.test(e)}function ju(e){for(let t of["error","message"]){let n=e[t];if(typeof n=="string"&&n.length>0)return n}}function Gu(e){if(!C(e))return;let t=e.ref;if(typeof t!="string"||t.length===0)return;let n=e.alias,r=e.configured,o=e.masked;return{ref:t,...typeof n=="string"&&n.length>0?{alias:n}:{},enabled:e.enabled===!0,configured:typeof r=="boolean"?r:null,...typeof o=="string"&&o.length>0?{masked:o}:{}}}function zu(e){let t=e.entries;if(!Array.isArray(t))return;let n=[];for(let i of t){let s=Gu(i);s!==void 0&&n.push(s)}let r=e.enabledRef,o=e.route;return{ok:!0,route:typeof o=="string"?o:"",enabledRef:typeof r=="string"&&r.length>0?r:null,entries:n}}async function $u(e){let t;try{t=await e.json()}catch{t=void 0}if(!C(t))return{ok:!1};if(t.ok===!0){let r=zu(t);if(r!==void 0)return r}let n=ju(t);return n===void 0?{ok:!1}:{ok:!1,error:n}}async function pt(e,t){let n=`${To}?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 $u(r)}catch{return{ok:!1}}}var Hs={list:e=>pt(e),add:(e,t,n)=>pt(e,{op:"add",value:t,...n===void 0?{}:{alias:n}}),enable:(e,t)=>pt(e,{op:"enable",ref:t}),rename:(e,t,n)=>pt(e,{op:"rename",ref:t,...n===void 0?{}:{alias:n}}),remove:(e,t)=>pt(e,{op:"remove",ref:t}),replace:(e,t,n)=>pt(e,{op:"value",ref:t,value:n}),async reveal(e,t){try{let n=await fetch(`${Yt}?route=${encodeURIComponent(e)}&ref=${encodeURIComponent(t)}`,{method:"GET",cache:"no-store",credentials:"same-origin"});if(!n.ok)return;let r=await n.json();if(!C(r)||r.ok!==!0)return;let o=r.key;return typeof o=="string"&&o.length>0?o:void 0}catch{return}}};var D=require("react/jsx-runtime"),Vu="M3.9 8.35 6.6 11.05 12.1 5.5",Yu=["M8 3.9v8.2","M3.9 8h8.2"];function Os({paths:e}){return(0,D.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,D.jsx)("path",{d:t},t))})}function Ju(e,t){return e.masked!==void 0?e.masked:e.configured===!1?t("keysMissing"):"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"}function Xu(e){return e.alias??e.masked??e.ref}function _s(e){let{route:t,t:n}=e,r=e.client??Hs,o=(0,ie.useId)(),[i,s]=(0,ie.useState)(void 0),[a,d]=(0,ie.useState)(null),[u,g]=(0,ie.useState)(void 0),[m,p]=(0,ie.useState)(!1),[l,c]=(0,ie.useState)(void 0),[f,y]=(0,ie.useState)(""),[v,w]=(0,ie.useState)(""),[k,R]=(0,ie.useState)(void 0),h=(0,ie.useCallback)((A,I)=>{if(!A.ok){g({kind:"error",text:A.error??n("keysUnreachable")});return}s(A.entries),d(A.enabledRef),g(I===void 0?void 0:{kind:"status",text:I})},[n]);(0,ie.useEffect)(()=>{let A=!0;return(async()=>{let I=await r.list(t);A&&h(I,void 0)})(),()=>{A=!1}},[h,r,t]);let T=(0,ie.useCallback)(async(A,I)=>{p(!0),R(void 0),c(void 0);try{h(await A(),I)}finally{p(!1)}},[h]),E=()=>{c(void 0),y(""),w("")},L=(A,I)=>{c({kind:A,ref:I.ref}),y(A==="alias"?I.alias??"":""),w(""),R(void 0)},P=()=>{if(m||l===void 0)return;let A=l.kind,I=l.ref;if(A!=="alias"&&!Pn(v))return;let Q=Rs(f);p(!0),(async()=>{try{if(A==="add"){let z=await r.add(t,v,Q);h(z,n("keysAdded")),z.ok&&E();return}if(I===void 0)return;let Y=A==="alias"?await r.rename(t,I,Q):await r.replace(t,I,v);h(Y,n(A==="alias"?"keysRenamed":"keysReplaced")),Y.ok&&E()}finally{p(!1)}})()},_=()=>{if(l===void 0)return null;let A=l.kind,I=A!=="alias",Q=I&&v.length>0&&!Pn(v);return(0,D.jsxs)("div",{className:"bre-keys-form",children:[(0,D.jsxs)("div",{className:"bre-keys-form-fields",children:[A==="value"?null:(0,D.jsx)("input",{className:"bre-text-input bre-keys-name",type:"text",value:f,placeholder:n("keysAliasPlaceholder"),"aria-label":n("keysAlias"),disabled:m,autoFocus:A==="alias",onChange:Y=>y(Y.target.value)}),I?(0,D.jsx)("input",{className:"bre-text-input bre-keys-secret",type:"password",autoComplete:"new-password",spellCheck:!1,value:v,placeholder:n(A==="add"?"keysValuePlaceholder":"keysNewValuePlaceholder"),"aria-label":n("keysValue"),"aria-invalid":Q,disabled:m,autoFocus:!0,onChange:Y=>w(Y.target.value)}):null]}),Q?(0,D.jsx)("p",{className:"bre-effort-message bre-error",role:"alert",children:n("keysAddIllegal")}):null,(0,D.jsxs)("div",{className:"bre-keys-form-actions",children:[(0,D.jsx)("button",{type:"button",className:"bre-link-button",disabled:m,onClick:E,children:n("keysCancel")}),(0,D.jsx)("button",{type:"button",className:"bre-primary-button",disabled:m||I&&!Pn(v),onClick:P,children:n(A==="add"?"keysAddConfirm":"keysSave")})]})]})},F=()=>l?.kind==="add"?(0,D.jsx)("li",{className:"bre-keys-form-row",children:_()}):(0,D.jsx)("li",{className:"bre-keys-add-row",children:(0,D.jsxs)("button",{type:"button",className:"bre-keys-add",disabled:m,onClick:()=>{c({kind:"add"}),y(""),w(""),R(void 0)},children:[(0,D.jsx)("span",{className:"bre-keys-add-mark","aria-hidden":"true",children:(0,D.jsx)(Os,{paths:Yu})}),n("keysAdd")]})});return i===void 0?u===void 0?(0,D.jsx)("div",{className:"bre-keys"}):(0,D.jsxs)("div",{className:"bre-keys",children:[(0,D.jsx)("p",{className:"bre-effort-message bre-"+u.kind,role:u.kind==="error"?"alert":"status",children:u.text}),(0,D.jsx)("ul",{className:"bre-keys-list",children:F()})]}):(0,D.jsxs)("div",{className:"bre-keys",children:[(0,D.jsxs)("ul",{className:"bre-keys-list",children:[i.map(A=>{let I=Xu(A);return(0,D.jsxs)(ie.Fragment,{children:[(0,D.jsxs)("li",{className:"bre-keys-row","data-state":A.configured===!1?"missing":"ready",children:[A.alias===void 0?null:(0,D.jsx)("span",{className:"bre-keys-alias",children:A.alias}),(0,D.jsx)("span",{className:A.alias===void 0?"bre-keys-mask bre-keys-mask-plain":"bre-keys-mask",children:Ju(A,n)}),(0,D.jsx)("span",{className:"bre-keys-actions",children:k===A.ref?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("button",{type:"button",className:"bre-link-button bre-keys-danger",disabled:m,onClick:()=>{T(()=>r.remove(t,A.ref),n("keysRemoved"))},children:n("keysConfirmRemove")}),(0,D.jsx)("button",{type:"button",className:"bre-link-button",disabled:m,onClick:()=>R(void 0),children:n("keysCancel")})]}):(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)("button",{type:"button",className:"bre-link-button",disabled:m,onClick:()=>{R(A.ref),c(void 0)},children:n("keysRemove")}),(0,D.jsx)("button",{type:"button",className:"bre-link-button",disabled:m,onClick:()=>L("alias",A),children:n("keysAlias")}),(0,D.jsx)("button",{type:"button",className:"bre-link-button",disabled:m,onClick:()=>L("value",A),children:n("keysEdit")})]})}),(0,D.jsxs)("label",{className:"bre-keys-enable",title:n("keysEnable",{name:I}),children:[(0,D.jsx)("input",{type:"radio",name:o,className:"bre-keys-enabled",checked:A.enabled,disabled:m,"aria-label":n("keysEnable",{name:I}),onChange:()=>{T(()=>r.enable(t,A.ref),n("keysEnabledNote",{name:I}))}}),(0,D.jsx)("span",{className:"bre-keys-mark","aria-hidden":"true",children:A.enabled?(0,D.jsx)(Os,{paths:[Vu]}):null}),(0,D.jsx)("span",{className:"bre-keys-enable-text",children:n("keysEnabled")})]})]}),l!==void 0&&l.ref===A.ref?(0,D.jsx)("li",{className:"bre-keys-form-row",children:_()}):null]},A.ref)}),F()]}),u===void 0?null:(0,D.jsx)("p",{className:"bre-effort-message bre-"+u.kind,role:u.kind==="error"?"alert":"status",children:u.text})]})}var qn="bre-key-managed",Qu="bre-keys-host",zr="data-bre-key-host",Zu="data-bre-key-input",Fn="data-bre-region",We=new WeakMap;function ef(e){let t=e.querySelector(`input[${Zu}]`);if(t instanceof HTMLInputElement)return t;let n=e.querySelector('input[type="password"]');return n instanceof HTMLInputElement?n:void 0}function Ns(e){let t=We.get(e)?.host;if(t!==void 0&&t.isConnected)return t;let n=e.nextElementSibling;return n instanceof HTMLElement&&n.hasAttribute(zr)?n:void 0}function Ds(e,t){let n=t.route;if(n===void 0||n.length===0||ef(e)===void 0||e.parentElement===null)return;ve(e,qn,!0);let r=We.get(e),o=Ns(e);o===void 0&&(r!==void 0&&Cs(e,r),o=e.ownerDocument.createElement("div"),o.className=Qu,e.after(o)),j(o,zr,n);let i=e.getAttribute(Fn);i===null?o.hasAttribute(Fn)&&o.removeAttribute(Fn):j(o,Fn,i);let s=()=>(0,Gr.createElement)(_e,{fallbackText:t.t("keysPanelFailed")},(0,Gr.createElement)(_s,{route:n,t:t.t,client:t.client})),a=We.get(e);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(s()));return}a!==void 0&&(We.delete(e),a.mount.root.unmount()),We.set(e,{route:n,host:o,mount:$e(o,s(),{sync:!0}),t:t.t,client:t.client})}function Cs(e,t){We.delete(e),Ne(t.mount)}function Kn(e){ve(e,qn,!1);let t=We.get(e);t!==void 0&&Cs(e,t),Ns(e)?.remove()}function Is(){for(let e of Array.from(document.querySelectorAll(`[${zr}]`))){let t=e.previousElementSibling;t instanceof HTMLElement&&We.has(t)?Kn(t):e.remove()}}var Ps="http://www.w3.org/2000/svg",tf="data-bre-icon";function nf(e){let t=document.createElementNS(Ps,"path");return t.setAttribute("d",e),t}function Fs(e,t){let n=document.createElementNS(Ps,"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(tf,e),n.append(...t.map(nf)),n}var Wn="bre-key-field",Ws="bre-key-eye",Bn="data-bre-key-input",Us="data-bre-eye-show",js="data-bre-eye-hide",qs=["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"],Yr=new WeakMap;function $r(e){let t=e.querySelector(`input[${Bn}]`);if(t instanceof HTMLInputElement)return t;let n=e.querySelector('input[type="password"]');return n instanceof HTMLInputElement?n:void 0}function Gs(e){for(let t of Array.from(e.children))if(t instanceof HTMLButtonElement&&t.classList.contains(Ws))return t}function zs(e,t){let n=$r(e);if(n===void 0){Un(e);return}Yr.set(e,t),j(n,Bn,""),ve(e,Wn,!0);let r=Gs(e)??of(e);j(r,Us,t.t("keyRevealShow")),j(r,js,t.t("keyRevealHide")),Vr(r,n)}function Un(e){let t=Gs(e);t!==void 0&&t.remove(),Yr.delete(e),ve(e,Wn,!1);let n=e.querySelector(`input[${Bn}]`);n instanceof HTMLInputElement&&(n.removeAttribute(Bn),n.type="password")}async function rf(e){try{let t=await fetch(`${Yt}?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 Vr(e,t){let n=t.type!=="password";j(e,"aria-pressed",n?"true":"false");let r=e.getAttribute(n?js:Us);r!==null&&(j(e,"aria-label",r),j(e,"title",r)),Ct(e,t.disabled)}function Ks(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 of(e){let t=document.createElement("button");t.type="button",t.className=Ws,t.append(Bs("eye"),Bs("eye-off"));let n,r=async()=>{let o=$r(e),i=Yr.get(e);if(o===void 0||i===void 0)return;if(o.type!=="password"){n!==void 0&&o.value===n&&Ks(o,""),n=void 0,o.type="password",Vr(t,o);return}let s=i.route;if(s!==void 0&&n===void 0&&o.value.length===0){j(t,"aria-busy","true");let a;try{a=await(i.loadKey??rf)(s)}catch{a=void 0}if(t.hasAttribute("aria-busy")&&t.removeAttribute("aria-busy"),a===void 0){let d=i.t("keyRevealFailed");j(t,"aria-label",d),j(t,"title",d);return}$r(e)===o&&o.value.length===0&&(n=a,Ks(o,a))}o.type="text",Vr(t,o)};return t.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),r()}),e.append(t),t}function Bs(e){let t=e==="eye-off"?[...qs,"M2.5 13.5 13.5 2.5"]:qs;return Fs(e,t)}var Jr="bre-editor-tabs",sf="bre-editor-tab",jn="data-bre-tab-id",Ft="bre-tabbed",je="data-bre-tab",$s="data-bre-provider",xe="data-bre-region",Pt="data-bre-editor-body",ht="data-bre-footer",af="row",df="path",qt="data-bre-details";var lf=".bre-headers",Ue="provider",mt="models",gt="advanced",uf=[Ue,mt,gt],ff="none",Vs=uf,Ys=Jr,Js=sf,Xs=jn,Gn='[class*="editorActions"], [class*="modelList"], [class*="modelCatalog"], [class*="modelEntry"]',cf='[class*="modelCatalog"], [class*="modelList"], [class*="modelEntry"]',Qs='[class*="rowCard"], [class*="addCard"], li',pf='[class*="addPanel"]',mf=".bre-create-host";function Zs(){return{warned:new WeakSet}}function Kt(e){return e===null?null:e.closest(Qs)}function ea(e){for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.matches(pf)&&!t.hidden)return t;return e}function ta(e,t){let n=Mn(e),r=e.getBoundingClientRect().top,o=n?.scrollTop??0;n!==void 0&&(n.style.overflowAnchor="none"),j(e,je,t),oa(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 Xr(e,t,n){if(!e.isConnected)return;let r=new Set;for(let o of Array.from(e.querySelectorAll(Gn))){let i=o.closest(Qs);i!==null&&r.add(i)}for(let o of Array.from(e.querySelectorAll(`.${Ft}`)))r.has(o)||zn(o);for(let o of r)try{vf(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)),zn(o)}}function na(){for(let e of Array.from(document.querySelectorAll(`.${Ft}`))){e.classList.remove(Ft),e.removeAttribute(je),e.removeAttribute(Pt);for(let t of Array.from(e.querySelectorAll(`[${xe}]`)))t.removeAttribute(xe)}for(let e of Array.from(document.querySelectorAll(`[${je}]`)))e.removeAttribute(je);for(let e of Array.from(document.querySelectorAll(`[${xe}]`)))e.removeAttribute(xe);for(let e of Array.from(document.querySelectorAll(`[${Pt}]`)))e.removeAttribute(Pt);for(let e of Array.from(document.querySelectorAll(`[${ht}]`)))e.removeAttribute(ht);for(let e of Array.from(document.querySelectorAll(`details[${qt}]`)))e.removeAttribute("open"),e.removeAttribute(qt);for(let e of Array.from(document.querySelectorAll(`.${Wn}`)))Un(e);for(let e of Array.from(document.querySelectorAll(`.${qn}`)))Kn(e);Is()}function gf(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(Gn)!==null||n.querySelector("input, select")!==null))return n;let t=e.querySelector(Gn);for(;t!==null&&t.parentElement!==e;)t=t.parentElement;return t!==null&&t!==e?t:void 0}function hf(e){let t={header:void 0,models:void 0,actions:void 0,fields:[]};ra(e,t,0);let{actions:n,fields:r,header:o,models:i}=t;if(!(n===void 0||r.length===0)&&r.some(s=>s.querySelector("input, select, textarea")!==null))return{header:o,models:i,actions:n,fields:r}}var bf=4;function ra(e,t,n){if(!(n>bf)){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(cf)){t.models??(t.models=r);continue}if(r.querySelector(Gn)!==null){ra(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 yf(e,t){if(!t.contains(e))return;j(e,ht,af);let n=e.parentElement;for(;n!==null&&(j(n,ht,df),n!==t);)n=n.parentElement}function wf(e){let n=e.querySelector(`[${$s}]`)?.getAttribute($s);return n==null||n===""?void 0:n}function vf(e,t){let n=ea(e),r=gf(n);if(r===void 0){zn(e);return}let o=hf(r);if(o===void 0){zn(e);return}let i=n.querySelector(lf),s=wf(n);for(let u of o.fields)j(u,xe,Ue),zs(u,{t:t.t,route:s}),Ds(u,{t:t.t,route:s});o.header!==void 0&&j(o.header,xe,ff),o.models!==void 0&&j(o.models,xe,mt),j(r,Pt,""),n.querySelector(mf)!==null&&yf(o.actions,r),i!==null&&j(i,xe,gt),kf(r);let a=new Set([Ue]);o.models!==void 0&&a.add(mt),i!==null&&a.add(gt);let d=e.getAttribute(je)??Ue;j(e,je,a.has(d)?d:Ue),ve(e,Ft,!0),xf(e,n,t,a)}function xf(e,t,n,r){let o=t.querySelector(`.${Jr}`);o!==null&&(j(o,"aria-label",n.t("editorTabsLabel")),In(It(o,Ue),n.t("editorTabProvider")),In(It(o,mt),n.t("editorTabModels")),In(It(o,gt),n.t("editorTabAdvanced")),Ct(It(o,mt),!r.has(mt)),Ct(It(o,gt),!r.has(gt)),oa(e,o))}function oa(e,t){let n=t??ea(e).querySelector(`.${Jr}`);if(n===null)return;let r=e.getAttribute(je)??Ue;for(let o of Array.from(n.querySelectorAll(`[${jn}]`)))j(o,"aria-selected",o.getAttribute(jn)===r?"true":"false")}function It(e,t){for(let n of Array.from(e.children))if(n instanceof HTMLElement&&n.getAttribute(jn)===t)return n}function zn(e){e.classList.remove(Ft),e.removeAttribute(je),e.removeAttribute(Pt);for(let t of Array.from(e.querySelectorAll(`[${xe}]`)))t.getAttribute(xe)===Ue&&(Un(t),Kn(t)),t.removeAttribute(xe);for(let t of Array.from(e.querySelectorAll(`[${ht}]`)))t.removeAttribute(ht);Ef(e)}function kf(e){for(let t of Array.from(e.querySelectorAll("details")))t.hasAttribute("open")||(j(t,qt,"closed"),j(t,"open",""))}function Ef(e){for(let t of Array.from(e.querySelectorAll(`details[${qt}]`)))t.removeAttribute("open"),t.removeAttribute(qt)}var ya=require("react");var fe=require("react");var X=require("react");var N=require("react/jsx-runtime"),Tf=["claude-cli/2.1.161 (external, cli)","claude-code/1.0.0","Kilo-Code/1.0"];function ia(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 sa(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 $n({route:e,api:t,t:n,onDismiss:r,deferred:o}){let i=(0,X.useId)(),[s,a]=(0,X.useState)(void 0),[d,u]=(0,X.useState)({rows:[]}),[g,m]=(0,X.useState)(!1),[p,l]=(0,X.useState)(!1),[c,f]=(0,X.useState)(!0),[y,v]=(0,X.useState)(!1),[w,k]=(0,X.useState)(!1),[R,h]=(0,X.useState)(void 0),[T,E]=(0,X.useState)(void 0),[L,P]=(0,X.useState)(!1),_=(0,X.useRef)(0),F=(0,X.useRef)(null),A=o!==void 0,I=o?.onDraft,Q=(0,X.useRef)(void 0);(0,X.useEffect)(()=>{if(A&&Q.current!==void 0)return;Q.current=e;let H=!0;return(async()=>{try{let q=await re(t);if(!H)return;let G=Sr(q.namespace,e);a(G),u(ia(G,_)),k(q.writable!==!0)}catch{H&&k(!0)}finally{H&&f(!1)}})(),()=>{H=!1}},[t,e,A]),(0,X.useEffect)(()=>{I!==void 0&&I(sa(d))},[d,I]),(0,X.useEffect)(()=>{let H=!0;return(async()=>{try{let G=await(await fetch(Mo,{method:"GET"})).json();H&&G.ok===!0&&G.data!==void 0&&E(G.data)}catch{}})(),()=>{H=!1}},[]),(0,X.useEffect)(()=>{let H=F.current;if(H===null)return;let q=()=>{P(H.dataset.breRegion==="advanced")};q();let G=new MutationObserver(q);return G.observe(H,{attributes:!0,attributeFilter:["data-bre-region"]}),()=>{G.disconnect()}},[]);let Y=()=>{u(H=>({...H,rows:[...H.rows,{id:_.current+=1,name:"",value:""}]})),h(void 0)},z=(H,q)=>{u(G=>({...G,rows:G.rows.map(be=>be.id===H?{...be,...q}:be)})),h(void 0)},oe=H=>{u(q=>({...q,rows:q.rows.filter(G=>G.id!==H)})),h(void 0)},B=()=>{if(u(ia(s,_)),l(!1),h(void 0),o!==void 0){o.onCancel();return}L&&r?.()},ee=async H=>{v(!0),h(void 0);let q;try{q=await At(t,e,H)}catch(G){q={ok:!1,error:G instanceof Error?G.message:String(G)}}if(v(!1),!q.ok){h({kind:"error",text:q.error==="no-route"?n("headersNoRoute"):q.error==="read-only"?n("headersReadOnly"):n("headersError",{error:q.error})});return}a(H),l(!1),h({kind:"success",text:Object.keys(H).length===0?n("headersCleared"):n("headersSaved")})},ae=Object.entries(s??{}),O=w||y,K=ae.length,U=L||A,te=g||p||U;return(0,N.jsxs)("div",{className:"bre-headers",ref:F,"data-plugin":ne,"data-open":g?"1":"0",children:[(0,N.jsx)("div",{className:"bre-headers-head",children:p||U?(0,N.jsx)("span",{className:"bre-effort-title",children:n("headersTitle")}):(0,N.jsxs)("button",{type:"button",className:"bre-headers-disclosure","aria-expanded":g,"aria-label":`${n("headersTitle")} ${e}`,onClick:()=>{m(!g),h(void 0)},children:[(0,N.jsx)("span",{className:"bre-effort-title",children:n("headersTitle")}),c||K===0?null:(0,N.jsx)("span",{className:"bre-headers-count",children:K}),(0,N.jsx)("span",{className:"bre-headers-chevron","aria-hidden":"true",children:"\u203A"})]})}),te?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("p",{className:"bre-effort-note",children:n("headersHint")}),T===void 0?null:(0,N.jsxs)(N.Fragment,{children:[T.environment.preferOfficialLayer?(0,N.jsx)("p",{className:"bre-effort-note bre-warn",children:n("headersConflictPatched")}):null,T.conflicts.length===0&&(T.headerConflicts?.length??0)===0?null:(0,N.jsx)("p",{className:"bre-effort-note bre-warn",children:n("headersConflictOrigin")}),T.environment.siblings.length===0?null:(0,N.jsx)("p",{className:"bre-effort-note bre-warn",children:n("headersConflictSiblings",{names:T.environment.siblings.map(H=>H.name).join(", ")})})]}),c?null:p||U?(0,N.jsxs)("div",{className:"bre-headers-edit",children:[(0,N.jsxs)("div",{className:"bre-headers-columns","aria-hidden":"true",children:[(0,N.jsx)("span",{children:n("headersName")}),(0,N.jsx)("span",{children:n("headersValue")}),(0,N.jsx)("span",{})]}),d.rows.map(H=>(0,N.jsxs)("div",{className:"bre-headers-row",children:[(0,N.jsx)("input",{type:"text",className:"bre-text-input bre-headers-name",value:H.name,disabled:O,placeholder:n("headersNamePlaceholder"),"aria-label":n("headersName"),onChange:q=>{z(H.id,{name:q.target.value})}}),(0,N.jsx)("input",{type:"text",className:"bre-text-input bre-headers-value",value:H.value,disabled:O,list:H.name.trim().toLowerCase()==="user-agent"?i:void 0,placeholder:n("headersValue"),"aria-label":n("headersValue"),onChange:q=>{z(H.id,{value:q.target.value})}}),(0,N.jsx)("button",{type:"button",className:"bre-link-button bre-headers-remove",disabled:O,"aria-label":`${n("headersClear")} ${H.name}`,onClick:()=>{oe(H.id)},children:"\xD7"})]},H.id)),(0,N.jsx)("button",{type:"button",className:"bre-link-button bre-headers-add",disabled:O,onClick:Y,children:n("headersAdd")}),!1,(0,N.jsx)("datalist",{id:i,children:Tf.map(H=>(0,N.jsx)("option",{value:H},H))}),(0,N.jsx)("p",{className:"bre-effort-note bre-headers-legacy",hidden:!0,children:n("headersUserAgentHint")}),A?(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)("p",{className:"bre-effort-note",children:n("pendingSave")}),(0,N.jsx)("p",{className:"bre-effort-note",children:n("pendingHint")})]}):null,(0,N.jsxs)("div",{className:"bre-effort-actions",children:[(0,N.jsx)("button",{type:"button",className:"bre-secondary-button",disabled:y,onClick:B,children:n("headersCancel")}),A?null:(0,N.jsx)("button",{type:"button",className:"bre-primary-button",disabled:O,onClick:()=>{ee(sa(d))},children:n("headersSave")})]})]}):(0,N.jsxs)("div",{className:"bre-headers-rows",children:[ae.length===0?(0,N.jsx)("p",{className:"bre-effort-note",children:n("headersEmpty")}):ae.map(([H,q])=>(0,N.jsxs)("div",{className:"bre-headers-row",children:[(0,N.jsx)("span",{className:"bre-headers-name",children:H}),(0,N.jsx)("span",{className:"bre-headers-value bre-headers-masked",children:"\u2022".repeat(Math.min(q.length,24))})]},H)),w?null:(0,N.jsx)("div",{className:"bre-effort-actions",children:(0,N.jsx)("button",{type:"button",className:"bre-secondary-button",disabled:O,onClick:()=>{l(!0),h(void 0)},children:n("headersEdit")})})]})]}):null,R===void 0?null:(0,N.jsx)("p",{className:"bre-effort-message bre-"+R.kind,role:R.kind==="error"?"alert":"status",children:R.text})]})}var Qr=require("react");var Lf={provider:"editorTabProvider",models:"editorTabModels",advanced:"editorTabAdvanced"};function Vn({host:e,t}){return(0,Qr.createElement)("div",{className:Ys,role:"tablist","aria-label":t("editorTabsLabel")},...Vs.map(n=>(0,Qr.createElement)("button",{key:n,type:"button",role:"tab",className:Js,[Xs]:n,onClick:r=>{r.preventDefault(),r.stopPropagation();let o=Kt(e.current);o!==null&&ta(o,n)}},t(Lf[n]))))}var Mf=15e3;function da(){return{intents:new Map,baseline:new Map,flushing:!1}}function Zr(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 eo(e,t){e.intents.delete(t)}function la(e,t){let n=e.intents.get(t);n!==void 0&&(n.releasedAt=Date.now())}function ua(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 fa(e,t){return t.length>0&&!e.baseline.has(t)}async function ca(e,t){if(e.flushing)return aa(e);if(e.intents.size===0)return 0;e.flushing=!0;try{let n=await re(t),r,o=async s=>Ye(n.namespace,s)?!0:(r??(r=await re(t,{fresh:!0})),Ye(r.namespace,s)),i=Date.now();for(let[s,a]of Array.from(e.intents)){if(a.declaredBefore===void 0){a.releasedAt!==void 0&&a.noted!==!0&&(a.noted=!0,console.warn("[bre] deferred request headers: nobody said whether this id existed before, so the draft is held:",s));continue}if(a.declaredBefore){e.intents.delete(s);continue}if(!await o(s)){a.releasedAt!==void 0&&i-a.releasedAt>Mf?(e.intents.delete(s),console.info("[bre] deferred request headers: gave up on a draft whose card closed first:",s)):a.releasedAt!==void 0&&console.info("[bre] deferred request headers: waiting for the closed card to declare",s);continue}console.info("[bre] deferred request headers: the route is declared, writing the held draft:",s);let d;try{d=await At(t,s,a.headers)}catch(u){d={ok:!1,error:u instanceof Error?u.message:String(u)}}if(d.ok){e.intents.delete(s),console.info("[bre] deferred request headers: saved",s,Object.keys(a.headers).length,"header(s)");continue}d.error!=="no-route"&&(e.intents.delete(s),console.error("[bre] deferred request headers: the write was refused:",d.error,s))}}catch(n){console.error("[bre] deferred request headers: could not read the settings document:",n)}finally{e.flushing=!1}return aa(e)}function aa(e){let t=0;for(let n of e.intents.values())n.releasedAt!==void 0&&(t+=1);return t}var tt=require("react/jsx-runtime");function ga({host:e,api:t,t:n,routeIdLabels:r,staged:o}){let[i,s]=(0,fe.useState)(()=>ma(e.current,r)),a=(0,fe.useRef)(i),d=(0,fe.useRef)(void 0),u=(0,fe.useRef)(new Set),g=(0,fe.useRef)(!1),m=(0,fe.useRef)(null);return m.current===null&&(m.current={onDraft:p=>{d.current=p;let l=a.current;if(l.length===0){!g.current&&Object.keys(p).length>0&&(g.current=!0,console.info("[bre] deferred request headers: holding a draft until the provider id is typed"));return}Zr(o,l,p),pa(t,o,l,u.current)},onCancel:()=>{d.current=void 0,eo(o,a.current)}}),(0,fe.useEffect)(()=>{let p=ha(e.current);if(p===null)return;let l=()=>{s(ma(e.current,r))};return p.addEventListener("input",l,!0),()=>{p.removeEventListener("input",l,!0)}},[e,r]),(0,fe.useEffect)(()=>{i.length>0&&pa(t,o,i,u.current)},[t,o,i]),(0,fe.useEffect)(()=>{let p=a.current;if(p===i)return;eo(o,p),a.current=i;let l=d.current;l!==void 0&&i.length>0&&Zr(o,i,l)},[i,o]),(0,fe.useEffect)(()=>()=>{la(o,a.current)},[o]),(0,tt.jsxs)(tt.Fragment,{children:[(0,tt.jsx)(Vn,{host:e,t:n}),(0,tt.jsx)($n,{route:i,api:t,t:n,deferred:m.current})]})}function pa(e,t,n,r){!fa(t,n)||r.has(n)||(r.add(n),(async()=>{try{let o=await re(e);ua(t,n,Ye(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 ha(e){let t=e?.parentElement;return t==null?null:t.parentElement?.closest('[class*="addCard"]')??t}function ma(e,t){let n=e?.parentElement;if(n==null)return"";let r=t(),o=ue(n,r).trim();if(o.length>0)return o;let i=ha(e);return i===null||i===n?"":ue(i,r).trim()}var no="bre-create-host",to="bre-add-mode-picker",Sf='[class*="addCard"]',Af='[class*="addPanel"]',Rf='[class*="addModes"]',Hf="-custom-panel",Of="-custom";function wa(){return{hosts:new Map}}function ro(e,t,n){if(!e.isConnected)return;let r=new Set;for(let o of Array.from(e.querySelectorAll(Sf)))if(o.isConnected)try{_f(o,t,n),r.add(o)}catch(i){Yn(o,n),va(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)&&Yn(o,n)}function _f(e,t,n){let r=Nf(e,Hf);if(r===void 0){ba(e);return}if(r.hidden){ba(e);return}Cf(e,r,t,n),va(e,!0)}function va(e,t){let n=xa(e);n!==void 0&&ve(n,to,t)}function Nf(e,t){for(let n of Array.from(e.querySelectorAll(Af)))if(n.id.endsWith(t))return n}function xa(e){let t=e.querySelector(Rf);if(t!==null){for(let n of Array.from(t.children))if(n instanceof HTMLElement&&n.getAttribute("role")==="tablist")return n}}function ba(e){let t=xa(e);if(t!==void 0){for(let n of Array.from(t.querySelectorAll('[role="tab"]')))if(n.id.endsWith(Of)){if(n.disabled)return;n.getAttribute("aria-selected")!=="true"&&n.click();return}}}function Df(e){for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.classList.contains(no))return t}function Cf(e,t,n,r){let o=r.hosts.get(e),i=Df(t);if(i!==void 0&&o!==void 0&&o.host===i)return;Yn(e,r),i!==void 0&&i.remove();let s=e.ownerDocument.createElement("div");s.className=no,t.insertBefore(s,t.firstChild);let a=$e(s,n.refreshed(()=>(0,ya.createElement)(ga,{host:{current:s},api:n.api,t:n.t,routeIdLabels:n.routeIdLabels,staged:n.staged})),{sync:!0});r.hosts.set(e,{host:s,mount:a})}function Yn(e,t){let n=t.hosts.get(e);n!==void 0&&(t.hosts.delete(e),Ne(n.mount))}function ka(e){for(let t of Array.from(e.hosts.keys()))Yn(t,e);for(let t of Array.from(document.querySelectorAll(`.${no}`)))t.remove();for(let t of Array.from(document.querySelectorAll(`.${to}`)))ve(t,to,!1)}var Bt="data-bre-row-provider",Ea="{provider}",If=["rowCard","setupCard"];function Ta(){return En()}function Ie(e){for(let t of If)for(let n of Array.from(e.querySelectorAll(`[class*="${t}"]`))){let r=n.parentElement;if(!(r===null||r.tagName!=="UL")&&de(r).length!==0)return r}}function Wt(e){return e.querySelector('[class*="rowHead"]')??void 0}function bt(e){let t=e.querySelector('[class*="rowName"]')?.textContent?.trim();return t!==void 0&&t.length>0?t:void 0}function Pf(e){let t=e.indexOf(Ea);if(!(t<0))return{prefix:e.slice(0,t),suffix:e.slice(t+Ea.length)}}function Ff(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 qf='[class*="rowCard"], [class*="setupCard"], [class*="addCard"]';function Kf(e){let t=e.closest(qf);for(let n=e;n!==null&&n!==t;n=n.parentElement)if(n.matches('[data-plugin], [class*="bre-"]'))return!0;return!1}function Pe(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=Pf(r);if(o!==void 0)for(let i of Array.from(e.querySelectorAll("button[aria-label]"))){if(Kf(i))continue;let s=i.getAttribute("aria-label")??"";if(s.length<=o.prefix.length+o.suffix.length||!s.startsWith(o.prefix)||!s.endsWith(o.suffix))continue;let a=Ff(s.slice(o.prefix.length,s.length-o.suffix.length));if(a!==void 0)return a}}}function oo(e){let t=e.getAttribute(Bt);return t===null||t.length===0?void 0:t}function Bf(e){return Ot(e,oo)}function La(e,t,n){if(!e.isConnected)return;let r=Ie(e);if(r===void 0)return;let o=t.labels();for(let i of de(r)){let s=Pe(i,o);if(s===void 0){i.removeAttribute(Bt);continue}oo(i)!==s&&i.setAttribute(Bt,s)}Sn(e,r,Wf(t),n)}function Wf(e){return{rowOf:t=>{let n=t.closest("li");return n instanceof HTMLElement?n:void 0},idOf:oo,labelOf:bt,order:t=>Fo(t),commit:t=>{Io(Bf(t))},seatOf:Wt,seatDrags:!0,gripLabel:(t,n)=>e.t("providerReorderAria",{provider:bt(t)??n}),gripHint:()=>e.t("providerReorderHint")}}function Ma(e){An(e);let t=Array.from(document.querySelectorAll(`[${Bt}]`));Ln(t);for(let n of t)n.removeAttribute(Bt)}var yt="data-bre-provider-switch",Jn="bre-row-disabled";function Aa(){return{switches:new WeakSet}}function Ra(e,t,n){if(!e.isConnected)return;let r=Ie(e);if(r===void 0)return;let o=t.labels();for(let i of Array.from(r.children)){if(!(i instanceof HTMLElement))continue;let s=Pe(i,o);if(s===void 0)continue;let a=Wt(i);a!==void 0&&(Uf(i,a,s,t,n),i.classList.toggle(Jn,!at(s)))}}function Ha(){for(let e of Array.from(document.querySelectorAll(`[${yt}]`)))e.remove();for(let e of Array.from(document.querySelectorAll(`.${Jn}`)))e.classList.remove(Jn)}function Uf(e,t,n,r,o){let i=t.querySelector(`[${yt}]`);if(i!==null){Sa(i,e,n,r);return}let s=document.createElement("button");s.className="bre-provider-switch",s.setAttribute("type","button"),s.setAttribute("role","switch"),s.setAttribute(yt,n),Sa(s,e,n,r),jf(s,e,o);let a=t.querySelector('[class*="rowActions"]');a===null?t.appendChild(s):a.insertBefore(s,a.firstChild)}function Sa(e,t,n,r){let o=r.t("providerToggleAria",{provider:bt(t)??n}),i=r.t("providerToggleHint"),s=at(n)?"true":"false";e.getAttribute(yt)!==n&&e.setAttribute(yt,n),e.getAttribute("aria-checked")!==s&&e.setAttribute("aria-checked",s),e.getAttribute("aria-label")!==o&&e.setAttribute("aria-label",o),e.getAttribute("title")!==i&&e.setAttribute("title",i)}function jf(e,t,n){n.switches.has(e)||(n.switches.add(e),e.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation();let o=e.getAttribute(yt);if(o===null)return;let i=!at(o);Bo(o,i),e.setAttribute("aria-checked",i?"true":"false"),t.classList.toggle(Jn,!i)}))}var Xn="data-bre-provider-delete",Oa='[class*="rowActions"]',_a='[class*="dangerButton"]',Gf="bre-provider-delete";function Na(e,t){if(!e.isConnected)return;let n=Ie(e);if(n===void 0)return;let r=t.labels(),o=zf(n)??t.t("providerRemoveDisabled");for(let i of Array.from(n.children)){if(!(i instanceof HTMLElement))continue;let s=Pe(i,r);if(s===void 0)continue;let a=Wt(i);if(a===void 0)continue;let d=a.querySelector(Oa);if(d===null)continue;let u=d.querySelector(`[${Xn}]`);if(d.querySelector(_a)!==null){u!==null&&u.remove();continue}let g=u??$f();d.lastElementChild!==g&&d.appendChild(g),Vf(g,s,o,t.t("providerRemoveLocked",{provider:bt(i)??s}))}}function Da(){for(let e of Array.from(document.querySelectorAll(`[${Xn}]`)))e.remove()}function zf(e){let n=e.querySelector(`${Oa} ${_a}`)?.textContent?.trim()??"";return n.length>0?n:void 0}function $f(){let e=document.createElement("button");return e.className=Gf,e.setAttribute("type","button"),e.setAttribute("disabled",""),e}function Vf(e,t,n,r){e.getAttribute(Xn)!==t&&e.setAttribute(Xn,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 Qn="data-bre-provider-disabled-group",Yf="bre-provider-disabled-seat",Ca="bre-provider-disabled-group",io="bre-row-folded",so="bre-row-hidden";function Ia(){return{expanded:!1}}function Pa(e,t,n){if(!e.isConnected)return;let r=Ie(e);if(r===void 0)return;let o=qa(r,t.labels()),i=o.filter(u=>!u.enabled).length,s=Ka(r);if(i===0){s!==void 0&&s.remove(),ao(o,n);return}let a=s??Jf(r,t,n);(a.parentElement!==r||r.lastElementChild!==a)&&r.append(a),ao(o,n);let d=Ba(a);d!==void 0&&Wa(d,i,t,n)}function Fa(){for(let e of Array.from(document.querySelectorAll(`[${Qn}]`)))e.remove();for(let e of Array.from(document.querySelectorAll(`.${so}, .${io}`)))e.classList.remove(so,io)}function qa(e,t){let n=[];for(let r of Array.from(e.children)){if(!(r instanceof HTMLElement)||r.getAttribute(Qn)!==null)continue;let o=Pe(r,t);o!==void 0&&n.push({row:r,id:o,enabled:at(o)})}return n}function ao(e,t){for(let n of e){let r=!n.enabled;n.row.classList.toggle(io,r),n.row.classList.toggle(so,r&&!t.expanded)}}function Ka(e){for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.getAttribute(Qn)!==null)return t}function Ba(e){return e.querySelector(`button.${Ca}`)??void 0}function Jf(e,t,n){let r=document.createElement("li");r.className=Yf,r.setAttribute(Qn,"");let o=document.createElement("button");return o.className=Ca,o.setAttribute("type","button"),o.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),n.expanded=!n.expanded,Xf(e,t,n)}),r.appendChild(o),e.append(r),r}function Xf(e,t,n){let r=qa(e,t.labels());ao(r,n);let o=Ka(e);if(o===void 0)return;let i=r.filter(a=>!a.enabled).length;if(i===0){o.remove();return}let s=Ba(o);s!==void 0&&Wa(s,i,t,n)}function Wa(e,t,n,r){let o=n.t(r.expanded?"providerDisabledGroupHide":"providerDisabledGroupShow",{count:t}),i=n.t("providerDisabledGroupHint"),s=r.expanded?"true":"false";e.textContent!==o&&(e.textContent=o),e.getAttribute("aria-expanded")!==s&&e.setAttribute("aria-expanded",s),e.getAttribute("aria-label")!==o&&e.setAttribute("aria-label",o),e.getAttribute("title")!==i&&e.setAttribute("title",i)}var Qf='p[class*="savedNotice"]',Ga="data-bre-saved-hidden",Zf="bre-auto-effort-note",ec="data-bre-auto-effort-phase",Ua="bre-auto-effort-note-text",wt=new Map,ja=new WeakMap,vt=null,Zn=null;function za(e){let t=Array.from(e.querySelectorAll(Qf));for(let n of t){let r=n.textContent?.trim()??"";ja.get(n)!==r&&(ja.set(n,r),r.length>0&&tc(r)),!wt.has(n)&&(wt.set(n,n.style.display),n.setAttribute(Ga,""),n.style.display="none")}for(let[n,r]of Array.from(wt))n.isConnected&&t.includes(n)||(Va(n,r),wt.delete(n))}function $a(){for(let[e,t]of Array.from(wt))Va(e,t);wt.clear(),lo()}function Va(e,t){e.style.display=t,e.removeAttribute(Ga)}function tc(e){if(vt!==null&&vt.isConnected&&vt.textContent===e)return;lo();let t=document.createElement("div");t.className=Zf,t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute(ec,"done"),t.innerHTML=`<span class="${Ua}"></span>`;let n=t.querySelector(`.${Ua}`);n!==null&&(n.textContent=e),t.style.setProperty("--bre-note-hold","3000ms"),document.body.append(t),vt=t,Zn=setTimeout(()=>{lo()},3e3)}function lo(){Zn!==null&&(clearTimeout(Zn),Zn=null),vt?.remove(),vt=null}var Ut="data-bre-row-model",uo="bre-model-grid";function Ja(){return En()}function nc(e){let t=[];for(let n of Array.from(e.querySelectorAll('[class*="modelList"]')))de(n).filter(o=>o.matches('[class*="modelEntry"]')).length!==0&&t.push(n);return t}function Xa(e){for(let t of e){if(t.type!=="childList")continue;let n=t.target;if(n instanceof HTMLElement&&n.matches('[class*="modelList"]')&&de(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 er(e){let t=e.getAttribute(Ut);return t===null||t.length===0?void 0:t}function fo(e,t){let n=e.closest("li");if(n!==null)return Pe(n,t.labels())}function Ya(e,t){let n=ue(e,t.labels().modelName);return n.length>0?n:er(e)}function rc(e,t){return{rowOf:n=>{let r=n.closest('[class*="modelEntry"]');return r instanceof HTMLElement?r:void 0},idOf:er,labelOf:n=>Ya(n,t),order:n=>{let r=fo(e,t);return r===void 0?n:Jo(r,n)},commit:n=>{let r=fo(n,t);r!==void 0&&Vo(r,Ot(n,er))},seatOf:n=>n.querySelector('[class*="modelRow"]')??void 0,seatDrags:!1,gripLabel:(n,r)=>t.t("modelReorderAria",{model:Ya(n,t)??r}),gripHint:()=>t.t("modelReorderHint"),decorate:(n,r)=>{r.classList.add(uo)}}}function Qa(e,t,n){if(!e.isConnected)return;let r=t.labels();for(let o of nc(e))if(fo(o,t)!==void 0){for(let i of de(o)){let s=ue(i,r.modelId);if(s.length===0){i.removeAttribute(Ut);continue}er(i)!==s&&i.setAttribute(Ut,s)}Sn(e,o,rc(o,t),n)}}function Za(e){An(e);for(let n of Array.from(document.querySelectorAll(`.${uo}`)))n.classList.remove(uo);let t=Array.from(document.querySelectorAll(`[${Ut}]`));Ln(t);for(let n of t)n.removeAttribute(Ut)}var oc="settings.models",Re={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"]};function td(e){let{ctx:t,api:n,t:r,onIdle:o,refreshed:i}=e,s=()=>{let O=t.locale.bind(oc),K=([U,...te])=>{let H=O(U);return H===U||H.trim()===""?te:[H,...te]};return{capacity:K(Re.capacity),modelId:K(Re.modelId),modelName:K(Re.modelName),routeId:K(Re.routeId),baseUrl:K(Re.baseUrl),apiProtocol:K(Re.apiProtocol),apply:K(Re.apply),cancel:K(Re.cancel),editProvider:K(Re.editProvider),inputImage:K(Re.inputImage)}},a=120,d=1e3,u=gs(),g=Ta(),m={t:r,labels:s},p=Aa(),l={t:r,labels:s},c={t:r,labels:s},f=Ia(),y={t:r,labels:s},v=Ja(),w={t:r,labels:s},k=Zs(),R={t:r},h=wa(),T=da(),E={t:r,api:n,routeIdLabels:()=>s().routeId,staged:T,refreshed:i},L,P,_,F,A=!1,I={api:n,describeNamespace:()=>re(n),t:r,labels:s,onIdle:o,onBackoff:O=>{Q(O)},onPendingChanged:()=>{z()},mount(O,K){let U=document.createElement("div");U.className="bre-effort-slot",U.dataset.plugin=ne,O.appendChild(U);let te=(0,ed.createRoot)(U),H=q=>{te.render((0,co.createElement)(_e,{fallbackText:r("renderFailed"),children:i(()=>(0,co.createElement)(wn,q))}))};return H(K),{unmount:()=>{te.unmount()},render:H}}};function Q(O){A||P!==void 0||(P=window.setTimeout(()=>{P=void 0,z()},O))}let Y=()=>{let O=Me();Ie(O)!==void 0&&(La(O,m,g),Ra(O,l,p),Na(O,c),Pa(O,y,f),Qa(O,w,v),za(O))};function z(){A||L!==void 0||(L=window.setTimeout(()=>{L=void 0,F?.(),As(Me(),I,u),ro(Me(),E,h),Xr(Me(),R,k),Y(),ca(T,n).then(O=>{O>0&&Q(d)})},a))}let oe=O=>{A||_!==void 0||(F=O,O(),Y(),Ts(),_=new MutationObserver(K=>{O(),ro(Me(),E,h),Xr(Me(),R,k),Y(),Xa(K)&&Ms(Me()),z()}),_.observe(document.body,{childList:!0,subtree:!0}),z())},B=()=>{A=!0,L!==void 0&&(window.clearTimeout(L),L=void 0),P!==void 0&&(window.clearTimeout(P),P=void 0),_?.disconnect(),_=void 0};return{state:u,labels:s,start:oe,stopObserver:B,teardown:()=>{B(),ps(u,I);for(let[,O]of u.mounted)O.editor.unmount();u.mounted.clear(),Ma(g),Ha(),Da(),Fa(),Ki(),$a(),Za(v),ka(h),na(),Ls()},flushOnUnload:()=>{ms(u,I)},schedule:z}}function ic(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,s]of Object.entries(n?.byId??{}))if(!(s===void 0||(s.retainedBy?.mainView??0)<=0))return typeof s.id=="string"&&s.id.length>0?s.id:i}function nd(e){let t,n=new Map,r=(s,a)=>{for(let[d,u]of n){if(d===a)continue;let g;try{g=s.directoryFor(u.sessionId)===d}catch{g=!1}g||(u.restore(),n.delete(d))}};return{ensure:()=>{let s=e.ctx,a=s.get?.("sessions"),d=s.get?.("uiSession"),u=s.get?.("modelDirectories"),g=ic(a,d);if(!(g===void 0||u===void 0))try{let m=u.directoryFor(g);return r(u,m),t!==void 0&&t.sessionId===g&&t.directory===m||(n.has(m)||n.set(m,{sessionId:g,restore:di(m,{configuredEffort:e.configuredEffort})}),t={sessionId:g,directory:m}),m}catch{t=void 0;return}},dispose:()=>{for(let[,s]of n)s.restore();n.clear()}}}var sc="conversation.input.model";function rd(e){return e.querySelector("[data-composer-card]")??void 0}function po(e){return e.querySelector(`[data-slot="${sc}"]`)??void 0}function od(e){let t=po(e)??e;return Array.from(t.querySelectorAll('button[aria-haspopup="menu"]'))}function id(e,t){let n=e.getAttribute("aria-controls");if(n===null||n.length===0)return;let r=t.getElementById(n);if(r!==null)return r.getAttribute("role")==="menu"?r:void 0}function mo(e=document){let t=rd(e);if(t===void 0)return;for(let r of od(t)){let o=id(r,e);if(o!==void 0)return o}let n=po(t)??t;for(let r of Array.from(n.querySelectorAll('[role="menu"]')))if(r.previousElementSibling?.matches('button[aria-haspopup="menu"]'))return r}function go(e=document){let t=rd(e);if(t===void 0)return;let n=po(t),r=od(t),o=r[0];if(o!==void 0){for(let i of r)if(id(i,e)!==void 0)return i;for(let i of r)if(i.nextElementSibling?.matches('[role="menu"]'))return i;return n===void 0?r.at(-1):o}}function sd(){return mo()}function ad(){return go()}var He=require("react");var dd="settings.models.provider-card";function ac(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 dc({provider:e,api:t,t:n}){let r=(0,He.useRef)(null),o=(0,He.useCallback)(()=>{ac(Kt(r.current))},[]);(0,He.useEffect)(()=>{let s=r.current,a=Kt(s);if(s===null||a===null)return;let d=a,u=()=>a.querySelector('[class*="_editor"]')!==null,g=()=>{let p=u()?"1":"0";s.dataset.edit!==p&&(s.dataset.edit=p)};g();let m=new MutationObserver(g);return m.observe(d,{childList:!0,subtree:!0}),()=>{m.disconnect()}},[]);let i=e?.provider;return typeof i!="string"||i.length===0?null:(0,He.createElement)("div",{ref:r,className:"bre-headers-host","data-bre-provider":i},(0,He.createElement)(Vn,{host:r,t:n}),(0,He.createElement)($n,{route:i,api:t,t:n,onDismiss:o}))}function ld(e,t,n){let r=e,o=r.slots?.inject(dd,()=>{r.slots?.register({name:dd,key:le,inject:()=>({api:t,t:n})},dc)});return typeof o=="function"?o:()=>{}}var he=require("react");function ud(e){let{t}=e,n=(0,he.useSyncExternalStore)(Xt,ye),r=()=>{Oo(!n)};return(0,he.createElement)("div",{className:"bre-slider-setting"},(0,he.createElement)("div",{className:"bre-slider-setting-row"},(0,he.createElement)("div",{className:"bre-slider-setting-copy"},(0,he.createElement)("div",{className:"bre-slider-setting-title"},t("sliderToggleTitle")),(0,he.createElement)("div",{className:"bre-slider-setting-description"},t("sliderToggleDescription"))),(0,he.createElement)("div",{className:"bre-slider-setting-control"},(0,he.createElement)("span",{className:"bre-slider-setting-state"},t(n?"settingOn":"settingOff")),(0,he.createElement)("button",{type:"button",role:"switch","aria-label":t("sliderToggleAria"),"aria-checked":n,className:"bre-slider-setting-switch"+(n?" is-on":""),onClick:r},(0,he.createElement)("span",{className:"bre-slider-setting-switch-knob","aria-hidden":!0})))))}function fd(e,t){let n=e,r=n.slots?.inject("settings.models.footer",()=>{n.slots?.register({name:"settings.models.footer",id:ne+"-slider-toggle",order:15,inject:()=>({t})},ud)});return typeof r=="function"?r:()=>{}}var lc=ne,uc=["slots","locale","connection","remote","remote.settings"];function fc(e){e.effect(()=>e.locale.register(or,{zh:Ro,en:Ao}),"dsh-model-think-level: dictionaries");let t=document.createElement("style");t.dataset.plugin=ne,t.dataset.pluginStyles=ne,t.textContent=Qo,document.head.appendChild(t),e.effect(()=>()=>t.remove(),"dsh-model-think-level: stylesheet");let n=(()=>{try{let l=e.get?.("configForms");try{let f=l?.get?.(le);if(f!==void 0)return f}catch{}return e.get?.("settingsScope")?.bind?.({namespace:le})}catch{return}})(),r=n===void 0?{settings:e.remote.settings}:{settings:e.remote.settings,scope:n},o=e.locale.bind(or),i=()=>{let l=e.locale;return typeof l.subscribe=="function"&&typeof l.getSnapshot=="function"?l:void 0},s=l=>{let c=i();return c===void 0?l():(0,cd.createElement)(So,{locale:c,children:l})},a=Li({api:r}),d=nd({ctx:e,configuredEffort:a.of}),u=xi({menuOf:sd,triggerOf:ad,t:o,refreshed:s,sliderEnabled:ye,directory:d.ensure}),g=Si({api:r}),m=td({ctx:e,api:r,t:o,onIdle:g.run,refreshed:s}),p=()=>{d.ensure(),u.reconcile()};e.effect(()=>(m.start(p),()=>{m.teardown(),u.dispose(),d.dispose()}),"dsh-model-think-level: DOM injector"),e.effect(()=>{let l=()=>{m.flushOnUnload()};return window.addEventListener("pagehide",l),()=>{window.removeEventListener("pagehide",l)}},"dsh-model-think-level: ledger flush on unload"),e.effect(()=>{let l=()=>{m.state.describePromise=void 0,a.invalidate(),m.schedule()},c=[e.remote.$on("settings/document-updated",f=>{f===le&&l()}),e.on("connection/reset",l)];return()=>{for(let f of c)f()}},"dsh-model-think-level: pushed invalidations"),e.effect(()=>{let l=w=>{w.key===Jt?_o(w.newValue!=="false"):w.key===Qt?Po(it(w.newValue)):w.key===en?Wo(qo(w.newValue)):w.key===nn&&Yo(pr(w.newValue))};window.addEventListener("storage",l);let c=Xt(()=>{m.schedule()}),f=Zt(()=>{m.schedule()}),y=tn(()=>{m.schedule()}),v=rn(()=>{m.schedule()});return()=>{window.removeEventListener("storage",l),c(),f(),y(),v()}},"dsh-model-think-level: client preferences"),e.effect(()=>fd(e,o),"dsh-model-think-level: footer slot activation"),e.effect(()=>ld(e,r,o),"dsh-model-think-level: provider-card slot activation")}
2172
2217
 
2173
2218
  return module.exports;
2174
2219
  }