dsh-model-think-level 2.0.2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +49 -23
- package/lib/balance.d.ts +44 -0
- package/lib/client/ComposerSlider.d.ts +19 -0
- package/lib/client/ConfigPane.d.ts +47 -0
- package/lib/client/EffortEditor.d.ts +34 -16
- package/lib/client/KeyManager.d.ts +2 -2
- package/lib/client/balance-client.d.ts +34 -0
- package/lib/client/capacity.d.ts +20 -4
- package/lib/client/configured-inputs.d.ts +11 -2
- package/lib/client/events.d.ts +31 -2
- package/lib/client/fingerprint-runner.d.ts +13 -1
- package/lib/client/image-config-client.d.ts +75 -0
- package/lib/client/injection/autofill-run.d.ts +2 -2
- package/lib/client/injection/config-button-seat.d.ts +96 -0
- package/lib/client/injection/create-key-seat.d.ts +3 -3
- package/lib/client/injection/create-keys-pane.d.ts +4 -2
- package/lib/client/injection/editor-tab-bar.d.ts +1 -1
- package/lib/client/injection/editor-tabs.d.ts +1 -1
- package/lib/client/injection/image-card.d.ts +85 -0
- package/lib/client/injection/imagegen-completion.d.ts +43 -0
- package/lib/client/injection/imagegen-entry.d.ts +22 -0
- package/lib/client/injection/key-prefetch.d.ts +44 -0
- package/lib/client/injection/key-reveal.d.ts +2 -3
- package/lib/client/injection/models-page-editor.d.ts +59 -28
- package/lib/client/injection/models-page.d.ts +15 -3
- package/lib/client/injection/provider-balance.d.ts +83 -0
- package/lib/client/injection/provider-endpoints.d.ts +2 -2
- package/lib/client/injection/row-drag.d.ts +7 -0
- package/lib/client/injection/staged-keys.d.ts +24 -12
- package/lib/client/key-manager-client.d.ts +70 -18
- package/lib/client/locales.d.ts +65 -15
- package/lib/client/ops.d.ts +12 -2
- package/lib/client/styles.d.ts +1 -1
- package/lib/client/types.d.ts +21 -3
- package/lib/client.js +721 -78
- package/lib/client.js.map +4 -4
- package/lib/constants.d.ts +58 -0
- package/lib/detection.d.ts +7 -0
- package/lib/fingerprint/estimate.d.ts +16 -0
- package/lib/fingerprint/run.d.ts +24 -0
- package/lib/fingerprint/store.d.ts +2 -2
- package/lib/fingerprint/verdict.d.ts +53 -3
- package/lib/headers-core.d.ts +3 -1
- package/lib/headers-fetch.d.ts +25 -0
- package/lib/image/command.d.ts +84 -0
- package/lib/image/config.d.ts +150 -0
- package/lib/image/generate.d.ts +135 -0
- package/lib/image/legacy-cleanup.d.ts +29 -0
- package/lib/image/sizes.d.ts +28 -0
- package/lib/image/tool.d.ts +107 -0
- package/lib/index.js +3876 -1745
- package/lib/index.js.map +4 -4
- package/lib/key-index.d.ts +37 -7
- package/lib/key-probe.d.ts +39 -99
- package/lib/key-refs.d.ts +43 -19
- package/lib/key-route-core.d.ts +100 -32
- package/lib/key-serves.d.ts +81 -0
- package/lib/knowledge.d.ts +21 -0
- package/lib/listing.d.ts +18 -20
- package/lib/multi-key-listing.d.ts +3 -3
- package/package.json +1 -8
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 nr=Object.defineProperty;var vu=Object.getOwnPropertyDescriptor;var xu=Object.getOwnPropertyNames;var ku=Object.prototype.hasOwnProperty;var Eu=(e,t,n)=>t in e?nr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Tu=(e,t)=>{for(var n in t)nr(e,n,{get:t[n],enumerable:!0})},Mu=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of xu(t))!ku.call(e,o)&&o!==n&&nr(e,o,{get:()=>t[o],enumerable:!(r=vu(t,o))||r.enumerable});return e};var Su=e=>Mu(nr({},"__esModule",{value:!0}),e);var Fe=(e,t,n)=>Eu(e,typeof t!="symbol"?t+"":t,n);var ig={};Tu(ig,{EffortEditor:()=>Ar,REFRESH_MIN_INTERVAL_MS:()=>wu,apply:()=>og,baselineModelsOf:()=>as,compatOf:()=>wr,createEditorApi:()=>kr,defaultEffortOf:()=>xr,describeNamespace:()=>ne,effortsOf:()=>br,findModelMenu:()=>oi,findModelTrigger:()=>ii,inject:()=>rg,inputOf:()=>yr,invalidateProbeCache:()=>Xo,name:()=>ng,nameOf:()=>vr,providerHeadersOf:()=>Jo,providersOf:()=>ke,routeIsDeclared:()=>He,userProvidersOf:()=>gr,writeModelRows:()=>gn,writeProviderHeaders:()=>bn});module.exports=Su(ig);var yu=require("react");function ya(e,t){let n=!1,r=0,o=!1,i;return{schedule:()=>{if(o||n)return;n=!0;let a=Math.max(0,t-(Date.now()-r));i=setTimeout(()=>{i=void 0,n=!1,r=Date.now(),o||e()},a)},dispose:()=>{o=!0,i!==void 0&&clearTimeout(i),i=void 0,n=!1}}}var pe="dsh-model-think-level",wa="/dsh-model-think-level/raw-models";var rr="/dsh-model-think-level/provider-key",va="/dsh-model-think-level/key-index",xa="/dsh-model-think-level/autofill-config",ka="/dsh-model-think-level/headers-config",Ro="/dsh-model-think-level/fingerprint",xe="llm-pi-ai",Ae="reasoningEffortsUnset",rt="inputUnset",_t="reasoningEffortsAutofilled",Ft="defaultEffort",Ho=pe;var fn=require("react");function Ea(e){let{locale:t}=e,n=(0,fn.useCallback)(o=>t.subscribe(o),[t]),r=(0,fn.useCallback)(()=>t.getSnapshot().revision??0,[t]);return(0,fn.useSyncExternalStore)(n,r),e.children()}var Ta={reasoningEffort:"Reasoning effort",thinkingMode:"Thinking",thinkingModeOff:"Off \u2014 this model is declared as not reasoning.",levelsLabel:"Declared levels",levelsHint:"Click to declare; clear every level to declare nothing \u2014 requests follow the provider default.",stateDeclared:"{count} declared \xB7 default {default}",stateUndeclared:"Nothing declared \u2014 requests follow the provider default.",modalityText:"Text",autoAdapt:"Auto-adapt",autoAdaptAll:"Auto-detect thinking levels",autoAdaptWorking:"Detecting\u2026",autoAdaptDone:"Adapted {count} \xB7 save to write",autoAdaptEmpty:"All already configured",autoAdaptUnsuggested:"No suggestion available",autoAdaptBlocked:"No models to adapt yet",autoAdaptFailed:"Detection failed: {message}",autoAdaptDoneHint:"Held for {count} model(s): they land when this card is saved.",autoAdaptEmptyHint:"Every model of this provider already declares its thinking levels.",autoAdaptUnsuggestedHint:"The models that still need a declaration have no knowledge-base match \u2014 adapt them one by one.",autoAdaptBlockedHint:"Nothing to adapt yet: the card has no models, is not saved, or the settings document is read-only.",apply:"Apply",reset:"Reset",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",contextWindowLabel:"Context window",maxTokensLabel:"Max output",capacityBlank:"Catalogue value",capacityUnitsHint:"Digits or K/M shorthand, e.g. 1,048,576 or 1M.",capacityRule:"Max output above the window is refused upstream; this check is local only.",tokensUnit:"tokens",inputModality:"Input modalities",modalityImage:"Image",modalityInherit:"Not declared \u2014 the provider default applies (usually text-only).",modalityDeclared:"Declared \u2014 clearing Image goes back to text only.",capacityInherit:"Empty keeps the catalogue value.",clearDeclaration:"Clear declaration",confidence_high:"high",confidence_medium:"medium",confidence_low:"low \u2014 verify before relying on it",noSuggestion:"No suggestion is available for this model.",writeError:"Failed: {message}",renderFailed:"Reasoning-effort editor failed to render",wirePlaceholder:"Wire value",wireValue:"value",wireShow:"Edit wire values",wireHide:"Hide wire values",wireHint:"Empty keeps the level's conventional spelling; a non-empty off value is what gets sent when thinking is closed.",reasoningDisabled:"No reasoning-effort control declared for this model (false) \u2014 do not arm thinking levels.",bareHint:"Clearing every level removes the declaration \u2014 requests go out bare (provider default), which some relays require.",defaultRiskDisabled:"No off level: Default and provider tests send thinking: disabled, which this model rejects (e.g. 1210).",defaultRiskQwen:"No off level: Default sends enable_thinking: false \u2014 only fails where the upstream requires thinking on.",stagedHint:"Not saved yet. Staged settings are applied automatically once the model is saved.",level_off:"off",level_minimal:"minimal",level_low:"low",level_medium:"medium",level_high:"high",level_xhigh:"xhigh",level_max:"max",sliderToggleTitle:"Model and reasoning-effort rows",sliderToggleDescription:"Show the model row and the reasoning-level chips in the model menu; the levels follow the current model.",sliderToggleAria:"Enable the model and reasoning-effort rows",settingOn:"On",settingOff:"Off",sliderNoLevels:"The current model exposes no reasoning-effort levels.",triggerFallback:"Select model",effortDefault:"Default",modelRowLabel:"Model",effortRowLabel:"Reasoning level",tagVision:"Image input",tagThinking:"Sends thinking levels",sliderNoCurrent:"No model selected.",sliderCommitSlow:"The switch is taking too long \u2014 try again.",defaultEffortLabel:"Default effort",defaultEffortUnset:"Follow memory",defaultEffortHint:"The level new sessions start at; a level you pick by hand always wins. Empty follows memory.",followMemory:"Follow memory",clearDefaultEffort:"Clear pick",modelSearchPlaceholder:"Search models\u2026",modelSearchNoMatches:"No matching models",modelSearchClear:"Clear search",modelSearchFailed:"Model search failed to render",editorTabsLabel:"Editor sections",editorTabProvider:"Provider",editorTabModels:"Models",editorTabAdvanced:"Advanced",editorTabFingerprint:"Fingerprint",fpTitle:"Model fingerprint",fpIntro:"Only GPT and Claude models can be probed \u2014 the fingerprint library covers those two families, and models outside it never appear here.",fpCount:"{count} probeable",fpSummary:"Identified {identified} \xB7 doubtful {doubtful} \xB7 failed {failed}",fpSummaryNone:"Nothing checked yet.",fpRunning:"Checking \xB7 {done} / {total} (keeps going if you leave)",fpDetectAll:"Check all",fpDetect:"Check",fpRetest:"Re-check",fpRetry:"Retry",fpCost:"{count} prompts \xB7 about {seconds}s",fpForget:"Forget",fpStateUnchecked:"Not checked",fpStateRunning:"Checking \xB7 {done}/{total}",fpStateIdentified:"{model} \xB7 {probability}",fpStateDoubtful:"Doubtful \xB7 {probability}",fpStateFailed:"Check failed",fpQueued:"Queued \xB7 #{position}",fpEvidence:"{used} / {total} prompts \xB7 similarity {similarity}",fpFamily:"Family",fpCandidates:"Closest candidates",fpClosedSet:"Closed-set result: a model outside the library is still attributed to the nearest listed one. Read it as a comparison, not a certificate.",fpCheckedAt:"Checked {time}",fpLoadFailed:"Could not read the stored verdicts: {error}",fpRunFailed:"Check failed: {error}",keyRevealShow:"Show key",keyRevealHide:"Hide key",keyRevealFailed:"Stored key unavailable",keysLoading:"Loading keys\u2026",keysAdd:"Add another key",keysAddConfirm:"Add",keysEnable:"Enable {name}",keysDisable:"Disable {name}",keysMissing:"Not stored",keysEdit:"Edit",keysRemove:"Delete",keysConfirmRemove:"Confirm delete",keysCancel:"Cancel",keysSave:"Save",keysAlias:"Label",keysAliasPlaceholder:"Name (optional), e.g. Team",keysValue:"Key",keysValuePlaceholder:"Paste the API key",keysNewValuePlaceholder:"Paste the new API key",keysAddIllegal:"A key is printable ASCII without spaces.",keysAdded:"Key stored.",keysRenamed:"Label saved.",keysReplaced:"Key replaced.",keysRemoved:"Key removed.",keysScope:"Models served by {name}",keysModels:"Models",keysScopeAll:"All models",keysScopeNone:"No models found",keysScopeCount:"{count} models",keysScopeSaved:"Model scope saved.",keysScopeHint:"Only the ticked models use this key; the rest go to the provider's other keys.",keysScopeEmpty:"This provider has no models yet. Add models first, then pick them here.",keysMergedOffer:"{count} more models are served by your keys but not added to this provider: {models}.",keysMergedApply:"Add them",keysMergedApplied:"Models added to the provider.",keysProtocolLabel:"Protocol for {name}",keysProtocolCreate:"Protocol",keysProtocolCreateHint:"The wire this key signs with; the addresses the provider has configured decide which families are offered.",keysProtocolDefault:"Auto (per model)",keysProtocolDefaultHint:"Picks each model\u2019s own wire: claude models use the Anthropic address, gemini models the Gemini one, the rest the provider\u2019s protocol (where that address is configured).",keysProtocolAnthropic:"Anthropic",keysProtocolAnthropicHint:"Anthropic API \xB7 Claude models",keysProtocolOpenAI:"Chat Completions",keysProtocolOpenAIHint:"OpenAI API \xB7 GPT models, most agents",keysProtocolResponses:"Responses",keysProtocolResponsesHint:"OpenAI API \xB7 Codex",keysProtocolGemini:"Gemini",keysProtocolGeminiHint:"Google Gemini API \xB7 gemini / gemma models",keysProtocolShortChat:"Chat",keysProtocolShortResponses:"Responses",keysProtocolShortAnthropic:"Anthropic",keysProtocolSaved:"Protocol saved.",keysEndpointOpenAI:"OpenAI",keysEndpointAnthropic:"Anthropic",keysEndpointGemini:"Gemini",keysMoreEndpoints:"More endpoints",keysEndpointsCount:"{count} more",keysEndpointInvalid:"The address must start with http:// or https://",keysUnreachable:"The plugin\u2019s key route did not answer.",keysPanelFailed:"Key manager failed to render",keysDraftHint:"Held by this page and stored when the provider is created \u2014 a reload discards them, exactly like the card\u2019s own fields.",keysLastEnabledOff:"The last enabled key cannot be switched off.",headersTitle:"Request headers",headersHint:"Sent on every request of this route.",headersEmpty:"No extra request headers are configured.",headersAdd:"Add header",headersName:"Name",headersNamePlaceholder:"e.g. x-company",headersValue:"Value",headersEdit:"Edit",headersSave:"Save",headersCancel:"Cancel",headersClear:"Clear all",headersRemove:"Remove header",headersSaved:"Saved.",headersCleared:"Cleared \u2014 this route sends no extra request headers.",headersReadOnly:"The settings document is not writable.",headersConflictOrigin:"Routes sharing one endpoint declare different request-header values: when the model in a request body does not identify exactly one of them, that request falls back to the first route.",headersConflictPatched:"The installed dsh-llm-pi-ai already carries a request-header patch: enter values in the headers above and this plugin need not take the request layer over.",headersConflictSiblings:"A plugin rewriting the same layer is installed: {names}. Only one user-agent rewrite should be active at a time, or the last writer on the wire wins.",headersError:"Save failed: {error}",headersNoRoute:"This route is no longer in the settings document \u2014 save the official card once first.",providerReorderAria:"Reorder {provider}",providerReorderHint:"Drag to set the provider order \u2014 the model switcher follows it.",providerToggleAria:"Enable {provider}",providerToggleHint:"A disabled provider is not listed by the model switcher.",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."},Ma={reasoningEffort:"\u601D\u8003\u5F3A\u5EA6",thinkingMode:"\u601D\u8003",thinkingModeOff:"\u5DF2\u5173\u95ED\u2014\u2014\u8BE5\u6A21\u578B\u58F0\u660E\u4E3A\u4E0D\u601D\u8003\u3002",levelsLabel:"\u652F\u6301\u6863\u4F4D",levelsHint:"\u70B9\u9009\u5373\u58F0\u660E\uFF1B\u5168\u90E8\u53D6\u6D88\u5219\u4E0D\u58F0\u660E\uFF0C\u8BF7\u6C42\u6309\u4F9B\u5E94\u5546\u9ED8\u8BA4\u53D1\u9001\u3002",stateDeclared:"\u5DF2\u58F0\u660E {count} \u6863 \xB7 \u9ED8\u8BA4 {default}",stateUndeclared:"\u672A\u58F0\u660E\u2014\u2014\u8BF7\u6C42\u6309\u4F9B\u5E94\u5546\u9ED8\u8BA4\u53D1\u9001\u3002",modalityText:"\u6587\u672C",autoAdapt:"\u81EA\u52A8\u9002\u914D",autoAdaptAll:"\u81EA\u52A8\u83B7\u53D6\u601D\u8003\u7B49\u7EA7",autoAdaptWorking:"\u83B7\u53D6\u4E2D\u2026",autoAdaptDone:"\u5DF2\u9002\u914D {count} \u4E2A\xB7\u4FDD\u5B58\u540E\u5199\u5165",autoAdaptEmpty:"\u5DF2\u5168\u90E8\u914D\u7F6E",autoAdaptUnsuggested:"\u6CA1\u6709\u53EF\u7528\u5EFA\u8BAE",autoAdaptBlocked:"\u6682\u65E0\u53EF\u9002\u914D\u6A21\u578B",autoAdaptFailed:"\u83B7\u53D6\u5931\u8D25\uFF1A{message}",autoAdaptDoneHint:"\u5DF2\u6682\u5B58 {count} \u4E2A\u6A21\u578B\u7684\u9002\u914D\u7ED3\u679C\uFF1A\u70B9\u8BE5\u5361\u7247\u7684\u300C\u4FDD\u5B58\u300D\u540E\u5199\u5165\u3002",autoAdaptEmptyHint:"\u8BE5\u4F9B\u5E94\u5546\u4E0B\u6240\u6709\u6A21\u578B\u90FD\u5DF2\u58F0\u660E\u601D\u8003\u7B49\u7EA7\u3002",autoAdaptUnsuggestedHint:"\u4ECD\u9700\u58F0\u660E\u7684\u6A21\u578B\u6CA1\u6709\u77E5\u8BC6\u5E93\u5339\u914D\u2014\u2014\u8BF7\u9010\u4E2A\u6253\u5F00\u6A21\u578B\u884C\u624B\u52A8\u9002\u914D\u3002",autoAdaptBlockedHint:"\u6682\u65E0\u53EF\u9002\u914D\u5185\u5BB9\uFF1A\u8BE5\u5361\u7247\u8FD8\u6CA1\u6709\u6A21\u578B\u3001\u5C1A\u672A\u4FDD\u5B58\uFF0C\u6216\u5F53\u524D\u8BBE\u7F6E\u6587\u6863\u4E0D\u53EF\u5199\u5165\u3002",apply:"\u5E94\u7528",reset:"\u653E\u5F03\u4FEE\u6539",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",contextWindowLabel:"\u4E0A\u4E0B\u6587\u7A97\u53E3",maxTokensLabel:"\u6700\u5927\u8F93\u51FA",capacityBlank:"\u6CBF\u7528\u76EE\u5F55\u503C",capacityUnitsHint:"\u53EF\u586B\u6570\u5B57\u6216 K/M \u7B80\u5199\uFF0C\u4F8B\u5982 1,048,576 \u6216 1M\u3002",capacityRule:"\u6700\u5927\u8F93\u51FA\u8D85\u8FC7\u7A97\u53E3\u4F1A\u88AB\u4E0A\u6E38\u62D2\u7EDD\uFF0C\u8FD9\u91CC\u53EA\u505A\u672C\u5730\u6821\u9A8C\u3002",tokensUnit:"tokens",inputModality:"\u8F93\u5165\u6A21\u6001",modalityImage:"\u56FE\u7247",modalityInherit:"\u672A\u58F0\u660E\u2014\u2014\u7EE7\u627F\u63D0\u4F9B\u65B9\u9ED8\u8BA4\uFF08\u901A\u5E38\u4EC5\u6587\u672C\uFF09\u3002",modalityDeclared:"\u5DF2\u58F0\u660E\u2014\u2014\u53D6\u6D88\u300C\u56FE\u7247\u300D\u5373\u56DE\u5230\u4EC5\u6587\u672C\u3002",capacityInherit:"\u7559\u7A7A\uFF1D\u6CBF\u7528\u6A21\u578B\u76EE\u5F55\u91CC\u7684\u503C\u3002",clearDeclaration:"\u6E05\u9664\u58F0\u660E",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",writeError:"\u5199\u5165\u5931\u8D25\uFF1A{message}",renderFailed:"\u601D\u8003\u5F3A\u5EA6\u7F16\u8F91\u5668\u6E32\u67D3\u5931\u8D25",wirePlaceholder:"\u7EBF\u4E0A\u53D6\u503C",wireValue:"\u53D6\u503C",wireShow:"\u7F16\u8F91\u7EBF\u4E0A\u53D6\u503C",wireHide:"\u6536\u8D77\u7EBF\u4E0A\u53D6\u503C",wireHint:"\u7559\u7A7A\uFF1D\u6CBF\u7528\u8BE5\u6863\u4F4D\u7684\u7EA6\u5B9A\u62FC\u5199\uFF1Boff \u6863\u586B\u4E86\u975E\u7A7A\u503C\uFF0C\u5C31\u4F1A\u5728\u5173\u95ED\u601D\u8003\u65F6\u53D1\u9001\u8FD9\u4E00\u6BB5\u3002",reasoningDisabled:"\u8BE5\u6A21\u578B\u58F0\u660E\u4E3A\u65E0 reasoning-effort \u63A7\u5236\uFF08false\uFF09\u2014\u2014\u8BF7\u52FF\u52FE\u9009\u601D\u8003\u6863\u3002",bareHint:"\u5168\u90E8\u53D6\u6D88\u5E76\u4FDD\u5B58\u5C06\u6E05\u9664\u58F0\u660E\u2014\u2014\u8BF7\u6C42\u4EE5\u88F8\u683C\u5F0F\u53D1\u51FA\uFF08\u8D70\u63D0\u4F9B\u65B9\u9ED8\u8BA4\uFF09\uFF0C\u90E8\u5206\u4E2D\u8F6C\u7AD9\u9700\u8981\u8FD9\u6837\u3002",defaultRiskDisabled:"\u65E0 off \u6863\uFF1ADefault \u4E0E\u63D0\u4F9B\u5546\u6D4B\u8BD5\u4F1A\u53D1\u9001 thinking: disabled\uFF0C\u8BE5\u6A21\u578B\u4F1A\u62A5\u9519\uFF08\u5982 1210\uFF09\u3002",defaultRiskQwen:"\u65E0 off \u6863\uFF1ADefault \u4F1A\u53D1\u9001 enable_thinking: false\u2014\u2014\u4EC5\u5728\u4E0A\u6E38\u8981\u6C42\u5F00\u542F\u601D\u8003\u65F6\u624D\u4F1A\u5931\u8D25\u3002",stagedHint:"\u5C1A\u672A\u4FDD\u5B58\u3002\u6682\u5B58\u7684\u914D\u7F6E\u5C06\u5728\u8BE5\u6A21\u578B\u4FDD\u5B58\u540E\u81EA\u52A8\u5E94\u7528\u3002",level_off:"off",level_minimal:"minimal",level_low:"low",level_medium:"medium",level_high:"high",level_xhigh:"xhigh",level_max:"max",sliderToggleTitle:"\u6A21\u578B\u4E0E\u601D\u8003\u7B49\u7EA7\u884C",sliderToggleDescription:"\u5728\u6A21\u578B\u83DC\u5355\u4E2D\u663E\u793A\u6A21\u578B\u884C\u4E0E\u601D\u8003\u7B49\u7EA7\u6807\u7B7E\uFF0C\u6863\u4F4D\u968F\u5F53\u524D\u6A21\u578B\u81EA\u52A8\u9002\u914D",sliderToggleAria:"\u542F\u7528\u6A21\u578B\u4E0E\u601D\u8003\u7B49\u7EA7\u884C",settingOn:"\u542F\u7528",settingOff:"\u505C\u7528",sliderNoLevels:"\u5F53\u524D\u6A21\u578B\u672A\u63D0\u4F9B\u601D\u8003\u5F3A\u5EA6\u6863\u4F4D",triggerFallback:"\u9009\u62E9\u6A21\u578B",effortDefault:"\u9ED8\u8BA4",modelRowLabel:"\u6A21\u578B",effortRowLabel:"\u601D\u8003\u7B49\u7EA7",tagVision:"\u652F\u6301\u56FE\u7247\u8F93\u5165",tagThinking:"\u652F\u6301\u601D\u8003\u7B49\u7EA7",sliderNoCurrent:"\u5F53\u524D\u65E0\u9009\u62E9\u4E2D\u7684\u6A21\u578B\u3002",sliderCommitSlow:"\u5207\u6362\u8D85\u65F6\u2014\u2014\u8BF7\u91CD\u8BD5\u3002",defaultEffortLabel:"\u9ED8\u8BA4\u601D\u8003\u5F3A\u5EA6",defaultEffortUnset:"\u8DDF\u968F\u8BB0\u5FC6",defaultEffortHint:"\u65B0\u4F1A\u8BDD\u7684\u8D77\u59CB\u6863\u4F4D\uFF1B\u4F1A\u8BDD\u5185\u624B\u52A8\u9009\u62E9\u59CB\u7EC8\u4F18\u5148\u3002\u7559\u7A7A\u5219\u8DDF\u968F\u8BB0\u5FC6\u94FE\u3002",followMemory:"\u8DDF\u968F\u8BB0\u5FC6",clearDefaultEffort:"\u6E05\u9664\u9009\u62E9",modelSearchPlaceholder:"\u641C\u7D22\u6A21\u578B\u2026",modelSearchNoMatches:"\u672A\u627E\u5230\u5339\u914D\u6A21\u578B",modelSearchClear:"\u6E05\u7A7A\u641C\u7D22",modelSearchFailed:"\u6A21\u578B\u641C\u7D22\u6E32\u67D3\u5931\u8D25",editorTabsLabel:"\u7F16\u8F91\u5668\u5206\u533A",editorTabProvider:"\u4F9B\u5E94\u5546\u914D\u7F6E",editorTabModels:"\u6A21\u578B\u914D\u7F6E",editorTabAdvanced:"\u9AD8\u7EA7\u914D\u7F6E",editorTabFingerprint:"\u6307\u7EB9\u68C0\u6D4B",fpTitle:"\u6A21\u578B\u6307\u7EB9",fpIntro:"\u53EA\u6709 GPT \u4E0E Claude \u7CFB\u5217\u6A21\u578B\u53EF\u68C0\u6D4B\u2014\u2014\u6307\u7EB9\u5E93\u53EA\u8986\u76D6\u8FD9\u4E24\u4E2A\u5BB6\u65CF\uFF0C\u4E0D\u5728\u6B64\u5217\u7684\u6A21\u578B\u4E0D\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\u3002",fpCount:"{count} \u4E2A\u53EF\u68C0\u6D4B",fpSummary:"\u5DF2\u8BC6\u522B {identified} \xB7 \u5B58\u7591 {doubtful} \xB7 \u5931\u8D25 {failed}",fpSummaryNone:"\u5C1A\u672A\u68C0\u6D4B\u3002",fpRunning:"\u6B63\u5728\u68C0\u6D4B \xB7 {done} / {total}\uFF08\u5207\u8D70\u4E5F\u4F1A\u7EE7\u7EED\uFF09",fpDetectAll:"\u68C0\u6D4B\u5168\u90E8",fpDetect:"\u68C0\u6D4B",fpRetest:"\u91CD\u6D4B",fpRetry:"\u91CD\u8BD5",fpCost:"{count} \u9898 \xB7 \u7EA6 {seconds} \u79D2",fpForget:"\u5FD8\u6389",fpStateUnchecked:"\u672A\u68C0\u6D4B",fpStateRunning:"\u68C0\u6D4B\u4E2D \xB7 {done}/{total}",fpStateIdentified:"{model} \xB7 {probability}",fpStateDoubtful:"\u5B58\u7591 \xB7 {probability}",fpStateFailed:"\u68C0\u6D4B\u5931\u8D25",fpQueued:"\u6392\u961F \xB7 \u7B2C {position} \u4E2A",fpEvidence:"{used} / {total} \u9898 \xB7 \u76F8\u4F3C\u5EA6 {similarity}",fpFamily:"\u5BB6\u65CF",fpCandidates:"\u6700\u63A5\u8FD1\u7684\u5019\u9009",fpClosedSet:"\u95ED\u96C6\u7ED3\u8BBA\uFF1A\u4E0D\u5728\u5E93\u91CC\u7684\u6A21\u578B\u4ECD\u4F1A\u88AB\u5F52\u7ED9\u6700\u63A5\u8FD1\u7684\u90A3\u4E2A\u3002\u8BF7\u5F53\u6210\u4E00\u6B21\u6BD4\u5BF9\uFF0C\u4E0D\u662F\u8BC1\u660E\u3002",fpCheckedAt:"\u68C0\u6D4B\u4E8E {time}",fpLoadFailed:"\u8BFB\u4E0D\u5230\u5DF2\u5B58\u7ED3\u8BBA\uFF1A{error}",fpRunFailed:"\u68C0\u6D4B\u5931\u8D25\uFF1A{error}",keyRevealShow:"\u663E\u793A\u5BC6\u94A5",keyRevealHide:"\u9690\u85CF\u5BC6\u94A5",keyRevealFailed:"\u65E0\u6CD5\u8BFB\u53D6\u5DF2\u4FDD\u5B58\u7684\u5BC6\u94A5",keysLoading:"\u6B63\u5728\u8BFB\u53D6\u5BC6\u94A5\u2026",keysAdd:"\u6DFB\u52A0\u53E6\u4E00\u4E2A\u5BC6\u94A5",keysAddConfirm:"\u6DFB\u52A0",keysEnable:"\u542F\u7528 {name}",keysDisable:"\u505C\u7528 {name}",keysMissing:"\u672A\u5B58\u50A8",keysEdit:"\u4FEE\u6539",keysRemove:"\u5220\u9664",keysConfirmRemove:"\u786E\u8BA4\u5220\u9664",keysCancel:"\u53D6\u6D88",keysSave:"\u4FDD\u5B58",keysAlias:"\u522B\u540D",keysAliasPlaceholder:"\u540D\u79F0\uFF08\u53EF\u9009\uFF09\uFF0C\u4F8B\u5982 \u56E2\u961F",keysValue:"\u5BC6\u94A5",keysValuePlaceholder:"\u7C98\u8D34 API \u5BC6\u94A5",keysNewValuePlaceholder:"\u7C98\u8D34\u65B0\u7684 API \u5BC6\u94A5",keysAddIllegal:"\u5BC6\u94A5\u53EA\u80FD\u662F\u53EF\u6253\u5370 ASCII \u5B57\u7B26\uFF0C\u4E14\u4E0D\u80FD\u5305\u542B\u7A7A\u683C\u3002",keysAdded:"\u5DF2\u4FDD\u5B58\u5BC6\u94A5\u3002",keysRenamed:"\u5DF2\u4FDD\u5B58\u522B\u540D\u3002",keysReplaced:"\u5DF2\u66FF\u6362\u5BC6\u94A5\u3002",keysRemoved:"\u5DF2\u5220\u9664\u5BC6\u94A5\u3002",keysScope:"{name} \u63D0\u4F9B\u670D\u52A1\u7684\u6A21\u578B",keysModels:"\u6A21\u578B",keysScopeAll:"\u5168\u90E8\u6A21\u578B",keysScopeNone:"\u672A\u53D1\u73B0\u6A21\u578B",keysScopeCount:"{count} \u4E2A\u6A21\u578B",keysScopeSaved:"\u5DF2\u4FDD\u5B58\u6A21\u578B\u8303\u56F4\u3002",keysScopeHint:"\u53EA\u6709\u9009\u4E2D\u7684\u6A21\u578B\u4F1A\u7528\u8FD9\u4E2A Key\uFF0C\u5176\u4ED6\u6A21\u578B\u4EA4\u7ED9\u8BE5\u4F9B\u5E94\u5546\u7684\u5176\u4ED6 Key\u3002",keysScopeEmpty:"\u8BE5\u4F9B\u5E94\u5546\u8FD8\u6CA1\u6709\u6A21\u578B\u3002\u8BF7\u5148\u6DFB\u52A0\u6A21\u578B\uFF0C\u518D\u6765\u8FD9\u91CC\u9009\u62E9\u3002",keysMergedOffer:"\u5BC6\u94A5\u8FD8\u63D0\u4F9B\u670D\u52A1\u5546\u5C1A\u672A\u6DFB\u52A0\u7684 {count} \u4E2A\u6A21\u578B\uFF1A{models}\u3002",keysMergedApply:"\u6DFB\u52A0",keysMergedApplied:"\u5DF2\u628A\u6A21\u578B\u6DFB\u52A0\u5230\u8BE5\u4F9B\u5E94\u5546\u3002",keysProtocolLabel:"{name} \u4F7F\u7528\u7684\u534F\u8BAE",keysProtocolCreate:"\u534F\u8BAE",keysProtocolCreateHint:"\u8FD9\u628A\u5BC6\u94A5\u8981\u8D70\u7684\u534F\u8BAE\uFF1B\u53EF\u9009\u54EA\u4E9B\u53D6\u51B3\u4E8E\u4F9B\u5E94\u5546\u5DF2\u914D\u7F6E\u7684\u7AEF\u70B9\u5730\u5740\u3002",keysProtocolDefault:"\u81EA\u52A8\uFF08\u6309\u6A21\u578B\uFF09",keysProtocolDefaultHint:"\u6309\u6A21\u578B\u81EA\u52A8\u9009\u62E9\u534F\u8BAE\uFF1Aclaude \u7CFB\u6A21\u578B\u8D70 Anthropic \u5730\u5740\uFF0Cgemini \u7CFB\u8D70 Gemini \u5730\u5740\uFF0C\u5176\u4F59\u6CBF\u7528\u8BE5\u4F9B\u5E94\u5546\u81EA\u5E26\u7684\u534F\u8BAE\uFF08\u9700\u5DF2\u914D\u7F6E\u5BF9\u5E94\u5730\u5740\uFF09",keysProtocolAnthropic:"Anthropic",keysProtocolAnthropicHint:"Anthropic API \xB7 Claude \u6A21\u578B",keysProtocolOpenAI:"Chat Completions",keysProtocolOpenAIHint:"OpenAI API \xB7 GPT \u6A21\u578B\u3001\u5927\u591A\u6570 agent",keysProtocolResponses:"Responses",keysProtocolResponsesHint:"OpenAI API \xB7 Codex",keysProtocolGemini:"Gemini",keysProtocolGeminiHint:"Google Gemini API \xB7 gemini / gemma \u6A21\u578B",keysProtocolShortChat:"Chat",keysProtocolShortResponses:"Responses",keysProtocolShortAnthropic:"Anthropic",keysProtocolSaved:"\u5DF2\u4FDD\u5B58\u534F\u8BAE\u3002",keysEndpointOpenAI:"OpenAI",keysEndpointAnthropic:"Anthropic",keysEndpointGemini:"Gemini",keysMoreEndpoints:"\u66F4\u591A\u7AEF\u70B9",keysEndpointsCount:"\u53E6\u6709 {count} \u4E2A",keysEndpointInvalid:"\u5730\u5740\u9700\u4EE5 http:// \u6216 https:// \u5F00\u5934",keysUnreachable:"\u63D2\u4EF6\u7684\u5BC6\u94A5\u63A5\u53E3\u6CA1\u6709\u54CD\u5E94\u3002",keysPanelFailed:"\u5BC6\u94A5\u7BA1\u7406\u9762\u677F\u6E32\u67D3\u5931\u8D25",keysDraftHint:"\u5BC6\u94A5\u6682\u5B58\u5728\u672C\u9875\uFF0C\u521B\u5EFA\u4F9B\u5E94\u5546\u540E\u81EA\u52A8\u4FDD\u5B58\uFF1B\u5237\u65B0\u9875\u9762\u4F1A\u4E22\u5F03\uFF0C\u4E0E\u5361\u7247\u81EA\u8EAB\u8868\u5355\u4E00\u81F4\u3002",keysLastEnabledOff:"\u4E0D\u80FD\u505C\u7528\u6700\u540E\u4E00\u628A\u542F\u7528\u4E2D\u7684\u5BC6\u94A5\u3002",headersTitle:"\u8BF7\u6C42\u5934",headersHint:"\u8BE5\u8DEF\u7531\u7684\u6BCF\u4E2A\u8BF7\u6C42\u90FD\u4F1A\u643A\u5E26\u81EA\u5B9A\u4E49\u8BF7\u6C42\u5934\u3002",headersEmpty:"\u5C1A\u672A\u914D\u7F6E\u989D\u5916\u8BF7\u6C42\u5934\u3002",headersAdd:"\u6DFB\u52A0\u8BF7\u6C42\u5934",headersName:"\u540D\u79F0",headersNamePlaceholder:"\u4F8B\u5982 x-company",headersValue:"\u503C",headersEdit:"\u7F16\u8F91",headersSave:"\u4FDD\u5B58",headersCancel:"\u53D6\u6D88",headersClear:"\u5168\u90E8\u6E05\u7A7A",headersRemove:"\u5220\u9664\u8BF7\u6C42\u5934",headersSaved:"\u5DF2\u4FDD\u5B58\u3002",headersCleared:"\u5DF2\u6E05\u7A7A\u2014\u2014\u8BE5\u8DEF\u7531\u4E0D\u518D\u643A\u5E26\u989D\u5916\u8BF7\u6C42\u5934\u3002",headersReadOnly:"\u5F53\u524D\u8BBE\u7F6E\u6587\u6863\u4E0D\u53EF\u5199\u5165\u3002",headersConflictOrigin:"\u540C\u4E00\u4E2A endpoint \u4E0A\u6709\u591A\u4E2A\u8DEF\u7531\u914D\u7F6E\u4E86\u4E0D\u540C\u7684\u8BF7\u6C42\u5934\u503C\uFF1A\u5F53\u8BF7\u6C42\u4F53\u91CC\u7684\u6A21\u578B\u65E0\u6CD5\u552F\u4E00\u5B9A\u4F4D\u5176\u4E2D\u4E00\u4E2A\u8DEF\u7531\u65F6\uFF0C\u8BE5\u8BF7\u6C42\u56DE\u9000\u5230\u7B2C\u4E00\u4E2A\u8DEF\u7531\u7684\u914D\u7F6E\u3002",headersConflictPatched:"\u68C0\u6D4B\u5230\u5B98\u65B9 dsh-llm-pi-ai \u5DF2\u5728\u8BF7\u6C42\u5C42\u5904\u7406\u8BF7\u6C42\u5934\uFF1A\u628A\u503C\u586B\u5728\u4E0A\u65B9\u8BF7\u6C42\u5934\u914D\u7F6E\u4E2D\u5373\u53EF\uFF0C\u65E0\u9700\u91CD\u590D\u63A5\u7BA1\u3002",headersConflictSiblings:"\u68C0\u6D4B\u5230\u4F1A\u6539\u5199\u540C\u4E00\u5C42\u7684\u540C\u7C7B\u63D2\u4EF6\uFF1A{names}\u3002\u540C\u4E00\u65F6\u95F4\u53EA\u5E94\u542F\u7528\u4E00\u79CD\u8BF7\u6C42\u5934\u6539\u5199\uFF0C\u5426\u5219\u7EBF\u4E0A\u751F\u6548\u7684\u662F\u6700\u540E\u5199\u5165\u8005\u3002",headersError:"\u4FDD\u5B58\u5931\u8D25\uFF1A{error}",headersNoRoute:"\u8BE5\u8DEF\u7531\u5DF2\u4E0D\u5728\u8BBE\u7F6E\u6587\u6863\u4E2D\u2014\u2014\u8BF7\u5148\u4FDD\u5B58\u4E00\u6B21\u5B98\u65B9\u5361\u7247\u3002",providerReorderAria:"\u62D6\u52A8\u6392\u5E8F\uFF1A{provider}",providerReorderHint:"\u62D6\u52A8\u8C03\u6574\u4F9B\u5E94\u5546\u987A\u5E8F\u2014\u2014\u6A21\u578B\u5207\u6362\u6309\u6B64\u987A\u5E8F\u663E\u793A\u3002",providerToggleAria:"\u542F\u7528 {provider}",providerToggleHint:"\u7981\u7528\u540E\u8BE5\u4F9B\u5E94\u5546\u4E0D\u5728\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u663E\u793A\u3002",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 or="dsh-model-think-level.slider.enabled",Lu=["dsh-reasoning-effort.enabled","@dsh-external/dsh-reasoning-effort.enabled"],pn=Au();function Au(){try{let e=window.localStorage.getItem(or),t=e===null?Lu.map(n=>window.localStorage.getItem(n)).find(n=>n!==null):null;return(e??t??null)!=="false"}catch{return!0}}var Co=new Set;function Sa(){for(let e of[...Co])e()}function Ke(){return pn}function La(e){if(pn!==e){pn=e;try{window.localStorage.setItem(or,String(e))}catch{}Sa()}}function Aa(e){pn!==e&&(pn=e,Sa())}function ir(e){return Co.add(e),()=>{Co.delete(e)}}var ar="dsh-model-think-level.provider-order",Ra=["deepseek-account","deepseek-official"];function qt(e){if(e===null)return[];try{let t=JSON.parse(e);return Array.isArray(t)?No(t.filter(n=>typeof n=="string")):[]}catch{return[]}}function No(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 Kt=(()=>{try{return qt(window.localStorage.getItem(ar))}catch{return[]}})(),Oo=new Set;function Ha(){for(let e of[...Oo])e()}function Ca(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Po(){return Kt}function Oa(e){let t=No(e);if(!Ca(Kt,t)){Kt=t;try{window.localStorage.setItem(ar,JSON.stringify(Kt))}catch{}Ha()}}function Na(e){let t=No(e);Ca(Kt,t)||(Kt=t,Ha())}function sr(e){return Oo.add(e),()=>{Oo.delete(e)}}function Do(e){let t=n=>{let r=Ra.indexOf(n);return r<0?Ra.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 Wt(e,t){let n=new Map;for(let a of t)n.has(a)||n.set(a,n.size);let r=[],o=[];e.forEach((a,s)=>{n.has(a)&&(r.push(s),o.push(a))}),o.sort((a,s)=>n.get(a)-n.get(s));let i=[...e];return r.forEach((a,s)=>{i[a]=o[s]}),i}function Pa(e){return Wt(Do(e),Po())}function Io(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 dr="dsh-model-think-level.providers.disabled",_o=new Set,ct=Ru();function Ru(){try{return qt(window.localStorage.getItem(dr))}catch{return[]}}function Da(e){return qt(e)}function Ia(){return ct}function Bt(e){return!ct.includes(e)}function _a(e,t){let n=!ct.includes(e);t!==n&&Ka(t?ct.filter(r=>r!==e):[...ct,e],!0)}function Fa(e){Ka(e,!1)}function lr(e){return _o.add(e),()=>{_o.delete(e)}}function Hu(e,t){return e.length!==t.length?!1:e.every(n=>t.includes(n))}function Ka(e,t){if(!Hu(ct,e)){if(ct=[...new Set(e)],t)try{window.localStorage.setItem(dr,JSON.stringify(ct))}catch{}for(let n of[..._o])n()}}var cr="dsh-model-think-level.model-order";function Ko(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=qa(o.filter(a=>typeof a=="string"));i.length>0&&(n[r]=i)}return n}catch{return{}}}function qa(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 vt=(()=>{try{return Ko(window.localStorage.getItem(cr))}catch{return{}}})(),Fo=new Set;function Wa(){for(let e of[...Fo])e()}function Cu(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Ou(){try{window.localStorage.setItem(cr,JSON.stringify(vt))}catch{}}function Ba(){return vt}function Ga(e){return vt[e]??Nu}var Nu=[];function Ua(e,t){if(e.length===0)return;let n=qa(t),r=Ga(e);if(Cu(r,n)&&(n.length>0||!(e in vt)))return;let o={...vt};n.length===0?delete o[e]:o[e]=n,vt=o,Ou(),Wa()}function za(e){vt=e,Wa()}function ur(e){return Fo.add(e),()=>{Fo.delete(e)}}function Pu(e,t){return Wt(e,t)}function ja(e,t){return Wt(t,Ga(e))}function qo(e,t){if(e.length===0||t.length===0)return e;let n=new Map(e.map(r=>[r.id,r]));return Pu(e.map(r=>r.id),t).map(r=>n.get(r))}var $a=`
|
|
7
|
+
"use strict";var Tr=Object.defineProperty;var $f=Object.getOwnPropertyDescriptor;var Vf=Object.getOwnPropertyNames;var Yf=Object.prototype.hasOwnProperty;var Xf=(e,t,n)=>t in e?Tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Jf=(e,t)=>{for(var n in t)Tr(e,n,{get:t[n],enumerable:!0})},Qf=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Vf(t))!Yf.call(e,o)&&o!==n&&Tr(e,o,{get:()=>t[o],enumerable:!(r=$f(t,o))||r.enumerable});return e};var Zf=e=>Qf(Tr({},"__esModule",{value:!0}),e);var Te=(e,t,n)=>Xf(e,typeof t!="symbol"?t+"":t,n);var qy={};Jf(qy,{EffortEditor:()=>Jr,REFRESH_MIN_INTERVAL_MS:()=>Uf,apply:()=>Ky,baselineModelsOf:()=>_s,compatOf:()=>Gr,createEditorApi:()=>Ur,defaultEffortOf:()=>zr,describeNamespace:()=>ie,effortsOf:()=>Kr,findModelMenu:()=>Ci,findModelTrigger:()=>Ni,imageGenOf:()=>zn,inject:()=>By,inputOf:()=>qr,invalidateProbeCache:()=>wi,name:()=>Fy,nameOf:()=>Wr,providerHeadersOf:()=>vi,providersOf:()=>xe,routeIsDeclared:()=>ze,userProvidersOf:()=>Br,writeModelRows:()=>Nt,writeProviderHeaders:()=>Un});module.exports=Zf(qy);var zf=require("react");function Qa(e,t){let n=!1,r=0,o=!1,i;return{schedule:()=>{if(o||n)return;n=!0;let a=Math.max(0,t-(Date.now()-r));i=setTimeout(()=>{i=void 0,n=!1,r=Date.now(),o||e()},a)},dispose:()=>{o=!0,i!==void 0&&clearTimeout(i),i=void 0,n=!1}}}var we="dsh-model-think-level",Za="/dsh-model-think-level/raw-models";var Sr="/dsh-model-think-level/provider-key",Mr="/dsh-model-think-level/key-index",es="/dsh-model-think-level/balance",ts="/dsh-model-think-level/autofill-config",ns="/dsh-model-think-level/headers-config",Zo="/dsh-model-think-level/fingerprint",Ce="llm-pi-ai",Ge="reasoningEffortsUnset",rt="inputUnset",We="inputImageGen",Xt="reasoningEffortsAutofilled",Jt="defaultEffort",Lr="/dsh-model-think-level/image-config",rs="/dsh-model-think-level/image-generate";var ei=we;var Fn=require("react");function os(e){let{locale:t}=e,n=(0,Fn.useCallback)(o=>t.subscribe(o),[t]),r=(0,Fn.useCallback)(()=>t.getSnapshot().revision??0,[t]);return(0,Fn.useSyncExternalStore)(n,r),e.children()}var is={reasoningEffort:"Reasoning effort",thinkingMode:"Thinking",thinkingModeOff:"Off \u2014 this model is declared as not reasoning.",levelsLabel:"Declared levels",levelsHint:"Click to declare; clear every level to declare nothing \u2014 requests follow the provider default.",stateDeclared:"{count} declared \xB7 default {default}",stateUndeclared:"Nothing declared \u2014 requests follow the provider default.",modalityText:"Text",autoAdapt:"Auto-adapt",autoAdaptAll:"Auto-detect thinking levels",autoAdaptWorking:"Detecting\u2026",autoAdaptDone:"Adapted {count} \xB7 save to write",autoAdaptEmpty:"All already configured",autoAdaptUnsuggested:"No suggestion available",autoAdaptBlocked:"No models to adapt yet",autoAdaptFailed:"Detection failed: {message}",autoAdaptDoneHint:"Held for {count} model(s): they land when this card is saved.",autoAdaptEmptyHint:"Every model of this provider already declares its thinking levels.",autoAdaptUnsuggestedHint:"The models that still need a declaration have no knowledge-base match \u2014 adapt them one by one.",autoAdaptBlockedHint:"Nothing to adapt yet: the card has no models, is not saved, or the settings document is read-only.",apply:"Apply",reset:"Reset",referenceTitle:"Reference capacities",contextWindowLabel:"Context window",maxTokensLabel:"Max output",capacityBlank:"Catalogue value",capacityUnitsHint:"Digits or K/M/B/T shorthand, e.g. 1,048,576 or 1M.",capacityRule:"Max output above the window is refused upstream; this check is local only.",tokensUnit:"tokens",inputModality:"Supported modalities",modalityImage:"Image",modalityImageGen:"Image generation",modalityImageGenHint:"Marked as an image generator \u2014 pick it in the composer, type a prompt, and the send goes straight to the images API.",modalityInherit:"Not declared \u2014 the provider default applies (usually text-only).",modalityDeclared:"Declared \u2014 clearing Image goes back to text only.",capacityInherit:"Empty keeps the catalogue value.",clearDeclaration:"Clear declaration",noSuggestion:"No suggestion is available for this model.",writeError:"Failed: {message}",renderFailed:"Reasoning-effort editor failed to render",wirePlaceholder:"Wire value",wireValue:"value",wireShow:"Edit wire values",wireHide:"Hide wire values",wireHint:"Empty keeps the level's conventional spelling; a non-empty off value is what gets sent when thinking is closed.",reasoningDisabled:"No reasoning-effort control declared for this model (false) \u2014 do not arm thinking levels.",bareHint:"Clearing every level removes the declaration \u2014 requests go out bare (provider default), which some relays require.",defaultRiskDisabled:"No off level: Default and provider tests send thinking: disabled, which this model rejects (e.g. 1210).",defaultRiskQwen:"No off level: Default sends enable_thinking: false \u2014 only fails where the upstream requires thinking on.",stagedHint:"Not saved yet. Staged settings are applied automatically once the model is saved.",level_off:"off",level_minimal:"minimal",level_low:"low",level_medium:"medium",level_high:"high",level_xhigh:"xhigh",level_max:"max",sliderToggleTitle:"Model and reasoning-effort rows",sliderToggleDescription:"Show the model row and the reasoning-level chips in the model menu; the levels follow the current model.",sliderToggleAria:"Enable the model and reasoning-effort rows",settingOn:"On",settingOff:"Off",sliderNoLevels:"The current model exposes no reasoning-effort levels.",triggerFallback:"Select model",effortDefault:"Default",modelRowLabel:"Model",effortRowLabel:"Reasoning level",tagVision:"Image input",tagThinking:"Sends thinking levels",tagImageGen:"Image generation model",sliderNoCurrent:"No model selected.",sliderCommitSlow:"The switch is taking too long \u2014 try again.",defaultEffortLabel:"Default effort",defaultEffortUnset:"Follow memory",defaultEffortHint:"The level new sessions start at; a level you pick by hand always wins. Empty follows memory.",followMemory:"Follow memory",clearDefaultEffort:"Clear pick",modelSearchPlaceholder:"Search models\u2026",modelSearchNoMatches:"No matching models",modelSearchClear:"Clear search",modelSearchFailed:"Model search failed to render",editorTabsLabel:"Editor sections",editorTabProvider:"Provider",editorTabModels:"Models",editorTabAdvanced:"Advanced",editorTabFingerprint:"Fingerprint",fpTitle:"Model fingerprint",fpIntro:"Only GPT and Claude models can be probed \u2014 the fingerprint library covers those two families, and models outside it never appear here.",fpCount:"{count} probeable",fpSummary:"Identified {identified} \xB7 doubtful {doubtful} \xB7 failed {failed}",fpSummaryNone:"Nothing checked yet.",fpRunning:"Checking \xB7 {done} / {total} (keeps going if you leave)",fpDetectAll:"Check all",fpDetect:"Check",fpRetest:"Re-check",fpRetry:"Retry",fpCost:"{count} prompts \xB7 about {seconds}s",fpCostMinutes:"{count} prompts \xB7 about {minutes} min",fpCostUnknown:"{count} prompts",fpForget:"Forget",fpStateUnchecked:"Not checked",fpStateRunning:"Checking \xB7 {done}/{total}",fpStateIdentified:"{model} \xB7 {probability}",fpStateDoubtful:"Doubtful \xB7 {probability}",fpStateFailed:"Check failed",fpQueued:"Queued \xB7 #{position}",fpEvidence:"{used} / {total} prompts",fpSimilarity:"Similarity",fpDetailShow:"Show result",fpDetailHide:"Hide result",fpFamily:"Family",fpChallengeCounted:"Q{index} {numbers} \xB7 counted",fpChallengeRejected:"Q{index} {parsed}/{numbers} \xB7 not counted",fpChallengeSkipped:"Q{index} {numbers} \xB7 early stop",fpChallengeTitle:"How each of the three prompts settled. The number is how many integers the prompt asked for; a slash means it asked for the right-hand count and answered only the left. A prompt only counts when it returns at least max(80, 55% of what it asked).",fpCandidates:"Closest candidates",fpClosedSet:"Closed-set result: a model outside the library is still attributed to the nearest listed one. Read it as a comparison, not a certificate.",fpCheckedAt:"Checked {time}",fpTiming:"Timing: first token {first}s \xB7 total {total}s \xB7 ~{rate} chars/s",fpLoadFailed:"Could not read the stored verdicts: {error}",fpRunFailed:"Check failed: {error}",keyRevealShow:"Show key",keyRevealHide:"Hide key",keyRevealFailed:"Stored key unavailable",keysLoading:"Loading keys\u2026",keysAdd:"Add another key",keysAddConfirm:"Add",keysEnable:"Enable {name}",keysDisable:"Disable {name}",keysMissing:"Not stored",keysEdit:"Edit",keysRemove:"Delete",keysConfirmRemove:"Confirm delete",keysCancel:"Cancel",keysSave:"Save",keysAlias:"Label",keysAliasPlaceholder:"Name (optional), e.g. Team",keysValue:"Key",keysValuePlaceholder:"Paste the API key",keysNewValuePlaceholder:"Paste the new API key",keysAddIllegal:"A key is printable ASCII without spaces.",keysAdded:"Key stored.",keysRenamed:"Label saved.",keysReplaced:"Key replaced.",keysRemoved:"Key removed.",keysScope:"Models served by {name}",keysModels:"Models",keysScopeAll:"All models",keysScopeNone:"No models found",keysScopeCount:"{count} models",keysScopeSaved:"Model scope saved.",keysScopeHint:"Only the ticked models use this key; the rest go to the provider's other keys.",keysScopeAutoHint:"This scope was ticked by the post-save probe and is re-checked on every save; saving an edit here claims it by hand.",keysScopeObserved:"Use what this key lists ({count})",keysScopeObservedHint:`This key's own listing carries {count} of this provider's {total} models. Models it does not list go to the other keys \u2014 or fail with a "model not supported in this group" error if no other key carries them either.`,keysScopeEmpty:"This provider has no models yet. Add models first, then pick them here.",keysProtocolLabel:"Protocol for {name}",keysProtocolCreate:"Protocol",keysProtocolCreateHint:"The wire this key signs with; the addresses the provider has configured decide which families are offered.",keysProtocolDefault:"Auto (per model)",keysProtocolDefaultHint:"Picks each model\u2019s own wire: claude models use the Anthropic address, the rest the provider\u2019s protocol (where that address is configured).",keysProtocolAnthropic:"Anthropic",keysProtocolAnthropicHint:"Anthropic API \xB7 Claude models",keysProtocolOpenAI:"Chat Completions",keysProtocolOpenAIHint:"OpenAI API \xB7 GPT models, most agents",keysProtocolResponses:"Responses",keysProtocolResponsesHint:"OpenAI API \xB7 Codex",keysProtocolShortChat:"Chat",keysProtocolShortResponses:"Responses",keysProtocolShortAnthropic:"Anthropic",keysProtocolSaved:"Protocol saved.",keysEndpointOpenAI:"OpenAI",keysEndpointAnthropic:"Anthropic",keysEndpointBalance:"Balance",keysEndpointBalanceHint:"Read-only endpoint queried for this provider\u2019s balance; the first API key is sent along.",keysMoreEndpoints:"More endpoints",keysEndpointsCount:"{count} more",keysEndpointInvalid:"The address must start with http:// or https://",keysUnreachable:"The plugin\u2019s key route did not answer.",keysPanelFailed:"Key manager failed to render",keysDraftHint:"Held by this page and stored when the provider is created \u2014 a reload discards them, exactly like the card\u2019s own fields.",keysLastEnabledOff:"The last enabled key cannot be switched off.",headersTitle:"Request headers",headersHint:"Sent on every request of this route.",headersEmpty:"No extra request headers are configured.",headersAdd:"Add header",headersName:"Name",headersNamePlaceholder:"e.g. x-company",headersValue:"Value",headersEdit:"Edit",headersSave:"Save",headersCancel:"Cancel",headersClear:"Clear all",headersRemove:"Remove header",headersSaved:"Saved.",headersCleared:"Cleared \u2014 this route sends no extra request headers.",headersReadOnly:"The settings document is not writable.",headersConflictOrigin:"Routes sharing one endpoint declare different request-header values: when the model in a request body does not identify exactly one of them, that request falls back to the first route.",headersConflictPatched:"The installed dsh-llm-pi-ai already carries a request-header patch: enter values in the headers above and this plugin need not take the request layer over.",headersConflictSiblings:"A plugin rewriting the same layer is installed: {names}. Only one user-agent rewrite should be active at a time, or the last writer on the wire wins.",headersError:"Save failed: {error}",headersNoRoute:"This route is no longer in the settings document \u2014 save the official card once first.",providerReorderAria:"Reorder {provider}",providerReorderHint:"Drag to set the provider order \u2014 the model switcher follows it.",providerToggleAria:"Enable {provider}",providerToggleHint:"A disabled provider is not listed by the model switcher.",providerBalanceLabel:"Balance",providerBalanceHint:"Fetched from this provider\u2019s balance endpoint.",providerBalanceRefresh:"Refresh balance",providerBalanceUnavailable:"Balance \u2014",providerDisabledGroupShow:"Show {count} switched-off provider(s)",providerDisabledGroupHide:"Hide {count} switched-off provider(s)",providerDisabledGroupHint:"A switched-off provider keeps its configuration and folds away here \u2014 unfold it to switch it back on.",providerRemoveDisabled:"Delete",providerRemoveLocked:"A built-in provider cannot be deleted.",modelReorderAria:"Reorder {model}",modelReorderHint:"Drag to set the order of this provider\u2019s models \u2014 the model switcher follows it.",configButton:"Image service",configButtonHint:"Image-generation service settings",configPaneTitle:"Image service",configPaneClose:"Close",configPaneFailed:"Config pane failed to render",configPaneFoot:"Image-generation models are marked on the Models page: expand a model row \u2192 Input modalities \u2192 Image generation.",imagegenSectionTitle:"Image generation",imagegenSectionSub:"Every configured image-generation model, across providers",imagegenModelCount:"{count} model(s)",imagegenLoading:"Loading\u2026",imagegenLoadFailed:"Could not read the image config",imagegenDefaultsLabel:"Defaults",imagegenDefaultModelLabel:"Default model",imagegenDefaultModelNone:"Not set",imagegenDefaultBadge:"Default",imagegenEndpointOk:"Verified",imagegenEndpointUnverified:"Unverified",imagegenEndpointUnsupported:"Unsupported",imagegenEndpointBadgeHint:"Unverified \u2260 unsupported \u2014 run Test once to learn.",imagegenNoEndpoint:"No compatible endpoint \xB7 generation disabled",imagegenSizeLabel:"Size",imagegenQualityLabel:"Quality",imagegenCountLabel:"Count",imagegenTimeoutLabel:"Timeout",imagegenTimeoutMinutes:"{minutes} min",imagegenTimeoutHint:"The per-request cap; every retry of the parameter fallback chain gets this budget too.",imagegenTestEndpoint:"Test",imagegenProbe:"Try one",imagegenProbeDone:"Saved to {path}",imagegenEmptyText:"No image-generation model is configured yet.",imagegenEmptyHint:"You can mark suspected models below with one click, or do it on the Models page yourself.",imagegenFindSuspects:"Find suspected image models",imagegenNoSuspects:"No suspected image models found.",imagegenMarkSuspects:"Mark {count} suspected model(s)",imagegenMarked:"Marked {count} model(s).",imagegenMarkFailed:"some rows could not be written",imagegenProbeDoneMulti:"Generated {count} image(s): {paths}",imagegenToolTitle:"Built-in image tool",imagegenToolRegistered:"{name} is registered \u2014 chat models can call it directly.",imagegenToolUnregistered:"Not registered \u2014 the host has no tools/attachments service. Restart DSH and reopen this pane.",imagegenToolTest:"Test generate",imagegenToolHint:"The tool ships with the plugin: nothing to install, it registers on boot and works after a reload.",imagegenCardRunning:"Generating image\u2026"},as={reasoningEffort:"\u601D\u8003\u5F3A\u5EA6",thinkingMode:"\u601D\u8003",thinkingModeOff:"\u5DF2\u5173\u95ED\u2014\u2014\u8BE5\u6A21\u578B\u58F0\u660E\u4E3A\u4E0D\u601D\u8003\u3002",levelsLabel:"\u652F\u6301\u6863\u4F4D",levelsHint:"\u70B9\u9009\u5373\u58F0\u660E\uFF1B\u5168\u90E8\u53D6\u6D88\u5219\u4E0D\u58F0\u660E\uFF0C\u8BF7\u6C42\u6309\u4F9B\u5E94\u5546\u9ED8\u8BA4\u53D1\u9001\u3002",stateDeclared:"\u5DF2\u58F0\u660E {count} \u6863 \xB7 \u9ED8\u8BA4 {default}",stateUndeclared:"\u672A\u58F0\u660E\u2014\u2014\u8BF7\u6C42\u6309\u4F9B\u5E94\u5546\u9ED8\u8BA4\u53D1\u9001\u3002",modalityText:"\u6587\u672C",autoAdapt:"\u81EA\u52A8\u9002\u914D",autoAdaptAll:"\u81EA\u52A8\u83B7\u53D6\u601D\u8003\u7B49\u7EA7",autoAdaptWorking:"\u83B7\u53D6\u4E2D\u2026",autoAdaptDone:"\u5DF2\u9002\u914D {count} \u4E2A\xB7\u4FDD\u5B58\u540E\u5199\u5165",autoAdaptEmpty:"\u5DF2\u5168\u90E8\u914D\u7F6E",autoAdaptUnsuggested:"\u6CA1\u6709\u53EF\u7528\u5EFA\u8BAE",autoAdaptBlocked:"\u6682\u65E0\u53EF\u9002\u914D\u6A21\u578B",autoAdaptFailed:"\u83B7\u53D6\u5931\u8D25\uFF1A{message}",autoAdaptDoneHint:"\u5DF2\u6682\u5B58 {count} \u4E2A\u6A21\u578B\u7684\u9002\u914D\u7ED3\u679C\uFF1A\u70B9\u8BE5\u5361\u7247\u7684\u300C\u4FDD\u5B58\u300D\u540E\u5199\u5165\u3002",autoAdaptEmptyHint:"\u8BE5\u4F9B\u5E94\u5546\u4E0B\u6240\u6709\u6A21\u578B\u90FD\u5DF2\u58F0\u660E\u601D\u8003\u7B49\u7EA7\u3002",autoAdaptUnsuggestedHint:"\u4ECD\u9700\u58F0\u660E\u7684\u6A21\u578B\u6CA1\u6709\u77E5\u8BC6\u5E93\u5339\u914D\u2014\u2014\u8BF7\u9010\u4E2A\u6253\u5F00\u6A21\u578B\u884C\u624B\u52A8\u9002\u914D\u3002",autoAdaptBlockedHint:"\u6682\u65E0\u53EF\u9002\u914D\u5185\u5BB9\uFF1A\u8BE5\u5361\u7247\u8FD8\u6CA1\u6709\u6A21\u578B\u3001\u5C1A\u672A\u4FDD\u5B58\uFF0C\u6216\u5F53\u524D\u8BBE\u7F6E\u6587\u6863\u4E0D\u53EF\u5199\u5165\u3002",apply:"\u5E94\u7528",reset:"\u653E\u5F03\u4FEE\u6539",referenceTitle:"\u53C2\u8003\u5BB9\u91CF",contextWindowLabel:"\u4E0A\u4E0B\u6587\u7A97\u53E3",maxTokensLabel:"\u6700\u5927\u8F93\u51FA",capacityBlank:"\u6CBF\u7528\u76EE\u5F55\u503C",capacityUnitsHint:"\u53EF\u586B\u6570\u5B57\u6216 K/M/B/T \u7B80\u5199\uFF0C\u4F8B\u5982 1,048,576 \u6216 1M\u3002",capacityRule:"\u6700\u5927\u8F93\u51FA\u8D85\u8FC7\u7A97\u53E3\u4F1A\u88AB\u4E0A\u6E38\u62D2\u7EDD\uFF0C\u8FD9\u91CC\u53EA\u505A\u672C\u5730\u6821\u9A8C\u3002",tokensUnit:"tokens",inputModality:"\u652F\u6301\u6A21\u6001",modalityImage:"\u56FE\u7247",modalityImageGen:"\u751F\u56FE",modalityImageGenHint:"\u5DF2\u6807\u8BB0\u4E3A\u751F\u56FE\u6A21\u578B\u2014\u2014\u5728\u5BF9\u8BDD\u6846\u9009\u4E2D\u5B83\u540E\u76F4\u63A5\u8F93\u5165\u63D0\u793A\u8BCD\u53D1\u9001\uFF0C\u5373\u8D70\u56FE\u7247\u63A5\u53E3\u751F\u6210\u56FE\u7247\u3002",modalityInherit:"\u672A\u58F0\u660E\u2014\u2014\u7EE7\u627F\u63D0\u4F9B\u65B9\u9ED8\u8BA4\uFF08\u901A\u5E38\u4EC5\u6587\u672C\uFF09\u3002",modalityDeclared:"\u5DF2\u58F0\u660E\u2014\u2014\u53D6\u6D88\u300C\u56FE\u7247\u300D\u5373\u56DE\u5230\u4EC5\u6587\u672C\u3002",capacityInherit:"\u7559\u7A7A\uFF1D\u6CBF\u7528\u6A21\u578B\u76EE\u5F55\u91CC\u7684\u503C\u3002",clearDeclaration:"\u6E05\u9664\u58F0\u660E",noSuggestion:"\u6CA1\u6709\u9002\u7528\u4E8E\u8BE5\u6A21\u578B\u7684\u5EFA\u8BAE\u3002",writeError:"\u5199\u5165\u5931\u8D25\uFF1A{message}",renderFailed:"\u601D\u8003\u5F3A\u5EA6\u7F16\u8F91\u5668\u6E32\u67D3\u5931\u8D25",wirePlaceholder:"\u7EBF\u4E0A\u53D6\u503C",wireValue:"\u53D6\u503C",wireShow:"\u7F16\u8F91\u7EBF\u4E0A\u53D6\u503C",wireHide:"\u6536\u8D77\u7EBF\u4E0A\u53D6\u503C",wireHint:"\u7559\u7A7A\uFF1D\u6CBF\u7528\u8BE5\u6863\u4F4D\u7684\u7EA6\u5B9A\u62FC\u5199\uFF1Boff \u6863\u586B\u4E86\u975E\u7A7A\u503C\uFF0C\u5C31\u4F1A\u5728\u5173\u95ED\u601D\u8003\u65F6\u53D1\u9001\u8FD9\u4E00\u6BB5\u3002",reasoningDisabled:"\u8BE5\u6A21\u578B\u58F0\u660E\u4E3A\u65E0 reasoning-effort \u63A7\u5236\uFF08false\uFF09\u2014\u2014\u8BF7\u52FF\u52FE\u9009\u601D\u8003\u6863\u3002",bareHint:"\u5168\u90E8\u53D6\u6D88\u5E76\u4FDD\u5B58\u5C06\u6E05\u9664\u58F0\u660E\u2014\u2014\u8BF7\u6C42\u4EE5\u88F8\u683C\u5F0F\u53D1\u51FA\uFF08\u8D70\u63D0\u4F9B\u65B9\u9ED8\u8BA4\uFF09\uFF0C\u90E8\u5206\u4E2D\u8F6C\u7AD9\u9700\u8981\u8FD9\u6837\u3002",defaultRiskDisabled:"\u65E0 off \u6863\uFF1ADefault \u4E0E\u63D0\u4F9B\u5546\u6D4B\u8BD5\u4F1A\u53D1\u9001 thinking: disabled\uFF0C\u8BE5\u6A21\u578B\u4F1A\u62A5\u9519\uFF08\u5982 1210\uFF09\u3002",defaultRiskQwen:"\u65E0 off \u6863\uFF1ADefault \u4F1A\u53D1\u9001 enable_thinking: false\u2014\u2014\u4EC5\u5728\u4E0A\u6E38\u8981\u6C42\u5F00\u542F\u601D\u8003\u65F6\u624D\u4F1A\u5931\u8D25\u3002",stagedHint:"\u5C1A\u672A\u4FDD\u5B58\u3002\u6682\u5B58\u7684\u914D\u7F6E\u5C06\u5728\u8BE5\u6A21\u578B\u4FDD\u5B58\u540E\u81EA\u52A8\u5E94\u7528\u3002",level_off:"off",level_minimal:"minimal",level_low:"low",level_medium:"medium",level_high:"high",level_xhigh:"xhigh",level_max:"max",sliderToggleTitle:"\u6A21\u578B\u4E0E\u601D\u8003\u7B49\u7EA7\u884C",sliderToggleDescription:"\u5728\u6A21\u578B\u83DC\u5355\u4E2D\u663E\u793A\u6A21\u578B\u884C\u4E0E\u601D\u8003\u7B49\u7EA7\u6807\u7B7E\uFF0C\u6863\u4F4D\u968F\u5F53\u524D\u6A21\u578B\u81EA\u52A8\u9002\u914D",sliderToggleAria:"\u542F\u7528\u6A21\u578B\u4E0E\u601D\u8003\u7B49\u7EA7\u884C",settingOn:"\u542F\u7528",settingOff:"\u505C\u7528",sliderNoLevels:"\u5F53\u524D\u6A21\u578B\u672A\u63D0\u4F9B\u601D\u8003\u5F3A\u5EA6\u6863\u4F4D",triggerFallback:"\u9009\u62E9\u6A21\u578B",effortDefault:"\u9ED8\u8BA4",modelRowLabel:"\u6A21\u578B",effortRowLabel:"\u601D\u8003\u7B49\u7EA7",tagVision:"\u652F\u6301\u56FE\u7247\u8F93\u5165",tagThinking:"\u652F\u6301\u601D\u8003\u7B49\u7EA7",tagImageGen:"\u751F\u56FE\u6A21\u578B",sliderNoCurrent:"\u5F53\u524D\u65E0\u9009\u62E9\u4E2D\u7684\u6A21\u578B\u3002",sliderCommitSlow:"\u5207\u6362\u8D85\u65F6\u2014\u2014\u8BF7\u91CD\u8BD5\u3002",defaultEffortLabel:"\u9ED8\u8BA4\u601D\u8003\u5F3A\u5EA6",defaultEffortUnset:"\u8DDF\u968F\u8BB0\u5FC6",defaultEffortHint:"\u65B0\u4F1A\u8BDD\u7684\u8D77\u59CB\u6863\u4F4D\uFF1B\u4F1A\u8BDD\u5185\u624B\u52A8\u9009\u62E9\u59CB\u7EC8\u4F18\u5148\u3002\u7559\u7A7A\u5219\u8DDF\u968F\u8BB0\u5FC6\u94FE\u3002",followMemory:"\u8DDF\u968F\u8BB0\u5FC6",clearDefaultEffort:"\u6E05\u9664\u9009\u62E9",modelSearchPlaceholder:"\u641C\u7D22\u6A21\u578B\u2026",modelSearchNoMatches:"\u672A\u627E\u5230\u5339\u914D\u6A21\u578B",modelSearchClear:"\u6E05\u7A7A\u641C\u7D22",modelSearchFailed:"\u6A21\u578B\u641C\u7D22\u6E32\u67D3\u5931\u8D25",editorTabsLabel:"\u7F16\u8F91\u5668\u5206\u533A",editorTabProvider:"\u4F9B\u5E94\u5546\u914D\u7F6E",editorTabModels:"\u6A21\u578B\u914D\u7F6E",editorTabAdvanced:"\u9AD8\u7EA7\u914D\u7F6E",editorTabFingerprint:"\u6307\u7EB9\u68C0\u6D4B",fpTitle:"\u6A21\u578B\u6307\u7EB9",fpIntro:"\u53EA\u6709 GPT \u4E0E Claude \u7CFB\u5217\u6A21\u578B\u53EF\u68C0\u6D4B\u2014\u2014\u6307\u7EB9\u5E93\u53EA\u8986\u76D6\u8FD9\u4E24\u4E2A\u5BB6\u65CF\uFF0C\u4E0D\u5728\u6B64\u5217\u7684\u6A21\u578B\u4E0D\u4F1A\u51FA\u73B0\u5728\u8FD9\u91CC\u3002",fpCount:"{count} \u4E2A\u53EF\u68C0\u6D4B",fpSummary:"\u5DF2\u8BC6\u522B {identified} \xB7 \u5B58\u7591 {doubtful} \xB7 \u5931\u8D25 {failed}",fpSummaryNone:"\u5C1A\u672A\u68C0\u6D4B\u3002",fpRunning:"\u6B63\u5728\u68C0\u6D4B \xB7 {done} / {total}\uFF08\u5207\u8D70\u4E5F\u4F1A\u7EE7\u7EED\uFF09",fpDetectAll:"\u68C0\u6D4B\u5168\u90E8",fpDetect:"\u68C0\u6D4B",fpRetest:"\u91CD\u6D4B",fpRetry:"\u91CD\u8BD5",fpCost:"{count} \u9898 \xB7 \u7EA6 {seconds} \u79D2",fpCostMinutes:"{count} \u9898 \xB7 \u7EA6 {minutes} \u5206\u949F",fpCostUnknown:"{count} \u9898",fpForget:"\u5FD8\u6389",fpStateUnchecked:"\u672A\u68C0\u6D4B",fpStateRunning:"\u68C0\u6D4B\u4E2D \xB7 {done}/{total}",fpStateIdentified:"{model} \xB7 {probability}",fpStateDoubtful:"\u5B58\u7591 \xB7 {probability}",fpStateFailed:"\u68C0\u6D4B\u5931\u8D25",fpQueued:"\u6392\u961F \xB7 \u7B2C {position} \u4E2A",fpEvidence:"{used} / {total} \u9898",fpSimilarity:"\u76F8\u4F3C\u5EA6",fpDetailShow:"\u5C55\u5F00\u7ED3\u679C",fpDetailHide:"\u6536\u8D77\u7ED3\u679C",fpFamily:"\u5BB6\u65CF",fpChallengeCounted:"\u9898{index} {numbers} \u4E2A \xB7 \u8BA1\u5165",fpChallengeRejected:"\u9898{index} {parsed}/{numbers} \xB7 \u672A\u8BA1\u5165",fpChallengeSkipped:"\u9898{index} {numbers} \u4E2A \xB7 \u65E9\u505C",fpChallengeTitle:"\u4E09\u9053\u9898\u5404\u81EA\u7684\u843D\u70B9\u3002\u6570\u5B57\u662F\u8FD9\u9898\u8981\u6C42\u7684\u6574\u6570\u4E2A\u6570\uFF1B\u6709\u659C\u6760\u65F6\uFF0C\u53F3\u8FB9\u662F\u8981\u6C42\u6570\u3001\u5DE6\u8FB9\u662F\u5B9E\u9645\u7B54\u56DE\u7684\u4E2A\u6570\u3002\u7B54\u56DE\u4E0D\u5230 max(80, \u8981\u6C42\u6570\u7684 55%) \u5C31\u4E0D\u8BA1\u5165\u3002",fpCandidates:"\u6700\u63A5\u8FD1\u7684\u5019\u9009",fpClosedSet:"\u95ED\u96C6\u7ED3\u8BBA\uFF1A\u4E0D\u5728\u5E93\u91CC\u7684\u6A21\u578B\u4ECD\u4F1A\u88AB\u5F52\u7ED9\u6700\u63A5\u8FD1\u7684\u90A3\u4E2A\u3002\u8BF7\u5F53\u6210\u4E00\u6B21\u6BD4\u5BF9\uFF0C\u4E0D\u662F\u8BC1\u660E\u3002",fpCheckedAt:"\u68C0\u6D4B\u4E8E {time}",fpTiming:"\u8017\u65F6\uFF1A\u9996\u5B57 {first} \u79D2 \xB7 \u603B\u8BA1 {total} \u79D2 \xB7 \u5410\u5B57\u7EA6 {rate} \u5B57\u7B26/\u79D2",fpLoadFailed:"\u8BFB\u4E0D\u5230\u5DF2\u5B58\u7ED3\u8BBA\uFF1A{error}",fpRunFailed:"\u68C0\u6D4B\u5931\u8D25\uFF1A{error}",keyRevealShow:"\u663E\u793A\u5BC6\u94A5",keyRevealHide:"\u9690\u85CF\u5BC6\u94A5",keyRevealFailed:"\u65E0\u6CD5\u8BFB\u53D6\u5DF2\u4FDD\u5B58\u7684\u5BC6\u94A5",keysLoading:"\u6B63\u5728\u8BFB\u53D6\u5BC6\u94A5\u2026",keysAdd:"\u6DFB\u52A0\u53E6\u4E00\u4E2A\u5BC6\u94A5",keysAddConfirm:"\u6DFB\u52A0",keysEnable:"\u542F\u7528 {name}",keysDisable:"\u505C\u7528 {name}",keysMissing:"\u672A\u5B58\u50A8",keysEdit:"\u4FEE\u6539",keysRemove:"\u5220\u9664",keysConfirmRemove:"\u786E\u8BA4\u5220\u9664",keysCancel:"\u53D6\u6D88",keysSave:"\u4FDD\u5B58",keysAlias:"\u522B\u540D",keysAliasPlaceholder:"\u540D\u79F0\uFF08\u53EF\u9009\uFF09\uFF0C\u4F8B\u5982 \u56E2\u961F",keysValue:"\u5BC6\u94A5",keysValuePlaceholder:"\u7C98\u8D34 API \u5BC6\u94A5",keysNewValuePlaceholder:"\u7C98\u8D34\u65B0\u7684 API \u5BC6\u94A5",keysAddIllegal:"\u5BC6\u94A5\u53EA\u80FD\u662F\u53EF\u6253\u5370 ASCII \u5B57\u7B26\uFF0C\u4E14\u4E0D\u80FD\u5305\u542B\u7A7A\u683C\u3002",keysAdded:"\u5DF2\u4FDD\u5B58\u5BC6\u94A5\u3002",keysRenamed:"\u5DF2\u4FDD\u5B58\u522B\u540D\u3002",keysReplaced:"\u5DF2\u66FF\u6362\u5BC6\u94A5\u3002",keysRemoved:"\u5DF2\u5220\u9664\u5BC6\u94A5\u3002",keysScope:"{name} \u63D0\u4F9B\u670D\u52A1\u7684\u6A21\u578B",keysModels:"\u6A21\u578B",keysScopeAll:"\u5168\u90E8\u6A21\u578B",keysScopeNone:"\u672A\u53D1\u73B0\u6A21\u578B",keysScopeCount:"{count} \u4E2A\u6A21\u578B",keysScopeSaved:"\u5DF2\u4FDD\u5B58\u6A21\u578B\u8303\u56F4\u3002",keysScopeHint:"\u53EA\u6709\u9009\u4E2D\u7684\u6A21\u578B\u4F1A\u7528\u8FD9\u4E2A Key\uFF0C\u5176\u4ED6\u6A21\u578B\u4EA4\u7ED9\u8BE5\u4F9B\u5E94\u5546\u7684\u5176\u4ED6 Key\u3002",keysScopeAutoHint:"\u8FD9\u4E2A\u8303\u56F4\u7531\u4FDD\u5B58\u540E\u7684\u81EA\u52A8\u63A2\u6D4B\u52FE\u9009\uFF0C\u6BCF\u6B21\u4FDD\u5B58\u90FD\u4F1A\u6309\u6700\u65B0\u63A2\u6D4B\u7ED3\u679C\u66F4\u65B0\uFF1B\u624B\u52A8\u4FDD\u5B58\u4E00\u6B21\u4FEE\u6539\u5373\u53EF\u63A5\u7BA1\u3002",keysScopeObserved:"\u6309\u8FD9\u4E2A Key \u7684\u5217\u8868\u9009\u62E9\uFF08{count}\uFF09",keysScopeObservedHint:"\u8FD9\u4E2A Key \u81EA\u5DF1\u7684\u6A21\u578B\u5217\u8868\u53EA\u6709\u8BE5\u4F9B\u5E94\u5546 {total} \u4E2A\u6A21\u578B\u4E2D\u7684 {count} \u4E2A\u3002\u5B83\u4E0D\u5217\u51FA\u7684\u6A21\u578B\u4F1A\u4EA4\u7ED9\u5176\u4ED6 Key\uFF1B\u5982\u679C\u5176\u4ED6 Key \u4E5F\u6CA1\u6709\uFF0C\u5C31\u4F1A\u62A5 \u201C\u6A21\u578B\u4E0D\u5728\u8FD9\u4E2A\u5206\u7EC4\u91CC\u201D \u7684\u9519\u3002",keysScopeEmpty:"\u8BE5\u4F9B\u5E94\u5546\u8FD8\u6CA1\u6709\u6A21\u578B\u3002\u8BF7\u5148\u6DFB\u52A0\u6A21\u578B\uFF0C\u518D\u6765\u8FD9\u91CC\u9009\u62E9\u3002",keysProtocolLabel:"{name} \u4F7F\u7528\u7684\u534F\u8BAE",keysProtocolCreate:"\u534F\u8BAE",keysProtocolCreateHint:"\u8FD9\u628A\u5BC6\u94A5\u8981\u8D70\u7684\u534F\u8BAE\uFF1B\u53EF\u9009\u54EA\u4E9B\u53D6\u51B3\u4E8E\u4F9B\u5E94\u5546\u5DF2\u914D\u7F6E\u7684\u7AEF\u70B9\u5730\u5740\u3002",keysProtocolDefault:"\u81EA\u52A8\uFF08\u6309\u6A21\u578B\uFF09",keysProtocolDefaultHint:"\u6309\u6A21\u578B\u81EA\u52A8\u9009\u62E9\u534F\u8BAE\uFF1Aclaude \u7CFB\u6A21\u578B\u8D70 Anthropic \u5730\u5740\uFF0C\u5176\u4F59\u6CBF\u7528\u8BE5\u4F9B\u5E94\u5546\u81EA\u5E26\u7684\u534F\u8BAE\uFF08\u9700\u5DF2\u914D\u7F6E\u5BF9\u5E94\u5730\u5740\uFF09",keysProtocolAnthropic:"Anthropic",keysProtocolAnthropicHint:"Anthropic API \xB7 Claude \u6A21\u578B",keysProtocolOpenAI:"Chat Completions",keysProtocolOpenAIHint:"OpenAI API \xB7 GPT \u6A21\u578B\u3001\u5927\u591A\u6570 agent",keysProtocolResponses:"Responses",keysProtocolResponsesHint:"OpenAI API \xB7 Codex",keysProtocolShortChat:"Chat",keysProtocolShortResponses:"Responses",keysProtocolShortAnthropic:"Anthropic",keysProtocolSaved:"\u5DF2\u4FDD\u5B58\u534F\u8BAE\u3002",keysEndpointOpenAI:"OpenAI",keysEndpointAnthropic:"Anthropic",keysEndpointBalance:"\u4F59\u989D",keysEndpointBalanceHint:"\u53EA\u8BFB\u63A5\u53E3\uFF1A\u7528\u4E8E\u8BFB\u53D6\u8BE5\u4F9B\u5E94\u5546\u4F59\u989D\uFF0C\u4F1A\u5E26\u4E0A\u5BC6\u94A5\u5217\u8868\u4E2D\u7684\u7B2C\u4E00\u628A\u5BC6\u94A5\u3002",keysMoreEndpoints:"\u66F4\u591A\u7AEF\u70B9",keysEndpointsCount:"\u53E6\u6709 {count} \u4E2A",keysEndpointInvalid:"\u5730\u5740\u9700\u4EE5 http:// \u6216 https:// \u5F00\u5934",keysUnreachable:"\u63D2\u4EF6\u7684\u5BC6\u94A5\u63A5\u53E3\u6CA1\u6709\u54CD\u5E94\u3002",keysPanelFailed:"\u5BC6\u94A5\u7BA1\u7406\u9762\u677F\u6E32\u67D3\u5931\u8D25",keysDraftHint:"\u5BC6\u94A5\u6682\u5B58\u5728\u672C\u9875\uFF0C\u521B\u5EFA\u4F9B\u5E94\u5546\u540E\u81EA\u52A8\u4FDD\u5B58\uFF1B\u5237\u65B0\u9875\u9762\u4F1A\u4E22\u5F03\uFF0C\u4E0E\u5361\u7247\u81EA\u8EAB\u8868\u5355\u4E00\u81F4\u3002",keysLastEnabledOff:"\u4E0D\u80FD\u505C\u7528\u6700\u540E\u4E00\u628A\u542F\u7528\u4E2D\u7684\u5BC6\u94A5\u3002",headersTitle:"\u8BF7\u6C42\u5934",headersHint:"\u8BE5\u8DEF\u7531\u7684\u6BCF\u4E2A\u8BF7\u6C42\u90FD\u4F1A\u643A\u5E26\u81EA\u5B9A\u4E49\u8BF7\u6C42\u5934\u3002",headersEmpty:"\u5C1A\u672A\u914D\u7F6E\u989D\u5916\u8BF7\u6C42\u5934\u3002",headersAdd:"\u6DFB\u52A0\u8BF7\u6C42\u5934",headersName:"\u540D\u79F0",headersNamePlaceholder:"\u4F8B\u5982 x-company",headersValue:"\u503C",headersEdit:"\u7F16\u8F91",headersSave:"\u4FDD\u5B58",headersCancel:"\u53D6\u6D88",headersClear:"\u5168\u90E8\u6E05\u7A7A",headersRemove:"\u5220\u9664\u8BF7\u6C42\u5934",headersSaved:"\u5DF2\u4FDD\u5B58\u3002",headersCleared:"\u5DF2\u6E05\u7A7A\u2014\u2014\u8BE5\u8DEF\u7531\u4E0D\u518D\u643A\u5E26\u989D\u5916\u8BF7\u6C42\u5934\u3002",headersReadOnly:"\u5F53\u524D\u8BBE\u7F6E\u6587\u6863\u4E0D\u53EF\u5199\u5165\u3002",headersConflictOrigin:"\u540C\u4E00\u4E2A endpoint \u4E0A\u6709\u591A\u4E2A\u8DEF\u7531\u914D\u7F6E\u4E86\u4E0D\u540C\u7684\u8BF7\u6C42\u5934\u503C\uFF1A\u5F53\u8BF7\u6C42\u4F53\u91CC\u7684\u6A21\u578B\u65E0\u6CD5\u552F\u4E00\u5B9A\u4F4D\u5176\u4E2D\u4E00\u4E2A\u8DEF\u7531\u65F6\uFF0C\u8BE5\u8BF7\u6C42\u56DE\u9000\u5230\u7B2C\u4E00\u4E2A\u8DEF\u7531\u7684\u914D\u7F6E\u3002",headersConflictPatched:"\u68C0\u6D4B\u5230\u5B98\u65B9 dsh-llm-pi-ai \u5DF2\u5728\u8BF7\u6C42\u5C42\u5904\u7406\u8BF7\u6C42\u5934\uFF1A\u628A\u503C\u586B\u5728\u4E0A\u65B9\u8BF7\u6C42\u5934\u914D\u7F6E\u4E2D\u5373\u53EF\uFF0C\u65E0\u9700\u91CD\u590D\u63A5\u7BA1\u3002",headersConflictSiblings:"\u68C0\u6D4B\u5230\u4F1A\u6539\u5199\u540C\u4E00\u5C42\u7684\u540C\u7C7B\u63D2\u4EF6\uFF1A{names}\u3002\u540C\u4E00\u65F6\u95F4\u53EA\u5E94\u542F\u7528\u4E00\u79CD\u8BF7\u6C42\u5934\u6539\u5199\uFF0C\u5426\u5219\u7EBF\u4E0A\u751F\u6548\u7684\u662F\u6700\u540E\u5199\u5165\u8005\u3002",headersError:"\u4FDD\u5B58\u5931\u8D25\uFF1A{error}",headersNoRoute:"\u8BE5\u8DEF\u7531\u5DF2\u4E0D\u5728\u8BBE\u7F6E\u6587\u6863\u4E2D\u2014\u2014\u8BF7\u5148\u4FDD\u5B58\u4E00\u6B21\u5B98\u65B9\u5361\u7247\u3002",providerReorderAria:"\u62D6\u52A8\u6392\u5E8F\uFF1A{provider}",providerReorderHint:"\u62D6\u52A8\u8C03\u6574\u4F9B\u5E94\u5546\u987A\u5E8F\u2014\u2014\u6A21\u578B\u5207\u6362\u6309\u6B64\u987A\u5E8F\u663E\u793A\u3002",providerToggleAria:"\u542F\u7528 {provider}",providerToggleHint:"\u7981\u7528\u540E\u8BE5\u4F9B\u5E94\u5546\u4E0D\u5728\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u663E\u793A\u3002",providerBalanceLabel:"\u4F59\u989D",providerBalanceHint:"\u6765\u81EA\u8BE5\u4F9B\u5E94\u5546\u914D\u7F6E\u7684\u4F59\u989D\u63A5\u53E3\u3002",providerBalanceRefresh:"\u5237\u65B0\u4F59\u989D",providerBalanceUnavailable:"\u4F59\u989D \u2014",providerDisabledGroupShow:"\u5C55\u5F00 {count} \u4E2A\u5DF2\u7981\u7528\u7684\u4F9B\u5E94\u5546",providerDisabledGroupHide:"\u6536\u8D77 {count} \u4E2A\u5DF2\u7981\u7528\u7684\u4F9B\u5E94\u5546",providerDisabledGroupHint:"\u5DF2\u7981\u7528\u7684\u4F9B\u5E94\u5546\u914D\u7F6E\u4ECD\u5728\uFF0C\u53EA\u662F\u6298\u53E0\u5728\u8FD9\u91CC\u2014\u2014\u5C55\u5F00\u540E\u53EF\u4EE5\u91CD\u65B0\u542F\u7528\u3002",providerRemoveDisabled:"\u5220\u9664",providerRemoveLocked:"\u5185\u7F6E\u4F9B\u5E94\u5546\u4E0D\u53EF\u5220\u9664\u3002",modelReorderAria:"\u62D6\u52A8\u6392\u5E8F\uFF1A{model}",modelReorderHint:"\u62D6\u52A8\u8C03\u6574\u8BE5\u4F9B\u5E94\u5546\u5185\u6A21\u578B\u987A\u5E8F\u2014\u2014\u6A21\u578B\u5207\u6362\u6309\u6B64\u987A\u5E8F\u663E\u793A\u3002",configButton:"\u751F\u56FE\u670D\u52A1",configButtonHint:"\u751F\u56FE\u670D\u52A1\u914D\u7F6E",configPaneTitle:"\u751F\u56FE\u670D\u52A1",configPaneClose:"\u5173\u95ED",configPaneFailed:"\u914D\u7F6E\u9762\u677F\u6E32\u67D3\u5931\u8D25",configPaneFoot:"\u751F\u56FE\u6A21\u578B\u7684\u6807\u8BB0\u5165\u53E3\u5728\u6A21\u578B\u914D\u7F6E\u9875\uFF1A\u5C55\u5F00\u6A21\u578B\u884C \u2192 \u8F93\u5165\u6A21\u6001 \u2192 \u52FE\u9009\u300C\u751F\u56FE\u300D\u3002",imagegenSectionTitle:"\u751F\u56FE",imagegenSectionSub:"\u81EA\u52A8\u83B7\u53D6\u5F53\u524D\u914D\u7F6E\u597D\u7684\u6240\u6709\u751F\u56FE\u6A21\u578B",imagegenModelCount:"{count} \u4E2A\u6A21\u578B",imagegenLoading:"\u6B63\u5728\u8BFB\u53D6\u2026",imagegenLoadFailed:"\u8BFB\u4E0D\u5230\u751F\u56FE\u914D\u7F6E",imagegenDefaultsLabel:"\u9ED8\u8BA4\u53C2\u6570",imagegenDefaultModelLabel:"\u9ED8\u8BA4\u751F\u56FE\u6A21\u578B",imagegenDefaultModelNone:"\u672A\u8BBE\u7F6E",imagegenDefaultBadge:"\u9ED8\u8BA4",imagegenEndpointOk:"\u5DF2\u9A8C\u8BC1",imagegenEndpointUnverified:"\u672A\u9A8C\u8BC1",imagegenEndpointUnsupported:"\u4E0D\u652F\u6301",imagegenEndpointBadgeHint:"\u672A\u9A8C\u8BC1 \u2260 \u4E0D\u652F\u6301\u2014\u2014\u70B9\u4E00\u6B21\u300C\u6D4B\u8BD5\u300D\u5373\u53EF\u786E\u8BA4\u3002",imagegenNoEndpoint:"\u65E0\u517C\u5BB9\u7AEF\u70B9 \xB7 \u751F\u6210\u5DF2\u7981\u7528",imagegenSizeLabel:"\u5C3A\u5BF8",imagegenQualityLabel:"\u8D28\u91CF",imagegenCountLabel:"\u6570\u91CF",imagegenTimeoutLabel:"\u8D85\u65F6",imagegenTimeoutMinutes:"{minutes} \u5206\u949F",imagegenTimeoutHint:"\u5355\u6B21\u8BF7\u6C42\u4E0A\u9650\uFF1B\u53C2\u6570\u56DE\u9000\u7684\u6BCF\u6B21\u91CD\u8BD5\u4E5F\u7528\u5B83\u3002",imagegenTestEndpoint:"\u6D4B\u8BD5",imagegenProbe:"\u8BD5\u4E00\u5F20",imagegenProbeDone:"\u5DF2\u4FDD\u5B58\u5230 {path}",imagegenEmptyText:"\u914D\u7F6E\u9875\u6682\u65E0\u751F\u56FE\u6A21\u578B\u3002",imagegenEmptyHint:"\u53EF\u4EE5\u4E00\u952E\u6807\u8BB0\u4E0B\u65B9\u7591\u4F3C\u751F\u56FE\u6A21\u578B\uFF0C\u6216\u5230\u6A21\u578B\u914D\u7F6E\u9875\u81EA\u884C\u52FE\u9009\u300C\u751F\u56FE\u300D\u3002",imagegenFindSuspects:"\u68C0\u6D4B\u7591\u4F3C\u751F\u56FE\u6A21\u578B",imagegenNoSuspects:"\u6CA1\u6709\u53D1\u73B0\u7591\u4F3C\u751F\u56FE\u6A21\u578B\u3002",imagegenMarkSuspects:"\u4E00\u952E\u6807\u8BB0 {count} \u4E2A\u7591\u4F3C\u6A21\u578B",imagegenMarked:"\u5DF2\u6807\u8BB0 {count} \u4E2A\u6A21\u578B\u3002",imagegenMarkFailed:"\u90E8\u5206\u884C\u5199\u5165\u5931\u8D25",imagegenProbeDoneMulti:"\u5DF2\u751F\u6210 {count} \u5F20\uFF1A{paths}",imagegenToolTitle:"\u5185\u5EFA\u751F\u56FE\u5DE5\u5177",imagegenToolRegistered:"{name} \u5DF2\u6CE8\u518C\u2014\u2014\u5BF9\u8BDD\u6A21\u578B\u53EF\u76F4\u63A5\u8C03\u7528\u3002",imagegenToolUnregistered:"\u672A\u6CE8\u518C\u2014\u2014\u5BBF\u4E3B\u672A\u63D0\u4F9B tools/attachments \u670D\u52A1\u3002\u8BF7\u91CD\u542F DSH \u540E\u91CD\u5F00\u672C\u9875\u3002",imagegenToolTest:"\u751F\u6210\u6D4B\u8BD5",imagegenToolHint:"\u5DE5\u5177\u968F\u63D2\u4EF6\u5185\u5EFA\uFF0C\u65E0\u9700\u5B89\u88C5\uFF1ADSH \u542F\u52A8\u65F6\u81EA\u52A8\u6CE8\u518C\uFF0C\u70ED\u52A0\u8F7D\u540E\u5373\u53EF\u7528\u3002",imagegenCardRunning:"\u6B63\u5728\u751F\u6210\u56FE\u7247\u2026"};var Ar="dsh-model-think-level.slider.enabled",ep=["dsh-reasoning-effort.enabled","@dsh-external/dsh-reasoning-effort.enabled"],Bn=tp();function tp(){try{let e=window.localStorage.getItem(Ar),t=e===null?ep.map(n=>window.localStorage.getItem(n)).find(n=>n!==null):null;return(e??t??null)!=="false"}catch{return!0}}var ti=new Set;function ss(){for(let e of[...ti])e()}function Je(){return Bn}function ds(e){if(Bn!==e){Bn=e;try{window.localStorage.setItem(Ar,String(e))}catch{}ss()}}function ls(e){Bn!==e&&(Bn=e,ss())}function Rr(e){return ti.add(e),()=>{ti.delete(e)}}var Hr="dsh-model-think-level.provider-order",cs=["deepseek-account","deepseek-official"];function Zt(e){if(e===null)return[];try{let t=JSON.parse(e);return Array.isArray(t)?ri(t.filter(n=>typeof n=="string")):[]}catch{return[]}}function ri(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 Qt=(()=>{try{return Zt(window.localStorage.getItem(Hr))}catch{return[]}})(),ni=new Set;function us(){for(let e of[...ni])e()}function fs(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function oi(){return Qt}function ps(e){let t=ri(e);if(!fs(Qt,t)){Qt=t;try{window.localStorage.setItem(Hr,JSON.stringify(Qt))}catch{}us()}}function ms(e){let t=ri(e);fs(Qt,t)||(Qt=t,us())}function Cr(e){return ni.add(e),()=>{ni.delete(e)}}function ii(e){let t=n=>{let r=cs.indexOf(n);return r<0?cs.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 en(e,t){let n=new Map;for(let a of t)n.has(a)||n.set(a,n.size);let r=[],o=[];e.forEach((a,s)=>{n.has(a)&&(r.push(s),o.push(a))}),o.sort((a,s)=>n.get(a)-n.get(s));let i=[...e];return r.forEach((a,s)=>{i[a]=o[s]}),i}function gs(e){return en(ii(e),oi())}function ai(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 Nr="dsh-model-think-level.providers.disabled",si=new Set,yt=np();function np(){try{return Zt(window.localStorage.getItem(Nr))}catch{return[]}}function hs(e){return Zt(e)}function bs(){return yt}function tn(e){return!yt.includes(e)}function ys(e,t){let n=!yt.includes(e);t!==n&&vs(t?yt.filter(r=>r!==e):[...yt,e],!0)}function ws(e){vs(e,!1)}function Ir(e){return si.add(e),()=>{si.delete(e)}}function rp(e,t){return e.length!==t.length?!1:e.every(n=>t.includes(n))}function vs(e,t){if(!rp(yt,e)){if(yt=[...new Set(e)],t)try{window.localStorage.setItem(Nr,JSON.stringify(yt))}catch{}for(let n of[...si])n()}}var Pr="dsh-model-think-level.model-order";function li(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=xs(o.filter(a=>typeof a=="string"));i.length>0&&(n[r]=i)}return n}catch{return{}}}function xs(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 Rt=(()=>{try{return li(window.localStorage.getItem(Pr))}catch{return{}}})(),di=new Set;function ks(){for(let e of[...di])e()}function op(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function ip(){try{window.localStorage.setItem(Pr,JSON.stringify(Rt))}catch{}}function Es(){return Rt}function Ts(e){return Rt[e]??ap}var ap=[];function Ss(e,t){if(e.length===0)return;let n=xs(t),r=Ts(e);if(op(r,n)&&(n.length>0||!(e in Rt)))return;let o={...Rt};n.length===0?delete o[e]:o[e]=n,Rt=o,ip(),ks()}function Ms(e){Rt=e,ks()}function Dr(e){return di.add(e),()=>{di.delete(e)}}function sp(e,t){return en(e,t)}function Ls(e,t){return en(t,Ts(e))}function ci(e,t){if(e.length===0||t.length===0)return e;let n=new Map(e.map(r=>[r.id,r]));return sp(e.map(r=>r.id),t).map(r=>n.get(r))}var As=`
|
|
8
8
|
/* ---- Quiet Precision: the plugin's own token layer ----
|
|
9
9
|
Every value below is a HOST design-platform token (--dsw-*) with the light
|
|
10
10
|
theme's literal as the fallback, so the plugin inherits a theme switch for
|
|
@@ -48,7 +48,14 @@ body {
|
|
|
48
48
|
--bre-accent-line: #4176e640;
|
|
49
49
|
--bre-accent-glow: #4176e61f;
|
|
50
50
|
--bre-ok: var(--dsw-alias-state-success-primary, #22c55e);
|
|
51
|
+
/* The success family gets the same three steps the accent family has (ink /
|
|
52
|
+
weak fill), because \u300C\u8BA1\u5165\u300D is a state a pill must paint, not a 1px dot.
|
|
53
|
+
The ink step stays a literal: the host's success token is a FILL colour and
|
|
54
|
+
unreadable as 11px text on its own tint. */
|
|
55
|
+
--bre-ok-ink: #157a43;
|
|
56
|
+
--bre-ok-weak: #eefaf2;
|
|
51
57
|
--bre-warn: var(--dsw-alias-state-warn-label, #dd8629);
|
|
58
|
+
--bre-warn-weak: #fdf6ec;
|
|
52
59
|
--bre-danger: var(--dsw-alias-state-error-primary, #ec1313);
|
|
53
60
|
--bre-danger-weak: #fef2f2;
|
|
54
61
|
--bre-r-xs: 4px;
|
|
@@ -71,6 +78,13 @@ body[data-ds-dark-theme] {
|
|
|
71
78
|
--bre-accent-weak: #1e335c;
|
|
72
79
|
--bre-accent-line: #7aaaff40;
|
|
73
80
|
--bre-accent-glow: #7aaaff26;
|
|
81
|
+
/* Success/warn tints have to be repainted, not inherited: a 10% mint wash on
|
|
82
|
+
a #353638 card is invisible, and #157a43 as 11px text on a dark card is
|
|
83
|
+
unreadable. Dark therefore swaps roles \u2014 deep fill, light ink \u2014 which is
|
|
84
|
+
exactly how the accent family above behaves. */
|
|
85
|
+
--bre-ok-ink: #6ad391;
|
|
86
|
+
--bre-ok-weak: #17301f;
|
|
87
|
+
--bre-warn-weak: #35281a;
|
|
74
88
|
--bre-danger-weak: #3a1b18;
|
|
75
89
|
--bre-switch-track: #4a4b4d;
|
|
76
90
|
--bre-shadow-pop: 0 2px 5px #00000059, 0 12px 32px -8px #000000a6;
|
|
@@ -104,20 +118,38 @@ body[data-ds-dark-theme] {
|
|
|
104
118
|
.bre-effort-card {
|
|
105
119
|
display: flex;
|
|
106
120
|
flex-direction: column;
|
|
107
|
-
gap:
|
|
108
|
-
padding:
|
|
121
|
+
gap: 11px;
|
|
122
|
+
padding: 12px 15px 12px;
|
|
109
123
|
border: none;
|
|
110
124
|
border-radius: var(--bre-r-md);
|
|
111
125
|
background: var(--dsw-alias-settings-card-fill, #ffffff);
|
|
112
126
|
box-sizing: border-box;
|
|
113
127
|
}
|
|
128
|
+
/* \u652F\u6301\u6A21\u6001, above the thinking switch. The same 15px inset as the card below
|
|
129
|
+
so its label lines up with the card's sections and with the switch. */
|
|
130
|
+
.bre-effort-modality {
|
|
131
|
+
display: flex;
|
|
132
|
+
flex-direction: column;
|
|
133
|
+
gap: 7px;
|
|
134
|
+
padding: 0 15px;
|
|
135
|
+
}
|
|
114
136
|
/* The editor's one-line head: the master switch with its title, the declared
|
|
115
|
-
state, and the applied suggestion's provenance pill.
|
|
137
|
+
state, and the applied suggestion's provenance pill. The card below pads
|
|
138
|
+
its content 15px in; without the same inset the switch sits on the card's
|
|
139
|
+
outer edge, left of every section under it. */
|
|
116
140
|
.bre-effort-top {
|
|
117
141
|
display: flex;
|
|
118
142
|
align-items: center;
|
|
119
143
|
flex-wrap: wrap;
|
|
120
144
|
gap: 9px;
|
|
145
|
+
padding: 0 15px;
|
|
146
|
+
}
|
|
147
|
+
/* A caveat that qualifies the SWITCH (no reasoning-effort control declared, no
|
|
148
|
+
off level): it hangs directly under the switch row, so it keeps that row's
|
|
149
|
+
15px inset and tightens the gap instead of opening a paragraph block. */
|
|
150
|
+
.bre-effort-note--top {
|
|
151
|
+
padding: 0 15px;
|
|
152
|
+
margin-top: -3px;
|
|
121
153
|
}
|
|
122
154
|
.bre-effort-state {
|
|
123
155
|
font-size: 12px;
|
|
@@ -191,28 +223,6 @@ body[data-ds-dark-theme] {
|
|
|
191
223
|
opacity: 0.4;
|
|
192
224
|
cursor: default;
|
|
193
225
|
}
|
|
194
|
-
/* The applied suggestion, as the board's pill: 22px, a hairline, quiet ink, and
|
|
195
|
-
the accent glyph that marks it as advice rather than state. */
|
|
196
|
-
.bre-effort-suggest {
|
|
197
|
-
display: inline-flex;
|
|
198
|
-
align-items: center;
|
|
199
|
-
gap: 5px;
|
|
200
|
-
max-width: 100%;
|
|
201
|
-
height: 22px;
|
|
202
|
-
padding: 0 8px;
|
|
203
|
-
border-radius: var(--bre-r-pill);
|
|
204
|
-
border: 1px solid var(--bre-line-2);
|
|
205
|
-
background: var(--bre-surface);
|
|
206
|
-
font-size: 11px;
|
|
207
|
-
color: var(--bre-ink-2);
|
|
208
|
-
white-space: nowrap;
|
|
209
|
-
overflow: hidden;
|
|
210
|
-
text-overflow: ellipsis;
|
|
211
|
-
}
|
|
212
|
-
.bre-effort-suggest svg {
|
|
213
|
-
flex: none;
|
|
214
|
-
color: var(--bre-accent);
|
|
215
|
-
}
|
|
216
226
|
.bre-link-button {
|
|
217
227
|
background: none;
|
|
218
228
|
border: none;
|
|
@@ -439,7 +449,7 @@ body[data-ds-dark-theme] {
|
|
|
439
449
|
.bre-effort-sec {
|
|
440
450
|
display: flex;
|
|
441
451
|
flex-direction: column;
|
|
442
|
-
gap:
|
|
452
|
+
gap: 6px;
|
|
443
453
|
}
|
|
444
454
|
.bre-effort-labelrow {
|
|
445
455
|
display: flex;
|
|
@@ -455,10 +465,13 @@ body[data-ds-dark-theme] {
|
|
|
455
465
|
}
|
|
456
466
|
/* User item 8: the explanation moved OUT of the label row. As an ellipsised
|
|
457
467
|
fragment beside the label it was unreadable at the disclosure's width; on its
|
|
458
|
-
own line at 11/16 the whole sentence fits, which is what the board draws.
|
|
468
|
+
own line at 11/16 the whole sentence fits, which is what the board draws.
|
|
469
|
+
It now follows the pills (the board's order: heading, control, note), so it
|
|
470
|
+
keeps no top margin of its own \u2014 the section's 6px gap is the whole spacing. */
|
|
459
471
|
.bre-effort-hint {
|
|
460
472
|
font-size: 11px;
|
|
461
473
|
line-height: 16px;
|
|
474
|
+
margin: 0;
|
|
462
475
|
color: var(--bre-ink-4);
|
|
463
476
|
}
|
|
464
477
|
.bre-effort-grow { flex: 1 1 auto; min-width: 0; }
|
|
@@ -542,6 +555,12 @@ body[data-ds-dark-theme] {
|
|
|
542
555
|
gap: 18px;
|
|
543
556
|
align-items: start;
|
|
544
557
|
}
|
|
558
|
+
/* The card with the thinking switch off: the two token counts stand alone, so
|
|
559
|
+
the slab tightens to their own height and keeps the same 15px inset. */
|
|
560
|
+
.bre-effort-card--capacity {
|
|
561
|
+
gap: 9px;
|
|
562
|
+
padding: 11px 15px 12px;
|
|
563
|
+
}
|
|
545
564
|
.bre-effort-wire {
|
|
546
565
|
box-sizing: border-box;
|
|
547
566
|
width: 100%;
|
|
@@ -692,12 +711,6 @@ body[data-ds-dark-theme] {
|
|
|
692
711
|
background-size: 12px 12px;
|
|
693
712
|
}
|
|
694
713
|
.bre-error { color: var(--dsw-alias-state-error-primary); }
|
|
695
|
-
/* ---- Zoned suggestion display ---- */
|
|
696
|
-
.bre-suggestion {
|
|
697
|
-
display: flex;
|
|
698
|
-
flex-direction: column;
|
|
699
|
-
gap: 3px;
|
|
700
|
-
}
|
|
701
714
|
/* The two capacities are EDITABLE fields, not a footnote (user request: \u4E0A\u4E0B\u6587
|
|
702
715
|
\u53C2\u6570/\u6700\u5927\u957F\u5EA6\u8FD9\u4E24\u4E2A\u53C2\u6570\u9700\u8981\u53EF\u4EE5\u914D\u7F6E): each is the row's own official input,
|
|
703
716
|
mirrored here, so the label sits above a sunken field with the unit inside it.
|
|
@@ -1117,6 +1130,18 @@ body[data-ds-dark-theme] {
|
|
|
1117
1130
|
.bre-option.is-active .bre-option-tags { color: var(--bre-accent); opacity: .9; }
|
|
1118
1131
|
.bre-tag { display: inline-flex; align-items: center; }
|
|
1119
1132
|
.bre-tag-icon { display: block; width: 13px; height: 13px; }
|
|
1133
|
+
/* The declared context window, spelled the way catalogues do (128K, 1M).
|
|
1134
|
+
Tabular digits so a column of them compares at a glance; muted like the
|
|
1135
|
+
badges, with its own title carrying the field copy. */
|
|
1136
|
+
.bre-option-cap {
|
|
1137
|
+
flex: none;
|
|
1138
|
+
color: var(--bre-ink-3);
|
|
1139
|
+
opacity: .78;
|
|
1140
|
+
font-size: 11px;
|
|
1141
|
+
font-variant-numeric: tabular-nums;
|
|
1142
|
+
line-height: 1;
|
|
1143
|
+
}
|
|
1144
|
+
.bre-option.is-active .bre-option-cap { color: var(--bre-accent); opacity: .9; }
|
|
1120
1145
|
.bre-empty { padding: 8px; font-size: 12px; color: var(--bre-ink-hint); }
|
|
1121
1146
|
|
|
1122
1147
|
/* ---- Truncated-label tooltip (custom, replaces the native title) ----
|
|
@@ -1598,13 +1623,28 @@ body:not([data-ds-dark-theme]) .bre-tip {
|
|
|
1598
1623
|
.bre-headers-actions .bre-secondary-button:hover:not(:disabled) {
|
|
1599
1624
|
background: var(--dsw-alias-interactive-bg-hover, #2631480f);
|
|
1600
1625
|
}
|
|
1601
|
-
/* The row that closes the pane.
|
|
1602
|
-
already carries
|
|
1603
|
-
|
|
1626
|
+
/* The row that closes the pane. In the fold it gets room, not a rule: the pane
|
|
1627
|
+
already carries its divider on its title row, so a line here would draw a
|
|
1628
|
+
second one with nothing between them to divide. */
|
|
1604
1629
|
.bre-headers-actions {
|
|
1605
1630
|
padding-top: 12px;
|
|
1606
1631
|
}
|
|
1607
1632
|
|
|
1633
|
+
/* Under the tabs the row is the card's ONLY commit row \u2014 the takeover hides the
|
|
1634
|
+
official footer's body on this pane \u2014 so it wears the footer dress the other
|
|
1635
|
+
two panes inherit from the official row: one hairline above, the pair
|
|
1636
|
+
right-aligned beneath it, matching that row's 6px margin / 12px padding / 1px
|
|
1637
|
+
hairline (the padding is the base rule's, just above). The advanced pane's
|
|
1638
|
+
\u4FDD\u5B58 was the only commit button without that divider. The rule belongs to the
|
|
1639
|
+
row that carries the pane's own save: the deferred variant (the
|
|
1640
|
+
create-provider card) has none and commits with the card's kept footer row,
|
|
1641
|
+
which already wears its own divider \u2014 a line here would stack a second one
|
|
1642
|
+
directly above it. */
|
|
1643
|
+
.bre-headers[data-bre-region='advanced'] .bre-headers-actions:has(.bre-primary-button) {
|
|
1644
|
+
margin-top: 6px;
|
|
1645
|
+
border-top: 1px solid var(--dsw-alias-border-l2, #0000001a);
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1608
1648
|
/* The row actions and the section's Edit affordance: the official 28px
|
|
1609
1649
|
bordered small button, and the 21px blue text link the model rows use. */
|
|
1610
1650
|
.bre-headers-row .bre-link-button {
|
|
@@ -1878,6 +1918,79 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
1878
1918
|
.bre-provider-switch::after { transition: none; }
|
|
1879
1919
|
}
|
|
1880
1920
|
|
|
1921
|
+
/* ---- Provider balance chip (Models page) ---- */
|
|
1922
|
+
|
|
1923
|
+
/* Leads the enable switch as context, not as a control: a quiet pill that must
|
|
1924
|
+
never read like a button, and never pushes the switch out of line. Tabular
|
|
1925
|
+
figures keep two providers' amounts from jittering as the page rescans. The
|
|
1926
|
+
pill holds the amount and, AFTER it, the small refresh control. */
|
|
1927
|
+
.bre-provider-balance {
|
|
1928
|
+
display: inline-flex;
|
|
1929
|
+
align-items: center;
|
|
1930
|
+
gap: 2px;
|
|
1931
|
+
flex: 0 0 auto;
|
|
1932
|
+
max-width: 168px;
|
|
1933
|
+
margin-right: 8px;
|
|
1934
|
+
padding: 1px 4px 1px 8px;
|
|
1935
|
+
border-radius: 9px;
|
|
1936
|
+
background: var(--dsw-alias-bg-tertiary, #eef0f4);
|
|
1937
|
+
color: var(--dsw-alias-label-secondary, #6b7280);
|
|
1938
|
+
font: inherit;
|
|
1939
|
+
font-size: 11.5px;
|
|
1940
|
+
font-variant-numeric: tabular-nums;
|
|
1941
|
+
line-height: 16px;
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
.bre-provider-balance-text {
|
|
1945
|
+
min-width: 0;
|
|
1946
|
+
overflow: hidden;
|
|
1947
|
+
white-space: nowrap;
|
|
1948
|
+
text-overflow: ellipsis;
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
/* The icon is a real button (16\xD716 hit area, 12px glyph) but visually part of
|
|
1952
|
+
the pill: quiet until hovered, and it never widens the amount's ellipsis
|
|
1953
|
+
budget \u2014 the text column shrinks, the control stays. */
|
|
1954
|
+
.bre-provider-balance-refresh {
|
|
1955
|
+
display: inline-flex;
|
|
1956
|
+
align-items: center;
|
|
1957
|
+
justify-content: center;
|
|
1958
|
+
flex: 0 0 auto;
|
|
1959
|
+
width: 16px;
|
|
1960
|
+
height: 16px;
|
|
1961
|
+
padding: 0;
|
|
1962
|
+
border: none;
|
|
1963
|
+
border-radius: 4px;
|
|
1964
|
+
background: none;
|
|
1965
|
+
color: inherit;
|
|
1966
|
+
cursor: pointer;
|
|
1967
|
+
opacity: .7;
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
.bre-provider-balance-refresh svg { width: 12px; height: 12px; }
|
|
1971
|
+
|
|
1972
|
+
.bre-provider-balance-refresh:hover {
|
|
1973
|
+
opacity: 1;
|
|
1974
|
+
background: var(--dsw-alias-bg-quaternary, #e2e5ea);
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
.bre-provider-balance-refresh:focus-visible {
|
|
1978
|
+
outline: 2px solid var(--dsw-alias-brand-primary, #4d6bfe);
|
|
1979
|
+
outline-offset: 1px;
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
.bre-provider-balance-refresh.is-spinning svg {
|
|
1983
|
+
animation: bre-balance-spin .8s linear infinite;
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
@keyframes bre-balance-spin {
|
|
1987
|
+
to { transform: rotate(360deg); }
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
@media (prefers-reduced-motion: reduce) {
|
|
1991
|
+
.bre-provider-balance-refresh.is-spinning svg { animation: none; }
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1881
1994
|
/* ---- The reserved delete seat (Models page) ---- */
|
|
1882
1995
|
|
|
1883
1996
|
/* A provider the host will not let the user remove renders no delete button, so
|
|
@@ -2306,6 +2419,24 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
2306
2419
|
margin-left: auto;
|
|
2307
2420
|
}
|
|
2308
2421
|
|
|
2422
|
+
/* The Fingerprint pane keeps the body under it too, and the "Customized" group
|
|
2423
|
+
stands there as an empty shell wearing its separator: on this tab every child
|
|
2424
|
+
of the group is a pane claim (the identity fields, the catalogue) or the
|
|
2425
|
+
dismissed summary, so the .5px line sat over a bare 22px strip between the
|
|
2426
|
+
pane above and the commit row below. The separator's job is to divide the
|
|
2427
|
+
group from the key field above it \u2014 this tab shows neither \u2014 so it goes, with
|
|
2428
|
+
the group's and its body's top padding, the same way the Models pane's did.
|
|
2429
|
+
The commit row's own hairline stays: it is the footer divider every tab's
|
|
2430
|
+
save row wears, and the shell's was the second line the pane had no use for. */
|
|
2431
|
+
.bre-tabbed[data-bre-tab='fingerprint'] [data-bre-editor-body] details[class*='customized'] {
|
|
2432
|
+
border-top: none;
|
|
2433
|
+
padding-top: 0;
|
|
2434
|
+
}
|
|
2435
|
+
|
|
2436
|
+
.bre-tabbed[data-bre-tab='fingerprint'] [data-bre-editor-body] details[class*='customized'] > [class*='customizedBody'] {
|
|
2437
|
+
padding-top: 0;
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2309
2440
|
/* The click's answer, as a bubble at the top of the window that takes itself
|
|
2310
2441
|
away again \u2014 and the official save line's answer too
|
|
2311
2442
|
(injection/saved-notice.ts), which is raised the same way with the same
|
|
@@ -2758,42 +2889,6 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
2758
2889
|
color: var(--dsw-alias-label-secondary, #6b7280);
|
|
2759
2890
|
}
|
|
2760
2891
|
|
|
2761
|
-
.bre-keys-discover {
|
|
2762
|
-
display: inline-flex;
|
|
2763
|
-
align-items: center;
|
|
2764
|
-
gap: 6px;
|
|
2765
|
-
padding: 0;
|
|
2766
|
-
border: 0;
|
|
2767
|
-
background: transparent;
|
|
2768
|
-
color: var(--dsw-alias-label-secondary, #6b7280);
|
|
2769
|
-
font: inherit;
|
|
2770
|
-
font-size: 11px;
|
|
2771
|
-
cursor: pointer;
|
|
2772
|
-
-webkit-appearance: none;
|
|
2773
|
-
appearance: none;
|
|
2774
|
-
transition: color 120ms ease;
|
|
2775
|
-
}
|
|
2776
|
-
|
|
2777
|
-
.bre-keys-discover:hover { color: var(--dsw-alias-label-primary, #0f1115); }
|
|
2778
|
-
|
|
2779
|
-
.bre-keys-discover:focus-visible {
|
|
2780
|
-
outline: none;
|
|
2781
|
-
box-shadow: 0 0 0 2px var(--dsw-alias-brand-primary, #3b82f6);
|
|
2782
|
-
border-radius: 4px;
|
|
2783
|
-
}
|
|
2784
|
-
|
|
2785
|
-
.bre-keys-discover:disabled { opacity: 0.55; cursor: default; }
|
|
2786
|
-
|
|
2787
|
-
.bre-keys-discover-mark {
|
|
2788
|
-
display: inline-flex;
|
|
2789
|
-
align-items: center;
|
|
2790
|
-
justify-content: center;
|
|
2791
|
-
width: 14px;
|
|
2792
|
-
height: 14px;
|
|
2793
|
-
}
|
|
2794
|
-
|
|
2795
|
-
.bre-keys-discover-mark > svg { width: 13px; height: 13px; }
|
|
2796
|
-
|
|
2797
2892
|
.bre-keys-add-mark {
|
|
2798
2893
|
display: inline-flex;
|
|
2799
2894
|
flex: 0 0 auto;
|
|
@@ -3054,7 +3149,7 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
3054
3149
|
/* The provider card's address tag: the protocol family the base URL serves.
|
|
3055
3150
|
A hairline pill, the redesign's quiet badge: centred text inside a 999
|
|
3056
3151
|
capsule, never a control. The width is FIXED at the form's label column:
|
|
3057
|
-
OpenAI
|
|
3152
|
+
OpenAI and Anthropic chips then share one 96px prefix column, so
|
|
3058
3153
|
the field's input and every \u66F4\u591A\u7AEF\u70B9 row's input start at the same x \u2014
|
|
3059
3154
|
a min-width column would drift with each family's name length. */
|
|
3060
3155
|
.bre-endpoint-family {
|
|
@@ -3708,7 +3803,7 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
3708
3803
|
@media (prefers-reduced-motion: reduce) {
|
|
3709
3804
|
.bre-editor-tab { transition: none; }
|
|
3710
3805
|
.bre-key-eye { transition: none; }
|
|
3711
|
-
.bre-keys-actions, .bre-keys-add, .bre-keys-
|
|
3806
|
+
.bre-keys-actions, .bre-keys-add, .bre-keys-chip { transition: none; }
|
|
3712
3807
|
}
|
|
3713
3808
|
|
|
3714
3809
|
/* ---- \u6307\u7EB9\u68C0\u6D4B\u9875\u7B7E / the fingerprint tab pane ----------------------------
|
|
@@ -3798,6 +3893,12 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
3798
3893
|
border-color: var(--bre-accent);
|
|
3799
3894
|
box-shadow: 0 0 0 3px var(--bre-accent-glow);
|
|
3800
3895
|
}
|
|
3896
|
+
/* The fold control is borderless, so its focus ring rides the model id. */
|
|
3897
|
+
.bre-fp-fold:focus-visible {
|
|
3898
|
+
outline: none;
|
|
3899
|
+
border-radius: var(--bre-r-sm);
|
|
3900
|
+
box-shadow: 0 0 0 2px var(--bre-accent-glow);
|
|
3901
|
+
}
|
|
3801
3902
|
.bre-fp-all:disabled,
|
|
3802
3903
|
.bre-fp-action:disabled { opacity: 0.55; cursor: default; }
|
|
3803
3904
|
|
|
@@ -3820,6 +3921,25 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
3820
3921
|
min-height: 44px;
|
|
3821
3922
|
padding: 6px 12px;
|
|
3822
3923
|
}
|
|
3924
|
+
/* The result card's fold control: chevron + model id as ONE button, so the
|
|
3925
|
+
target is the label the user reads and the row keeps a keyboard path to its
|
|
3926
|
+
own result card. Quiet until hover \u2014 the chevron alone carries the state. */
|
|
3927
|
+
.bre-fp-fold {
|
|
3928
|
+
display: inline-flex;
|
|
3929
|
+
align-items: center;
|
|
3930
|
+
gap: 6px;
|
|
3931
|
+
margin: -6px -4px -6px -8px;
|
|
3932
|
+
padding: 6px 4px 6px 8px;
|
|
3933
|
+
border: 0;
|
|
3934
|
+
background: none;
|
|
3935
|
+
color: inherit;
|
|
3936
|
+
font: inherit;
|
|
3937
|
+
text-align: left;
|
|
3938
|
+
cursor: pointer;
|
|
3939
|
+
min-width: 0;
|
|
3940
|
+
}
|
|
3941
|
+
.bre-fp-fold:hover .bre-fp-model { color: var(--bre-accent); }
|
|
3942
|
+
.bre-fp-chev { flex: none; color: var(--bre-ink-3); opacity: .7; }
|
|
3823
3943
|
.bre-fp-model {
|
|
3824
3944
|
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
3825
3945
|
font-size: 12px;
|
|
@@ -3877,6 +3997,53 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
3877
3997
|
font-weight: 500;
|
|
3878
3998
|
color: var(--bre-ink);
|
|
3879
3999
|
}
|
|
4000
|
+
/* \u9010\u9898\u90A3\u4E00\u884C\uFF1A\u4E09\u9897\u836F\u4E38\uFF0C\u7D27\u8D34\u300C\u5BB6\u65CF / \u76F8\u4F3C\u5EA6\u300D\u4E0B\u65B9\uFF08m00136\uFF09\u3002
|
|
4001
|
+
Grammar is the badge's \u2014 19px, 5px corner, 11px text, one hairline \u2014 so the
|
|
4002
|
+
result card reads as one instrument instead of a second design. Only the
|
|
4003
|
+
state changes colour, and the state is exactly three: counted (success),
|
|
4004
|
+
not counted (warn), early-stopped (muted, dashed, because nothing failed).
|
|
4005
|
+
|
|
4006
|
+
\u4E00\u884C\u5C31\u662F\u4E00\u884C\uFF08m00557\uFF09\uFF1A\u4E09\u9897\u5E76\u6392\u3001\u4E0D\u6362\u884C\u3001\u4E0D\u6536\u7F29\uFF0C\u9760\u300CQ1 312 \xB7 \u8BA1\u5165\u300D
|
|
4007
|
+
\u8FD9\u79CD\u7A84\u6807\u7B7E\u628A\u5BBD\u5EA6\u538B\u56DE\u6765\uFF1B\u6362\u884C\u4F1A\u8BA9\u4E09\u9898\u8BFB\u6210\u4E24\u5F20\u8868\u3002 */
|
|
4008
|
+
.bre-fp-chals {
|
|
4009
|
+
display: flex;
|
|
4010
|
+
flex-wrap: nowrap;
|
|
4011
|
+
align-items: center;
|
|
4012
|
+
gap: 6px;
|
|
4013
|
+
margin-top: 8px;
|
|
4014
|
+
min-width: 0;
|
|
4015
|
+
/* \u836F\u4E38\u4E09\u9897\u5408\u8BA1\u7EA6 320px\uFF0C\u7A84\u7A97\u624D\u7528\u5F97\u4E0A\uFF1A\u5B81\u53EF\u6A2A\u5411\u6EDA\u4E00\u70B9\uFF0C\u4E5F\u4E0D\u8BA9\u7B2C\u4E09\u9897\u88AB
|
|
4016
|
+
.bre-fp-row \u7684 overflow:hidden \u6084\u6084\u88C1\u6389\u3002 */
|
|
4017
|
+
overflow-x: auto;
|
|
4018
|
+
scrollbar-width: none;
|
|
4019
|
+
}
|
|
4020
|
+
.bre-fp-chal {
|
|
4021
|
+
display: inline-flex;
|
|
4022
|
+
flex: 0 0 auto;
|
|
4023
|
+
align-items: center;
|
|
4024
|
+
height: 19px;
|
|
4025
|
+
padding: 0 6px;
|
|
4026
|
+
border: 1px solid transparent;
|
|
4027
|
+
border-radius: 5px;
|
|
4028
|
+
font-size: 11px;
|
|
4029
|
+
line-height: 1;
|
|
4030
|
+
white-space: nowrap;
|
|
4031
|
+
font-variant-numeric: tabular-nums;
|
|
4032
|
+
}
|
|
4033
|
+
.bre-fp-chal.is-counted {
|
|
4034
|
+
background: var(--bre-ok-weak);
|
|
4035
|
+
color: var(--bre-ok-ink);
|
|
4036
|
+
}
|
|
4037
|
+
.bre-fp-chal.is-rejected {
|
|
4038
|
+
background: var(--bre-warn-weak);
|
|
4039
|
+
color: var(--bre-warn);
|
|
4040
|
+
}
|
|
4041
|
+
.bre-fp-chal.is-skipped {
|
|
4042
|
+
border-color: var(--bre-line-3);
|
|
4043
|
+
border-style: dashed;
|
|
4044
|
+
background: transparent;
|
|
4045
|
+
color: var(--bre-ink-3);
|
|
4046
|
+
}
|
|
3880
4047
|
.bre-fp-bars {
|
|
3881
4048
|
display: flex;
|
|
3882
4049
|
flex-direction: column;
|
|
@@ -3917,13 +4084,489 @@ li.bre-row-disabled [class*="rowName"] { opacity: .5; }
|
|
|
3917
4084
|
line-height: 16px;
|
|
3918
4085
|
color: var(--bre-ink-3);
|
|
3919
4086
|
}
|
|
4087
|
+
/* The timing line answers "why was this slow" in one muted sentence:
|
|
4088
|
+
a long first-token wait means thinking preamble, a low chars/s means
|
|
4089
|
+
provider throughput. Same voice as the note, one line, no numbers that
|
|
4090
|
+
pretend to be measurements they are not. */
|
|
4091
|
+
.bre-fp-timing {
|
|
4092
|
+
margin: 6px 0 0;
|
|
4093
|
+
font-size: 11px;
|
|
4094
|
+
line-height: 16px;
|
|
4095
|
+
color: var(--bre-ink-3);
|
|
4096
|
+
font-variant-numeric: tabular-nums;
|
|
4097
|
+
}
|
|
3920
4098
|
|
|
3921
4099
|
@media (prefers-reduced-motion: reduce) {
|
|
3922
4100
|
.bre-fp-all, .bre-fp-action { transition: none; }
|
|
3923
4101
|
}
|
|
3924
|
-
`;var yn=require("react"),Ts=require("react-dom");var E=require("react"),us=require("react-dom");var Ja=["off","minimal","low","medium","high","xhigh","max"],Du=["text","image"];var Iu=[{id:"deepseek-v4-vision",patterns:["deepseek-v4-flash-vision","deepseek-v4-vision"],efforts:{off:"none",low:"low",high:"high",max:"max"},defaultEffort:"high",compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,maxTokens:384e3,note:"DeepSeek \u89C6\u89C9\u5B9E\u9A8C\u7248 id\uFF08deepseek-v4-flash-vision-exp\uFF09\u3002\u5B98\u65B9\u76EE\u5F55\u5DF2\u6807\u6CE8\u8BE5\u6A21\u578B\u9000\u5F79\uFF0C\u540D\u5B57\u4ECD\u88AB\u63A5\u53D7\u3001\u7531\u73B0\u884C deepseek-flash \u63D0\u4F9B\u670D\u52A1\u2014\u2014\u56FE\u7247\u8F93\u5165\u73B0\u5DF2\u7531 deepseek-flash \u539F\u751F\u63D0\u4F9B\u3002"},{id:"deepseek-v4-1-flash",patterns:["deepseek-v4.1-flash","deepseek-flash"],efforts:{off:"none",low:"low",high:"high",max:"max"},defaultEffort:"high",compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,maxTokens:384e3,note:'DeepSeek-V4.1-Flash\uFF082026-09-10 \u53D1\u5E03\u7684\u73B0\u884C\u5B98\u65B9\u6A21\u578B\uFF0C\u5B98\u65B9 id \u4E3A deepseek-flash\uFF1B25 \u4E07\u5E76\u53D1\u3001**\u539F\u751F\u56FE\u7247\u8F93\u5165**\uFF09\u3002V4.1 \u7684\u5404\u5199\u6CD5\uFF08deepseek-flash\u3001deepseek-v4.1-flash\u3001deepseek-v4-1-flash\uFF0C\u4EE5\u53CA\u5E26\u65E5\u671F\u540E\u7F00\u7684\u7B2C\u4E09\u65B9\u53D8\u4F53\uFF09\u90FD\u5F52\u6B64\u6761\u2014\u2014\u7EAF\u6587\u672C\u7684 deepseek-v4 \u4E3B\u5E72\u4E0D\u518D\u541E\u6389\u5B83\u4EEC\u3002\u5B98\u65B9\u679A\u4E3E\u540C V4 \u7CFB\uFF1AOff\uFF08thinking:"disabled"\uFF09/ Low / High / Max\uFF0C\u9ED8\u8BA4 High\uFF1B\u5BB9\u91CF 1,048,576 \u4E0A\u4E0B\u6587 / \u6700\u5927\u8F93\u51FA 384K\u3002'},{id:"deepseek-v4",patterns:["deepseek-v4"],efforts:{off:"none",low:"low",high:"high",max:"max"},defaultEffort:"high",compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!0},input:["text"],contextWindow:1048576,maxTokens:384e3,note:'DeepSeek \u5B98\u65B9\u679A\u4E3E Low / High / Max\uFF08\u9ED8\u8BA4 High\uFF1Bminimal\u3001medium\u3001xhigh \u517C\u5BB9\u6620\u5C04\uFF0Cultra\u2192max\uFF09\uFF0COff \u5373 thinking:"disabled"\uFF08Responses API \u4E0B off \u4EE5 reasoning.effort:"none" \u8868\u793A\uFF09\u3002\u672C\u6761\u76EE\u662F V4 \u5BB6\u65CF\u7684**\u7EAF\u6587\u672C**\u6210\u5458\uFF1Adeepseek-v4-pro\uFF08= DeepSeek-V4-Pro-0813\uFF0C\u5B98\u65B9\u4E0D\u652F\u6301\u56FE\u7247\uFF09\u4E0E\u5DF2\u9000\u5F79\u6A21\u578B\u7684\u517C\u5BB9\u522B\u540D deepseek-v4-flash\uFF08deepseek-v4-flash-vision-exp \u53E6\u6709\u89C6\u89C9\u6761\u76EE\uFF09\u3002**\u6536\u56FE\u7684 V4.1-Flash\uFF08\u5B98\u65B9 id deepseek-flash\uFF09\u53E6\u6709\u4E13\u95E8\u6761\u76EE**\uFF0C\u5176 input \u542B image\u3002\u5BB9\u91CF\uFF1A1,048,576 \u4E0A\u4E0B\u6587 / \u6700\u5927\u8F93\u51FA 384K\uFF08393,216\uFF1B\u9ED8\u8BA4\u975E\u601D\u8003 8K\u3001\u601D\u8003 64K\u3001effort=max \u65F6 128K\uFF09\u3002'},{id:"deepseek-v3",patterns:["deepseek-v3","deepseek-chat"],efforts:{off:"none",high:"high",max:"max"},compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!0},input:["text"],contextWindow:163840,maxTokens:65536,note:"DeepSeek V3 \u6863\u4F4D\uFF1AOff / High / Max\u3002\u5B98\u65B9\u5DF2\u505C\u552E V3 \u4EE3\uFF08\u5B9A\u4EF7\u9875\u4EC5\u5269 V4 \u4E09\u578B\uFF09\uFF0C\u5BB9\u91CF\u53D6\u76EE\u5F55\u73B0\u5F79\u503C\u3002"},{id:"deepseek-r1",patterns:["deepseek-r1","deepseek-reasoner"],efforts:{high:"high"},defaultEffort:"high",compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!0},input:["text"],contextWindow:163840,maxTokens:32768,note:"DeepSeek-R1 \u4E3A\u63A8\u7406\u6A21\u578B\uFF0C\u4EC5\u63D0\u4F9B High\u3002\u5B98\u65B9\u5DF2\u4E0B\u67B6 R1 \u4EE3\uFF0C\u5BB9\u91CF\u53D6\u76EE\u5F55 r1-0528 \u503C\u3002"},{id:"openai-gpt-5-2",patterns:["gpt-5.2"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"off",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.2 \u6863\u4F4D\uFF1ANone / Low / Medium / High / XHigh\uFF08\u9ED8\u8BA4 None\uFF09\u3002\u5B98\u65B9\u53E6\u652F\u6301 PDF \u8F93\u5165\uFF08\u6838\u5FC3\u8BCD\u8868\u6682\u4E0D\u542B\uFF09\u3002gpt-5.2-pro \u5B98\u65B9\u9875\u672A\u5355\u5217\u6863\u4F4D\u884C\uFF0C\u6309\u672C\u6761\u76EE\u540C\u6863\u5904\u7406\uFF1Bgpt-5.2-codex \u89C1\u5355\u72EC\u6761\u76EE\u3002"},{id:"openai-gpt-5-2-codex",patterns:["gpt-5.2-codex"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.2-Codex \u6863\u4F4D\uFF1ALow / Medium / High / XHigh\uFF08\u65E0 None \u6863\uFF0C\u52FF\u52FE Off\uFF09\uFF0C\u5E26\u56FE\u8F93\u5165\u3001400K\u3002"},{id:"openai-gpt-5-6",patterns:["gpt-5.6"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:272e3,maxTokens:128e3,note:"GPT-5.6\uFF08\u522B\u540D\u5373 sol\uFF09\u6863\u4F4D\uFF1ANone / Low / Medium(\u9ED8\u8BA4) / High / XHigh / Max\uFF1Bsol/luna/terra \u540C\u6863\uFF0C\u5E26\u56FE\u8F93\u5165\u30022026-10 \u6821\u51C6\uFF1A\u4E0A\u4E0B\u6587\u6309 pi-ai 1.2.0 \u76EE\u5F55\u8BB0 272,000\uFF08\u6B64\u524D\u8BEF\u8BB0 1,050,000\uFF09\u3002"},{id:"openai-gpt-5-5",patterns:["gpt-5.5"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:272e3,maxTokens:128e3,note:"GPT-5.5 \u6863\u4F4D\uFF1ANone / Low / Medium(\u9ED8\u8BA4) / High / XHigh\uFF08\u65E0 Max \u6863\uFF09\uFF0C\u5E26\u56FE\u8F93\u5165\u3002pro \u53D8\u4F53\u4EC5 High(\u9ED8\u8BA4) / XHigh\u30011.05M \u4E0A\u4E0B\u6587\u4E14\u4EC5 Responses API\u30022026-10 \u6821\u51C6\uFF1A\u4E0A\u4E0B\u6587\u6309 pi-ai 1.2.0 \u76EE\u5F55\u8BB0 272,000\uFF08\u6B64\u524D\u8BEF\u8BB0 1,050,000\uFF09\u3002"},{id:"openai-gpt-5-4",patterns:["gpt-5.4"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"off",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:272e3,maxTokens:128e3,note:"GPT-5.4 \u6863\u4F4D\uFF1ANone(\u9ED8\u8BA4) / Low / Medium / High / XHigh\uFF0C\u5E26\u56FE\u8F93\u5165\u3002pro \u53D8\u4F53\u4EC5 Medium/High/XHigh\uFF081.05M\uFF09\uFF1Bmini/nano \u4E3A 400K \u4E0A\u4E0B\u6587\u30022026-10 \u6821\u51C6\uFF1A\u4E0A\u4E0B\u6587\u6309 pi-ai 1.2.0 \u76EE\u5F55\u8BB0 272,000\uFF08\u6B64\u524D\u8BEF\u8BB0 1,050,000\uFF09\u3002"},{id:"openai-gpt-5-3",patterns:["gpt-5.3"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.3-Codex \u6863\u4F4D\uFF1ANone / Low / Medium(\u9ED8\u8BA4) / High / XHigh\uFF0C\u5E26\u56FE\u8F93\u5165\u3001400K\uFF1B2026-10 \u6821\u51C6\uFF1ANone \u6863\u6309 pi-ai 1.2.0 \u76EE\u5F55\u8865\u56DE\uFF08\u6B64\u524D\u6309\u65E7\u6A21\u578B\u9875\u8BB0\u4E3A\u65E0 None\uFF09\u3002gpt-5.3-chat \u4E3A\u975E\u63A8\u7406\u804A\u5929\u6A21\u578B\uFF08\u89C1 chat \u6761\u76EE\uFF09\u3002"},{id:"openai-gpt-5-1",patterns:["gpt-5.1"],efforts:{off:"none",low:"low",medium:"medium",high:"high"},defaultEffort:"off",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.1 \u6863\u4F4D\uFF1ANone / Low / Medium / High\uFF08\u9ED8\u8BA4 None\uFF09\u3002"},{id:"openai-gpt-5-1-codex",patterns:["gpt-5.1-codex"],efforts:{low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.1-Codex \u7CFB\u5217\uFF1A\u5B98\u65B9\u6A21\u578B\u9875\u672A\u5355\u5217 effort \u503C\u57DF\uFF0C\u6309\u540C\u4EE3\u4FDD\u5B88\u6863 Low / Medium / High\uFF08\u65E0 None\uFF1Bxhigh \u672A\u8BC1\u5B9E\uFF09\u3002\u5982\u7AEF\u70B9\u652F\u6301 xhigh/none \u53EF\u624B\u8C03\u3002"},{id:"openai-gpt-5",patterns:["gpt-5"],efforts:{minimal:"minimal",low:"low",medium:"medium",high:"high"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5 \u521D\u4EE3\u6863\u4F4D\uFF1AMinimal / Low / Medium / High\uFF0C\u65E0\u5173\u95ED\u6863\u3002"},{id:"openai-gpt-5-2-chat",patterns:["gpt-5.2-chat"],efforts:{off:null,medium:"medium",xhigh:"xhigh"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:128e3,maxTokens:16384,note:"GPT-5.2-Chat\uFF08\u5B98\u65B9 id gpt-5.2-chat-latest\uFF09\uFF1Api-ai 1.2.0 \u76EE\u5F55\u8BB0\u4E3A\u63A8\u7406\u6A21\u578B\uFF0C\u4EC5 Medium / XHigh \u4E24\u6863\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF0C\u975E\u663E\u5F0F\u5173\u95ED\uFF09\uFF0C128K / 16,384 \u8F93\u51FA\u30022026-10 \u65B0\u589E\u6761\u76EE\u3002"},{id:"openai-chat",patterns:["gpt-5.1-chat-latest","gpt-5.3-chat-latest","gpt-5-chat-latest","gpt-chat-latest","gpt-5-chat","gpt-5.1-chat","gpt-5.3-chat"],efforts:!1,input:["text","image"],contextWindow:128e3,maxTokens:16384,note:"-chat \u7CFB\u5217\uFF08\u5B98\u65B9 id \u4E3A gpt-5.x-chat-latest\uFF09\u4E3A\u975E\u63A8\u7406\u804A\u5929\u6A21\u578B\uFF0C\u4E0D\u652F\u6301 effort \u53C2\u6570\uFF08\u52FF\u52FE\u601D\u8003\u6863\uFF09\uFF1B\u5B98\u65B9\u652F\u6301\u56FE\u7247\u8F93\u5165\uFF0C128K / 16,384 \u8F93\u51FA\u3002gpt-5-chat-latest \u5DF2\u4E8E 2026-07-23 \u4E0B\u67B6\u3001gpt-chat-latest \u5DF2\u65E0\u5B98\u65B9\u9875\u9762\uFF08\u4FDD\u7559\u6A21\u5F0F\u4F9B\u7F51\u5173\uFF09\u3002gpt-5.2-chat \u53E6\u6709\u63A8\u7406\u6761\u76EE\u3002"},{id:"openai-o",patterns:["o1","o3","o4"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:2e5,maxTokens:1e5,note:"OpenAI o \u7CFB\u6863\u4F4D\uFF1ALow / Medium / High\u3002\u5B98\u65B9\u5DF2\u4E8E 2026-06 \u516C\u544A\u9000\u5F79\uFF08o1/o1-pro/o3-mini/o4-mini 2026-10-23 \u79FB\u9664\u3001o3/o3-pro 2026-12-11\uFF09\uFF0C\u7F51\u5173\u6B8B\u7559\u4ECD\u53EF\u547D\u4E2D\uFF1B\u591A\u6570 o \u7CFB\u7AEF\u70B9\u6536\u56FE\uFF08o3-mini \u4F8B\u5916\uFF09\u3002"},{id:"openai-gpt-oss",patterns:["gpt-oss"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"low",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],contextWindow:131072,maxTokens:131072,note:"GPT-OSS \u5F00\u6E90\u6743\u91CD\uFF08Ollama/vLLM \u5E38\u89C1\uFF09\uFF1Areasoning effort Low / Medium / High\uFF0C\u7EAF\u6587\u672C\uFF0C131K \u4E0A\u4E0B\u6587 / 131K \u8F93\u51FA\u30022026-09 \u590D\u6838\uFF1A\u5B98\u65B9\u6A21\u578B\u9875\u73B0\u5728\u5199 Chat Completions = Not supported\u3001\u65E0\u56FE\u7247\u8F93\u5165\uFF08\u9ED8\u8BA4 Low \u6765\u81EA\u5B98\u65B9 CLI\uFF0C\u4E0D\u662F API \u9875\uFF09\uFF0C\u56E0\u6B64\u8FD9\u91CC\u4E0D\u518D\u58F0\u660E Off\u3002"},{id:"openai-gpt-6",patterns:["gpt-6-luna","gpt-6-sol","gpt-6-terra","gpt-6.1"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:272e3,maxTokens:128e3,note:'GPT-6 \u7CFB\uFF08luna/sol/terra\uFF0C2026-10 \u6821\u51C6\u65B0\u589E\uFF09\uFF1Api-ai 1.2.0 \u76EE\u5F55\u5168\u6863 None / Low / Medium / High / XHigh / Max\uFF0C\u5E26\u56FE\u8F93\u5165\uFF0C272,000 \u4E0A\u4E0B\u6587 / 128,000 \u8F93\u51FA\u3002gpt-6-astra \u89C1\u5355\u72EC\u6761\u76EE\uFF08\u88F8 "gpt-6" \u4E0E 6.1-sol \u7531 astra \u6761\u76EE\u627F\u63A5\uFF0Coff \u4EE5\u7701\u7565\u8868\u8FBE\uFF0C"none" \u672A\u8BC1\u5B9E\u53EF\u624B\u8C03\uFF09\u3002'},{id:"openai-gpt-6-astra",patterns:["gpt-6-astra","gpt-6","gpt-6.1-sol"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:272e3,maxTokens:128e3,note:'GPT-6 Astra \u6863\u4F4D\uFF1ALow / Medium / High / XHigh / Max\u2014\u2014**\u6CA1\u6709 None \u6863**\uFF08\u5B98\u65B9\u539F\u6587\uFF1A\u8BBE\u4E3A none \u8FD4\u56DE HTTP 400\uFF09\uFF0C\u56E0\u6B64\u672C\u6761\u76EE\u4E0D\u58F0\u660E Off\u3002\u5E26\u56FE\u8F93\u5165\uFF1B2026-10 \u6821\u51C6\uFF1A\u4E0A\u4E0B\u6587\u6309 pi-ai 1.2.0 \u76EE\u5F55\u8BB0 272,000\uFF08\u6B64\u524D\u8BEF\u8BB0 1,050,000\uFF09\u3002\u5DE5\u5177\u8C03\u7528\u9700\u8D70 Responses API\u3002gpt-6 luna/sol/terra \u89C1\u5355\u72EC\u6761\u76EE\uFF1B\u88F8 "gpt-6" \u4E0E 6.1-sol\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF09\u7531\u672C\u6761\u76EE\u627F\u63A5\u3002'},{id:"openai-gpt-daybreak",patterns:["gpt-daybreak"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:105e4,maxTokens:128e3,note:"GPT-Daybreak\uFF08blue-latest 1.05M / red-latest 400K\uFF0C2026-10 \u65B0\u589E\uFF09\uFF1Api-ai 1.2.0 \u76EE\u5F55\u5168\u6863 None / Low / Medium / High / XHigh / Max\uFF0C\u5E26\u56FE\u8F93\u5165 / 128,000 \u8F93\u51FA\u3002"},{id:"openai-gpt-realtime",patterns:["gpt-realtime"],efforts:{minimal:"minimal",low:"low",medium:"medium",high:"high",xhigh:"xhigh"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:128e3,maxTokens:32e3,note:"GPT-Realtime 2.1\uFF082026-10 \u65B0\u589E\uFF09\uFF1Api-ai 1.2.0 \u76EE\u5F55\u6863\u4F4D Minimal / Low / Medium / High / XHigh\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF09\uFF0C128,000 \u4E0A\u4E0B\u6587 / 32,000 \u8F93\u51FA\u3002"},{id:"openai-gpt-5-6-cyber",patterns:["gpt-5.6-cyber"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.6-Cyber\uFF1A\u5B98\u65B9\u6A21\u578B\u9875\u672A\u5355\u5217 effort \u503C\u57DF\uFF08\u4E0D\u7B49\u4E8E\u4E0D\u652F\u6301\uFF09\uFF0C\u6545\u6309\u540C\u4EE3\u4FDD\u5B88\u6863 Low / Medium / High / XHigh\uFF1B\u8BE5\u578B\u53F7\u4EC5 Responses API\uFF0C\u5E26\u56FE\u8F93\u5165\u3001400K \u4E0A\u4E0B\u6587\u3002\u5B98\u65B9\u652F\u6301\u7684\u5176\u4ED6\u6863\u4F4D\u53EF\u624B\u8C03\u540E\u5E94\u7528\u3002"},{id:"openai-gpt-4o",patterns:["gpt-4o"],efforts:!1,input:["text","image"],contextWindow:128e3,maxTokens:16384,note:"GPT-4o \u4EE3\u9645\uFF1A\u975E\u63A8\u7406\u6A21\u578B\uFF0C\u4E0D\u652F\u6301 effort \u53C2\u6570\uFF08\u52FF\u52FE\u601D\u8003\u6863\uFF09\uFF1B\u56FE\u7247\u8F93\u5165\u5168\u7CFB\u6807\u914D\uFF0C128K / 16,384 \u8F93\u51FA\u3002"},{id:"openai-gpt-4-1",patterns:["gpt-4.1"],efforts:!1,input:["text","image"],contextWindow:1047576,maxTokens:32768,note:"GPT-4.1 \u5168\u7CFB\uFF08\u542B mini/nano\uFF09\uFF1A\u975E\u63A8\u7406\u6A21\u578B\uFF0C\u4E0D\u652F\u6301 effort \u53C2\u6570\uFF1B\u5B98\u65B9 1,047,576 \u4E0A\u4E0B\u6587 / 32,768 \u8F93\u51FA\uFF0C\u5168\u7CFB\u5E26\u56FE\u8F93\u5165\u3002"},{id:"openai-gpt-4-turbo-preview",patterns:["gpt-4-turbo-preview"],efforts:!1,input:["text"],contextWindow:128e3,maxTokens:4096,note:"GPT-4 Turbo Preview\uFF1A\u975E\u63A8\u7406\u6A21\u578B\uFF0C\u7EAF\u6587\u672C\u8F93\u5165\uFF08\u6B63\u5F0F turbo \u5FEB\u7167\u652F\u6301\u56FE\u7247\uFF0C\u89C1\u4E0B\u6761\uFF09\uFF0C128K\u3002"},{id:"openai-gpt-4-turbo",patterns:["gpt-4-turbo"],efforts:!1,input:["text","image"],contextWindow:128e3,maxTokens:4096,note:"GPT-4 Turbo\uFF1A\u975E\u63A8\u7406\u6A21\u578B\uFF0C\u5B98\u65B9\u652F\u6301\u56FE\u7247\u8F93\u5165\uFF0C128K / 4,096 \u8F93\u51FA\u3002"},{id:"openai-gpt",patterns:["gpt-4","gpt-3.5"],efforts:!1,input:["text"],note:"GPT-4/3.5 \u4EE3\u9645\uFF1A\u975E\u63A8\u7406\u6A21\u578B\uFF0C\u4E0D\u652F\u6301 effort \u53C2\u6570\uFF08\u52FF\u52FE\u601D\u8003\u6863\uFF09\u3002gpt-4-turbo/4.1 \u8D77\u652F\u6301\u56FE\u7247\uFF0C\u89C1\u5355\u72EC\u6761\u76EE\uFF1B\u65B0\u4EE3\u8BF7\u7528 GPT-5 \u7CFB\uFF08\u89C1 openai-chat/gpt-5.x \u6761\u76EE\uFF09\u3002"},{id:"anthropic-claude-5-5",patterns:["claude-haiku-5.5","claude-opus-5-5","claude-sonnet-5-5","haiku-5.5","claude-5-5"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},defaultEffort:"high",compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude 5.5 \u4EE3\uFF08Haiku 5.5 / Opus 5.5 / Sonnet 5.5\uFF09\uFF1Api-ai 1.2.0 \u5B98\u65B9\u76EE\u5F55\u5168\u6863 Low / Medium / High(\u9ED8\u8BA4) / XHigh / Max\uFF0C\u81EA\u9002\u5E94\u601D\u8003\uFF0C1M \u4E0A\u4E0B\u6587 / 128K \u8F93\u51FA\u3002off/minimal \u4EE5\u7701\u7565\u8868\u8FBE\uFF08\u76EE\u5F55\u5C06\u4E24\u952E\u8BB0\u4E3A null\uFF0C\u975E\u663E\u5F0F\u5173\u95ED\uFF09\u3002"},{id:"anthropic-claude-5",patterns:["claude-fable-5","claude-mythos-5","claude-opus-5","claude-sonnet-5"],efforts:{xhigh:"xhigh",max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude 5 \u4EE3\uFF08Fable 5 / Mythos 5 / Opus 5 / Sonnet 5\uFF09\uFF1A2026-10 \u6821\u51C6\u2014\u2014pi-ai 1.2.0 \u5B98\u65B9\u76EE\u5F55\u5DF2\u6536\u7D27\u4E3A XHigh / Max\uFF08low/medium/high \u6863\u5DF2\u4ECE\u8BE5\u4EE3 effort \u76EE\u5F55\u79FB\u9664\uFF1BFable 5 \u4E0E Opus 5 \u53E6\u63A5\u53D7\u4EE5\u7701\u7565\u8868\u8FBE\u7684 off\uFF0CSonnet 5 \u65E0 off\uFF09\u30021M \u4E0A\u4E0B\u6587 / 128K \u8F93\u51FA\uFF08Batch 300K\uFF09\u3002\u5B98\u65B9\u652F\u6301 PDF \u8F93\u5165\u3002\u6CE8\u610F\uFF1AAnthropic \u5B98\u65B9 OpenAI \u517C\u5BB9\u5C42\u4F1A\u5FFD\u7565 effort \u53C2\u6570\uFF0C\u58F0\u660E\u5728\u7B2C\u4E09\u65B9\u7F51\u5173\u6620\u5C04\u65F6\u751F\u6548\u3002"},{id:"anthropic-claude-5-1",patterns:["claude-fable-5-1","claude-mythos-5-1"],efforts:{xhigh:"xhigh",max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude Fable 5.1 / Mythos 5.1\uFF1A2026-10 \u6821\u51C6\u2014\u2014pi-ai 1.2.0 \u76EE\u5F55\u6863\u4F4D XHigh / Max\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF09\uFF0C\u81EA\u9002\u5E94\u601D\u8003\u5E38\u5F00\uFF08\u4E0D\u63A5\u53D7 enabled/disabled\uFF09\u30021M \u4E0A\u4E0B\u6587 / 128K \u8F93\u51FA\uFF1BFable 5.1 \u652F\u6301\u4F1A\u8BDD\u4E2D\u9014\u6539\u6863\uFF08\u9700 beta header\uFF0C\u672C\u63D2\u4EF6\u4E0D\u6D89\u53CA\uFF09\u3002"},{id:"anthropic-claude-mythos-preview",patterns:["claude-mythos-preview"],efforts:{low:"low",medium:"medium",high:"high",max:"max"},defaultEffort:"high",compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude Mythos Preview\uFF1A\u5B98\u65B9\u6863\u4F4D Low / Medium / High / Max\uFF08\u65E0 XHigh\uFF09\uFF0C1M \u4E0A\u4E0B\u6587\u3002pi-ai 1.2.0 \u76EE\u5F55\u65E0 mythos \u6761\u76EE\uFF0C\u672C\u6863\u4F4D\u6CBF\u7528\u5B98\u65B9 effort \u77E9\u9635\u3002"},{id:"anthropic-claude-opus-4-high",patterns:["claude-opus-4-8","claude-opus-4-7"],efforts:{xhigh:"xhigh",max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude Opus 4.7/4.8\uFF1A2026-10 \u6821\u51C6\u2014\u2014pi-ai 1.2.0 \u5B98\u65B9\u76EE\u5F55\u6863\u4F4D\u4EC5 XHigh / Max\uFF08low/medium/high \u5DF2\u4ECE\u8BE5\u4EE3\u76EE\u5F55\u79FB\u9664\uFF1Bxhigh \u4E3A\u5B98\u65B9\u63A8\u8350\u7684\u7F16\u7801\u8D77\u6B65\u6863\uFF09\u30021M \u4E0A\u4E0B\u6587\u3002"},{id:"anthropic-claude-4-6",patterns:["claude-opus-4-6","claude-sonnet-4-6"],efforts:{max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude 4.6 \u4EE3\uFF08Opus 4.6 / Sonnet 4.6\uFF09\uFF1A2026-10 \u6821\u51C6\u2014\u2014pi-ai 1.2.0 \u5B98\u65B9\u76EE\u5F55\u4EC5\u5269 Max \u4E00\u6863\uFF08low/medium/high/xhigh \u5747\u5DF2\u4ECE\u76EE\u5F55\u79FB\u9664\uFF09\u30021M \u4E0A\u4E0B\u6587\u3002"},{id:"anthropic-claude-opus-4-5",patterns:["claude-opus-4-5"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"high",compat:{supportsReasoningEffort:!0},input:["text","image"],contextWindow:2e5,maxTokens:64e3,note:"Claude Opus 4.5\uFF1A\u5B98\u65B9 effort \u652F\u6301\u5217\u8868\uFF0820251101 \u5FEB\u7167\uFF09\uFF0C\u6863\u4F4D Low / Medium / High\uFF08\u65E0 XHigh/Max\uFF09\uFF0C\u53EF\u4E0E budget_tokens \u5E76\u7528\uFF1B200K / 64K\u3002"},{id:"anthropic-claude",patterns:["claude"],efforts:!1,input:["text","image"],contextWindow:2e5,maxTokens:64e3,note:"Claude 3.x \u4E0E Sonnet 4.5 / Haiku 4.5\uFF1A\u5B98\u65B9 effort \u53C2\u6570\u4E0D\u652F\u6301\uFF08\u4EC5 5.5/5/5.1 \u4EE3\u3001Opus 4.5/4.6/4.7/4.8\u3001Sonnet 4.6 \u652F\u6301\uFF09\uFF0C\u601D\u8003\u7531 thinking.type \u63A7\u5236\u2014\u2014\u52FF\u52FE\u601D\u8003\u6863\u3002\u53C2\u8003\u5BB9\u91CF 200K / 64K\uFF08Haiku 3.5 \u4E3A\u7EAF\u6587\u672C\uFF0C\u6309\u9700\u53D6\u6D88\u56FE\u7247\uFF09\u3002Haiku 5.5 \u53CA\u6574\u4E2A 5.5 \u4EE3\u89C1\u4E0A\u65B9 anthropic-claude-5-5 \u6761\u76EE\u3002"},{id:"google-gemini",patterns:["gemini"],efforts:{low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,maxTokens:65536,note:"Gemini \u901A\u7528\u5B89\u5168\u6863\uFF1ALow / Medium / High\uFF08\u5B98\u65B9 OpenAI \u517C\u5BB9\u6620\u5C04\u8868\u53E6\u6536 minimal\uFF1A2.5 \u7CFB\u6620\u5C04\u4E3A 1,024 \u9884\u7B97\u30013.1 Flash-Lite/3 Flash \u539F\u751F minimal\u30013.1 Pro \u843D low\uFF09\u3002none \u4EC5\u80FD\u5173 2.5 \u975E Pro\uFF1B2.5 Pro \u4E0E 3 \u4EE3\u4E0D\u53EF\u5173\uFF1B\u5404\u578B\u9ED8\u8BA4\u4E0D\u4E00\uFF08flash-lite \u9ED8\u8BA4\u5173\uFF09\u3002\u5B98\u65B9\u53E6\u6536\u97F3\u9891/\u89C6\u9891/PDF\u3002Gemma-4 \u89C1\u4E0B\u6761\u3002"},{id:"google-gemma-4",patterns:["gemma-4"],efforts:{off:null,minimal:"MINIMAL",high:"HIGH"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:262144,maxTokens:32768,note:"Gemma 4\uFF0826b/31b-it\uFF09\uFF1A\u4E09\u6863 Minimal / High\uFF08\u6863\u4F4D\u7EBF\u4E3A\u5B98\u65B9\u5927\u5199\u679A\u4E3E\u62FC\u5199\uFF09\uFF0Coff \u4EE5\u7701\u7565\u8868\u8FBE\uFF1BLow/Medium \u4E0D\u88AB\u63A5\u53D7\u3002\u5E26\u56FE\u8F93\u5165\uFF0C262,144 / 32,768\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF09\u3002"},{id:"xai-grok-4-7",patterns:["grok-4.7"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:5e5,maxTokens:5e5,note:'Grok 4.7\uFF1A\u6863\u4F4D Low / Medium / High / XHigh\uFF0C\u601D\u8003\u4E0D\u53EF\u5173\u95ED\uFF08off \u4EC5\u4EE5\u7701\u7565\u8868\u8FBE\uFF09\uFF1B\u5E26\u56FE\u8F93\u5165\uFF0C500K \u4E0A\u4E0B\u6587 / 500K \u8F93\u51FA\uFF082026-10 \u6821\u51C6\uFF1Api-ai 1.2.0 \u5B98\u65B9\u76EE\u5F55\u786E\u8BA4\u6863\u4F4D\u4E0E\u5BB9\u91CF\uFF0C"\u4E0A\u6E38 404"\u4E0E"\u6863\u4F4D\u672A\u8BC1\u5B9E"\u4E24\u6761\u65E7\u8BB0\u5F55\u4F5C\u5E9F\uFF09\u3002grok-4.5 \u4F20 xhigh \u88AB\u9759\u9ED8\u6309 High \u5904\u7406\u7684\u8BF4\u660E\u89C1\u5176\u6761\u76EE\u3002'},{id:"xai-grok-high",patterns:["grok-4.6"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"high",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:5e5,note:'Grok 4.6 \u6863\u4F4D\uFF1ALow / Medium / High(\u9ED8\u8BA4) / XHigh\uFF0C\u601D\u8003\u4E0D\u53EF\u5173\u95ED\uFF1B\u5E26\u56FE\u8F93\u5165\u3001500K \u4E0A\u4E0B\u6587\u3002Grok 4.7 \u89C1\u4E0A\u4E00\u6761\uFF08\u6B64\u524D\u8BB0\u4E3A"\u4E0D\u5B58\u5728"\uFF0C\u5DF2\u968F\u53D1\u5E03\u4F5C\u5E9F\uFF09\u3002'},{id:"xai-grok-4-5",patterns:["grok-4.5"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"high",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:5e5,note:"Grok 4.5 \u6863\u4F4D\uFF1ALow / Medium / High(\u9ED8\u8BA4)\uFF0C\u601D\u8003\u4E0D\u53EF\u5173\u95ED\uFF1B\u5E26\u56FE\u8F93\u5165\u3002\u4F20\u5165 xhigh \u4F1A\u88AB\u5B98\u65B9\u9759\u9ED8\u6309 High \u5904\u7406\u3002"},{id:"xai-grok-4-3",patterns:["grok-4.3"],efforts:{off:"none",low:"low",medium:"medium",high:"high"},defaultEffort:"low",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1e6,maxTokens:3e4,note:"Grok 4.3\uFF1A\u5B98\u65B9\u56DB\u7EA7 reasoning effort\uFF08None / Low(\u9ED8\u8BA4) / Medium / High\uFF09\uFF0C1M \u4E0A\u4E0B\u6587 / 30,000 \u8F93\u51FA\uFF082026-10 \u6821\u51C6\uFF1AXHigh \u6863\u6309 pi-ai 1.2.0 \u76EE\u5F55\u79FB\u9664\u2014\u2014\u5B83\u81EA 4.6 \u8D77\u624D\u52A0\u5165\uFF1B\u5E26\u56FE\u8F93\u5165\uFF09\u3002grok-4-fast \u7B49\u65E7 slug 2026-05-15 \u8D77\u81EA\u52A8\u91CD\u5B9A\u5411\u5230\u672C\u578B\u53F7\u3002"},{id:"xai-grok",patterns:["grok"],efforts:{low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],note:"Grok \u901A\u7528\u6863\u4F4D\uFF1ALow / Medium / High\u3002\u521D\u4EE3 grok-4\u3001grok-4.20 \u4E0E grok-build-0.1 \u4E0D\u63A5\u53D7\u8BE5\u53C2\u6570\uFF08grok-4 \u7CFB\u4E0E grok-3 \u5DF2\u4E8E 2026-05-15 \u9000\u5F79\u5E76\u91CD\u5B9A\u5411\u81F3 4.3\uFF09\uFF1Bgrok-4.20-multi-agent \u7684\u56DB\u6863\u63A7\u5236\u7684\u662F agent \u6570\u91CF\u800C\u975E\u601D\u8003\u6DF1\u5EA6\u3002\u65B0\u65E7\u4EE3\u9645\u8BF7\u4F18\u5148\u9009 4.5/4.6/4.3\uFF1B\u591A\u6A21\u6001\u53D8\u4F53\u6309\u9700\u52FE\u9009\u56FE\u7247\u3002"},{id:"mistral-magistral",patterns:["magistral"],efforts:{off:"none",high:"high"},defaultEffort:"off",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:262144,maxTokens:16384,note:'Magistral\uFF08magistral-medium-latest\uFF09\uFF1A2026-10 \u6821\u51C6\u2014\u2014pi-ai 1.2.0 \u76EE\u5F55\u663E\u793A\u73B0\u5F79 magistral \u8D70 mistral-conversations \u534F\u8BAE\u5E76\u63A5\u53D7 effort\uFF08None / High \u4E24\u6863\uFF0C\u9ED8\u8BA4 None\uFF09\uFF0C\u5E26\u56FE\u8F93\u5165\uFF0C262,144 / 16,384\u3002\u65E9\u524D"\u8BE5\u7EBF\u65E0 effort \u53C2\u6570\u4E14\u5DF2\u5F03\u7528"\u7684\u8BB0\u5F55\u4F5C\u5E9F\u3002'},{id:"mistral-medium-3",patterns:["mistral-medium-3.5","mistral-large-4","mistral-medium-2604","mistral-medium-latest","mistral-small-latest","mistral-small-2603"],efforts:{off:"none",high:"high"},defaultEffort:"off",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],note:"Mistral \u73B0\u5F79\u63A8\u7406\u6863\uFF082026-10 \u6269\u5145\uFF09\uFF1ANone / High \u4E24\u6863\uFF0C\u5B98\u65B9 reasoning_effort \u679A\u4E3E\u5373 none/high\uFF1B\u73B0\u5F79\u578B\u53F7 mistral-large-4\uFF081M\uFF09\u3001mistral-medium-3.5\uFF082604/latest\uFF09\u3001mistral-small-2603\uFF08Small 4\uFF09\u7ECF\u5B83\u63A7\u5236\uFF0C\u5747\u5E26\u89C6\u89C9\u3002\u5BB9\u91CF\uFF1Alarge-4 262,144 \u8F93\u51FA\u3001medium 262,144 \u8F93\u51FA\u3001small 256,000 \u8F93\u51FA\uFF08\u4E0A\u4E0B\u6587\u5747 262,144\uFF09\u3002\u975E\u63A8\u7406\u65E7\u6B3E\u89C1\u4E0B\u6761\u3002"},{id:"mistral-legacy",patterns:["mistral-large-2411","mistral-large-latest","mistral-large-2512","mistral-medium-2505","mistral-medium-2508","mistral-small-2506","mistral-nemo","devstral","ministral","codestral","pixtral","voxtral"],efforts:!1,input:["text","image"],note:"Mistral \u975E\u63A8\u7406\u7EBF\uFF082026-10 \u65B0\u589E\u6761\u76EE\uFF09\uFF1Alarge-2411/2512/latest\u3001medium-2505/2508\u3001small-2506\u3001nemo \u53CA devstral/ministral/codestral/pixtral/voxtral \u7B49\u4E13\u7528\u7EBF\u5747\u4E0D\u63A5\u53D7 effort \u53C2\u6570\uFF08\u52FF\u52FE\u601D\u8003\u6863\uFF09\u3002\u591A\u6570\u73B0\u5F79\u6B3E\u5E26\u89C6\u89C9\uFF08large-2411 \u4E3A\u7EAF\u6587\u672C\uFF09\u3002"},{id:"qwen-vision",patterns:["qwen-vl","qwen2-vl","qwen2-5-vl","qwen3-vl","qvq"],efforts:{off:null,high:"high"},defaultEffort:"high",compat:{thinkingFormat:"qwen"},input:["text","image"],contextWindow:131072,maxTokens:8192,note:"\u901A\u4E49\u89C6\u89C9\u7EBF\uFF08Qwen-VL/QvQ\uFF09\uFF1Aenable_thinking \u5F00\u5173\uFF08\u5F00=High\uFF09\uFF0C\u6536\u56FE\u3002qwen3-vl \u5BB9\u91CF\u66F4\u5927\uFF0C\u6309\u9700\u4E0A\u8C03\u3002"},{id:"qwen-3-8",patterns:["qwen3.8"],efforts:{off:null,low:"low",medium:"medium",xhigh:"xhigh"},defaultEffort:"xhigh",compat:{thinkingFormat:"qwen",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1e6,note:"Qwen 3.8 \u7CFB\uFF1A\u5B98\u65B9 reasoning_effort \u6863\u4F4D XHigh(\u9ED8\u8BA4) / Medium / Low\uFF0Cthinking \u9ED8\u8BA4\u5F00\u3001\u53EF\u6309\u8BF7\u6C42\u5173\u95ED\uFF1B\u539F\u751F\u591A\u6A21\u6001\uFF08qwen3.8-max \u56FE\u50CF/\u89C6\u9891\u7406\u89E3\uFF0C\u89C6\u9891\u672A\u5165\u6838\u5FC3\u8BCD\u8868\uFF09\u30021M \u6863\u4E0A\u4E0B\u6587\u300227B \u4E0E Flash-Next \u5F00\u6E90\u6B3E\u89C1\u5355\u72EC\u6761\u76EE\u3002"},{id:"qwen-3-8-27b",patterns:["qwen3.8-27b"],efforts:{off:null,low:"low",medium:"medium",xhigh:"xhigh"},defaultEffort:"xhigh",compat:{thinkingFormat:"qwen",supportsReasoningEffort:!0},input:["text","image"],contextWindow:262144,note:"Qwen3.8-27B\uFF08dense\uFF0C2026-08-14 \u5F00\u6E90\uFF09\uFF1A\u5B98\u65B9 reasoning_effort \u6863\u4F4D XHigh(\u9ED8\u8BA4) / Medium / Low\uFF0Cthinking \u9ED8\u8BA4\u5F00\u3001\u53EF\u6309\u8BF7\u6C42\u5173\uFF1B\u539F\u751F\u56FE\u50CF+\u89C6\u9891\u7406\u89E3\uFF08\u89C6\u9891\u672A\u5165\u6838\u5FC3\u8BCD\u8868\uFF09\u3002262,144 \u539F\u751F\u4E0A\u4E0B\u6587\u3001\u5B98\u65B9\u58F0\u660E\u53EF\u6269\u81F3 1M\u3002\u6765\u6E90\uFF1AHF Qwen/Qwen3.8-27B \u6A21\u578B\u5361\u3002"},{id:"qwen-3-8-flash-next",patterns:["qwen3.8-flash-next"],efforts:{off:null,low:"low",medium:"medium",xhigh:"xhigh"},defaultEffort:"xhigh",compat:{thinkingFormat:"qwen",supportsReasoningEffort:!0},input:["text","image"],contextWindow:262144,note:"Qwen3.8-Flash-Next\uFF08125B-A6B \u5B9E\u9A8C\u67B6\u6784\uFF0CQwen4 \u524D\u8EAB\uFF09\uFF1A\u5B98\u65B9 reasoning_effort \u6863\u4F4D XHigh(\u9ED8\u8BA4) / Medium / Low + enable_thinking \u5F00\u5173\uFF1B\u539F\u751F\u89C6\u89C9\uFF08Vision Encoder\uFF09\u3002262,144 \u539F\u751F\u4E0A\u4E0B\u6587\u3001\u53EF\u6269\u81F3 1M\u3002\u6765\u6E90\uFF1AHF \u6A21\u578B\u5361\u4E0E qwen.ai \u5B98\u65B9\u535A\u5BA2\u3002"},{id:"qwen",patterns:["qwen","qwq"],efforts:{off:null,high:"high"},defaultEffort:"high",compat:{thinkingFormat:"qwen"},input:["text"],contextWindow:1e6,maxTokens:65536,note:"\u901A\u4E49\u5343\u95EE\uFF1Aenable_thinking \u5F00\u5173\uFF08\u65E0 effort \u6863\uFF09\uFF0C\u5F00=High\uFF1B\u73B0\u5F79\u65D7\u8230\u4E3A qwen3.8 \u7CFB\uFF081M \u6863\u4E0A\u4E0B\u6587\uFF0C\u89C1 qwen-3-8 \u6761\u76EE\uFF09\u30023.6/3.7 \u4EE3\u7684 Plus/Flash \u4EA6\u9ED8\u8BA4\u591A\u6A21\u6001\uFF08\u56FE\u7247/\u89C6\u9891\uFF09\uFF0C\u5982\u63A5\u5165\u8BF7\u6309\u9700\u52FE\u9009\u56FE\u7247\uFF1B\u89C6\u89C9\u7EBF\u89C1 qwen-vision \u6761\u76EE\u3002"},{id:"glm-vision",patterns:["glm-4v","glm-4-6v","glm-4-5v","glm-5v"],efforts:{off:null,high:"high"},defaultEffort:"high",compat:{thinkingFormat:"zai"},input:["text","image"],contextWindow:131072,maxTokens:32768,note:"\u667A\u8C31\u89C6\u89C9\u7EBF\uFF08GLM-4V/4.5V/4.6V/5V\uFF09\uFF1Athinking \u5F00\u5173\uFF08\u5F00=High\uFF09\uFF0C\u6536\u56FE\u3002GLM-4.5V \u4E3A\u5F3A\u5236\u601D\u8003\uFF08\u4F20 disabled \u62A5\u9519\uFF0C\u8BF7\u624B\u52A8\u5220 Off \u6863\uFF09\u3002"},{id:"glm-5-3-flash",patterns:["glm-5.3-flash","glm-5.3-flashx"],efforts:{low:"low",high:"high",max:"max"},defaultEffort:"max",compat:{thinkingFormat:"zai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,maxTokens:131072,note:"GLM-5.3-Flash\uFF08320B\uFF0C\u5B98\u65B9\u6587\u6863 vlm \u5206\u7C7B\uFF09\uFF1A\u5F3A\u5236\u601D\u8003\uFF08thinking.type \u4EC5 enabled\uFF0C\u4E0D\u652F\u6301\u5173\u95ED\uFF09\uFF0C\u6587\u672C\u53C2\u6570\u4E0E GLM-5.3 \u4E00\u81F4\u2014\u2014\u6863\u4F4D Low / High / Max\u3002\u8F93\u5165\u6A21\u6001\uFF1A\u89C6\u9891\u3001\u56FE\u50CF\u3001\u6587\u672C\u3001\u6587\u4EF6\uFF08\u89C6\u9891/\u6587\u4EF6\u672A\u5165\u6838\u5FC3\u8BCD\u8868\uFF0C\u56FE\u7247\u53EF\u52FE\uFF09\u3002\u5B98\u65B9 1M \u4E0A\u4E0B\u6587 / 128K \u6700\u5927\u8F93\u51FA\u3002\u6765\u6E90\uFF1Adocs.bigmodel.cn \u6A21\u578B\u9875\u3002"},{id:"glm-5-3",patterns:["glm-5.3"],efforts:{low:"low",high:"high",max:"max"},defaultEffort:"max",compat:{thinkingFormat:"zai",supportsReasoningEffort:!0},input:["text"],contextWindow:1048576,maxTokens:131072,note:"GLM-5.3 \u6863\u4F4D\uFF1ALow / High / Max\uFF08\u5F3A\u5236\u601D\u8003\uFF0C\u5176\u4F59\u503C\u62A5\u9519\uFF09\u3002\u5B98\u65B9\u5BB9\u91CF 1M / 128K\u3002"},{id:"glm-5-2",patterns:["glm-5.2"],efforts:{off:"none",minimal:"minimal",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},defaultEffort:"max",compat:{thinkingFormat:"zai",supportsReasoningEffort:!0},input:["text"],contextWindow:1048576,maxTokens:131072,note:"GLM-5.2 \u6863\u4F4D\uFF1ANone / Minimal / Low / Medium / High / XHigh / Max\uFF08\u5B98\u65B9\u6620\u5C04\uFF1ALow\xB7Medium\u2192High\u3001XHigh\u2192Max\u3001None\xB7Minimal=\u505C\u6B62\u601D\u8003\uFF09\u3002\u89C6\u89C9\u7EBF\u89C1 glm-vision \u6761\u76EE\u3002"},{id:"glm",patterns:["glm","zhipu","chatglm"],efforts:{off:null,high:"high"},defaultEffort:"high",compat:{thinkingFormat:"zai"},input:["text"],note:"GLM \u901A\u7528\uFF1Athinking \u5F00\u5173\uFF08\u65E0 effort \u6863\uFF09\uFF0C\u5F00=High\uFF1Beffort \u9636\u68AF\u4EC5 GLM-5.2+ \u652F\u6301\uFF08\u89C1\u4E0A\u4E24\u6761\u76EE\uFF09\u3002\u6CE8\u610F GLM-4.7/GLM-4.5V \u4E3A\u5F3A\u5236\u601D\u8003\uFF0C\u4F20 disabled \u4F1A\u62A5\u9519\uFF08\u8BF7\u624B\u52A8\u5220 Off \u6863\uFF09\u3002\u89C6\u89C9\u7EBF\u89C1 glm-vision \u6761\u76EE\u3002"},{id:"kimi-k3",patterns:["kimi-k3"],efforts:{low:"low",high:"high",max:"max"},defaultEffort:"max",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,note:"Kimi K3 \u6863\u4F4D\uFF1ALow / High / Max(\u9ED8\u8BA4 Max)\uFF0C\u8D70\u9876\u5C42 reasoning_effort\uFF1B\u59CB\u7EC8\u63A8\u7406\u3001\u52FF\u4F20 thinking \u5BF9\u8C61\u3002\u539F\u751F\u89C6\u89C9\u7406\u89E3\uFF0C1M \u4E0A\u4E0B\u6587\uFF08\u6700\u5927\u8F93\u51FA\u5B98\u65B9\u672A\u5355\u72EC\u5217\uFF0C\u4E0D\u63D0\u4F9B\uFF09\u3002"},{id:"kimi-k2-vision",patterns:["kimi-k2.6","kimi-k2.5"],efforts:{off:null,high:"high"},defaultEffort:"high",compat:{thinkingFormat:"deepseek"},input:["text","image"],contextWindow:262144,note:"Kimi K2.5/K2.6 \u89C6\u89C9\u4EE3\uFF1Athinking.type \u5F00\u5173\uFF08\u9ED8\u8BA4\u5F00\u3001\u53EF\u5173\uFF09\uFF0C\u5F00=High\uFF1B\u5E26\u89C6\u89C9\uFF0C256K\u3002K2.7 Code \u59CB\u7EC8\u601D\u8003\uFF0C\u89C1\u5355\u72EC\u6761\u76EE\u3002"},{id:"kimi-k27-code",patterns:["kimi-k2.7"],efforts:{high:"high"},defaultEffort:"high",compat:{thinkingFormat:"deepseek"},input:["text","image"],contextWindow:262144,note:"Kimi K2.7 Code\uFF08\u542B\u9AD8\u901F\u7248\uFF09\uFF1A\u59CB\u7EC8\u601D\u8003\u2014\u2014thinking.type \u4EC5\u63A5\u53D7 enabled\uFF08\u4F20 disabled \u62A5\u9519\uFF09\uFF0C\u65E0 Off \u6863\uFF1B\u5E26\u89C6\u89C9\uFF0C256K\u3002"},{id:"kimi-for-coding",patterns:["kimi-for-coding"],efforts:{low:"low",high:"high",max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1048576,maxTokens:32768,note:"Kimi for Coding\uFF1AMoonshot \u7F16\u7801\u4E13\u7EBF\u8D70 anthropic-messages \u534F\u8BAE\u3001\u81EA\u9002\u5E94\u601D\u8003\uFF0C\u6863\u4F4D Low / High / Max\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF09\uFF1B\u5E26\u56FE\u8F93\u5165\uFF0C1M \u4E0A\u4E0B\u6587 / 32,768 \u8F93\u51FA\u3002\u9AD8\u901F\u7248\uFF08-highspeed\uFF09\u65E0 effort \u63A7\u4EF6\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF09\u3002"},{id:"kimi-moonshot-v1-vision",patterns:["moonshot-v1-8k-vision","moonshot-v1-32k-vision","moonshot-v1-128k-vision"],efforts:!1,input:["text","image"],note:"Moonshot V1 \u89C6\u89C9\u65E7\u4EE3\uFF088k/32k/128k \u5404\u4E00\uFF09\uFF1A\u65E0\u601D\u8003\u63A7\u4EF6\uFF08\u751F\u6210\u6A21\u578B\uFF09\u3001\u652F\u6301\u56FE\u7247\u8F93\u5165\uFF1B\u8BE5\u7EBF\u5DF2\u505C\u6B62\u5BF9\u65B0\u7528\u6237\u5F00\u653E\uFF082026-08-31 \u5168\u91CF\u4E0B\u7EBF\uFF0C\u7F51\u5173\u6B8B\u7559\u4ECD\u53EF\u547D\u4E2D\uFF09\u3002"},{id:"kimi",patterns:["kimi","moonshot"],efforts:{off:null,high:"high"},compat:{thinkingFormat:"deepseek"},input:["text"],contextWindow:262144,note:"Kimi \u901A\u7528\uFF1Athinking \u5F00\u5173\uFF08\u65E0 effort \u6863\uFF09\uFF0C\u5F00=High\u3002k2 \u7CFB\u5217 2026-05-25 \u4E0B\u7EBF\u3001kimi-latest 2026-01-28 \u4E0B\u7EBF\u3001moonshot-v1 \u7CFB 2026-08-31 \u5168\u91CF\u4E0B\u7EBF\uFF08\u7F51\u5173\u6B8B\u7559\u4ECD\u53EF\u547D\u4E2D\uFF1Bmoonshot-v1 \u672C\u8EAB\u975E\u601D\u8003\u6A21\u578B\uFF09\u3002\u89C6\u89C9\u4EE3\u4E0E K2.7 Code \u89C1\u5355\u72EC\u6761\u76EE\u3002"},{id:"hunyuan-hy3",patterns:["hy3"],efforts:{low:"low",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],contextWindow:262144,note:"\u6DF7\u5143 hy3\uFF1A\u5F00\u6E90\u5951\u7EA6\u7ECF chat_template_kwargs.reasoning_effort = no_think(\u9ED8\u8BA4)/low/high\uFF1B\u5B98\u65B9\u6A21\u578B\u5361 256K \u4E0A\u4E0B\u6587\uFF08295B MoE\uFF0C2026 \u5F00\u6E90\uFF09\u3002"},{id:"hunyuan-hy4",patterns:["hy4-preview","hy-4-preview"],efforts:{off:"no_think",high:"high"},defaultEffort:"high",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},contextWindow:1e6,note:"\u6DF7\u5143 Hy4 preview\uFF1A\u5B98\u65B9 README\u2014\u2014reasoning \u9ED8\u8BA4 high\uFF08\u6DF1\u5EA6\u601D\u8003\uFF09\uFF0C\u5173\u95ED\u7ECF chat_template_kwargs.reasoning_effort=no_think\uFF1B\u5B98\u65B9\u89C4\u683C\u8868 1M \u4E0A\u4E0B\u6587\uFF08770B-A49B MoE\uFF0CGated DSA\uFF09\u3002low \u6863\u5B98\u65B9\u672A\u5217\uFF0C\u5982\u6709\u8BF7\u624B\u8C03\uFF1B\u89C6\u89C9\u672A\u58F0\u660E\uFF0C\u6309\u9700\u624B\u52FE\u3002\u6765\u6E90\uFF1ATencent-Hunyuan/Hy4-preview \u5B98\u65B9 README\u3002"},{id:"step-5-preview",patterns:["step-5"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1e6,maxTokens:65536,note:'\u9636\u8DC3 Step-5-Preview\uFF08\u5B98\u65B9 id \u5373 step-5-preview\uFF0C\u65E0\u88F8 step-5\uFF1Bpattern \u53D6\u5BB6\u65CF\u4E3B\u5E72\u4EE5\u517C\u5BB9\u7F51\u5173\u5199\u6CD5\uFF09\uFF1A\u6863\u4F4D Low / Medium(\u5B98\u65B9\u6807"\u9ED8\u8BA4\u63A8\u8350") / High\uFF0C\u601D\u8003\u4E0D\u53EF\u5173\u95ED\uFF1B\u539F\u751F\u56FE\u7247 + \u89C6\u9891\u8F93\u5165\uFF1B1M \u4E0A\u4E0B\u6587\u300164K \u6700\u5927\u8F93\u51FA\uFF08\u5B98\u65B9\u53E6\u6CE8 max_tokens \u9ED8\u8BA4 INF\u3001\u4E0E 64K \u4E0A\u9650\u5E76\u5B58\uFF0C\u4EE5\u7AEF\u70B9\u5B9E\u6D4B\u4E3A\u51C6\uFF09\u3002'},{id:"step-3-7",patterns:["step-3.7","step-3.6"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:262144,note:"\u9636\u8DC3 Step-3.6/3.7 \u6863\u4F4D\uFF1ALow / Medium(\u9ED8\u8BA4\u63A8\u8350) / High\uFF0C\u539F\u751F\u56FE\u7247+\u89C6\u9891\u7406\u89E3\u3002\u4E0A\u4E0B\u6587\u4E3A\u8F93\u5165+\u8F93\u51FA\u603B\u548C\u4E0A\u9650\u3002"},{id:"step-3-5",patterns:["step-3.5"],efforts:{low:"low",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],contextWindow:262144,note:"\u9636\u8DC3 Step-3.5 Flash \u6863\u4F4D\uFF1ALow / High\uFF08\u7EAF\u6587\u672C\u63A8\u7406\u65D7\u8230\uFF09\u3002\u4E0A\u4E0B\u6587\u4E3A\u8F93\u5165+\u8F93\u51FA\u603B\u548C\u4E0A\u9650\u3002"},{id:"step",patterns:["step-3","step-2"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],note:"\u9636\u8DC3 Step \u6863\u4F4D\uFF1ALow / Medium / High\uFF08\u9ED8\u8BA4 Medium\uFF0C\u4E0D\u53EF\u5173\u95ED\uFF09\u30023.6/3.7 \u89C6\u89C9\u4EE3\u89C1\u5355\u72EC\u6761\u76EE\u3002"},{id:"doubao",patterns:["doubao","seed"],efforts:{off:null,low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],note:"\u8C46\u5305\u6863\u4F4D\uFF1AOff / Low / Medium / High\u2014\u2014effort \u9636\u68AF\u4ECD\u662F\u793E\u533A\u8BC1\u636E\u3001\u5B98\u65B9 Ark \u6587\u6863\u660E\u5217\u7684\u4E3A thinking.type \u5F00\u5173\uFF082026-08-24 \u590D\u6838\u4ECD\u672A\u89C1\u5230 effort \u5B98\u65B9\u660E\u6587\uFF09\u3002seed \u4EE3\u6536\u56FE\uFF081.5-pro \u4F8B\u5916\uFF09\u3002"},{id:"minimax-m2",patterns:["minimax-m2"],efforts:!1,input:["text"],contextWindow:204800,maxTokens:131072,note:"MiniMax-M2 / M2.5\uFF08\u542B -highspeed\uFF09\uFF1A\u65E0\u601D\u8003\u63A7\u4EF6\u3001\u65E0 effort \u53C2\u6570\uFF08M3 \u624D\u5F15\u5165 thinking \u53C2\u6570\uFF09\uFF0C\u7EAF\u6587\u672C\uFF0C204,800 / 131,072\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF1BM3 \u89C1\u4E0B\u6761\uFF09\u3002"},{id:"minimax-m3",patterns:["minimax-m3"],efforts:{off:null,high:"high"},compat:{thinkingFormat:"deepseek"},input:["text","image"],contextWindow:1048576,maxTokens:512e3,note:"MiniMax-M3\uFF1A\u5B98\u65B9 thinking \u53C2\u6570 enabled/adaptive/disabled\uFF08\u65E0 effort \u6863\uFF09\uFF0C\u5F00=High\u3001\u5173=disabled\uFF1B\u539F\u751F\u591A\u6A21\u6001\uFF08\u56FE/\u89C6\u9891\uFF0C\u6838\u5FC3\u8BCD\u8868\u4EC5\u542B\u56FE\uFF09\uFF0C1M \u4E0A\u4E0B\u6587 / 512,000 \u8F93\u51FA\uFF082026-10 \u6821\u51C6\u8865\u5BB9\u91CF\uFF09\u3002"},{id:"mimo-v2-6",patterns:["mimo-v2.6","mimo-v2.5"],efforts:{off:"none",low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,maxTokens:131072,note:"\u5C0F\u7C73 MiMo v2.6 \u7CFB\u5217\uFF08mimo-v2.6-pro / -flash / -pro-ultraspeed\uFF1B1M \u4E0A\u4E0B\u6587 / 128K \u6700\u5927\u8F93\u51FA\u3001\u539F\u751F\u5168\u6A21\u6001\uFF09\u4E0E\u5176\u524D\u4EE3 mimo-v2.5\u3002\u5B98\u65B9\u6587\u6863\uFF1Athinking.type\uFF08enabled/disabled\uFF0C\u9ED8\u8BA4 enabled\uFF09+ reasoning.effort\uFF08none \u5173\u95ED\uFF1B\u5176\u4F59\u5408\u6CD5\u503C\u5747\u5F00\u542F\uFF0C\u4E14**\u73B0\u9636\u6BB5\u6682\u672A\u533A\u5206\u63A8\u7406\u5F3A\u5EA6**\u2014\u2014minimal \u5F52\u4E00\u4E3A low\u3001xhigh/max/ultra \u5F52\u4E00\u4E3A high\uFF09\uFF0C\u56E0\u6B64\u8FD9\u91CC\u58F0\u660E\u7684\u662F\u7AEF\u70B9**\u63A5\u53D7**\u7684\u6863\u4F4D Off / Low / Medium / High\uFF08xhigh\u3001max \u4E0D\u58F0\u660E\uFF0C\u7AEF\u70B9\u53EA\u4F1A\u6298\u53E0\u4E3A high\uFF09\u3002\u601D\u8003\u6A21\u5F0F\u4E0B temperature / top_p \u4E0D\u53EF\u81EA\u5B9A\u4E49\uFF08\u5F3A\u5236 1.0 / 0.95\uFF09\uFF1B\u5E26\u5DE5\u5177\u8C03\u7528\u7684\u5386\u53F2\u8F6E\u5FC5\u987B\u5B8C\u6574\u56DE\u4F20 reasoning_content\uFF0C\u5426\u5219 400\u3002mimo-v2.5 \u4E0E v2.5-pro \u5B98\u65B9\u5B9A\u4E8E 2026-10-21 \u4E0B\u7EBF\u3002"},{id:"mimo-v2-5-pro",patterns:["mimo-v2.5-pro"],efforts:{off:"none",low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],contextWindow:1048576,maxTokens:131072,note:"\u5C0F\u7C73 MiMo v2.5-Pro\uFF1A\u8BE5\u5BB6\u65CF\u552F\u4E00\u7684**\u7EAF\u6587\u672C**\u6210\u5458\uFF08\u5B98\u65B9\u80FD\u529B\u8868\u672A\u5217\u5168\u6A21\u6001\u7406\u89E3\uFF09\uFF0C1M \u4E0A\u4E0B\u6587 / 128K \u6700\u5927\u8F93\u51FA\uFF0C\u63A8\u7406\u5951\u7EA6\u4E0E v2.6 \u7CFB\u5217\u76F8\u540C\uFF08thinking.type + reasoning.effort\uFF0Cnone \u5173\u95ED\u3001\u5176\u4F59\u6863\u4F4D\u6682\u4E0D\u533A\u5206\u5F3A\u5EA6\uFF09\u3002\u5B98\u65B9\u5B9A\u4E8E 2026-10-21 \u4E0B\u7EBF\u3002"},{id:"baidu-ernie",patterns:["ernie"],efforts:!1,input:["text"],contextWindow:131072,note:"\u767E\u5EA6\u5343\u5E06 ERNIE \u7CFB\uFF1A\u5B98\u65B9 OpenAI \u517C\u5BB9\u63A5\u53E3\u65E0 reasoning_effort \u53C2\u6570\u2014\u2014\u601D\u8003\u7531\u6A21\u578B\u53D8\u4F53\u51B3\u5B9A\uFF08-Thinking \u7CFB\u5217\u59CB\u7EC8\u601D\u8003\u3001\u666E\u901A\u7CFB\u5217\u4E0D\u601D\u8003\uFF09\uFF0C\u52FF\u52FE\u601D\u8003\u6863\u3002ERNIE 4.5 Turbo VL \u652F\u6301\u56FE\u7247\uFF0C\u6309\u9700\u624B\u52FE\uFF1B\u53C2\u8003\u5BB9\u91CF\u53D6 Turbo 128K \u6863\u3002"},{id:"fireworks-ember",patterns:["ember-1"],efforts:{off:"none",low:"low",medium:"medium",high:"high",max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1048576,maxTokens:131072,note:"Fireworks ember-1\uFF1Aanthropic-messages \u534F\u8BAE\u81EA\u9002\u5E94\u601D\u8003\uFF0C\u6863\u4F4D None(\u5173) / Low / Medium / High / Max\uFF08off \u663E\u5F0F none \u62FC\u5199\uFF09\uFF1B\u5E26\u56FE\u8F93\u5165\uFF0C1M \u4E0A\u4E0B\u6587 / 131,072 \u8F93\u51FA\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF09\u3002"},{id:"thinkingmachines-inkling",patterns:["inkling"],efforts:{off:"none",minimal:"minimal",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:524288,maxTokens:131072,note:"Thinking Machines Inkling\uFF1A\u5168\u6863 Minimal / Low / Medium(\u9ED8\u8BA4) / High / XHigh / Max\uFF0Coff \u663E\u5F0F none\uFF1B\u5E26\u56FE\u8F93\u5165\uFF0C512K \u4E0A\u4E0B\u6587 / 131,072 \u8F93\u51FA\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF1Btogether \u4E2D\u7EE7\u4FA7 effort \u53C2\u6570\u672A\u5F00\u653E\uFF0C\u9700\u652F\u6301\u65B9\u8F6C\u53D1\uFF09\u3002"},{id:"antling-ring",patterns:["ring-2.6"],efforts:{high:"high",xhigh:"xhigh"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],contextWindow:262144,maxTokens:65536,note:"\u8682\u8681 Ling Ring-2.6-1T\uFF1A\u6863\u4F4D High / XHigh\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF09\uFF1B262,144 / 65,536\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF09\u3002"},{id:"antling-ling",patterns:["ling-2.6"],efforts:!1,input:["text"],note:"\u8682\u8681 Ling-2.6\uFF08\u542B -flash\uFF09\uFF1A\u975E\u601D\u8003\u6A21\u578B\uFF0C\u65E0 effort \u63A7\u4EF6\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF1BRing-2.6 \u601D\u8003\u7EBF\u89C1\u4E0A\u6761\uFF09\u3002"}],Wo={off:null,low:"low",medium:"medium",high:"high"},_u={"openai-completions":Wo,"openai-responses":Wo,"anthropic-messages":Wo,deepseek:{off:"none",low:"low",high:"high",max:"max"}},Fu={low:"low",medium:"medium",high:"high"};function hn(e){return(e??"").toLowerCase().trim()}function Va(e){return e!==void 0&&/[a-z0-9]/.test(e)}function mn(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g," ")}function Qa(e,t,n){let r=t===0?void 0:e[t-1],o=e[t+n];return!Va(r)&&!Va(o)}function Go(e,t){let n=mn(e)+" "+mn(t??""),r;for(let o of Iu)for(let i of o.patterns){let a=mn(i),s=n.indexOf(a);for(;s>=0;){if(Qa(n,s,a.length)){(r===void 0||a.length>r.length)&&(r={entry:o,length:a.length});break}s=n.indexOf(a,s+1)}}return r?.entry}var Ku={"deepseek.com":"deepseek","anthropic.com":"anthropic-messages"};function qu(e){let t=hn(e.api);if(t.length>0)return t;let n=e.baseURL;if(n!==void 0&&n.length>0)try{let o=new URL(n).hostname.toLowerCase().split(".");if(o.length>=2){let i=Ku[o.slice(-2).join(".")];if(i!==void 0)return i}}catch{}return"openai-completions"}var fr="openai-completions",Za="anthropic-messages";function Bo(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 Wu(e,t){let n=hn(t),r={...e};if(delete r.supportsMidConvoEffort,delete r.allowedFallbackModels,n===Za){for(let o of["thinkingFormat","supportsReasoningEffort","thinkingTokenBudgetField","supportsThinkingTokenBudget","vllmPriority"])delete r[o];return r.forceAdaptiveThinking===void 0?void 0:{forceAdaptiveThinking:r.forceAdaptiveThinking}}if(n===fr)return delete r.forceAdaptiveThinking,Object.keys(r).length===0?void 0:r}function Bu(e,t){let n=hn(t.api);if(n===fr){let r=e.compat;return r!==void 0&&(r=Wu(r,n)??void 0),r===void 0&&!Bo(t.baseURL)?void 0:r===void 0?{thinkingTokenBudgetField:"thinking_token_budget"}:r.thinkingTokenBudgetField===void 0&&r.supportsThinkingTokenBudget!==!0&&Bo(t.baseURL)?{...r,thinkingTokenBudgetField:"thinking_token_budget"}:r}if(n===Za&&e.anthropicAdaptive===!0)return{forceAdaptiveThinking:!0}}var Gu=["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 Uo(e){if(hn(e.api)!==fr)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(".")?!Gu.some(r=>n===r||n.endsWith("."+r)):!1}catch{return!1}}function Ya(e,t,n){return e===void 0||!n||e.supportsDeveloperRole!==void 0||!Uo(t)?e:{...e,supportsDeveloperRole:!1}}var Xa={off:null,low:"low",medium:"medium",high:"high"},Uu=["vl","vision","omni","4o","pixtral","internvl"];function zo(e){let t=mn(e);for(let n of Uu){let r=mn(n),o=t.indexOf(r);for(;o>=0;){if(Qa(t,o,r.length))return["text","image"];o=t.indexOf(r,o+1)}}}function zu(e){if(e===void 0)return;let t=e.map(n=>n.toLowerCase());if(t.some(n=>Du.includes(n)))return t.includes("image")?["text","image"]:["text"]}function $e(e,t,n){let r=Go(e,t.displayName),o,i,a,s;r?.input!==void 0&&(o=r.input,i="knowledge"),r?.contextWindow!==void 0&&(a=r.contextWindow),r?.maxTokens!==void 0&&(s=r.maxTokens);let d=zu(n?.input);if(d!==void 0&&(o=d,i="endpoint"),n?.contextLength!==void 0&&Number.isFinite(n.contextLength)&&n.contextLength>0&&(a=n.contextLength),o===void 0){let h=zo(e);h!==void 0&&(o=h,i="heuristic")}let l={...o===void 0?{}:{input:o},...i===void 0?{}:{inputSource:i},...a===void 0?{}:{contextWindow:a},...s===void 0?{}:{maxTokens:s}},f=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",...f,...l};if(r!==void 0){let h=Ya(Bu(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}:{},...h===void 0?{}:{compat:h},matched:!0,entryId:r.id,source:r.id,confidence:"high",...f,...l}}let m=qu(t),u=_u[m]??Fu,c=hn(t.api)===fr?{thinkingFormat:"openai",supportsReasoningEffort:!0}:void 0,p=c!==void 0&&Bo(t.baseURL)?{...c,thinkingTokenBudgetField:"thinking_token_budget"}:c,b=Ya(p,t,!0);return n?.reasoning===!0?{efforts:{...Xa},...Xa.medium!==void 0?{defaultEffort:"medium"}:{},...b===void 0?{}:{compat:b},matched:!1,source:"endpoint:"+(n.source??"listing"),confidence:"medium",...f,...l}:{efforts:u,...u.medium!==void 0?{defaultEffort:"medium"}:{},...b===void 0?{}:{compat:b},matched:!1,source:"protocol:"+m,confidence:"low",...f,...l}}var ts="dsh-model-think-level.slider.efforts",jo="breSelectWired",ju=400;function $u(e){return e===void 0?Promise.resolve(void 0):new Promise(t=>{let n=!1,r=i=>{n||(n=!0,t(i))},o=setTimeout(()=>r(void 0),ju);e.then(i=>{clearTimeout(o),r(i)},()=>{clearTimeout(o),r(void 0)})})}function $o(e){return typeof e=="object"&&e!==null&&e.ok===!1}function Vo(e){if(!$o(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 xt(e,t){return`${e}/${t}`}function ns(){try{let e=window.localStorage.getItem(ts);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 Vu(e){try{window.localStorage.setItem(ts,JSON.stringify(e))}catch{}}function Yu(e,t,n){let r=ns();r[xt(e,t)]=n,Vu(r)}function Xu(e,t){return ns()[xt(e,t)]}function pr(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 Ju(e,t,n){return e.groups.find(o=>o.id===t)?.models.find(o=>o.id===n)?.reasoning?.defaultEffort}function Qu(e){if(!(e.length<2))return e[Math.floor((e.length-1)/2)]}function Zu(e,t){return e===null||e.provider!==t.provider||e.model!==t.model}async function es(e,t,n,r,o){let i=pr(e,t,n);if(i.length===0)return;let a=xt(t,n),s=r.get(a);if(s!==void 0&&i.includes(s))return s;let d=await $u(o?.configuredEffort===void 0?void 0:o.configuredEffort(t,n));if(d!==void 0&&i.includes(d))return d;let l=Xu(t,n);if(l!==void 0&&i.includes(l))return l;let f=$e(n,{}).defaultEffort;if(f!==void 0&&i.includes(f))return f;let m=Ju(e,t,n);return m!==void 0&&i.includes(m)?m:Qu(i)}function rs(e,t){let n=e;if(n[jo]===!0)return()=>{};let r=Object.prototype.hasOwnProperty.call(n,"select"),o=e.select,i=new Map,a=new Set,s=new Map,d=3,l=0,f=async c=>{let p=++l;if(c.reasoningEffort!==void 0){let v=await o.call(e,c);return!$o(v)&&Ke()&&(i.set(xt(c.provider,c.model),c.reasoningEffort),Yu(c.provider,c.model,c.reasoningEffort)),v}let b=e.store.getSnapshot();if(!Zu(b.current,c)){if(Ke()){let v=xt(c.provider,c.model);i.delete(v),a.add(v)}return o.call(e,c)}if(!Ke())return o.call(e,c);let h=await es(b,c.provider,c.model,i,t);if(l!==p)return;let x=e.store.getSnapshot(),S=x.current!==null&&x.current.provider===c.provider&&x.current.model===c.model;return!Ke()||h===void 0||!pr(x,c.provider,c.model).includes(h)?S?void 0:o.call(e,c):o.call(e,{...c,reasoningEffort:h})},m=()=>{let c=e.store.getSnapshot(),p=c.current;if(p===null||p.reasoningEffort!==void 0||!Ke())return;let b=xt(p.provider,p.model);if(a.has(b))return;if(pr(c,p.provider,p.model).length===0){a.add(b);return}a.add(b);let h=l;es(c,p.provider,p.model,i,t).then(async x=>{if(x===void 0){a.delete(b);return}if(!Ke()){a.delete(b);return}let S=e.store.getSnapshot(),v=S.current;if(l!==h||v===null||v.reasoningEffort!==void 0||xt(v.provider,v.model)!==b||!pr(S,v.provider,v.model).includes(x))return;let P=await o.call(e,{provider:v.provider,model:v.model,reasoningEffort:x});if($o(P))throw P}).catch(()=>{let x=(s.get(b)??0)+1;s.set(b,x),x<d&&(a.delete(b),m())})},u=e.store.subscribe(m);return m(),n[jo]=!0,e.select=f,()=>{delete n[jo],u(),r?e.select=o:delete n.select}}var K=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function os(e){let t=e.toLowerCase();return t.includes("compat")||t.includes("thinkingtokenbudget")||t.includes("vllmpriority")||t.includes("supportsmaxoutput")}function Gt(e,t){if(!K(e))return[];let n=e[t];return!K(n)||!Array.isArray(n.models)?[]:n.models.filter(K)}function kt(e,t){if(!K(e))return{};let n=e[t];if(!K(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 ut=(e,t)=>typeof e[t]=="boolean";function ef(e,t){if(Array.isArray(e)){for(let n of e)if(K(n)&&n.id===t)return n}}function tf(e){if(!K(e))return{reasoning:"unknown",source:null};let t=e.supported_features;if(Array.isArray(t)&&t.includes("reasoning"))return{...Re(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{...Re(e),reasoning:!0,source:"supported_parameters"};if(ut(e,"supports_reasoning"))return{...Re(e),reasoning:e.supports_reasoning,source:"supports_reasoning"};if(ut(e,"supportsReasoning"))return{...Re(e),reasoning:e.supportsReasoning,source:"supportsReasoning"};if(ut(e,"can_reason"))return{...Re(e),reasoning:e.can_reason,source:"can_reason"};if(ut(e,"reasoning"))return{...Re(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{...Re(e),reasoning:!0,source:"reasoning_effort"};let o=K(e.capabilities)?e.capabilities:void 0;if(o!==void 0){let i=o.thinking,a=K(i)&&typeof i.supported=="boolean"?i.supported:void 0,s=o.effort,d=K(s)&&typeof s.supported=="boolean"?s.supported:void 0;if(d===!0)return{...Re(e),reasoning:!0,source:"capabilities.effort.supported"};if(a===!0)return{...Re(e),reasoning:!0,source:"capabilities.thinking.supported"};if(a===!1)return{...Re(e),reasoning:!1,source:"capabilities.thinking.supported"};if(d===!1)return{...Re(e),reasoning:!1,source:"capabilities.effort.supported"}}return{...Re(e),reasoning:"unknown",source:null}}function Re(e){let t={},n=a=>{if(!Array.isArray(a))return;let s=a.filter(d=>typeof d=="string");return s.length>0?s.map(d=>d.toLowerCase()):[]},r=K(e.architecture)?e.architecture:void 0,o=n(r?.input_modalities);if(o===void 0&&(o=n(e.input_modalities)),o===void 0){let a=K(e.modalities)?e.modalities:void 0;o=n(a?.input)}if(o===void 0){let a=e.capabilities,s=d=>Array.isArray(d)&&d.some(l=>typeof l=="string"&&l.toLowerCase()==="vision");if(s(e.supported_features)||s(a))o=["image"];else if(K(a)){let d=[];for(let l of["image_input","video_input","pdf_input","file_input"]){let f=K(a[l])?a[l]:void 0;if(f===void 0||typeof f.supported!="boolean")continue;let m=l.replace(/_input$/,"");f.supported===!0?d.push(m):d.length===0&&d.push("text")}d.length>0&&(o=d)}}o===void 0&&(ut(e,"supports_vision")?o=e.supports_vision===!0?["image"]:[]:ut(e,"supportsVision")?o=e.supportsVision===!0?["image"]:[]:(ut(e,"supports_images")||ut(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 s=(K(e.top_provider)?e.top_provider:void 0)?.context_length;if(typeof s=="number"&&Number.isFinite(s)&&s>0)t.contextLength=s;else{let d=e.max_input_tokens;if(typeof d=="number"&&Number.isFinite(d)&&d>0)t.contextLength=d;else{let f=(K(e.limit)?e.limit:void 0)?.context;typeof f=="number"&&Number.isFinite(f)&&f>0&&(t.contextLength=f)}}}return t}function is(e,t){let n=ef(e,t);return n===void 0?{found:!1,signal:{reasoning:"unknown",source:null}}:{found:!0,signal:tf(n)}}function ke(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 hr(e){if(!K(e))return;let t=e.providers;return K(t)?t:void 0}function as(e,t){for(let n of[e?.user,e?.base]){let r=hr(n)?.[t];if(K(r)&&r.models!==void 0)return r.models}}function gr(e){return hr(e?.user)}function br(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 yr(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 wr(e,t){let r=e.find(o=>o.id===t)?.compat;if(K(r))return{...r}}function vr(e,t){let r=e.find(o=>o.id===t)?.name;return typeof r=="string"&&r.length>0?r:void 0}function xr(e,t){let r=e.find(o=>o.id===t)?.[Ft];return typeof r=="string"&&r.length>0?r:void 0}var nf=3e4,Yo=new Map,mr=new Map;async function rf(e){let t=Yo.get(e);if(t!==void 0&&Date.now()-t.at<nf)return t.data;let n=mr.get(e);if(n!==void 0)return n;let r=(async()=>{try{let o=await fetch(`${wa}?route=${encodeURIComponent(e)}`,{method:"GET"});if(!o.ok)return;let i=await o.json();return i?.ok?(Yo.set(e,{at:Date.now(),data:i.data}),i.data):void 0}catch{return}finally{mr.delete(e)}})();return mr.set(e,r),r}function Xo(){Yo.clear(),mr.clear()}async function of(e,t){let n=await rf(e);return n===void 0?{reasoning:"unknown",source:null}:is(n,t).signal}function kr(e,t=()=>ne(e),n,r,o,i){return{async suggest(a,s,d,l){let f=ke((await t()).namespace),m=kt(f,a),u={api:m.api??l?.api,baseURL:m.baseURL??l?.baseURL,displayName:d??m.displayName},c=f[a]===void 0?void 0:await of(a,s),p=$e(s,u,c);return p.efforts===void 0?{ok:!1,error:"no-suggestion"}:{ok:!0,suggestion:{efforts:p.efforts,...p.compat===void 0?{}:{compat:p.compat},...p.defaultEffort===void 0?{}:{defaultEffort:p.defaultEffort},...p.input===void 0?{}:{input:p.input},...p.inputSource===void 0?{}:{inputSource:p.inputSource},...p.contextWindow===void 0?{}:{contextWindow:p.contextWindow},...p.maxTokens===void 0?{}:{maxTokens:p.maxTokens},matched:p.matched,source:p.source,confidence:p.confidence,...p.endpoint===void 0?{}:{endpoint:p.endpoint}}}},commit(a,s,d){if(i?.()===!0){n?.(a,s,d.efforts,d.compat,d.input,d.defaultEffort);return}r?.(a,s,{efforts:d.efforts,...d.compat===void 0?{}:{compat:d.compat},...d.input===void 0?{}:{input:d.input},...d.defaultEffort===void 0?{}:{defaultEffort:d.defaultEffort}})},withdraw(a,s){o?.(a,s)},stageEfforts(a,s,d,l,f,m){n?.(a,s,d,l,f,m)},async writeEfforts(a,s,d,l,f,m){if(r!==void 0)return r(a,s,{efforts:d,...l===void 0?{}:{compat:l},...f===void 0?{}:{input:f},...m===void 0?{}:{defaultEffort:m}}),{ok:!0,staged:!0};let c=(await gn(e,a,[{modelId:s,efforts:d,...l===void 0?{}:{compat:l},...f===void 0?{}:{input:f},...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 gn(e,t,n,r=()=>ne(e),o){if(n.length===0)return[];let i=!1;for(let a=0;a<3;a++)try{let s=a===0?await r():await ne(e,{fresh:!0});if(s.namespace===void 0)return n.map(()=>({ok:!1,error:"no-namespace"}));let d=as(s.namespace,t);if(!Array.isArray(d))return n.map(()=>({ok:!1,modelNotFound:!0}));if(!d.every(K))return n.map(()=>({ok:!1,error:"invalid-models"}));let f=d.map(c=>c),m=[];for(let c of n){let p=f.findIndex(b=>b.id===c.modelId);if(p<0){m.push(c.modelId);continue}f[p]=af(f[p],c,i?void 0:c.compat)}if(m.length>0)return n.map(c=>m.includes(c.modelId)?{ok:!1,modelNotFound:!0}:{ok:!1,error:"model-not-found"});if(o?.()===!0)return n.map(()=>({ok:!1,aborted:!0}));let u=await e.settings.mutate(xe,[{op:"set",path:["providers",t,"models"],value:f}],s.namespace.revision);if(!u.ok){if(a===0&&u.error.code==="settings/conflict")continue;let c=u.error.code==="settings/rejected"&&os(u.error.message);if(!i&&c&&n.some(p=>p.compat!==void 0)){i=!0;continue}return n.map(()=>({ok:!1,error:u.error.message}))}return n.map(()=>({ok:!0}))}catch(s){return n.map(()=>({ok:!1,error:s instanceof Error?s.message:String(s)}))}return n.map(()=>({ok:!1,error:"conflict"}))}function af(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[Ae]=!0;else if(delete r[Ae],delete r[_t],i===!1)r.reasoningEfforts=!1;else{r.reasoningEfforts={...i};let s={...K(e.compat)?e.compat:{},...n??{}};Object.keys(s).length>0&&(r.compat=s)}return t.input!==void 0&&(t.input===null?(delete r.input,r[rt]=!0):(delete r[rt],r.input=[...t.input])),t.defaultEffort!==void 0&&(t.defaultEffort===null?delete r[Ft]:r[Ft]=t.defaultEffort),r}function Jo(e,t){for(let n of[e?.user,e?.base]){let r=hr(n)?.[t];if(!K(r))continue;let o=r.headers;if(o===void 0)continue;if(!K(o))return;let i={};for(let[a,s]of Object.entries(o))typeof s=="string"&&(i[a]=s);return i}}async function bn(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 ne(e):await ne(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(!He(i.namespace,t)){r=!0;continue}let a=await e.settings.mutate(xe,[{op:"set",path:["providers",t,"headers"],value:{...n}}],i.namespace.revision);if(!a.ok){if(o===0&&a.error.code==="settings/conflict")continue;return{ok:!1,error:a.error.message}}return{ok:!0}}catch(i){return{ok:!1,error:i instanceof Error?i.message:String(i)}}return r?{ok:!1,error:"no-route"}:{ok:!1,error:"conflict"}}function He(e,t){if(Object.prototype.hasOwnProperty.call(ke(e),t))return!0;for(let n of[e?.user,e?.base]){let r=hr(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:sf(e);if(n!==void 0)return n;let r=await e.settings.describe();return r.ok?{namespace:r.value.namespaces.find(i=>i.ns===xe),writable:r.value.writable,source:"wire"}:{namespace:void 0,writable:!1,source:"wire"}}function sf(e){let t=e.scope?.getSnapshot();if(!(t===void 0||t.status!=="ready")&&typeof t.revision=="number")return{namespace:{ns:xe,schema:{},value:t.value,user:t.user,base:t.base,revision:t.revision,applies:"live",secrets:[]},writable:t.writable===!0,source:"scope"}}var Qo=new Map;function ss(e){let t=Qo,n=!1,r,o=0,i=new Set,a=()=>{for(let d of[...i])d()},s=()=>{if(n)return Promise.resolve();if(r!==void 0)return r;let d=o;return r=ne(e,{fresh:!0}).then(l=>{if(d!==o||l.namespace===void 0)return;let f=new Map;for(let[m,u]of Object.entries(ke(l.namespace))){let c=new Map,p=Array.isArray(u.models)?u.models:[];for(let b of p){if(!K(b)||typeof b.id!="string"||!Array.isArray(b.input))continue;let h=b.input.filter(x=>typeof x=="string");h.length>0&&c.set(b.id,h)}c.size>0&&f.set(m,c)}t=f,n=!0,a()}).catch(()=>{}).finally(()=>{d===o&&(r=void 0)}),r};return{getSnapshot:()=>t,subscribe(d){return i.add(d),()=>{i.delete(d)}},load:s,invalidate(){o+=1,n=!1,r=void 0,i.size>0&&s()}}}var df=1e4;function ds(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 lf(e){return e.current}function ls(e,t){let n=lf(t),r=e.findIndex(s=>s.id===n?.reasoningEffort);if(r>=0)return r;let i=t.groups.find(s=>s.id===n?.provider)?.models.find(s=>s.id===n?.model)?.reasoning?.defaultEffort,a=i===void 0?-1:e.findIndex(s=>s.id===i);return a>=0?a:Math.floor((e.length-1)/2)}function Er(e){return e.models??[]}function ft(e){let t=e;return t.name??t.label??t.title??e.id}function cf(){let[e,t]=(0,E.useState)(null),n=(0,E.useRef)(0);(0,E.useEffect)(()=>()=>{window.clearTimeout(n.current)},[]);let r=(0,E.useCallback)(()=>{window.clearTimeout(n.current),t(null)},[]),o=(0,E.useCallback)((i,a)=>{window.clearTimeout(n.current);let s=i.currentTarget;s.scrollWidth<=s.clientWidth+1||(n.current=window.setTimeout(()=>{t({target:s,text:a})},300))},[]);return{tip:e,onEnter:o,onLeave:r}}function uf({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,us.createPortal)((0,E.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)}var cs=new Map;function ff(e,t){let n=t??e.input;if(Array.isArray(n)&&n.length>0)return n.includes("image");let r=JSON.stringify([e.id,e.name]),o=cs.get(r);if(o!==void 0)return o;let i=Go(e.id,e.name)?.input,a=i!==void 0?i.includes("image"):(zo(e.id)??[]).includes("image");return cs.set(r,a),a}function pf(e){let t=e.reasoning?.efforts;return Array.isArray(t)&&t.length>0}function mf(e){return(0,E.createElement)("svg",{className:"bre-tag-icon",width:13,height:13,viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":e},(0,E.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,E.createElement)("circle",{cx:8,cy:8,r:1.8,fill:"currentColor"}))}function hf(e){return(0,E.createElement)("svg",{className:"bre-tag-icon",width:13,height:13,viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":e},(0,E.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"}))}var gf=["#22c55e","#a3e635","#eab308","#f97316","#ef4444"],qg=gf.map(e=>[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]);function bf(e,t,n){let r=[];return ff(e,n)&&r.push((0,E.createElement)("span",{key:"vision",className:"bre-tag",title:t("tagVision")},mf(t("tagVision")))),pf(e)&&r.push((0,E.createElement)("span",{key:"thinking",className:"bre-tag",title:t("tagThinking")},hf(t("tagThinking")))),r.length===0?null:(0,E.createElement)("span",{className:"bre-option-tags"},...r)}function fs(e){let{directory:t,t:n,configuredInputs:r}=e,o=(0,E.useSyncExternalStore)(y=>t.store.subscribe(y),()=>t.store.getSnapshot()),i=(0,E.useSyncExternalStore)(y=>r?.subscribe(y)??(()=>{}),()=>r?.getSnapshot()??Qo),a=ds(o),[s,d]=(0,E.useState)(()=>{let y=t.store.getSnapshot(),H=ds(y);return H[ls(H,y)]?.id??""}),[l,f]=(0,E.useState)(""),[m,u]=(0,E.useState)(null),[c,p]=(0,E.useState)(!1),[b,h]=(0,E.useState)(null),x=(0,E.useRef)(null),S=(0,E.useRef)(""),v=(0,E.useRef)(!1),P=o.current!==null&&a.length>=2,D=c,z=b??o.error,oe=t.select,k=(0,E.useCallback)(()=>setTimeout(()=>{v.current&&(v.current=!1,p(!1),h(n("sliderCommitSlow")))},df),[n]);(0,E.useLayoutEffect)(()=>{if(v.current||ie.current)return;let y=ls(a,o),H=a[y]?.id??"";S.current=H,d(te=>te===H?te:H),h(null)},[P,a,o]),(0,E.useEffect)(()=>{t.load().catch(()=>{})},[t]),(0,E.useEffect)(()=>{r?.load().catch(()=>{})},[r]);let M=o.current,W=o.groups.find(y=>y.id===M?.provider),R=W?.models.find(y=>y.id===M?.model)?.name??(M===null?n("triggerFallback"):M.model),N=M===null?"":ft(W??{id:M.provider}),B=a.find(y=>y.id===s)?.name??n("effortDefault"),O=(0,E.useSyncExternalStore)(sr,Po),U=(0,E.useSyncExternalStore)(lr,Ia),X=(0,E.useSyncExternalStore)(ur,Ba),ce=o.groups.filter(y=>Er(y).length>0&&!U.includes(y.id)).map(y=>y.id),j=Wt(Do(ce),O),re=m!==null&&j.includes(m)?m:M!==null&&j.includes(M.provider)?M.provider:j[0]??null,J=l.trim().toLowerCase(),$=J!=="",de=$?j.flatMap(y=>qo(Er(o.groups.find(H=>H.id===y)),X[y]??[]).filter(H=>(H.name??H.id).toLowerCase().includes(J)||H.id.toLowerCase().includes(J)).map(H=>({provider:y,choice:H}))):[],fe=$?de:re===null?[]:qo(Er(o.groups.find(y=>y.id===re)),X[re]??[]).map(y=>({provider:re,choice:y})),F=M===null?"":M.provider+"/"+M.model,G=(0,E.useCallback)(()=>{let y=x.current?.closest('[role="menu"], [role="group"]');y!=null&&(y.tabIndex=-1,y.focus({preventScroll:!0}))},[]),g=(0,E.useCallback)(async(y,H)=>{if(v.current)return;let te=t.store.getSnapshot().current;if($&&f(""),te!==null&&te.provider===y&&te.model===H)return;v.current=!0,G(),p(!0),h(null);let he=k();try{let ge=await oe({provider:y,model:H}),je=Vo(ge);if(je!==void 0)throw new Error(je)}catch(ge){h(ge instanceof Error?ge.message:String(ge))}finally{clearTimeout(he),v.current=!1,p(!1)}},[k,t,G,$,oe]),L=(0,E.useCallback)(async y=>{if(v.current||y===o.current?.reasoningEffort&&o.status!=="error")return;v.current=!0;let H=S.current;G(),p(!0),h(null),d(y);let te=k();try{let he=o.current;if(he===null)throw new Error(n("sliderNoCurrent"));let ge=await oe({provider:he.provider,model:he.model,reasoningEffort:y}),je=Vo(ge);if(je!==void 0)throw new Error(je);let w=t.store.getSnapshot(),ue=a.find(ye=>ye.id===w.current?.reasoningEffort)?.id??y;S.current=ue,d(ue)}catch(he){S.current=H,d(H),h(he instanceof Error?he.message:String(he))}finally{clearTimeout(te),v.current=!1,p(!1)}},[k,t,G,a,oe,o.current,o.status,n]),_=(0,E.useRef)(null),V=(0,E.useRef)(null),Q=(0,E.useRef)(null),ie=(0,E.useRef)(!1),me=(0,E.useRef)(null),Se=(0,E.useRef)(null),Le=(0,E.useRef)(null),[tt,Pt]=(0,E.useState)(null),[Vn,ve]=(0,E.useState)(null),Eo=Math.max(0,a.findIndex(y=>y.id===s)),ze=tt??Eo,Dt=(Vn??(a.length>1?ze/(a.length-1):0))*100,yt=y=>{let H=_.current;if(H===null)return 0;let te=H.getBoundingClientRect();return te.width<=0?0:Math.min(1,Math.max(0,(y-te.left)/te.width))},_e=y=>a.length>1?Math.round(y*(a.length-1)):0,nt=y=>{Se.current=y;let H=y*100;V.current!==null&&(V.current.style.clipPath=`inset(0 ${100-H}% 0 0)`),Q.current!==null&&(Q.current.style.left=`${H}%`)},Yn=y=>{if(a.length===0)return;let H=yt(y);Le.current===null&&(Le.current=requestAnimationFrame(()=>{Le.current=null,ie.current&&Se.current!==null&&nt(Se.current)})),Se.current=H;let te=_e(H);te!==me.current&&(me.current=te,Pt(te),ve(H))},Xn=()=>{me.current=null,Se.current=null,Le.current!==null&&(cancelAnimationFrame(Le.current),Le.current=null),Pt(null),ve(null)},To=y=>{if(P){if(y.preventDefault(),ie.current=!0,typeof y.currentTarget.setPointerCapture=="function")try{y.currentTarget.setPointerCapture(y.pointerId)}catch{}me.current=_e(yt(y.clientX)),Yn(y.clientX),Pt(me.current),ve(Se.current)}},Jn=y=>{ie.current&&Yn(y.clientX)},Qn=y=>{if(!ie.current)return;if(ie.current=!1,typeof y.currentTarget.releasePointerCapture=="function"&&y.currentTarget.hasPointerCapture?.(y.pointerId)===!0)try{y.currentTarget.releasePointerCapture(y.pointerId)}catch{}let H=_e(yt(y.clientX)),te=a[H];if(te===void 0){Xn();return}L(te.id).finally(Xn)},Mo=y=>{if(!P)return;let H;if(y.key==="ArrowRight"||y.key==="ArrowUp"?H=Math.min(a.length-1,ze+1):y.key==="ArrowLeft"||y.key==="ArrowDown"?H=Math.max(0,ze-1):y.key==="Home"?H=0:y.key==="End"&&(H=a.length-1),H===void 0)return;y.preventDefault();let te=a[H];te!==void 0&&L(te.id)},{tip:cn,onEnter:It,onLeave:un}=cf(),Zn=(0,E.createElement)("div",{className:"bre-menu-head"},(0,E.createElement)("span",{className:"bre-row-label"},n("modelRowLabel")),(0,E.createElement)("span",{className:"bre-menu-cur"},(0,E.createElement)("span",{className:"bre-menu-name","aria-label":M===null?R:N+" \xB7 "+R,onMouseEnter:y=>{It(y,M===null?R:N+" \xB7 "+R)},onMouseLeave:un},R),N===""?null:(0,E.createElement)("span",{className:"bre-menu-prov"},N))),So=(0,E.createElement)("div",{className:"bre-menu-search"},(0,E.createElement)("div",{className:"bre-menu-search-box"},(0,E.createElement)("span",{className:"bre-menu-search-icon","aria-hidden":!0},(0,E.createElement)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,E.createElement)("circle",{cx:"7",cy:"7",r:"4.5"}),(0,E.createElement)("path",{d:"M10.5 10.5L14 14",strokeLinecap:"round"}))),(0,E.createElement)("input",{type:"text",className:"bre-menu-search-input",role:"searchbox",placeholder:n("modelSearchPlaceholder"),"aria-label":n("modelSearchPlaceholder"),value:l,spellCheck:!1,autoComplete:"off",onChange:y=>{f(y.currentTarget.value)}}),l===""?null:(0,E.createElement)("button",{type:"button",className:"bre-menu-search-clear",title:n("modelSearchClear"),"aria-label":n("modelSearchClear"),onClick:()=>{f("")}},(0,E.createElement)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,E.createElement)("path",{d:"M4 4L12 12M12 4L4 12",strokeLinecap:"round"}))))),Lo=(0,E.createElement)("div",{className:"bre-providers",role:"group","aria-label":n("modelRowLabel")},...j.map(y=>{let H=o.groups.find(te=>te.id===y);return(0,E.createElement)("button",{key:y,type:"button",className:"bre-provider"+(y===re?" is-open":"")+(y===M?.provider?" is-current":""),disabled:D,"aria-expanded":y===re,onMouseLeave:un,onClick:()=>{u(y),f("")}},(0,E.createElement)("span",{className:"bre-option-name","aria-label":ft(H),onMouseEnter:te=>{It(te,ft(H))}},ft(H)),(0,E.createElement)("span",{className:"bre-provider-count"},String(Er(H).length)))}),...j.length===0?[(0,E.createElement)("div",{key:"no-providers",className:"bre-empty"},n("sliderNoCurrent"))]:[]),Ao=(0,E.createElement)("div",{className:"bre-provider-models",role:"group","aria-label":n("modelRowLabel")},...fe.length===0?[(0,E.createElement)("div",{key:"no-models",className:"bre-empty"},n($?"modelSearchNoMatches":"sliderNoCurrent"))]:fe.map(({provider:y,choice:H})=>{let te=y+"/"+H.id,he=te===F,ge=H.name??H.id,je=$?ft(o.groups.find(w=>w.id===y))+" \xB7 "+ge:ge;return(0,E.createElement)("button",{key:te,type:"button",className:"bre-option"+(he?" is-active":""),disabled:D,"aria-pressed":he,onMouseLeave:un,onClick:()=>{g(y,H.id)}},(0,E.createElement)("span",{className:"bre-option-name","aria-label":je,onMouseEnter:w=>{It(w,je)}},$?(0,E.createElement)("span",{className:"bre-option-origin"},ft(o.groups.find(w=>w.id===y))+" \xB7 "):null,ge),bf(H,n,i.get(y)?.get(H.id)))})),er=(0,E.createElement)("div",{className:"bre-menu-foot"},P?(0,E.createElement)("div",{className:"bre-menu-slider"},(0,E.createElement)("div",{className:"bre-effort-slider-head","aria-hidden":!0},(0,E.createElement)("span",{className:"bre-effort-slider-head-label"},n("effortRowLabel")),(0,E.createElement)("span",{className:"bre-effort-slider-head-value"},a[ze]?.name??B)),(0,E.createElement)("div",{className:"bre-effort-slider",ref:_,role:"slider",tabIndex:0,"aria-label":n("effortRowLabel"),"aria-valuemin":0,"aria-valuemax":a.length-1,"aria-valuenow":ze,"aria-valuetext":a[ze]?.name,"aria-disabled":D||void 0,"data-bre-dragging":tt===null?void 0:"true",onPointerDown:To,onPointerMove:Jn,onPointerUp:Qn,onPointerCancel:Qn,onKeyDown:Mo},(0,E.createElement)("span",{className:"bre-effort-slider-fill",ref:V,style:{clipPath:`inset(0 ${100-Dt}% 0 0)`}}),...a.map((y,H)=>H===ze?null:(0,E.createElement)("span",{key:"tick-"+y.id,className:"bre-effort-slider-tick",style:{left:a.length>1?`${H/(a.length-1)*100}%`:"0%"}})),(0,E.createElement)("span",{className:"bre-effort-slider-thumb",ref:Q,style:{left:`${Dt}%`}})),(0,E.createElement)("div",{className:"bre-effort-slider-labels","aria-hidden":!0},...a.map((y,H)=>(0,E.createElement)("span",{key:y.id,className:"bre-effort-slider-label"+(H===0?" is-first":"")+(H===a.length-1?" is-last":"")+(H===ze?" is-on":""),style:{left:a.length>1?`${H/(a.length-1)*100}%`:"0%"}},y.name)))):(0,E.createElement)("span",{className:"bre-row-value is-muted"},n("sliderNoLevels")));return(0,E.createElement)("div",{className:"bre-slider-body",ref:x},(0,E.createElement)("div",{className:"bre-card"},Zn,So,(0,E.createElement)("div",{className:"bre-panel bre-panel-models"},Lo,Ao),er),z===null?null:(0,E.createElement)("div",{className:"bre-model-error",role:"status"},z),cn===null?null:(0,E.createElement)(uf,{key:"tip",state:cn}))}var ae=require("react"),ms='section[role="group"]',ei='button[role="menuitemradio"]';function hs(e){return e.querySelector(ms)!==null}function Zo(e){return Array.from(e.querySelectorAll(ei)).filter(t=>!t.disabled&&t.style.display!=="none")}function yf(e){let t=e.getAttribute("aria-labelledby");return(t===null?null:e.ownerDocument.getElementById(t))?.textContent?.toLowerCase()??""}function ps(e,t,n=new Map){let r=d=>{n.has(d)||n.set(d,d.style.display),d.style.display="none"},o=d=>{let l=n.get(d);l!==void 0&&(d.style.display=l,n.delete(d))};for(let d of[...n.keys()])d.isConnected||n.delete(d);let i=t.trim().toLowerCase().split(/\s+/).filter(Boolean),a=Array.from(e.querySelectorAll(ms)),s=0;if(i.length===0){for(let d of[...n.keys()])o(d);for(let d of a)s+=d.querySelectorAll(ei).length;return s}for(let d of a){let l=yf(d),f=Array.from(d.querySelectorAll(ei)),m=0;for(let u of f){let c=(u.getAttribute("title")??"").toLowerCase(),p=(u.textContent??"").toLowerCase(),b=`${l} ${c} ${p}`;i.every(h=>b.includes(h))?(o(u),m+=1):r(u)}m>0?(o(d),s+=m):r(d)}return s}function gs({menu:e,t}){let[n,r]=(0,ae.useState)(""),[o,i]=(0,ae.useState)(0),a=(0,ae.useRef)(null),s=(0,ae.useRef)(""),d=(0,ae.useRef)(new Map),l=(0,ae.useCallback)(c=>{s.current=c;let p=ps(e,c,d.current);i(p)},[e]);(0,ae.useEffect)(()=>()=>{ps(e,"",d.current)},[e]),(0,ae.useEffect)(()=>{let c=new MutationObserver(()=>{s.current.trim().length!==0&&l(s.current)});return c.observe(e,{childList:!0,subtree:!0}),()=>{c.disconnect()}},[e,l]),(0,ae.useEffect)(()=>{let c=p=>{if(s.current.trim().length===0)return;let b=p.key;if(!(b==="ArrowDown"||b==="ArrowUp")&&!(b==="Home"||b==="End"||b==="PageUp"||b==="PageDown")||p.target===a.current||p.target instanceof Node&&!e.contains(p.target))return;let S=Zo(e);if(S.length===0)return;let v=S.findIndex(D=>D===document.activeElement),P;b==="Home"||b==="PageUp"?P=0:b==="End"||b==="PageDown"?P=S.length-1:b==="ArrowDown"?P=v===-1?0:(v+1)%S.length:P=v===-1?S.length-1:(v-1+S.length)%S.length,p.preventDefault(),p.stopPropagation(),S[P]?.focus()};return e.addEventListener("keydown",c,!0),()=>{e.removeEventListener("keydown",c,!0)}},[e]);let f=c=>{let p=c.key;if(p==="ArrowDown"){c.preventDefault(),c.stopPropagation(),Zo(e)[0]?.focus();return}if(n.trim().length>0&&(p==="ArrowUp"||p==="Home"||p==="PageUp"||p==="End"||p==="PageDown")){let b=Zo(e);b.length>0&&(c.preventDefault(),c.stopPropagation(),b[p==="ArrowUp"||p==="End"||p==="PageDown"?b.length-1:0]?.focus());return}p==="Escape"&&n.length>0&&(c.preventDefault(),c.stopPropagation(),r(""),l(""))},m=()=>{r(""),l(""),a.current?.focus({preventScroll:!0})},u=o===0&&n.trim().length>0;return(0,ae.createElement)("div",{className:"bre-model-search-box"+(u?" has-empty":""),"data-bre-search":"1"},(0,ae.createElement)("div",{className:"bre-search-input-wrapper"},(0,ae.createElement)("span",{className:"bre-search-icon","aria-hidden":"true"},(0,ae.createElement)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,ae.createElement)("circle",{cx:"7",cy:"7",r:"4.5"}),(0,ae.createElement)("path",{d:"M10.5 10.5L14 14",strokeLinecap:"round"}))),(0,ae.createElement)("input",{ref:a,type:"text",className:"bre-search-input",role:"searchbox",placeholder:t("modelSearchPlaceholder"),"aria-label":t("modelSearchPlaceholder"),value:n,spellCheck:!1,autoComplete:"off",onChange:c=>{let p=c.currentTarget.value;r(p),l(p)},onKeyDown:f}),n.length>0?(0,ae.createElement)("button",{type:"button",className:"bre-search-clear",title:t("modelSearchClear"),"aria-label":t("modelSearchClear"),onClick:m},(0,ae.createElement)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,ae.createElement)("path",{d:"M4 4L12 12M12 4L4 12",strokeLinecap:"round"}))):null),u?(0,ae.createElement)("div",{className:"bre-search-empty",role:"status"},t("modelSearchNoMatches")):null)}var Tr=require("react"),bs=require("react-dom"),ys=require("react-dom/client");function We(){return document.body}function ot(e,t,n){let r=(0,ys.createRoot)(e);return n?.sync===!0?(0,bs.flushSync)(()=>{r.render(t)}):r.render(t),{wrapper:e,root:r}}function Ce(e){e!==void 0&&(e.root.unmount(),e.wrapper.remove())}var qe=class extends Tr.Component{constructor(){super(...arguments);Fe(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,Tr.createElement)("div",{style:{color:"#c00",fontSize:"11px",whiteSpace:"pre-wrap",padding:"6px"}},`${this.props.fallbackText}: ${this.state.error}`):this.props.children}};var wf="conversation.input.model";function ws(e){return e.querySelector("[data-composer-card]")??void 0}function ti(e){return e.querySelector(`[data-slot="${wf}"]`)??void 0}function vs(e){let t=ti(e)??e;return Array.from(t.querySelectorAll('button[aria-haspopup="menu"]'))}function ni(e){if(e==null)return!1;let t=e.getAttribute("role");return t==="menu"||t==="group"}function ri(e){return e.getAttribute("role")==="group"}function xs(e,t){let n=e.getAttribute("aria-controls");if(n===null||n.length===0)return;let r=t.getElementById(n);return ni(r)?r:void 0}function oi(e=document){let t=ws(e);if(t===void 0)return;for(let r of vs(t)){let o=xs(r,e);if(o!==void 0)return o}let n=ti(t)??t;for(let r of Array.from(n.querySelectorAll('[role="menu"], [role="group"]')))if(r.previousElementSibling?.matches('button[aria-haspopup="menu"]')&&ni(r)&&!(r.getAttribute("role")==="group"&&r.querySelector('[role="menuitemradio"], section[role="group"]')===null))return r}function ii(e=document){let t=ws(e);if(t===void 0)return;let n=ti(t),r=vs(t),o=r[0];if(o!==void 0){for(let i of r)if(xs(i,e)!==void 0)return i;for(let i of r)if(ni(i.nextElementSibling))return i;return n===void 0?r.at(-1):o}}function ks(){return oi()}function Es(){return ii()}var vf=()=>{(0,Ts.flushSync)(()=>{window.dispatchEvent(new Event("resize"))})};function Ms(e){let{menuOf:t,triggerOf:n,t:r,refreshed:o,sliderEnabled:i,directory:a}=e,s,d,l,f,m,u,c,p,b=()=>{p?.removeAttribute("data-bre-provider"),p=void 0},h=()=>{let T=n();p!==void 0&&p!==T&&b();let R=u?.store.getSnapshot(),N=R?.current;if(T===void 0||N===null||N===void 0){T===p&&b();return}let B=R?.groups.find(U=>U.id===N.provider),O=B===void 0?N.provider:ft(B);if(O.trim()===""){T===p&&b();return}T.dataset.breProvider=O,p=T},x=()=>{let T=a();T!==u&&(c?.(),c=void 0,u=T,T!==void 0&&(c=T.store.subscribe(h))),h()},S=()=>{Ce(l),l=void 0},v=new Map,P=()=>{for(let[T,R]of v)T.style.display=R;v.clear()},D=T=>T.getAttribute("aria-hidden")!=="true"||T.childElementCount>0?!1:(T.textContent??"").trim()==="",z=(T,R)=>{for(let O of Array.from(v.keys()))(!O.isConnected||O.parentElement!==T)&&v.delete(O);let N=[];for(let O of Array.from(T.children))O!==R&&(D(O)||N.push(O));let B=document.activeElement;B!==null&&B!==R&&!R.contains(B)&&N.some(O=>O.contains(B))&&(T.tabIndex=-1,T.focus({preventScroll:!0}));for(let O of N)v.has(O)||v.set(O,O.style.display),O.style.display!=="none"&&(O.style.display="none")},oe=T=>{let R=T.querySelector('section[role="group"]'),N=R?.parentElement,B=N!=null&&N.parentElement===T?N:R;if(l===void 0){let O=document.createElement("div");O.dataset.plugin=pe,O.dataset.breSearch="1",T.insertBefore(O,B),l=ot(O,(0,yn.createElement)(qe,{fallbackText:r("modelSearchFailed"),children:o(()=>(0,yn.createElement)(gs,{menu:T,t:r}))}),{sync:!0});return}if(l.wrapper.parentElement!==T){T.insertBefore(l.wrapper,B);return}B!==null&&l.wrapper.nextSibling!==B&&T.insertBefore(l.wrapper,B)},k=T=>{if(!i()){Ce(s),s=void 0,d=void 0,T.classList.remove("bre-model-menu-host"),P();for(let U of Array.from(T.children))U.getAttribute("role")==="menuitem"&&(U.style.display="");return}let R=a();if(R===void 0)return;if(s!==void 0&&d!==R&&(Ce(s),s=void 0,d=void 0),s===void 0){d=R;let U=document.createElement("div");U.dataset.plugin=pe,U.dataset.breSlider="1",T.insertBefore(U,T.firstChild),s=ot(U,(0,yn.createElement)(qe,{fallbackText:r("renderFailed"),children:o(()=>(0,yn.createElement)(fs,{directory:R,configuredInputs:e.configuredInputs,t:r}))}),{sync:!0})}else(s.wrapper.parentElement!==T||T.firstChild!==s.wrapper)&&T.insertBefore(s.wrapper,T.firstChild);T.classList.add("bre-model-menu-host");let N=Array.from(T.children).filter(U=>U.getAttribute("role")==="menuitem"),B=s.wrapper;if(ri(T)){B.style.display="",z(T,B);return}if(P(),Array.from(T.querySelectorAll('[role="menuitemradio"]')).some(U=>!B.contains(U)))s.wrapper.contains(document.activeElement)&&(T.tabIndex=-1,T.focus({preventScroll:!0})),s.wrapper.style.display="none";else{s.wrapper.style.display="";for(let U of N)U.style.display="none"}};return{reconcile:()=>{x();let T=t();if(T===void 0){s!==void 0&&(i()?s.wrapper.remove():(Ce(s),s=void 0,d=void 0)),S(),f=void 0,m=void 0,P();return}let R=ri(T),N=R&&i(),B=!R&&hs(T);B?oe(T):S(),k(T),(B!==f||N!==m)&&(f=B,m=N,(B||N||i())&&vf())},dispose:()=>{c?.(),c=void 0,u=void 0,b(),Ce(s),s=void 0,d=void 0,S(),P(),f=void 0,m=void 0}}}var xf=350;function Ss(e){let t,n,r=0,o=()=>{if(t!==void 0)return Promise.resolve();let s=r;return n??(n=ne(e.api).then(d=>{if(d.namespace===void 0){n=void 0;return}let l=new Map;for(let[f,m]of Object.entries(ke(d.namespace))){let u=Array.isArray(m.models)?m.models:[];for(let c of u){if(typeof c!="object"||c===null||Array.isArray(c))continue;let p=c.id,b=c[Ft];typeof p=="string"&&typeof b=="string"&&b.length>0&&l.set(`${f}/${p}`,b)}}s===r?t=l:n=void 0}).catch(()=>{s===r&&(n=void 0)})),n};return{of:async(s,d)=>{if(t===void 0){let l=o();await new Promise(f=>{let m=!1,u=()=>{m||(m=!0,f())},c=setTimeout(u,xf);l.then(()=>{clearTimeout(c),u()},()=>{clearTimeout(c),u()})})}return t?.get(`${s}/${d}`)},invalidate:()=>{r+=1,t=void 0,n=void 0}}}function kf(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(!K(e))return;let a={};for(let s of Object.keys(e)){if(!t(s))continue;let d=e[s],l=K(d)&&Array.isArray(d.models)?d.models:void 0;if(l===void 0||l.length===0||!l.every(K))continue;let f=l,m=[],u=!1;for(let c of f){let p=c.reasoningEfforts!==void 0||c[Ae]===!0,b=kf(c)||c[rt]===!0;if((p||!o)&&(b||!i)){let z=Ef(c,e,s);z!==void 0?(u=!0,m.push(z)):m.push(c);continue}let h=typeof c.id=="string"?c.id:"";if(h.length===0){m.push(c);continue}let x=kt(e,s),S=typeof c.name=="string"?c.name:void 0,v=$e(h,{...x,displayName:S??x.displayName});if(v.efforts===void 0){m.push(c);continue}let P={...c},D=!1;if(!p&&o&&(D=!0,P.reasoningEfforts=v.efforts,P[_t]=r,v.compat!==void 0)){let z=K(c.compat)?c.compat:{};P.compat={...z,...v.compat}}if(!b&&i&&v.input!==void 0&&(D=!0,P.input=[...v.input]),!D){m.push(c);continue}u=!0,m.push(P)}u&&(a[s]={models:m})}return Object.keys(a).length===0?void 0:{providers:a}}function Ef(e,t,n){if(!K(e.reasoningEfforts)||e[Ae]===!0)return;let r=e.compat,o=K(r)?{...r}:{};if(o.supportsDeveloperRole===void 0&&Uo(kt(t,n)))return{...e,compat:{...o,supportsDeveloperRole:!1}}}function Ls(e){let t,n=0,r=()=>{if(t!==void 0)return t;let i=(async()=>{try{let a=await fetch(xa,{method:"GET"});if(!a.ok)return;let s=await a.json();return s?.ok!==!0?void 0:{autofill:s.data?.autofill!==!1,modalityAutofill:s.data?.modalityAutofill!==!1}}catch{return}})().then(a=>(a===void 0&&t===i&&(t=void 0),a??{autofill:!0,modalityAutofill:!0}));return t=i,i},o=async()=>{let i=n;try{let a=await r();if(i!==n||!a.autofill)return;let s=await ne(e.api),d=s.namespace;if(i!==n||d===void 0||s.writable!==!0)return;let l=gr(d);if(l===void 0||ai(l,()=>!0,{modalities:a.modalityAutofill},d.revision)===void 0)return;let m=s.source==="scope"?await ne(e.api,{fresh:!0}):s,u=m.namespace;if(i!==n||u===void 0||m.writable!==!0)return;let c=gr(u);if(c===void 0)return;let p=ai(c,()=>!0,{modalities:a.modalityAutofill},u.revision);if(p===void 0)return;let b=p.providers,h=Object.entries(b).map(([S,v])=>({op:"set",path:["providers",S,"models"],value:v.models})),x=await e.api.settings.mutate(xe,h,u.revision);x.ok||console.error(`[bre] idle autofill refused: ${x.error.message}`)}catch(a){console.error(`[bre] idle autofill failed: ${a instanceof Error?a.message:String(a)}`)}};return{run:()=>{o()},invalidate:()=>{n+=1,t=void 0}}}var ua=require("react"),tu=require("react-dom"),nu=require("react-dom/client");var Y=require("react");var pt=Ja;function Et(e){let t={};for(let n of pt){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 Ut(e){let t=!1,n=!1,r={};for(let o of pt){let i=e[o];if(!i.on)continue;if(o==="off"){t=!0;let s=i.wire.trim();r.off=s.length===0?null:s;continue}n=!0;let a=i.wire.trim();r[o]=a.length===0?o:a}return n?r:t?!1:void 0}function wn(e,t){if(e===t)return!0;if(e===!1||e===void 0||t===!1||t===void 0)return!1;let n=pt.filter(o=>e[o]!==void 0),r=pt.filter(o=>t[o]!==void 0);return n.length!==r.length?!1:n.every(o=>e[o]===t[o])}function As(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 si="bre:auto-effort",Rs=Promise.resolve();function Hs(e){Rs=Rs.then(e,e).then(()=>{},()=>{})}function Cs(e,t=document){t.dispatchEvent(new CustomEvent(si,{detail:{route:e}}))}function Os(e,t=document){let n=r=>{let o=r.detail;typeof o?.route!="string"||o.route.length===0||e(o.route)};return t.addEventListener(si,n),()=>{t.removeEventListener(si,n)}}var Tf=new Intl.NumberFormat("en-US"),Mf=/^(\d+(?:\.\d+)?)([km])?$/i;function Ve(e){let t=e.replace(/[,_\s]/g,"");if(t==="")return;let n=Mf.exec(t);if(n===null)return;let r=n[2]===void 0?1:n[2].toLowerCase()==="m"?1e6:1e3,o=Math.round(Number(n[1])*r);return Number.isFinite(o)&&o>0?o:void 0}function Be(e){return e===void 0?"":Tf.format(e)}var A=require("react/jsx-runtime"),Sf=["M3.4 4.2h9.2","M8 4.2v8.2","M5.9 12.4h4.2"],Lf=["M4.4 3.4h7.2a1.9 1.9 0 0 1 1.9 1.9v5.4a1.9 1.9 0 0 1-1.9 1.9H4.4a1.9 1.9 0 0 1-1.9-1.9V5.3a1.9 1.9 0 0 1 1.9-1.9Z","M6.2 7.2a.9.9 0 1 0 0-1.8.9.9 0 0 0 0 1.8Z","M2.9 11.2 6.1 8.4l2.1 1.9 1.8-1.5 2.7 2.4"],Af=["M8 3.2 13.6 12.8H2.4L8 3.2Z","M8 6.9v2.5","M8 11.3h.01"],Rf=["M8 2.6 9.1 6.4 12.9 7.5 9.1 8.6 8 12.4 6.9 8.6 3.1 7.5 6.9 6.4Z","M12.3 2.4v1.9M11.35 3.35h1.9"],Hf=["M4.5 6.5 8 10 11.5 6.5"],Cf=["M6.5 4.5 10 8 6.5 11.5"];function vn({paths:e}){return(0,A.jsx)("svg",{viewBox:"0 0 16 16",width:12,height:12,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.map(t=>(0,A.jsx)("path",{d:t},t))})}function Tt(e){return e===void 0||e.length===0?{declared:!1,image:!1}:{declared:!0,image:e.includes("image")}}function Sr(e){return e.declared?e.image?["text","image"]:["text"]:null}function Mr(e,t){return e.declared?t===void 0?!1:e.image?t.includes("image"):!t.includes("image"):t===void 0}function di(e,t,n){let r=e?t:!1;return e&&r===void 0&&n===void 0?"keep":r}function Lr(e){let t=e.appliedCompat;return e.initialCompat?.supportsThinkingTokenBudget===!0&&e.initialCompat?.thinkingTokenBudgetField===void 0&&t?.thinkingTokenBudgetField===void 0&&(e.routeApi??"").toLowerCase()==="openai-completions"&&(t={...t??{},thinkingTokenBudgetField:"thinking_token_budget"}),{efforts:e.efforts,...t===void 0?{}:{compat:t},...e.input===void 0?{}:{input:e.input},...e.defaultEffort===void 0?{}:{defaultEffort:e.defaultEffort}}}function Ar({route:e,routeApi:t,routeBaseURL:n,modelId:r,modelName:o,efforts:i,effortsUnset:a=!1,input:s,compat:d,defaultEffort:l,index:f,staged:m=!1,officialInputTypes:u=!1,onCoverageChange:c,api:p,readOnly:b,t:h}){let[x,S]=(0,Y.useState)(()=>Et(i)),[v,P]=(0,Y.useState)(()=>Tt(s)),[D,z]=(0,Y.useState)(()=>i!==!1),oe=(0,Y.useRef)(c);oe.current=c,(0,Y.useEffect)(()=>{oe.current?.(D)},[D]);let[k,M]=(0,Y.useState)(()=>l??""),[W,T]=(0,Y.useState)(!1),[R,N]=(0,Y.useState)(void 0),[B,O]=(0,Y.useState)(void 0),[U,X]=(0,Y.useState)(""),[ce,j]=(0,Y.useState)("low"),[re,J]=(0,Y.useState)(()=>pt.some(w=>x[w].on&&x[w].wire.trim()!==(w==="off"?"":w))),$=(0,Y.useRef)(void 0),[de,fe]=(0,Y.useState)(void 0),F=(0,Y.useRef)(void 0);F.current===void 0&&(F.current=p.readCapacities?.()??{});let[G,g]=(0,Y.useState)(()=>Be(F.current?.contextWindow)),[L,_]=(0,Y.useState)(()=>Be(F.current?.maxTokens)),[V,Q]=(0,Y.useState)(void 0),ie=(0,Y.useRef)(!1),me=(0,Y.useRef)(i),Se=(0,Y.useRef)(s),Le=(0,Y.useRef)(l),tt=(0,Y.useRef)(void 0),Pt=(0,Y.useRef)(i);Pt.current=i;let Vn=(0,Y.useRef)(a);Vn.current=a,(0,Y.useEffect)(()=>Os(w=>{if(w!==e||Pt.current!==void 0||Vn.current)return;let Z=tt.current;Z!==void 0&&Hs(Z)}),[e]),(0,Y.useEffect)(()=>{wn(me.current,i)||(me.current=i,ie.current||(S(Et(i)),z(i!==!1))),Se.current!==s&&(Se.current=s,ie.current||P(Tt(s))),Le.current!==l&&(Le.current=l,ie.current||M(l??""))},[i,s,l]);let ve=pt.filter(w=>x[w].on),Eo=k===(l??"")?void 0:k===""?null:k,ze=D?Ut(x):!1,Dt=!wn(ze,i)||!Mr(v,s)||Eo!==void 0,yt=(0,Y.useRef)(void 0),_e=()=>{ie.current=!0,O(void 0),X(""),j("low"),fe(void 0)},nt=(w,Z,ue,ye=D)=>{let wt=di(ye,Ut(w),i),tr=Mr(Z,s)?void 0:Sr(Z),ga=Lr({efforts:wt,input:tr,defaultEffort:ue===(l??"")?void 0:ue===""?null:ue,appliedCompat:$.current,routeApi:t,initialCompat:d}),ba=JSON.stringify(ga);yt.current!==ba&&(yt.current=ba,p.commit(e,r,ga))},Yn=(w,Z)=>{_e();let ue=!Z&&k===w?"":k;ue!==k&&M(ue);let ye={...x,[w]:{...x[w],on:Z}};Z&&w!=="off"&&ye[w].wire.trim().length===0&&(ye[w]={...ye[w],wire:w}),S(ye),nt(ye,v,ue),N(void 0)},Xn=w=>{_e(),z(w);let Z=w?k:"";Z!==k&&M(Z),nt(x,v,Z,w),N(void 0)},To=(w,Z)=>{_e();let ue={...x,[w]:{...x[w],wire:Z}};S(ue),nt(ue,v,k),N(void 0)},Jn=w=>{_e();let Z={declared:!0,image:w};P(Z),nt(x,Z,k),N(void 0)},Qn=()=>{_e();let w={declared:!1,image:!1};P(w),nt(x,w,k),N(void 0)},Mo=w=>{_e(),M(w),nt(x,v,w),N(void 0)},cn=(w,Z)=>{let ue=Z.slice(0,20),ye=w==="context"?ue:G,wt=w==="output"?ue:L;Q(w),w==="context"?g(ue):_(ue),p.setCapacities?.({contextWindow:Ve(ye),maxTokens:Ve(wt)})},It=w=>{w==="context"?g(Z=>Be(Ve(Z))):_(Z=>Be(Ve(Z))),Q(void 0)},un=w=>{_e();let Z=w.efforts!==!1;z(Z);let ue=Et(w.efforts);S(ue);let ye=w.input===void 0?v:Tt(w.input);w.input!==void 0&&P(ye);let wt=k===""&&w.defaultEffort!==void 0?w.defaultEffort:k;if(wt!==k&&M(wt),O(w.efforts),X(w.source),j(w.confidence),$.current=w.compat,fe(w.inputSource),w.contextWindow!==void 0||w.maxTokens!==void 0){p.fillCapacities?.(w.contextWindow,w.maxTokens);let tr=p.readCapacities?.();g(Be(tr?.contextWindow)),_(Be(tr?.maxTokens))}N({kind:"info",text:h("appliedHint",{source:w.source,confidence:h("confidence_"+w.confidence)})}),nt(ue,ye,wt,Z)},Zn=async()=>{if(!(b||W)){T(!0),N(void 0);try{let w=m?await p.suggest(e,r,o,{...t===void 0?{}:{api:t},...n===void 0?{}:{baseURL:n}}):await p.suggest(e,r,o);if(!w.ok){N({kind:"error",text:w.error==="no-suggestion"?h("noSuggestion"):w.error});return}un(w.suggestion)}catch(w){N({kind:"error",text:h("writeError",{message:String(w)})})}finally{T(!1)}}};(0,Y.useEffect)(()=>{tt.current=Zn});let So=()=>{ie.current=!1,p.withdraw(e,r),S(Et(i)),z(i!==!1),P(Tt(s)),M(l??""),O(void 0),X(""),j("low"),$.current=void 0,fe(void 0);let w=F.current??{};g(Be(w.contextWindow)),_(Be(w.maxTokens)),Q(void 0),p.setCapacities?.({contextWindow:w.contextWindow,maxTokens:w.maxTokens}),N(void 0),yt.current=void 0},Lo=(0,Y.useMemo)(()=>$e(r,{...t===void 0?{}:{api:t},...n===void 0?{}:{baseURL:n}}).compat?.thinkingFormat,[r,t,n]),Ao=$.current?.thinkingFormat??Lo,er=As(i,Ao),y=b||W,H=D?ve.length===0?h("stateUndeclared"):h("stateDeclared",{count:ve.length,default:h(k===""?"defaultEffortUnset":"level_"+k)}):h("thinkingModeOff"),te=k!==""&&!ve.includes(k)?[...ve,k]:ve,he=Ve(G),ge=Ve(L),je=he!==void 0&&ge!==void 0&&ge>he;return(0,A.jsxs)("div",{className:"bre-effort-editor","data-plugin":pe,children:[(0,A.jsxs)("div",{className:"bre-effort-top",children:[(0,A.jsxs)("label",{className:"bre-thinking-switch",children:[(0,A.jsx)("input",{type:"checkbox",checked:D,disabled:y,"aria-label":h("thinkingMode")+" "+String(f+1),onChange:w=>{Xn(w.target.checked)}}),(0,A.jsx)("span",{className:"bre-effort-switch-track","aria-hidden":"true"}),(0,A.jsx)("span",{className:"bre-effort-title",children:h("thinkingMode")})]}),(0,A.jsx)("span",{className:"bre-effort-state",children:H}),B===void 0?null:(0,A.jsx)("span",{className:"bre-effort-suggest",role:"status",children:h("appliedHint",{source:U,confidence:h("confidence_"+ce)})})]}),D?(0,A.jsxs)("div",{className:"bre-effort-card",children:[(0,A.jsxs)("div",{className:"bre-effort-sec",children:[(0,A.jsxs)("div",{className:"bre-effort-labelrow",children:[(0,A.jsx)("span",{className:"bre-effort-label",children:h("levelsLabel")}),(0,A.jsx)("span",{className:"bre-effort-grow"}),(0,A.jsxs)("button",{type:"button",className:"bre-effort-adapt",disabled:y,onClick:()=>{Zn()},children:[(0,A.jsx)(vn,{paths:Rf}),h("autoAdapt")]})]}),(0,A.jsx)("p",{className:"bre-effort-hint",children:h("levelsHint")}),(0,A.jsx)("div",{className:"bre-pillrow",role:"group","aria-label":h("levelsLabel"),children:pt.map(w=>{let Z=x[w];return(0,A.jsx)("button",{type:"button",className:Z.on?"bre-lvl is-on":"bre-lvl",disabled:y,"aria-pressed":Z.on,"aria-label":h("level_"+w)+" "+String(f+1),title:h("level_"+w),onClick:()=>{Yn(w,!Z.on)},children:h("level_"+w)},w)})}),ve.length===0?null:(0,A.jsxs)("button",{type:"button",className:"bre-effort-wiretoggle",disabled:y,"aria-expanded":re,onClick:()=>{J(!re)},children:[(0,A.jsx)(vn,{paths:re?Hf:Cf}),h(re?"wireHide":"wireShow")]}),ve.length===0||!re?null:(0,A.jsxs)("div",{className:"bre-wire",children:[(0,A.jsx)("div",{className:"bre-wire-grid",children:ve.map(w=>(0,A.jsxs)(Y.Fragment,{children:[(0,A.jsx)("span",{className:"bre-wire-name",children:h("level_"+w)}),(0,A.jsx)("input",{type:"text",className:"bre-effort-wire",value:x[w].wire,disabled:y,placeholder:h("wirePlaceholder"),"aria-label":h("level_"+w)+" "+h("wireValue"),onChange:Z=>{To(w,Z.target.value)}})]},w))}),(0,A.jsx)("p",{className:"bre-effort-note",children:h("wireHint")})]})]}),(0,A.jsxs)("div",{className:"bre-effort-cols",children:[ve.length===0?null:(0,A.jsxs)("div",{className:"bre-effort-sec",children:[(0,A.jsx)("span",{className:"bre-effort-label",children:h("defaultEffortLabel")}),(0,A.jsxs)("select",{className:"bre-effort-select",value:k,disabled:y,"aria-label":h("defaultEffortLabel"),onChange:w=>{Mo(w.target.value)},children:[(0,A.jsx)("option",{value:"",children:h("followMemory")}),te.map(w=>(0,A.jsx)("option",{value:w,children:h("level_"+w)},w))]}),(0,A.jsx)("p",{className:"bre-effort-note",children:h("defaultEffortHint")})]}),(0,A.jsxs)("div",{className:"bre-effort-sec",children:[(0,A.jsx)("span",{className:"bre-effort-label",children:h("inputModality")}),(0,A.jsxs)("div",{className:"bre-pillrow",role:"group","aria-label":h("inputModality"),children:[(0,A.jsxs)("button",{type:"button",className:v.declared?"bre-lvl bre-lvl--opt is-on":"bre-lvl bre-lvl--opt",disabled:y,"aria-pressed":v.declared,"aria-label":h("modalityText")+" "+String(f+1),title:h("modalityText"),onClick:()=>{v.declared?Qn():Jn(!1)},children:[(0,A.jsx)(vn,{paths:Sf}),h("modalityText")]}),(0,A.jsxs)("button",{type:"button",className:v.declared&&v.image?"bre-lvl bre-lvl--opt is-on":"bre-lvl bre-lvl--opt",disabled:y,"aria-pressed":v.declared&&v.image,"aria-label":h("modalityImage")+" "+String(f+1),title:h("modalityImage"),onClick:()=>{Jn(!(v.declared&&v.image))},children:[(0,A.jsx)(vn,{paths:Lf}),h("modalityImage")]})]}),(0,A.jsx)("p",{className:"bre-effort-note",children:v.declared?h("modalityDeclared"):h("modalityInherit")})]})]}),(0,A.jsx)("span",{className:"bre-effort-sep"}),m?(0,A.jsx)("p",{className:"bre-effort-note",children:h("stagedHint")}):null,je?(0,A.jsxs)("p",{className:"bre-effort-note bre-warn",children:[(0,A.jsx)(vn,{paths:Af}),h("capacityRule")]}):null,i===!1?(0,A.jsx)("p",{className:"bre-effort-note",children:h("reasoningDisabled")}):null,er===void 0?null:(0,A.jsx)("p",{className:"bre-effort-note",children:h(er==="thinking-disabled"?"defaultRiskDisabled":"defaultRiskQwen")}),Ut(x)===void 0&&i!==void 0?(0,A.jsx)("p",{className:"bre-effort-note",children:h("bareHint")}):null,(0,A.jsxs)("div",{className:"bre-effort-cols",children:[(0,A.jsxs)("div",{className:"bre-effort-sec",children:[(0,A.jsx)("span",{className:"bre-effort-label",children:h("contextWindowLabel")}),(0,A.jsxs)("span",{className:"bre-cap-box",children:[(0,A.jsx)("input",{type:"text",inputMode:"text",className:"bre-cap-input",value:V==="context"?G:Be(he),disabled:y,placeholder:h("capacityBlank"),"aria-label":h("contextWindowLabel")+" "+String(f+1),onFocus:()=>{Q("context")},onBlur:()=>{It("context")},onChange:w=>{cn("context",w.target.value)}}),(0,A.jsx)("span",{className:"bre-cap-unit",children:h("tokensUnit")})]}),(0,A.jsx)("p",{className:"bre-effort-note",children:h("capacityInherit")})]}),(0,A.jsxs)("div",{className:"bre-effort-sec",children:[(0,A.jsx)("span",{className:"bre-effort-label",children:h("maxTokensLabel")}),(0,A.jsxs)("span",{className:"bre-cap-box",children:[(0,A.jsx)("input",{type:"text",inputMode:"text",className:"bre-cap-input",value:V==="output"?L:Be(ge),disabled:y,placeholder:h("capacityBlank"),"aria-label":h("maxTokensLabel")+" "+String(f+1),onFocus:()=>{Q("output")},onBlur:()=>{It("output")},onChange:w=>{cn("output",w.target.value)}}),(0,A.jsx)("span",{className:"bre-cap-unit",children:h("tokensUnit")})]}),(0,A.jsx)("p",{className:"bre-effort-note",children:h("capacityUnitsHint")})]})]}),B===void 0?null:(0,A.jsx)("div",{className:"bre-suggestion",children:de===void 0?null:(0,A.jsx)("p",{className:"bre-effort-note",children:h(de==="endpoint"?"inputHintEndpoint":de==="knowledge"?"inputHintKnowledge":"inputHintHeuristic")})}),R===void 0?null:(0,A.jsx)("p",{className:"bre-effort-message bre-"+R.kind,role:R.kind==="error"?"alert":"status",children:R.text}),Dt?(0,A.jsx)("p",{className:"bre-effort-message bre-info",role:"status",children:h("pendingSave")}):null,Dt?(0,A.jsx)("p",{className:"bre-effort-note",children:h("pendingHint")}):null,(0,A.jsx)("div",{className:"bre-effort-actions",children:(0,A.jsx)("button",{type:"button",className:"bre-secondary-button",disabled:y||!Dt,onClick:So,children:h("reset")})})]}):null]})}function ee(e,t,n){e.getAttribute(t)!==n&&e.setAttribute(t,n)}function Ge(e,t){e!==void 0&&e.hidden!==t&&(e.hidden=t)}function be(e,t,n){e.classList.contains(t)!==n&&(n?e.classList.add(t):e.classList.remove(t))}function xn(e,t){e!==void 0&&e.textContent!==t&&(e.textContent=t)}var mt="data-bre-auto-effort",li='[class*="modelCatalog"]',Of='[class*="modelListHead"]',Nf='button[class*="linkButton"]',Pf="bre-auto-effort",Df="bre-auto-effort-note",If="data-bre-auto-effort-phase",Ps="bre-auto-effort-note-text",Ds="bre-auto-effort-note-detail",_f=3e3;function Ff(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 ci(e){return Array.from(e.querySelectorAll(li)).filter(t=>(t.parentElement?.closest(li)??null)===null)}function Rr(e,t,n){let r=new Map;for(let s of t)s.route.length!==0&&s.catalogue.isConnected&&r.set(s.catalogue,s.route);let o=n.t("autoAdaptAll");for(let[s,d]of r){let l=s.querySelector(Of)??s,f=l.querySelector(`[${mt}]`)??qf();_s.set(f,n);let m=Kf(l);m!==null?m.nextElementSibling!==f&&m.after(f):l.lastElementChild!==f&&l.append(f),Uf(f,d,o)}let i=new Set,a=new Set(r.values());for(let s of Array.from(e.querySelectorAll(`[${mt}]`))){let d=s.closest(li),l=s.getAttribute(mt)??"";if(d===null||!r.has(d)||i.has(d)){s.remove(),l.length>0&&!a.has(l)&&ui(l);continue}i.add(d)}}function ui(e){let t=Mt.get(e);t!==void 0&&(t.timer!==null&&clearTimeout(t.timer),t.note.remove(),Mt.delete(e))}function Is(){for(let e of Array.from(document.querySelectorAll(`[${mt}]`)))e.remove();for(let e of Mt.values())e.timer!==null&&clearTimeout(e.timer),e.note.remove();Mt.clear()}function Kf(e){let t=Array.from(e.querySelectorAll(Nf));return t.length===0?null:t[t.length-1]}function qf(){let e=document.createElement("button");return e.className=Pf,e.setAttribute("type","button"),e.setAttribute(mt,""),e.addEventListener("click",()=>{let t=e.getAttribute(mt)??"";if(t.length===0)return;let n=_s.get(e);n!==void 0&&(Cs(t),Wf(t,n))}),e}async function Wf(e,t){if(t.onRequest===void 0)return;Ns(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){ui(e);return}let r=Ff(n);r!==null&&Ns(e,r,t,_f)}function Ns(e,t,n,r){let o=Mt.get(e);o!==void 0&&!o.note.isConnected&&(o.timer!==null&&clearTimeout(o.timer),Mt.delete(e),o=void 0),o!==void 0&&o.timer!==null&&clearTimeout(o.timer);let i=o?.note??Bf();i.setAttribute(If,t.phase);let a=i.querySelector(`.${Ps}`),s=i.querySelector(`.${Ds}`),d=Gf(t,n);a.textContent!==d.text&&(a.textContent=d.text),s.textContent!==d.detail&&(s.textContent=d.detail),Ge(s,d.detail.length===0),o===void 0&&document.body.append(i);let l=r>0?setTimeout(()=>{ui(e)},r):null;i.style.setProperty("--bre-note-hold",`${r}ms`),Mt.set(e,{note:i,timer:l})}function Bf(){let e=document.createElement("div");return e.className=Df,e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.innerHTML=`<span class="${Ps}"></span><span class="${Ds}"></span>`,e}var _s=new WeakMap,Mt=new Map;function Gf(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 Uf(e,t,n){e.getAttribute(mt)!==t&&e.setAttribute(mt,t),e.textContent!==n&&(e.textContent=n),e.getAttribute("title")!==null&&e.removeAttribute("title")}var kn="data-bre-drag-handle",fi="data-bre-row-head",pi="data-bre-drop-side",Hr="bre-row-dragging",Cr="bre-row-drop-target",Gs="bre-drag-ghost",Us="bre-drop-line",Fs="http://www.w3.org/2000/svg",Ks=8,qs=28,Ws=12,zf="transform 180ms cubic-bezier(0.2, 0.7, 0.3, 1)",jf='button, a, input, textarea, select, [contenteditable], [role="button"], [role="switch"], [role="checkbox"], [role="textbox"], [role="combobox"]';function Or(){return{sources:new WeakSet,lists:new WeakSet,line:void 0,sighted:new WeakMap,drag:void 0}}function we(e){return Array.from(e.children).filter(t=>t instanceof HTMLElement)}function $f(e,t){let n=e.style.order;if(n==="")return t;let r=Number.parseInt(n,10);return Number.isNaN(r)?t:r}function St(e){return we(e).map((t,n)=>({row:t,key:$f(t,n),index:n})).sort((t,n)=>t.key-n.key||t.index-n.index).map(t=>t.row)}function zs(e,t){let n=e.filter(a=>t.includes(a)),r=n.map(a=>e.indexOf(a)),o=t.filter(a=>n.includes(a)),i=new Map;e.forEach((a,s)=>i.set(a,s)),r.forEach((a,s)=>{let d=o[s];d!==void 0&&i.set(d,a)});for(let[a,s]of i){let d=String(s);a.style.order!==d&&(a.style.order=d)}}function Nr(e,t){zs(St(e),t)}function mi(e,t){let n=we(e),r=n.map(o=>o.offsetTop);t(),n.forEach((o,i)=>{let a=r[i]-o.offsetTop;a!==0&&(o.style.transition="none",o.style.transform=`translateY(${a}px)`,o.offsetHeight,o.style.transition=zf,o.style.transform="")})}function En(e,t){return St(e).map(n=>t(n)).filter(n=>n!==void 0)}function Vf(e,t,n){let r=En(e,t);if(n===void 0||!Yf(e,n))return r;let o=new Map;return n.ids.forEach((i,a)=>{o.has(i)||o.set(i,a)}),r.map((i,a)=>({id:i,key:o.get(i)??n.ids.length+a})).sort((i,a)=>i.key-a.key).map(i=>i.id)}function Yf(e,t){return t.rows.some(n=>!e.contains(n))}function Xf(e,t){let n=[];for(let o of St(e)){let i=t(o);i!==void 0&&n.push(i)}let r=[];for(let o of we(e))t(o)!==void 0&&r.push(o);return{ids:n,rows:r}}function js(e,t,n){let r=new Map;for(let[s,d]of t.entries())r.has(d)||r.set(d,s);let o=we(e),a=[...o.filter(s=>n(s)!==void 0)].sort((s,d)=>{let l=r.get(n(s))??Number.MAX_SAFE_INTEGER,f=r.get(n(d))??Number.MAX_SAFE_INTEGER;return l-f});zs(o,a)}function Pr(e){for(let t of e)t.style.order="",t.style.transition="",t.style.transform=""}function $s(e,t,n,r){let i=e.filter(a=>a!==t).indexOf(n);return i<0?Math.max(0,e.indexOf(t)):r?i+1:i}function Vs(e,t){let n,r=Number.POSITIVE_INFINITY;for(let o of e){let i=o.getBoundingClientRect(),a=t<i.top?i.top-t:t>i.bottom?t-i.bottom:0;a<r&&(r=a,n=o)}return n}function Jf(e,t){let n=e.getBoundingClientRect();return n.height<=0?!0:t>n.top+n.height/2}function Ys(e,t){let n=e.getBoundingClientRect();return t?n.bottom+Ks/2-1:n.top-Ks/2-1}function Xs(){let e=document.createElementNS(Fs,"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(Fs,"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 Js(e,t){let n=document.createElement("div");n.className=Gs,n.setAttribute("aria-hidden","true"),n.appendChild(Xs());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 Qf(e){return!(e instanceof Element)||e.closest(`[${kn}]`)!==null?!1:e.closest(jf)!==null}function Qs(e){return e.parentElement??void 0}function Zs(e){for(let t of we(e))t.classList.remove(Cr),t.removeAttribute(pi)}function Dr(e){let t=e.parentElement;for(;t!==null;){if(ed(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;)ed(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 ed(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 td(e,t){let n=e.getBoundingClientRect();return n.height<=0?0:t<n.top+qs?-Ws:t>n.bottom-qs?Ws:0}function nd(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 Zf(e){let t=e.line;if(t!==void 0&&t.isConnected)return t;let n=document.createElement("div");return n.className=Us,n.setAttribute("aria-hidden","true"),document.body.appendChild(n),e.line=n,n}function ep(e,t,n){let r=Zf(e),o=t.getBoundingClientRect();r.style.top=`${Ys(t,n)}px`,r.style.left=`${o.left}px`,r.style.width=`${o.width}px`,r.style.display="block",r.setAttribute(pi,n?"after":"before")}function tp(e){e.line!==void 0&&(e.line.style.display="none")}function np(e){let t=e.drag;e.drag=void 0,t!==void 0&&(nd(e,t,0),tp(e),t.row.classList.remove(Hr),Zs(t.list),t.dropped||mi(t.list,()=>{Nr(t.list,t.before)}))}function rp(e,t,n,r){if(Qf(t.target)){t.preventDefault();return}let o=Qs(e),i=n.idOf(e);if(o===void 0||i===void 0){t.preventDefault();return}let a={row:e,list:o,before:St(o),scroller:Dr(o),adapter:n,scrollStep:0,frame:void 0,dropped:!1};r.drag=a,e.classList.add(Hr);let s=Js(e,n.labelOf(e));Number.isFinite(t.clientX)&&Number.isFinite(t.clientY)&&(s.style.left=`${t.clientX}px`,s.style.top=`${t.clientY}px`),document.body.appendChild(s);let d=t.dataTransfer;if(d!=null)try{d.effectAllowed="move",d.setData("text/plain",i),d.setDragImage(s,Math.round(s.offsetWidth/2),Math.round(s.offsetHeight/2))}catch{}window.setTimeout(()=>{s.remove()},0)}function op(e,t,n){let r=n.drag;if(r===void 0||r.list!==e)return;let o=t.target,i=o instanceof Element?r.adapter.rowOf(o,e):void 0,a=St(e),s=i!==void 0&&a.includes(i)?i:Vs(a,t.clientY);if(s===void 0)return;t.preventDefault();let d=t.dataTransfer;d!=null&&(d.dropEffect="move");let l=Jf(s,t.clientY),f=$s(a,r.row,s,l);f!==a.indexOf(r.row)&&mi(e,()=>{Nr(e,Io(a,r.row,f))}),Zs(e),s.classList.add(Cr),s.setAttribute(pi,l?"after":"before"),ep(n,s,l),nd(n,r,r.scroller===void 0?0:td(r.scroller,t.clientY))}function ip(e,t){t.lists.has(e)||(t.lists.add(e),e.addEventListener("dragover",n=>{op(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 ap(e,t,n,r){r.sources.has(e)||(r.sources.add(e),n.seatDrags&&(e.setAttribute(fi,"1"),e.setAttribute("draggable","true")),e.addEventListener("dragstart",o=>{rp(t,o,n,r)}),e.addEventListener("dragend",()=>{np(r)}))}function sp(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=Qs(t);if(i===void 0)return;let a=St(i),s=a.indexOf(t);if(s<0)return;let d=s+(o.key==="ArrowUp"?-1:1);d<0||d>=a.length||(o.preventDefault(),mi(i,()=>{Nr(i,Io(a,t,d))}),n.commit(i),e.focus())})}function Bs(e,t,n,r){let o=r.gripLabel(t,n),i=r.gripHint();e.getAttribute(kn)!==n&&e.setAttribute(kn,n),e.getAttribute("aria-label")!==o&&e.setAttribute("aria-label",o),e.getAttribute("title")!==i&&e.setAttribute("title",i)}function dp(e,t,n,r,o){let i=t.querySelector(`[${kn}]`);if(i!==null){Bs(i,e,n,r);return}r.decorate?.(e,t);let a=document.createElement("span");a.className="bre-drag-grip",a.setAttribute("role","button"),a.setAttribute("tabindex","0"),a.setAttribute("draggable","true"),a.appendChild(Xs()),Bs(a,e,n,r),sp(a,e,r,o),ap(r.seatDrags?t:a,e,r,o),t.insertBefore(a,t.firstChild)}function _r(e,t,n,r){if(!e.isConnected)return;ip(t,r);for(let i of we(t)){let a=n.idOf(i);if(a===void 0)continue;let s=n.seatOf(i);s!==void 0&&dp(i,s,a,n,r)}if(r.drag!==void 0)return;let o=Vf(t,n.idOf,r.sighted.get(t));js(t,n.order(o),n.idOf),r.sighted.set(t,Xf(t,n.idOf))}function Fr(e){e.drag=void 0;for(let t of Array.from(document.querySelectorAll(`[${kn}]`)))t.remove();for(let t of Array.from(document.querySelectorAll(`[${fi}]`)))t.removeAttribute(fi),t.removeAttribute("draggable");for(let t of Array.from(document.querySelectorAll(`.${Hr}, .${Cr}`)))t.classList.remove(Hr,Cr);for(let t of Array.from(document.querySelectorAll(`.${Us}`)))t.remove();for(let t of Array.from(document.querySelectorAll(`.${Gs}`)))t.remove();e.line=void 0}var rd=["openai","anthropic","gemini"];function Kr(e){return e==="anthropic-messages"?"anthropic":e==="google-generative-ai"?"gemini":"openai"}function od(e){return e==="openai-completions"||e==="anthropic-messages"||e==="openai-responses"||e==="google-generative-ai"}var lp=40;function id(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,lp)}function Lt(e){return typeof e=="string"&&/^[\x21-\x7E]+$/.test(e)}var cp=12;function ad(e){return e.length===0?"":e.length<cp?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022":`${e.slice(0,4)}...${e.slice(-4)}`}var Tn="bre:endpoints-changed";function up(e){for(let t of["error","message"]){let n=e[t];if(typeof n=="string"&&n.length>0)return n}}function qr(e){if(!Array.isArray(e))return;let t=[];for(let n of e)typeof n=="string"&&n.length>0&&t.push(n);return t}function fp(e){if(!K(e))return;let t=e.ref;if(typeof t!="string"||t.length===0)return;let n=e.alias,r=e.configured,o=e.masked,i=qr(e.models),a=e.protocol,s=e.rest,d=K(s)&&typeof s.remainingMs=="number"?s.remainingMs:void 0,l=K(s)&&typeof s.failures=="number"?s.failures:void 0;return{ref:t,...typeof n=="string"&&n.length>0?{alias:n}:{},enabled:e.enabled!==!1,configured:typeof r=="boolean"?r:null,...typeof o=="string"&&o.length>0?{masked:o}:{},...i===void 0?{}:{models:i},...od(a)?{protocol:a}:{},...d!==void 0&&d>=0&&l!==void 0?{rest:{remainingMs:d,failures:l}}:{}}}function pp(e){let t=e.entries;if(!Array.isArray(t))return;let n=[];for(let m of t){let u=fp(m);u!==void 0&&n.push(u)}let r=e.route,o=qr(e.models),i=qr(e.mergedModels),a=qr(e.unmergedModels),s=e.endpoints,d=K(s)&&typeof s.openai=="string"?s.openai:null,l=K(s)&&typeof s.anthropic=="string"?s.anthropic:null,f=K(s)&&typeof s.gemini=="string"?s.gemini:null;return{ok:!0,route:typeof r=="string"?r:"",entries:n,...o===void 0?{}:{models:o},...i===void 0?{}:{mergedModels:i},...a===void 0||a.length===0?{}:{unmergedModels:a},endpoints:{openai:d,anthropic:l,gemini:f}}}async function mp(e){let t;try{t=await e.json()}catch{t=void 0}if(!K(t))return{ok:!1};if(t.ok===!0){let r=pp(t);if(r!==void 0)return r}let n=up(t);return n===void 0?{ok:!1}:{ok:!1,error:n}}async function Ye(e,t){let n=`${va}?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 mp(r)}catch{return{ok:!1}}}var Xe={list:e=>Ye(e),add:(e,t,n)=>Ye(e,{op:"add",value:t,...n===void 0?{}:{alias:n}}),rename:(e,t,n)=>Ye(e,{op:"rename",ref:t,...n===void 0?{}:{alias:n}}),remove:(e,t)=>Ye(e,{op:"remove",ref:t}),replace:(e,t,n)=>Ye(e,{op:"value",ref:t,value:n}),setScope:(e,t,n)=>Ye(e,{op:"scope",ref:t,...n===void 0?{}:{models:n}}),setEnabled:(e,t,n)=>Ye(e,{op:"enable",ref:t,enabled:n}),setProtocol:(e,t,n)=>Ye(e,{op:"protocol",ref:t,...n===void 0?{}:{protocol:n}}),setEndpoints:(e,t,n,r)=>Ye(e,{op:"endpoints",openai:t??"",anthropic:n??"",gemini:r??""}),applyMerged:e=>Ye(e,{op:"applyMerged"}),async reveal(e,t){try{let n=await fetch(`${rr}?route=${encodeURIComponent(e)}&ref=${encodeURIComponent(t)}`,{method:"GET",cache:"no-store",credentials:"same-origin"});if(!n.ok)return;let r=await n.json();if(!K(r)||r.ok!==!0)return;let o=r.key;return typeof o=="string"&&o.length>0?o:void 0}catch{return}}};var Mn="data-bre-endpoint-rows",it="data-bre-endpoint-row",Br="data-bre-endpoint-family",sd="data-bre-endpoint-filled",Gr="data-bre-endpoint-field",Ur="data-bre-endpoint-title",Sn="data-bre-endpoint-toggle",pd="data-bre-endpoint-count",zr="data-bre-field-order",Ln="data-bre-endpoint-serving",dd="data-bre-protocol-watch",ld=new WeakSet,cd="data-bre-row-provider",bi="data-bre-protocol-cards",zt="data-bre-protocol-value",yi="data-bre-protocol-source";function Oe(e,t){for(let n of t){let r=Array.from(e.querySelectorAll("input[aria-label], select[aria-label]")).find(o=>(o.getAttribute("aria-label")??"").startsWith(n));if(r!==void 0)return r}}function jt(e,t){let n=Oe(e,t);if(n===void 0)return;let r=n.closest("label");return r!==null&&r.parentElement!==null?r:n.parentElement??void 0}function hi(e,t){let n=e;for(;n!==null&&n.parentElement!==t;)n=n.parentElement;return n===null||n===t?void 0:n}function hp(e,t,n){for(let r=t.parentElement;r!==null;r=r.parentElement){if(!r.contains(n)||e!==void 0&&!r.contains(e))continue;let o=hi(t,r),i=hi(n,r);if(o===void 0||i===void 0||o===i)continue;let a=e===void 0?void 0:hi(e,r);return{container:r,protocol:o,url:i,name:a}}}function md(e,t){let n=Oe(e,t);return n instanceof HTMLSelectElement||n instanceof HTMLInputElement?n.value.trim():""}function gp(e,t){let n=md(e,t.apiProtocol);return n==="anthropic-messages"||n==="openai-completions"||n==="openai-responses"||n==="google-generative-ai"?n:void 0}function Je(e,t){let n=gp(e,t);return n===void 0?void 0:Kr(n)}function Rn(e,t){let n=md(e,t.routeId);return n.length>0?n:(e.closest(`[${cd}]`)?.getAttribute(cd)??"").trim()}function hd(e,t){return e==="anthropic"?t("keysEndpointAnthropic"):e==="openai"?t("keysEndpointOpenAI"):e==="gemini"?t("keysEndpointGemini"):""}function bp(e,t){let n=Oe(e,t.modelName),r=Oe(e,t.apiProtocol),o=Oe(e,t.baseUrl);if(r===void 0||o===void 0)return;let i=hp(n,r,o);if(i===void 0)return;let{container:a,protocol:s,url:d,name:l}=i,f=u=>Array.from(a.children).indexOf(u);if((l===void 0||f(l)<f(s))&&f(s)<f(d)){e.setAttribute(zr,"1");return}a.insertBefore(s,d),l!==void 0&&a.insertBefore(l,s),e.setAttribute(zr,"1")}function gd(e,t){for(let n of Array.from(e.children))if(!(n===t||n.contains(t))&&!n.hasAttribute(Br)&&!n.hasAttribute(Sn)&&n instanceof HTMLElement&&(n.textContent??"").trim().length>0)return n}function jr(e,t){let n=t?"1":"0";e.getAttribute(sd)!==n&&e.setAttribute(sd,n)}function yp(e,t,n){let r=gd(e,t);if(!n){e.removeAttribute(Gr),r?.removeAttribute(Ur);return}e.setAttribute(Gr,"1"),r?.setAttribute(Ur,"1")}function bd(e,t,n){let r=Oe(e,t.baseUrl);if(r===void 0)return;let o=jt(e,t.baseUrl);if(o===void 0)return;let i=hd(Je(e,t),n),a=o.querySelector(`[${Br}]`);if(a===null&&i.length>0){a=document.createElement("span"),a.setAttribute(Br,"1"),a.className="bre-endpoint-family";let d=r.closest("label");d!==null&&d.contains(r)?d.insertBefore(a,r):o.insertBefore(a,r)}a!==null&&(a.textContent!==i&&(a.textContent=i),Ge(a,i.length===0),jr(a,r instanceof HTMLInputElement&&r.value.trim().length>0)),yp(o,r,a!==null&&i.length>0);let s=Je(e,t);s===void 0?o.removeAttribute(Ln):o.setAttribute(Ln,s)}function wp(e,t){let n=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value")?.set;n===void 0?e.value=t:n.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function yd(e,t){for(let n of Array.from(t.querySelectorAll(`[${zt}]`))){let r=n.getAttribute(zt)===e.value;n.classList.toggle("is-selected",r),n.setAttribute("aria-checked",r?"true":"false"),n.tabIndex=r?0:-1}}function vp(e,t,n){let r=Array.from(t.querySelectorAll(`[${zt}]`)),o=Array.from(e.options).filter(i=>i.value.length>0);return r.length!==o.length?!1:o.every((i,a)=>{let s=r[a];return s!==void 0&&s.getAttribute(zt)===i.value&&(s.textContent??"")===wd(i.value,(i.textContent??i.value).trim(),n.t)})}var xp="google-generative-ai",ud="data-bre-protocol-option";function wd(e,t,n){return e==="openai-completions"?n("keysProtocolShortChat"):e==="openai-responses"?n("keysProtocolShortResponses"):e==="anthropic-messages"?n("keysProtocolShortAnthropic"):e==="google-generative-ai"?n("keysProtocolGemini"):t}function fd(e,t,n){t.replaceChildren();for(let r of Array.from(e.options)){let o=r.value;if(o.length===0)continue;let i=document.createElement("button");i.type="button",i.className="bre-protocol-card",i.setAttribute("role","radio"),i.setAttribute(zt,o),i.textContent=wd(o,(r.textContent??o).trim(),n.t),i.title=(r.textContent??o).trim(),i.addEventListener("click",()=>{e.value!==o&&(wp(e,o),yd(e,t))}),t.appendChild(i)}}function kp(e,t,n){let r=Oe(e,t.apiProtocol);if(!(r instanceof HTMLSelectElement))return;let o=jt(e,t.apiProtocol);if(o===void 0)return;let i=r.querySelector(`option[${ud}]`);i===null&&(i=document.createElement("option"),i.setAttribute(ud,"1"),i.value=xp,r.appendChild(i));let a=n.t("keysProtocolGemini");i.textContent!==a&&(i.textContent=a);let s=o.querySelector(`[${bi}]`);if(s===null){let d=document.createElement("div");s=d,d.setAttribute(bi,"1"),d.className="bre-protocol-cards",d.setAttribute("role","radiogroup");let l=r.getAttribute("aria-label");l!==null&&d.setAttribute("aria-label",l),r.setAttribute(yi,"1"),r.after(d),fd(r,d,n),d.addEventListener("keydown",f=>{let m=f.key==="ArrowRight"||f.key==="ArrowDown"?1:f.key==="ArrowLeft"||f.key==="ArrowUp"?-1:0,u=Array.from(d.querySelectorAll(`[${zt}]`));if(u.length===0)return;if(f.key==="Home"||f.key==="End"){f.preventDefault();let b=f.key==="Home"?u[0]:u[u.length-1];b?.click(),b?.focus();return}if(m===0)return;f.preventDefault();let c=u.findIndex(b=>b.classList.contains("is-selected")),p=u[(Math.max(c,0)+m+u.length)%u.length];p?.click(),p?.focus()})}else vp(r,s,n)||fd(r,s,n);Ge(r,!0),yd(r,s)}function vd(e,t,n){let r=e===null?0:e.querySelectorAll(`[${it}]`).length,o=r===0?"":n.t("keysEndpointsCount",{count:r});if(o.length===0){t.hasAttribute("title")&&t.removeAttribute("title");return}t.getAttribute("title")!==o&&t.setAttribute("title",o)}function Ep(e,t,n){let r=e.querySelector(`[${Sn}]`);if(jt(e,t.apiProtocol)===void 0){r?.remove(),e.querySelector(`[${pd}]`)?.remove();return}let o=jt(e,t.baseUrl);if(o===void 0)return;let i=Oe(e,t.baseUrl);if(i===void 0)return;let a=gd(o,i);if(a===void 0||a===r)return;let s=()=>e.querySelector(`[${Mn}]`),d=f=>{let m=n.t("keysMoreEndpoints");f.textContent!==m&&(f.textContent=m);let u=s();f.setAttribute("aria-expanded",u!==null&&!u.hidden?"true":"false"),vd(u,f,n)};if(r!==null){r.parentElement!==a&&a.append(r),d(r);return}let l=document.createElement("button");l.type="button",l.setAttribute(Sn,"1"),l.className="bre-endpoint-toggle",l.textContent=n.t("keysMoreEndpoints"),l.addEventListener("click",()=>{let f=s();if(f!==null&&(f.hidden=!f.hidden,d(l),!f.hidden)){let m=Rn(e,t);m.length>0&&Sp(f,m,n,e,t)}}),a.append(l),d(l)}var gi=new WeakMap,Tp=1e3,xd=new WeakMap,wi=0,Wr=new Map;function Mp(e,t){wi+=1,typeof CustomEvent=="function"&&document.dispatchEvent(new CustomEvent(Tn,{detail:{route:e,openai:t.openai??"",anthropic:t.anthropic??"",gemini:t.gemini??""}}))}function An(e){let t=e.getAttribute(it);return t==="openai"||t==="anthropic"||t==="gemini"?t:void 0}async function Sp(e,t,n,r,o){for(let i of Array.from(e.querySelectorAll(`[${it}]`)))await kd(i,t,n,r,o)}async function kd(e,t,n,r,o){let i=e.querySelector(".bre-endpoint-url"),a=An(e);if(i===null||a===void 0)return;let s=(gi.get(e)??0)+1;gi.set(e,s),xd.set(e,{at:Date.now(),epoch:wi});let d=n.client??Xe,l=await $r(t,d);if(l===void 0||gi.get(e)!==s||An(e)!==a||document.activeElement===i)return;await Ed(r,o,n,t,Je(r,o),l);let f=l[a];i.value!==f&&(i.value=f);let m=e.querySelector(".bre-endpoint-family");m!==null&&jr(m,f.length>0)}async function Ed(e,t,n,r,o,i,a=!1){if(o===void 0||!a&&i[o].length>0)return;let s=Oe(e,t.baseUrl);if(!(s instanceof HTMLInputElement)||document.activeElement===s)return;let d=s.value.trim();if(d.length===0&&!a)return;let l=n.client??Xe;await xi(r,l,f=>{if(!(!a&&f[o].length>0)&&f[o]!==d)return{openai:o==="openai"?d:f.openai,anthropic:o==="anthropic"?d:f.anthropic,gemini:o==="gemini"?d:f.gemini}})}function vi(e,t,n){let r=jt(e,t.baseUrl);if(r===void 0||r.parentElement===null)return;let o=Je(e,t);if(o===void 0)return;let i=r.querySelector(`:scope > [${Mn}]`);i===null&&(i=e.querySelector(`[${Mn}]`),i!==null&&r.appendChild(i)),i===null&&(i=document.createElement("div"),i.setAttribute(Mn,"1"),i.hidden=!0,r.appendChild(i));let a=rd.filter(m=>m!==o),s=Array.from(i.children).filter(m=>m instanceof HTMLElement&&m.hasAttribute(it));if(!(a.length===s.length&&a.every((m,u)=>An(s[u])===m)))for(let m of a){let u=i.querySelector(`[${it}="${m}"]`);u===null&&(u=Lp(e,t,n,m)),i.appendChild(u)}for(let m of Array.from(i.querySelectorAll(`[${it}]`))){let u=An(m);u!==void 0&&u!==o||m.remove()}let l=e.querySelector(`[${Sn}]`);l!==null&&(l.setAttribute("aria-expanded",i.hidden?"false":"true"),vd(i,l,n));let f=Rn(e,t);if(f.length>0)for(let m of Array.from(i.querySelectorAll(`[${it}]`))){let u=xd.get(m);(u===void 0||u.epoch!==wi||Date.now()-u.at>=Tp)&&kd(m,f,n,e,t)}}function Lp(e,t,n,r){let o=document.createElement("div");o.setAttribute(it,r),o.className="bre-endpoint-row";let i=document.createElement("span");i.className="bre-endpoint-family",i.textContent=hd(r,n.t),jr(i,!1);let a=document.createElement("input");a.type="url",a.className="bre-text-input bre-endpoint-url",a.spellcheck=!1,a.placeholder="https://\u2026";let s=n.client??Xe;return a.addEventListener("change",()=>{let d=Rn(e,t);if(d.length===0)return;let l=a.value.trim();if(l.length>0&&!/^https?:\/\//i.test(l)){a.setAttribute("aria-invalid","true"),a.title=n.t("keysEndpointInvalid");return}a.hasAttribute("aria-invalid")&&a.removeAttribute("aria-invalid"),a.hasAttribute("title")&&a.removeAttribute("title"),jr(i,l.length>0),(async()=>await xi(d,s,f=>{let m=An(o);if(m!==void 0)return{openai:m==="openai"?l:f.openai,anthropic:m==="anthropic"?l:f.anthropic,gemini:m==="gemini"?l:f.gemini}}))()}),o.append(i,a),o}async function Ap(e,t,n,r,o){let i=Rn(e,t),a=Oe(e,t.baseUrl);if(i.length===0||!(a instanceof HTMLInputElement))return;let s=n.client??Xe,d=await $r(i,s);if(d===void 0||Je(e,t)!==o)return;let l=a.value.trim();if(l.length>0&&l!==d[r]){let u=await xi(i,s,c=>{if(Je(e,t)===o)return{openai:r==="openai"?l:c.openai,anthropic:r==="anthropic"?l:c.anthropic,gemini:r==="gemini"?l:c.gemini}});if(u===void 0||(d=u,Je(e,t)!==o))return}let f=d[o];if(a.value===f)return;let m=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set;m===void 0?a.value=f:m.call(a,f),a.dispatchEvent(new Event("input",{bubbles:!0})),a.dispatchEvent(new Event("change",{bubbles:!0})),vi(e,t,n)}async function xi(e,t,n){let o=(Wr.get(e)??Promise.resolve()).then(async()=>{let i=await $r(e,t);if(i===void 0)return;let a=n(i);if(a===void 0)return;let s=await t.setEndpoints(e,a.openai,a.anthropic,a.gemini);if(!s.ok)return;let d={openai:s.endpoints.openai??"",anthropic:s.endpoints.anthropic??"",gemini:s.endpoints.gemini??""};return Mp(e,s.endpoints),d});Wr.set(e,o);try{return await o}finally{Wr.get(e)===o&&Wr.delete(e)}}async function $r(e,t){let n=await t.list(e);if(n.ok)return{openai:n.endpoints.openai??"",anthropic:n.endpoints.anthropic??"",gemini:n.endpoints.gemini??""}}function Rp(e,t,n){let r=jt(e,t.baseUrl),o=Je(e,t),i=r?.getAttribute(Ln);bd(e,t,n.t),vi(e,t,n),!(r===void 0||i===void 0||o===void 0)&&i!==o&&(i!=="openai"&&i!=="anthropic"&&i!=="gemini"||Ap(e,t,n,i,o))}function Td(e,t,n){bp(e,t),kp(e,t,n),bd(e,t,n.t),Ep(e,t,n),vi(e,t,n);let r=Oe(e,t.apiProtocol);r instanceof HTMLSelectElement&&!r.hasAttribute(dd)&&(r.setAttribute(dd,"1"),r.addEventListener("change",()=>Rp(e,t,n)));let o=Oe(e,t.baseUrl);o instanceof HTMLInputElement&&!ld.has(o)&&(ld.add(o),o.addEventListener("change",()=>{let i=Rn(e,t),a=Je(e,t);if(i.length===0||a===void 0)return;let s=n.client??Xe;(async()=>{let d=await $r(i,s);d!==void 0&&Je(e,t)===a&&await Ed(e,t,n,i,a,d,!0)})()}))}function Hp(){for(let e of Array.from(document.querySelectorAll(`select[${yi}]`)))e.hidden=!1,e.removeAttribute(yi)}function Md(){Hp();for(let e of Array.from(document.querySelectorAll(`[${Mn}], [${it}], [${Sn}], [${pd}], [${bi}], [${Br}]`)))e.remove();for(let e of Array.from(document.querySelectorAll(`[${zr}], [${Gr}], [${Ur}], [${Ln}]`)))e.removeAttribute(zr),e.removeAttribute(Gr),e.removeAttribute(Ur),e.removeAttribute(Ln)}function $t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var ki="__breLedgerDocument";function Dd(){let e=globalThis;return e[ki]??(e[ki]=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`)}var Vr="bre:held-writes:v1";function Ri(){try{return typeof sessionStorage>"u"?void 0:sessionStorage}catch{return}}function Qe(e){let t=Ri();if(t!==void 0)try{if(e.pending.size===0&&e.queued.size===0){t.removeItem(Vr);return}let n={document:Dd(),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(Vr,JSON.stringify(n))}catch{}}function Sd(e,t){if(!Array.isArray(e))return;let n=[];for(let r of e){if(!Array.isArray(r)||r.length!==2)return;let[o,i]=r;if(typeof o!="string"||!Array.isArray(i))return;let a=[];for(let s of i){if(!Array.isArray(s)||s.length!==2)return;let[d,l]=s;if(typeof d!="string"||!K(l)||t!==void 0&&!t(l))return;a.push([d,l])}n.push([o,a])}return n}function Cp(e){let t=Ri();if(t!==void 0)try{let n=t.getItem(Vr);if(n===null)return;let r=JSON.parse(n);if(r.document!==Dd())return;let o=Sd(r.pending),i=Sd(r.queued,Wp);if(o===void 0||i===void 0)return;let a=Array.isArray(r.committed)?r.committed.filter(s=>typeof s=="string"):[];for(let[s,d]of o)e.pending.set(s,new Map(d));for(let[s,d]of i)a.includes(s)&&(e.queued.set(s,new Map(d)),e.committing.add(s))}catch{}}function Id(e,t){(async()=>{try{await Hi(t,e),await Ci(t,e)}catch(n){console.error(`[bre] teardown flush failed: ${n instanceof Error?n.message:String(n)}`)}})()}function _d(e,t){(async()=>{try{await Hi(t,e,!0),await Ci(t,e,!0)}catch(n){console.error(`[bre] unload flush failed: ${n instanceof Error?n.message:String(n)}`)}finally{try{Ri()?.removeItem(Vr)}catch{}}})()}function Fd(){let e={disposed:!1,mounted:new Map,describePromise:void 0,pending:new Map,missedScans:new Map,queued:new Map,editing:void 0,flushing:!1,flushFailures:0,nextFlushAt:0,committing:new Set,adapting:new Set,signalsUnavailable:!1,submitWired:new WeakSet,cancelWired:new WeakSet,disclosureWired:new WeakSet,editWired:new WeakSet};return Cp(e),e}async function Op(e,t){if(!t.flushing){t.flushing=!0;try{let n=await Hi(e,t),r=await Ci(e,t);n||r?Ld(e,t):(t.flushFailures=0,t.nextFlushAt=0)}catch(n){Ld(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 Ld(e,t){t.flushFailures+=1;let n=Math.min(2**t.flushFailures*500,3e4);t.nextFlushAt=Date.now()+n,e.onBackoff?.(n)}function Np(e){return e.queued.size>0||e.pending.size>0}function Pn(e,t,n,r,o,i,a){try{let s=e.pending.get(t);if(r===void 0){if(s===void 0)return;s.delete(n),s.size===0&&e.pending.delete(t);return}e.pending.set(t,(s??new Map).set(n,{efforts:r,...o===void 0?{}:{compat:o},...i===void 0?{}:{input:i},...a===void 0?{}:{defaultEffort:a}}))}finally{Qe(e)}}function Kd(e,t,n,r){e.queued.set(t,(e.queued.get(t)??new Map).set(n,r)),Qe(e)}function Pp(e,t,n){let r=e.pending.get(t);r!==void 0&&(r.delete(n),r.size===0&&e.pending.delete(t),Qe(e))}function Dp(e,t,n){let r=e.queued.get(t);r!==void 0&&(r.delete(n),r.size===0&&e.queued.delete(t),Qe(e))}function Ip(e,t,n){Pp(e,t,n),Dp(e,t,n)}function _p(e,t){e.queued.delete(t),e.pending.delete(t),e.missedScans.delete(t),e.committing.delete(t),Qe(e)}function Fp(e,t,n){if(t===void 0)return null;let i=t[Ae]!==!0&&t.reasoningEfforts!==void 0&&typeof t[_t]=="number"||t[Ae]!==!0&&n?.efforts!==void 0&&Kp(t.reasoningEfforts,n.efforts)?!1:t.reasoningEfforts!==void 0||t[Ae]===!0||e.efforts==="keep",s=t[rt]!==!0&&n?.input!==void 0&&qp(t.input,n.input)?!1:Array.isArray(t.input)&&t.input.length>0||t[rt]===!0,d=i?"keep":e.efforts,l=s?void 0:e.input,f=e.defaultEffort;return d==="keep"&&l===void 0&&f===void 0?null:{efforts:d,...e.compat===void 0?{}:{compat:e.compat},...l===void 0?{}:{input:l},...f===void 0?{}:{defaultEffort:f}}}function Kp(e,t){if(e===t)return!0;if(!K(e)||!K(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 qp(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 Wp(e){if(!K(e))return!1;let t=e.efforts;return t===!1||t==="keep"||K(t)}async function Bp(e,t,n,r,o=!1){let i=await e.describeNamespace(),a=ke(i.namespace),s=[];for(let[m,u]of[...r]){let c=Gt(a,n).find(S=>S.id===m);if(c===void 0||t.pending.get(n)?.get(m)!==u)continue;let p=kt(a,n),b=typeof c.name=="string"?c.name:void 0,h=$e(m,b===void 0?p:{...p,displayName:b}),x=Fp(u,c,{...h.efforts===void 0?{}:{efforts:h.efforts},...h.input===void 0?{}:{input:h.input}});if(x===null){Pn(t,n,m,void 0);continue}s.push({modelId:m,efforts:x.efforts,...x.compat===void 0?{}:{compat:x.compat},...x.input===void 0?{}:{input:x.input},...x.defaultEffort===void 0?{}:{defaultEffort:x.defaultEffort}})}if(s.length===0)return!1;let d=!1,l=await gn(e.api,n,s,()=>d?e.describeNamespace():(d=!0,Promise.resolve(i)),o?void 0:ol),f=!1;return s.forEach((m,u)=>{let c=l[u];if(c?.aborted!==!0){if(c?.ok===!0||c?.modelNotFound===!0){Pn(t,n,m.modelId,void 0);return}f=!0,console.error(`[bre] staged flush write failed for "${n}"/"${m.modelId}": ${c?.error??"unknown"}`)}}),f}async function Hi(e,t,n=!1){for(let a of[...t.committing])t.queued.has(a)||t.committing.delete(a);if(![...t.queued.keys()].some(a=>t.committing.has(a)||t.signalsUnavailable)||(await e.describeNamespace()).writable!==!0)return Qe(t),!1;let i=!1;for(let[a,s]of[...t.queued]){if(!t.committing.has(a)&&!t.signalsUnavailable)continue;let l=[...s].map(([u,c])=>({modelId:u,efforts:c.efforts,...c.compat===void 0?{}:{compat:c.compat},...c.input===void 0?{}:{input:c.input},...c.defaultEffort===void 0?{}:{defaultEffort:c.defaultEffort}})),f=await gn(e.api,a,l,void 0,n?void 0:ol),m=!1;l.forEach((u,c)=>{let p=f[c];if(p?.aborted===!0){m=!0;return}if(p?.ok===!0||p?.modelNotFound===!0){s.delete(u.modelId);return}console.error(`[bre] held write failed for "${a}"/"${u.modelId}": ${p?.error??"unknown"}`)}),s.size===0?(t.queued.delete(a),t.committing.delete(a)):m||(i=!0)}return Qe(t),i}async function Ci(e,t,n=!1){if(t.pending.size===0)return!1;let r=await e.describeNamespace();if(r.writable!==!0)return!1;let o=ke(r.namespace),i=!1;for(let[a,s]of[...t.pending]){if(s.size===0){t.pending.delete(a);continue}$t(o,a)&&await Bp(e,t,a,s,n)&&(i=!0)}return Qe(t),i}function Ee(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 Dn(e){return e.closest('[class*="editor"], [class*="rowCard"], [class*="addCard"]')??void 0}function Gp(e){let t=e.closest('[class*="modelEntry"]');if(t===null){let r=Dn(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 qd(e,t){return Array.from(e.querySelectorAll("button[aria-label]")).find(n=>t.some(r=>(n.getAttribute("aria-label")??"").startsWith(r)))}function Ad(){return new Promise(e=>{if(typeof window.requestAnimationFrame!="function"){e();return}let t,n=()=>{window.clearTimeout(r),t!==void 0&&window.cancelAnimationFrame(t),e()},r=window.setTimeout(n,100);t=window.requestAnimationFrame(n)})}function Cn(e){return e.querySelector('[class*="modelInputTypes"]')!==null}var Up="modelReasoning",Ti="data-bre-reasoning-hidden";function Wd(e){return e.querySelector(`[class*="${Up}"]`)??void 0}function Oi(e){let t=Wd(e);t!==void 0&&t.style.display!=="none"&&(t.setAttribute(Ti,"1"),t.style.display="none")}function On(e){let t=Wd(e);t!==void 0&&t.getAttribute(Ti)==="1"&&(t.removeAttribute(Ti),t.style.display==="none"&&(t.style.display=""))}var Mi="data-bre-capacity-hidden";function Bd(e){return Array.from(e.children).filter(t=>{if(t.nodeType!==1)return!1;let n=t;return n.matches('[class*="modelField"]')||n.matches('[class*="modelInputTypes"]')})}function Rd(e){for(let t of Bd(e))t.style.display!=="none"&&(t.setAttribute(Mi,"1"),t.style.display="none")}function Hn(e){for(let t of Bd(e))t.getAttribute(Mi)==="1"&&(t.removeAttribute(Mi),t.style.display==="none"&&(t.style.display=""))}function Gd(e,t){let n=e.querySelector('[class*="modelInputTypes"]');if(n===null)return;let r=Array.from(n.querySelectorAll('input[type="checkbox"]')),o=r.find(i=>{let a=i.closest("label")?.textContent?.trim();return a!==void 0&&t.includes(a)});return o!==void 0?o:r.length===2?r[1]:void 0}function In(e,t,n){let r=Gd(e,n);return r===void 0||r.disabled?!1:(r.checked!==t&&r.click(),!0)}function Si(e,t,n){return t==null||e===void 0?t:In(e,t.includes("image"),n)?void 0:t}function Hd(e,t){let n=e.getAttribute("aria-label")??"";if(t.some(o=>n.startsWith(o)))return!0;let r=e.closest("label")?.textContent?.trim()??"";return r.length>0&&t.some(o=>r.includes(o))}function Ni(e,t){let n=[...t.modelId,...t.modelName],r=Array.from(e.querySelectorAll("input")).filter(s=>s.type!=="checkbox"&&s.type!=="radio").filter(s=>s.closest("[data-plugin]")===null).filter(s=>!n.some(d=>(s.getAttribute("aria-label")??"").startsWith(d))),o=r.find(s=>Hd(s,t.contextWindow)),i=r.find(s=>Hd(s,t.maxOutput));if(o!==void 0&&i!==void 0)return{contextWindow:o,maxOutput:i};let a=r.filter(s=>s!==o&&s!==i);return{contextWindow:o??a[0],maxOutput:i??(o!==void 0?a[0]:a[1])}}function Ud(e,t,n){let r=Ni(e,t),o=(i,a)=>i===void 0||i.disabled||a===void 0||!Number.isFinite(a)||a<=0||Ve(i.value)!==void 0?!1:zd(i,String(a));return{contextWindow:o(r.contextWindow,n.contextWindow),maxOutput:o(r.maxOutput,n.maxTokens)}}function zd(e,t){return e.disabled?!1:(e.value===t||(Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set?.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0}))),!0)}function zp(e,t){let n=Ni(e,t),r=a=>{if(a!==void 0)return Ve(a.value)},o=r(n.contextWindow),i=r(n.maxOutput);return{...o===void 0?{}:{contextWindow:o},...i===void 0?{}:{maxTokens:i}}}function jp(e,t,n){let r=Ni(e,t),o=(i,a)=>i===void 0?!1:zd(i,a===void 0||!Number.isFinite(a)||a<=0?"":String(a));return{contextWindow:"contextWindow"in n?o(r.contextWindow,n.contextWindow):!1,maxOutput:"maxTokens"in n?o(r.maxOutput,n.maxTokens):!1}}async function $p(e,t,n){if(e===void 0)return!1;let r=t.inputImage;if(Cn(e))return In(e,!0,r);let o=e.closest('[class*="modelEntry"]')??e;if(o.querySelector('[class*="modelAdvanced"]')!==null)return!1;let i=qd(o,t.capacity);if(i===void 0||i.disabled)return!1;i.click(),Cn(o)||await n();try{return Cn(o)&&In(o,!0,r)}finally{i.click()}}async function Vp(e,t,n,r){if(e.matches('[class*="modelAdvanced"]'))return r(e);let o=e.closest('[class*="modelEntry"]')??e;if(o.querySelector('[class*="modelAdvanced"]')!==null)return r(o);let i=qd(o,t.capacity);if(i===void 0||i.disabled)return!1;i.click(),o.querySelector('[class*="modelAdvanced"]')===null&&await n();try{return o.querySelector('[class*="modelAdvanced"]')!==null?r(o):!1}finally{i.click()}}function Yp(e,t,n,r,o){n.disposed||!e.isConnected||Di(e)===void 0||Array.from(e.querySelectorAll("button[aria-label]")).some(a=>o.capacity.some(s=>(a.getAttribute("aria-label")??"").startsWith(s)))||Rr(e,Xp(e,ke(r.namespace),o),{t:t.t,onRequest:a=>jd(n,t,a)})}function Xp(e,t,n){let r=[];for(let o of ci(e)){let i=Dn(o);if(i===void 0)continue;let a=at(i,t,n);a===void 0||a.staged||r.push({catalogue:o,route:a.route})}return r}function Jp(e,t,n){let r=[],o=new Set;for(let i of e){if(o.has(i.card))continue;o.add(i.card);let a=at(i.card,t,n);if(a===void 0)continue;let[s]=ci(i.card);s!==void 0&&r.push({catalogue:s,route:a.route})}return r}function Qp(e,t,n,r){let o=[],i=new Set;for(let a of r.capacity){let s=Array.from(e.querySelectorAll("button[aria-label]")).filter(d=>(d.getAttribute("aria-label")??"").startsWith(a));for(let d of s){let l=Dn(d);if(l===void 0)continue;let f=d.closest('[class*="modelEntry"]')??l,m=Ee(f,r.modelId);m.length===0||i.has(m)||at(l,n,r)?.route===t&&(i.add(m),o.push({id:m,name:Ee(f,r.modelName),row:f}))}}return o}async function jd(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{Xo();let a,s=()=>a??(a=t.describeNamespace()),d=await s(),l=ke(d.namespace);if(d.writable!==!0)return{held:0,unsuggested:0,blocked:"unwritable"};if(!$t(l,n)&&r.length===0)return{held:0,unsuggested:0,blocked:"unknown-route"};let m=Gt(l,n),u=new Set;for(let k of m){let M=typeof k.id=="string"?k.id:"";M.length>0&&u.add(M)}let c=m.slice();for(let k of r)k.id.length===0||u.has(k.id)||c.push({id:k.id,name:k.name});if(c.length===0)return{held:0,unsuggested:0,blocked:"no-models"};let p=l[n]??{},b=typeof p.api=="string"?p.api:void 0,h=new Set,x=new Map;for(let[k,M]of e.mounted)M.props.route===n&&(x.set(M.props.modelId,k),M.props.efforts!==void 0&&h.add(M.props.modelId));let S=new Map;for(let k of r)k.row!==void 0&&S.set(k.id,k.row);let v=!1,P=(k,M)=>Si(x.get(k),M,t.labels().inputImage),D=async(k,M)=>{if(M.image!==!0)return!1;let W=x.get(k)??S.get(k);return W===void 0?!1:$p(W,t.labels(),Ad)},z=async(k,M,W)=>{let T=M.image===!0,R=W.contextWindow!==void 0||W.maxTokens!==void 0;if(!T&&!R)return!1;let N=x.get(k)??S.get(k);if(N===void 0)return!1;let B=t.labels();return Vp(N,B,Ad,O=>{let U=T&&Cn(O)&&In(O,!0,B.inputImage),X=R?Ud(O,B,W):{contextWindow:!1,maxOutput:!1};return{modality:U,capacities:X.contextWindow||X.maxOutput}})},oe=kr(t.api,s,(k,M,W,T,R,N)=>{Pn(e,k,M,W,T,P(M,R),N)},(k,M,W)=>{Kd(e,k,M,{...W,input:P(M,W.input)})},void 0,()=>v);for(let k of c){let M=typeof k.id=="string"?k.id:"";if(M.length===0)continue;let W=br(c,M),T=yr(c,M),R=W!==void 0||k[Ae]===!0,N=Array.isArray(T)&&T.length>0||k[rt]===!0;if(h.has(M)&&!R)continue;if(R&&N){let fe=x.get(M)??S.get(M);if(Array.isArray(T)&&T.includes("image")&&fe!==void 0){let F=t.labels().inputImage,G=Gd(fe,F);G!==void 0&&!G.disabled&&!G.checked&&In(fe,!0,F)}continue}let B=wr(c,M),O=xr(c,M)??"",U=await oe.suggest(n,M,vr(c,M));if(!U.ok){i+=1;continue}let X=U.suggestion,ce=X.efforts!==!1,j=X.input===void 0?Tt(T):Tt(X.input);if(R){if(!j.image||e.queued.get(n)?.has(M)===!0)continue;if(await D(M,j)){o+=1;continue}v=!u.has(M),oe.commit(n,M,Lr({efforts:"keep",input:Sr(j)})),v&&t.onPendingChanged?.(),v=!1,o+=1;continue}let re=X.defaultEffort??O,J=re===O?void 0:re===""?null:re;v=!u.has(M);let $=await z(M,j,{...X.contextWindow===void 0?{}:{contextWindow:X.contextWindow},...X.maxTokens===void 0?{}:{maxTokens:X.maxTokens}}),de=$!==!1&&$.modality;oe.commit(n,M,Lr({efforts:di(ce,Ut(Et(X.efforts)),W),input:de||Mr(j,T)?void 0:Sr(j),defaultEffort:J,appliedCompat:X.compat,routeApi:b,initialCompat:B})),v&&t.onPendingChanged?.(),v=!1,o+=1}return{held:o,unsuggested:i}}catch(a){return console.warn("[bre] provider-wide adapt failed:",a),{held:o,unsuggested:i,failed:a instanceof Error?a.message:String(a)}}finally{e.adapting.delete(n)}}function Zp(e){return e.querySelector(`[data-plugin="${pe}"]`)!==null}function em(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&&wn(e.efforts,t.efforts)&&nm(e.input,t.input)&&tm(e.compat,t.compat)}function tm(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 nm(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 Li(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 at(e,t,n){let r=e.querySelector('[class*="editorRoute"]')?.textContent?.trim();if(r!==void 0&&r.length>0&&$t(t,r))return{route:r,staged:!1};if(Li(e,n.routeId)){let a=Ee(e,n.routeId);return a.length>0&&!$t(t,a)?{route:a,staged:!0}:void 0}let o=e.querySelector('[class*="editorTitle"], [class*="rowName"]')?.textContent?.trim();if(o===void 0||o.length===0)return;let i=Object.entries(t).find(([,a])=>a.displayName===o);if(i!==void 0)return{route:i[0],staged:!1};if($t(t,o))return{route:o,staged:!1}}function rm(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,u)=>(m.textContent??"").trim()===u,i=n.querySelector('[class*="primaryButton"]'),a=n.querySelector('[class*="secondaryButton"]');if(i!==null&&a!==null)return{submit:i,cancel:a};let s=[...r].reverse().find(m=>t.apply.some(u=>o(m,u))),d=[...r].reverse().find(m=>t.cancel.some(u=>o(m,u)));if(s!==void 0&&d!==void 0)return{submit:s,cancel:d};let l=r[r.length-1],f=r[r.length-2];if(!(l===void 0||f===void 0))return{submit:l,cancel:f}}function Yr(e,t,n){t.has(e)||(t.add(e),e.addEventListener("click",n,{capture:!0}))}var Ei=new WeakMap,Ai=new Set;function $d(){for(let e of Array.from(Ai))e.release()}var Pi=420,Vd=320,om=160,Cd=2e3,im=150,Yd=new Set(["PageUp","PageDown","Home","End","ArrowUp","ArrowDown"," "]);function Xd(e,t=Vd){for(let n of Ir(e)){let r=Xr.get(n);if(r!==void 0){window.clearTimeout(r.timer),r.timer=window.setTimeout(()=>Od(n),t);continue}Xr.set(n,{saved:n.style.overflowAnchor,timer:window.setTimeout(()=>Od(n),t)}),n.style.overflowAnchor="none"}}var Xr=new Map;function Od(e){let t=Xr.get(e);t!==void 0&&(Xr.delete(e),e.style.overflowAnchor=t.saved)}function Qr(e,t){let n=Ir(e),r=n[0];if(r===void 0||!e.isConnected)return;let o=performance.now(),i=Ei.get(r);if(i!==void 0){i.deadline=Math.min(Math.max(i.deadline,o+t),i.startedAt+Cd);return}let a=e.getBoundingClientRect(),s=a.top,d=a.height,l=new Map,f=new Map;for(let S of n)l.set(S,S.scrollTop),f.set(S,S.style.overflowAnchor),S.style.overflowAnchor="none";let m=new Set(n),u={deadline:o+t,startedAt:o,frame:void 0,release:()=>{}},c=()=>{if(Ai.delete(u)){u.frame!==void 0&&(window.cancelAnimationFrame(u.frame),u.frame=void 0);for(let[S,v]of f)S.style.overflowAnchor=v;Ei.delete(r),document.removeEventListener("wheel",p,!0),document.removeEventListener("touchstart",p,!0),document.removeEventListener("pointerdown",p,!0),document.removeEventListener("keydown",b,!0)}};function p(){c()}function b(S){Yd.has(S.key)&&c()}u.release=c,Ei.set(r,u),Ai.add(u),document.addEventListener("wheel",p,{capture:!0,passive:!0}),document.addEventListener("touchstart",p,{capture:!0,passive:!0}),document.addEventListener("pointerdown",p,{capture:!0}),document.addEventListener("keydown",b,{capture:!0});let h=0,x=()=>{if(u.frame=void 0,h+=1,!e.isConnected||h>=im){c();return}let S=e.getBoundingClientRect(),v=Math.abs(S.height-d)>.5;if(!v&&[...m].some(z=>z.scrollTop!==l.get(z))){c();return}let P=S.top-s;P!==0&&am(n,m,l,P);let D=performance.now();if(v&&(d=S.height,u.deadline=Math.min(Math.max(u.deadline,D+om),u.startedAt+Cd)),D>=u.deadline){c();return}u.frame=window.requestAnimationFrame(x)};u.frame=window.requestAnimationFrame(x)}function am(e,t,n,r){let o=r;for(let i of[...t,...e]){if(o===0)break;let a=i.scrollTop;if(a!==n.get(i))continue;i.scrollTop=a+o;let s=i.scrollTop;s!==a&&(n.set(i,s),t.add(i),o-=s-a)}}var Jd='[class*="modelList"]',sm="bre-list-slack",dm=3e3,Zr,Vt=new WeakMap,Yt=new Set;function Qd(e){if(!(e instanceof Element))return;let t=e.closest(Jd);if(t===null)return;let n=Ir(t).map(r=>({host:r,top:r.scrollTop}));n.length!==0&&(Zr={targets:n,at:performance.now()})}function st(){Zr=void 0}function Zd(e){Qd(e.target)}function el(e){if(Yd.has(e.key)){st();return}Qd(e.target)}var Nn=0;function tl(){Nn+=1,!(Nn>1)&&(document.addEventListener("click",Zd,!0),document.addEventListener("keydown",el,!0),document.addEventListener("focusin",st,!0),document.addEventListener("pointerdown",st,!0),document.addEventListener("wheel",st,{capture:!0,passive:!0}),document.addEventListener("touchstart",st,{capture:!0,passive:!0}))}function Jr(e){let t=Vt.get(e);t!==void 0&&(Vt.delete(e),Yt.delete(t),t.scrollTarget.removeEventListener("scroll",t.onScroll),t.spacer.remove())}function lm(e){return e===document.scrollingElement?document:e}function cm(){if(Yt.size!==0)for(let e of Array.from(Yt)){let t=e.host;if(!e.spacer.isConnected){Vt.delete(t),Yt.delete(e),e.scrollTarget.removeEventListener("scroll",e.onScroll);continue}t.scrollTop<=t.scrollHeight-t.clientHeight-e.height&&Jr(t)}}function Nd(e,t){return e.scrollTop>e.scrollHeight-e.clientHeight-t}function um(e=performance.now()){let t=Zr;if(!(t===void 0||e-t.at>dm))for(let n of t.targets){let r=n.host;if(!r.isConnected)continue;let o=Vt.get(r),i=o===void 0?0:o.height,a=r.scrollHeight-r.clientHeight-i,s=n.top-a;if(s<=0){o!==void 0&&!Nd(r,o.height)&&Jr(r);continue}let d=o;if(d===void 0){let l=document.createElement("div");l.className=sm,l.dataset.plugin=pe,l.setAttribute("aria-hidden","true"),l.style.height="0px",(r===document.scrollingElement?document.body??r:r).appendChild(l);let m=()=>{let u=Vt.get(r);u!==void 0&&!Nd(r,u.height)&&Jr(r)};d={host:r,spacer:l,height:0,onScroll:m,scrollTarget:lm(r)},Vt.set(r,d),Yt.add(d),d.scrollTarget.addEventListener("scroll",m,{passive:!0})}d.height!==s&&(d.height=s,d.spacer.style.height=`${s}px`),r.scrollTop!==n.top&&(r.scrollTop=n.top)}}function nl(){if(Nn=Math.max(0,Nn-1),!(Nn>0)){document.removeEventListener("click",Zd,!0),document.removeEventListener("keydown",el,!0),document.removeEventListener("focusin",st,!0),document.removeEventListener("pointerdown",st,!0),document.removeEventListener("wheel",st,!0),document.removeEventListener("touchstart",st,!0),Zr=void 0;for(let e of Array.from(Yt))Jr(e.host)}}function rl(e,t=Pi){um(),cm();let n=new Set;for(let r of Array.from(e.querySelectorAll(Jd))){let o=r.closest('[class*="rowCard"], [class*="setupCard"], [class*="addCard"]');o===null||n.has(o)||(n.add(o),Qr(o,t))}}function fm(e,t){Yr(e,t,()=>{let n=e.closest('[class*="modelEntry"]')??e.closest('[class*="rowCard"]');n!==null&&Qr(e.closest('[class*="rowCard"]')??n,Pi)})}var Pd="{provider}";function pm(e,t){let n=t.editProvider.map(o=>{let i=o.indexOf(Pd);return i<0?void 0:{prefix:o.slice(0,i),suffix:o.slice(i+Pd.length)}}).filter(o=>o!==void 0);if(n.length===0)return[];let r=[];for(let o of Array.from(e.querySelectorAll("button[aria-label]"))){let i=o.getAttribute("aria-label")??"";n.some(a=>i.length>a.prefix.length+a.suffix.length&&i.startsWith(a.prefix)&&i.endsWith(a.suffix))&&o.closest("[data-plugin]")===null&&r.push(o)}return r}function mm(e,t){Yr(e,t,()=>{let n=e.closest('[class*="rowCard"], [class*="setupCard"], [class*="addCard"]');n!==null&&Qr(n,Pi)})}function Di(e){return e.querySelector('[class*="editorActions"]')??e.querySelector('[class*="modelEntry"]')??void 0}function ol(){return Di(We())!==void 0}function hm(e,t,n){let r={routeId:t.routeId,modelName:t.modelName,baseUrl:t.baseUrl,apiProtocol:t.apiProtocol},o=new Set;for(let i of Array.from(e.querySelectorAll('[class*="editor"], [class*="addCard"], [class*="rowCard"]')))Li(i,t.apiProtocol)&&Li(i,t.baseUrl)&&o.add(i);for(let i of o)Td(i,r,{t:n})}function Ii(e,t,n){if(n.disposed||!e.isConnected)return;let r=t.labels(),o=Di(e)!==void 0;for(let s of Array.from(e.querySelectorAll('[class*="rowCard"], [class*="setupCard"]')))for(let d of pm(s,r))mm(d,n.editWired);hm(e,r,t.t);let i=Array.from(e.querySelectorAll("button[aria-label]")).some(s=>r.capacity.some(d=>(s.getAttribute("aria-label")??"").startsWith(d)));if(!o){if(Rr(e,[],{t:t.t}),n.mounted.size>0){for(let[d,l]of n.mounted)On(d),Hn(d),l.editor.unmount();n.mounted.clear()}let s=n.editing;n.editing=!1,(s!==!1||Np(n)&&Date.now()>=n.nextFlushAt)&&Op(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,l]of n.mounted)On(d),Hn(d),l.editor.unmount();n.mounted.clear(),n.describePromise??(n.describePromise=t.describeNamespace());let s=r;n.describePromise.then(d=>{Yp(e,t,n,d,s)}).catch(d=>{n.describePromise=void 0,console.error(`[bre] empty-catalog seat failed: ${d instanceof Error?d.message:String(d)}`)});return}for(let s of r.capacity)for(let d of Array.from(e.querySelectorAll("button[aria-label]")))(d.getAttribute("aria-label")??"").startsWith(s)&&fm(d,n.disclosureWired);n.describePromise??(n.describePromise=t.describeNamespace());let a=s=>{if(n.disposed||!e.isConnected)return;let d=s.namespace,l=ke(d),f=[];for(let u of r.capacity){let c=Array.from(e.querySelectorAll("button[aria-label]")).filter(p=>(p.getAttribute("aria-label")??"").startsWith(u));for(let p of c){let b=Dn(p);if(b===void 0)continue;let h=p.closest('[class*="modelEntry"]')??b,x=Ee(h,r.modelId);x.length!==0&&f.push({container:Gp(p),row:h,modelId:x,card:b})}}Rr(e,Jp(f,l,r),{t:t.t,onRequest:u=>jd(n,t,u,Qp(e,u,l,r))});for(let[u,c]of n.mounted)f.some(p=>p.container===u)||(On(u),Hn(u),c.editor.unmount(),n.mounted.delete(u));if(n.pending.size>0){let u=new Map;for(let p of f){let b=at(p.card,l,r);if(b===void 0)continue;let h=u.get(b.route);h===void 0&&u.set(b.route,h=new Set),h.add(p.modelId)}let c=new Map;for(let[p,b]of n.pending){if(!$t(l,p))continue;let h=u.get(p),x=[...b.keys()].filter(S=>!h?.has(S));x.length>0&&c.set(p,new Set(x))}for(let[p,b]of c){let h=n.missedScans.get(p);if(h!==void 0)for(let x of b)h.has(x)&&(Pn(n,p,x,void 0),h.delete(x),b.delete(x))}n.missedScans=c}else n.missedScans=new Map;let m=new Set(f.map(u=>u.card));for(let u of m){let c=at(u,l,r);if(c===void 0)continue;let p=c.route,b=rm(u,r);b===void 0?n.signalsUnavailable=!0:(n.signalsUnavailable=!1,Yr(b.submit,n.submitWired,()=>{let h=at(u,l,r)?.route??p;n.committing.add(h),Qe(n)}),Yr(b.cancel,n.cancelWired,()=>{let h=at(u,l,r)?.route??p;_p(n,h)}))}f.forEach((u,c)=>{let p=u.container;if(p===void 0)return;let b=at(u.card,l,r);if(b===void 0)return;let{route:h,staged:x}=b,S=l[h]??{},v=Gt(l,h),P=new Set(v.map(J=>J.id)),D=x||!P.has(u.modelId),z=D?n.pending.get(h)?.get(u.modelId)?.efforts:void 0,oe=D?z==="keep"?void 0:z:br(v,u.modelId),k=!D&&v.some(J=>J.id===u.modelId&&J[Ae]===!0),M=D?n.pending.get(h)?.get(u.modelId)?.input:yr(v,u.modelId),W=D?n.pending.get(h)?.get(u.modelId)?.compat:wr(v,u.modelId),T=D?n.pending.get(h)?.get(u.modelId)?.defaultEffort??void 0:xr(v,u.modelId),R=D?Ee(u.row,r.modelName):"",N=D?R.length>0?R:void 0:vr(v,u.modelId),B=x?Ee(u.card,r.apiProtocol):"",O=x?Ee(u.card,r.baseUrl):"",U=x&&B.length>0?B:typeof S.api=="string"?S.api:void 0,X=x&&O.length>0?O:typeof S.baseURL=="string"?S.baseURL:void 0,ce={route:h,routeDisplayName:x?h:typeof S.displayName=="string"?S.displayName:h,...U===void 0?{}:{routeApi:U},...X===void 0?{}:{routeBaseURL:X},modelId:u.modelId,...N===void 0?{}:{modelName:N},...oe===void 0?{}:{efforts:oe},...k?{effortsUnset:k}:{},...M===void 0?{}:{input:M},...W===void 0?{}:{compat:W},...T===void 0?{}:{defaultEffort:T},index:c,staged:D,officialInputTypes:Cn(p),onCoverageChange:J=>{J?Rd(p):Hn(p)},api:{...kr(t.api,void 0,(J,$,de,fe,F,G)=>{Pn(n,J,$,de,fe,Si(p,F,r.inputImage),G)},(J,$,de)=>{Kd(n,J,$,{...de,input:Si(p,de.input,r.inputImage)})},J=>{Ip(n,J,u.modelId)},()=>(at(u.card,l,r)?.staged??x)||!P.has(u.modelId)),fillCapacities:(J,$)=>{Ud(p,r,{...J===void 0?{}:{contextWindow:J},...$===void 0?{}:{maxTokens:$}})},readCapacities:()=>zp(p,r),setCapacities:J=>{jp(p,r,J)}},readOnly:s.writable!==!0,t:t.t};Oi(p),oe===!1?Hn(p):Rd(p);let j=n.mounted.get(p);if(j!==void 0){em(j.props,ce)||(j.props=ce,j.editor.render(ce));return}if(Zp(p))return;Qr(Dn(p)??u.card,Vd);let re=t.mount(p,ce);n.mounted.set(p,{editor:re,props:ce})})};n.describePromise.then(a,()=>{n.describePromise=void 0}).catch(s=>{console.error(`[bre] editor reconcile failed: ${s instanceof Error?s.message:String(s)}`)})}var _i=require("react");var se=require("react");var Ne=require("react"),sl=require("react-dom"),Ze=require("react/jsx-runtime"),il=6,gm=292,eo=8,bm=52;function al(e,t){let n=e.getBoundingClientRect(),r=t*bm+46,o=window.innerWidth||0,i=window.innerHeight||0,a=Math.max(eo,Math.min(n.left,o-gm-eo)),s=n.bottom+il,d=n.top-il-r,l=i>0&&s+r>i-eo&&d>eo?d:s;return{left:a,top:l}}function dl(e){let{anchor:t,label:n,options:r,selected:o,onPick:i,onClose:a}=e,[s,d]=(0,Ne.useState)(()=>al(t,r.length)),l=(0,Ne.useRef)(null),f=(0,Ne.useRef)([]);(0,Ne.useLayoutEffect)(()=>{let c=()=>{d(al(t,r.length))};return c(),window.addEventListener("resize",c),window.addEventListener("scroll",c,!0),()=>{window.removeEventListener("resize",c),window.removeEventListener("scroll",c,!0)}},[t,r.length]),(0,Ne.useEffect)(()=>{let c=Math.max(0,r.findIndex(p=>p.value===o));f.current[c]?.focus()},[r,o]),(0,Ne.useEffect)(()=>{let c=p=>{let b=p.target;b instanceof Node&&l.current?.contains(b)!==!0&&(t.contains(b)||a())};return document.addEventListener("pointerdown",c,!0),()=>{document.removeEventListener("pointerdown",c,!0)}},[t,a]);let m=(0,Ne.useCallback)(c=>{if(r.length===0)return;let p=(c+r.length)%r.length;f.current[p]?.focus()},[r.length]),u=c=>{let p=f.current.findIndex(b=>b===document.activeElement);if(c.key==="Escape"){c.preventDefault(),c.stopPropagation(),a();return}if(c.key==="ArrowDown"){c.preventDefault(),m(p+1);return}if(c.key==="ArrowUp"){c.preventDefault(),m(p<0?r.length-1:p-1);return}if(c.key==="Home"){c.preventDefault(),m(0);return}c.key==="End"&&(c.preventDefault(),m(r.length-1))};return(0,sl.createPortal)((0,Ze.jsxs)("div",{ref:l,className:"bre-protocol-menu",style:{left:s.left,top:s.top},onKeyDown:u,children:[(0,Ze.jsx)("p",{className:"bre-protocol-menu-title",children:n}),(0,Ze.jsx)("ul",{className:"bre-protocol-menu-list",role:"listbox","aria-label":n,children:r.map((c,p)=>{let b=c.value===o;return(0,Ze.jsx)("li",{children:(0,Ze.jsx)("button",{ref:h=>{f.current[p]=h},type:"button",role:"option","aria-selected":b,"aria-checked":b,"data-protocol-value":c.value,className:"bre-protocol-option",tabIndex:-1,onClick:()=>{i(c.value)},children:(0,Ze.jsxs)("span",{className:"bre-protocol-option-text",children:[(0,Ze.jsx)("span",{className:"bre-protocol-option-title",children:c.title}),(0,Ze.jsx)("span",{className:"bre-protocol-option-hint",children:c.hint})]})})},c.value)})})]}),document.body)}var C=require("react/jsx-runtime"),ym=["M8 3.9v8.2","M3.9 8h8.2"],wm="M3.9 8.35 6.6 11.05 12.1 5.5";function ll({paths:e}){return(0,C.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,C.jsx)("path",{d:t},t))})}function vm(e,t){return e.masked!==void 0?e.masked:e.configured===!1?t("keysMissing"):"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"}function cl(e){return e.alias??e.masked??e.ref}function xm(e,t){return e.models===void 0?t("keysScopeAll"):e.models.length===0?t("keysScopeNone"):t("keysScopeCount",{count:e.models.length})}var pl=["openai-completions","openai-responses","anthropic-messages","google-generative-ai"],km={openai:null,anthropic:null,gemini:null},ul=new Intl.Collator("en",{numeric:!0,sensitivity:"base"});function Em(e,t){return pl.filter(n=>n===t?!0:(e[Kr(n)]??"").length>0)}function ml(e,t){return t(e==="anthropic-messages"?"keysProtocolAnthropic":e==="openai-responses"?"keysProtocolResponses":e==="openai-completions"?"keysProtocolOpenAI":e==="google-generative-ai"?"keysProtocolGemini":"keysProtocolDefault")}function Tm(e,t){return t(e==="anthropic-messages"?"keysProtocolAnthropicHint":e==="openai-responses"?"keysProtocolResponsesHint":e==="openai-completions"?"keysProtocolOpenAIHint":e==="google-generative-ai"?"keysProtocolGeminiHint":"keysProtocolDefaultHint")}function fl(e,t,n,r=!1){return[void 0,...r?pl:Em(e,t)].map(i=>({value:i??"",title:ml(i,n),hint:Tm(i,n)}))}function to(e){let{route:t,t:n,draft:r}=e,o=e.client??Xe,[i,a]=(0,se.useState)(void 0),[s,d]=(0,se.useState)([]),[l,f]=(0,se.useState)(void 0),[m,u]=(0,se.useState)(!1),[c,p]=(0,se.useState)(void 0),[b,h]=(0,se.useState)(""),[x,S]=(0,se.useState)(""),[v,P]=(0,se.useState)([]),[D,z]=(0,se.useState)(void 0);(0,se.useEffect)(()=>{r===!0&&p({kind:"add"})},[r]);let[oe,k]=(0,se.useState)(void 0),[M,W]=(0,se.useState)(void 0),[T,R]=(0,se.useState)(km),[N,B]=(0,se.useState)([]),O=(0,se.useCallback)((g,L)=>{if(!g.ok){f({kind:"error",text:g.error??n("keysUnreachable")});return}a(g.entries),d(g.models??[]),B((g.unmergedModels??[]).slice().sort(ul.compare)),R(g.endpoints),f(L===void 0?void 0:{kind:"status",text:L})},[n]);(0,se.useEffect)(()=>{let g=!0;return(async()=>{let L=await o.list(t);g&&O(L,void 0)})(),()=>{g=!1}},[O,o,t]),(0,se.useEffect)(()=>{let g=L=>{let V=L.detail?.route;V!==void 0&&V!==t||(async()=>{let Q=await o.list(t);Q.ok&&O(Q,void 0)})()};return document.addEventListener(Tn,g),()=>{document.removeEventListener(Tn,g)}},[O,o,t]);let U=()=>{p(void 0),h(""),S(""),P([]),z(void 0)},X=(0,se.useCallback)(async(g,L)=>{let _=c;u(!0),k(void 0);try{let V=await g();O(V,L),V.ok&&_!==void 0&&_.kind!=="add"&&!V.entries.some(Q=>Q.ref===_.ref)&&U()}finally{u(!1)}},[O,c]),ce=(g,L)=>{p({kind:g,ref:L.ref}),h(g==="alias"?L.alias??"":""),S(""),P(L.models??[]),z(void 0),k(void 0)},j=()=>{if(m||c===void 0)return;let g=c.kind,L=c.ref;if(g!=="alias"&&g!=="scope"&&!Lt(x))return;let _=id(b),V=D;u(!0),(async()=>{try{if(g==="add"){let ie=new Set((i??[]).map(tt=>tt.ref)),me=await o.add(t,x,_);if(!me.ok){O(me,n("keysAdded"));return}let Se=V===void 0?void 0:me.entries.find(tt=>!ie.has(tt.ref)),Le=Se===void 0?me:await o.setProtocol(t,Se.ref,V);O(Le,n("keysAdded")),Le.ok&&U();return}if(L===void 0)return;if(g==="scope"){let ie=await o.setScope(t,L,v.length===0?void 0:v);O(ie,n("keysScopeSaved")),ie.ok&&U();return}let Q=g==="alias"?await o.rename(t,L,_):await o.replace(t,L,x);O(Q,n(g==="alias"?"keysRenamed":"keysReplaced")),Q.ok&&U()}finally{u(!1)}})()},re=g=>{P(L=>L.includes(g)?L.filter(_=>_!==g):[...L,g])},J=[...s,...N].sort(ul.compare),$=()=>{if(c===void 0)return null;let g=c.kind,L=g==="add"||g==="value",_=g==="scope",V=L&&x.length>0&&!Lt(x);return(0,C.jsxs)("div",{className:"bre-keys-form",children:[_?(0,C.jsx)("div",{className:"bre-keys-chips",role:"group","aria-label":n("keysScope"),children:J.length===0?(0,C.jsx)("p",{className:"bre-keys-hint",children:n("keysScopeEmpty")}):J.map(Q=>{let ie=v.includes(Q);return(0,C.jsx)("button",{type:"button",className:ie?"bre-keys-chip is-selected":"bre-keys-chip","aria-pressed":ie,disabled:m,onClick:()=>re(Q),children:Q},Q)})}):(0,C.jsxs)("div",{className:"bre-keys-form-fields",children:[g==="value"?null:(0,C.jsx)("input",{className:"bre-text-input bre-keys-name",type:"text",value:b,placeholder:n("keysAliasPlaceholder"),"aria-label":n("keysAlias"),disabled:m,autoFocus:g==="alias",onChange:Q=>h(Q.target.value)}),L?(0,C.jsx)("input",{className:"bre-text-input bre-keys-secret",type:"password",autoComplete:"new-password",spellCheck:!1,value:x,placeholder:n(g==="add"?"keysValuePlaceholder":"keysNewValuePlaceholder"),"aria-label":n("keysValue"),"aria-invalid":V,disabled:m,autoFocus:!0,onChange:Q=>S(Q.target.value)}):null]}),g==="add"?(0,C.jsx)("div",{className:"bre-keys-chips",role:"group","aria-label":n("keysProtocolCreate"),children:fl(T,void 0,n,r===!0).map(Q=>{let ie=Q.value===""?void 0:Q.value,me=D===ie;return(0,C.jsx)("button",{type:"button",className:me?"bre-keys-chip is-selected":"bre-keys-chip","aria-pressed":me,title:Q.hint,disabled:m,onClick:()=>z(ie),children:Q.title},Q.value)})}):null,g==="add"?(0,C.jsx)("p",{className:"bre-keys-hint",children:n("keysProtocolCreateHint")}):null,_?(0,C.jsx)("p",{className:"bre-keys-hint",children:n("keysScopeHint")}):null,V?(0,C.jsx)("p",{className:"bre-effort-message bre-error",role:"alert",children:n("keysAddIllegal")}):null,(0,C.jsxs)("div",{className:"bre-keys-form-actions",children:[_?(0,C.jsx)("button",{type:"button",className:"bre-link-button bre-keys-allmodels",disabled:m,onClick:()=>P([]),children:n("keysScopeAll")}):null,(0,C.jsx)("button",{type:"button",className:"bre-link-button",disabled:m,onClick:U,children:n("keysCancel")}),(0,C.jsx)("button",{type:"button",className:"bre-primary-button",disabled:m||L&&!Lt(x),onClick:j,children:n(g==="add"?"keysAddConfirm":"keysSave")})]})]})},de=()=>c?.kind==="add"?(0,C.jsx)("li",{className:"bre-keys-form-row",children:$()}):(0,C.jsx)("li",{className:"bre-keys-add-row",children:(0,C.jsxs)("button",{type:"button",className:"bre-keys-add",disabled:m,onClick:()=>{p({kind:"add"}),h(""),S(""),P([]),k(void 0)},children:[(0,C.jsx)("span",{className:"bre-keys-add-mark","aria-hidden":"true",children:(0,C.jsx)(ll,{paths:ym})}),n("keysAdd")]})}),fe=(g,L)=>{let _=L===""?void 0:L;W(void 0),X(()=>o.setProtocol(t,g.ref,_),n("keysProtocolSaved"))},F=M===void 0?void 0:i?.find(g=>g.ref===M.ref);if(i===void 0)return l===void 0?(0,C.jsx)("div",{className:"bre-keys"}):(0,C.jsxs)("div",{className:"bre-keys",children:[(0,C.jsx)("p",{className:"bre-effort-message bre-"+l.kind,role:l.kind==="error"?"alert":"status",children:l.text}),(0,C.jsx)("ul",{className:"bre-keys-list",children:de()})]});let G=i.reduce((g,L)=>L.enabled?g+1:g,0);return(0,C.jsxs)("div",{className:"bre-keys",children:[(0,C.jsxs)("ul",{className:"bre-keys-list",children:[i.map(g=>{let L=cl(g),_=g.enabled&&G<=1;return(0,C.jsxs)(se.Fragment,{children:[(0,C.jsxs)("li",{className:g.enabled?"bre-keys-row":"bre-keys-row is-off","data-state":g.configured===!1?"missing":"ready",children:[(0,C.jsx)("button",{type:"button",className:g.enabled?"bre-keys-toggle is-on":"bre-keys-toggle","aria-pressed":g.enabled,"aria-label":n(g.enabled?"keysDisable":"keysEnable",{name:L}),title:n(g.enabled?"keysDisable":"keysEnable",{name:L}),disabled:m||_,onClick:()=>{X(()=>o.setEnabled(t,g.ref,!g.enabled),void 0)},children:(0,C.jsx)("span",{className:"bre-keys-toggle-mark","aria-hidden":"true",children:(0,C.jsx)(ll,{paths:[wm]})})}),g.alias===void 0?null:(0,C.jsx)("span",{className:"bre-keys-alias",children:g.alias}),(0,C.jsx)("span",{className:g.alias===void 0?"bre-keys-mask bre-keys-mask-plain":"bre-keys-mask",children:vm(g,n)}),(0,C.jsx)("span",{className:oe===g.ref?"bre-keys-actions is-confirming":"bre-keys-actions",children:oe===g.ref?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("button",{type:"button",className:"bre-link-button bre-keys-danger",disabled:m,onClick:()=>{X(()=>o.remove(t,g.ref),n("keysRemoved"))},children:n("keysConfirmRemove")}),(0,C.jsx)("button",{type:"button",className:"bre-link-button",disabled:m,onClick:()=>k(void 0),children:n("keysCancel")})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("span",{className:"bre-keys-protocol-wrap",children:(0,C.jsxs)("button",{type:"button",className:"bre-keys-protocol","aria-haspopup":"listbox","aria-expanded":M?.ref===g.ref,"aria-label":n("keysProtocolLabel",{name:L}),title:n("keysProtocolLabel",{name:L}),disabled:m,onClick:V=>{let Q=V.currentTarget;W(ie=>ie?.ref===g.ref?void 0:{ref:g.ref,anchor:Q}),k(void 0)},children:[(0,C.jsx)("span",{className:"bre-keys-protocol-label",children:ml(g.protocol,n)}),(0,C.jsx)("span",{className:"bre-keys-protocol-caret","aria-hidden":"true",children:"\u203A"})]})}),(0,C.jsx)("button",{type:"button",className:"bre-link-button",disabled:m,onClick:()=>{k(g.ref),p(void 0)},children:n("keysRemove")}),(0,C.jsx)("button",{type:"button",className:"bre-link-button",disabled:m,onClick:()=>ce("alias",g),children:n("keysAlias")}),r===!0?null:(0,C.jsx)("button",{type:"button",className:"bre-link-button bre-keys-scope",disabled:m,title:n("keysScope",{name:L}),onClick:()=>ce("scope",g),children:xm(g,n)}),(0,C.jsx)("button",{type:"button",className:"bre-link-button",disabled:m,onClick:()=>ce("value",g),children:n("keysEdit")})]})})]}),c!==void 0&&c.ref===g.ref?(0,C.jsx)("li",{className:"bre-keys-form-row",children:$()}):null]},g.ref)}),de()]}),r===!0?(0,C.jsx)("p",{className:"bre-keys-note",children:n("keysDraftHint")}):null,N.length===0?null:(0,C.jsxs)("p",{className:"bre-keys-note",children:[n("keysMergedOffer",{count:N.length,models:N.join(", ")})," ",(0,C.jsx)("button",{type:"button",className:"bre-link-button",disabled:m,onClick:()=>{X(()=>o.applyMerged(t),n("keysMergedApplied"))},children:n("keysMergedApply")})]}),l===void 0?null:(0,C.jsx)("p",{className:"bre-effort-message bre-"+l.kind,role:l.kind==="error"?"alert":"status",children:l.text}),M===void 0||F===void 0?null:(0,C.jsx)(dl,{anchor:M.anchor,label:n("keysProtocolLabel",{name:cl(F)}),options:fl(T,F.protocol,n,r===!0),selected:F.protocol??"",onPick:g=>fe(F,g),onClose:()=>W(void 0)})]})}var At="bre-key-managed",Mm="bre-keys-host",Fi="data-bre-key-host",Sm="data-bre-key-input",no="data-bre-region",ht=new WeakMap;function Lm(e){let t=e.querySelector(`input[${Sm}]`);if(t instanceof HTMLInputElement)return t;let n=e.querySelector('input[type="password"]');return n instanceof HTMLInputElement?n:void 0}function hl(e){let t=ht.get(e)?.host;if(t!==void 0&&t.isConnected)return t;let n=e.nextElementSibling;return n instanceof HTMLElement&&n.hasAttribute(Fi)?n:void 0}function gl(e,t){let n=t.route;if(n===void 0||n.length===0||Lm(e)===void 0||e.parentElement===null)return;be(e,At,!0);let r=ht.get(e),o=hl(e);o===void 0&&(r!==void 0&&bl(e,r),o=e.ownerDocument.createElement("div"),o.className=Mm,e.after(o)),ee(o,Fi,n);let i=e.getAttribute(no);i===null?o.hasAttribute(no)&&o.removeAttribute(no):ee(o,no,i);let a=()=>(0,_i.createElement)(qe,{fallbackText:t.t("keysPanelFailed")},(0,_i.createElement)(to,{route:n,t:t.t,client:t.client})),s=ht.get(e);if(s!==void 0&&s.route===n){(s.t!==t.t||s.client!==t.client)&&(s.t=t.t,s.client=t.client,s.mount.root.render(a()));return}s!==void 0&&(ht.delete(e),s.mount.root.unmount()),ht.set(e,{route:n,host:o,mount:ot(o,a(),{sync:!0}),t:t.t,client:t.client})}function bl(e,t){ht.delete(e),Ce(t.mount)}function ro(e){be(e,At,!1);let t=ht.get(e);t!==void 0&&bl(e,t),hl(e)?.remove()}function yl(){for(let e of Array.from(document.querySelectorAll(`[${Fi}]`))){let t=e.previousElementSibling;t instanceof HTMLElement&&ht.has(t)?ro(t):e.remove()}}var wl="http://www.w3.org/2000/svg",Am="data-bre-icon";function Rm(e){let t=document.createElementNS(wl,"path");return t.setAttribute("d",e),t}function vl(e,t){let n=document.createElementNS(wl,"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(Am,e),n.append(...t.map(Rm)),n}var Ht="bre-key-field",El="bre-key-eye",_n="data-bre-key-input",Tl="data-bre-eye-show",Ml="data-bre-eye-hide",xl=["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"],oo=new WeakMap,Rt=new WeakMap;function io(e){let t=e.querySelector(`input[${_n}]`);if(t instanceof HTMLInputElement)return t;let n=e.querySelector('input[type="password"]');return n instanceof HTMLInputElement?n:void 0}function Wi(e){for(let t of Array.from(e.children))if(t instanceof HTMLButtonElement&&t.classList.contains(El))return t}function Sl(e){let t=io(e);t!==void 0&&(ee(t,_n,""),be(e,Ht,!0))}function Ll(e,t){let n=io(e);if(n===void 0){Xt(e);return}oo.get(e)?.route!==t.route&&Rt.delete(e),oo.set(e,t),ee(n,_n,""),be(e,Ht,!0);let r=Wi(e)??Cm(e);ee(r,Tl,t.t("keyRevealShow")),ee(r,Ml,t.t("keyRevealHide")),Ki(r,n)}function Xt(e){let t=Wi(e);t!==void 0&&t.remove(),oo.delete(e),be(e,Ht,!1);let n=e.querySelector(`input[${_n}]`);n instanceof HTMLInputElement&&(n.removeAttribute(_n),n.type="password");let r=Rt.get(e);Rt.delete(e),r!==void 0&&n instanceof HTMLInputElement&&n.value===r&&qi(n,"")}async function Hm(e){try{let t=await fetch(`${rr}?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 Ki(e,t){let n=t.type!=="password";ee(e,"aria-pressed",n?"true":"false");let r=e.getAttribute(n?Ml:Tl);r!==null&&(ee(e,"aria-label",r),ee(e,"title",r)),Ge(e,t.disabled)}function qi(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 Cm(e){let t=document.createElement("button");t.type="button",t.className=El,t.append(kl("eye"),kl("eye-off"));let n=async()=>{let r=io(e),o=oo.get(e);if(r===void 0||o===void 0)return;if(r.type!=="password"){let a=Rt.get(e);Rt.delete(e),a!==void 0&&r.value===a&&qi(r,""),r.type="password",Ki(t,r);return}let i=o.route;if(i!==void 0&&Rt.get(e)===void 0&&r.value.length===0){ee(t,"aria-busy","true");let a;try{a=await(o.loadKey??Hm)(i)}catch{a=void 0}if(t.hasAttribute("aria-busy")&&t.removeAttribute("aria-busy"),a===void 0){let s=o.t("keyRevealFailed");ee(t,"aria-label",s),ee(t,"title",s);return}if(Wi(e)!==t||!t.isConnected||io(e)!==r||r.value.length>0)return;Rt.set(e,a),qi(r,a)}r.type="text",Ki(t,r)};return t.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation(),n()}),e.append(t),t}function kl(e){let t=e==="eye-off"?[...xl,"M2.5 13.5 13.5 2.5"]:xl;return vl(e,t)}var Gi="bre-editor-tabs",Om="bre-editor-tab",ao="data-bre-tab-id",Kn="bre-tabbed",bt="data-bre-tab",Al="data-bre-provider",Pe="data-bre-region",Fn="data-bre-editor-body",en="data-bre-footer",Nm="row",Pm="path",qn="data-bre-details";var Dm=".bre-headers",Im=".bre-fingerprint",_m="data-bre-fingerprint",gt="provider",Jt="models",Qt="fingerprint",Zt="advanced",Fm=[gt,Jt,Qt,Zt],Km="none",Rl=Fm,Hl=Gi,Cl=Om,Ol=ao,so='[class*="editorActions"], [class*="modelList"], [class*="modelCatalog"], [class*="modelEntry"]',qm='[class*="modelCatalog"], [class*="modelList"], [class*="modelEntry"]',Nl='[class*="rowCard"], [class*="addCard"], li',Wm='[class*="addPanel"]',Bi=".bre-create-host";function Pl(){return{warned:new WeakSet}}function tn(e){return e===null?null:e.closest(Nl)}function Dl(e){let t=tn(e);return t!==null&&t.querySelector(Bi)!==null}function Il(e){for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.matches(Wm)&&!t.hidden)return t;return e}function _l(e,t){let n=Dr(e),r=e.getBoundingClientRect().top,o=n?.scrollTop??0;n!==void 0&&(n.style.overflowAnchor="none"),ee(e,bt,t),ql(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 Ui(e,t,n){if(!e.isConnected)return;let r=new Set;for(let o of Array.from(e.querySelectorAll(so))){let i=o.closest(Nl);i!==null&&r.add(i)}for(let o of Array.from(e.querySelectorAll(`.${Kn}`)))r.has(o)||lo(o);for(let o of r)try{$m(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)),lo(o)}}function Fl(){for(let e of Array.from(document.querySelectorAll(`.${Kn}`))){e.classList.remove(Kn),e.removeAttribute(bt),e.removeAttribute(Fn);for(let t of Array.from(e.querySelectorAll(`[${Pe}]`)))t.removeAttribute(Pe)}for(let e of Array.from(document.querySelectorAll(`[${bt}]`)))e.removeAttribute(bt);for(let e of Array.from(document.querySelectorAll(`[${Pe}]`)))e.removeAttribute(Pe);for(let e of Array.from(document.querySelectorAll(`[${Fn}]`)))e.removeAttribute(Fn);for(let e of Array.from(document.querySelectorAll(`[${en}]`)))e.removeAttribute(en);for(let e of Array.from(document.querySelectorAll(`details[${qn}]`)))e.removeAttribute("open"),e.removeAttribute(qn);for(let e of Array.from(document.querySelectorAll(`.${Ht}`)))Xt(e);for(let e of Array.from(document.querySelectorAll(`.${At}`)))ro(e);yl()}function Bm(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(so)!==null||n.querySelector("input, select")!==null))return n;let t=e.querySelector(so);for(;t!==null&&t.parentElement!==e;)t=t.parentElement;return t!==null&&t!==e?t:void 0}function Gm(e){let t={header:void 0,models:void 0,actions:void 0,fields:[]};Kl(e,t,0);let{actions:n,fields:r,header:o,models:i}=t;if(!(n===void 0||r.length===0)&&r.some(a=>a.querySelector("input, select, textarea")!==null))return{header:o,models:i,actions:n,fields:r}}var Um=4;function Kl(e,t,n){if(!(n>Um)){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(qm)){t.models??(t.models=r);continue}if(r.querySelector(so)!==null){Kl(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 zm(e,t){if(!t.contains(e))return;ee(e,en,Nm);let n=e.parentElement;for(;n!==null&&(ee(n,en,Pm),n!==t);)n=n.parentElement}function jm(e){let n=e.querySelector(`[${Al}]`)?.getAttribute(Al);return n==null||n===""?void 0:n}function $m(e,t){let n=Il(e),r=Bm(n);if(r===void 0){lo(e);return}let o=Gm(r);if(o===void 0){lo(e);return}let i=n.querySelector(Dm),a=jm(n);for(let m of o.fields)ee(m,Pe,gt),Ll(m,{t:t.t,route:a}),gl(m,{t:t.t,route:a});o.header!==void 0&&ee(o.header,Pe,Km),o.models!==void 0&&ee(o.models,Pe,Jt),ee(r,Fn,""),n.querySelector(Bi)!==null&&zm(o.actions,r),i!==null&&ee(i,Pe,Zt);let s=n.querySelector(Im);s!==null&&ee(s,Pe,Qt),Ym(r);let d=new Set([gt]);o.models!==void 0&&d.add(Jt),i!==null&&d.add(Zt);let l=n.querySelector(Bi)!==null;s!==null&&!l&&s.getAttribute(_m)==="ready"&&d.add(Qt);let f=e.getAttribute(bt)??gt;ee(e,bt,d.has(f)?f:gt),be(e,Kn,!0),Vm(e,n,t,d)}function Vm(e,t,n,r){let o=t.querySelector(`.${Gi}`);o!==null&&(ee(o,"aria-label",n.t("editorTabsLabel")),xn(Ct(o,gt),n.t("editorTabProvider")),xn(Ct(o,Jt),n.t("editorTabModels")),xn(Ct(o,Zt),n.t("editorTabAdvanced")),xn(Ct(o,Qt),n.t("editorTabFingerprint")),Ge(Ct(o,Jt),!r.has(Jt)),Ge(Ct(o,Zt),!r.has(Zt)),Ge(Ct(o,Qt),!r.has(Qt)),ql(e,o))}function ql(e,t){let n=t??Il(e).querySelector(`.${Gi}`);if(n===null)return;let r=e.getAttribute(bt)??gt;for(let o of Array.from(n.querySelectorAll(`[${ao}]`)))ee(o,"aria-selected",o.getAttribute(ao)===r?"true":"false")}function Ct(e,t){for(let n of Array.from(e.children))if(n instanceof HTMLElement&&n.getAttribute(ao)===t)return n}function lo(e){e.classList.remove(Kn),e.removeAttribute(bt),e.removeAttribute(Fn);for(let t of Array.from(e.querySelectorAll(`[${Pe}]`)))t.getAttribute(Pe)===gt&&(Xt(t),ro(t)),t.removeAttribute(Pe);for(let t of Array.from(e.querySelectorAll(`[${en}]`)))t.removeAttribute(en);Xm(e)}function Ym(e){for(let t of Array.from(e.querySelectorAll("details")))t.hasAttribute("open")||(ee(t,qn,"closed"),ee(t,"open",""))}function Xm(e){for(let t of Array.from(e.querySelectorAll(`details[${qn}]`)))t.removeAttribute("open"),t.removeAttribute(qn)}var Mc=require("react");var Te=require("react");var le=require("react");var Jm='p[class*="savedNotice"]',Gl="data-bre-saved-hidden",Qm="bre-auto-effort-note",Zm="data-bre-auto-effort-phase",Wl="bre-auto-effort-note-text",nn=new Map,Bl=new WeakMap,rn=null,co=null;function Ul(e){let t=Array.from(e.querySelectorAll(Jm));for(let n of t){let r=n.textContent?.trim()??"";Bl.get(n)!==r&&(Bl.set(n,r),r.length>0&&Vl(r)),!nn.has(n)&&(nn.set(n,n.style.display),n.setAttribute(Gl,""),n.style.display="none")}for(let[n,r]of Array.from(nn))n.isConnected&&t.includes(n)||(jl(n,r),nn.delete(n))}function zl(){for(let[e,t]of Array.from(nn))jl(e,t);nn.clear(),zi()}function jl(e,t){e.style.display=t,e.removeAttribute(Gl)}function $l(e){Vl(e)}function Vl(e){if(rn!==null&&rn.isConnected&&rn.textContent===e)return;zi();let t=document.createElement("div");t.className=Qm,t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute(Zm,"done"),t.innerHTML=`<span class="${Wl}"></span>`;let n=t.querySelector(`.${Wl}`);n!==null&&(n.textContent=e),t.style.setProperty("--bre-note-hold","3000ms"),document.body.append(t),rn=t,co=setTimeout(()=>{zi()},3e3)}function zi(){co!==null&&(clearTimeout(co),co=null),rn?.remove(),rn=null}var Ot="data-bre-settle",Yl='[class*="rowActions"] > button:not(.bre-provider-switch):not(.bre-provider-delete)';var et=null,ji=0,uo=0,Wn=!1,on=null;function Xl(e){return e.className.includes("dangerButton")?"remove":"edit"}function $i(e,t){return Array.from(e.querySelectorAll(Yl)).find(r=>Xl(r)===t)??null}function eh(e){return typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,16)}function th(e){typeof cancelAnimationFrame=="function"?cancelAnimationFrame(e):clearTimeout(e)}function Jl(e=document){Bn();let t=[];for(let n of Array.from(e.querySelectorAll(Yl))){if(n.disabled)continue;let r=n.closest("li")??n.parentElement;if(r===null)continue;let o=Xl(n);t.some(i=>i.row===r&&i.role===o)||t.push({row:r,role:o})}t.length!==0&&(et=t,uo=Date.now(),ji=uo+8e3,nh(),Ql())}function Vi(){if(et===null)return;let e=Date.now();if(e>ji){Bn();return}let t=0;if(et=et.filter(n=>{if(!n.row.isConnected)return!1;let r=$i(n.row,n.role);return r===null||(r.disabled?(Wn=!0,t+=1,r.hasAttribute(Ot)||r.setAttribute(Ot,"")):Wn&&r.hasAttribute(Ot)&&r.removeAttribute(Ot)),!0}),Wn&&t===0){Bn();return}if(!Wn&&e-uo>1500){Bn();return}Ql()}function Ql(){on!==null||et===null||(on=eh(()=>{on=null,Vi()}))}function nh(){if(et!==null)for(let e of et){let t=$i(e.row,e.role);t!==null&&!t.hasAttribute(Ot)&&t.setAttribute(Ot,"")}}function Zl(){Bn()}function Bn(){if(on!==null&&(th(on),on=null),et!==null)for(let e of et){let t=$i(e.row,e.role);t!==null&&t.removeAttribute(Ot)}et=null,Wn=!1,ji=0,uo=0}var q=require("react/jsx-runtime"),rh=["claude-cli/2.1.161 (external, cli)","claude-code/1.0.0","Kilo-Code/1.0"];function ec(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 tc(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 fo({route:e,api:t,t:n,onDismiss:r,deferred:o}){let i=(0,le.useId)(),[a,s]=(0,le.useState)(void 0),[d,l]=(0,le.useState)({rows:[]}),[f,m]=(0,le.useState)(!1),[u,c]=(0,le.useState)(!1),[p,b]=(0,le.useState)(!0),[h,x]=(0,le.useState)(!1),[S,v]=(0,le.useState)(!1),[P,D]=(0,le.useState)(void 0),[z,oe]=(0,le.useState)(void 0),[k,M]=(0,le.useState)(!1),W=(0,le.useRef)(0),T=(0,le.useRef)(null),R=o!==void 0,N=o?.onDraft,B=(0,le.useRef)(void 0);(0,le.useEffect)(()=>{if(R&&B.current!==void 0)return;B.current=e;let g=!0;return(async()=>{try{let L=await ne(t);if(!g)return;let _=Jo(L.namespace,e);s(_),l(ec(_,W)),v(L.writable!==!0)}catch{g&&v(!0)}finally{g&&b(!1)}})(),()=>{g=!1}},[t,e,R]),(0,le.useEffect)(()=>{N!==void 0&&N(tc(d))},[d,N]),(0,le.useEffect)(()=>{let g=!0;return(async()=>{try{let _=await(await fetch(ka,{method:"GET"})).json();g&&_.ok===!0&&_.data!==void 0&&oe(_.data)}catch{}})(),()=>{g=!1}},[]),(0,le.useEffect)(()=>{let g=T.current;if(g===null)return;let L=()=>{M(g.dataset.breRegion==="advanced")};L();let _=new MutationObserver(L);return _.observe(g,{attributes:!0,attributeFilter:["data-bre-region"]}),()=>{_.disconnect()}},[]);let O=()=>{l(g=>({...g,rows:[...g.rows,{id:W.current+=1,name:"",value:""}]})),D(void 0)},U=(g,L)=>{l(_=>({..._,rows:_.rows.map(V=>V.id===g?{...V,...L}:V)})),D(void 0)},X=g=>{l(L=>({...L,rows:L.rows.filter(_=>_.id!==g)})),D(void 0)},ce=()=>{l({rows:[{id:W.current+=1,name:"",value:""}]}),D(void 0)},j=()=>{if(l(ec(a,W)),c(!1),D(void 0),o!==void 0){o.onCancel();return}k&&r?.()},re=async g=>{x(!0),D(void 0),Jl();let L;try{L=await bn(t,e,g)}catch(V){L={ok:!1,error:V instanceof Error?V.message:String(V)}}if(x(!1),!L.ok){D({kind:"error",text:L.error==="no-route"?n("headersNoRoute"):L.error==="read-only"?n("headersReadOnly"):n("headersError",{error:L.error})});return}s(g),c(!1);let _=Object.keys(g).length===0?n("headersCleared"):n("headersSaved");if(k){$l(_),r?.();return}D({kind:"success",text:_})},J=Object.entries(a??{}),$=S||h,de=k||R,fe=u||de?d.rows.filter(g=>g.name.trim().length>0).length:J.length,F=d.rows.some(g=>g.name.trim().length>0||g.value.length>0),G=f||u||de;return(0,q.jsxs)("div",{className:"bre-headers",ref:T,"data-plugin":pe,"data-open":f?"1":"0",children:[(0,q.jsx)("div",{className:"bre-headers-head",children:u||de?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("span",{className:"bre-effort-title",children:n("headersTitle")}),fe===0?null:(0,q.jsx)("span",{className:"bre-headers-count",children:fe}),S||!F?null:(0,q.jsx)("button",{type:"button",className:"bre-headers-clear",disabled:$,onClick:ce,children:n("headersClear")})]}):(0,q.jsxs)("button",{type:"button",className:"bre-headers-disclosure","aria-expanded":f,"aria-label":`${n("headersTitle")} ${e}`,onClick:()=>{m(!f),D(void 0)},children:[(0,q.jsx)("span",{className:"bre-effort-title",children:n("headersTitle")}),p||fe===0?null:(0,q.jsx)("span",{className:"bre-headers-count",children:fe}),(0,q.jsx)("span",{className:"bre-headers-chevron","aria-hidden":"true",children:"\u203A"})]})}),G?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("p",{className:"bre-effort-note",children:n("headersHint")}),z===void 0?null:(0,q.jsxs)(q.Fragment,{children:[z.environment.preferOfficialLayer?(0,q.jsx)("p",{className:"bre-effort-note bre-warn",children:n("headersConflictPatched")}):null,z.conflicts.length===0&&(z.headerConflicts?.length??0)===0?null:(0,q.jsx)("p",{className:"bre-effort-note bre-warn",children:n("headersConflictOrigin")}),z.environment.siblings.length===0?null:(0,q.jsx)("p",{className:"bre-effort-note bre-warn",children:n("headersConflictSiblings",{names:z.environment.siblings.map(g=>g.name).join(", ")})})]}),p?null:u||de?(0,q.jsxs)("div",{className:"bre-headers-edit",children:[(0,q.jsxs)("div",{className:"bre-headers-columns","aria-hidden":"true",children:[(0,q.jsx)("span",{children:n("headersName")}),(0,q.jsx)("span",{children:n("headersValue")}),(0,q.jsx)("span",{})]}),d.rows.map(g=>(0,q.jsxs)("div",{className:"bre-headers-row",children:[(0,q.jsx)("input",{type:"text",className:"bre-text-input bre-headers-name",value:g.name,disabled:$,placeholder:n("headersNamePlaceholder"),"aria-label":n("headersName"),onChange:L=>{U(g.id,{name:L.target.value})}}),(0,q.jsx)("input",{type:"text",className:"bre-text-input bre-headers-value",value:g.value,disabled:$,list:g.name.trim().toLowerCase()==="user-agent"?i:void 0,placeholder:n("headersValue"),"aria-label":n("headersValue"),onChange:L=>{U(g.id,{value:L.target.value})}}),(0,q.jsx)("button",{type:"button",className:"bre-headers-remove",disabled:$,"aria-label":`${n("headersRemove")} ${g.name}`,title:n("headersRemove"),onClick:()=>{X(g.id)},children:"\xD7"})]},g.id)),(0,q.jsx)("button",{type:"button",className:"bre-headers-add",disabled:$,onClick:O,children:n("headersAdd")}),(0,q.jsx)("datalist",{id:i,children:rh.map(g=>(0,q.jsx)("option",{value:g},g))}),R?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("p",{className:"bre-effort-note",children:n("pendingSave")}),(0,q.jsx)("p",{className:"bre-effort-note",children:n("pendingHint")})]}):null]}):(0,q.jsxs)("div",{className:"bre-headers-rows",children:[J.length===0?(0,q.jsx)("p",{className:"bre-effort-note",children:n("headersEmpty")}):J.map(([g,L])=>(0,q.jsxs)("div",{className:"bre-headers-row",children:[(0,q.jsx)("span",{className:"bre-headers-name",children:g}),(0,q.jsx)("span",{className:"bre-headers-value bre-headers-masked",children:"\u2022".repeat(Math.min(L.length,24))})]},g)),S?null:(0,q.jsx)("div",{className:"bre-effort-actions",children:(0,q.jsx)("button",{type:"button",className:"bre-secondary-button",disabled:$,onClick:()=>{c(!0),D(void 0)},children:n("headersEdit")})})]})]}):null,!p&&(de||u)?(0,q.jsxs)("div",{className:"bre-effort-actions bre-headers-actions",children:[(0,q.jsx)("button",{type:"button",className:"bre-secondary-button",disabled:h,onClick:j,children:n("headersCancel")}),R?null:(0,q.jsx)("button",{type:"button",className:"bre-primary-button",disabled:$,onClick:()=>{re(tc(d))},children:n("headersSave")})]}):null,P===void 0?null:(0,q.jsx)("p",{className:"bre-effort-message bre-"+P.kind,role:P.kind==="error"?"alert":"status",children:P.text})]})}var Yi=require("react");var oh={provider:"editorTabProvider",models:"editorTabModels",fingerprint:"editorTabFingerprint",advanced:"editorTabAdvanced"};function po({host:e,t}){return(0,Yi.createElement)("div",{className:Hl,role:"tablist","aria-label":t("editorTabsLabel")},...Rl.map(n=>(0,Yi.createElement)("button",{key:n,type:"button",role:"tab",className:Cl,[Ol]:n,onClick:r=>{r.preventDefault(),r.stopPropagation();let o=tn(e.current);o!==null&&_l(o,n)}},t(oh[n]))))}var ih=15e3;function rc(){return{intents:new Map,baseline:new Map,flushing:!1}}function Xi(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 Ji(e,t){e.intents.delete(t)}function oc(e,t){let n=e.intents.get(t);n!==void 0&&(n.releasedAt=Date.now())}function ic(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 ac(e,t){return t.length>0&&!e.baseline.has(t)}async function sc(e,t){if(e.flushing)return nc(e);if(e.intents.size===0)return 0;e.flushing=!0;try{let n=await ne(t),r,o=async a=>He(n.namespace,a)?!0:(r??(r=await ne(t,{fresh:!0})),He(r.namespace,a)),i=Date.now();for(let[a,s]of Array.from(e.intents)){if(s.declaredBefore===void 0){s.releasedAt!==void 0&&s.noted!==!0&&(s.noted=!0,console.warn("[bre] deferred request headers: nobody said whether this id existed before, so the draft is held:",a));continue}if(s.declaredBefore){e.intents.delete(a);continue}if(!await o(a)){s.releasedAt!==void 0&&i-s.releasedAt>ih?(e.intents.delete(a),console.info("[bre] deferred request headers: gave up on a draft whose card closed first:",a)):s.releasedAt!==void 0&&console.info("[bre] deferred request headers: waiting for the closed card to declare",a);continue}console.info("[bre] deferred request headers: the route is declared, writing the held draft:",a);let d;try{d=await bn(t,a,s.headers)}catch(l){d={ok:!1,error:l instanceof Error?l.message:String(l)}}if(d.ok){e.intents.delete(a),console.info("[bre] deferred request headers: saved",a,Object.keys(s.headers).length,"header(s)");continue}d.error!=="no-route"&&(e.intents.delete(a),console.error("[bre] deferred request headers: the write was refused:",d.error,a))}}catch(n){console.error("[bre] deferred request headers: could not read the settings document:",n)}finally{e.flushing=!1}return nc(e)}function nc(e){let t=0;for(let n of e.intents.values())n.releasedAt!==void 0&&(t+=1);return t}var Nt=require("react/jsx-runtime");function lc({host:e,api:t,t:n,routeIdLabels:r,staged:o}){let[i,a]=(0,Te.useState)(()=>Gn(e.current,r)),s=(0,Te.useRef)(i),d=(0,Te.useRef)(void 0),l=(0,Te.useRef)(new Set),f=(0,Te.useRef)(!1),m=(0,Te.useRef)(null);return m.current===null&&(m.current={onDraft:u=>{d.current=u;let c=s.current;if(c.length===0){!f.current&&Object.keys(u).length>0&&(f.current=!0,console.info("[bre] deferred request headers: holding a draft until the provider id is typed"));return}Xi(o,c,u),dc(t,o,c,l.current)},onCancel:()=>{d.current=void 0,Ji(o,s.current)}}),(0,Te.useEffect)(()=>{let u=mo(e.current);if(u===null)return;let c=()=>{a(Gn(e.current,r))};return u.addEventListener("input",c,!0),()=>{u.removeEventListener("input",c,!0)}},[e,r]),(0,Te.useEffect)(()=>{i.length>0&&dc(t,o,i,l.current)},[t,o,i]),(0,Te.useEffect)(()=>{let u=s.current;if(u===i)return;Ji(o,u),s.current=i;let c=d.current;c!==void 0&&i.length>0&&Xi(o,i,c)},[i,o]),(0,Te.useEffect)(()=>()=>{oc(o,s.current)},[o]),(0,Nt.jsxs)(Nt.Fragment,{children:[(0,Nt.jsx)(po,{host:e,t:n}),(0,Nt.jsx)(fo,{route:i,api:t,t:n,deferred:m.current})]})}function dc(e,t,n,r){!ac(t,n)||r.has(n)||(r.add(n),(async()=>{try{let o=await ne(e);ic(t,n,He(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 mo(e){let t=e?.parentElement;return t==null?null:t.parentElement?.closest('[class*="addCard"]')??t}function Gn(e,t){let n=e?.parentElement;if(n==null)return"";let r=t(),o=Ee(n,r).trim();if(o.length>0)return o;let i=mo(e);return i===null||i===n?"":Ee(i,r).trim()}var Zi=require("react");var Me=require("react");var ah=15e3,sh=3;function uc(){return{intents:new Map,baseline:new Map,draining:!1}}function Qi(e,t,n){if(t.length===0)return;if(n.length===0){e.intents.delete(t);return}let r=e.intents.get(t);if(r===void 0){e.intents.set(t,{drafts:[...n],landed:[],declaredBefore:e.baseline.get(t),attempts:0});return}r.drafts=[...n]}function fc(e,t){e.intents.delete(t)}function pc(e,t){let n=e.intents.get(t);n!==void 0&&(n.releasedAt=Date.now())}function mc(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 hc(e,t){return t.length>0&&!e.baseline.has(t)}async function gc(e,t,n){if(e.draining)return cc(e);if(e.intents.size===0)return 0;e.draining=!0;try{let r=await ne(t),o,i=async s=>He(r.namespace,s)?!0:(o??(o=await ne(t,{fresh:!0})),He(o.namespace,s)),a=Date.now();for(let[s,d]of Array.from(e.intents)){if(d.declaredBefore===void 0){d.releasedAt!==void 0&&d.noted!==!0&&(d.noted=!0,console.warn("[bre] deferred api keys: nobody said whether this id existed before, so the drafts are held:",s));continue}if(d.declaredBefore){e.intents.delete(s);continue}if(!await i(s)){d.releasedAt!==void 0&&a-d.releasedAt>ah&&(e.intents.delete(s),console.info("[bre] deferred api keys: gave up on drafts whose card closed first:",s));continue}await dh(s,d,n)&&(e.intents.delete(s),console.info("[bre] deferred api keys: the route is declared, saved the held key list:",s))}}catch(r){console.error("[bre] deferred api keys: could not read the settings document:",r)}finally{e.draining=!1}return cc(e)}async function dh(e,t,n){let r=!1,o=!1,i=()=>{r=!0,t.attempts+=1};for(let a of t.drafts){if(t.landed.some(l=>l.ref===a.ref))continue;let s=await n.add(e,a.value,a.alias);if(!s.ok){i();break}let d=s.entries.map(l=>l.ref).find(l=>!t.landed.some(f=>f.hostRef===l));if(d===void 0){i();break}t.landed.push({ref:a.ref,hostRef:d,done:!1}),o=!0}if(!r)for(let a of t.drafts){let s=t.landed.find(d=>d.ref===a.ref);if(!(s===void 0||s.done)){if(a.protocol!==void 0){if(!(await n.setProtocol(e,s.hostRef,a.protocol)).ok){i();break}o=!0}if(!a.enabled){if(!(await n.setEnabled(e,s.hostRef,!1)).ok){i();break}o=!0}s.done=!0}}return r?(o&&(t.attempts=0),t.attempts>=sh?(console.error("[bre] deferred api keys: the write was refused; giving up on the held key list:",e),!0):!1):!0}function cc(e){let t=0;for(let n of e.intents.values())n.releasedAt!==void 0&&(t+=1);return t}var lh={openai:null,anthropic:null,gemini:null};function ch(e){let t=new Set(e.map(n=>n.ref));for(let n=1;n<=999;n+=1){let r=`key-${n}`;if(!t.has(r))return r}return`key-${Date.now()}`}function bc(e,t){let n=()=>({ok:!0,route:"",entries:e.drafts.map(a=>({ref:a.ref,...a.alias===void 0?{}:{alias:a.alias},enabled:a.enabled,configured:!0,masked:ad(a.value),...a.protocol===void 0?{}:{protocol:a.protocol}})),endpoints:lh}),r=()=>(t.onChange(e.drafts),n()),o=a=>e.drafts.find(s=>s.ref===a),i=(a,s)=>(e.drafts=e.drafts.map(d=>d.ref===a?s:d),r());return{list:async()=>n(),add:async(a,s,d)=>Lt(s)?(e.drafts=[...e.drafts,{ref:ch(e.drafts),value:s,enabled:!0,...d===void 0?{}:{alias:d}}],r()):{ok:!1,error:t.t("keysAddIllegal")},rename:async(a,s,d)=>{let l=o(s);if(l===void 0)return{ok:!1};let{alias:f,...m}=l;return i(s,{...m,...d===void 0?{}:{alias:d}})},replace:async(a,s,d)=>{let l=o(s);return l===void 0||!Lt(d)?{ok:!1,error:t.t("keysAddIllegal")}:i(s,{...l,value:d})},remove:async(a,s)=>(e.drafts=e.drafts.filter(d=>d.ref!==s),r()),setScope:async()=>n(),setEnabled:async(a,s,d)=>{let l=o(s);return l===void 0?{ok:!1}:!d&&!e.drafts.some(f=>f.ref!==s&&f.enabled)?{ok:!1,error:t.t("keysLastEnabledOff")}:i(s,{...l,enabled:d})},setProtocol:async(a,s,d)=>{let l=o(s);if(l===void 0)return{ok:!1};let{protocol:f,...m}=l;return i(s,{...m,...d===void 0?{}:{protocol:d}})},setEndpoints:async()=>n(),applyMerged:async()=>n(),reveal:async(a,s)=>o(s)?.value}}var wc=require("react/jsx-runtime");function yc({host:e,store:t,api:n,t:r,routeIdLabels:o,staged:i}){let[a,s]=(0,Me.useState)(()=>Gn(e.current,o)),d=(0,Me.useRef)(a),l=(0,Me.useRef)(new Set),f=(0,Me.useRef)(!1),m=(0,Me.useMemo)(()=>bc(t,{t:r,onChange:u=>{let c=d.current;if(c.length===0){!f.current&&u.length>0&&(f.current=!0,console.info("[bre] deferred api keys: holding the list until the provider id is typed"));return}Qi(i,c,u)}}),[i,t,r]);return(0,Me.useEffect)(()=>{let u=mo(e.current);if(u===null)return;let c=()=>{s(Gn(e.current,o))};return u.addEventListener("input",c,!0),()=>{u.removeEventListener("input",c,!0)}},[e,o]),(0,Me.useEffect)(()=>{a.length>0&&uh(n,i,a,l.current)},[n,i,a]),(0,Me.useEffect)(()=>{let u=d.current;u!==a&&(fc(i,u),d.current=a,t.drafts.length>0&&a.length>0&&Qi(i,a,t.drafts))},[a,i,t]),(0,Me.useEffect)(()=>()=>{pc(i,d.current)},[i]),(0,wc.jsx)(to,{route:a,t:r,client:m,draft:!0})}function uh(e,t,n,r){!hc(t,n)||r.has(n)||(r.add(n),(async()=>{try{let o=await ne(e);mc(t,n,He(o.namespace,n))}catch(o){r.delete(n),console.warn("[bre] deferred api keys: could not read the settings document for this route:",o)}})())}var go="data-bre-create-keys",fh="bre-keys-host",ph="data-bre-key-input",ho="data-bre-region",an=new WeakMap;function mh(e){let t=e.querySelector(`input[${ph}]`);if(t instanceof HTMLInputElement)return t;let n=e.querySelector('input[type="password"]');return n instanceof HTMLInputElement?n:void 0}function vc(e){let t=an.get(e)?.host;if(t!==void 0&&t.isConnected)return t;let n=e.nextElementSibling;return n instanceof HTMLDivElement&&n.hasAttribute(go)?n:void 0}function xc(e,t){if(e.closest(`[${go}]`)!==null){sn(e);return}if(mh(e)===void 0){sn(e);return}if(e.parentElement===null)return;be(e,At,!0);let r=an.get(e),o=vc(e);o===void 0&&(r!==void 0&&ea(e,r),o=e.ownerDocument.createElement("div"),o.className=fh,e.after(o)),ee(o,go,"");let i=e.getAttribute(ho);if(i===null?o.hasAttribute(ho)&&o.removeAttribute(ho):ee(o,ho,i),r!==void 0&&r.host===o)return;r!==void 0&&ea(e,r);let a={drafts:[]},s=o,d=ot(o,t.refreshed(()=>(0,Zi.createElement)(qe,{fallbackText:t.t("keysPanelFailed")},(0,Zi.createElement)(yc,{host:{current:s},store:a,api:t.api,t:t.t,routeIdLabels:t.routeIdLabels,staged:t.staged}))),{sync:!0});an.set(e,{host:o,mount:d})}function ea(e,t){an.delete(e),Ce(t.mount)}function sn(e){be(e,At,!1);let t=an.get(e);t!==void 0&&ea(e,t),vc(e)?.remove()}function kc(){for(let e of Array.from(document.querySelectorAll(`[${go}]`))){let t=e.previousElementSibling;t instanceof HTMLElement&&an.has(t)?sn(t):e.remove()}}var na="bre-create-host",ta="bre-add-mode-picker",hh='[class*="addCard"]',gh='[class*="addPanel"]',bh='[class*="addModes"]',Ec="-custom-panel",yh="-custom";function Sc(){return{hosts:new Map}}function ra(e,t,n){if(!e.isConnected)return;let r=new Set;for(let o of Array.from(e.querySelectorAll(hh)))if(o.isConnected)try{wh(o,t,n),r.add(o)}catch(i){bo(o,n);for(let a of oa(o))try{sn(a)}catch{}Lc(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)&&bo(o,n)}function wh(e,t,n){let r=Tc(e,Ec);(r===void 0||r.hidden)&&(Th(e),r=Tc(e,Ec),r===void 0||r.hidden)||(e.getAttribute("data-bre-add-card")!=="1"&&e.setAttribute("data-bre-add-card","1"),Sh(e,r,t,n),kh(e),Eh(r,t),Lc(e,!0))}var vh=".field, label",xh=".bre-keys-host, .bre-keys, .bre-create-host";function oa(e){let t=[],n=e.querySelectorAll('input[type="password"], input[data-bre-key-input]');for(let r of Array.from(n)){if(r.closest(xh)!==null)continue;let o=r.closest(vh)??r.parentElement;o!==null&&!t.includes(o)&&t.push(o)}return t}function kh(e){for(let t of oa(e))try{Sl(t)}catch(n){console.warn("[bre] add provider card: could not mark a key field:",n)}}function Eh(e,t){for(let n of oa(e))try{xc(n,{t:t.t,api:t.api,routeIdLabels:t.routeIdLabels,staged:t.stagedKeys,refreshed:t.refreshed})}catch(r){sn(n),console.warn("[bre] add provider card: could not mount the key list:",r)}}function Lc(e,t){let n=Ac(e);n!==void 0&&be(n,ta,t)}function Tc(e,t){for(let n of Array.from(e.querySelectorAll(gh)))if(n.id.endsWith(t))return n}function Ac(e){let t=e.querySelector(bh);if(t!==null){for(let n of Array.from(t.children))if(n instanceof HTMLElement&&n.getAttribute("role")==="tablist")return n}}function Th(e){let t=Ac(e);if(t!==void 0){for(let n of Array.from(t.querySelectorAll('[role="tab"]')))if(n.id.endsWith(yh)){if(n.disabled)return;n.getAttribute("aria-selected")!=="true"&&n.click();return}}}function Mh(e){for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.classList.contains(na))return t}function Sh(e,t,n,r){let o=r.hosts.get(e),i=Mh(t);if(i!==void 0&&o!==void 0&&o.host===i)return;bo(e,r),i!==void 0&&i.remove();let a=e.ownerDocument.createElement("div");a.className=na,t.insertBefore(a,t.firstChild),Xd(e);let s=ot(a,n.refreshed(()=>(0,Mc.createElement)(lc,{host:{current:a},api:n.api,t:n.t,routeIdLabels:n.routeIdLabels,staged:n.staged})),{sync:!0});r.hosts.set(e,{host:a,mount:s})}function bo(e,t){let n=t.hosts.get(e);n!==void 0&&(t.hosts.delete(e),Ce(n.mount))}function Rc(e){for(let t of Array.from(e.hosts.keys()))bo(t,e);for(let t of Array.from(document.querySelectorAll(`.${na}`)))t.remove();for(let t of Array.from(document.querySelectorAll(`.${ta}`)))be(t,ta,!1);for(let t of Array.from(document.querySelectorAll(`.${Ht}`)))Xt(t);kc()}var Un="data-bre-row-provider",Hc="{provider}",Lh=["rowCard","setupCard"];function Cc(){return Or()}function dt(e){for(let t of Lh)for(let n of Array.from(e.querySelectorAll(`[class*="${t}"]`))){let r=n.parentElement;if(!(r===null||r.tagName!=="UL")&&we(r).length!==0)return r}}function zn(e){return e.querySelector('[class*="rowHead"]')??void 0}function dn(e){let t=e.querySelector('[class*="rowName"]')?.textContent?.trim();return t!==void 0&&t.length>0?t:void 0}function Ah(e){let t=e.indexOf(Hc);if(!(t<0))return{prefix:e.slice(0,t),suffix:e.slice(t+Hc.length)}}function Rh(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 Hh='[class*="rowCard"], [class*="setupCard"], [class*="addCard"]';function Ch(e){let t=e.closest(Hh);for(let n=e;n!==null&&n!==t;n=n.parentElement)if(n.matches('[data-plugin], [class*="bre-"]'))return!0;return!1}function lt(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=Ah(r);if(o!==void 0)for(let i of Array.from(e.querySelectorAll("button[aria-label]"))){if(Ch(i))continue;let a=i.getAttribute("aria-label")??"";if(a.length<=o.prefix.length+o.suffix.length||!a.startsWith(o.prefix)||!a.endsWith(o.suffix))continue;let s=Rh(a.slice(o.prefix.length,a.length-o.suffix.length));if(s!==void 0)return s}}}function ia(e){let t=e.getAttribute(Un);return t===null||t.length===0?void 0:t}function Oh(e){return En(e,ia)}function Oc(e,t,n){if(!e.isConnected)return;let r=dt(e);if(r===void 0)return;let o=t.labels();for(let i of we(r)){let a=lt(i,o);if(a===void 0){i.removeAttribute(Un);continue}ia(i)!==a&&i.setAttribute(Un,a)}_r(e,r,Nh(t),n)}function Nh(e){return{rowOf:t=>{let n=t.closest("li");return n instanceof HTMLElement?n:void 0},idOf:ia,labelOf:dn,order:t=>Pa(t),commit:t=>{Oa(Oh(t))},seatOf:zn,seatDrags:!0,gripLabel:(t,n)=>e.t("providerReorderAria",{provider:dn(t)??n}),gripHint:()=>e.t("providerReorderHint")}}function Nc(e){Fr(e);let t=Array.from(document.querySelectorAll(`[${Un}]`));Pr(t);for(let n of t)n.removeAttribute(Un)}var ln="data-bre-provider-switch",yo="bre-row-disabled";function Dc(){return{switches:new WeakSet}}function Ic(e,t,n){if(!e.isConnected)return;let r=dt(e);if(r===void 0)return;let o=t.labels();for(let i of Array.from(r.children)){if(!(i instanceof HTMLElement))continue;let a=lt(i,o);if(a===void 0)continue;let s=zn(i);s!==void 0&&(Ph(i,s,a,t,n),i.classList.toggle(yo,!Bt(a)))}}function _c(){for(let e of Array.from(document.querySelectorAll(`[${ln}]`)))e.remove();for(let e of Array.from(document.querySelectorAll(`.${yo}`)))e.classList.remove(yo)}function Ph(e,t,n,r,o){let i=t.querySelector(`[${ln}]`);if(i!==null){Pc(i,e,n,r);return}let a=document.createElement("button");a.className="bre-provider-switch",a.setAttribute("type","button"),a.setAttribute("role","switch"),a.setAttribute(ln,n),Pc(a,e,n,r),Dh(a,e,o);let s=t.querySelector('[class*="rowActions"]');s===null?t.appendChild(a):s.insertBefore(a,s.firstChild)}function Pc(e,t,n,r){let o=r.t("providerToggleAria",{provider:dn(t)??n}),i=r.t("providerToggleHint"),a=Bt(n)?"true":"false";e.getAttribute(ln)!==n&&e.setAttribute(ln,n),e.getAttribute("aria-checked")!==a&&e.setAttribute("aria-checked",a),e.getAttribute("aria-label")!==o&&e.setAttribute("aria-label",o),e.getAttribute("title")!==i&&e.setAttribute("title",i)}function Dh(e,t,n){n.switches.has(e)||(n.switches.add(e),e.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation();let o=e.getAttribute(ln);if(o===null)return;let i=!Bt(o);_a(o,i),e.setAttribute("aria-checked",i?"true":"false"),t.classList.toggle(yo,!i)}))}var wo="data-bre-provider-delete",Fc='[class*="rowActions"]',Kc='[class*="dangerButton"]',Ih="bre-provider-delete";function qc(e,t){if(!e.isConnected)return;let n=dt(e);if(n===void 0)return;let r=t.labels(),o=_h(n)??t.t("providerRemoveDisabled");for(let i of Array.from(n.children)){if(!(i instanceof HTMLElement))continue;let a=lt(i,r);if(a===void 0)continue;let s=zn(i);if(s===void 0)continue;let d=s.querySelector(Fc);if(d===null)continue;let l=d.querySelector(`[${wo}]`);if(d.querySelector(Kc)!==null){l!==null&&l.remove();continue}let f=l??Fh();d.lastElementChild!==f&&d.appendChild(f),Kh(f,a,o,t.t("providerRemoveLocked",{provider:dn(i)??a}))}}function Wc(){for(let e of Array.from(document.querySelectorAll(`[${wo}]`)))e.remove()}function _h(e){let n=e.querySelector(`${Fc} ${Kc}`)?.textContent?.trim()??"";return n.length>0?n:void 0}function Fh(){let e=document.createElement("button");return e.className=Ih,e.setAttribute("type","button"),e.setAttribute("disabled",""),e}function Kh(e,t,n,r){e.getAttribute(wo)!==t&&e.setAttribute(wo,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 vo="data-bre-provider-disabled-group",qh="bre-provider-disabled-seat",Bc="bre-provider-disabled-group",aa="bre-row-folded",sa="bre-row-hidden";function Gc(){return{expanded:!1}}function Uc(e,t,n){if(!e.isConnected)return;let r=dt(e);if(r===void 0)return;let o=jc(r,t.labels()),i=o.filter(l=>!l.enabled).length,a=$c(r);if(i===0){a!==void 0&&a.remove(),da(o,n);return}let s=a??Wh(r,t,n);(s.parentElement!==r||r.lastElementChild!==s)&&r.append(s),da(o,n);let d=Vc(s);d!==void 0&&Yc(d,i,t,n)}function zc(){for(let e of Array.from(document.querySelectorAll(`[${vo}]`)))e.remove();for(let e of Array.from(document.querySelectorAll(`.${sa}, .${aa}`)))e.classList.remove(sa,aa)}function jc(e,t){let n=[];for(let r of Array.from(e.children)){if(!(r instanceof HTMLElement)||r.getAttribute(vo)!==null)continue;let o=lt(r,t);o!==void 0&&n.push({row:r,id:o,enabled:Bt(o)})}return n}function da(e,t){for(let n of e){let r=!n.enabled;n.row.classList.toggle(aa,r),n.row.classList.toggle(sa,r&&!t.expanded)}}function $c(e){for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.getAttribute(vo)!==null)return t}function Vc(e){return e.querySelector(`button.${Bc}`)??void 0}function Wh(e,t,n){let r=document.createElement("li");r.className=qh,r.setAttribute(vo,"");let o=document.createElement("button");return o.className=Bc,o.setAttribute("type","button"),o.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),n.expanded=!n.expanded,Bh(e,t,n)}),r.appendChild(o),e.append(r),r}function Bh(e,t,n){let r=jc(e,t.labels());da(r,n);let o=$c(e);if(o===void 0)return;let i=r.filter(s=>!s.enabled).length;if(i===0){o.remove();return}let a=Vc(o);a!==void 0&&Yc(a,i,t,n)}function Yc(e,t,n,r){let o=n.t(r.expanded?"providerDisabledGroupHide":"providerDisabledGroupShow",{count:t}),i=n.t("providerDisabledGroupHint"),a=r.expanded?"true":"false";e.textContent!==o&&(e.textContent=o),e.getAttribute("aria-expanded")!==a&&e.setAttribute("aria-expanded",a),e.getAttribute("aria-label")!==o&&e.setAttribute("aria-label",o),e.getAttribute("title")!==i&&e.setAttribute("title",i)}var jn="data-bre-row-model",la="bre-model-grid";function Jc(){return Or()}function Gh(e){let t=[];for(let n of Array.from(e.querySelectorAll('[class*="modelList"]')))we(n).filter(o=>o.matches('[class*="modelEntry"]')).length!==0&&t.push(n);return t}function Qc(e){for(let t of e){if(t.type!=="childList")continue;let n=t.target;if(n instanceof HTMLElement&&n.matches('[class*="modelList"]')&&we(n).some(r=>r.matches('[class*="modelEntry"]')))return!0;for(let r of[t.addedNodes,t.removedNodes])for(let o of Array.from(r))if(o instanceof HTMLElement&&o.matches('[class*="modelEntry"]'))return!0}return!1}function xo(e){let t=e.getAttribute(jn);return t===null||t.length===0?void 0:t}function ca(e,t){let n=e.closest("li");if(n!==null)return lt(n,t.labels())}function Xc(e,t){let n=Ee(e,t.labels().modelName);return n.length>0?n:xo(e)}function Uh(e,t){return{rowOf:n=>{let r=n.closest('[class*="modelEntry"]');return r instanceof HTMLElement?r:void 0},idOf:xo,labelOf:n=>Xc(n,t),order:n=>{let r=ca(e,t);return r===void 0?n:ja(r,n)},commit:n=>{let r=ca(n,t);r!==void 0&&Ua(r,En(n,xo))},seatOf:n=>n.querySelector('[class*="modelRow"]')??void 0,seatDrags:!1,gripLabel:(n,r)=>t.t("modelReorderAria",{model:Xc(n,t)??r}),gripHint:()=>t.t("modelReorderHint"),decorate:(n,r)=>{r.classList.add(la)}}}function Zc(e,t,n){if(!e.isConnected)return;let r=t.labels();for(let o of Gh(e))if(ca(o,t)!==void 0){for(let i of we(o)){let a=Ee(i,r.modelId);if(a.length===0){i.removeAttribute(jn);continue}xo(i)!==a&&i.setAttribute(jn,a)}_r(e,o,Uh(o,t),n)}}function eu(e){Fr(e);for(let n of Array.from(document.querySelectorAll(`.${la}`)))n.classList.remove(la);let t=Array.from(document.querySelectorAll(`[${jn}]`));Pr(t);for(let n of t)n.removeAttribute(jn)}var zh="settings.models",De={capacity:["modelAdvanced","Model options","Capacities"],modelId:["modelId","Model ID"],modelName:["modelName","Display name"],routeId:["customRoute","Provider ID"],baseUrl:["baseUrl","Base URL"],apiProtocol:["customApi","API protocol"],apply:["apply","Apply"],cancel:["cancel","Cancel"],editProvider:["editProvider","Edit {provider}"],inputImage:["modelInputImage","Image"],contextWindow:["modelContextWindow","contextWindow","Context window","\u4E0A\u4E0B\u6587\u7A97\u53E3"],maxOutput:["modelMaxOutput","maxOutput","maxTokens","Max output","\u6700\u5927\u8F93\u51FA"]};function ru(e){let{ctx:t,api:n,t:r,onIdle:o,refreshed:i}=e,a=()=>{let F=t.locale.bind(zh),G=g=>{let L=[];for(let _ of g){let V=F(_);V!==_&&V.trim()!==""&&!L.includes(V)&&L.push(V)}return L.length===0?g:[...L,...g.filter(_=>!L.includes(_))]};return{capacity:G(De.capacity),modelId:G(De.modelId),modelName:G(De.modelName),routeId:G(De.routeId),baseUrl:G(De.baseUrl),apiProtocol:G(De.apiProtocol),apply:G(De.apply),cancel:G(De.cancel),editProvider:G(De.editProvider),inputImage:G(De.inputImage),contextWindow:G(De.contextWindow),maxOutput:G(De.maxOutput)}},s=120,d=1e3,l=Fd(),f=Cc(),m={t:r,labels:a},u=Dc(),c={t:r,labels:a},p={t:r,labels:a},b=Gc(),h={t:r,labels:a},x=Jc(),S={t:r,labels:a},v=Pl(),P={t:r},D=Sc(),z=rc(),oe=uc(),k={t:r,api:n,routeIdLabels:()=>a().routeId,staged:z,stagedKeys:oe,refreshed:i},M,W,T,R,N=F=>{for(let G of F)for(let g of Array.from(G.addedNodes)){if(!(g instanceof HTMLElement))continue;let L=g.matches('[class*="modelAdvanced"]')?[g]:Array.from(g.querySelectorAll('[class*="modelAdvanced"]'));for(let _ of L)Oi(_)}},B=!1,O={api:n,describeNamespace:()=>ne(n),t:r,labels:a,onIdle:o,onBackoff:F=>{X(F)},onPendingChanged:()=>{re()},mount(F,G){let g=document.createElement("div");g.className="bre-effort-slot",g.dataset.plugin=pe,F.appendChild(g);let L=(0,nu.createRoot)(g),_=V=>{L.render((0,ua.createElement)(qe,{fallbackText:r("renderFailed"),children:i(()=>(0,ua.createElement)(Ar,V))}))};return(0,tu.flushSync)(()=>{_(G)}),{unmount:()=>{try{L.unmount()}finally{g.remove()}},render:_}}},U=0;function X(F){if(B)return;let G=Date.now()+F;W!==void 0&&G>=U||(W!==void 0&&window.clearTimeout(W),U=G,W=window.setTimeout(()=>{W=void 0,U=0,re()},F))}let ce=()=>{let F=We();dt(F)!==void 0&&(Oc(F,m,f),Ic(F,c,u),qc(F,p),Uc(F,h,b),Zc(F,S,x),Vi(),Ul(F))},j=(F,G)=>{try{G()}catch(g){console.error(`[bre] ${F} failed:`,g)}};function re(){B||M!==void 0||(M=window.setTimeout(()=>{M=void 0,j("composer mutation",()=>{R?.()}),j("editor reconcile",()=>{Ii(We(),O,l)}),j("add-card reconcile",()=>{ra(We(),k,D)}),j("editor tabs reconcile",()=>{Ui(We(),P,v)}),j("dom decorations",()=>{ce()}),sc(z,n).then(F=>{F>0&&X(d)}),gc(oe,n,Xe).then(F=>{F>0&&X(d)})},s))}let J=F=>{if(B||T!==void 0)return;R=F,j("models page startup",()=>{F(),ce()}),tl();let G=g=>{F(),j("editor reconcile",()=>{Ii(We(),O,l)}),ra(We(),k,D),Ui(We(),P,v),ce(),Qc(g)&&rl(We())};T=new MutationObserver(g=>{j("models mutation",()=>{G(g)}),j("early reasoning hide",()=>{N(g)}),re()}),T.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden"]}),re()},$=()=>{B=!0,M!==void 0&&(window.clearTimeout(M),M=void 0),W!==void 0&&(window.clearTimeout(W),W=void 0),T?.disconnect(),T=void 0};return{state:l,labels:a,start:J,stopObserver:$,teardown:()=>{if(!l.disposed){$(),l.disposed=!0,$d(),Id(l,O);for(let[F,G]of l.mounted)On(F),G.editor.unmount();l.mounted.clear(),Nc(f),_c(),Wc(),zc(),Is(),zl(),Zl(),eu(x),Rc(D),Fl(),Md(),nl()}},flushOnUnload:()=>{_d(l,O)},schedule:re}}var iu=e=>`?route=${encodeURIComponent(e)}`;async function au(e){try{let t=await e.json();if(typeof t.error=="string"&&t.error.length>0)return t.error}catch{}return`fingerprint request failed (${e.status})`}async function fa(e){try{let t=await fetch(`${Ro}${iu(e)}`,{method:"GET"}),n=await t.json();if(t.ok&&n.ok===!0){let r=n.data;return{ok:!0,data:{bank:r?.bank??{},records:Array.isArray(r?.records)?r.records:[]}}}return{ok:!1,error:typeof n.error=="string"?n.error:await au(t)}}catch(t){return{ok:!1,error:t instanceof Error?t.message:String(t)}}}function su(e,t,n){let r=new AbortController,o=!1;return{done:(async()=>{let a;try{let s=await fetch(`${Ro}${iu(e)}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({model:t}),signal:r.signal});if(!s.ok)return{ok:!1,error:await au(s)};let d=s.body?.getReader();if(d===void 0)return{ok:!1,error:"the fingerprint route sent no body"};let l=new TextDecoder,f="";for(;;){let{done:u,value:c}=await d.read();if(u)break;f+=l.decode(c,{stream:!0});let p=f.indexOf(`
|
|
3925
|
-
|
|
3926
|
-
`)}}let m=f.trim();if(m.length>0){let u=ou(m);u!==void 0&&(n(u),u.type==="result"?a={ok:!0,record:u.record}:u.type==="error"&&(a={ok:!1,error:u.error}))}}catch(s){return o?{ok:!1,error:"cancelled"}:{ok:!1,error:s instanceof Error?s.message:String(s)}}return a!==void 0?a:o?{ok:!1,error:"cancelled"}:{ok:!1,error:"the fingerprint route ended without a verdict"}})(),abort:()=>{o=!0,r.abort()}}}function ou(e){let t;try{t=JSON.parse(e)}catch{return}if(typeof t!="object"||t===null)return;let n=t,r=n.type;if(r==="progress")return{type:"progress",index:Number(n.index??0),ok:n.ok===!0,...typeof n.error=="string"?{error:n.error}:{}};if(r==="result"){let o=n.record;return typeof o!="object"||o===null?void 0:{type:"result",record:o}}if(r==="error")return{type:"error",error:typeof n.error=="string"?n.error:"fingerprint route failed"}}var jh=3,pa=new Map;function $h(e){return pa.get(e)??{run:(t,n,r)=>su(t,n,r)}}var ma=class{constructor(t){Fe(this,"route",t);Fe(this,"listeners",new Set);Fe(this,"recordListeners",new Set);Fe(this,"failureListeners",new Set);Fe(this,"state",{running:new Map,queued:[]});Fe(this,"inflight");Fe(this,"draining",!1);Fe(this,"disposed",!1)}getState(){return this.state}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onRecord(t){return this.recordListeners.add(t),()=>{this.recordListeners.delete(t)}}onFailure(t){return this.failureListeners.add(t),()=>{this.failureListeners.delete(t)}}idle(){return this.state.running.size===0&&this.state.queued.length===0}check(t){this.checkAll([t])}checkAll(t){if(this.disposed)return;let n=[...this.state.queued];for(let r of t)n.includes(r)||this.state.running.has(r)||n.push(r);n.length!==this.state.queued.length&&(this.publish({...this.state,queued:n}),this.drain())}abort(){this.publish({running:new Map,queued:[]}),this.inflight?.abort(),this.inflight=void 0}dispose(){this.disposed||(this.disposed=!0,this.abort(),this.listeners.clear(),this.recordListeners.clear(),this.failureListeners.clear(),ko.delete(this.route),pa.delete(this.route))}setSender(t){pa.set(this.route,t)}publish(t){this.state=t;for(let n of[...this.listeners])n()}async drain(){if(!(this.draining||this.disposed)){this.draining=!0;try{for(;;){let t=this.state.queued[0];if(t===void 0||(this.publish({running:new Map(this.state.running).set(t,0),queued:this.state.queued.slice(1)}),await this.runOne(t),this.disposed))break}}finally{this.draining=!1}}}async runOne(t){let n=$h(this.route),r=0,o=n.run(this.route,t,s=>{s.type==="progress"&&(r+=1,this.publish({running:new Map(this.state.running).set(t,Math.min(r,jh)),queued:this.state.queued}))});this.inflight=o;let i=await o.done;if(this.inflight=void 0,this.disposed)return;let a=new Map(this.state.running);if(a.delete(t),this.publish({running:a,queued:this.state.queued}),i.ok)for(let s of[...this.recordListeners])s(i.record);else for(let s of[...this.failureListeners])s(t,i.error)}},ko=new Map;function du(e){let t=ko.get(e);return t===void 0&&(t=new ma(e),ko.set(e,t)),t}function lu(){for(let e of[...ko.values()])e.dispose()}function Vh(e,t){let n=e?.list?.getSnapshot(),r=n?.current;if(typeof r=="string"&&r.length>0)return r;let o=t?.adapter?.current?.getSnapshot?.()?.key;if(typeof o=="string"&&o.length>0)return o;for(let[i,a]of Object.entries(n?.byId??{}))if(!(a===void 0||(a.retainedBy?.mainView??0)<=0))return typeof a.id=="string"&&a.id.length>0?a.id:i}function cu(e){let t,n=new Map,r=(a,s)=>{for(let[d,l]of n){if(d===s)continue;let f;try{f=a.directoryFor(l.sessionId)===d}catch{f=!1}f||(l.restore(),n.delete(d))}};return{ensure:()=>{let a=e.ctx,s=a.get?.("sessions"),d=a.get?.("uiSession"),l=a.get?.("modelDirectories"),f=Vh(s,d);if(!(f===void 0||l===void 0))try{let m=l.directoryFor(f);return r(l,m),t!==void 0&&t.sessionId===f&&t.directory===m||(n.has(m)||n.set(m,{sessionId:f,restore:rs(m,{configuredEffort:e.configuredEffort})}),t={sessionId:f,directory:m}),m}catch{t=void 0;return}},dispose:()=>{for(let[,a]of n)a.restore();n.clear()}}}var Ue=require("react");var I=require("react");var Yh=/^(gpt-|chatgpt-|o[134](-|$)|claude-)/;function Xh(e){let t=String(e??"").trim(),n=t.lastIndexOf("/");return n===-1?t:t.slice(n+1)}function uu(e){let t=Xh(e).toLowerCase();return t.length>0&&Yh.test(t)}var fu={running:new Map,queued:[]};function $n(e){return typeof e!="number"||!Number.isFinite(e)?"\u2014":`${Math.round(e*100)}%`}function Jh(e){return!Number.isFinite(e)||e<=0?"\u2014":new Date(e).toLocaleString()}function pu({route:e,api:t,t:n,ctx:r,host:o}){let[i]=(0,I.useState)(()=>Dl(o.current)),[a,s]=(0,I.useState)([]),[d,l]=(0,I.useState)(new Map),[f,m]=(0,I.useState)(void 0),[u,c]=(0,I.useState)(void 0),p=(0,I.useMemo)(()=>i?void 0:du(e),[i,e]),b=(0,I.useSyncExternalStore)((0,I.useCallback)(k=>p?.subscribe(k)??(()=>{}),[p]),(0,I.useCallback)(()=>p?.getState()??fu,[p]),(0,I.useCallback)(()=>fu,[]));(0,I.useEffect)(()=>{if(p!==void 0)return p.onRecord(k=>{c(void 0),l(M=>{let W=new Map(M);return W.set(k.model,k),W})})},[p]),(0,I.useEffect)(()=>{if(p!==void 0)return p.onFailure((k,M)=>{c({model:k,error:M})})},[p]);let h=(0,I.useCallback)(async()=>{if(i)return;let M=(await ne(t)).namespace?.value?.providers,W=Gt(M,e).map(R=>R.id).filter(R=>typeof R=="string"&&R.length>0).filter(uu);s(W.map(R=>({model:R})));let T=await fa(e);T.ok?(m(void 0),l(new Map(T.data.records.map(R=>[R.model,R])))):m(T.error)},[t,i,e]);if((0,I.useEffect)(()=>{i||h()},[i,h]),(0,I.useEffect)(()=>{if(!(i||r===void 0))return r.remote.$on("settings/document-updated",()=>{h()})},[i,r,h]),i)return null;let x=a.length,S=a.filter(k=>d.has(k.model)).length,v=a.filter(k=>d.get(k.model)?.status==="identified").length,P=a.filter(k=>d.get(k.model)?.status==="doubtful").length,D=a.filter(k=>d.get(k.model)?.status==="failed").length,z=b.running.size>0,oe=b.running.size+b.queued.length;return(0,I.createElement)("div",{className:"bre-fingerprint","data-bre-fingerprint":x>0?"ready":"none"},(0,I.createElement)("div",{className:"bre-fp-head"},(0,I.createElement)("span",{className:"bre-fp-title"},n("fpTitle")),(0,I.createElement)("span",{className:"bre-fp-count"},n("fpCount",{count:x})),(0,I.createElement)("span",{className:"bre-fp-summary",role:"status","aria-live":"polite"},z?n("fpRunning",{done:b.running.size,total:oe}):S===0?n("fpSummaryNone"):n("fpSummary",{identified:v,doubtful:P,failed:D})),(0,I.createElement)("span",{className:"grow"}),(0,I.createElement)("button",{type:"button",className:"bre-fp-all",disabled:z||x===0,onClick:()=>{p?.checkAll(a.map(k=>k.model))}},n("fpDetectAll"))),(0,I.createElement)("p",{className:"bre-fp-intro"},n("fpIntro")),f!==void 0?(0,I.createElement)("p",{className:"bre-fp-error"},n("fpLoadFailed",{error:f})):null,u!==void 0?(0,I.createElement)("p",{className:"bre-fp-error",role:"alert"},n("fpRunFailed",{error:`${u.model}: ${u.error}`})):null,(0,I.createElement)("div",{className:"bre-fp-rows"},...a.map(k=>Qh(k,{t:n,runner:p,runnerState:b,records:d,route:e}))))}function Qh(e,t){let{t:n,runner:r,runnerState:o,records:i}=t,a=i.get(e.model),s=o.running.get(e.model),d=o.queued.indexOf(e.model),l=s!==void 0,f=d>=0,m=l?{className:"is-running",text:n("fpStateRunning",{done:s,total:3})}:f?{className:"is-queued",text:n("fpQueued",{position:d+1})}:a===void 0?{className:"is-idle",text:n("fpStateUnchecked")}:a.status==="failed"?{className:"is-failed",text:n("fpStateFailed")}:a.status==="doubtful"?{className:"is-doubtful",text:n("fpStateDoubtful",{probability:$n(a.probability)})}:{className:"is-identified",text:n("fpStateIdentified",{model:a.predictionName??a.prediction??e.model,probability:$n(a.probability)})},u=a===void 0?"fpDetect":a.status==="failed"?"fpRetry":"fpRetest";return(0,I.createElement)("div",{className:"bre-fp-row",key:e.model},(0,I.createElement)("div",{className:"bre-fp-row-head"},(0,I.createElement)("span",{className:"bre-fp-model"},e.model),(0,I.createElement)("span",{className:`bre-fp-badge ${m.className}`},m.text),(0,I.createElement)("span",{className:"grow"}),(0,I.createElement)("span",{className:"bre-fp-evidence"},a===void 0?n("fpCost",{count:3,seconds:15}):n("fpEvidence",{used:a.usedOutputs,total:3,similarity:$n(a.top?.[0]?.similarity)})),(0,I.createElement)("button",{type:"button",className:"bre-fp-action",disabled:l||f,onClick:()=>{r?.check(e.model)}},n(u))),a!==void 0&&a.status!=="failed"?Zh(a,n):a!==void 0&&a.error!==void 0?(0,I.createElement)("div",{className:"bre-fp-body"},(0,I.createElement)("p",{className:"bre-fp-error"},a.error)):null)}function Zh(e,t){let n=e.top??[];return(0,I.createElement)("div",{className:"bre-fp-body"},(0,I.createElement)("div",{className:"bre-fp-family"},(0,I.createElement)("span",{className:"bre-fp-k"},t("fpFamily")),(0,I.createElement)("span",{className:"bre-fp-v"},`${e.familyPrediction??"\u2014"} \xB7 ${$n(e.familyProbability)}`),(0,I.createElement)("span",{className:"grow"}),(0,I.createElement)("span",{className:"bre-fp-k"},t("fpCheckedAt",{time:Jh(e.checkedAt)}))),(0,I.createElement)("div",{className:"bre-fp-k",style:{marginTop:"8px"}},t("fpCandidates")),(0,I.createElement)("div",{className:"bre-fp-bars"},...n.map((r,o)=>(0,I.createElement)("div",{className:"bre-fp-bar",key:r.model},(0,I.createElement)("span",{className:"bre-fp-bar-name"},r.model),(0,I.createElement)("span",{className:`bre-fp-bar-fill${o===0?" is-top":""}`,style:{width:`${Math.max(2,Math.round(r.probability*100))}%`}}),(0,I.createElement)("span",{className:"bre-fp-bar-value"},$n(r.probability))))),(0,I.createElement)("p",{className:"bre-fp-note"},t("fpClosedSet")))}var mu="settings.models.provider-card";function eg(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 tg({provider:e,api:t,t:n,ctx:r}){let o=(0,Ue.useRef)(null),i=e?.provider,a=(0,Ue.useCallback)(()=>{eg(tn(o.current))},[]);return(0,Ue.useLayoutEffect)(()=>{let s=o.current,d=tn(s);if(s===null||d===null)return;let l=d,f=()=>d.querySelector('[class*="_editor"]')!==null,m=()=>{let c=f()?"1":"0";s.dataset.edit!==c&&(s.dataset.edit=c)};m();let u=new MutationObserver(m);return u.observe(l,{childList:!0,subtree:!0}),()=>{u.disconnect()}},[i]),typeof i!="string"||i.length===0?null:(0,Ue.createElement)("div",{ref:o,className:"bre-headers-host","data-bre-provider":i},(0,Ue.createElement)(po,{host:o,t:n}),(0,Ue.createElement)(fo,{route:i,api:t,t:n,onDismiss:a}),(0,Ue.createElement)(pu,{route:i,api:t,t:n,ctx:r,host:o}))}function hu(e,t,n){let r=e,o=r.slots?.inject(mu,()=>{r.slots?.register({name:mu,key:xe,inject:()=>({api:t,t:n,ctx:e})},tg)});return typeof o=="function"?o:()=>{}}var Ie=require("react");function gu(e){let{t}=e,n=(0,Ie.useSyncExternalStore)(ir,Ke),r=()=>{La(!n)};return(0,Ie.createElement)("div",{className:"bre-slider-setting"},(0,Ie.createElement)("div",{className:"bre-slider-setting-row"},(0,Ie.createElement)("div",{className:"bre-slider-setting-copy"},(0,Ie.createElement)("div",{className:"bre-slider-setting-title"},t("sliderToggleTitle")),(0,Ie.createElement)("div",{className:"bre-slider-setting-description"},t("sliderToggleDescription"))),(0,Ie.createElement)("div",{className:"bre-slider-setting-control"},(0,Ie.createElement)("span",{className:"bre-slider-setting-state"},t(n?"settingOn":"settingOff")),(0,Ie.createElement)("button",{type:"button",role:"switch","aria-label":t("sliderToggleAria"),"aria-checked":n,className:"bre-slider-setting-switch"+(n?" is-on":""),onClick:r},(0,Ie.createElement)("span",{className:"bre-slider-setting-switch-knob","aria-hidden":!0})))))}function bu(e,t){let n=e,r=n.slots?.inject("settings.models.footer",()=>{n.slots?.register({name:"settings.models.footer",id:pe+"-slider-toggle",order:15,inject:()=>({t})},gu)});return typeof r=="function"?r:()=>{}}var wu=200,ng=pe,rg=["slots","locale","connection","remote","remote.settings"];function og(e){e.effect(()=>e.locale.register(Ho,{zh:Ma,en:Ta}),"dsh-model-think-level: dictionaries");let t=document.createElement("style");t.dataset.plugin=pe,t.dataset.pluginStyles=pe,t.textContent=$a,document.head.appendChild(t),e.effect(()=>()=>t.remove(),"dsh-model-think-level: stylesheet");let n=(()=>{try{let p=e.get?.("configForms");try{let h=p?.get?.(xe);if(h!==void 0)return h}catch{}return e.get?.("settingsScope")?.bind?.({namespace:xe})}catch{return}})(),r=n===void 0?{settings:e.remote.settings}:{settings:e.remote.settings,scope:n},o=e.locale.bind(Ho),i=()=>{let p=e.locale;return typeof p.subscribe=="function"&&typeof p.getSnapshot=="function"?p:void 0},a=p=>{let b=i();return b===void 0?p():(0,yu.createElement)(Ea,{locale:b,children:p})},s=Ss({api:r}),d=ss(r),l=cu({ctx:e,configuredEffort:s.of}),f=Ms({menuOf:ks,triggerOf:Es,t:o,refreshed:a,sliderEnabled:Ke,directory:l.ensure,configuredInputs:d}),m=Ls({api:r}),u=ru({ctx:e,api:r,t:o,onIdle:m.run,refreshed:a}),c=()=>{l.ensure(),f.reconcile()};e.effect(()=>(u.start(c),()=>{u.teardown(),f.dispose(),l.dispose()}),"dsh-model-think-level: DOM injector"),e.effect(()=>{let p=()=>{u.flushOnUnload(),lu()};return window.addEventListener("pagehide",p),()=>{window.removeEventListener("pagehide",p)}},"dsh-model-think-level: ledger flush on unload"),e.effect(()=>{let b=ya(()=>{u.state.describePromise=void 0,s.invalidate(),d.invalidate(),m.invalidate(),u.schedule()},wu),h=[e.remote.$on("settings/document-updated",x=>{x===xe&&b.schedule()}),e.on("connection/reset",b.schedule)];return()=>{b.dispose();for(let x of h)x()}},"dsh-model-think-level: pushed invalidations"),e.effect(()=>{let p=v=>{v.key===or?Aa(v.newValue!=="false"):v.key===ar?Na(qt(v.newValue)):v.key===dr?Fa(Da(v.newValue)):v.key===cr&&za(Ko(v.newValue))};window.addEventListener("storage",p);let b=ir(()=>{u.schedule()}),h=sr(()=>{u.schedule()}),x=lr(()=>{u.schedule()}),S=ur(()=>{u.schedule()});return()=>{window.removeEventListener("storage",p),b(),h(),x(),S()}},"dsh-model-think-level: client preferences"),e.effect(()=>bu(e,o),"dsh-model-think-level: footer slot activation"),e.effect(()=>hu(e,r,o),"dsh-model-think-level: provider-card slot activation")}
|
|
4102
|
+
|
|
4103
|
+
/* ==== Composer library toggle (\u5BF9\u8BDD / \u751F\u56FE) ====
|
|
4104
|
+
Pinned to the model switcher's LEFT by position, not by flow: the shell's
|
|
4105
|
+
trailing control row wraps on narrow composers, so an in-flow sibling landed
|
|
4106
|
+
on the line above the switcher, and moving the shell's trigger into a
|
|
4107
|
+
plugin-owned wrapper made React re-render it on every scan. The host is a
|
|
4108
|
+
fixed-position sibling placed against the trigger's measured rect, so no
|
|
4109
|
+
shell node and no shell style is touched. Two chips in one quiet track: the
|
|
4110
|
+
active one wears the plugin's accent tint, the other stays text-only, so the
|
|
4111
|
+
pair reads as one mode switch, not two buttons. */
|
|
4112
|
+
/* ==== Generated-image card: the chrome under a generated-image reply ==== */
|
|
4113
|
+
.bre-image-card {
|
|
4114
|
+
display: flex;
|
|
4115
|
+
align-items: center;
|
|
4116
|
+
gap: 10px;
|
|
4117
|
+
margin-top: 6px;
|
|
4118
|
+
padding: 8px 10px;
|
|
4119
|
+
border: 1px solid var(--bre-line-2);
|
|
4120
|
+
border-radius: var(--bre-r-md);
|
|
4121
|
+
background: var(--dsw-alias-bg-elevated, #ffffff);
|
|
4122
|
+
}
|
|
4123
|
+
.bre-image-card-main {
|
|
4124
|
+
display: flex;
|
|
4125
|
+
flex-direction: column;
|
|
4126
|
+
gap: 2px;
|
|
4127
|
+
min-width: 0;
|
|
4128
|
+
flex: 1 1 auto;
|
|
4129
|
+
}
|
|
4130
|
+
.bre-image-card-name {
|
|
4131
|
+
font-size: 12.5px;
|
|
4132
|
+
line-height: 18px;
|
|
4133
|
+
color: var(--bre-ink-1);
|
|
4134
|
+
overflow: hidden;
|
|
4135
|
+
text-overflow: ellipsis;
|
|
4136
|
+
white-space: nowrap;
|
|
4137
|
+
}
|
|
4138
|
+
.bre-image-card-note {
|
|
4139
|
+
font-size: 11.5px;
|
|
4140
|
+
line-height: 16px;
|
|
4141
|
+
color: var(--bre-ink-3);
|
|
4142
|
+
overflow: hidden;
|
|
4143
|
+
text-overflow: ellipsis;
|
|
4144
|
+
white-space: nowrap;
|
|
4145
|
+
}
|
|
4146
|
+
.bre-image-card-actions {
|
|
4147
|
+
display: inline-flex;
|
|
4148
|
+
align-items: center;
|
|
4149
|
+
gap: 6px;
|
|
4150
|
+
flex: none;
|
|
4151
|
+
}
|
|
4152
|
+
.bre-image-card-btn {
|
|
4153
|
+
appearance: none;
|
|
4154
|
+
border: 1px solid var(--bre-line-2);
|
|
4155
|
+
border-radius: var(--bre-r-sm);
|
|
4156
|
+
padding: 3px 9px;
|
|
4157
|
+
background: var(--dsw-alias-bg-elevated, #ffffff);
|
|
4158
|
+
color: var(--bre-ink-2);
|
|
4159
|
+
font: inherit;
|
|
4160
|
+
font-size: 12px;
|
|
4161
|
+
line-height: 18px;
|
|
4162
|
+
cursor: pointer;
|
|
4163
|
+
}
|
|
4164
|
+
.bre-image-card-btn:hover {
|
|
4165
|
+
color: var(--bre-ink-1);
|
|
4166
|
+
border-color: var(--bre-line-3);
|
|
4167
|
+
background: var(--bre-sunken-2);
|
|
4168
|
+
}
|
|
4169
|
+
.bre-image-card-btn:focus-visible {
|
|
4170
|
+
outline: 2px solid var(--bre-accent-line);
|
|
4171
|
+
outline-offset: 1px;
|
|
4172
|
+
}
|
|
4173
|
+
@media (prefers-reduced-motion: reduce) {
|
|
4174
|
+
.bre-image-card-btn {
|
|
4175
|
+
transition: none;
|
|
4176
|
+
}
|
|
4177
|
+
}
|
|
4178
|
+
|
|
4179
|
+
|
|
4180
|
+
/* ==== Image-generation config (\u751F\u56FE\u914D\u7F6E) ====
|
|
4181
|
+
The Models-page title-row button and the floating pane it opens. The pane's
|
|
4182
|
+
z-index clears the settings dialog's own opaque overlay (z-index 1000,
|
|
4183
|
+
styles.ts) \u2014 the same arithmetic the drop line above uses, kept at 1010 per
|
|
4184
|
+
the design so any host toast (1200) still lands above it. */
|
|
4185
|
+
/* The host's title is a bare h2 (block, full-width); the seat needs a flex
|
|
4186
|
+
line to hold the right edge. Plugin-owned, removed with the seat. */
|
|
4187
|
+
.bre-config-title-line {
|
|
4188
|
+
display: flex;
|
|
4189
|
+
align-items: center;
|
|
4190
|
+
}
|
|
4191
|
+
.bre-config-host {
|
|
4192
|
+
display: inline-flex;
|
|
4193
|
+
align-items: center;
|
|
4194
|
+
margin-left: auto;
|
|
4195
|
+
flex: none;
|
|
4196
|
+
}
|
|
4197
|
+
/* The seat is a ROUND, icon-only button (user request: \u5706\u5F62\u6309\u94AE\uFF0C\u53EA\u653E\u56FE\u6807\uFF0C\u4E0D\u8981\u6587\u5B57).
|
|
4198
|
+
Circle at the same 28px the host's own title-line controls use, so it reads
|
|
4199
|
+
as one of them rather than a labelled pill competing with the heading. The
|
|
4200
|
+
label is not rendered as a text node at all \u2014 it lives in the button's
|
|
4201
|
+
title/aria-label \u2014 hence the fixed square, centred glyph and zero padding. */
|
|
4202
|
+
.bre-config-btn {
|
|
4203
|
+
display: inline-flex;
|
|
4204
|
+
align-items: center;
|
|
4205
|
+
justify-content: center;
|
|
4206
|
+
width: 28px;
|
|
4207
|
+
height: 28px;
|
|
4208
|
+
padding: 0;
|
|
4209
|
+
border: 1px solid var(--bre-line-2);
|
|
4210
|
+
border-radius: 50%;
|
|
4211
|
+
background: var(--dsw-alias-bg-elevated, #ffffff);
|
|
4212
|
+
color: var(--bre-ink-2);
|
|
4213
|
+
font: inherit;
|
|
4214
|
+
line-height: 1;
|
|
4215
|
+
cursor: pointer;
|
|
4216
|
+
transition: background var(--bre-t) var(--bre-ease), color var(--bre-t) var(--bre-ease),
|
|
4217
|
+
border-color var(--bre-t) var(--bre-ease);
|
|
4218
|
+
}
|
|
4219
|
+
.bre-config-btn:hover {
|
|
4220
|
+
color: var(--bre-ink);
|
|
4221
|
+
border-color: var(--bre-line-3);
|
|
4222
|
+
background: var(--bre-hover);
|
|
4223
|
+
}
|
|
4224
|
+
.bre-config-btn:focus-visible {
|
|
4225
|
+
outline: none;
|
|
4226
|
+
border-color: var(--bre-accent);
|
|
4227
|
+
box-shadow: 0 0 0 3px var(--bre-accent-glow);
|
|
4228
|
+
}
|
|
4229
|
+
.bre-config-btn-icon { flex: none; display: block; }
|
|
4230
|
+
|
|
4231
|
+
.bre-config-backdrop {
|
|
4232
|
+
position: fixed;
|
|
4233
|
+
inset: 0;
|
|
4234
|
+
background: #00000066;
|
|
4235
|
+
z-index: 1010;
|
|
4236
|
+
display: flex;
|
|
4237
|
+
align-items: center;
|
|
4238
|
+
justify-content: center;
|
|
4239
|
+
padding: 24px;
|
|
4240
|
+
}
|
|
4241
|
+
.bre-config-pane {
|
|
4242
|
+
width: min(560px, calc(100vw - 48px));
|
|
4243
|
+
max-height: min(640px, calc(100vh - 48px));
|
|
4244
|
+
display: flex;
|
|
4245
|
+
flex-direction: column;
|
|
4246
|
+
border-radius: 12px;
|
|
4247
|
+
border: 1px solid var(--bre-line-2);
|
|
4248
|
+
background: var(--dsw-alias-bg-elevated, #ffffff);
|
|
4249
|
+
box-shadow: 0 18px 48px #00000038;
|
|
4250
|
+
overflow: hidden;
|
|
4251
|
+
}
|
|
4252
|
+
.bre-config-head {
|
|
4253
|
+
display: flex;
|
|
4254
|
+
align-items: center;
|
|
4255
|
+
gap: 8px;
|
|
4256
|
+
padding: 12px 16px;
|
|
4257
|
+
border-bottom: 1px solid var(--bre-line-1);
|
|
4258
|
+
}
|
|
4259
|
+
.bre-config-title {
|
|
4260
|
+
font-size: 14px;
|
|
4261
|
+
font-weight: 600;
|
|
4262
|
+
color: var(--bre-ink-1);
|
|
4263
|
+
}
|
|
4264
|
+
.bre-config-close {
|
|
4265
|
+
margin-left: auto;
|
|
4266
|
+
width: 24px;
|
|
4267
|
+
height: 24px;
|
|
4268
|
+
display: inline-flex;
|
|
4269
|
+
align-items: center;
|
|
4270
|
+
justify-content: center;
|
|
4271
|
+
border: none;
|
|
4272
|
+
border-radius: 6px;
|
|
4273
|
+
background: none;
|
|
4274
|
+
color: var(--bre-ink-3);
|
|
4275
|
+
font-size: 13px;
|
|
4276
|
+
cursor: pointer;
|
|
4277
|
+
}
|
|
4278
|
+
.bre-config-close:hover { background: var(--bre-accent-weak); color: var(--bre-ink-1); }
|
|
4279
|
+
.bre-config-body {
|
|
4280
|
+
padding: 14px 16px;
|
|
4281
|
+
overflow-y: auto;
|
|
4282
|
+
}
|
|
4283
|
+
.bre-config-foot {
|
|
4284
|
+
padding: 8px 16px 12px;
|
|
4285
|
+
font-size: 11px;
|
|
4286
|
+
line-height: 16px;
|
|
4287
|
+
color: var(--bre-ink-3);
|
|
4288
|
+
}
|
|
4289
|
+
.bre-config-loading {
|
|
4290
|
+
padding: 18px 4px;
|
|
4291
|
+
font-size: 12.5px;
|
|
4292
|
+
color: var(--bre-ink-3);
|
|
4293
|
+
}
|
|
4294
|
+
/* The first paint of the pane: real structure, grey rows, no spinner wobble. */
|
|
4295
|
+
.bre-config-loading-text {
|
|
4296
|
+
margin-bottom: 12px;
|
|
4297
|
+
}
|
|
4298
|
+
.bre-config-skeleton {
|
|
4299
|
+
display: flex;
|
|
4300
|
+
flex-direction: column;
|
|
4301
|
+
gap: 8px;
|
|
4302
|
+
}
|
|
4303
|
+
.bre-config-skeleton-row {
|
|
4304
|
+
height: 34px;
|
|
4305
|
+
border-radius: 10px;
|
|
4306
|
+
border: 1px solid var(--bre-line-1);
|
|
4307
|
+
background: linear-gradient(90deg, var(--bre-sunken-2) 0%, var(--bre-sunken-1) 50%, var(--bre-sunken-2) 100%);
|
|
4308
|
+
background-size: 200% 100%;
|
|
4309
|
+
animation: bre-config-shimmer 1.4s linear infinite;
|
|
4310
|
+
}
|
|
4311
|
+
@keyframes bre-config-shimmer {
|
|
4312
|
+
from { background-position: 200% 0; }
|
|
4313
|
+
to { background-position: -200% 0; }
|
|
4314
|
+
}
|
|
4315
|
+
@media (prefers-reduced-motion: reduce) {
|
|
4316
|
+
.bre-config-skeleton-row { animation: none; }
|
|
4317
|
+
}
|
|
4318
|
+
|
|
4319
|
+
.bre-config-card-head {
|
|
4320
|
+
display: flex;
|
|
4321
|
+
align-items: baseline;
|
|
4322
|
+
gap: 8px;
|
|
4323
|
+
margin-bottom: 10px;
|
|
4324
|
+
}
|
|
4325
|
+
.bre-config-card-title {
|
|
4326
|
+
font-size: 13.5px;
|
|
4327
|
+
font-weight: 600;
|
|
4328
|
+
color: var(--bre-ink-1);
|
|
4329
|
+
}
|
|
4330
|
+
.bre-config-card-sub {
|
|
4331
|
+
font-size: 11.5px;
|
|
4332
|
+
color: var(--bre-ink-3);
|
|
4333
|
+
}
|
|
4334
|
+
.bre-config-notice {
|
|
4335
|
+
margin: 0 0 10px;
|
|
4336
|
+
padding: 7px 10px;
|
|
4337
|
+
border-radius: 8px;
|
|
4338
|
+
border: 1px solid var(--bre-accent-line);
|
|
4339
|
+
background: var(--bre-accent-weak);
|
|
4340
|
+
color: var(--bre-accent-ink);
|
|
4341
|
+
font-size: 12px;
|
|
4342
|
+
line-height: 17px;
|
|
4343
|
+
overflow-wrap: anywhere;
|
|
4344
|
+
}
|
|
4345
|
+
|
|
4346
|
+
.bre-config-badge {
|
|
4347
|
+
display: inline-flex;
|
|
4348
|
+
align-items: center;
|
|
4349
|
+
padding: 1px 7px;
|
|
4350
|
+
border-radius: var(--bre-r-pill);
|
|
4351
|
+
border: 1px solid var(--bre-line-2);
|
|
4352
|
+
font-size: 11px;
|
|
4353
|
+
line-height: 16px;
|
|
4354
|
+
color: var(--bre-ink-3);
|
|
4355
|
+
white-space: nowrap;
|
|
4356
|
+
}
|
|
4357
|
+
.bre-config-badge-ok { color: #1c7c3c; border-color: #1c7c3c33; background: #1c7c3c0f; }
|
|
4358
|
+
.bre-config-badge-bad { color: #b3261e; border-color: #b3261e33; background: #b3261e0f; }
|
|
4359
|
+
.bre-config-badge-unknown { color: var(--bre-ink-3); }
|
|
4360
|
+
.bre-config-badge-default { color: var(--bre-accent); border-color: var(--bre-accent-line); background: var(--bre-accent-weak); }
|
|
4361
|
+
|
|
4362
|
+
.bre-config-defaults {
|
|
4363
|
+
display: flex;
|
|
4364
|
+
align-items: center;
|
|
4365
|
+
gap: 6px;
|
|
4366
|
+
margin: 0 0 10px;
|
|
4367
|
+
font-size: 12px;
|
|
4368
|
+
color: var(--bre-ink-3);
|
|
4369
|
+
}
|
|
4370
|
+
.bre-config-select {
|
|
4371
|
+
border: 1px solid var(--bre-line-2);
|
|
4372
|
+
border-radius: 6px;
|
|
4373
|
+
background: var(--dsw-alias-bg-elevated, #ffffff);
|
|
4374
|
+
color: var(--bre-ink-1);
|
|
4375
|
+
font: inherit;
|
|
4376
|
+
font-size: 12px;
|
|
4377
|
+
padding: 3px 6px;
|
|
4378
|
+
max-width: 128px;
|
|
4379
|
+
}
|
|
4380
|
+
|
|
4381
|
+
/* The timeout cell of the defaults row: a select over five minute steps
|
|
4382
|
+
(5/10/15/30/60), milliseconds in defaults.timeoutMs. */
|
|
4383
|
+
.bre-config-timeout {
|
|
4384
|
+
display: inline-flex;
|
|
4385
|
+
align-items: center;
|
|
4386
|
+
gap: 4px;
|
|
4387
|
+
margin-left: 2px;
|
|
4388
|
+
}
|
|
4389
|
+
.bre-config-timeout .bre-config-select {
|
|
4390
|
+
max-width: none;
|
|
4391
|
+
}
|
|
4392
|
+
|
|
4393
|
+
/* The default-model row under the params: one menu standing in for the old
|
|
4394
|
+
per-row radio, so the pick does not compete with each row's own controls. */
|
|
4395
|
+
.bre-config-default-row {
|
|
4396
|
+
display: flex;
|
|
4397
|
+
align-items: center;
|
|
4398
|
+
gap: 6px;
|
|
4399
|
+
margin: 0 0 10px;
|
|
4400
|
+
font-size: 12px;
|
|
4401
|
+
color: var(--bre-ink-3);
|
|
4402
|
+
}
|
|
4403
|
+
.bre-config-default-label { flex: none; }
|
|
4404
|
+
.bre-config-default-select {
|
|
4405
|
+
max-width: none;
|
|
4406
|
+
min-width: 160px;
|
|
4407
|
+
flex: 0 1 auto;
|
|
4408
|
+
}
|
|
4409
|
+
.bre-config-default-select:disabled { opacity: 0.6; cursor: default; }
|
|
4410
|
+
|
|
4411
|
+
.bre-config-rows {
|
|
4412
|
+
display: flex;
|
|
4413
|
+
flex-direction: column;
|
|
4414
|
+
border: 1px solid var(--bre-line-1);
|
|
4415
|
+
border-radius: 10px;
|
|
4416
|
+
overflow: hidden;
|
|
4417
|
+
}
|
|
4418
|
+
.bre-config-row {
|
|
4419
|
+
display: flex;
|
|
4420
|
+
align-items: center;
|
|
4421
|
+
gap: 10px;
|
|
4422
|
+
padding: 9px 12px;
|
|
4423
|
+
}
|
|
4424
|
+
.bre-config-row + .bre-config-row { border-top: 1px solid var(--bre-line-1); }
|
|
4425
|
+
.bre-config-name { min-width: 0; flex: 1 1 auto; }
|
|
4426
|
+
.bre-config-name-main {
|
|
4427
|
+
font-size: 12.5px;
|
|
4428
|
+
color: var(--bre-ink-1);
|
|
4429
|
+
display: flex;
|
|
4430
|
+
align-items: center;
|
|
4431
|
+
gap: 6px;
|
|
4432
|
+
overflow-wrap: anywhere;
|
|
4433
|
+
}
|
|
4434
|
+
.bre-config-name-sub {
|
|
4435
|
+
margin-top: 1px;
|
|
4436
|
+
font-size: 11px;
|
|
4437
|
+
line-height: 15px;
|
|
4438
|
+
color: var(--bre-ink-3);
|
|
4439
|
+
display: flex;
|
|
4440
|
+
align-items: center;
|
|
4441
|
+
gap: 6px;
|
|
4442
|
+
overflow-wrap: anywhere;
|
|
4443
|
+
}
|
|
4444
|
+
.bre-config-row-controls {
|
|
4445
|
+
display: flex;
|
|
4446
|
+
align-items: center;
|
|
4447
|
+
gap: 5px;
|
|
4448
|
+
flex: none;
|
|
4449
|
+
flex-wrap: wrap;
|
|
4450
|
+
justify-content: flex-end;
|
|
4451
|
+
}
|
|
4452
|
+
|
|
4453
|
+
.bre-config-btn-ghost {
|
|
4454
|
+
border: 1px solid var(--bre-line-2);
|
|
4455
|
+
border-radius: 6px;
|
|
4456
|
+
background: none;
|
|
4457
|
+
color: var(--bre-ink-2);
|
|
4458
|
+
font: inherit;
|
|
4459
|
+
font-size: 11.5px;
|
|
4460
|
+
line-height: 17px;
|
|
4461
|
+
padding: 3px 9px;
|
|
4462
|
+
cursor: pointer;
|
|
4463
|
+
flex: none;
|
|
4464
|
+
}
|
|
4465
|
+
.bre-config-btn-ghost:hover { color: var(--bre-ink-1); border-color: var(--bre-line-3); }
|
|
4466
|
+
.bre-config-btn-ghost:disabled { opacity: 0.55; cursor: default; }
|
|
4467
|
+
.bre-config-btn-primary {
|
|
4468
|
+
border: none;
|
|
4469
|
+
border-radius: 6px;
|
|
4470
|
+
background: var(--dsw-alias-label-primary, #17181a);
|
|
4471
|
+
color: var(--dsw-alias-bg-elevated, #ffffff);
|
|
4472
|
+
font: inherit;
|
|
4473
|
+
font-size: 12px;
|
|
4474
|
+
line-height: 18px;
|
|
4475
|
+
padding: 5px 12px;
|
|
4476
|
+
cursor: pointer;
|
|
4477
|
+
flex: none;
|
|
4478
|
+
}
|
|
4479
|
+
.bre-config-btn-primary:disabled { opacity: 0.6; cursor: default; }
|
|
4480
|
+
|
|
4481
|
+
.bre-config-empty {
|
|
4482
|
+
border: 1px dashed var(--bre-line-3);
|
|
4483
|
+
border-radius: 10px;
|
|
4484
|
+
padding: 14px;
|
|
4485
|
+
display: flex;
|
|
4486
|
+
flex-direction: column;
|
|
4487
|
+
gap: 6px;
|
|
4488
|
+
}
|
|
4489
|
+
.bre-config-empty-text { font-size: 12.5px; color: var(--bre-ink-2); }
|
|
4490
|
+
.bre-config-empty-hint { font-size: 11.5px; color: var(--bre-ink-3); line-height: 16px; }
|
|
4491
|
+
.bre-config-suspects {
|
|
4492
|
+
display: flex;
|
|
4493
|
+
flex-wrap: wrap;
|
|
4494
|
+
align-items: center;
|
|
4495
|
+
gap: 6px;
|
|
4496
|
+
margin-top: 4px;
|
|
4497
|
+
}
|
|
4498
|
+
.bre-config-suspect {
|
|
4499
|
+
border: 1px solid var(--bre-line-2);
|
|
4500
|
+
border-radius: var(--bre-r-pill);
|
|
4501
|
+
padding: 2px 9px;
|
|
4502
|
+
font-size: 11.5px;
|
|
4503
|
+
color: var(--bre-ink-2);
|
|
4504
|
+
}
|
|
4505
|
+
|
|
4506
|
+
.bre-config-tool {
|
|
4507
|
+
margin-top: 14px;
|
|
4508
|
+
border-top: 1px solid var(--bre-line-1);
|
|
4509
|
+
padding-top: 12px;
|
|
4510
|
+
}
|
|
4511
|
+
.bre-config-tool-head {
|
|
4512
|
+
display: flex;
|
|
4513
|
+
align-items: center;
|
|
4514
|
+
gap: 10px;
|
|
4515
|
+
font-size: 12.5px;
|
|
4516
|
+
color: var(--bre-ink-1);
|
|
4517
|
+
}
|
|
4518
|
+
.bre-config-tool-name {
|
|
4519
|
+
margin-left: auto;
|
|
4520
|
+
font-family: var(--bre-mono, ui-monospace, monospace);
|
|
4521
|
+
font-size: 11px;
|
|
4522
|
+
color: var(--bre-ink-2);
|
|
4523
|
+
background: var(--bre-line-1);
|
|
4524
|
+
border-radius: var(--bre-r-pill);
|
|
4525
|
+
padding: 1px 8px;
|
|
4526
|
+
}
|
|
4527
|
+
.bre-config-tool-status {
|
|
4528
|
+
margin-top: 6px;
|
|
4529
|
+
font-size: 11.5px;
|
|
4530
|
+
line-height: 16px;
|
|
4531
|
+
color: var(--bre-ink-3);
|
|
4532
|
+
overflow-wrap: anywhere;
|
|
4533
|
+
}
|
|
4534
|
+
.bre-config-tool-actions {
|
|
4535
|
+
display: flex;
|
|
4536
|
+
gap: 6px;
|
|
4537
|
+
margin-top: 8px;
|
|
4538
|
+
}
|
|
4539
|
+
.bre-config-tool-hint {
|
|
4540
|
+
margin-top: 8px;
|
|
4541
|
+
font-size: 11px;
|
|
4542
|
+
line-height: 16px;
|
|
4543
|
+
color: var(--bre-ink-3);
|
|
4544
|
+
}
|
|
4545
|
+
|
|
4546
|
+
/* The conversation's generated-image card (keyed tool.call.toolview). */
|
|
4547
|
+
.bre-image-card {
|
|
4548
|
+
display: flex;
|
|
4549
|
+
flex-direction: column;
|
|
4550
|
+
gap: 6px;
|
|
4551
|
+
min-width: 0;
|
|
4552
|
+
}
|
|
4553
|
+
.bre-image-card-running {
|
|
4554
|
+
font-size: 12px;
|
|
4555
|
+
color: var(--bre-ink-3);
|
|
4556
|
+
}
|
|
4557
|
+
.bre-image-card-caption {
|
|
4558
|
+
font-size: 11px;
|
|
4559
|
+
line-height: 16px;
|
|
4560
|
+
color: var(--bre-ink-3);
|
|
4561
|
+
white-space: pre-line;
|
|
4562
|
+
overflow-wrap: anywhere;
|
|
4563
|
+
}
|
|
4564
|
+
|
|
4565
|
+
`;var Kn="bre:endpoints-changed",qn="bre:settings-changed",Gn="bre:balance-changed";var jn=require("react"),sd=require("react-dom");var E=require("react"),Vs=require("react-dom");var G=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Rs(e){let t=e.toLowerCase();return t.includes("compat")||t.includes("thinkingtokenbudget")||t.includes("vllmpriority")||t.includes("supportsmaxoutput")}function nn(e,t){if(!G(e))return[];let n=e[t];return!G(n)||!Array.isArray(n.models)?[]:n.models.filter(G)}function Ht(e,t){if(!G(e))return{};let n=e[t];if(!G(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 Is=["off","minimal","low","medium","high","xhigh","max"],dp=["text","image"];var lp=[{id:"deepseek-v4-vision",patterns:["deepseek-v4-flash-vision","deepseek-v4-vision"],efforts:{off:"none",low:"low",high:"high",max:"max"},defaultEffort:"high",compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,maxTokens:384e3,note:"DeepSeek \u89C6\u89C9\u5B9E\u9A8C\u7248 id\uFF08deepseek-v4-flash-vision-exp\uFF09\u3002\u5B98\u65B9\u76EE\u5F55\u5DF2\u6807\u6CE8\u8BE5\u6A21\u578B\u9000\u5F79\uFF0C\u540D\u5B57\u4ECD\u88AB\u63A5\u53D7\u3001\u7531\u73B0\u884C deepseek-flash \u63D0\u4F9B\u670D\u52A1\u2014\u2014\u56FE\u7247\u8F93\u5165\u73B0\u5DF2\u7531 deepseek-flash \u539F\u751F\u63D0\u4F9B\u3002"},{id:"deepseek-v4-1-flash",patterns:["deepseek-v4.1-flash","deepseek-flash"],efforts:{off:"none",low:"low",high:"high",max:"max"},defaultEffort:"high",compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,maxTokens:384e3,note:'DeepSeek-V4.1-Flash\uFF082026-09-10 \u53D1\u5E03\u7684\u73B0\u884C\u5B98\u65B9\u6A21\u578B\uFF0C\u5B98\u65B9 id \u4E3A deepseek-flash\uFF1B25 \u4E07\u5E76\u53D1\u3001**\u539F\u751F\u56FE\u7247\u8F93\u5165**\uFF09\u3002V4.1 \u7684\u5404\u5199\u6CD5\uFF08deepseek-flash\u3001deepseek-v4.1-flash\u3001deepseek-v4-1-flash\uFF0C\u4EE5\u53CA\u5E26\u65E5\u671F\u540E\u7F00\u7684\u7B2C\u4E09\u65B9\u53D8\u4F53\uFF09\u90FD\u5F52\u6B64\u6761\u2014\u2014\u7EAF\u6587\u672C\u7684 deepseek-v4 \u4E3B\u5E72\u4E0D\u518D\u541E\u6389\u5B83\u4EEC\u3002\u5B98\u65B9\u679A\u4E3E\u540C V4 \u7CFB\uFF1AOff\uFF08thinking:"disabled"\uFF09/ Low / High / Max\uFF0C\u9ED8\u8BA4 High\uFF1B\u5BB9\u91CF 1,048,576 \u4E0A\u4E0B\u6587 / \u6700\u5927\u8F93\u51FA 384K\u3002'},{id:"deepseek-v4",patterns:["deepseek-v4"],efforts:{off:"none",low:"low",high:"high",max:"max"},defaultEffort:"high",compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!0},input:["text"],contextWindow:1048576,maxTokens:384e3,note:'DeepSeek \u5B98\u65B9\u679A\u4E3E Low / High / Max\uFF08\u9ED8\u8BA4 High\uFF1Bminimal\u3001medium\u3001xhigh \u517C\u5BB9\u6620\u5C04\uFF0Cultra\u2192max\uFF09\uFF0COff \u5373 thinking:"disabled"\uFF08Responses API \u4E0B off \u4EE5 reasoning.effort:"none" \u8868\u793A\uFF09\u3002\u672C\u6761\u76EE\u662F V4 \u5BB6\u65CF\u7684**\u7EAF\u6587\u672C**\u6210\u5458\uFF1Adeepseek-v4-pro\uFF08= DeepSeek-V4-Pro-0813\uFF0C\u5B98\u65B9\u4E0D\u652F\u6301\u56FE\u7247\uFF09\u4E0E\u5DF2\u9000\u5F79\u6A21\u578B\u7684\u517C\u5BB9\u522B\u540D deepseek-v4-flash\uFF08deepseek-v4-flash-vision-exp \u53E6\u6709\u89C6\u89C9\u6761\u76EE\uFF09\u3002**\u6536\u56FE\u7684 V4.1-Flash\uFF08\u5B98\u65B9 id deepseek-flash\uFF09\u53E6\u6709\u4E13\u95E8\u6761\u76EE**\uFF0C\u5176 input \u542B image\u3002\u5BB9\u91CF\uFF1A1,048,576 \u4E0A\u4E0B\u6587 / \u6700\u5927\u8F93\u51FA 384K\uFF08393,216\uFF1B\u9ED8\u8BA4\u975E\u601D\u8003 8K\u3001\u601D\u8003 64K\u3001effort=max \u65F6 128K\uFF09\u3002'},{id:"deepseek-v3",patterns:["deepseek-v3","deepseek-chat"],efforts:{off:"none",high:"high",max:"max"},compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!0},input:["text"],contextWindow:163840,maxTokens:65536,note:"DeepSeek V3 \u6863\u4F4D\uFF1AOff / High / Max\u3002\u5B98\u65B9\u5DF2\u505C\u552E V3 \u4EE3\uFF08\u5B9A\u4EF7\u9875\u4EC5\u5269 V4 \u4E09\u578B\uFF09\uFF0C\u5BB9\u91CF\u53D6\u76EE\u5F55\u73B0\u5F79\u503C\u3002"},{id:"deepseek-r1",patterns:["deepseek-r1","deepseek-reasoner"],efforts:{high:"high"},defaultEffort:"high",compat:{thinkingFormat:"deepseek",supportsReasoningEffort:!0},input:["text"],contextWindow:163840,maxTokens:32768,note:"DeepSeek-R1 \u4E3A\u63A8\u7406\u6A21\u578B\uFF0C\u4EC5\u63D0\u4F9B High\u3002\u5B98\u65B9\u5DF2\u4E0B\u67B6 R1 \u4EE3\uFF0C\u5BB9\u91CF\u53D6\u76EE\u5F55 r1-0528 \u503C\u3002"},{id:"openai-gpt-5-2",patterns:["gpt-5.2"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"off",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.2 \u6863\u4F4D\uFF1ANone / Low / Medium / High / XHigh\uFF08\u9ED8\u8BA4 None\uFF09\u3002\u5B98\u65B9\u53E6\u652F\u6301 PDF \u8F93\u5165\uFF08\u6838\u5FC3\u8BCD\u8868\u6682\u4E0D\u542B\uFF09\u3002gpt-5.2-pro \u5B98\u65B9\u9875\u672A\u5355\u5217\u6863\u4F4D\u884C\uFF0C\u6309\u672C\u6761\u76EE\u540C\u6863\u5904\u7406\uFF1Bgpt-5.2-codex \u89C1\u5355\u72EC\u6761\u76EE\u3002"},{id:"openai-gpt-5-2-codex",patterns:["gpt-5.2-codex"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.2-Codex \u6863\u4F4D\uFF1ALow / Medium / High / XHigh\uFF08\u65E0 None \u6863\uFF0C\u52FF\u52FE Off\uFF09\uFF0C\u5E26\u56FE\u8F93\u5165\u3001400K\u3002"},{id:"openai-gpt-5-6",patterns:["gpt-5.6"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:272e3,maxTokens:128e3,note:"GPT-5.6\uFF08\u522B\u540D\u5373 sol\uFF09\u6863\u4F4D\uFF1ANone / Low / Medium(\u9ED8\u8BA4) / High / XHigh / Max\uFF1Bsol/luna/terra \u540C\u6863\uFF0C\u5E26\u56FE\u8F93\u5165\u30022026-10 \u6821\u51C6\uFF1A\u4E0A\u4E0B\u6587\u6309 pi-ai 1.2.0 \u76EE\u5F55\u8BB0 272,000\uFF08\u6B64\u524D\u8BEF\u8BB0 1,050,000\uFF09\u3002"},{id:"openai-gpt-5-5",patterns:["gpt-5.5"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:272e3,maxTokens:128e3,note:"GPT-5.5 \u6863\u4F4D\uFF1ANone / Low / Medium(\u9ED8\u8BA4) / High / XHigh\uFF08\u65E0 Max \u6863\uFF09\uFF0C\u5E26\u56FE\u8F93\u5165\u3002pro \u53D8\u4F53\u4EC5 High(\u9ED8\u8BA4) / XHigh\u30011.05M \u4E0A\u4E0B\u6587\u4E14\u4EC5 Responses API\u30022026-10 \u6821\u51C6\uFF1A\u4E0A\u4E0B\u6587\u6309 pi-ai 1.2.0 \u76EE\u5F55\u8BB0 272,000\uFF08\u6B64\u524D\u8BEF\u8BB0 1,050,000\uFF09\u3002"},{id:"openai-gpt-5-4",patterns:["gpt-5.4"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"off",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:272e3,maxTokens:128e3,note:"GPT-5.4 \u6863\u4F4D\uFF1ANone(\u9ED8\u8BA4) / Low / Medium / High / XHigh\uFF0C\u5E26\u56FE\u8F93\u5165\u3002pro \u53D8\u4F53\u4EC5 Medium/High/XHigh\uFF081.05M\uFF09\uFF1Bmini/nano \u4E3A 400K \u4E0A\u4E0B\u6587\u30022026-10 \u6821\u51C6\uFF1A\u4E0A\u4E0B\u6587\u6309 pi-ai 1.2.0 \u76EE\u5F55\u8BB0 272,000\uFF08\u6B64\u524D\u8BEF\u8BB0 1,050,000\uFF09\u3002"},{id:"openai-gpt-5-3",patterns:["gpt-5.3"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.3-Codex \u6863\u4F4D\uFF1ANone / Low / Medium(\u9ED8\u8BA4) / High / XHigh\uFF0C\u5E26\u56FE\u8F93\u5165\u3001400K\uFF1B2026-10 \u6821\u51C6\uFF1ANone \u6863\u6309 pi-ai 1.2.0 \u76EE\u5F55\u8865\u56DE\uFF08\u6B64\u524D\u6309\u65E7\u6A21\u578B\u9875\u8BB0\u4E3A\u65E0 None\uFF09\u3002gpt-5.3-chat \u4E3A\u975E\u63A8\u7406\u804A\u5929\u6A21\u578B\uFF08\u89C1 chat \u6761\u76EE\uFF09\u3002"},{id:"openai-gpt-5-1",patterns:["gpt-5.1"],efforts:{off:"none",low:"low",medium:"medium",high:"high"},defaultEffort:"off",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.1 \u6863\u4F4D\uFF1ANone / Low / Medium / High\uFF08\u9ED8\u8BA4 None\uFF09\u3002"},{id:"openai-gpt-5-1-codex",patterns:["gpt-5.1-codex"],efforts:{low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.1-Codex \u7CFB\u5217\uFF1A\u5B98\u65B9\u6A21\u578B\u9875\u672A\u5355\u5217 effort \u503C\u57DF\uFF0C\u6309\u540C\u4EE3\u4FDD\u5B88\u6863 Low / Medium / High\uFF08\u65E0 None\uFF1Bxhigh \u672A\u8BC1\u5B9E\uFF09\u3002\u5982\u7AEF\u70B9\u652F\u6301 xhigh/none \u53EF\u624B\u8C03\u3002"},{id:"openai-gpt-5",patterns:["gpt-5"],efforts:{minimal:"minimal",low:"low",medium:"medium",high:"high"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5 \u521D\u4EE3\u6863\u4F4D\uFF1AMinimal / Low / Medium / High\uFF0C\u65E0\u5173\u95ED\u6863\u3002"},{id:"openai-gpt-5-2-chat",patterns:["gpt-5.2-chat"],efforts:{off:null,medium:"medium",xhigh:"xhigh"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:128e3,maxTokens:16384,note:"GPT-5.2-Chat\uFF08\u5B98\u65B9 id gpt-5.2-chat-latest\uFF09\uFF1Api-ai 1.2.0 \u76EE\u5F55\u8BB0\u4E3A\u63A8\u7406\u6A21\u578B\uFF0C\u4EC5 Medium / XHigh \u4E24\u6863\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF0C\u975E\u663E\u5F0F\u5173\u95ED\uFF09\uFF0C128K / 16,384 \u8F93\u51FA\u30022026-10 \u65B0\u589E\u6761\u76EE\u3002"},{id:"openai-chat",patterns:["gpt-5.1-chat-latest","gpt-5.3-chat-latest","gpt-5-chat-latest","gpt-chat-latest","gpt-5-chat","gpt-5.1-chat","gpt-5.3-chat"],efforts:!1,input:["text","image"],contextWindow:128e3,maxTokens:16384,note:"-chat \u7CFB\u5217\uFF08\u5B98\u65B9 id \u4E3A gpt-5.x-chat-latest\uFF09\u4E3A\u975E\u63A8\u7406\u804A\u5929\u6A21\u578B\uFF0C\u4E0D\u652F\u6301 effort \u53C2\u6570\uFF08\u52FF\u52FE\u601D\u8003\u6863\uFF09\uFF1B\u5B98\u65B9\u652F\u6301\u56FE\u7247\u8F93\u5165\uFF0C128K / 16,384 \u8F93\u51FA\u3002gpt-5-chat-latest \u5DF2\u4E8E 2026-07-23 \u4E0B\u67B6\u3001gpt-chat-latest \u5DF2\u65E0\u5B98\u65B9\u9875\u9762\uFF08\u4FDD\u7559\u6A21\u5F0F\u4F9B\u7F51\u5173\uFF09\u3002gpt-5.2-chat \u53E6\u6709\u63A8\u7406\u6761\u76EE\u3002"},{id:"openai-o",patterns:["o1","o3","o4"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:2e5,maxTokens:1e5,note:"OpenAI o \u7CFB\u6863\u4F4D\uFF1ALow / Medium / High\u3002\u5B98\u65B9\u5DF2\u4E8E 2026-06 \u516C\u544A\u9000\u5F79\uFF08o1/o1-pro/o3-mini/o4-mini 2026-10-23 \u79FB\u9664\u3001o3/o3-pro 2026-12-11\uFF09\uFF0C\u7F51\u5173\u6B8B\u7559\u4ECD\u53EF\u547D\u4E2D\uFF1B\u591A\u6570 o \u7CFB\u7AEF\u70B9\u6536\u56FE\uFF08o3-mini \u4F8B\u5916\uFF09\u3002"},{id:"openai-gpt-oss",patterns:["gpt-oss"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"low",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],contextWindow:131072,maxTokens:131072,note:"GPT-OSS \u5F00\u6E90\u6743\u91CD\uFF08Ollama/vLLM \u5E38\u89C1\uFF09\uFF1Areasoning effort Low / Medium / High\uFF0C\u7EAF\u6587\u672C\uFF0C131K \u4E0A\u4E0B\u6587 / 131K \u8F93\u51FA\u30022026-09 \u590D\u6838\uFF1A\u5B98\u65B9\u6A21\u578B\u9875\u73B0\u5728\u5199 Chat Completions = Not supported\u3001\u65E0\u56FE\u7247\u8F93\u5165\uFF08\u9ED8\u8BA4 Low \u6765\u81EA\u5B98\u65B9 CLI\uFF0C\u4E0D\u662F API \u9875\uFF09\uFF0C\u56E0\u6B64\u8FD9\u91CC\u4E0D\u518D\u58F0\u660E Off\u3002"},{id:"openai-gpt-6",patterns:["gpt-6-luna","gpt-6-sol","gpt-6-terra","gpt-6.1"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:272e3,maxTokens:128e3,note:'GPT-6 \u7CFB\uFF08luna/sol/terra\uFF0C2026-10 \u6821\u51C6\u65B0\u589E\uFF09\uFF1Api-ai 1.2.0 \u76EE\u5F55\u5168\u6863 None / Low / Medium / High / XHigh / Max\uFF0C\u5E26\u56FE\u8F93\u5165\uFF0C272,000 \u4E0A\u4E0B\u6587 / 128,000 \u8F93\u51FA\u3002gpt-6-astra \u89C1\u5355\u72EC\u6761\u76EE\uFF08\u88F8 "gpt-6" \u4E0E 6.1-sol \u7531 astra \u6761\u76EE\u627F\u63A5\uFF0Coff \u4EE5\u7701\u7565\u8868\u8FBE\uFF0C"none" \u672A\u8BC1\u5B9E\u53EF\u624B\u8C03\uFF09\u3002'},{id:"openai-gpt-6-astra",patterns:["gpt-6-astra","gpt-6","gpt-6.1-sol"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:272e3,maxTokens:128e3,note:'GPT-6 Astra \u6863\u4F4D\uFF1ALow / Medium / High / XHigh / Max\u2014\u2014**\u6CA1\u6709 None \u6863**\uFF08\u5B98\u65B9\u539F\u6587\uFF1A\u8BBE\u4E3A none \u8FD4\u56DE HTTP 400\uFF09\uFF0C\u56E0\u6B64\u672C\u6761\u76EE\u4E0D\u58F0\u660E Off\u3002\u5E26\u56FE\u8F93\u5165\uFF1B2026-10 \u6821\u51C6\uFF1A\u4E0A\u4E0B\u6587\u6309 pi-ai 1.2.0 \u76EE\u5F55\u8BB0 272,000\uFF08\u6B64\u524D\u8BEF\u8BB0 1,050,000\uFF09\u3002\u5DE5\u5177\u8C03\u7528\u9700\u8D70 Responses API\u3002gpt-6 luna/sol/terra \u89C1\u5355\u72EC\u6761\u76EE\uFF1B\u88F8 "gpt-6" \u4E0E 6.1-sol\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF09\u7531\u672C\u6761\u76EE\u627F\u63A5\u3002'},{id:"openai-gpt-daybreak",patterns:["gpt-daybreak"],efforts:{off:"none",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:105e4,maxTokens:128e3,note:"GPT-Daybreak\uFF08blue-latest 1.05M / red-latest 400K\uFF0C2026-10 \u65B0\u589E\uFF09\uFF1Api-ai 1.2.0 \u76EE\u5F55\u5168\u6863 None / Low / Medium / High / XHigh / Max\uFF0C\u5E26\u56FE\u8F93\u5165 / 128,000 \u8F93\u51FA\u3002"},{id:"openai-gpt-realtime",patterns:["gpt-realtime"],efforts:{minimal:"minimal",low:"low",medium:"medium",high:"high",xhigh:"xhigh"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:128e3,maxTokens:32e3,note:"GPT-Realtime 2.1\uFF082026-10 \u65B0\u589E\uFF09\uFF1Api-ai 1.2.0 \u76EE\u5F55\u6863\u4F4D Minimal / Low / Medium / High / XHigh\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF09\uFF0C128,000 \u4E0A\u4E0B\u6587 / 32,000 \u8F93\u51FA\u3002"},{id:"openai-gpt-5-6-cyber",patterns:["gpt-5.6-cyber"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:4e5,maxTokens:128e3,note:"GPT-5.6-Cyber\uFF1A\u5B98\u65B9\u6A21\u578B\u9875\u672A\u5355\u5217 effort \u503C\u57DF\uFF08\u4E0D\u7B49\u4E8E\u4E0D\u652F\u6301\uFF09\uFF0C\u6545\u6309\u540C\u4EE3\u4FDD\u5B88\u6863 Low / Medium / High / XHigh\uFF1B\u8BE5\u578B\u53F7\u4EC5 Responses API\uFF0C\u5E26\u56FE\u8F93\u5165\u3001400K \u4E0A\u4E0B\u6587\u3002\u5B98\u65B9\u652F\u6301\u7684\u5176\u4ED6\u6863\u4F4D\u53EF\u624B\u8C03\u540E\u5E94\u7528\u3002"},{id:"openai-gpt-4o",patterns:["gpt-4o"],efforts:!1,input:["text","image"],contextWindow:128e3,maxTokens:16384,note:"GPT-4o \u4EE3\u9645\uFF1A\u975E\u63A8\u7406\u6A21\u578B\uFF0C\u4E0D\u652F\u6301 effort \u53C2\u6570\uFF08\u52FF\u52FE\u601D\u8003\u6863\uFF09\uFF1B\u56FE\u7247\u8F93\u5165\u5168\u7CFB\u6807\u914D\uFF0C128K / 16,384 \u8F93\u51FA\u3002"},{id:"openai-gpt-4-1",patterns:["gpt-4.1"],efforts:!1,input:["text","image"],contextWindow:1047576,maxTokens:32768,note:"GPT-4.1 \u5168\u7CFB\uFF08\u542B mini/nano\uFF09\uFF1A\u975E\u63A8\u7406\u6A21\u578B\uFF0C\u4E0D\u652F\u6301 effort \u53C2\u6570\uFF1B\u5B98\u65B9 1,047,576 \u4E0A\u4E0B\u6587 / 32,768 \u8F93\u51FA\uFF0C\u5168\u7CFB\u5E26\u56FE\u8F93\u5165\u3002"},{id:"openai-gpt-4-turbo-preview",patterns:["gpt-4-turbo-preview"],efforts:!1,input:["text"],contextWindow:128e3,maxTokens:4096,note:"GPT-4 Turbo Preview\uFF1A\u975E\u63A8\u7406\u6A21\u578B\uFF0C\u7EAF\u6587\u672C\u8F93\u5165\uFF08\u6B63\u5F0F turbo \u5FEB\u7167\u652F\u6301\u56FE\u7247\uFF0C\u89C1\u4E0B\u6761\uFF09\uFF0C128K\u3002"},{id:"openai-gpt-4-turbo",patterns:["gpt-4-turbo"],efforts:!1,input:["text","image"],contextWindow:128e3,maxTokens:4096,note:"GPT-4 Turbo\uFF1A\u975E\u63A8\u7406\u6A21\u578B\uFF0C\u5B98\u65B9\u652F\u6301\u56FE\u7247\u8F93\u5165\uFF0C128K / 4,096 \u8F93\u51FA\u3002"},{id:"openai-gpt",patterns:["gpt-4","gpt-3.5"],efforts:!1,input:["text"],note:"GPT-4/3.5 \u4EE3\u9645\uFF1A\u975E\u63A8\u7406\u6A21\u578B\uFF0C\u4E0D\u652F\u6301 effort \u53C2\u6570\uFF08\u52FF\u52FE\u601D\u8003\u6863\uFF09\u3002gpt-4-turbo/4.1 \u8D77\u652F\u6301\u56FE\u7247\uFF0C\u89C1\u5355\u72EC\u6761\u76EE\uFF1B\u65B0\u4EE3\u8BF7\u7528 GPT-5 \u7CFB\uFF08\u89C1 openai-chat/gpt-5.x \u6761\u76EE\uFF09\u3002"},{id:"anthropic-claude-5-5",patterns:["claude-haiku-5.5","claude-opus-5-5","claude-sonnet-5-5","haiku-5.5","claude-5-5"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},defaultEffort:"high",compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude 5.5 \u4EE3\uFF08Haiku 5.5 / Opus 5.5 / Sonnet 5.5\uFF09\uFF1Api-ai 1.2.0 \u5B98\u65B9\u76EE\u5F55\u5168\u6863 Low / Medium / High(\u9ED8\u8BA4) / XHigh / Max\uFF0C\u81EA\u9002\u5E94\u601D\u8003\uFF0C1M \u4E0A\u4E0B\u6587 / 128K \u8F93\u51FA\u3002off/minimal \u4EE5\u7701\u7565\u8868\u8FBE\uFF08\u76EE\u5F55\u5C06\u4E24\u952E\u8BB0\u4E3A null\uFF0C\u975E\u663E\u5F0F\u5173\u95ED\uFF09\u3002"},{id:"anthropic-claude-5",patterns:["claude-fable-5","claude-mythos-5","claude-opus-5","claude-sonnet-5"],efforts:{xhigh:"xhigh",max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude 5 \u4EE3\uFF08Fable 5 / Mythos 5 / Opus 5 / Sonnet 5\uFF09\uFF1A2026-10 \u6821\u51C6\u2014\u2014pi-ai 1.2.0 \u5B98\u65B9\u76EE\u5F55\u5DF2\u6536\u7D27\u4E3A XHigh / Max\uFF08low/medium/high \u6863\u5DF2\u4ECE\u8BE5\u4EE3 effort \u76EE\u5F55\u79FB\u9664\uFF1BFable 5 \u4E0E Opus 5 \u53E6\u63A5\u53D7\u4EE5\u7701\u7565\u8868\u8FBE\u7684 off\uFF0CSonnet 5 \u65E0 off\uFF09\u30021M \u4E0A\u4E0B\u6587 / 128K \u8F93\u51FA\uFF08Batch 300K\uFF09\u3002\u5B98\u65B9\u652F\u6301 PDF \u8F93\u5165\u3002\u6CE8\u610F\uFF1AAnthropic \u5B98\u65B9 OpenAI \u517C\u5BB9\u5C42\u4F1A\u5FFD\u7565 effort \u53C2\u6570\uFF0C\u58F0\u660E\u5728\u7B2C\u4E09\u65B9\u7F51\u5173\u6620\u5C04\u65F6\u751F\u6548\u3002"},{id:"anthropic-claude-5-1",patterns:["claude-fable-5-1","claude-mythos-5-1"],efforts:{xhigh:"xhigh",max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude Fable 5.1 / Mythos 5.1\uFF1A2026-10 \u6821\u51C6\u2014\u2014pi-ai 1.2.0 \u76EE\u5F55\u6863\u4F4D XHigh / Max\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF09\uFF0C\u81EA\u9002\u5E94\u601D\u8003\u5E38\u5F00\uFF08\u4E0D\u63A5\u53D7 enabled/disabled\uFF09\u30021M \u4E0A\u4E0B\u6587 / 128K \u8F93\u51FA\uFF1BFable 5.1 \u652F\u6301\u4F1A\u8BDD\u4E2D\u9014\u6539\u6863\uFF08\u9700 beta header\uFF0C\u672C\u63D2\u4EF6\u4E0D\u6D89\u53CA\uFF09\u3002"},{id:"anthropic-claude-mythos-preview",patterns:["claude-mythos-preview"],efforts:{low:"low",medium:"medium",high:"high",max:"max"},defaultEffort:"high",compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude Mythos Preview\uFF1A\u5B98\u65B9\u6863\u4F4D Low / Medium / High / Max\uFF08\u65E0 XHigh\uFF09\uFF0C1M \u4E0A\u4E0B\u6587\u3002pi-ai 1.2.0 \u76EE\u5F55\u65E0 mythos \u6761\u76EE\uFF0C\u672C\u6863\u4F4D\u6CBF\u7528\u5B98\u65B9 effort \u77E9\u9635\u3002"},{id:"anthropic-claude-opus-4-high",patterns:["claude-opus-4-8","claude-opus-4-7"],efforts:{xhigh:"xhigh",max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude Opus 4.7/4.8\uFF1A2026-10 \u6821\u51C6\u2014\u2014pi-ai 1.2.0 \u5B98\u65B9\u76EE\u5F55\u6863\u4F4D\u4EC5 XHigh / Max\uFF08low/medium/high \u5DF2\u4ECE\u8BE5\u4EE3\u76EE\u5F55\u79FB\u9664\uFF1Bxhigh \u4E3A\u5B98\u65B9\u63A8\u8350\u7684\u7F16\u7801\u8D77\u6B65\u6863\uFF09\u30021M \u4E0A\u4E0B\u6587\u3002"},{id:"anthropic-claude-4-6",patterns:["claude-opus-4-6","claude-sonnet-4-6"],efforts:{max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1e6,maxTokens:128e3,note:"Claude 4.6 \u4EE3\uFF08Opus 4.6 / Sonnet 4.6\uFF09\uFF1A2026-10 \u6821\u51C6\u2014\u2014pi-ai 1.2.0 \u5B98\u65B9\u76EE\u5F55\u4EC5\u5269 Max \u4E00\u6863\uFF08low/medium/high/xhigh \u5747\u5DF2\u4ECE\u76EE\u5F55\u79FB\u9664\uFF09\u30021M \u4E0A\u4E0B\u6587\u3002"},{id:"anthropic-claude-opus-4-5",patterns:["claude-opus-4-5"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"high",compat:{supportsReasoningEffort:!0},input:["text","image"],contextWindow:2e5,maxTokens:64e3,note:"Claude Opus 4.5\uFF1A\u5B98\u65B9 effort \u652F\u6301\u5217\u8868\uFF0820251101 \u5FEB\u7167\uFF09\uFF0C\u6863\u4F4D Low / Medium / High\uFF08\u65E0 XHigh/Max\uFF09\uFF0C\u53EF\u4E0E budget_tokens \u5E76\u7528\uFF1B200K / 64K\u3002"},{id:"anthropic-claude",patterns:["claude"],efforts:!1,input:["text","image"],contextWindow:2e5,maxTokens:64e3,note:"Claude 3.x \u4E0E Sonnet 4.5 / Haiku 4.5\uFF1A\u5B98\u65B9 effort \u53C2\u6570\u4E0D\u652F\u6301\uFF08\u4EC5 5.5/5/5.1 \u4EE3\u3001Opus 4.5/4.6/4.7/4.8\u3001Sonnet 4.6 \u652F\u6301\uFF09\uFF0C\u601D\u8003\u7531 thinking.type \u63A7\u5236\u2014\u2014\u52FF\u52FE\u601D\u8003\u6863\u3002\u53C2\u8003\u5BB9\u91CF 200K / 64K\uFF08Haiku 3.5 \u4E3A\u7EAF\u6587\u672C\uFF0C\u6309\u9700\u53D6\u6D88\u56FE\u7247\uFF09\u3002Haiku 5.5 \u53CA\u6574\u4E2A 5.5 \u4EE3\u89C1\u4E0A\u65B9 anthropic-claude-5-5 \u6761\u76EE\u3002"},{id:"google-gemini",patterns:["gemini"],efforts:{low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,maxTokens:65536,note:"Gemini \u901A\u7528\u5B89\u5168\u6863\uFF1ALow / Medium / High\uFF08\u5B98\u65B9 OpenAI \u517C\u5BB9\u6620\u5C04\u8868\u53E6\u6536 minimal\uFF1A2.5 \u7CFB\u6620\u5C04\u4E3A 1,024 \u9884\u7B97\u30013.1 Flash-Lite/3 Flash \u539F\u751F minimal\u30013.1 Pro \u843D low\uFF09\u3002none \u4EC5\u80FD\u5173 2.5 \u975E Pro\uFF1B2.5 Pro \u4E0E 3 \u4EE3\u4E0D\u53EF\u5173\uFF1B\u5404\u578B\u9ED8\u8BA4\u4E0D\u4E00\uFF08flash-lite \u9ED8\u8BA4\u5173\uFF09\u3002\u5B98\u65B9\u53E6\u6536\u97F3\u9891/\u89C6\u9891/PDF\u3002Gemma-4 \u89C1\u4E0B\u6761\u3002"},{id:"google-gemma-4",patterns:["gemma-4"],efforts:{off:null,minimal:"MINIMAL",high:"HIGH"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:262144,maxTokens:32768,note:"Gemma 4\uFF0826b/31b-it\uFF09\uFF1A\u4E09\u6863 Minimal / High\uFF08\u6863\u4F4D\u7EBF\u4E3A\u5B98\u65B9\u5927\u5199\u679A\u4E3E\u62FC\u5199\uFF09\uFF0Coff \u4EE5\u7701\u7565\u8868\u8FBE\uFF1BLow/Medium \u4E0D\u88AB\u63A5\u53D7\u3002\u5E26\u56FE\u8F93\u5165\uFF0C262,144 / 32,768\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF09\u3002"},{id:"xai-grok-4-7",patterns:["grok-4.7"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:5e5,maxTokens:5e5,note:'Grok 4.7\uFF1A\u6863\u4F4D Low / Medium / High / XHigh\uFF0C\u601D\u8003\u4E0D\u53EF\u5173\u95ED\uFF08off \u4EC5\u4EE5\u7701\u7565\u8868\u8FBE\uFF09\uFF1B\u5E26\u56FE\u8F93\u5165\uFF0C500K \u4E0A\u4E0B\u6587 / 500K \u8F93\u51FA\uFF082026-10 \u6821\u51C6\uFF1Api-ai 1.2.0 \u5B98\u65B9\u76EE\u5F55\u786E\u8BA4\u6863\u4F4D\u4E0E\u5BB9\u91CF\uFF0C"\u4E0A\u6E38 404"\u4E0E"\u6863\u4F4D\u672A\u8BC1\u5B9E"\u4E24\u6761\u65E7\u8BB0\u5F55\u4F5C\u5E9F\uFF09\u3002grok-4.5 \u4F20 xhigh \u88AB\u9759\u9ED8\u6309 High \u5904\u7406\u7684\u8BF4\u660E\u89C1\u5176\u6761\u76EE\u3002'},{id:"xai-grok-high",patterns:["grok-4.6"],efforts:{low:"low",medium:"medium",high:"high",xhigh:"xhigh"},defaultEffort:"high",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:5e5,note:'Grok 4.6 \u6863\u4F4D\uFF1ALow / Medium / High(\u9ED8\u8BA4) / XHigh\uFF0C\u601D\u8003\u4E0D\u53EF\u5173\u95ED\uFF1B\u5E26\u56FE\u8F93\u5165\u3001500K \u4E0A\u4E0B\u6587\u3002Grok 4.7 \u89C1\u4E0A\u4E00\u6761\uFF08\u6B64\u524D\u8BB0\u4E3A"\u4E0D\u5B58\u5728"\uFF0C\u5DF2\u968F\u53D1\u5E03\u4F5C\u5E9F\uFF09\u3002'},{id:"xai-grok-4-5",patterns:["grok-4.5"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"high",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:5e5,note:"Grok 4.5 \u6863\u4F4D\uFF1ALow / Medium / High(\u9ED8\u8BA4)\uFF0C\u601D\u8003\u4E0D\u53EF\u5173\u95ED\uFF1B\u5E26\u56FE\u8F93\u5165\u3002\u4F20\u5165 xhigh \u4F1A\u88AB\u5B98\u65B9\u9759\u9ED8\u6309 High \u5904\u7406\u3002"},{id:"xai-grok-4-3",patterns:["grok-4.3"],efforts:{off:"none",low:"low",medium:"medium",high:"high"},defaultEffort:"low",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1e6,maxTokens:3e4,note:"Grok 4.3\uFF1A\u5B98\u65B9\u56DB\u7EA7 reasoning effort\uFF08None / Low(\u9ED8\u8BA4) / Medium / High\uFF09\uFF0C1M \u4E0A\u4E0B\u6587 / 30,000 \u8F93\u51FA\uFF082026-10 \u6821\u51C6\uFF1AXHigh \u6863\u6309 pi-ai 1.2.0 \u76EE\u5F55\u79FB\u9664\u2014\u2014\u5B83\u81EA 4.6 \u8D77\u624D\u52A0\u5165\uFF1B\u5E26\u56FE\u8F93\u5165\uFF09\u3002grok-4-fast \u7B49\u65E7 slug 2026-05-15 \u8D77\u81EA\u52A8\u91CD\u5B9A\u5411\u5230\u672C\u578B\u53F7\u3002"},{id:"xai-grok",patterns:["grok"],efforts:{low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],note:"Grok \u901A\u7528\u6863\u4F4D\uFF1ALow / Medium / High\u3002\u521D\u4EE3 grok-4\u3001grok-4.20 \u4E0E grok-build-0.1 \u4E0D\u63A5\u53D7\u8BE5\u53C2\u6570\uFF08grok-4 \u7CFB\u4E0E grok-3 \u5DF2\u4E8E 2026-05-15 \u9000\u5F79\u5E76\u91CD\u5B9A\u5411\u81F3 4.3\uFF09\uFF1Bgrok-4.20-multi-agent \u7684\u56DB\u6863\u63A7\u5236\u7684\u662F agent \u6570\u91CF\u800C\u975E\u601D\u8003\u6DF1\u5EA6\u3002\u65B0\u65E7\u4EE3\u9645\u8BF7\u4F18\u5148\u9009 4.5/4.6/4.3\uFF1B\u591A\u6A21\u6001\u53D8\u4F53\u6309\u9700\u52FE\u9009\u56FE\u7247\u3002"},{id:"mistral-magistral",patterns:["magistral"],efforts:{off:"none",high:"high"},defaultEffort:"off",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:262144,maxTokens:16384,note:'Magistral\uFF08magistral-medium-latest\uFF09\uFF1A2026-10 \u6821\u51C6\u2014\u2014pi-ai 1.2.0 \u76EE\u5F55\u663E\u793A\u73B0\u5F79 magistral \u8D70 mistral-conversations \u534F\u8BAE\u5E76\u63A5\u53D7 effort\uFF08None / High \u4E24\u6863\uFF0C\u9ED8\u8BA4 None\uFF09\uFF0C\u5E26\u56FE\u8F93\u5165\uFF0C262,144 / 16,384\u3002\u65E9\u524D"\u8BE5\u7EBF\u65E0 effort \u53C2\u6570\u4E14\u5DF2\u5F03\u7528"\u7684\u8BB0\u5F55\u4F5C\u5E9F\u3002'},{id:"mistral-medium-3",patterns:["mistral-medium-3.5","mistral-large-4","mistral-medium-2604","mistral-medium-latest","mistral-small-latest","mistral-small-2603"],efforts:{off:"none",high:"high"},defaultEffort:"off",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],note:"Mistral \u73B0\u5F79\u63A8\u7406\u6863\uFF082026-10 \u6269\u5145\uFF09\uFF1ANone / High \u4E24\u6863\uFF0C\u5B98\u65B9 reasoning_effort \u679A\u4E3E\u5373 none/high\uFF1B\u73B0\u5F79\u578B\u53F7 mistral-large-4\uFF081M\uFF09\u3001mistral-medium-3.5\uFF082604/latest\uFF09\u3001mistral-small-2603\uFF08Small 4\uFF09\u7ECF\u5B83\u63A7\u5236\uFF0C\u5747\u5E26\u89C6\u89C9\u3002\u5BB9\u91CF\uFF1Alarge-4 262,144 \u8F93\u51FA\u3001medium 262,144 \u8F93\u51FA\u3001small 256,000 \u8F93\u51FA\uFF08\u4E0A\u4E0B\u6587\u5747 262,144\uFF09\u3002\u975E\u63A8\u7406\u65E7\u6B3E\u89C1\u4E0B\u6761\u3002"},{id:"mistral-legacy",patterns:["mistral-large-2411","mistral-large-latest","mistral-large-2512","mistral-medium-2505","mistral-medium-2508","mistral-small-2506","mistral-nemo","devstral","ministral","codestral","pixtral","voxtral"],efforts:!1,input:["text","image"],note:"Mistral \u975E\u63A8\u7406\u7EBF\uFF082026-10 \u65B0\u589E\u6761\u76EE\uFF09\uFF1Alarge-2411/2512/latest\u3001medium-2505/2508\u3001small-2506\u3001nemo \u53CA devstral/ministral/codestral/pixtral/voxtral \u7B49\u4E13\u7528\u7EBF\u5747\u4E0D\u63A5\u53D7 effort \u53C2\u6570\uFF08\u52FF\u52FE\u601D\u8003\u6863\uFF09\u3002\u591A\u6570\u73B0\u5F79\u6B3E\u5E26\u89C6\u89C9\uFF08large-2411 \u4E3A\u7EAF\u6587\u672C\uFF09\u3002"},{id:"qwen-vision",patterns:["qwen-vl","qwen2-vl","qwen2-5-vl","qwen3-vl","qvq"],efforts:{off:null,high:"high"},defaultEffort:"high",compat:{thinkingFormat:"qwen"},input:["text","image"],contextWindow:131072,maxTokens:8192,note:"\u901A\u4E49\u89C6\u89C9\u7EBF\uFF08Qwen-VL/QvQ\uFF09\uFF1Aenable_thinking \u5F00\u5173\uFF08\u5F00=High\uFF09\uFF0C\u6536\u56FE\u3002qwen3-vl \u5BB9\u91CF\u66F4\u5927\uFF0C\u6309\u9700\u4E0A\u8C03\u3002"},{id:"qwen-3-8",patterns:["qwen3.8"],efforts:{off:null,low:"low",medium:"medium",xhigh:"xhigh"},defaultEffort:"xhigh",compat:{thinkingFormat:"qwen",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1e6,note:"Qwen 3.8 \u7CFB\uFF1A\u5B98\u65B9 reasoning_effort \u6863\u4F4D XHigh(\u9ED8\u8BA4) / Medium / Low\uFF0Cthinking \u9ED8\u8BA4\u5F00\u3001\u53EF\u6309\u8BF7\u6C42\u5173\u95ED\uFF1B\u539F\u751F\u591A\u6A21\u6001\uFF08qwen3.8-max \u56FE\u50CF/\u89C6\u9891\u7406\u89E3\uFF0C\u89C6\u9891\u672A\u5165\u6838\u5FC3\u8BCD\u8868\uFF09\u30021M \u6863\u4E0A\u4E0B\u6587\u300227B \u4E0E Flash-Next \u5F00\u6E90\u6B3E\u89C1\u5355\u72EC\u6761\u76EE\u3002"},{id:"qwen-3-8-27b",patterns:["qwen3.8-27b"],efforts:{off:null,low:"low",medium:"medium",xhigh:"xhigh"},defaultEffort:"xhigh",compat:{thinkingFormat:"qwen",supportsReasoningEffort:!0},input:["text","image"],contextWindow:262144,note:"Qwen3.8-27B\uFF08dense\uFF0C2026-08-14 \u5F00\u6E90\uFF09\uFF1A\u5B98\u65B9 reasoning_effort \u6863\u4F4D XHigh(\u9ED8\u8BA4) / Medium / Low\uFF0Cthinking \u9ED8\u8BA4\u5F00\u3001\u53EF\u6309\u8BF7\u6C42\u5173\uFF1B\u539F\u751F\u56FE\u50CF+\u89C6\u9891\u7406\u89E3\uFF08\u89C6\u9891\u672A\u5165\u6838\u5FC3\u8BCD\u8868\uFF09\u3002262,144 \u539F\u751F\u4E0A\u4E0B\u6587\u3001\u5B98\u65B9\u58F0\u660E\u53EF\u6269\u81F3 1M\u3002\u6765\u6E90\uFF1AHF Qwen/Qwen3.8-27B \u6A21\u578B\u5361\u3002"},{id:"qwen-3-8-flash-next",patterns:["qwen3.8-flash-next"],efforts:{off:null,low:"low",medium:"medium",xhigh:"xhigh"},defaultEffort:"xhigh",compat:{thinkingFormat:"qwen",supportsReasoningEffort:!0},input:["text","image"],contextWindow:262144,note:"Qwen3.8-Flash-Next\uFF08125B-A6B \u5B9E\u9A8C\u67B6\u6784\uFF0CQwen4 \u524D\u8EAB\uFF09\uFF1A\u5B98\u65B9 reasoning_effort \u6863\u4F4D XHigh(\u9ED8\u8BA4) / Medium / Low + enable_thinking \u5F00\u5173\uFF1B\u539F\u751F\u89C6\u89C9\uFF08Vision Encoder\uFF09\u3002262,144 \u539F\u751F\u4E0A\u4E0B\u6587\u3001\u53EF\u6269\u81F3 1M\u3002\u6765\u6E90\uFF1AHF \u6A21\u578B\u5361\u4E0E qwen.ai \u5B98\u65B9\u535A\u5BA2\u3002"},{id:"qwen",patterns:["qwen","qwq"],efforts:{off:null,high:"high"},defaultEffort:"high",compat:{thinkingFormat:"qwen"},input:["text"],contextWindow:1e6,maxTokens:65536,note:"\u901A\u4E49\u5343\u95EE\uFF1Aenable_thinking \u5F00\u5173\uFF08\u65E0 effort \u6863\uFF09\uFF0C\u5F00=High\uFF1B\u73B0\u5F79\u65D7\u8230\u4E3A qwen3.8 \u7CFB\uFF081M \u6863\u4E0A\u4E0B\u6587\uFF0C\u89C1 qwen-3-8 \u6761\u76EE\uFF09\u30023.6/3.7 \u4EE3\u7684 Plus/Flash \u4EA6\u9ED8\u8BA4\u591A\u6A21\u6001\uFF08\u56FE\u7247/\u89C6\u9891\uFF09\uFF0C\u5982\u63A5\u5165\u8BF7\u6309\u9700\u52FE\u9009\u56FE\u7247\uFF1B\u89C6\u89C9\u7EBF\u89C1 qwen-vision \u6761\u76EE\u3002"},{id:"glm-vision",patterns:["glm-4v","glm-4-6v","glm-4-5v","glm-5v"],efforts:{off:null,high:"high"},defaultEffort:"high",compat:{thinkingFormat:"zai"},input:["text","image"],contextWindow:131072,maxTokens:32768,note:"\u667A\u8C31\u89C6\u89C9\u7EBF\uFF08GLM-4V/4.5V/4.6V/5V\uFF09\uFF1Athinking \u5F00\u5173\uFF08\u5F00=High\uFF09\uFF0C\u6536\u56FE\u3002GLM-4.5V \u4E3A\u5F3A\u5236\u601D\u8003\uFF08\u4F20 disabled \u62A5\u9519\uFF0C\u8BF7\u624B\u52A8\u5220 Off \u6863\uFF09\u3002"},{id:"glm-5-3-flash",patterns:["glm-5.3-flash","glm-5.3-flashx"],efforts:{low:"low",high:"high",max:"max"},defaultEffort:"max",compat:{thinkingFormat:"zai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,maxTokens:131072,note:"GLM-5.3-Flash\uFF08320B\uFF0C\u5B98\u65B9\u6587\u6863 vlm \u5206\u7C7B\uFF09\uFF1A\u5F3A\u5236\u601D\u8003\uFF08thinking.type \u4EC5 enabled\uFF0C\u4E0D\u652F\u6301\u5173\u95ED\uFF09\uFF0C\u6587\u672C\u53C2\u6570\u4E0E GLM-5.3 \u4E00\u81F4\u2014\u2014\u6863\u4F4D Low / High / Max\u3002\u8F93\u5165\u6A21\u6001\uFF1A\u89C6\u9891\u3001\u56FE\u50CF\u3001\u6587\u672C\u3001\u6587\u4EF6\uFF08\u89C6\u9891/\u6587\u4EF6\u672A\u5165\u6838\u5FC3\u8BCD\u8868\uFF0C\u56FE\u7247\u53EF\u52FE\uFF09\u3002\u5B98\u65B9 1M \u4E0A\u4E0B\u6587 / 128K \u6700\u5927\u8F93\u51FA\u3002\u6765\u6E90\uFF1Adocs.bigmodel.cn \u6A21\u578B\u9875\u3002"},{id:"glm-5-3",patterns:["glm-5.3"],efforts:{low:"low",high:"high",max:"max"},defaultEffort:"max",compat:{thinkingFormat:"zai",supportsReasoningEffort:!0},input:["text"],contextWindow:1048576,maxTokens:131072,note:"GLM-5.3 \u6863\u4F4D\uFF1ALow / High / Max\uFF08\u5F3A\u5236\u601D\u8003\uFF0C\u5176\u4F59\u503C\u62A5\u9519\uFF09\u3002\u5B98\u65B9\u5BB9\u91CF 1M / 128K\u3002"},{id:"glm-5-2",patterns:["glm-5.2"],efforts:{off:"none",minimal:"minimal",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},defaultEffort:"max",compat:{thinkingFormat:"zai",supportsReasoningEffort:!0},input:["text"],contextWindow:1048576,maxTokens:131072,note:"GLM-5.2 \u6863\u4F4D\uFF1ANone / Minimal / Low / Medium / High / XHigh / Max\uFF08\u5B98\u65B9\u6620\u5C04\uFF1ALow\xB7Medium\u2192High\u3001XHigh\u2192Max\u3001None\xB7Minimal=\u505C\u6B62\u601D\u8003\uFF09\u3002\u89C6\u89C9\u7EBF\u89C1 glm-vision \u6761\u76EE\u3002"},{id:"glm",patterns:["glm","zhipu","chatglm"],efforts:{off:null,high:"high"},defaultEffort:"high",compat:{thinkingFormat:"zai"},input:["text"],note:"GLM \u901A\u7528\uFF1Athinking \u5F00\u5173\uFF08\u65E0 effort \u6863\uFF09\uFF0C\u5F00=High\uFF1Beffort \u9636\u68AF\u4EC5 GLM-5.2+ \u652F\u6301\uFF08\u89C1\u4E0A\u4E24\u6761\u76EE\uFF09\u3002\u6CE8\u610F GLM-4.7/GLM-4.5V \u4E3A\u5F3A\u5236\u601D\u8003\uFF0C\u4F20 disabled \u4F1A\u62A5\u9519\uFF08\u8BF7\u624B\u52A8\u5220 Off \u6863\uFF09\u3002\u89C6\u89C9\u7EBF\u89C1 glm-vision \u6761\u76EE\u3002"},{id:"kimi-k3",patterns:["kimi-k3"],efforts:{low:"low",high:"high",max:"max"},defaultEffort:"max",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,note:"Kimi K3 \u6863\u4F4D\uFF1ALow / High / Max(\u9ED8\u8BA4 Max)\uFF0C\u8D70\u9876\u5C42 reasoning_effort\uFF1B\u59CB\u7EC8\u63A8\u7406\u3001\u52FF\u4F20 thinking \u5BF9\u8C61\u3002\u539F\u751F\u89C6\u89C9\u7406\u89E3\uFF0C1M \u4E0A\u4E0B\u6587\uFF08\u6700\u5927\u8F93\u51FA\u5B98\u65B9\u672A\u5355\u72EC\u5217\uFF0C\u4E0D\u63D0\u4F9B\uFF09\u3002"},{id:"kimi-k2-vision",patterns:["kimi-k2.6","kimi-k2.5"],efforts:{off:null,high:"high"},defaultEffort:"high",compat:{thinkingFormat:"deepseek"},input:["text","image"],contextWindow:262144,note:"Kimi K2.5/K2.6 \u89C6\u89C9\u4EE3\uFF1Athinking.type \u5F00\u5173\uFF08\u9ED8\u8BA4\u5F00\u3001\u53EF\u5173\uFF09\uFF0C\u5F00=High\uFF1B\u5E26\u89C6\u89C9\uFF0C256K\u3002K2.7 Code \u59CB\u7EC8\u601D\u8003\uFF0C\u89C1\u5355\u72EC\u6761\u76EE\u3002"},{id:"kimi-k27-code",patterns:["kimi-k2.7"],efforts:{high:"high"},defaultEffort:"high",compat:{thinkingFormat:"deepseek"},input:["text","image"],contextWindow:262144,note:"Kimi K2.7 Code\uFF08\u542B\u9AD8\u901F\u7248\uFF09\uFF1A\u59CB\u7EC8\u601D\u8003\u2014\u2014thinking.type \u4EC5\u63A5\u53D7 enabled\uFF08\u4F20 disabled \u62A5\u9519\uFF09\uFF0C\u65E0 Off \u6863\uFF1B\u5E26\u89C6\u89C9\uFF0C256K\u3002"},{id:"kimi-for-coding",patterns:["kimi-for-coding"],efforts:{low:"low",high:"high",max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1048576,maxTokens:32768,note:"Kimi for Coding\uFF1AMoonshot \u7F16\u7801\u4E13\u7EBF\u8D70 anthropic-messages \u534F\u8BAE\u3001\u81EA\u9002\u5E94\u601D\u8003\uFF0C\u6863\u4F4D Low / High / Max\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF09\uFF1B\u5E26\u56FE\u8F93\u5165\uFF0C1M \u4E0A\u4E0B\u6587 / 32,768 \u8F93\u51FA\u3002\u9AD8\u901F\u7248\uFF08-highspeed\uFF09\u65E0 effort \u63A7\u4EF6\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF09\u3002"},{id:"kimi-moonshot-v1-vision",patterns:["moonshot-v1-8k-vision","moonshot-v1-32k-vision","moonshot-v1-128k-vision"],efforts:!1,input:["text","image"],note:"Moonshot V1 \u89C6\u89C9\u65E7\u4EE3\uFF088k/32k/128k \u5404\u4E00\uFF09\uFF1A\u65E0\u601D\u8003\u63A7\u4EF6\uFF08\u751F\u6210\u6A21\u578B\uFF09\u3001\u652F\u6301\u56FE\u7247\u8F93\u5165\uFF1B\u8BE5\u7EBF\u5DF2\u505C\u6B62\u5BF9\u65B0\u7528\u6237\u5F00\u653E\uFF082026-08-31 \u5168\u91CF\u4E0B\u7EBF\uFF0C\u7F51\u5173\u6B8B\u7559\u4ECD\u53EF\u547D\u4E2D\uFF09\u3002"},{id:"kimi",patterns:["kimi","moonshot"],efforts:{off:null,high:"high"},compat:{thinkingFormat:"deepseek"},input:["text"],contextWindow:262144,note:"Kimi \u901A\u7528\uFF1Athinking \u5F00\u5173\uFF08\u65E0 effort \u6863\uFF09\uFF0C\u5F00=High\u3002k2 \u7CFB\u5217 2026-05-25 \u4E0B\u7EBF\u3001kimi-latest 2026-01-28 \u4E0B\u7EBF\u3001moonshot-v1 \u7CFB 2026-08-31 \u5168\u91CF\u4E0B\u7EBF\uFF08\u7F51\u5173\u6B8B\u7559\u4ECD\u53EF\u547D\u4E2D\uFF1Bmoonshot-v1 \u672C\u8EAB\u975E\u601D\u8003\u6A21\u578B\uFF09\u3002\u89C6\u89C9\u4EE3\u4E0E K2.7 Code \u89C1\u5355\u72EC\u6761\u76EE\u3002"},{id:"hunyuan-hy3",patterns:["hy3"],efforts:{low:"low",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],contextWindow:262144,note:"\u6DF7\u5143 hy3\uFF1A\u5F00\u6E90\u5951\u7EA6\u7ECF chat_template_kwargs.reasoning_effort = no_think(\u9ED8\u8BA4)/low/high\uFF1B\u5B98\u65B9\u6A21\u578B\u5361 256K \u4E0A\u4E0B\u6587\uFF08295B MoE\uFF0C2026 \u5F00\u6E90\uFF09\u3002"},{id:"hunyuan-hy4",patterns:["hy4-preview","hy-4-preview"],efforts:{off:"no_think",high:"high"},defaultEffort:"high",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},contextWindow:1e6,note:"\u6DF7\u5143 Hy4 preview\uFF1A\u5B98\u65B9 README\u2014\u2014reasoning \u9ED8\u8BA4 high\uFF08\u6DF1\u5EA6\u601D\u8003\uFF09\uFF0C\u5173\u95ED\u7ECF chat_template_kwargs.reasoning_effort=no_think\uFF1B\u5B98\u65B9\u89C4\u683C\u8868 1M \u4E0A\u4E0B\u6587\uFF08770B-A49B MoE\uFF0CGated DSA\uFF09\u3002low \u6863\u5B98\u65B9\u672A\u5217\uFF0C\u5982\u6709\u8BF7\u624B\u8C03\uFF1B\u89C6\u89C9\u672A\u58F0\u660E\uFF0C\u6309\u9700\u624B\u52FE\u3002\u6765\u6E90\uFF1ATencent-Hunyuan/Hy4-preview \u5B98\u65B9 README\u3002"},{id:"step-5-preview",patterns:["step-5"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1e6,maxTokens:65536,note:'\u9636\u8DC3 Step-5-Preview\uFF08\u5B98\u65B9 id \u5373 step-5-preview\uFF0C\u65E0\u88F8 step-5\uFF1Bpattern \u53D6\u5BB6\u65CF\u4E3B\u5E72\u4EE5\u517C\u5BB9\u7F51\u5173\u5199\u6CD5\uFF09\uFF1A\u6863\u4F4D Low / Medium(\u5B98\u65B9\u6807"\u9ED8\u8BA4\u63A8\u8350") / High\uFF0C\u601D\u8003\u4E0D\u53EF\u5173\u95ED\uFF1B\u539F\u751F\u56FE\u7247 + \u89C6\u9891\u8F93\u5165\uFF1B1M \u4E0A\u4E0B\u6587\u300164K \u6700\u5927\u8F93\u51FA\uFF08\u5B98\u65B9\u53E6\u6CE8 max_tokens \u9ED8\u8BA4 INF\u3001\u4E0E 64K \u4E0A\u9650\u5E76\u5B58\uFF0C\u4EE5\u7AEF\u70B9\u5B9E\u6D4B\u4E3A\u51C6\uFF09\u3002'},{id:"step-3-7",patterns:["step-3.7","step-3.6"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:262144,note:"\u9636\u8DC3 Step-3.6/3.7 \u6863\u4F4D\uFF1ALow / Medium(\u9ED8\u8BA4\u63A8\u8350) / High\uFF0C\u539F\u751F\u56FE\u7247+\u89C6\u9891\u7406\u89E3\u3002\u4E0A\u4E0B\u6587\u4E3A\u8F93\u5165+\u8F93\u51FA\u603B\u548C\u4E0A\u9650\u3002"},{id:"step-3-5",patterns:["step-3.5"],efforts:{low:"low",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],contextWindow:262144,note:"\u9636\u8DC3 Step-3.5 Flash \u6863\u4F4D\uFF1ALow / High\uFF08\u7EAF\u6587\u672C\u63A8\u7406\u65D7\u8230\uFF09\u3002\u4E0A\u4E0B\u6587\u4E3A\u8F93\u5165+\u8F93\u51FA\u603B\u548C\u4E0A\u9650\u3002"},{id:"step",patterns:["step-3","step-2"],efforts:{low:"low",medium:"medium",high:"high"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],note:"\u9636\u8DC3 Step \u6863\u4F4D\uFF1ALow / Medium / High\uFF08\u9ED8\u8BA4 Medium\uFF0C\u4E0D\u53EF\u5173\u95ED\uFF09\u30023.6/3.7 \u89C6\u89C9\u4EE3\u89C1\u5355\u72EC\u6761\u76EE\u3002"},{id:"doubao",patterns:["doubao","seed"],efforts:{off:null,low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],note:"\u8C46\u5305\u6863\u4F4D\uFF1AOff / Low / Medium / High\u2014\u2014effort \u9636\u68AF\u4ECD\u662F\u793E\u533A\u8BC1\u636E\u3001\u5B98\u65B9 Ark \u6587\u6863\u660E\u5217\u7684\u4E3A thinking.type \u5F00\u5173\uFF082026-08-24 \u590D\u6838\u4ECD\u672A\u89C1\u5230 effort \u5B98\u65B9\u660E\u6587\uFF09\u3002seed \u4EE3\u6536\u56FE\uFF081.5-pro \u4F8B\u5916\uFF09\u3002"},{id:"minimax-m2",patterns:["minimax-m2"],efforts:!1,input:["text"],contextWindow:204800,maxTokens:131072,note:"MiniMax-M2 / M2.5\uFF08\u542B -highspeed\uFF09\uFF1A\u65E0\u601D\u8003\u63A7\u4EF6\u3001\u65E0 effort \u53C2\u6570\uFF08M3 \u624D\u5F15\u5165 thinking \u53C2\u6570\uFF09\uFF0C\u7EAF\u6587\u672C\uFF0C204,800 / 131,072\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF1BM3 \u89C1\u4E0B\u6761\uFF09\u3002"},{id:"minimax-m3",patterns:["minimax-m3"],efforts:{off:null,high:"high"},compat:{thinkingFormat:"deepseek"},input:["text","image"],contextWindow:1048576,maxTokens:512e3,note:"MiniMax-M3\uFF1A\u5B98\u65B9 thinking \u53C2\u6570 enabled/adaptive/disabled\uFF08\u65E0 effort \u6863\uFF09\uFF0C\u5F00=High\u3001\u5173=disabled\uFF1B\u539F\u751F\u591A\u6A21\u6001\uFF08\u56FE/\u89C6\u9891\uFF0C\u6838\u5FC3\u8BCD\u8868\u4EC5\u542B\u56FE\uFF09\uFF0C1M \u4E0A\u4E0B\u6587 / 512,000 \u8F93\u51FA\uFF082026-10 \u6821\u51C6\u8865\u5BB9\u91CF\uFF09\u3002"},{id:"mimo-v2-6",patterns:["mimo-v2.6","mimo-v2.5"],efforts:{off:"none",low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:1048576,maxTokens:131072,note:"\u5C0F\u7C73 MiMo v2.6 \u7CFB\u5217\uFF08mimo-v2.6-pro / -flash / -pro-ultraspeed\uFF1B1M \u4E0A\u4E0B\u6587 / 128K \u6700\u5927\u8F93\u51FA\u3001\u539F\u751F\u5168\u6A21\u6001\uFF09\u4E0E\u5176\u524D\u4EE3 mimo-v2.5\u3002\u5B98\u65B9\u6587\u6863\uFF1Athinking.type\uFF08enabled/disabled\uFF0C\u9ED8\u8BA4 enabled\uFF09+ reasoning.effort\uFF08none \u5173\u95ED\uFF1B\u5176\u4F59\u5408\u6CD5\u503C\u5747\u5F00\u542F\uFF0C\u4E14**\u73B0\u9636\u6BB5\u6682\u672A\u533A\u5206\u63A8\u7406\u5F3A\u5EA6**\u2014\u2014minimal \u5F52\u4E00\u4E3A low\u3001xhigh/max/ultra \u5F52\u4E00\u4E3A high\uFF09\uFF0C\u56E0\u6B64\u8FD9\u91CC\u58F0\u660E\u7684\u662F\u7AEF\u70B9**\u63A5\u53D7**\u7684\u6863\u4F4D Off / Low / Medium / High\uFF08xhigh\u3001max \u4E0D\u58F0\u660E\uFF0C\u7AEF\u70B9\u53EA\u4F1A\u6298\u53E0\u4E3A high\uFF09\u3002\u601D\u8003\u6A21\u5F0F\u4E0B temperature / top_p \u4E0D\u53EF\u81EA\u5B9A\u4E49\uFF08\u5F3A\u5236 1.0 / 0.95\uFF09\uFF1B\u5E26\u5DE5\u5177\u8C03\u7528\u7684\u5386\u53F2\u8F6E\u5FC5\u987B\u5B8C\u6574\u56DE\u4F20 reasoning_content\uFF0C\u5426\u5219 400\u3002mimo-v2.5 \u4E0E v2.5-pro \u5B98\u65B9\u5B9A\u4E8E 2026-10-21 \u4E0B\u7EBF\u3002"},{id:"mimo-v2-5-pro",patterns:["mimo-v2.5-pro"],efforts:{off:"none",low:"low",medium:"medium",high:"high"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],contextWindow:1048576,maxTokens:131072,note:"\u5C0F\u7C73 MiMo v2.5-Pro\uFF1A\u8BE5\u5BB6\u65CF\u552F\u4E00\u7684**\u7EAF\u6587\u672C**\u6210\u5458\uFF08\u5B98\u65B9\u80FD\u529B\u8868\u672A\u5217\u5168\u6A21\u6001\u7406\u89E3\uFF09\uFF0C1M \u4E0A\u4E0B\u6587 / 128K \u6700\u5927\u8F93\u51FA\uFF0C\u63A8\u7406\u5951\u7EA6\u4E0E v2.6 \u7CFB\u5217\u76F8\u540C\uFF08thinking.type + reasoning.effort\uFF0Cnone \u5173\u95ED\u3001\u5176\u4F59\u6863\u4F4D\u6682\u4E0D\u533A\u5206\u5F3A\u5EA6\uFF09\u3002\u5B98\u65B9\u5B9A\u4E8E 2026-10-21 \u4E0B\u7EBF\u3002"},{id:"baidu-ernie",patterns:["ernie"],efforts:!1,input:["text"],contextWindow:131072,note:"\u767E\u5EA6\u5343\u5E06 ERNIE \u7CFB\uFF1A\u5B98\u65B9 OpenAI \u517C\u5BB9\u63A5\u53E3\u65E0 reasoning_effort \u53C2\u6570\u2014\u2014\u601D\u8003\u7531\u6A21\u578B\u53D8\u4F53\u51B3\u5B9A\uFF08-Thinking \u7CFB\u5217\u59CB\u7EC8\u601D\u8003\u3001\u666E\u901A\u7CFB\u5217\u4E0D\u601D\u8003\uFF09\uFF0C\u52FF\u52FE\u601D\u8003\u6863\u3002ERNIE 4.5 Turbo VL \u652F\u6301\u56FE\u7247\uFF0C\u6309\u9700\u624B\u52FE\uFF1B\u53C2\u8003\u5BB9\u91CF\u53D6 Turbo 128K \u6863\u3002"},{id:"fireworks-ember",patterns:["ember-1"],efforts:{off:"none",low:"low",medium:"medium",high:"high",max:"max"},compat:{supportsReasoningEffort:!0},anthropicAdaptive:!0,input:["text","image"],contextWindow:1048576,maxTokens:131072,note:"Fireworks ember-1\uFF1Aanthropic-messages \u534F\u8BAE\u81EA\u9002\u5E94\u601D\u8003\uFF0C\u6863\u4F4D None(\u5173) / Low / Medium / High / Max\uFF08off \u663E\u5F0F none \u62FC\u5199\uFF09\uFF1B\u5E26\u56FE\u8F93\u5165\uFF0C1M \u4E0A\u4E0B\u6587 / 131,072 \u8F93\u51FA\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF09\u3002"},{id:"thinkingmachines-inkling",patterns:["inkling"],efforts:{off:"none",minimal:"minimal",low:"low",medium:"medium",high:"high",xhigh:"xhigh",max:"max"},defaultEffort:"medium",compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text","image"],contextWindow:524288,maxTokens:131072,note:"Thinking Machines Inkling\uFF1A\u5168\u6863 Minimal / Low / Medium(\u9ED8\u8BA4) / High / XHigh / Max\uFF0Coff \u663E\u5F0F none\uFF1B\u5E26\u56FE\u8F93\u5165\uFF0C512K \u4E0A\u4E0B\u6587 / 131,072 \u8F93\u51FA\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF1Btogether \u4E2D\u7EE7\u4FA7 effort \u53C2\u6570\u672A\u5F00\u653E\uFF0C\u9700\u652F\u6301\u65B9\u8F6C\u53D1\uFF09\u3002"},{id:"antling-ring",patterns:["ring-2.6"],efforts:{high:"high",xhigh:"xhigh"},compat:{thinkingFormat:"openai",supportsReasoningEffort:!0},input:["text"],contextWindow:262144,maxTokens:65536,note:"\u8682\u8681 Ling Ring-2.6-1T\uFF1A\u6863\u4F4D High / XHigh\uFF08off \u4EE5\u7701\u7565\u8868\u8FBE\uFF09\uFF1B262,144 / 65,536\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF09\u3002"},{id:"antling-ling",patterns:["ling-2.6"],efforts:!1,input:["text"],note:"\u8682\u8681 Ling-2.6\uFF08\u542B -flash\uFF09\uFF1A\u975E\u601D\u8003\u6A21\u578B\uFF0C\u65E0 effort \u63A7\u4EF6\uFF082026-10 \u6821\u51C6\u65B0\u589E\uFF1BRing-2.6 \u601D\u8003\u7EBF\u89C1\u4E0A\u6761\uFF09\u3002"},{id:"openai-gpt-image",patterns:["gpt-image","dall-e","dalle"],efforts:!1,imageGen:!0,note:"OpenAI \u751F\u56FE\u7CFB\uFF08gpt-image-1 / DALL\xB7E 3\uFF09\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"google-imagen",patterns:["imagen","flash-image","pro-image","nano-banana"],efforts:!1,imageGen:!0,note:'Google \u751F\u56FE\u7CFB\uFF08Imagen / Gemini-Image "nano banana"\uFF09\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002'},{id:"black-forest-flux",patterns:["flux"],efforts:!1,imageGen:!0,note:"FLUX \u7CFB\uFF08FLUX.1 schnell/dev/pro \u7B49\uFF09\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"stability-sd",patterns:["stable-diffusion","sdxl","sd3"],efforts:!1,imageGen:!0,note:"Stability \u751F\u56FE\u7CFB\uFF08Stable Diffusion / SDXL / SD3\uFF09\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"zhipu-cogview",patterns:["cogview"],efforts:!1,imageGen:!0,note:"\u667A\u8C31 CogView \u751F\u56FE\u7CFB\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"aliyun-wanx",patterns:["wanx"],efforts:!1,imageGen:!0,note:"\u963F\u91CC\u4E07\u76F8 Wanx \u751F\u56FE\u7CFB\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"bytedance-seedream",patterns:["seedream","seededit"],efforts:!1,imageGen:!0,note:"\u5B57\u8282 Seedream / SeedEdit \u751F\u56FE\u7CFB\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"qwen-image",patterns:["qwen-image"],efforts:!1,imageGen:!0,note:"\u901A\u4E49\u5343\u95EE Qwen-Image \u751F\u56FE\u7CFB\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"},{id:"midjourney",patterns:["midjourney","niji"],efforts:!1,imageGen:!0,note:"Midjourney / Niji \u751F\u56FE\u7CFB\uFF08\u4E2D\u8F6C\u5E38\u89C1\uFF09\uFF1A\u56FE\u50CF\u751F\u6210\u6A21\u578B\uFF0C\u4E0D\u80FD\u4F5C\u4E3A\u5BF9\u8BDD\u6A21\u578B\u4F7F\u7528\u2014\u2014\u5728\u8F93\u5165\u6846\u6A21\u578B\u5207\u6362\u5217\u8868\u4E2D\u5E26\u300C\u751F\u56FE\u300D\u6807\u8BB0\u5C55\u793A\u3002\u8BF7\u52FF\u52FE\u601D\u8003\u6863\u3002"}],ui={off:null,low:"low",medium:"medium",high:"high"},cp={"openai-completions":ui,"openai-responses":ui,"anthropic-messages":ui,deepseek:{off:"none",low:"low",high:"high",max:"max"}},up={low:"low",medium:"medium",high:"high"};function Wn(e){return(e??"").toLowerCase().trim()}function Hs(e){return e!==void 0&&/[a-z0-9]/.test(e)}function Ct(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g," ").replace(/([a-z])(\d)/g,"$1 $2")}function pi(e,t,n){let r=t===0?void 0:e[t-1],o=e[t+n];return!Hs(r)&&!Hs(o)}function mi(e,t){let n=Ct(e)+" "+Ct(t??""),r;for(let o of lp)for(let i of o.patterns){let a=Ct(i),s=n.indexOf(a);for(;s>=0;){if(pi(n,s,a.length)){(r===void 0||a.length>r.length)&&(r={entry:o,length:a.length});break}s=n.indexOf(a,s+1)}}return r?.entry}var fp={"deepseek.com":"deepseek","anthropic.com":"anthropic-messages"};function pp(e){let t=Wn(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=fp[o.slice(-2).join(".")];if(i!==void 0)return i}}catch{}return"openai-completions"}var Or="openai-completions",Ps="anthropic-messages";function fi(e){if(e===void 0||e.length===0)return!1;let t="";try{t=new URL(e).hostname.toLowerCase()}catch{return!1}if(t.startsWith("[")){let n=t.slice(1,-1);return n==="::1"||n==="::"||n.startsWith("fe80:")||n.startsWith("fc")||n.startsWith("fd")}return!!(t==="localhost"||t.endsWith(".local")||t.endsWith(".internal")||/^(127\.|10\.|192\.168\.)/.test(t)||/^172\.(1[6-9]|2[0-9]|3[01])\./.test(t))}function mp(e,t){let n=Wn(t),r={...e};if(delete r.supportsMidConvoEffort,delete r.allowedFallbackModels,n===Ps){for(let o of["thinkingFormat","supportsReasoningEffort","thinkingTokenBudgetField","supportsThinkingTokenBudget","vllmPriority"])delete r[o];return r.forceAdaptiveThinking===void 0?void 0:{forceAdaptiveThinking:r.forceAdaptiveThinking}}if(n===Or)return delete r.forceAdaptiveThinking,Object.keys(r).length===0?void 0:r}function gp(e,t){let n=Wn(t.api);if(n===Or){let r=e.compat;r!==void 0&&(r=mp(r,n)??void 0);let o=e.efforts!==!1;return r===void 0?o&&fi(t.baseURL)?{thinkingTokenBudgetField:"thinking_token_budget"}:void 0:o&&r.thinkingTokenBudgetField===void 0&&r.supportsThinkingTokenBudget!==!0&&fi(t.baseURL)?{...r,thinkingTokenBudgetField:"thinking_token_budget"}:r}if(n===Ps&&e.anthropicAdaptive===!0)return{forceAdaptiveThinking:!0}}var hp=["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 gi(e){if(Wn(e.api)!==Or)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(".")?!hp.some(r=>n===r||n.endsWith("."+r)):!1}catch{return!1}}function Cs(e,t,n){return e===void 0||!n||e.supportsDeveloperRole!==void 0||!gi(t)?e:{...e,supportsDeveloperRole:!1}}var Ns={off:null,low:"low",medium:"medium",high:"high"},bp=["vl","vision","omni","4o","pixtral","internvl"];function hi(e){let t=Ct(e);for(let n of bp){let r=Ct(n),o=t.indexOf(r);for(;o>=0;){if(pi(t,o,r.length))return["text","image"];o=t.indexOf(r,o+1)}}}var yp=["dall-e","dalle","gpt-image","imagen","flux","stable-diffusion","sdxl","sd3","cogview","wanx","seedream","seededit","midjourney","niji","nano-banana","image-gen","imagegen","qwen-image","grok-2-image"];function bi(e){let t=Ct(e);for(let n of yp){let r=Ct(n),o=t.indexOf(r);for(;o>=0;){if(pi(t,o,r.length))return!0;o=t.indexOf(r,o+1)}}return!1}function wp(e){if(e===void 0)return;let t=e.map(n=>n.toLowerCase());if(t.some(n=>dp.includes(n)))return t.includes("image")?["text","image"]:["text"]}function ot(e,t,n){let r=mi(e,t.displayName),o,i,a,s,d;r?.imageGen===!0&&(a=!0),r?.input!==void 0&&(o=r.input,i="knowledge"),r?.contextWindow!==void 0&&(s=r.contextWindow),r?.maxTokens!==void 0&&(d=r.maxTokens);let l=wp(n?.input);l!==void 0&&(o=l,i="endpoint");let c=n?.output;if(c!==void 0&&(a=c.includes("image")&&!c.includes("text")),n?.contextLength!==void 0&&Number.isFinite(n.contextLength)&&n.contextLength>0&&(s=n.contextLength),o===void 0){let k=hi(e);k!==void 0&&(o=k,i="heuristic")}a===void 0&&bi(e)&&(a=!0),a===!0&&(o=void 0,i=void 0);let f={...o===void 0?{}:{input:o},...i===void 0?{}:{inputSource:i},...a===void 0?{}:{imageGen:a},...s===void 0?{}:{contextWindow:s},...d===void 0?{}:{maxTokens:d}},m=n===void 0?{}:{endpoint:{reasoning:n.reasoning,source:n.source}};if(n?.reasoning===!1)return{efforts:!1,matched:!1,source:"endpoint:"+(n.source??"listing"),confidence:"high",...m,...f};if(r!==void 0){let k=Cs(gp(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}:{},...k===void 0?{}:{compat:k},matched:!0,entryId:r.id,source:r.id,confidence:"high",...m,...f}}let u=pp(t),p=cp[u]??up,h=Wn(t.api)===Or?{thinkingFormat:"openai",supportsReasoningEffort:!0}:void 0,g=h!==void 0&&fi(t.baseURL)?{...h,thinkingTokenBudgetField:"thinking_token_budget"}:h,y=Cs(g,t,!0);return n?.reasoning===!0?{efforts:{...Ns},...Ns.medium!==void 0?{defaultEffort:"medium"}:{},...y===void 0?{}:{compat:y},matched:!1,source:"endpoint:"+(n.source??"listing"),confidence:"medium",...m,...f}:{efforts:p,...p.medium!==void 0?{defaultEffort:"medium"}:{},...y===void 0?{}:{compat:y},matched:!1,source:"protocol:"+u,confidence:"low",...m,...f}}var wt=(e,t)=>typeof e[t]=="boolean";function vp(e,t){if(Array.isArray(e)){for(let n of e)if(G(n)&&n.id===t)return n}}function xp(e){if(!G(e))return{reasoning:"unknown",source:null};let t=e.supported_features;if(Array.isArray(t)&&t.includes("reasoning"))return{...Ne(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{...Ne(e),reasoning:!0,source:"supported_parameters"};if(wt(e,"supports_reasoning"))return{...Ne(e),reasoning:e.supports_reasoning,source:"supports_reasoning"};if(wt(e,"supportsReasoning"))return{...Ne(e),reasoning:e.supportsReasoning,source:"supportsReasoning"};if(wt(e,"can_reason"))return{...Ne(e),reasoning:e.can_reason,source:"can_reason"};if(wt(e,"reasoning"))return{...Ne(e),reasoning:e.reasoning,source:"reasoning"};let r=e.reasoning_effort;if(r===!1)return{...Ne(e),reasoning:!1,source:"reasoning_effort"};if(typeof r=="string"&&r.trim().length>0||e.supports_reasoning_effort===!0)return{...Ne(e),reasoning:!0,source:"reasoning_effort"};let o=G(e.capabilities)?e.capabilities:void 0;if(o!==void 0){let i=o.thinking,a=G(i)&&typeof i.supported=="boolean"?i.supported:void 0,s=o.effort,d=G(s)&&typeof s.supported=="boolean"?s.supported:void 0;if(d===!0)return{...Ne(e),reasoning:!0,source:"capabilities.effort.supported"};if(a===!0)return{...Ne(e),reasoning:!0,source:"capabilities.thinking.supported"};if(a===!1)return{...Ne(e),reasoning:!1,source:"capabilities.thinking.supported"};if(d===!1)return{...Ne(e),reasoning:!1,source:"capabilities.effort.supported"}}return{...Ne(e),reasoning:"unknown",source:null}}function Ne(e){let t={},n=s=>{if(!Array.isArray(s))return;let d=s.filter(l=>typeof l=="string");return d.length>0?d.map(l=>l.toLowerCase()):[]},r=G(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=G(e.modalities)?e.modalities:void 0;o=n(s?.input)}if(o===void 0){let s=e.capabilities,d=l=>Array.isArray(l)&&l.some(c=>typeof c=="string"&&c.toLowerCase()==="vision");if(d(e.supported_features)||d(s))o=["image"];else if(G(s)){let l=[];for(let c of["image_input","video_input","pdf_input","file_input"]){let f=G(s[c])?s[c]:void 0;if(f===void 0||typeof f.supported!="boolean")continue;let m=c.replace(/_input$/,"");f.supported===!0?l.push(m):l.length===0&&l.push("text")}l.length>0&&(o=l)}}o===void 0&&(wt(e,"supports_vision")?o=e.supports_vision===!0?["image"]:[]:wt(e,"supportsVision")?o=e.supportsVision===!0?["image"]:[]:(wt(e,"supports_images")||wt(e,"supportsImages"))&&(o=e.supports_images===!0||e.supportsImages===!0?["image"]:[])),o!==void 0&&(t.input=o.length===0?["text"]:o);let i=n(r?.output_modalities);if(i===void 0&&(i=n(e.output_modalities)),i===void 0){let s=G(e.modalities)?e.modalities:void 0;i=n(s?.output)}i!==void 0&&(t.output=i);let a=e.context_length;if(typeof a=="number"&&Number.isFinite(a)&&a>0)t.contextLength=a;else{let d=(G(e.top_provider)?e.top_provider:void 0)?.context_length;if(typeof d=="number"&&Number.isFinite(d)&&d>0)t.contextLength=d;else{let l=e.max_input_tokens;if(typeof l=="number"&&Number.isFinite(l)&&l>0)t.contextLength=l;else{let f=(G(e.limit)?e.limit:void 0)?.context;typeof f=="number"&&Number.isFinite(f)&&f>0&&(t.contextLength=f)}}}return t}function Ds(e,t){let n=vp(e,t);return n===void 0?{found:!1,signal:{reasoning:"unknown",source:null}}:{found:!0,signal:xp(n)}}function xe(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 Fr(e){if(!G(e))return;let t=e.providers;return G(t)?t:void 0}function _s(e,t){for(let n of[e?.user,e?.base]){let r=Fr(n)?.[t];if(G(r)&&r.models!==void 0)return r.models}}function Br(e){return Fr(e?.user)}function Kr(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 qr(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 Gr(e,t){let r=e.find(o=>o.id===t)?.compat;if(G(r))return{...r}}function zn(e,t){return e.find(r=>r.id===t)?.[We]===!0}function Wr(e,t){let r=e.find(o=>o.id===t)?.name;return typeof r=="string"&&r.length>0?r:void 0}function zr(e,t){let r=e.find(o=>o.id===t)?.[Jt];return typeof r=="string"&&r.length>0?r:void 0}var kp=3e4,Ep=15e3,yi=new Map,_r=new Map;async function Tp(e){let t=yi.get(e);if(t!==void 0&&Date.now()-t.at<kp)return t.data;let n=_r.get(e);if(n!==void 0)return n;let r=(async()=>{try{let o=await fetch(`${Za}?route=${encodeURIComponent(e)}`,{method:"GET",signal:AbortSignal.timeout(Ep)});if(!o.ok)return;let i=await o.json();return i?.ok?(yi.set(e,{at:Date.now(),data:i.data}),i.data):void 0}catch{return}finally{_r.delete(e)}})();return _r.set(e,r),r}function wi(){yi.clear(),_r.clear()}async function Sp(e,t){let n=await Tp(e);return n===void 0?{reasoning:"unknown",source:null}:Ds(n,t).signal}function Ur(e,t=()=>ie(e),n,r,o,i){return{async suggest(a,s,d,l){let c=xe((await t()).namespace),f=Ht(c,a),m={api:f.api??l?.api,baseURL:f.baseURL??l?.baseURL,displayName:d??f.displayName},u=c[a]===void 0?void 0:await Sp(a,s),p=ot(s,m,u);return p.efforts===void 0?{ok:!1,error:"no-suggestion"}:{ok:!0,suggestion:{efforts:p.efforts,...p.compat===void 0?{}:{compat:p.compat},...p.defaultEffort===void 0?{}:{defaultEffort:p.defaultEffort},...p.input===void 0?{}:{input:p.input},...p.inputSource===void 0?{}:{inputSource:p.inputSource},...p.imageGen===void 0?{}:{imageGen:p.imageGen},...p.contextWindow===void 0?{}:{contextWindow:p.contextWindow},...p.maxTokens===void 0?{}:{maxTokens:p.maxTokens},matched:p.matched,source:p.source,confidence:p.confidence,...p.endpoint===void 0?{}:{endpoint:p.endpoint}}}},commit(a,s,d){if(i?.()===!0){n?.(a,s,d.efforts,d.compat,d.input,d.defaultEffort,d.imageGen);return}r?.(a,s,{efforts:d.efforts,...d.compat===void 0?{}:{compat:d.compat},...d.input===void 0?{}:{input:d.input},...d.imageGen===void 0?{}:{imageGen:d.imageGen},...d.defaultEffort===void 0?{}:{defaultEffort:d.defaultEffort}})},withdraw(a,s){o?.(a,s)},stageEfforts(a,s,d,l,c,f,m){n?.(a,s,d,l,c,f,m)},async writeEfforts(a,s,d,l,c,f,m){if(r!==void 0)return r(a,s,{efforts:d,...l===void 0?{}:{compat:l},...c===void 0?{}:{input:c},...m===void 0?{}:{imageGen:m},...f===void 0?{}:{defaultEffort:f}}),{ok:!0,staged:!0};let p=(await Nt(e,a,[{modelId:s,efforts:d,...l===void 0?{}:{compat:l},...c===void 0?{}:{input:c},...m===void 0?{}:{imageGen:m},...f===void 0?{}:{defaultEffort:f}}],t))[0]??{ok:!1,error:"no-result"};return p.ok?{ok:!0}:p.modelNotFound===!0?{ok:!1,error:"model-not-found"}:{ok:!1,error:p.error??"conflict"}}}}async function Nt(e,t,n,r=()=>ie(e),o){if(n.length===0)return[];let i=!1;for(let a=0;a<3;a++)try{let s=a===0?await r():await ie(e,{fresh:!0});if(s.namespace===void 0)return n.map(()=>({ok:!1,error:"no-namespace"}));let d=_s(s.namespace,t);if(!Array.isArray(d))return n.map(()=>({ok:!1,modelNotFound:!0}));if(!d.every(G))return n.map(()=>({ok:!1,error:"invalid-models"}));let c=d.map(u=>u),f=[];for(let u of n){let p=c.findIndex(h=>h.id===u.modelId);if(p<0){f.push(u.modelId);continue}c[p]=Mp(c[p],u,i?void 0:u.compat)}if(f.length>0)return n.map(u=>f.includes(u.modelId)?{ok:!1,modelNotFound:!0}:{ok:!1,error:"model-not-found"});if(o?.()===!0)return n.map(()=>({ok:!1,aborted:!0}));let m=await e.settings.mutate(Ce,[{op:"set",path:["providers",t,"models"],value:c}],s.namespace.revision);if(!m.ok){if(a===0&&m.error.code==="settings/conflict")continue;let u=m.error.code==="settings/rejected"&&Rs(m.error.message);if(!i&&u&&n.some(p=>p.compat!==void 0)){i=!0;continue}return n.map(()=>({ok:!1,error:m.error.message}))}return n.map(()=>({ok:!0}))}catch(s){return n.map(()=>({ok:!1,error:s instanceof Error?s.message:String(s)}))}return n.map(()=>({ok:!1,error:"conflict"}))}function Mp(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[Xt],i===!1)r.reasoningEfforts=!1;else{r.reasoningEfforts={...i};let s={...G(e.compat)?e.compat:{},...n??{}};Object.keys(s).length>0&&(r.compat=s)}return t.input!==void 0&&(t.input===null?(delete r.input,r[rt]=!0):(delete r[rt],r.input=[...t.input])),t.imageGen!==void 0&&(t.imageGen===!0?(r[We]=!0,delete r.input,delete r[rt]):delete r[We]),t.defaultEffort!==void 0&&(t.defaultEffort===null?delete r[Jt]:r[Jt]=t.defaultEffort),r}function vi(e,t){for(let n of[e?.user,e?.base]){let r=Fr(n)?.[t];if(!G(r))continue;let o=r.headers;if(o===void 0)continue;if(!G(o))return;let i={};for(let[a,s]of Object.entries(o))typeof s=="string"&&(i[a]=s);return i}}async function Un(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 ie(e):await ie(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(!ze(i.namespace,t)){r=!0;continue}let a=await e.settings.mutate(Ce,[{op:"set",path:["providers",t,"headers"],value:{...n}}],i.namespace.revision);if(!a.ok){if(o===0&&a.error.code==="settings/conflict")continue;return{ok:!1,error:a.error.message}}return{ok:!0}}catch(i){return{ok:!1,error:i instanceof Error?i.message:String(i)}}return r?{ok:!1,error:"no-route"}:{ok:!1,error:"conflict"}}function ze(e,t){if(Object.prototype.hasOwnProperty.call(xe(e),t))return!0;for(let n of[e?.user,e?.base]){let r=Fr(n);if(r!==void 0&&Object.prototype.hasOwnProperty.call(r,t))return!0}return!1}async function ie(e,t={}){let n=t.fresh===!0?void 0:Lp(e,t.allowStale===!0);if(n!==void 0)return n;let r=await e.settings.describe();return r.ok?{namespace:r.value.namespaces.find(i=>i.ns===Ce),writable:r.value.writable,source:"wire"}:{namespace:void 0,writable:!1,source:"wire"}}var Os=new WeakMap;function Lp(e,t=!1){let n=e.scope;if(n===void 0)return;let r=n.getSnapshot();if(r===void 0)return;if(r.status==="ready"&&typeof r.revision=="number"){let i={namespace:{ns:Ce,schema:{},value:r.value,user:r.user,base:r.base,revision:r.revision,applies:"live",secrets:[]},writable:r.writable===!0,source:"scope"};return Os.set(n,i),i}if(!t||n===void 0)return;let o=Os.get(n);if(o!==void 0)return{...o,source:"scope-stale"}}var xi=new Map;function Fs(e){let t=xi,n=!1,r,o=0,i=new Set,a=()=>{for(let d of[...i])d()},s=()=>{if(n)return Promise.resolve();if(r!==void 0)return r;let d=o;return r=ie(e,{fresh:!0}).then(l=>{if(d!==o||l.namespace===void 0)return;let c=new Map;for(let[f,m]of Object.entries(xe(l.namespace))){let u=new Map,p=Array.isArray(m.models)?m.models:[];for(let h of p){if(!G(h)||typeof h.id!="string"||h.id.length===0)continue;let g={};if(Array.isArray(h.input)){let k=h.input.filter(w=>typeof w=="string");k.length>0&&(g.input=k)}h[We]===!0&&(g.imageGen=!0);let y=h.contextWindow;typeof y=="number"&&Number.isFinite(y)&&y>0&&(g.contextWindow=y),(g.input!==void 0||g.imageGen!==void 0||g.contextWindow!==void 0)&&u.set(h.id,g)}u.size>0&&c.set(f,u)}t=c,n=!0,a()}).catch(()=>{}).finally(()=>{d===o&&(r=void 0)}),r};return{getSnapshot:()=>t,subscribe(d){return i.add(d),()=>{i.delete(d)}},load:s,invalidate(){o+=1,n=!1,r=void 0,i.size>0&&s()}}}var Ap=new Intl.NumberFormat("en-US"),Rp=/^(\d+(?:\.\d+)?)([kmbt])?$/i,Hp={k:1e3,m:1e6,b:1e9,t:1e12};function it(e){let t=e.replace(/[,_\s]/g,"");if(t==="")return;let n=Rp.exec(t);if(n===null)return;let r=n[2]===void 0?1:Hp[n[2].toLowerCase()],o=Math.round(Number(n[1])*r);return Number.isFinite(o)&&o>0?o:void 0}function Qe(e){return e===void 0?"":Ap.format(e)}function Bs(e){if(e===void 0||!Number.isFinite(e)||e<=0)return"";let t=1024,n=t*1024,r=n*1024,o=r*1024,i=s=>Number.isInteger(s)?String(s):s.toFixed(1).replace(/\.0$/,""),a=[{floor:1e12,binary:o,decimal:1e12,suffix:"T"},{floor:1e9,binary:r,decimal:1e9,suffix:"B"},{floor:1e6,binary:n,decimal:1e6,suffix:"M"},{floor:1e3,binary:t,decimal:1e3,suffix:"K"}];for(let s of a){if(e<s.floor)continue;if(e%s.binary===0)return`${e/s.binary}${s.suffix}`;if(e%s.decimal===0)return`${e/s.decimal}${s.suffix}`;let d=u=>Math.round(u*10)/10,l=e/s.binary,c=e/s.decimal,f=Math.abs(e-d(l)*s.binary),m=Math.abs(e-d(c)*s.decimal);return f<=m?`${i(l)}${s.suffix}`:`${i(c)}${s.suffix}`}return String(e)}var qs="dsh-model-think-level.slider.efforts",ki="breSelectWired",Cp=400;function Np(e){return e===void 0?Promise.resolve(void 0):new Promise(t=>{let n=!1,r=i=>{n||(n=!0,t(i))},o=setTimeout(()=>r(void 0),Cp);e.then(i=>{clearTimeout(o),r(i)},()=>{clearTimeout(o),r(void 0)})})}function Ei(e){return typeof e=="object"&&e!==null&&e.ok===!1}function Ti(e){if(!Ei(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 It(e,t){return`${e}/${t}`}function Gs(){try{let e=window.localStorage.getItem(qs);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 Ip(e){try{window.localStorage.setItem(qs,JSON.stringify(e))}catch{}}function Pp(e,t,n){let r=Gs();r[It(e,t)]=n,Ip(r)}function Dp(e,t){return Gs()[It(e,t)]}function jr(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 Op(e,t,n){return e.groups.find(o=>o.id===t)?.models.find(o=>o.id===n)?.reasoning?.defaultEffort}function _p(e){if(!(e.length<2))return e[Math.floor((e.length-1)/2)]}function Fp(e,t){return e===null||e.provider!==t.provider||e.model!==t.model}async function Ks(e,t,n,r,o){let i=jr(e,t,n);if(i.length===0)return;let a=It(t,n),s=r.get(a);if(s!==void 0&&i.includes(s))return s;let d=await Np(o?.configuredEffort===void 0?void 0:o.configuredEffort(t,n));if(d!==void 0&&i.includes(d))return d;let l=Dp(t,n);if(l!==void 0&&i.includes(l))return l;let c=ot(n,{}).defaultEffort;if(c!==void 0&&i.includes(c))return c;let f=Op(e,t,n);return f!==void 0&&i.includes(f)?f:_p(i)}function Ws(e,t){let n=e;if(n[ki]===!0)return()=>{};let r=Object.prototype.hasOwnProperty.call(n,"select"),o=e.select,i=new Map,a=new Set,s=new Map,d=3,l=0,c=async u=>{let p=++l;if(u.reasoningEffort!==void 0){let w=await o.call(e,u);return!Ei(w)&&Je()&&(i.set(It(u.provider,u.model),u.reasoningEffort),Pp(u.provider,u.model,u.reasoningEffort)),w}let h=e.store.getSnapshot();if(!Fp(h.current,u)){if(Je()){let w=It(u.provider,u.model);i.delete(w),a.add(w)}return o.call(e,u)}if(!Je())return o.call(e,u);let g=await Ks(h,u.provider,u.model,i,t);if(l!==p)return;let y=e.store.getSnapshot(),k=y.current!==null&&y.current.provider===u.provider&&y.current.model===u.model;return!Je()||g===void 0||!jr(y,u.provider,u.model).includes(g)?k?void 0:o.call(e,u):o.call(e,{...u,reasoningEffort:g})},f=()=>{let u=e.store.getSnapshot(),p=u.current;if(p===null||p.reasoningEffort!==void 0||!Je())return;let h=It(p.provider,p.model);if(a.has(h))return;if(jr(u,p.provider,p.model).length===0){a.add(h);return}a.add(h);let g=l;Ks(u,p.provider,p.model,i,t).then(async y=>{if(y===void 0){a.delete(h);return}if(!Je()){a.delete(h);return}let k=e.store.getSnapshot(),w=k.current;if(l!==g||w===null||w.reasoningEffort!==void 0||It(w.provider,w.model)!==h||!jr(k,w.provider,w.model).includes(y))return;let C=await o.call(e,{provider:w.provider,model:w.model,reasoningEffort:y});if(Ei(C))throw C}).catch(()=>{let y=(s.get(h)??0)+1;s.set(h,y),y<d&&(a.delete(h),f())})},m=e.store.subscribe(f);return f(),n[ki]=!0,e.select=c,()=>{delete n[ki],m(),r?e.select=o:delete n.select}}var Bp=1e4;function zs(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 Kp(e){return e.current}function Us(e,t){let n=Kp(t),r=e.findIndex(s=>s.id===n?.reasoningEffort);if(r>=0)return r;let i=t.groups.find(s=>s.id===n?.provider)?.models.find(s=>s.id===n?.model)?.reasoning?.defaultEffort,a=i===void 0?-1:e.findIndex(s=>s.id===i);return a>=0?a:Math.floor((e.length-1)/2)}function qp(e){return e?.models??[]}function vt(e){let t=e;return t.name??t.label??t.title??e.id}function Si(e){if(typeof document>"u"||!e.isConnected||e.getClientRects().length===0)return!1;let t=e.getBoundingClientRect();return t.width>0||t.height>0}function Gp(){let[e,t]=(0,E.useState)(null),n=(0,E.useRef)(0),r=(0,E.useCallback)(()=>{window.clearTimeout(n.current),t(null)},[]),o=(0,E.useCallback)((i,a)=>{window.clearTimeout(n.current);let s=i.currentTarget;s.scrollWidth<=s.clientWidth+1||(n.current=window.setTimeout(()=>{Si(s)&&(s.scrollWidth<=s.clientWidth+1||t({target:s,text:a}))},300))},[]);return(0,E.useEffect)(()=>()=>{window.clearTimeout(n.current),t(null)},[]),(0,E.useEffect)(()=>{if(e===null)return;let i=e.target,a=()=>{t(null)};window.addEventListener("pointerdown",a,!0),window.addEventListener("keydown",a,!0),window.addEventListener("scroll",a,!0),window.addEventListener("wheel",a,{capture:!0,passive:!0}),window.addEventListener("resize",a);let s=typeof MutationObserver>"u"?null:new MutationObserver(()=>{Si(i)||a()});return s?.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden"]}),()=>{window.removeEventListener("pointerdown",a,!0),window.removeEventListener("keydown",a,!0),window.removeEventListener("scroll",a,!0),window.removeEventListener("wheel",a,!0),window.removeEventListener("resize",a),s?.disconnect()}},[e]),{tip:e,onEnter:o,onLeave:r}}function Wp({state:e}){if(typeof document>"u")return null;let t=e.target;if(!Si(t))return null;let n=t.getBoundingClientRect();if(n.top>window.innerHeight||n.bottom<0)return null;let r=Math.max(12,Math.min(n.right,window.innerWidth-12));return(0,Vs.createPortal)((0,E.createElement)("div",{className:"bre-tip",role:"tooltip",style:{top:Math.min(n.bottom+6,window.innerHeight-40),right:Math.max(12,window.innerWidth-r)}},e.text),document.body)}var js=new Map;function zp(e,t){let n=t??e.input;if(Array.isArray(n)&&n.length>0)return n.includes("image");let r=JSON.stringify([e.id,e.name]),o=js.get(r);if(o!==void 0)return o;let i=mi(e.id,e.name)?.input,a=i!==void 0?i.includes("image"):(hi(e.id)??[]).includes("image");return js.set(r,a),a}function $s(e,t){return t?.imageGen===!0?!0:e.inputImageGen===!0}function Up(e){let t=e.reasoning?.efforts;return Array.isArray(t)&&t.length>0}function jp(e){return(0,E.createElement)("svg",{className:"bre-tag-icon",width:13,height:13,viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":e},(0,E.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,E.createElement)("circle",{cx:8,cy:8,r:1.8,fill:"currentColor"}))}function $p(e){return(0,E.createElement)("svg",{className:"bre-tag-icon",width:13,height:13,viewBox:"0 0 16 16",fill:"none",role:"img","aria-label":e},(0,E.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 Vp(e){return(0,E.createElement)("svg",{className:"bre-tag-icon",width:13,height:13,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.3,strokeLinecap:"round",strokeLinejoin:"round",role:"img","aria-label":e},(0,E.createElement)("path",{d:"M9.4 12.7H3.6a1.7 1.7 0 0 1-1.7-1.7V5.1a1.7 1.7 0 0 1 1.7-1.7h4.2"}),(0,E.createElement)("path",{d:"M2.6 10.6 5.3 8.5l1.8 1.5 1.6-1.3 2.3 2"}),(0,E.createElement)("path",{d:"M12.4 2.2l.75 2.05L15.2 5l-2.05.75L12.4 7.8l-.75-2.05L9.6 5l2.05-.75Z",fill:"currentColor",stroke:"none"}))}var Yp=["#22c55e","#a3e635","#eab308","#f97316","#ef4444"],Mw=Yp.map(e=>[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]);function Xp(e,t,n,r=!1){let o=[];return zp(e,n)&&o.push((0,E.createElement)("span",{key:"vision",className:"bre-tag",title:t("tagVision")},jp(t("tagVision")))),Up(e)&&o.push((0,E.createElement)("span",{key:"thinking",className:"bre-tag",title:t("tagThinking")},$p(t("tagThinking")))),r&&o.push((0,E.createElement)("span",{key:"imageGen",className:"bre-tag",title:t("tagImageGen")},Vp(t("tagImageGen")))),o.length===0?null:(0,E.createElement)("span",{className:"bre-option-tags"},...o)}function Jp(e,t){let n=Bs(e);return n===""?null:(0,E.createElement)("span",{className:"bre-option-cap",title:t("contextWindowLabel")},n)}function Ys(e){let{directory:t,t:n,configuredInputs:r}=e,o=(0,E.useSyncExternalStore)(v=>t.store.subscribe(v),()=>t.store.getSnapshot()),i=(0,E.useSyncExternalStore)(v=>r?.subscribe(v)??(()=>{}),()=>r?.getSnapshot()??xi),a=zs(o),[s,d]=(0,E.useState)(()=>{let v=t.store.getSnapshot(),D=zs(v);return D[Us(D,v)]?.id??""}),[l,c]=(0,E.useState)(""),[f,m]=(0,E.useState)(null),[u,p]=(0,E.useState)(!1),[h,g]=(0,E.useState)(null),y=(0,E.useRef)(null),k=(0,E.useRef)(""),w=(0,E.useRef)(!1),C=o.current!==null&&a.length>=2,K=u,J=h??o.error,W=t.select,I=(0,E.useCallback)(()=>setTimeout(()=>{w.current&&(w.current=!1,p(!1),g(n("sliderCommitSlow")))},Bp),[n]);(0,E.useLayoutEffect)(()=>{if(w.current||pe.current)return;let v=Us(a,o),D=a[v]?.id??"";k.current=D,d(oe=>oe===D?oe:D),g(null)},[C,a,o]),(0,E.useEffect)(()=>{t.load().catch(()=>{})},[t]),(0,E.useEffect)(()=>{r?.load().catch(()=>{})},[r]);let N=o.current,j=o.groups.find(v=>v.id===N?.provider),R=j?.models.find(v=>v.id===N?.model)?.name??(N===null?n("triggerFallback"):N.model),_=N===null?"":vt(j??{id:N.provider}),b=a.find(v=>v.id===s)?.name??n("effortDefault"),L=(0,E.useSyncExternalStore)(Cr,oi),H=(0,E.useSyncExternalStore)(Ir,bs),ne=(0,E.useSyncExternalStore)(Dr,Es),$=(0,E.useCallback)((v,D)=>i.get(v)?.get(D),[i]),re=(0,E.useCallback)((v,D)=>$s(D,$(v,D.id)),[$]),ee=(0,E.useCallback)((v,D)=>qp(v).filter(oe=>!re(D,oe)),[re]),de=o.groups.filter(v=>ee(v,v.id).length>0&&!H.includes(v.id)).map(v=>v.id),z=en(ii(de),L),Z=f!==null&&z.includes(f)?f:N!==null&&z.includes(N.provider)?N.provider:z[0]??null,te=l.trim().toLowerCase(),fe=te!=="",ve=fe?z.flatMap(v=>ci(ee(o.groups.find(D=>D.id===v),v),ne[v]??[]).filter(D=>(D.name??D.id).toLowerCase().includes(te)||D.id.toLowerCase().includes(te)).map(D=>({provider:v,choice:D}))):[],q=fe?ve:Z===null?[]:ci(ee(o.groups.find(v=>v.id===Z),Z),ne[Z]??[]).map(v=>({provider:Z,choice:v})),Y=N===null?"":N.provider+"/"+N.model,me=n("sliderNoCurrent"),x=(0,E.useCallback)(()=>{let v=y.current?.closest('[role="menu"], [role="group"]');v!=null&&(v.tabIndex=-1,v.focus({preventScroll:!0}))},[]),M=(0,E.useCallback)(async(v,D)=>{if(w.current)return;let oe=t.store.getSnapshot().current;if(fe&&c(""),oe!==null&&oe.provider===v&&oe.model===D)return;w.current=!0,x(),p(!0),g(null);let Ae=I();try{let Re=await W({provider:v,model:D}),Xe=Ti(Re);if(Xe!==void 0)throw new Error(Xe)}catch(Re){g(Re instanceof Error?Re.message:String(Re))}finally{clearTimeout(Ae),w.current=!1,p(!1)}},[I,t,x,fe,W]),F=(0,E.useCallback)(async v=>{if(w.current||v===o.current?.reasoningEffort&&o.status!=="error")return;w.current=!0;let D=k.current;x(),p(!0),g(null),d(v);let oe=I();try{let Ae=o.current;if(Ae===null)throw new Error(n("sliderNoCurrent"));let Re=await W({provider:Ae.provider,model:Ae.model,reasoningEffort:v}),Xe=Ti(Re);if(Xe!==void 0)throw new Error(Xe);let At=t.store.getSnapshot(),Ja=a.find(jf=>jf.id===At.current?.reasoningEffort)?.id??v;k.current=Ja,d(Ja)}catch(Ae){k.current=D,d(D),g(Ae instanceof Error?Ae.message:String(Ae))}finally{clearTimeout(oe),w.current=!1,p(!1)}},[I,t,x,a,W,o.current,o.status,n]),V=(0,E.useRef)(null),ue=(0,E.useRef)(null),ae=(0,E.useRef)(null),pe=(0,E.useRef)(!1),X=(0,E.useRef)(null),be=(0,E.useRef)(null),Me=(0,E.useRef)(null),[$t,qe]=(0,E.useState)(null),[Yo,Pn]=(0,E.useState)(null),Xo=Math.max(0,a.findIndex(v=>v.id===s)),Ye=$t??Xo,Dn=(Yo??(a.length>1?Ye/(a.length-1):0))*100,On=v=>{let D=V.current;if(D===null)return 0;let oe=D.getBoundingClientRect();return oe.width<=0?0:Math.min(1,Math.max(0,(v-oe.left)/oe.width))},Vt=v=>a.length>1?Math.round(v*(a.length-1)):0,Jo=v=>{be.current=v;let D=v*100;ue.current!==null&&(ue.current.style.clipPath=`inset(0 ${100-D}% 0 0)`),ae.current!==null&&(ae.current.style.left=`${D}%`)},wr=v=>{if(a.length===0)return;let D=On(v);Me.current===null&&(Me.current=requestAnimationFrame(()=>{Me.current=null,pe.current&&be.current!==null&&Jo(be.current)})),be.current=D;let oe=Vt(D);oe!==X.current&&(X.current=oe,qe(oe),Pn(D))},vr=()=>{X.current=null,be.current=null,Me.current!==null&&(cancelAnimationFrame(Me.current),Me.current=null),qe(null),Pn(null)},xr=v=>{if(C){if(v.preventDefault(),pe.current=!0,typeof v.currentTarget.setPointerCapture=="function")try{v.currentTarget.setPointerCapture(v.pointerId)}catch{}X.current=Vt(On(v.clientX)),wr(v.clientX),qe(X.current),Pn(be.current)}},Le=v=>{pe.current&&wr(v.clientX)},kr=v=>{if(!pe.current)return;if(pe.current=!1,typeof v.currentTarget.releasePointerCapture=="function"&&v.currentTarget.hasPointerCapture?.(v.pointerId)===!0)try{v.currentTarget.releasePointerCapture(v.pointerId)}catch{}let D=Vt(On(v.clientX)),oe=a[D];if(oe===void 0){vr();return}F(oe.id).finally(vr)},Qo=v=>{if(!C)return;let D;if(v.key==="ArrowRight"||v.key==="ArrowUp"?D=Math.min(a.length-1,Ye+1):v.key==="ArrowLeft"||v.key==="ArrowDown"?D=Math.max(0,Ye-1):v.key==="Home"?D=0:v.key==="End"&&(D=a.length-1),D===void 0)return;v.preventDefault();let oe=a[D];oe!==void 0&&F(oe.id)},{tip:Yt,onEnter:Lt,onLeave:_n}=Gp(),Er=(0,E.createElement)("div",{className:"bre-menu-head"},(0,E.createElement)("span",{className:"bre-row-label"},n("modelRowLabel")),(0,E.createElement)("span",{className:"bre-menu-cur"},(0,E.createElement)("span",{className:"bre-menu-name","aria-label":N===null?R:_+" \xB7 "+R,onMouseEnter:v=>{Lt(v,N===null?R:_+" \xB7 "+R)},onMouseLeave:_n},R),_===""?null:(0,E.createElement)("span",{className:"bre-menu-prov"},_))),T=(0,E.createElement)("div",{className:"bre-menu-search"},(0,E.createElement)("div",{className:"bre-menu-search-box"},(0,E.createElement)("span",{className:"bre-menu-search-icon","aria-hidden":!0},(0,E.createElement)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,E.createElement)("circle",{cx:"7",cy:"7",r:"4.5"}),(0,E.createElement)("path",{d:"M10.5 10.5L14 14",strokeLinecap:"round"}))),(0,E.createElement)("input",{type:"text",className:"bre-menu-search-input",role:"searchbox",placeholder:n("modelSearchPlaceholder"),"aria-label":n("modelSearchPlaceholder"),value:l,spellCheck:!1,autoComplete:"off",onChange:v=>{c(v.currentTarget.value)},onKeyDown:v=>{v.key!=="Escape"||l===""||(v.preventDefault(),v.stopPropagation(),c(""))}}),l===""?null:(0,E.createElement)("button",{type:"button",className:"bre-menu-search-clear",title:n("modelSearchClear"),"aria-label":n("modelSearchClear"),onClick:()=>{c("")}},(0,E.createElement)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,E.createElement)("path",{d:"M4 4L12 12M12 4L4 12",strokeLinecap:"round"}))))),Q=(0,E.createElement)("div",{className:"bre-providers",role:"group","aria-label":n("modelRowLabel")},...z.map(v=>{let D=o.groups.find(oe=>oe.id===v);return(0,E.createElement)("button",{key:v,type:"button",className:"bre-provider"+(v===Z?" is-open":"")+(v===N?.provider?" is-current":""),disabled:K,"aria-expanded":v===Z,onMouseLeave:_n,onClick:()=>{m(v),c("")}},(0,E.createElement)("span",{className:"bre-option-name","aria-label":vt(D),onMouseEnter:oe=>{Lt(oe,vt(D))}},vt(D)),(0,E.createElement)("span",{className:"bre-provider-count"},String(ee(D,v).length)))}),...z.length===0?[(0,E.createElement)("div",{key:"no-providers",className:"bre-empty"},me)]:[]),ye=(0,E.createElement)("div",{className:"bre-provider-models",role:"group","aria-label":n("modelRowLabel")},...q.length===0?[(0,E.createElement)("div",{key:"no-models",className:"bre-empty"},fe?n("modelSearchNoMatches"):me)]:q.map(({provider:v,choice:D})=>{let oe=v+"/"+D.id,Ae=oe===Y,Re=D.name??D.id,Xe=fe?vt(o.groups.find(At=>At.id===v))+" \xB7 "+Re:Re;return(0,E.createElement)("button",{key:oe,type:"button",className:"bre-option"+(Ae?" is-active":""),disabled:K,"aria-pressed":Ae,onMouseLeave:_n,onClick:()=>{M(v,D.id)}},(0,E.createElement)("span",{className:"bre-option-name","aria-label":Xe,onMouseEnter:At=>{Lt(At,Xe)}},fe?(0,E.createElement)("span",{className:"bre-option-origin"},vt(o.groups.find(At=>At.id===v))+" \xB7 "):null,Re),Jp($(v,D.id)?.contextWindow,n),Xp(D,n,$(v,D.id)?.input,$s(D,$(v,D.id))))})),Ee=(0,E.createElement)("div",{className:"bre-menu-foot"},C?(0,E.createElement)("div",{className:"bre-menu-slider"},(0,E.createElement)("div",{className:"bre-effort-slider-head","aria-hidden":!0},(0,E.createElement)("span",{className:"bre-effort-slider-head-label"},n("effortRowLabel")),(0,E.createElement)("span",{className:"bre-effort-slider-head-value"},a[Ye]?.name??b)),(0,E.createElement)("div",{className:"bre-effort-slider",ref:V,role:"slider",tabIndex:0,"aria-label":n("effortRowLabel"),"aria-valuemin":0,"aria-valuemax":a.length-1,"aria-valuenow":Ye,"aria-valuetext":a[Ye]?.name,"aria-disabled":K||void 0,"data-bre-dragging":$t===null?void 0:"true",onPointerDown:xr,onPointerMove:Le,onPointerUp:kr,onPointerCancel:kr,onKeyDown:Qo},(0,E.createElement)("span",{className:"bre-effort-slider-fill",ref:ue,style:{clipPath:`inset(0 ${100-Dn}% 0 0)`}}),...a.map((v,D)=>D===Ye?null:(0,E.createElement)("span",{key:"tick-"+v.id,className:"bre-effort-slider-tick",style:{left:a.length>1?`${D/(a.length-1)*100}%`:"0%"}})),(0,E.createElement)("span",{className:"bre-effort-slider-thumb",ref:ae,style:{left:`${Dn}%`}})),(0,E.createElement)("div",{className:"bre-effort-slider-labels","aria-hidden":!0},...a.map((v,D)=>(0,E.createElement)("span",{key:v.id,className:"bre-effort-slider-label"+(D===0?" is-first":"")+(D===a.length-1?" is-last":"")+(D===Ye?" is-on":""),style:{left:a.length>1?`${D/(a.length-1)*100}%`:"0%"}},v.name)))):(0,E.createElement)("span",{className:"bre-row-value is-muted"},n("sliderNoLevels")));return(0,E.createElement)("div",{className:"bre-slider-body",ref:y},(0,E.createElement)("div",{className:"bre-card"},Er,T,(0,E.createElement)("div",{className:"bre-panel bre-panel-models"},Q,ye),Ee),J===null?null:(0,E.createElement)("div",{className:"bre-model-error",role:"status"},J),Yt===null?null:(0,E.createElement)(Wp,{key:"tip",state:Yt}))}var ge=require("react"),Js='section[role="group"]',Li='button[role="menuitemradio"]';function Qs(e){return e.querySelector(Js)!==null}function Mi(e){return Array.from(e.querySelectorAll(Li)).filter(t=>!t.disabled&&t.style.display!=="none")}function Qp(e){let t=e.getAttribute("aria-labelledby");return(t===null?null:e.ownerDocument.getElementById(t))?.textContent?.toLowerCase()??""}function Xs(e,t,n=new Map){let r=d=>{n.has(d)||n.set(d,d.style.display),d.style.display="none"},o=d=>{let l=n.get(d);l!==void 0&&(d.style.display=l,n.delete(d))};for(let d of[...n.keys()])d.isConnected||n.delete(d);let i=t.trim().toLowerCase().split(/\s+/).filter(Boolean),a=Array.from(e.querySelectorAll(Js)),s=0;if(i.length===0){for(let d of[...n.keys()])o(d);for(let d of a)s+=d.querySelectorAll(Li).length;return s}for(let d of a){let l=Qp(d),c=Array.from(d.querySelectorAll(Li)),f=0;for(let m of c){let u=(m.getAttribute("title")??"").toLowerCase(),p=(m.textContent??"").toLowerCase(),h=`${l} ${u} ${p}`;i.every(g=>h.includes(g))?(o(m),f+=1):r(m)}f>0?(o(d),s+=f):r(d)}return s}function Zs({menu:e,t}){let[n,r]=(0,ge.useState)(""),[o,i]=(0,ge.useState)(0),a=(0,ge.useRef)(null),s=(0,ge.useRef)(""),d=(0,ge.useRef)(new Map),l=(0,ge.useCallback)(u=>{s.current=u;let p=Xs(e,u,d.current);i(p)},[e]);(0,ge.useEffect)(()=>()=>{Xs(e,"",d.current)},[e]),(0,ge.useEffect)(()=>{let u=new MutationObserver(()=>{s.current.trim().length!==0&&l(s.current)});return u.observe(e,{childList:!0,subtree:!0}),()=>{u.disconnect()}},[e,l]),(0,ge.useEffect)(()=>{let u=p=>{if(s.current.trim().length===0)return;let h=p.key;if(!(h==="ArrowDown"||h==="ArrowUp")&&!(h==="Home"||h==="End"||h==="PageUp"||h==="PageDown")||p.target===a.current||p.target instanceof Node&&!e.contains(p.target))return;let k=Mi(e);if(k.length===0)return;let w=k.findIndex(K=>K===document.activeElement),C;h==="Home"||h==="PageUp"?C=0:h==="End"||h==="PageDown"?C=k.length-1:h==="ArrowDown"?C=w===-1?0:(w+1)%k.length:C=w===-1?k.length-1:(w-1+k.length)%k.length,p.preventDefault(),p.stopPropagation(),k[C]?.focus()};return e.addEventListener("keydown",u,!0),()=>{e.removeEventListener("keydown",u,!0)}},[e]);let c=u=>{let p=u.key;if(p==="ArrowDown"){u.preventDefault(),u.stopPropagation(),Mi(e)[0]?.focus();return}if(n.trim().length>0&&(p==="ArrowUp"||p==="Home"||p==="PageUp"||p==="End"||p==="PageDown")){let h=Mi(e);h.length>0&&(u.preventDefault(),u.stopPropagation(),h[p==="ArrowUp"||p==="End"||p==="PageDown"?h.length-1:0]?.focus());return}p==="Escape"&&n.length>0&&(u.preventDefault(),u.stopPropagation(),r(""),l(""))},f=()=>{r(""),l(""),a.current?.focus({preventScroll:!0})},m=o===0&&n.trim().length>0;return(0,ge.createElement)("div",{className:"bre-model-search-box"+(m?" has-empty":""),"data-bre-search":"1"},(0,ge.createElement)("div",{className:"bre-search-input-wrapper"},(0,ge.createElement)("span",{className:"bre-search-icon","aria-hidden":"true"},(0,ge.createElement)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,ge.createElement)("circle",{cx:"7",cy:"7",r:"4.5"}),(0,ge.createElement)("path",{d:"M10.5 10.5L14 14",strokeLinecap:"round"}))),(0,ge.createElement)("input",{ref:a,type:"text",className:"bre-search-input",role:"searchbox",placeholder:t("modelSearchPlaceholder"),"aria-label":t("modelSearchPlaceholder"),value:n,spellCheck:!1,autoComplete:"off",onChange:u=>{let p=u.currentTarget.value;r(p),l(p)},onKeyDown:c}),n.length>0?(0,ge.createElement)("button",{type:"button",className:"bre-search-clear",title:t("modelSearchClear"),"aria-label":t("modelSearchClear"),onClick:f},(0,ge.createElement)("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5"},(0,ge.createElement)("path",{d:"M4 4L12 12M12 4L4 12",strokeLinecap:"round"}))):null),m?(0,ge.createElement)("div",{className:"bre-search-empty",role:"status"},t("modelSearchNoMatches")):null)}var $r=require("react"),ed=require("react-dom"),td=require("react-dom/client");function Ze(){return document.body}function et(e,t,n){let r=(0,td.createRoot)(e);return n?.sync===!0?(0,ed.flushSync)(()=>{r.render(t)}):r.render(t),{wrapper:e,root:r}}function ke(e){e!==void 0&&(e.root.unmount(),e.wrapper.remove())}var Ie=class extends $r.Component{constructor(){super(...arguments);Te(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,$r.createElement)("div",{style:{color:"#c00",fontSize:"11px",whiteSpace:"pre-wrap",padding:"6px"}},`${this.props.fallbackText}: ${this.state.error}`):this.props.children}};var Zp="conversation.input.model";function nd(e){return e.querySelector("[data-composer-card]")??void 0}function Ai(e){return e.querySelector(`[data-slot="${Zp}"]`)??void 0}function rd(e){let t=Ai(e)??e;return Array.from(t.querySelectorAll('button[aria-haspopup="menu"]'))}function Ri(e){if(e==null)return!1;let t=e.getAttribute("role");return t==="menu"||t==="group"}function Hi(e){return e.getAttribute("role")==="group"}function od(e,t){let n=e.getAttribute("aria-controls");if(n===null||n.length===0)return;let r=t.getElementById(n);return Ri(r)?r:void 0}function Ci(e=document){let t=nd(e);if(t===void 0)return;for(let r of rd(t)){let o=od(r,e);if(o!==void 0)return o}let n=Ai(t)??t;for(let r of Array.from(n.querySelectorAll('[role="menu"], [role="group"]')))if(r.previousElementSibling?.matches('button[aria-haspopup="menu"]')&&Ri(r)&&!(r.getAttribute("role")==="group"&&r.querySelector('[role="menuitemradio"], section[role="group"]')===null))return r}function Ni(e=document){let t=nd(e);if(t===void 0)return;let n=Ai(t),r=rd(t),o=r[0];if(o!==void 0){for(let i of r)if(od(i,e)!==void 0)return i;for(let i of r)if(Ri(i.nextElementSibling))return i;return n===void 0?r.at(-1):o}}function id(){return Ci()}function ad(){return Ni()}var em=()=>{(0,sd.flushSync)(()=>{window.dispatchEvent(new Event("resize"))})};function dd(e){let{menuOf:t,triggerOf:n,t:r,refreshed:o,sliderEnabled:i,directory:a}=e,s,d,l,c,f,m,u,p,h=()=>{p?.removeAttribute("data-bre-provider"),p=void 0},g=()=>{let S=n();p!==void 0&&p!==S&&h();let R=m?.store.getSnapshot(),_=R?.current;if(S===void 0||_===null||_===void 0){S===p&&h();return}let b=R?.groups.find(H=>H.id===_.provider),L=b===void 0?_.provider:vt(b);if(L.trim()===""){S===p&&h();return}S.dataset.breProvider=L,p=S},y=()=>{let S=a();S!==m&&(u?.(),u=void 0,m=S,S!==void 0&&(u=S.store.subscribe(g))),g()},k=()=>{ke(l),l=void 0},w=new Map,C=()=>{for(let[R,_]of w)R.style.display=_;w.clear();let S=t();S!==void 0&&S.getAttribute("tabindex")==="-1"&&S.removeAttribute("tabindex")},K=S=>S.getAttribute("aria-hidden")!=="true"||S.childElementCount>0?!1:(S.textContent??"").trim()==="",J=(S,R)=>{for(let L of Array.from(w.keys()))(!L.isConnected||L.parentElement!==S)&&w.delete(L);let _=[];for(let L of Array.from(S.children))L!==R&&(K(L)||_.push(L));let b=document.activeElement;b!==null&&b!==R&&!R.contains(b)&&_.some(L=>L.contains(b))&&(S.tabIndex=-1,S.focus({preventScroll:!0}));for(let L of _)w.has(L)||w.set(L,L.style.display),L.style.display!=="none"&&(L.style.display="none")},W=S=>{let R=S.querySelector('section[role="group"]'),_=R?.parentElement,b=_!=null&&_.parentElement===S?_:R;if(l===void 0){let L=document.createElement("div");L.dataset.plugin=we,L.dataset.breSearch="1",S.insertBefore(L,b),l=et(L,(0,jn.createElement)(Ie,{fallbackText:r("modelSearchFailed"),children:o(()=>(0,jn.createElement)(Zs,{menu:S,t:r}))}),{sync:!0});return}if(l.wrapper.parentElement!==S){S.insertBefore(l.wrapper,b);return}b!==null&&l.wrapper.nextSibling!==b&&S.insertBefore(l.wrapper,b)},I=S=>{if(!i()){ke(s),s=void 0,d=void 0,S.classList.remove("bre-model-menu-host"),C();for(let H of Array.from(S.children))H.getAttribute("role")==="menuitem"&&(H.style.display="");return}let R=a();if(R===void 0)return;if(s!==void 0&&d!==R&&(ke(s),s=void 0,d=void 0),s===void 0){d=R;let H=document.createElement("div");H.dataset.plugin=we,H.dataset.breSlider="1",S.insertBefore(H,S.firstChild),s=et(H,(0,jn.createElement)(Ie,{fallbackText:r("renderFailed"),children:o(()=>(0,jn.createElement)(Ys,{directory:R,configuredInputs:e.configuredInputs,t:r}))}),{sync:!0})}else(s.wrapper.parentElement!==S||S.firstChild!==s.wrapper)&&S.insertBefore(s.wrapper,S.firstChild);S.classList.add("bre-model-menu-host");let _=Array.from(S.children).filter(H=>H.getAttribute("role")==="menuitem"),b=s.wrapper;if(Hi(S)){b.style.display="",J(S,b);return}if(C(),Array.from(S.querySelectorAll('[role="menuitemradio"]')).some(H=>!b.contains(H)))s.wrapper.contains(document.activeElement)&&(S.tabIndex=-1,S.focus({preventScroll:!0})),s.wrapper.style.display="none";else{s.wrapper.style.display="";for(let H of _)H.style.display="none"}};return{reconcile:()=>{y();let S=t();if(S===void 0){s!==void 0&&(i()?s.wrapper.remove():(ke(s),s=void 0,d=void 0)),k(),c=void 0,f=void 0,C();return}let R=Hi(S),_=R&&i(),b=!R&&Qs(S);b?W(S):k(),I(S),(b!==c||_!==f)&&(c=b,f=_,(b||_||i())&&em())},dispose:()=>{u?.(),u=void 0,m=void 0,h(),ke(s),s=void 0,d=void 0,k(),C(),c=void 0,f=void 0}}}var tm=350;function ld(e){let t,n,r=0,o=()=>{if(t!==void 0)return Promise.resolve();let s=r;return n??(n=ie(e.api).then(d=>{if(d.namespace===void 0){n=void 0;return}let l=new Map;for(let[c,f]of Object.entries(xe(d.namespace))){let m=Array.isArray(f.models)?f.models:[];for(let u of m){if(typeof u!="object"||u===null||Array.isArray(u))continue;let p=u.id,h=u[Jt];typeof p=="string"&&typeof h=="string"&&h.length>0&&l.set(`${c}/${p}`,h)}}s===r?t=l:n=void 0}).catch(()=>{s===r&&(n=void 0)})),n};return{of:async(s,d)=>{if(t===void 0){let l=o();await new Promise(c=>{let f=!1,m=()=>{f||(f=!0,c())},u=setTimeout(m,tm);l.then(()=>{clearTimeout(u),m()},()=>{clearTimeout(u),m()})})}return t?.get(`${s}/${d}`)},invalidate:()=>{r+=1,t=void 0,n=void 0}}}function nm(e){let t=e.input;return Array.isArray(t)&&t.length>0?!0:e[rt]===!0||e[We]===!0}function Ii(e,t=()=>!0,n={},r=0){let o=n.efforts!==!1,i=n.modalities!==!1;if(!G(e))return;let a={};for(let s of Object.keys(e)){if(!t(s))continue;let d=e[s],l=G(d)&&Array.isArray(d.models)?d.models:void 0;if(l===void 0||l.length===0)continue;let c=l,f=[],m=!1;for(let u of c){if(!G(u)){f.push(u);continue}let p=u,h=p.reasoningEfforts!==void 0||p[Ge]===!0,g=nm(p);if((h||!o)&&(g||!i)){let W=rm(p,e,s);W!==void 0?(m=!0,f.push(W)):f.push(p);continue}let y=typeof p.id=="string"?p.id:"";if(y.length===0){f.push(p);continue}let k=Ht(e,s),w=typeof p.name=="string"?p.name:void 0,C=ot(y,{...k,displayName:w??k.displayName});if(C.efforts===void 0){f.push(p);continue}let K={...p},J=!1;if(!h&&o&&C.confidence!=="low"&&(J=!0,K.reasoningEfforts=C.efforts,K[Xt]=r,C.compat!==void 0)){let W=G(p.compat)?p.compat:{};K.compat={...W,...C.compat}}if(!g&&i&&(C.imageGen===!0?(J=!0,K[We]=!0):C.input!==void 0&&(J=!0,K.input=[...C.input])),!J){f.push(p);continue}m=!0,f.push(K)}m&&(a[s]={models:f})}return Object.keys(a).length===0?void 0:{providers:a}}function rm(e,t,n){if(!G(e.reasoningEfforts)||e[Ge]===!0)return;let r=e.compat,o=G(r)?{...r}:{};if(o.supportsDeveloperRole===void 0&&gi(Ht(t,n)))return{...e,compat:{...o,supportsDeveloperRole:!1}}}function cd(e){let t,n=0,r=()=>{if(t!==void 0)return t;let i=(async()=>{try{let a=await fetch(ts,{method:"GET"});if(!a.ok)return;let s=await a.json();return s?.ok!==!0?void 0:{autofill:s.data?.autofill!==!1,modalityAutofill:s.data?.modalityAutofill!==!1}}catch{return}})().then(a=>(a===void 0&&t===i&&(t=void 0),a??{autofill:!0,modalityAutofill:!0}));return t=i,i},o=async i=>{let a=n;try{let s=await r();if(a!==n||!s.autofill)return;let d=i??await ie(e.api),l=d.namespace;if(a!==n||l===void 0||d.writable!==!0)return;let c=Br(l);if(c===void 0||Ii(c,()=>!0,{modalities:s.modalityAutofill},l.revision)===void 0)return;let m=d.source==="scope"?await ie(e.api,{fresh:!0}):d,u=m.namespace;if(a!==n||u===void 0||m.writable!==!0)return;let p=Br(u);if(p===void 0)return;let h=Ii(p,()=>!0,{modalities:s.modalityAutofill},u.revision);if(h===void 0)return;let g=h.providers,y=Object.entries(g).map(([w,C])=>({op:"set",path:["providers",w,"models"],value:C.models})),k=await e.api.settings.mutate(Ce,y,u.revision);k.ok||console.error(`[bre] idle autofill refused: ${k.error.message}`)}catch(s){console.error(`[bre] idle autofill failed: ${s instanceof Error?s.message:String(s)}`)}};return{run:()=>{o()},invalidate:()=>{n+=1,t=void 0}}}var $a=require("react"),gf=require("react-dom"),hf=require("react-dom/client");var le=require("react");var xt=Is;function Pt(e){let t={};for(let n of xt){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 rn(e){let t=!1,n=!1,r={};for(let o of xt){let i=e[o];if(!i.on)continue;if(o==="off"){t=!0;let s=i.wire.trim();r.off=s.length===0?null:s;continue}n=!0;let a=i.wire.trim();r[o]=a.length===0?o:a}return n?r:t?!1:void 0}function $n(e,t){if(e===t)return!0;if(e===!1||e===void 0||t===!1||t===void 0)return!1;let n=xt.filter(o=>e[o]!==void 0),r=xt.filter(o=>t[o]!==void 0);return n.length!==r.length?!1:n.every(o=>e[o]===t[o])}function ud(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 Pi="bre:auto-effort",fd=Promise.resolve();function pd(e){fd=fd.then(e,e).then(()=>{},()=>{})}function md(e,t=document){t.dispatchEvent(new CustomEvent(Pi,{detail:{route:e}}))}function gd(e,t=document){let n=r=>{let o=r.detail;typeof o?.route!="string"||o.route.length===0||e(o.route)};return t.addEventListener(Pi,n),()=>{t.removeEventListener(Pi,n)}}var P=require("react/jsx-runtime"),om=["M3.4 4.2h9.2","M8 4.2v8.2","M5.9 12.4h4.2"],im=["M4.4 3.4h7.2a1.9 1.9 0 0 1 1.9 1.9v5.4a1.9 1.9 0 0 1-1.9 1.9H4.4a1.9 1.9 0 0 1-1.9-1.9V5.3a1.9 1.9 0 0 1 1.9-1.9Z","M6.2 7.2a.9.9 0 1 0 0-1.8.9.9 0 0 0 0 1.8Z","M2.9 11.2 6.1 8.4l2.1 1.9 1.8-1.5 2.7 2.4"],am=["M9.4 12.7H3.6a1.7 1.7 0 0 1-1.7-1.7V5.1a1.7 1.7 0 0 1 1.7-1.7h4.2","M2.6 10.6 5.3 8.5l1.8 1.5 1.6-1.3 2.3 2","M12.4 2.2l.75 2.05L15.2 5l-2.05.75L12.4 7.8l-.75-2.05L9.6 5l2.05-.75Z"],sm=["M8 3.2 13.6 12.8H2.4L8 3.2Z","M8 6.9v2.5","M8 11.3h.01"],dm=["M8 2.6 9.1 6.4 12.9 7.5 9.1 8.6 8 12.4 6.9 8.6 3.1 7.5 6.9 6.4Z","M12.3 2.4v1.9M11.35 3.35h1.9"],lm=["M4.5 6.5 8 10 11.5 6.5"],cm=["M6.5 4.5 10 8 6.5 11.5"];function on({paths:e}){return(0,P.jsx)("svg",{viewBox:"0 0 16 16",width:12,height:12,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.map(t=>(0,P.jsx)("path",{d:t},t))})}function ct(e,t){return t===!0?{declared:!1,image:!1,imageGen:!0}:e===void 0||e.length===0?{declared:!1,image:!1,imageGen:!1}:{declared:!0,image:e.includes("image"),imageGen:!1}}function Yr(e){return e.imageGen?{input:null,imageGen:!0}:e.declared?{input:e.image?["text","image"]:["text"],imageGen:!1}:{input:null,imageGen:!1}}function Vr(e,t,n){return e.imageGen!==(n===!0)?!1:e.imageGen?!0:e.declared?t===void 0?!1:e.image?t.includes("image"):!t.includes("image"):t===void 0}function Di(e,t,n){let r=e?t:!1;return e&&r===void 0&&n===void 0?"keep":r}function Xr(e){let t=e.appliedCompat;return e.initialCompat?.supportsThinkingTokenBudget===!0&&e.initialCompat?.thinkingTokenBudgetField===void 0&&t?.thinkingTokenBudgetField===void 0&&(e.routeApi??"").toLowerCase()==="openai-completions"&&(t={...t??{},thinkingTokenBudgetField:"thinking_token_budget"}),{efforts:e.efforts,...t===void 0?{}:{compat:t},...e.input===void 0?{}:{input:e.input},...e.imageGen===void 0?{}:{imageGen:e.imageGen},...e.defaultEffort===void 0?{}:{defaultEffort:e.defaultEffort}}}function Jr({route:e,routeApi:t,routeBaseURL:n,modelId:r,modelName:o,efforts:i,effortsUnset:a=!1,input:s,imageGen:d,compat:l,defaultEffort:c,index:f,staged:m=!1,officialInputTypes:u=!1,api:p,readOnly:h,t:g}){let[y,k]=(0,le.useState)(()=>Pt(i)),[w,C]=(0,le.useState)(()=>ct(s,d)),[K,J]=(0,le.useState)(()=>i!==!1),[W,I]=(0,le.useState)(()=>c??""),[N,j]=(0,le.useState)(!1),[S,R]=(0,le.useState)(void 0),[_,b]=(0,le.useState)(()=>xt.some(T=>y[T].on&&y[T].wire.trim()!==(T==="off"?"":T))),L=(0,le.useRef)(void 0),H=(0,le.useRef)(void 0);H.current===void 0&&(H.current=p.readCapacities?.()??{});let[ne,$]=(0,le.useState)(()=>Qe(H.current?.contextWindow)),[re,ee]=(0,le.useState)(()=>Qe(H.current?.maxTokens)),[de,z]=(0,le.useState)(void 0),Z=(0,le.useRef)(!1),te=(0,le.useRef)(i),fe=(0,le.useRef)(s),ve=(0,le.useRef)(d),q=(0,le.useRef)(c),Y=(0,le.useRef)(void 0),me=(0,le.useRef)(i);me.current=i;let x=(0,le.useRef)(a);x.current=a,(0,le.useEffect)(()=>gd(T=>{if(T!==e||me.current!==void 0||x.current)return;let Q=Y.current;Q!==void 0&&pd(Q)}),[e]),(0,le.useEffect)(()=>{$n(te.current,i)||(te.current=i,Z.current||(k(Pt(i)),J(i!==!1))),(fe.current!==s||ve.current!==d)&&(fe.current=s,ve.current=d,Z.current||C(ct(s,d))),q.current!==c&&(q.current=c,Z.current||I(c??""))},[i,s,d,c]);let M=xt.filter(T=>y[T].on),F=W===(c??"")?void 0:W===""?null:W,V=K?rn(y):!1,ue=!$n(V,i)||!Vr(w,s,d)||F!==void 0,ae=(0,le.useRef)(void 0),pe=()=>{Z.current=!0},X=(T,Q,ye,Ee=K)=>{let v=Di(Ee,rn(T),i),oe=!Vr(Q,s,d)?Yr(Q):void 0,Ae=ye===(c??"")?void 0:ye===""?null:ye,Re=Xr({efforts:v,input:oe?.input,imageGen:oe?.imageGen,defaultEffort:Ae,appliedCompat:L.current,routeApi:t,initialCompat:l}),Xe=JSON.stringify(Re);ae.current!==Xe&&(ae.current=Xe,p.commit(e,r,Re))},be=(T,Q)=>{pe();let ye=!Q&&W===T?"":W;ye!==W&&I(ye);let Ee={...y,[T]:{...y[T],on:Q}};Q&&T!=="off"&&Ee[T].wire.trim().length===0&&(Ee[T]={...Ee[T],wire:T}),k(Ee),X(Ee,w,ye),R(void 0)},Me=T=>{pe(),J(T);let Q=T?W:"";Q!==W&&I(Q),X(y,w,Q,T),R(void 0)},$t=(T,Q)=>{pe();let ye={...y,[T]:{...y[T],wire:Q}};k(ye),X(ye,w,W),R(void 0)},qe=T=>{pe();let Q={declared:!0,image:T,imageGen:!1};C(Q),X(y,Q,W),R(void 0)},Yo=()=>{pe();let T={declared:!1,image:!1,imageGen:!1};C(T),X(y,T,W),R(void 0)},Pn=T=>{pe();let Q=T?{declared:!1,image:!1,imageGen:!0}:{declared:!1,image:!1,imageGen:!1};C(Q),X(y,Q,W),R(void 0)},Xo=T=>{pe(),I(T),X(y,w,T),R(void 0)},Ye=(T,Q)=>{let ye=Q.slice(0,20),Ee=T==="context"?ye:ne,v=T==="output"?ye:re;z(T),T==="context"?$(ye):ee(ye),p.setCapacities?.({contextWindow:it(Ee),maxTokens:it(v)})},Dn=T=>{T==="context"?$(Q=>Qe(it(Q))):ee(Q=>Qe(it(Q))),z(void 0)},On=T=>{pe();let Q=T.efforts!==!1;J(Q);let ye=Pt(T.efforts);k(ye);let Ee=T.imageGen===!0?ct(void 0,!0):T.input===void 0?w:ct(T.input);Ee!==w&&C(Ee);let v=W===""&&T.defaultEffort!==void 0?T.defaultEffort:W;if(v!==W&&I(v),L.current=T.compat,T.contextWindow!==void 0||T.maxTokens!==void 0){p.fillCapacities?.(T.contextWindow,T.maxTokens);let D=p.readCapacities?.();$(Qe(D?.contextWindow)),ee(Qe(D?.maxTokens))}R(void 0),X(ye,Ee,v,Q)},Vt=async()=>{if(!(h||N)){j(!0),R(void 0);try{let T=m?await p.suggest(e,r,o,{...t===void 0?{}:{api:t},...n===void 0?{}:{baseURL:n}}):await p.suggest(e,r,o);if(!T.ok){R({kind:"error",text:T.error==="no-suggestion"?g("noSuggestion"):T.error});return}On(T.suggestion)}catch(T){R({kind:"error",text:g("writeError",{message:String(T)})})}finally{j(!1)}}};(0,le.useEffect)(()=>{Y.current=Vt});let Jo=()=>{Z.current=!1,p.withdraw(e,r),k(Pt(i)),J(i!==!1),C(ct(s,d)),I(c??""),L.current=void 0;let T=H.current??{};$(Qe(T.contextWindow)),ee(Qe(T.maxTokens)),z(void 0),p.setCapacities?.({contextWindow:T.contextWindow,maxTokens:T.maxTokens}),R(void 0),ae.current=void 0},wr=(0,le.useMemo)(()=>ot(r,{...t===void 0?{}:{api:t},...n===void 0?{}:{baseURL:n}}).compat?.thinkingFormat,[r,t,n]),vr=L.current?.thinkingFormat??wr,xr=ud(i,vr),Le=h||N,kr=K?M.length===0?g("stateUndeclared"):g("stateDeclared",{count:M.length,default:g(W===""?"defaultEffortUnset":"level_"+W)}):g("thinkingModeOff"),Qo=W!==""&&!M.includes(W)?[...M,W]:M,Yt=it(ne),Lt=it(re),_n=Yt!==void 0&&Lt!==void 0&&Lt>Yt,Er=(0,P.jsxs)(P.Fragment,{children:[_n?(0,P.jsxs)("p",{className:"bre-effort-note bre-warn",children:[(0,P.jsx)(on,{paths:sm}),g("capacityRule")]}):null,(0,P.jsxs)("div",{className:"bre-effort-cols",children:[(0,P.jsxs)("div",{className:"bre-effort-sec",children:[(0,P.jsx)("span",{className:"bre-effort-label",children:g("contextWindowLabel")}),(0,P.jsxs)("span",{className:"bre-cap-box",children:[(0,P.jsx)("input",{type:"text",inputMode:"text",className:"bre-cap-input",value:de==="context"?ne:Qe(Yt),disabled:Le,placeholder:g("capacityBlank"),"aria-label":g("contextWindowLabel")+" "+String(f+1),onFocus:()=>{z("context")},onBlur:()=>{Dn("context")},onChange:T=>{Ye("context",T.target.value)}}),(0,P.jsx)("span",{className:"bre-cap-unit",children:g("tokensUnit")})]}),(0,P.jsx)("p",{className:"bre-effort-note",children:g("capacityInherit")})]}),(0,P.jsxs)("div",{className:"bre-effort-sec",children:[(0,P.jsx)("span",{className:"bre-effort-label",children:g("maxTokensLabel")}),(0,P.jsxs)("span",{className:"bre-cap-box",children:[(0,P.jsx)("input",{type:"text",inputMode:"text",className:"bre-cap-input",value:de==="output"?re:Qe(Lt),disabled:Le,placeholder:g("capacityBlank"),"aria-label":g("maxTokensLabel")+" "+String(f+1),onFocus:()=>{z("output")},onBlur:()=>{Dn("output")},onChange:T=>{Ye("output",T.target.value)}}),(0,P.jsx)("span",{className:"bre-cap-unit",children:g("tokensUnit")})]}),(0,P.jsx)("p",{className:"bre-effort-note",children:g("capacityUnitsHint")})]})]})]});return(0,P.jsxs)("div",{className:"bre-effort-editor","data-plugin":we,children:[(0,P.jsxs)("div",{className:"bre-effort-modality",children:[(0,P.jsx)("span",{className:"bre-effort-label",children:g("inputModality")}),(0,P.jsxs)("div",{className:"bre-pillrow",role:"group","aria-label":g("inputModality"),children:[(0,P.jsxs)("button",{type:"button",className:w.declared?"bre-lvl bre-lvl--opt is-on":"bre-lvl bre-lvl--opt",disabled:Le,"aria-pressed":w.declared,"aria-label":g("modalityText")+" "+String(f+1),title:g("modalityText"),onClick:()=>{w.declared?Yo():qe(!1)},children:[(0,P.jsx)(on,{paths:om}),g("modalityText")]}),(0,P.jsxs)("button",{type:"button",className:w.declared&&w.image?"bre-lvl bre-lvl--opt is-on":"bre-lvl bre-lvl--opt",disabled:Le,"aria-pressed":w.declared&&w.image,"aria-label":g("modalityImage")+" "+String(f+1),title:g("modalityImage"),onClick:()=>{qe(!(w.declared&&w.image))},children:[(0,P.jsx)(on,{paths:im}),g("modalityImage")]}),(0,P.jsxs)("button",{type:"button",className:w.imageGen?"bre-lvl bre-lvl--opt is-on":"bre-lvl bre-lvl--opt",disabled:Le,"aria-pressed":w.imageGen,"aria-label":g("modalityImageGen")+" "+String(f+1),title:g("modalityImageGen"),onClick:()=>{Pn(!w.imageGen)},children:[(0,P.jsx)(on,{paths:am}),g("modalityImageGen")]})]}),(0,P.jsx)("p",{className:"bre-effort-note",children:w.imageGen?g("modalityImageGenHint"):w.declared?g("modalityDeclared"):g("modalityInherit")})]}),(0,P.jsxs)("div",{className:"bre-effort-top",children:[(0,P.jsxs)("label",{className:"bre-thinking-switch",children:[(0,P.jsx)("input",{type:"checkbox",checked:K,disabled:Le,"aria-label":g("thinkingMode")+" "+String(f+1),onChange:T=>{Me(T.target.checked)}}),(0,P.jsx)("span",{className:"bre-effort-switch-track","aria-hidden":"true"}),(0,P.jsx)("span",{className:"bre-effort-title",children:g("thinkingMode")})]}),(0,P.jsx)("span",{className:"bre-effort-state",children:kr})]}),K?(0,P.jsxs)(P.Fragment,{children:[i===!1?(0,P.jsx)("p",{className:"bre-effort-note bre-effort-note--top",children:g("reasoningDisabled")}):null,xr===void 0?null:(0,P.jsx)("p",{className:"bre-effort-note bre-effort-note--top",children:g(xr==="thinking-disabled"?"defaultRiskDisabled":"defaultRiskQwen")})]}):null,K?(0,P.jsxs)("div",{className:"bre-effort-card",children:[(0,P.jsxs)("div",{className:"bre-effort-sec",children:[(0,P.jsxs)("div",{className:"bre-effort-labelrow",children:[(0,P.jsx)("span",{className:"bre-effort-label",children:g("levelsLabel")}),(0,P.jsx)("span",{className:"bre-effort-grow"}),(0,P.jsxs)("button",{type:"button",className:"bre-effort-adapt",disabled:Le,onClick:()=>{Vt()},children:[(0,P.jsx)(on,{paths:dm}),g("autoAdapt")]})]}),(0,P.jsx)("div",{className:"bre-pillrow",role:"group","aria-label":g("levelsLabel"),children:xt.map(T=>{let Q=y[T];return(0,P.jsx)("button",{type:"button",className:Q.on?"bre-lvl is-on":"bre-lvl",disabled:Le,"aria-pressed":Q.on,"aria-label":g("level_"+T)+" "+String(f+1),title:g("level_"+T),onClick:()=>{be(T,!Q.on)},children:g("level_"+T)},T)})}),(0,P.jsx)("p",{className:"bre-effort-hint",children:g("levelsHint")}),M.length===0?null:(0,P.jsxs)("button",{type:"button",className:"bre-effort-wiretoggle",disabled:Le,"aria-expanded":_,onClick:()=>{b(!_)},children:[(0,P.jsx)(on,{paths:_?lm:cm}),g(_?"wireHide":"wireShow")]}),M.length===0||!_?null:(0,P.jsxs)("div",{className:"bre-wire",children:[(0,P.jsx)("div",{className:"bre-wire-grid",children:M.map(T=>(0,P.jsxs)(le.Fragment,{children:[(0,P.jsx)("span",{className:"bre-wire-name",children:g("level_"+T)}),(0,P.jsx)("input",{type:"text",className:"bre-effort-wire",value:y[T].wire,disabled:Le,placeholder:g("wirePlaceholder"),"aria-label":g("level_"+T)+" "+g("wireValue"),onChange:Q=>{$t(T,Q.target.value)}})]},T))}),(0,P.jsx)("p",{className:"bre-effort-note",children:g("wireHint")})]})]}),M.length===0?null:(0,P.jsx)("div",{className:"bre-effort-cols",children:(0,P.jsxs)("div",{className:"bre-effort-sec",children:[(0,P.jsx)("span",{className:"bre-effort-label",children:g("defaultEffortLabel")}),(0,P.jsxs)("select",{className:"bre-effort-select",value:W,disabled:Le,"aria-label":g("defaultEffortLabel"),onChange:T=>{Xo(T.target.value)},children:[(0,P.jsx)("option",{value:"",children:g("followMemory")}),Qo.map(T=>(0,P.jsx)("option",{value:T,children:g("level_"+T)},T))]}),(0,P.jsx)("p",{className:"bre-effort-note",children:g("defaultEffortHint")})]})}),m?(0,P.jsx)("p",{className:"bre-effort-note",children:g("stagedHint")}):null,rn(y)===void 0&&i!==void 0?(0,P.jsx)("p",{className:"bre-effort-note",children:g("bareHint")}):null,(0,P.jsx)("span",{className:"bre-effort-sep"}),Er,S===void 0?null:(0,P.jsx)("p",{className:"bre-effort-message bre-"+S.kind,role:S.kind==="error"?"alert":"status",children:S.text}),(0,P.jsx)("div",{className:"bre-effort-actions",children:(0,P.jsx)("button",{type:"button",className:"bre-secondary-button",disabled:Le||!ue,onClick:Jo,children:g("reset")})})]}):(0,P.jsxs)("div",{className:"bre-effort-card bre-effort-card--capacity",children:[Er,S===void 0?null:(0,P.jsx)("p",{className:"bre-effort-message bre-"+S.kind,role:S.kind==="error"?"alert":"status",children:S.text})]})]})}function se(e,t,n){e.getAttribute(t)!==n&&e.setAttribute(t,n)}function tt(e,t){e!==void 0&&e.hidden!==t&&(e.hidden=t)}function Se(e,t,n){e.classList.contains(t)!==n&&(n?e.classList.add(t):e.classList.remove(t))}function Vn(e,t){e!==void 0&&e.textContent!==t&&(e.textContent=t)}var kt="data-bre-auto-effort",Oi='[class*="modelCatalog"]',um='[class*="modelListHead"]',fm='button[class*="linkButton"]',pm="bre-auto-effort",mm="bre-auto-effort-note",gm="data-bre-auto-effort-phase",bd="bre-auto-effort-note-text",yd="bre-auto-effort-note-detail",hm=3e3;function bm(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 _i(e){return Array.from(e.querySelectorAll(Oi)).filter(t=>(t.parentElement?.closest(Oi)??null)===null)}function Qr(e,t,n){let r=new Map;for(let s of t)s.route.length!==0&&s.catalogue.isConnected&&r.set(s.catalogue,s.route);let o=n.t("autoAdaptAll");for(let[s,d]of r){let l=s.querySelector(um)??s,c=l.querySelector(`[${kt}]`)??wm();vd.set(c,n);let f=ym(l);f!==null?f.nextElementSibling!==c&&f.after(c):l.lastElementChild!==c&&l.append(c),Em(c,d,o)}let i=new Set,a=new Set(r.values());for(let s of Array.from(e.querySelectorAll(`[${kt}]`))){let d=s.closest(Oi),l=s.getAttribute(kt)??"";if(d===null||!r.has(d)||i.has(d)){s.remove(),l.length>0&&!a.has(l)&&Fi(l);continue}i.add(d)}}function Fi(e){let t=Dt.get(e);t!==void 0&&(t.timer!==null&&clearTimeout(t.timer),t.note.remove(),Dt.delete(e))}function wd(){for(let e of Array.from(document.querySelectorAll(`[${kt}]`)))e.remove();for(let e of Dt.values())e.timer!==null&&clearTimeout(e.timer),e.note.remove();Dt.clear()}function ym(e){let t=Array.from(e.querySelectorAll(fm));return t.length===0?null:t[t.length-1]}function wm(){let e=document.createElement("button");return e.className=pm,e.setAttribute("type","button"),e.setAttribute(kt,""),e.addEventListener("click",()=>{let t=e.getAttribute(kt)??"";if(t.length===0)return;let n=vd.get(e);n!==void 0&&(md(t),vm(t,n))}),e}async function vm(e,t){if(t.onRequest===void 0)return;hd(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){Fi(e);return}let r=bm(n);r!==null&&hd(e,r,t,hm)}function hd(e,t,n,r){let o=Dt.get(e);o!==void 0&&!o.note.isConnected&&(o.timer!==null&&clearTimeout(o.timer),Dt.delete(e),o=void 0),o!==void 0&&o.timer!==null&&clearTimeout(o.timer);let i=o?.note??xm();i.setAttribute(gm,t.phase);let a=i.querySelector(`.${bd}`),s=i.querySelector(`.${yd}`),d=km(t,n);a.textContent!==d.text&&(a.textContent=d.text),s.textContent!==d.detail&&(s.textContent=d.detail),tt(s,d.detail.length===0),o===void 0&&document.body.append(i);let l=r>0?setTimeout(()=>{Fi(e)},r):null;i.style.setProperty("--bre-note-hold",`${r}ms`),Dt.set(e,{note:i,timer:l})}function xm(){let e=document.createElement("div");return e.className=mm,e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.innerHTML=`<span class="${bd}"></span><span class="${yd}"></span>`,e}var vd=new WeakMap,Dt=new Map;function km(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 Em(e,t,n){e.getAttribute(kt)!==t&&e.setAttribute(kt,t),e.textContent!==n&&(e.textContent=n),e.getAttribute("title")!==null&&e.removeAttribute("title")}var Yn="data-bre-drag-handle",Bi="data-bre-row-head",Ki="data-bre-drop-side",Zr="bre-row-dragging",eo="bre-row-drop-target",Md="bre-drag-ghost",Ld="bre-drop-line",xd="http://www.w3.org/2000/svg",kd=8,Ed=28,Td=12,Tm="transform 180ms cubic-bezier(0.2, 0.7, 0.3, 1)",Sm='button, a, input, textarea, select, [contenteditable], [role="button"], [role="switch"], [role="checkbox"], [role="textbox"], [role="combobox"]';function to(){return{sources:new WeakSet,lists:new WeakSet,line:void 0,sighted:new WeakMap,drag:void 0}}function He(e){return Array.from(e.children).filter(t=>t instanceof HTMLElement)}function Mm(e,t){let n=e.style.order;if(n==="")return t;let r=Number.parseInt(n,10);return Number.isNaN(r)?t:r}function Ot(e){return He(e).map((t,n)=>({row:t,key:Mm(t,n),index:n})).sort((t,n)=>t.key-n.key||t.index-n.index).map(t=>t.row)}function Ad(e,t){let n=e.filter(a=>t.includes(a)),r=n.map(a=>e.indexOf(a)),o=t.filter(a=>n.includes(a)),i=new Map;e.forEach((a,s)=>i.set(a,s)),r.forEach((a,s)=>{let d=o[s];d!==void 0&&i.set(d,a)});for(let[a,s]of i){let d=String(s);a.style.order!==d&&(a.style.order=d)}}function no(e,t){Ad(Ot(e),t)}function qi(e,t){let n=He(e),r=n.map(o=>o.offsetTop);t(),n.forEach((o,i)=>{let a=r[i]-o.offsetTop;a!==0&&(o.style.transition="none",o.style.transform=`translateY(${a}px)`,o.offsetHeight,o.style.transition=Tm,o.style.transform="")})}function Xn(e,t){return Ot(e).map(n=>t(n)).filter(n=>n!==void 0)}function Lm(e,t,n){let r=Xn(e,t);if(n===void 0||!Am(e,n))return r;let o=new Map;return n.ids.forEach((i,a)=>{o.has(i)||o.set(i,a)}),r.map((i,a)=>({id:i,key:o.get(i)??n.ids.length+a})).sort((i,a)=>i.key-a.key).map(i=>i.id)}function Am(e,t){return t.rows.some(n=>!e.contains(n))}function Rm(e,t){let n=[];for(let o of Ot(e)){let i=t(o);i!==void 0&&n.push(i)}let r=[];for(let o of He(e))t(o)!==void 0&&r.push(o);return{ids:n,rows:r}}function Rd(e,t,n){let r=new Map;for(let[s,d]of t.entries())r.has(d)||r.set(d,s);let o=He(e),a=[...o.filter(s=>n(s)!==void 0)].sort((s,d)=>{let l=r.get(n(s))??Number.MAX_SAFE_INTEGER,c=r.get(n(d))??Number.MAX_SAFE_INTEGER;return l-c});Ad(o,a)}function ro(e){for(let t of e)t.style.order="",t.style.transition="",t.style.transform=""}function Hd(e,t,n,r){let i=e.filter(a=>a!==t).indexOf(n);return i<0?Math.max(0,e.indexOf(t)):r?i+1:i}function Cd(e,t){let n,r=Number.POSITIVE_INFINITY;for(let o of e){let i=o.getBoundingClientRect(),a=t<i.top?i.top-t:t>i.bottom?t-i.bottom:0;a<r&&(r=a,n=o)}return n}function Hm(e,t){let n=e.getBoundingClientRect();return n.height<=0?!0:t>n.top+n.height/2}function Nd(e,t){let n=e.getBoundingClientRect();return t?n.bottom+kd/2-1:n.top-kd/2-1}function Id(){let e=document.createElementNS(xd,"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(xd,"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 Pd(e,t){let n=document.createElement("div");n.className=Md,n.setAttribute("aria-hidden","true"),n.appendChild(Id());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 Cm(e){return!(e instanceof Element)||e.closest(`[${Yn}]`)!==null?!1:e.closest(Sm)!==null}function Dd(e){return e.parentElement??void 0}function Od(e){for(let t of He(e))t.classList.remove(eo),t.removeAttribute(Ki)}function oo(e){let t=e.parentElement;for(;t!==null;){if(Bd(t))return t;t=t.parentElement}let n=document.scrollingElement;return n instanceof HTMLElement&&n.scrollHeight>n.clientHeight?n:void 0}function _d(e){let t=[],n=e.parentElement;for(;n!==null;)Bd(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 Gi(e){let t=[],n=e.parentElement;for(;n!==null;)Fd(n)&&t.push(n),n=n.parentElement;let r=document.scrollingElement;return r instanceof HTMLElement&&!t.includes(r)&&t.push(r),t}function Fd(e){let t=e.style.overflowY,n=t.length>0?t:window.getComputedStyle(e).overflowY;return n==="auto"||n==="scroll"||n==="overlay"}function Bd(e){return e.scrollHeight>e.clientHeight&&Fd(e)}function Kd(e,t){let n=e.getBoundingClientRect();return n.height<=0?0:t<n.top+Ed?-Td:t>n.bottom-Ed?Td:0}function qd(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 Nm(e){let t=e.line;if(t!==void 0&&t.isConnected)return t;let n=document.createElement("div");return n.className=Ld,n.setAttribute("aria-hidden","true"),document.body.appendChild(n),e.line=n,n}function Im(e,t,n){let r=Nm(e),o=t.getBoundingClientRect();r.style.top=`${Nd(t,n)}px`,r.style.left=`${o.left}px`,r.style.width=`${o.width}px`,r.style.display="block",r.setAttribute(Ki,n?"after":"before")}function Pm(e){e.line!==void 0&&(e.line.style.display="none")}function Dm(e){let t=e.drag;e.drag=void 0,t!==void 0&&(qd(e,t,0),Pm(e),t.row.classList.remove(Zr),Od(t.list),t.dropped||qi(t.list,()=>{no(t.list,t.before)}))}function Om(e,t,n,r){if(Cm(t.target)){t.preventDefault();return}let o=Dd(e),i=n.idOf(e);if(o===void 0||i===void 0){t.preventDefault();return}let a={row:e,list:o,before:Ot(o),scroller:oo(o),adapter:n,scrollStep:0,frame:void 0,dropped:!1};r.drag=a,e.classList.add(Zr);let s=Pd(e,n.labelOf(e));Number.isFinite(t.clientX)&&Number.isFinite(t.clientY)&&(s.style.left=`${t.clientX}px`,s.style.top=`${t.clientY}px`),document.body.appendChild(s);let d=t.dataTransfer;if(d!=null)try{d.effectAllowed="move",d.setData("text/plain",i),d.setDragImage(s,Math.round(s.offsetWidth/2),Math.round(s.offsetHeight/2))}catch{}window.setTimeout(()=>{s.remove()},0)}function _m(e,t,n){let r=n.drag;if(r===void 0||r.list!==e)return;let o=t.target,i=o instanceof Element?r.adapter.rowOf(o,e):void 0,a=Ot(e),s=i!==void 0&&a.includes(i)?i:Cd(a,t.clientY);if(s===void 0)return;t.preventDefault();let d=t.dataTransfer;d!=null&&(d.dropEffect="move");let l=Hm(s,t.clientY),c=Hd(a,r.row,s,l);c!==a.indexOf(r.row)&&qi(e,()=>{no(e,ai(a,r.row,c))}),Od(e),s.classList.add(eo),s.setAttribute(Ki,l?"after":"before"),Im(n,s,l),qd(n,r,r.scroller===void 0?0:Kd(r.scroller,t.clientY))}function Fm(e,t){t.lists.has(e)||(t.lists.add(e),e.addEventListener("dragover",n=>{_m(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 Bm(e,t,n,r){r.sources.has(e)||(r.sources.add(e),n.seatDrags&&(e.setAttribute(Bi,"1"),e.setAttribute("draggable","true")),e.addEventListener("dragstart",o=>{Om(t,o,n,r)}),e.addEventListener("dragend",()=>{Dm(r)}))}function Km(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=Dd(t);if(i===void 0)return;let a=Ot(i),s=a.indexOf(t);if(s<0)return;let d=s+(o.key==="ArrowUp"?-1:1);d<0||d>=a.length||(o.preventDefault(),qi(i,()=>{no(i,ai(a,t,d))}),n.commit(i),e.focus())})}function Sd(e,t,n,r){let o=r.gripLabel(t,n),i=r.gripHint();e.getAttribute(Yn)!==n&&e.setAttribute(Yn,n),e.getAttribute("aria-label")!==o&&e.setAttribute("aria-label",o),e.getAttribute("title")!==i&&e.setAttribute("title",i)}function qm(e,t,n,r,o){let i=t.querySelector(`[${Yn}]`);if(i!==null){Sd(i,e,n,r);return}r.decorate?.(e,t);let a=document.createElement("span");a.className="bre-drag-grip",a.setAttribute("role","button"),a.setAttribute("tabindex","0"),a.setAttribute("draggable","true"),a.appendChild(Id()),Sd(a,e,n,r),Km(a,e,r,o),Bm(r.seatDrags?t:a,e,r,o),t.insertBefore(a,t.firstChild)}function io(e,t,n,r){if(!e.isConnected)return;Fm(t,r);for(let i of He(t)){let a=n.idOf(i);if(a===void 0)continue;let s=n.seatOf(i);s!==void 0&&qm(i,s,a,n,r)}if(r.drag!==void 0)return;let o=Lm(t,n.idOf,r.sighted.get(t));Rd(t,n.order(o),n.idOf),r.sighted.set(t,Rm(t,n.idOf))}function ao(e){e.drag=void 0;for(let t of Array.from(document.querySelectorAll(`[${Yn}]`)))t.remove();for(let t of Array.from(document.querySelectorAll(`[${Bi}]`)))t.removeAttribute(Bi),t.removeAttribute("draggable");for(let t of Array.from(document.querySelectorAll(`.${Zr}, .${eo}`)))t.classList.remove(Zr,eo);for(let t of Array.from(document.querySelectorAll(`.${Ld}`)))t.remove();for(let t of Array.from(document.querySelectorAll(`.${Md}`)))t.remove();e.line=void 0}var Gd=["openai","anthropic"];function so(e){return e==="anthropic-messages"?"anthropic":"openai"}function Wd(e){return e==="openai-completions"||e==="anthropic-messages"||e==="openai-responses"}var Gm=40;function zd(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,Gm)}function ut(e){return typeof e=="string"&&/^[\x21-\x7E]+$/.test(e)}var Wm=12;function Ud(e){return e.length===0?"":e.length<Wm?"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022":`${e.slice(0,4)}...${e.slice(-4)}`}function jd(e){for(let t of["error","message"]){let n=e[t];if(typeof n=="string"&&n.length>0)return n}}function Wi(e){if(!Array.isArray(e))return;let t=[];for(let n of e)typeof n=="string"&&n.length>0&&t.push(n);return t}function zm(e){if(!G(e))return;let t=e.ref;if(typeof t!="string"||t.length===0)return;let n=e.alias,r=e.configured,o=e.masked,i=Wi(e.models),a=Wi(e.observed),s=e.protocol,d=e.auto,l=e.rest,c=G(l)&&typeof l.remainingMs=="number"?l.remainingMs:void 0,f=G(l)&&typeof l.failures=="number"?l.failures:void 0;return{ref:t,...typeof n=="string"&&n.length>0?{alias:n}:{},enabled:e.enabled!==!1,configured:typeof r=="boolean"?r:null,...typeof o=="string"&&o.length>0?{masked:o}:{},...i===void 0?{}:{models:i},...a===void 0||a.length===0?{}:{observed:a},...Wd(s)?{protocol:s}:{},...d===!0?{auto:!0}:{},...c!==void 0&&c>=0&&f!==void 0?{rest:{remainingMs:c,failures:f}}:{}}}function Um(e){let t=e.entries;if(!Array.isArray(t))return;let n=[];for(let l of t){let c=zm(l);c!==void 0&&n.push(c)}let r=e.addedRef,o=e.route,i=Wi(e.models),a=e.endpoints,s=G(a)&&typeof a.openai=="string"?a.openai:null,d=G(a)&&typeof a.anthropic=="string"?a.anthropic:null;return{ok:!0,route:typeof o=="string"?o:"",entries:n,...typeof r=="string"&&n.some(l=>l.ref===r)?{addedRef:r}:{},...i===void 0?{}:{models:i},...e.probing===!0?{probing:!0}:{},endpoints:{openai:s,anthropic:d}}}async function jm(e){let t;try{t=await e.json()}catch{t=void 0}if(!G(t))return{ok:!1};if(t.ok===!0){let r=Um(t);if(r!==void 0)return r}let n=jd(t);return n===void 0?{ok:!1}:{ok:!1,error:n}}async function $d(e,t){let n=`${Mr}?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 jm(r)}catch{return{ok:!1}}}var an=new Map,$m=64;function Vd(e){let t=an.get(e);if(t!==void 0)return t;if(an.size>=$m){let r=an.keys().next().value;r!==void 0&&an.delete(r)}let n={updatedAt:0,revision:0};return an.set(e,n),n}function Vm(e){return an.get(e)?.state}function Ym(e){let t=Vd(e);if(t.read!==void 0)return t.read;let n=t.revision,r=$d(e).then(o=>t.revision!==n?t.state??o:(o.ok&&(t.state=o,t.updatedAt=Date.now()),o)).finally(()=>{t.read===r&&(t.read=void 0)});return t.read=r,r}async function ft(e,t){let n=Vd(e),r=++n.revision;n.read=void 0;let o=await $d(e,t);return o.ok&&n.revision===r&&(n.revision+=1,n.read=void 0,n.state=o,n.updatedAt=Date.now()),o}async function Xm(e){try{let t=await fetch(`${Mr}?route=${encodeURIComponent(e)}&op=endpoints`,{method:"GET",cache:"no-store",credentials:"same-origin"});if(!t.ok)return{ok:!1};let n=await t.json().catch(()=>{});if(!G(n)||n.ok!==!0)return{ok:!1};let r=n.endpoints;return G(r)?{ok:!0,endpoints:{openai:typeof r.openai=="string"?r.openai:null,anthropic:typeof r.anthropic=="string"?r.anthropic:null}}:{ok:!0}}catch{return{ok:!1}}}async function Jm(e){try{let n=await(await fetch(`${Mr}?route=${encodeURIComponent(e)}&op=balance`,{method:"GET",cache:"no-store",credentials:"same-origin"})).json().catch(()=>{});if(!G(n)||n.ok!==!0){let o=G(n)?jd(n):void 0;return o===void 0?{ok:!1}:{ok:!1,error:o}}let r=n.endpoint;return{ok:!0,endpoint:typeof r=="string"&&r.length>0?r:null}}catch{return{ok:!1}}}var Pe={list:Ym,endpoints:Xm,balanceEndpoint:Jm,cached:Vm,add:(e,t,n)=>ft(e,{op:"add",value:t,...n===void 0?{}:{alias:n}}),rename:(e,t,n)=>ft(e,{op:"rename",ref:t,...n===void 0?{}:{alias:n}}),remove:(e,t)=>ft(e,{op:"remove",ref:t}),replace:(e,t,n)=>ft(e,{op:"value",ref:t,value:n}),setScope:(e,t,n)=>ft(e,{op:"scope",ref:t,...n===void 0?{}:{models:n}}),setEnabled:(e,t,n)=>ft(e,{op:"enable",ref:t,enabled:n}),setProtocol:(e,t,n)=>ft(e,{op:"protocol",ref:t,...n===void 0?{}:{protocol:n}}),setEndpoints:(e,t,n)=>ft(e,{op:"endpoints",openai:t??"",anthropic:n??""}),setBalanceEndpoint:(e,t)=>ft(e,{op:"balance",endpoint:t}),async reveal(e,t){try{let n=await fetch(`${Sr}?route=${encodeURIComponent(e)}&ref=${encodeURIComponent(t)}`,{method:"GET",cache:"no-store",credentials:"same-origin"});if(!n.ok)return;let r=await n.json();if(!G(r)||r.ok!==!0)return;let o=r.key;return typeof o=="string"&&o.length>0?o:void 0}catch{return}}};var sn="data-bre-endpoint-rows",pt="data-bre-endpoint-row",fn="data-bre-balance-row",co="data-bre-endpoint-family",Yd="data-bre-endpoint-filled",uo="data-bre-endpoint-field",fo="data-bre-endpoint-title",ln="data-bre-endpoint-toggle",el="data-bre-endpoint-count",po="data-bre-field-order",Jn="data-bre-endpoint-serving",Xd="data-bre-protocol-watch",Jd=new WeakSet,Qd="data-bre-row-provider",Ui="data-bre-protocol-cards",cn="data-bre-protocol-value",ji="data-bre-protocol-source";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)return r}}function un(e,t){let n=Ue(e,t);if(n===void 0)return;let r=n.closest("label");return r!==null&&r.parentElement!==null?r:n.parentElement??void 0}function zi(e,t){let n=e;for(;n!==null&&n.parentElement!==t;)n=n.parentElement;return n===null||n===t?void 0:n}function Qm(e,t,n){for(let r=t.parentElement;r!==null;r=r.parentElement){if(!r.contains(n)||e!==void 0&&!r.contains(e))continue;let o=zi(t,r),i=zi(n,r);if(o===void 0||i===void 0||o===i)continue;let a=e===void 0?void 0:zi(e,r);return{container:r,protocol:o,url:i,name:a}}}function tl(e,t){let n=Ue(e,t);return n instanceof HTMLSelectElement||n instanceof HTMLInputElement?n.value.trim():""}function Zm(e,t){let n=tl(e,t.apiProtocol);return n==="anthropic-messages"||n==="openai-completions"||n==="openai-responses"?n:void 0}function at(e,t){let n=Zm(e,t);return n===void 0?void 0:so(n)}function Ft(e,t){let n=tl(e,t.routeId);return n.length>0?n:(e.closest(`[${Qd}]`)?.getAttribute(Qd)??"").trim()}function nl(e,t){return e==="anthropic"?t("keysEndpointAnthropic"):e==="openai"?t("keysEndpointOpenAI"):""}function eg(e,t){let n=Ue(e,t.modelName),r=Ue(e,t.apiProtocol),o=Ue(e,t.baseUrl);if(r===void 0||o===void 0)return;let i=Qm(n,r,o);if(i===void 0)return;let{container:a,protocol:s,url:d,name:l}=i,c=m=>Array.from(a.children).indexOf(m);if((l===void 0||c(l)<c(s))&&c(s)<c(d)){e.setAttribute(po,"1");return}a.insertBefore(s,d),l!==void 0&&a.insertBefore(l,s),e.setAttribute(po,"1")}function rl(e,t){for(let n of Array.from(e.children))if(!(n===t||n.contains(t))&&!n.hasAttribute(co)&&!n.hasAttribute(ln)&&n instanceof HTMLElement&&(n.textContent??"").trim().length>0)return n}function _t(e,t){let n=t?"1":"0";e.getAttribute(Yd)!==n&&e.setAttribute(Yd,n)}function tg(e,t,n){let r=rl(e,t);if(!n){e.removeAttribute(uo),r?.removeAttribute(fo);return}e.setAttribute(uo,"1"),r?.setAttribute(fo,"1")}function ol(e,t,n){let r=Ue(e,t.baseUrl);if(r===void 0)return;let o=un(e,t.baseUrl);if(o===void 0)return;let i=nl(at(e,t),n),a=o.querySelector(`[${co}]`);if(a===null&&i.length>0){a=document.createElement("span"),a.setAttribute(co,"1"),a.className="bre-endpoint-family";let d=r.closest("label");d!==null&&d.contains(r)?d.insertBefore(a,r):o.insertBefore(a,r)}a!==null&&(a.textContent!==i&&(a.textContent=i),tt(a,i.length===0),_t(a,r instanceof HTMLInputElement&&r.value.trim().length>0)),tg(o,r,a!==null&&i.length>0);let s=at(e,t);s===void 0?o.removeAttribute(Jn):o.setAttribute(Jn,s)}function ng(e,t){let n=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"value")?.set;n===void 0?e.value=t:n.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function il(e,t){for(let n of Array.from(t.querySelectorAll(`[${cn}]`))){let r=n.getAttribute(cn)===e.value;n.classList.toggle("is-selected",r),n.setAttribute("aria-checked",r?"true":"false"),n.tabIndex=r?0:-1}}function rg(e,t,n){let r=Array.from(t.querySelectorAll(`[${cn}]`)),o=Array.from(e.options).filter(i=>i.value.length>0);return r.length!==o.length?!1:o.every((i,a)=>{let s=r[a];return s!==void 0&&s.getAttribute(cn)===i.value&&(s.textContent??"")===al(i.value,(i.textContent??i.value).trim(),n.t)})}function al(e,t,n){return e==="openai-completions"?n("keysProtocolShortChat"):e==="openai-responses"?n("keysProtocolShortResponses"):e==="anthropic-messages"?n("keysProtocolShortAnthropic"):t}function Zd(e,t,n){t.replaceChildren();for(let r of Array.from(e.options)){let o=r.value;if(o.length===0)continue;let i=document.createElement("button");i.type="button",i.className="bre-protocol-card",i.setAttribute("role","radio"),i.setAttribute(cn,o),i.textContent=al(o,(r.textContent??o).trim(),n.t),i.title=(r.textContent??o).trim(),i.addEventListener("click",()=>{e.value!==o&&(ng(e,o),il(e,t))}),t.appendChild(i)}}function og(e,t,n){let r=Ue(e,t.apiProtocol);if(!(r instanceof HTMLSelectElement))return;let o=un(e,t.apiProtocol);if(o===void 0)return;let i=o.querySelector(`[${Ui}]`);if(i===null){let a=document.createElement("div");i=a,a.setAttribute(Ui,"1"),a.className="bre-protocol-cards",a.setAttribute("role","radiogroup");let s=r.getAttribute("aria-label");s!==null&&a.setAttribute("aria-label",s),r.setAttribute(ji,"1"),r.after(a),Zd(r,a,n),a.addEventListener("keydown",d=>{let l=d.key==="ArrowRight"||d.key==="ArrowDown"?1:d.key==="ArrowLeft"||d.key==="ArrowUp"?-1:0,c=Array.from(a.querySelectorAll(`[${cn}]`));if(c.length===0)return;if(d.key==="Home"||d.key==="End"){d.preventDefault();let u=d.key==="Home"?c[0]:c[c.length-1];u?.click(),u?.focus();return}if(l===0)return;d.preventDefault();let f=c.findIndex(u=>u.classList.contains("is-selected")),m=c[(Math.max(f,0)+l+c.length)%c.length];m?.click(),m?.focus()})}else rg(r,i,n)||Zd(r,i,n);tt(r,!0),il(r,i)}function $i(e,t,n){let r=e===null?0:e.querySelectorAll(`[${pt}], [${fn}]`).length,o=r===0?"":n.t("keysEndpointsCount",{count:r});if(o.length===0){t.hasAttribute("title")&&t.removeAttribute("title");return}t.getAttribute("title")!==o&&t.setAttribute("title",o)}function ig(e,t,n){let r=e.querySelector(`[${ln}]`);if(un(e,t.apiProtocol)===void 0){r?.remove(),e.querySelector(`[${el}]`)?.remove();return}let o=un(e,t.baseUrl);if(o===void 0)return;let i=Ue(e,t.baseUrl);if(i===void 0)return;let a=rl(o,i);if(a===void 0||a===r)return;let s=()=>e.querySelector(`[${sn}]`),d=c=>{let f=n.t("keysMoreEndpoints");c.textContent!==f&&(c.textContent=f);let m=s();c.setAttribute("aria-expanded",m!==null&&!m.hidden?"true":"false"),$i(m,c,n)};if(r!==null){r.parentElement!==a&&a.append(r),d(r);return}let l=document.createElement("button");l.type="button",l.setAttribute(ln,"1"),l.className="bre-endpoint-toggle",l.textContent=n.t("keysMoreEndpoints"),l.addEventListener("click",()=>{let c=s();if(c!==null&&(c.hidden=!c.hidden,d(l),!c.hidden)){let f=Ft(e,t);f.length>0&&dg(c,f,n,e,t)}}),a.append(l),d(l)}var dn=new WeakMap,sl=1e3,mo=new WeakMap,pn=0,lo=new Map;function ag(e,t){pn+=1,typeof CustomEvent=="function"&&document.dispatchEvent(new CustomEvent(Kn,{detail:{route:e,openai:t.openai??"",anthropic:t.anthropic??""}}))}function sg(e,t){pn+=1,typeof CustomEvent=="function"&&document.dispatchEvent(new CustomEvent(Gn,{detail:{route:e,endpoint:t}}))}function Qn(e){let t=e.getAttribute(pt);return t==="openai"||t==="anthropic"?t:void 0}async function dg(e,t,n,r,o){for(let i of Array.from(e.querySelectorAll(`[${pt}], [${fn}]`)))await dl(i,t,n,r,o)}async function dl(e,t,n,r,o){let i=e.querySelector(".bre-endpoint-url");if(i===null)return;if(e.hasAttribute(fn)){await ll(e,i,t,n);return}let a=Qn(e);if(a===void 0)return;let s=(dn.get(e)??0)+1;dn.set(e,s),mo.set(e,{at:Date.now(),epoch:pn});let d=n.client??Pe,l=await go(t,d);if(l===void 0||dn.get(e)!==s||Qn(e)!==a||document.activeElement===i)return;await cl(r,o,n,t,at(r,o),l);let c=l[a];i.value!==c&&(i.value=c);let f=e.querySelector(".bre-endpoint-family");f!==null&&_t(f,c.length>0)}async function ll(e,t,n,r){let o=(dn.get(e)??0)+1;dn.set(e,o),mo.set(e,{at:Date.now(),epoch:pn});let i=r.client??Pe;if(i.balanceEndpoint===void 0)return;let a=await i.balanceEndpoint(n);if(!a.ok||dn.get(e)!==o||document.activeElement===t)return;let s=a.endpoint??"";t.value!==s&&(t.value=s);let d=e.querySelector(".bre-endpoint-family");d!==null&&_t(d,s.length>0)}async function cl(e,t,n,r,o,i,a=!1){if(o===void 0||!a&&i[o].length>0)return;let s=Ue(e,t.baseUrl);if(!(s instanceof HTMLInputElement)||document.activeElement===s)return;let d=s.value.trim();if(d.length===0&&!a)return;let l=n.client??Pe;await Yi(r,l,c=>{if(!(!a&&c[o].length>0)&&c[o]!==d)return{openai:o==="openai"?d:c.openai,anthropic:o==="anthropic"?d:c.anthropic}})}function Vi(e,t,n){let r=un(e,t.baseUrl);if(r===void 0||r.parentElement===null)return;let o=at(e,t);if(o===void 0)return;let i=r.querySelector(`:scope > [${sn}]`);i===null&&(i=e.querySelector(`[${sn}]`),i!==null&&r.appendChild(i)),i===null&&(i=document.createElement("div"),i.setAttribute(sn,"1"),i.hidden=!0,r.appendChild(i));let a=Gd.filter(f=>f!==o),s=Array.from(i.children).filter(f=>f instanceof HTMLElement&&f.hasAttribute(pt));if(!(a.length===s.length&&a.every((f,m)=>Qn(s[m])===f)))for(let f of a){let m=i.querySelector(`[${pt}="${f}"]`);m===null&&(m=lg(e,t,n,f)),i.appendChild(m)}for(let f of Array.from(i.querySelectorAll(`[${pt}]`))){let m=Qn(f);m!==void 0&&m!==o||f.remove()}let l=e.querySelector(`[${ln}]`);l!==null&&(l.setAttribute("aria-expanded",i.hidden?"false":"true"),$i(i,l,n));let c=Ft(e,t);if(c.length>0)for(let f of Array.from(i.querySelectorAll(`[${pt}]`))){let m=mo.get(f);(m===void 0||m.epoch!==pn||Date.now()-m.at>=sl)&&dl(f,c,n,e,t)}}function lg(e,t,n,r){let o=document.createElement("div");o.setAttribute(pt,r),o.className="bre-endpoint-row";let i=document.createElement("span");i.className="bre-endpoint-family",i.textContent=nl(r,n.t),_t(i,!1);let a=document.createElement("input");a.type="url",a.className="bre-text-input bre-endpoint-url",a.spellcheck=!1,a.placeholder="https://\u2026";let s=n.client??Pe;return a.addEventListener("change",()=>{let d=Ft(e,t);if(d.length===0)return;let l=a.value.trim();if(l.length>0&&!/^https?:\/\//i.test(l)){a.setAttribute("aria-invalid","true"),a.title=n.t("keysEndpointInvalid");return}a.hasAttribute("aria-invalid")&&a.removeAttribute("aria-invalid"),a.hasAttribute("title")&&a.removeAttribute("title"),_t(i,l.length>0),(async()=>await Yi(d,s,c=>{let f=Qn(o);if(f!==void 0)return{openai:f==="openai"?l:c.openai,anthropic:f==="anthropic"?l:c.anthropic}}))()}),o.append(i,a),o}function ul(e,t,n){let r=e.querySelector(`[${sn}]`),o=e.querySelector(`[${fn}]`),i=Ft(e,t);if(r===null||i.length===0){o?.remove();return}let a=o;a===null&&(a=cg(e,t,n)),r.lastElementChild!==a&&r.appendChild(a);let s=e.querySelector(`[${ln}]`);s!==null&&$i(r,s,n);let d=mo.get(a);if(d===void 0||d.epoch!==pn||Date.now()-d.at>=sl){let l=a.querySelector(".bre-endpoint-url");l!==null&&ll(a,l,i,n)}}function cg(e,t,n){let r=document.createElement("div");r.setAttribute(fn,"1"),r.className="bre-endpoint-row bre-balance-row";let o=document.createElement("span");o.className="bre-endpoint-family",o.textContent=n.t("keysEndpointBalance"),_t(o,!1);let i=document.createElement("input");i.type="url",i.className="bre-text-input bre-endpoint-url",i.spellcheck=!1,i.placeholder="https://\u2026",i.setAttribute("aria-label",n.t("keysEndpointBalance")),i.title=n.t("keysEndpointBalanceHint");let a=n.client??Pe,s=a.setBalanceEndpoint;return i.addEventListener("change",()=>{let d=Ft(e,t);if(d.length===0)return;let l=i.value.trim();if(l.length>0&&!/^https?:\/\//i.test(l)){i.setAttribute("aria-invalid","true"),i.title=n.t("keysEndpointInvalid");return}i.hasAttribute("aria-invalid")&&i.removeAttribute("aria-invalid"),i.title=n.t("keysEndpointBalanceHint"),_t(o,l.length>0),s!==void 0&&(async()=>(await s.call(a,d,l)).ok&&sg(d,l))()}),r.append(o,i),r}async function ug(e,t,n,r,o){let i=Ft(e,t),a=Ue(e,t.baseUrl);if(i.length===0||!(a instanceof HTMLInputElement))return;let s=n.client??Pe,d=await go(i,s);if(d===void 0||at(e,t)!==o)return;let l=a.value.trim();if(l.length>0&&l!==d[r]){let m=await Yi(i,s,u=>{if(at(e,t)===o)return{openai:r==="openai"?l:u.openai,anthropic:r==="anthropic"?l:u.anthropic}});if(m===void 0||(d=m,at(e,t)!==o))return}let c=d[o];if(a.value===c)return;let f=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set;f===void 0?a.value=c:f.call(a,c),a.dispatchEvent(new Event("input",{bubbles:!0})),a.dispatchEvent(new Event("change",{bubbles:!0})),Vi(e,t,n)}async function Yi(e,t,n){let o=(lo.get(e)??Promise.resolve()).then(async()=>{let i=await go(e,t);if(i===void 0)return;let a=n(i);if(a===void 0)return;let s=t.setEndpoints;if(typeof s!="function")return;let d=await s.call(t,e,a.openai,a.anthropic);if(!d.ok)return;let l={openai:d.endpoints.openai??"",anthropic:d.endpoints.anthropic??""};return ag(e,d.endpoints),l});lo.set(e,o);try{return await o}finally{lo.get(e)===o&&lo.delete(e)}}async function go(e,t){if(t.endpoints!==void 0){let r=await t.endpoints(e);return r.ok?{openai:r.endpoints?.openai??"",anthropic:r.endpoints?.anthropic??""}:void 0}let n=await t.list(e);if(n.ok)return{openai:n.endpoints.openai??"",anthropic:n.endpoints.anthropic??""}}function fg(e,t,n){let r=un(e,t.baseUrl),o=at(e,t),i=r?.getAttribute(Jn);ol(e,t,n.t),Vi(e,t,n),ul(e,t,n),!(r===void 0||i===void 0||o===void 0)&&i!==o&&(i!=="openai"&&i!=="anthropic"||ug(e,t,n,i,o))}function fl(e,t,n){eg(e,t),og(e,t,n),ol(e,t,n.t),ig(e,t,n),Vi(e,t,n),ul(e,t,n);let r=Ue(e,t.apiProtocol);r instanceof HTMLSelectElement&&!r.hasAttribute(Xd)&&(r.setAttribute(Xd,"1"),r.addEventListener("change",()=>fg(e,t,n)));let o=Ue(e,t.baseUrl);o instanceof HTMLInputElement&&!Jd.has(o)&&(Jd.add(o),o.addEventListener("change",()=>{let i=Ft(e,t),a=at(e,t);if(i.length===0||a===void 0)return;let s=n.client??Pe;(async()=>{let d=await go(i,s);d!==void 0&&at(e,t)===a&&await cl(e,t,n,i,a,d,!0)})()}))}function pg(){for(let e of Array.from(document.querySelectorAll(`select[${ji}]`)))e.hidden=!1,e.removeAttribute(ji)}function pl(){pg();for(let e of Array.from(document.querySelectorAll(`[${sn}], [${pt}], [${fn}], [${ln}], [${el}], [${Ui}], [${co}]`)))e.remove();for(let e of Array.from(document.querySelectorAll(`[${po}], [${uo}], [${fo}], [${Jn}]`)))e.removeAttribute(po),e.removeAttribute(uo),e.removeAttribute(fo),e.removeAttribute(Jn)}function mn(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Xi="__breLedgerDocument";function kl(){let e=globalThis;return e[Xi]??(e[Xi]=`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`)}var bo="bre:held-writes:v1";function ra(){try{return typeof sessionStorage>"u"?void 0:sessionStorage}catch{return}}function st(e){let t=ra();if(t!==void 0)try{if(e.pending.size===0&&e.queued.size===0){t.removeItem(bo);return}let n={document:kl(),committed:[...e.committing].filter(r=>e.queued.has(r)),pending:[...e.pending].map(([r,o])=>[r,[...o]]),queued:[...e.queued].map(([r,o])=>[r,[...o]])};t.setItem(bo,JSON.stringify(n))}catch{}}function ml(e,t){if(!Array.isArray(e))return;let n=[];for(let r of e){if(!Array.isArray(r)||r.length!==2)return;let[o,i]=r;if(typeof o!="string"||!Array.isArray(i))return;let a=[];for(let s of i){if(!Array.isArray(s)||s.length!==2)return;let[d,l]=s;if(typeof d!="string"||!G(l)||t!==void 0&&!t(l))return;a.push([d,l])}n.push([o,a])}return n}function mg(e){let t=ra();if(t!==void 0)try{let n=t.getItem(bo);if(n===null)return;let r=JSON.parse(n);if(r.document!==kl())return;let o=ml(r.pending),i=ml(r.queued,Eg);if(o===void 0||i===void 0)return;let a=Array.isArray(r.committed)?r.committed.filter(s=>typeof s=="string"):[];for(let[s,d]of o)e.pending.set(s,new Map(d));for(let[s,d]of i)a.includes(s)&&(e.queued.set(s,new Map(d)),e.committing.add(s))}catch{}}function El(e,t){(async()=>{try{await oa(t,e),await ia(t,e)}catch(n){console.error(`[bre] teardown flush failed: ${n instanceof Error?n.message:String(n)}`)}})()}function Tl(e,t){(async()=>{try{await oa(t,e,!0),await ia(t,e,!0)}catch(n){console.error(`[bre] unload flush failed: ${n instanceof Error?n.message:String(n)}`)}finally{try{ra()?.removeItem(bo)}catch{}}})()}function Sl(){let e={disposed:!1,mounted:new Map,describePromise:void 0,pending:new Map,missedScans:new Map,queued:new Map,editing:void 0,flushing:!1,flushFailures:0,nextFlushAt:0,committing:new Set,adapting:new Set,signalsUnavailable:!1,submitWired:new WeakSet,cancelWired:new WeakSet,disclosureWired:new WeakSet,editWired:new WeakSet,addModelWired:new WeakSet,addProviderWired:new WeakSet};return mg(e),e}async function gg(e,t,n=!1){if(t.flushing)return;t.flushing=!0;let r;try{r=n&&Ll(t)?await ie(e.api,{fresh:!0}):void 0;let o=await oa(e,t,!1,r),i=await ia(e,t,!1,r);o||i?gl(e,t):(t.flushFailures=0,t.nextFlushAt=0)}catch(o){gl(e,t),console.error(`[bre] idle flush failed: ${o instanceof Error?o.message:String(o)}`)}finally{t.flushing=!1}try{e.onIdle?.(r)}catch(o){console.error(`[bre] idle hook failed: ${o instanceof Error?o.message:String(o)}`)}}var Ml=new Set(["no-namespace","invalid-models"]);function gl(e,t){t.flushFailures+=1;let n=Math.min(2**(t.flushFailures-1)*500,3e4);t.nextFlushAt=Date.now()+n,e.onBackoff?.(n)}function Ll(e){return e.queued.size>0||e.pending.size>0}function gn(e,t,n,r,o,i,a,s){try{let d=e.pending.get(t);if(r===void 0){if(d===void 0)return;d.delete(n),d.size===0&&e.pending.delete(t);return}e.pending.set(t,(d??new Map).set(n,{efforts:r,...o===void 0?{}:{compat:o},...i===void 0?{}:{input:i},...s===void 0?{}:{imageGen:s===!0},...a===void 0?{}:{defaultEffort:a}}))}finally{st(e)}}function Al(e,t,n,r){e.queued.set(t,(e.queued.get(t)??new Map).set(n,r)),st(e)}function hg(e,t,n){let r=e.pending.get(t);r!==void 0&&(r.delete(n),r.size===0&&e.pending.delete(t),st(e))}function bg(e,t,n){let r=e.queued.get(t);r!==void 0&&(r.delete(n),r.size===0&&e.queued.delete(t),st(e))}function yg(e,t,n){hg(e,t,n),bg(e,t,n)}function wg(e,t){e.queued.delete(t),e.pending.delete(t),e.missedScans.delete(t),e.committing.delete(t),st(e)}function vg(e,t,n){if(t===void 0)return null;let i=t[Ge]!==!0&&t.reasoningEfforts!==void 0&&typeof t[Xt]=="number"||t[Ge]!==!0&&n?.efforts!==void 0&&xg(t.reasoningEfforts,n.efforts)?!1:t.reasoningEfforts!==void 0||t[Ge]===!0||e.efforts==="keep",s=t[rt]!==!0&&n?.input!==void 0&&kg(t.input,n.input)?!1:Array.isArray(t.input)&&t.input.length>0||t[rt]===!0,d=i?"keep":e.efforts,l=s?void 0:e.input,c=t[We]===!0,f=e.imageGen!==void 0&&e.imageGen!==c?e.imageGen:void 0,m=e.defaultEffort;return d==="keep"&&l===void 0&&f===void 0&&m===void 0?null:{efforts:d,...e.compat===void 0?{}:{compat:e.compat},...l===void 0?{}:{input:l},...f===void 0?{}:{imageGen:f},...m===void 0?{}:{defaultEffort:m}}}function xg(e,t){if(e===t)return!0;if(!G(e)||!G(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 kg(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 Eg(e){if(!G(e))return!1;let t=e.efforts;return t===!1||t==="keep"||G(t)}async function Tg(e,t,n,r,o=!1,i){let a=i??await e.describeNamespace(),s=xe(a.namespace),d=[];for(let[m,u]of[...r]){let p=nn(s,n).find(w=>w.id===m);if(p===void 0||t.pending.get(n)?.get(m)!==u)continue;let h=Ht(s,n),g=typeof p.name=="string"?p.name:void 0,y=ot(m,g===void 0?h:{...h,displayName:g}),k=vg(u,p,{...y.efforts===void 0?{}:{efforts:y.efforts},...y.input===void 0?{}:{input:y.input}});if(k===null){gn(t,n,m,void 0);continue}d.push({modelId:m,efforts:k.efforts,...k.compat===void 0?{}:{compat:k.compat},...k.input===void 0?{}:{input:k.input},...k.imageGen===void 0?{}:{imageGen:k.imageGen},...k.defaultEffort===void 0?{}:{defaultEffort:k.defaultEffort}})}if(d.length===0)return!1;let l=!1,c=await Nt(e.api,n,d,()=>l?e.describeNamespace():(l=!0,Promise.resolve(a)),o?void 0:Vl),f=!1;return d.forEach((m,u)=>{let p=c[u];if(p?.aborted!==!0){if(p?.ok===!0||p?.modelNotFound===!0){gn(t,n,m.modelId,void 0);return}if(p?.error!==void 0&&Ml.has(p.error)){gn(t,n,m.modelId,void 0),console.error(`[bre] staged flush withdrew "${n}"/"${m.modelId}": ${p.error}`);return}f=!0,console.error(`[bre] staged flush write failed for "${n}"/"${m.modelId}": ${p?.error??"unknown"}`)}}),(t.pending.get(n)?.size??0)===0&&t.pending.delete(n),f}async function oa(e,t,n=!1,r){for(let s of[...t.committing])t.queued.has(s)||t.committing.delete(s);if(![...t.queued.keys()].some(s=>t.committing.has(s)||t.signalsUnavailable))return st(t),!1;let i=r??await e.describeNamespace();if(i.writable!==!0)return st(t),!1;let a=!1;for(let[s,d]of[...t.queued]){if(!t.committing.has(s)&&!t.signalsUnavailable)continue;let c=[...d].map(([u,p])=>({modelId:u,efforts:p.efforts,...p.compat===void 0?{}:{compat:p.compat},...p.input===void 0?{}:{input:p.input},...p.imageGen===void 0?{}:{imageGen:p.imageGen},...p.defaultEffort===void 0?{}:{defaultEffort:p.defaultEffort}})),f=await Nt(e.api,s,c,()=>Promise.resolve(i),n?void 0:Vl),m=!1;c.forEach((u,p)=>{let h=f[p];if(h?.aborted===!0){m=!0;return}if(h?.ok===!0||h?.modelNotFound===!0){d.delete(u.modelId);return}if(h?.error!==void 0&&Ml.has(h.error)){d.delete(u.modelId),console.error(`[bre] held write withdrawn for "${s}"/"${u.modelId}": ${h.error}`);return}console.error(`[bre] held write failed for "${s}"/"${u.modelId}": ${h?.error??"unknown"}`)}),d.size===0?(t.queued.delete(s),t.committing.delete(s)):m||(a=!0)}return st(t),a}async function ia(e,t,n=!1,r){if(t.pending.size===0)return!1;let o=r??await e.describeNamespace();if(o.writable!==!0)return!1;let i=xe(o.namespace),a=!1;for(let[s,d]of[...t.pending]){if(d.size===0){t.pending.delete(s);continue}mn(i,s)&&await Tg(e,t,s,d,n,o)&&(a=!0)}return st(t),a}function De(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 tr(e){return e.closest('[class*="editor"], [class*="rowCard"], [class*="addCard"]')??void 0}function Sg(e){let t=e.closest('[class*="modelEntry"]');if(t===null){let r=tr(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 Rl(e,t){return Array.from(e.querySelectorAll("button[aria-label]")).find(n=>t.some(r=>(n.getAttribute("aria-label")??"").startsWith(r)))}function hl(){return new Promise(e=>{if(typeof window.requestAnimationFrame!="function"){e();return}let t,n=()=>{window.clearTimeout(r),t!==void 0&&window.cancelAnimationFrame(t),e()},r=window.setTimeout(n,100);t=window.requestAnimationFrame(n)})}function ho(e){return e.querySelector('[class*="modelInputTypes"]')!==null}var Mg="modelReasoning",Zi="data-bre-reasoning-hidden";function Hl(e){return e.querySelector(`[class*="${Mg}"]`)??void 0}function aa(e){let t=Hl(e);t!==void 0&&t.style.display!=="none"&&(t.setAttribute(Zi,"1"),t.style.display="none")}function Zn(e){let t=Hl(e);t!==void 0&&t.getAttribute(Zi)==="1"&&(t.removeAttribute(Zi),t.style.display==="none"&&(t.style.display=""))}var yo="data-bre-capacity-hidden";function Cl(e,t){return Array.from(e.children).filter(n=>n.nodeType!==1?!1:n.matches(`[class*="${t}"]`))}function Lg(e){return Cl(e,"modelField")}function Ag(e){return Cl(e,"modelInputTypes")}function Nl(e){return[...Lg(e),...Ag(e)]}function Rg(e){for(let t of e)t.style.display!=="none"&&(t.setAttribute(yo,"1"),t.style.display="none")}function Hg(e){for(let t of e)t.getAttribute(yo)==="1"&&(t.removeAttribute(yo),t.style.display==="none"&&(t.style.display=""))}function Cg(e){Rg(Nl(e))}function Ji(e){Hg(Nl(e))}function Il(e){let t=e.querySelector('[class*="modelInputTypes"]');return t===null||t.getAttribute(yo)==="1"?!1:!t.hidden&&t.style.display!=="none"}function Pl(e,t){let n=e.querySelector('[class*="modelInputTypes"]');if(n===null)return;let r=Array.from(n.querySelectorAll('input[type="checkbox"]')),o=r.find(i=>{let a=i.closest("label")?.textContent?.trim();return a!==void 0&&t.includes(a)});return o!==void 0?o:r.length===2?r[1]:void 0}function nr(e,t,n){if(!Il(e))return!1;let r=Pl(e,n);return r===void 0||r.disabled?!1:(r.checked!==t&&r.click(),!0)}function ea(e,t,n){return t==null||e===void 0||Il(e)&&nr(e,t.includes("image"),n),t}function bl(e,t){let n=e.getAttribute("aria-label")??"";if(t.some(o=>n.startsWith(o)))return!0;let r=e.closest("label")?.textContent?.trim()??"";return r.length>0&&t.some(o=>r.includes(o))}function sa(e,t){let n=[...t.modelId,...t.modelName],r=Array.from(e.querySelectorAll("input")).filter(s=>s.type!=="checkbox"&&s.type!=="radio").filter(s=>s.closest("[data-plugin]")===null).filter(s=>!n.some(d=>(s.getAttribute("aria-label")??"").startsWith(d))),o=r.find(s=>bl(s,t.contextWindow)),i=r.find(s=>bl(s,t.maxOutput));if(o!==void 0&&i!==void 0)return{contextWindow:o,maxOutput:i};let a=r.filter(s=>s!==o&&s!==i);return{contextWindow:o??a[0],maxOutput:i??(o!==void 0?a[0]:a[1])}}function Dl(e,t,n){let r=sa(e,t),o=(i,a)=>i===void 0||i.disabled||a===void 0||!Number.isFinite(a)||a<=0||it(i.value)!==void 0?!1:Ol(i,String(a));return{contextWindow:o(r.contextWindow,n.contextWindow),maxOutput:o(r.maxOutput,n.maxTokens)}}function Ol(e,t){return e.disabled?!1:(e.value===t||(Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value")?.set?.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0}))),!0)}function Ng(e,t){let n=sa(e,t),r=a=>{if(a!==void 0)return it(a.value)},o=r(n.contextWindow),i=r(n.maxOutput);return{...o===void 0?{}:{contextWindow:o},...i===void 0?{}:{maxTokens:i}}}function Ig(e,t,n){let r=sa(e,t),o=(i,a)=>i===void 0?!1:Ol(i,a===void 0||!Number.isFinite(a)||a<=0?"":String(a));return{contextWindow:"contextWindow"in n?o(r.contextWindow,n.contextWindow):!1,maxOutput:"maxTokens"in n?o(r.maxOutput,n.maxTokens):!1}}async function Pg(e,t,n){if(e===void 0)return!1;let r=t.inputImage;if(ho(e))return nr(e,!0,r);let o=e.closest('[class*="modelEntry"]')??e;if(o.querySelector('[class*="modelAdvanced"]')!==null)return!1;let i=Rl(o,t.capacity);if(i===void 0||i.disabled)return!1;i.click(),ho(o)||await n();try{return ho(o)&&nr(o,!0,r)}finally{i.click()}}async function Dg(e,t,n,r){if(e.matches('[class*="modelAdvanced"]'))return r(e);let o=e.closest('[class*="modelEntry"]')??e;if(o.querySelector('[class*="modelAdvanced"]')!==null)return r(o);let i=Rl(o,t.capacity);if(i===void 0||i.disabled)return!1;i.click(),o.querySelector('[class*="modelAdvanced"]')===null&&await n();try{return o.querySelector('[class*="modelAdvanced"]')!==null?r(o):!1}finally{i.click()}}function Og(e,t,n,r,o){n.disposed||!e.isConnected||la(e)===void 0||Array.from(e.querySelectorAll("button[aria-label]")).some(a=>o.capacity.some(s=>(a.getAttribute("aria-label")??"").startsWith(s)))||Qr(e,_g(e,xe(r.namespace),o),{t:t.t,onRequest:a=>_l(n,t,a)})}function _g(e,t,n){let r=[];for(let o of _i(e)){let i=tr(o);if(i===void 0)continue;let a=mt(i,t,n);a===void 0||a.staged||r.push({catalogue:o,route:a.route})}return r}function Fg(e,t,n){let r=[],o=new Set;for(let i of e){if(o.has(i.card))continue;o.add(i.card);let a=mt(i.card,t,n);if(a===void 0)continue;let[s]=_i(i.card);s!==void 0&&r.push({catalogue:s,route:a.route})}return r}function Bg(e,t,n,r){let o=[],i=new Set;for(let a of r.capacity){let s=Array.from(e.querySelectorAll("button[aria-label]")).filter(d=>(d.getAttribute("aria-label")??"").startsWith(a));for(let d of s){let l=tr(d);if(l===void 0)continue;let c=d.closest('[class*="modelEntry"]')??l,f=De(c,r.modelId);f.length===0||i.has(f)||mt(l,n,r)?.route===t&&(i.add(f),o.push({id:f,name:De(c,r.modelName),row:c}))}}return o}async function _l(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{wi();let a,s=()=>a??(a=t.describeNamespace()),d=await s(),l=xe(d.namespace);if(d.writable!==!0)return{held:0,unsuggested:0,blocked:"unwritable"};if(!mn(l,n)&&r.length===0)return{held:0,unsuggested:0,blocked:"unknown-route"};let f=nn(l,n),m=new Set;for(let I of f){let N=typeof I.id=="string"?I.id:"";N.length>0&&m.add(N)}let u=f.slice();for(let I of r)I.id.length===0||m.has(I.id)||u.push({id:I.id,name:I.name});if(u.length===0)return{held:0,unsuggested:0,blocked:"no-models"};let p=l[n]??{},h=typeof p.api=="string"?p.api:void 0,g=new Set,y=new Map;for(let[I,N]of e.mounted)N.props.route===n&&(y.set(N.props.modelId,I),N.props.efforts!==void 0&&g.add(N.props.modelId));let k=new Map;for(let I of r)I.row!==void 0&&k.set(I.id,I.row);let w=!1,C=(I,N)=>ea(y.get(I),N,t.labels().inputImage),K=async(I,N)=>{if(N.image!==!0)return;let j=y.get(I)??k.get(I);j!==void 0&&await Pg(j,t.labels(),hl)},J=async(I,N,j)=>{let S=N.image===!0,R=j.contextWindow!==void 0||j.maxTokens!==void 0;if(!S&&!R)return;let _=y.get(I)??k.get(I);if(_===void 0)return;let b=t.labels();await Dg(_,b,hl,L=>{S&&nr(L,!0,b.inputImage),R&&Dl(L,b,j)})},W=Ur(t.api,s,(I,N,j,S,R,_,b)=>{gn(e,I,N,j,S,C(N,R),_,b)},(I,N,j)=>{Al(e,I,N,{...j,input:C(N,j.input)})},void 0,()=>w);for(let I of u){let N=typeof I.id=="string"?I.id:"";if(N.length===0)continue;let j=Kr(u,N),S=qr(u,N),R=I[We]===!0,_=j!==void 0||I[Ge]===!0,b=Array.isArray(S)&&S.length>0||I[rt]===!0||R;if(g.has(N)&&!_)continue;if(_&&b){let te=y.get(N)??k.get(N);if(Array.isArray(S)&&S.includes("image")&&te!==void 0){let fe=t.labels().inputImage,ve=Pl(te,fe);ve!==void 0&&!ve.disabled&&!ve.checked&&nr(te,!0,fe)}continue}let L=Gr(u,N),H=zr(u,N)??"",ne=await W.suggest(n,N,Wr(u,N));if(!ne.ok){i+=1;continue}let $=ne.suggestion,re=$.efforts!==!1,ee=$.imageGen===!0?ct(void 0,!0):$.input===void 0?ct(S,R):ct($.input);if(_){if(!ee.image&&!ee.imageGen||e.queued.get(n)?.has(N)===!0)continue;await K(N,ee),w=!m.has(N),W.commit(n,N,Xr({efforts:"keep",...Yr(ee)})),w&&t.onPendingChanged?.(),w=!1,o+=1;continue}let de=H!==""?H:$.defaultEffort??H,z=de===H?void 0:de===""?null:de;w=!m.has(N),await J(N,ee,{...$.contextWindow===void 0?{}:{contextWindow:$.contextWindow},...$.maxTokens===void 0?{}:{maxTokens:$.maxTokens}});let Z=Vr(ee,S,R)?void 0:Yr(ee);W.commit(n,N,Xr({efforts:Di(re,rn(Pt($.efforts)),j),input:Z?.input,imageGen:Z?.imageGen,defaultEffort:z,appliedCompat:$.compat,routeApi:h,initialCompat:L})),w&&t.onPendingChanged?.(),w=!1,o+=1}return{held:o,unsuggested:i}}catch(a){return console.warn("[bre] provider-wide adapt failed:",a),{held:o,unsuggested:i,failed:a instanceof Error?a.message:String(a)}}finally{e.adapting.delete(n)}}function Kg(e){return e.querySelector(`[data-plugin="${we}"]`)!==null}function qg(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&&$n(e.efforts,t.efforts)&&Wg(e.input,t.input)&&e.imageGen===t.imageGen&&Gg(e.compat,t.compat)}function Gg(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 Wg(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 ta(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 mt(e,t,n){let r=e.querySelector('[class*="editorRoute"]')?.textContent?.trim();if(r!==void 0&&r.length>0&&mn(t,r))return{route:r,staged:!1};if(ta(e,n.routeId)){let a=De(e,n.routeId);return a.length>0&&!mn(t,a)?{route:a,staged:!0}:void 0}let o=e.querySelector('[class*="editorTitle"], [class*="rowName"]')?.textContent?.trim();if(o===void 0||o.length===0)return;let i=Object.entries(t).find(([,a])=>a.displayName===o);if(i!==void 0)return{route:i[0],staged:!1};if(mn(t,o))return{route:o,staged:!1}}function zg(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=(f,m)=>(f.textContent??"").trim()===m,i=n.querySelector('[class*="primaryButton"]'),a=n.querySelector('[class*="secondaryButton"]');if(i!==null&&a!==null)return{submit:i,cancel:a};let s=[...r].reverse().find(f=>t.apply.some(m=>o(f,m))),d=[...r].reverse().find(f=>t.cancel.some(m=>o(f,m)));if(s!==void 0&&d!==void 0)return{submit:s,cancel:d};let l=r[r.length-1],c=r[r.length-2];if(!(l===void 0||c===void 0))return{submit:l,cancel:c}}function yn(e,t,n){t.has(e)||(t.add(e),e.addEventListener("click",n,{capture:!0}))}var Qi=new WeakMap,na=new Set;function Fl(){for(let e of Array.from(na))e.release()}var rr=420,Bl=320,Ug=160,yl=2e3,jg=150,Kl=new Set(["PageUp","PageDown","Home","End","ArrowUp","ArrowDown"," "]);function da(e,t=Bl){for(let n of Gi(e)){let r=wo.get(n);if(r!==void 0){window.clearTimeout(r.timer),r.timer=window.setTimeout(()=>wl(n),t);continue}n.style.overflowAnchor!=="none"&&(wo.set(n,{saved:n.style.overflowAnchor,timer:window.setTimeout(()=>wl(n),t)}),n.style.overflowAnchor="none")}}var wo=new Map;function wl(e){let t=wo.get(e);t!==void 0&&(wo.delete(e),e.style.overflowAnchor=t.saved)}function wn(e,t,n=!1){let r=Gi(e),o=r[0];if(o===void 0||!e.isConnected)return;let i=performance.now(),a=Qi.get(o);if(a!==void 0)if(n)a.release();else{a.deadline=Math.min(Math.max(a.deadline,i+t),a.startedAt+yl);return}let s=e.getBoundingClientRect(),d=s.top,l=s.height,c=new Map,f=new Map;for(let w of r){c.set(w,w.scrollTop);let C=w.style.overflowAnchor;C!=="none"&&f.set(w,C),w.style.overflowAnchor="none"}let m=new Set(r),u={deadline:i+t,startedAt:i,frame:void 0,release:()=>{}},p=()=>{if(na.delete(u)){u.frame!==void 0&&(window.cancelAnimationFrame(u.frame),u.frame=void 0);for(let[w,C]of f)w.style.overflowAnchor=C;Qi.delete(o),document.removeEventListener("wheel",h,!0),document.removeEventListener("touchstart",h,!0),document.removeEventListener("pointerdown",h,!0),document.removeEventListener("keydown",g,!0)}};function h(){p()}function g(w){Kl.has(w.key)&&p()}u.release=p,Qi.set(o,u),na.add(u),document.addEventListener("wheel",h,{capture:!0,passive:!0}),document.addEventListener("touchstart",h,{capture:!0,passive:!0}),document.addEventListener("pointerdown",h,{capture:!0}),document.addEventListener("keydown",g,{capture:!0});let y=0,k=()=>{if(u.frame=void 0,y+=1,!e.isConnected||y>=jg){p();return}let w=e.getBoundingClientRect(),C=Math.abs(w.height-l)>.5;if(!C&&[...m].some(I=>I.scrollTop!==c.get(I))){p();return}let K=[];if(C){for(let I of r){let N=c.get(I);N===void 0||I.scrollTop===N||(K.push(I),I.scrollTop=N,c.set(I,I.scrollTop))}w=e.getBoundingClientRect()}let J=w.top-d;J!==0&&$g(r,m,c,J,K);let W=performance.now();if(C&&(l=w.height,u.deadline=Math.min(Math.max(u.deadline,W+Ug),u.startedAt+yl)),W>=u.deadline){p();return}u.frame=window.requestAnimationFrame(k)};u.frame=window.requestAnimationFrame(k)}function $g(e,t,n,r,o=[]){let i=r;for(let a of new Set([...o,...t,...e])){if(i===0)break;let s=a.scrollTop;if(s!==n.get(a))continue;a.scrollTop=s+i;let d=a.scrollTop;d!==s&&(n.set(a,d),t.add(a),i-=d-s)}}var ql='[class*="modelList"]',Vg="bre-list-slack",Yg=3e3,xo,hn=new WeakMap,bn=new Set;function Gl(e){if(!(e instanceof Element))return;let t=e.closest(ql);if(t===null)return;let n=_d(t).map(r=>({host:r,top:r.scrollTop}));n.length!==0&&(xo={targets:n,at:performance.now()})}function gt(){xo=void 0}function Wl(e){Gl(e.target)}function zl(e){if(Kl.has(e.key)){gt();return}Gl(e.target)}var er=0;function Ul(){er+=1,!(er>1)&&(document.addEventListener("click",Wl,!0),document.addEventListener("keydown",zl,!0),document.addEventListener("focusin",gt,!0),document.addEventListener("pointerdown",gt,!0),document.addEventListener("wheel",gt,{capture:!0,passive:!0}),document.addEventListener("touchstart",gt,{capture:!0,passive:!0}))}function vo(e){let t=hn.get(e);t!==void 0&&(hn.delete(e),bn.delete(t),t.scrollTarget.removeEventListener("scroll",t.onScroll),t.spacer.remove())}function Xg(e){return e===document.scrollingElement?document:e}function Jg(){if(bn.size!==0)for(let e of Array.from(bn)){let t=e.host;if(!e.spacer.isConnected){hn.delete(t),bn.delete(e),e.scrollTarget.removeEventListener("scroll",e.onScroll);continue}t.scrollTop<=t.scrollHeight-t.clientHeight-e.height&&vo(t)}}function vl(e,t){return e.scrollTop>e.scrollHeight-e.clientHeight-t}function Qg(e=performance.now()){let t=xo;if(!(t===void 0||e-t.at>Yg))for(let n of t.targets){let r=n.host;if(!r.isConnected)continue;let o=hn.get(r),i=o===void 0?0:o.height,a=r.scrollHeight-r.clientHeight-i,s=n.top-a;if(s<=0){o!==void 0&&!vl(r,o.height)&&vo(r);continue}let d=o;if(d===void 0){let l=document.createElement("div");l.className=Vg,l.dataset.plugin=we,l.setAttribute("aria-hidden","true"),l.style.height="0px",(r===document.scrollingElement?document.body??r:r).appendChild(l);let f=()=>{let m=hn.get(r);m!==void 0&&!vl(r,m.height)&&vo(r)};d={host:r,spacer:l,height:0,onScroll:f,scrollTarget:Xg(r)},hn.set(r,d),bn.add(d),d.scrollTarget.addEventListener("scroll",f,{passive:!0})}d.height!==s&&(d.height=s,d.spacer.style.height=`${s}px`),r.scrollTop!==n.top&&(r.scrollTop=n.top)}}function jl(){if(er=Math.max(0,er-1),!(er>0)){document.removeEventListener("click",Wl,!0),document.removeEventListener("keydown",zl,!0),document.removeEventListener("focusin",gt,!0),document.removeEventListener("pointerdown",gt,!0),document.removeEventListener("wheel",gt,!0),document.removeEventListener("touchstart",gt,!0),xo=void 0;for(let e of Array.from(bn))vo(e.host)}}function $l(e,t=rr){Qg(),Jg();let n=new Set;for(let r of Array.from(e.querySelectorAll(ql))){let o=r.closest('[class*="rowCard"], [class*="setupCard"], [class*="addCard"]');o===null||n.has(o)||(n.add(o),wn(o,t))}}function Zg(e,t){yn(e,t,()=>{let n=e.closest('[class*="modelEntry"]')??e.closest('[class*="rowCard"]');n!==null&&wn(e.closest('[class*="rowCard"]')??n,rr)})}var xl="{provider}";function eh(e,t){let n=t.editProvider.map(o=>{let i=o.indexOf(xl);return i<0?void 0:{prefix:o.slice(0,i),suffix:o.slice(i+xl.length)}}).filter(o=>o!==void 0);if(n.length===0)return[];let r=[];for(let o of Array.from(e.querySelectorAll("button[aria-label]"))){let i=o.getAttribute("aria-label")??"";n.some(a=>i.length>a.prefix.length+a.suffix.length&&i.startsWith(a.prefix)&&i.endsWith(a.suffix))&&o.closest("[data-plugin]")===null&&r.push(o)}return r}function th(e,t){yn(e,t,()=>{let n=e.closest('[class*="rowCard"], [class*="setupCard"], [class*="addCard"]');n!==null&&wn(n,rr)})}function nh(e,t){let n=[];for(let r of Array.from(e.querySelectorAll("button"))){if(r.closest("[data-plugin]")!==null)continue;let o=r.getAttribute("aria-label")??"";if(t.addModel.some(a=>o.startsWith(a))){n.push(r);continue}let i=(r.textContent??"").trim();i.length>0&&t.addModel.some(a=>i===a||i===`+ ${a}`)&&n.push(r)}return n}function rh(e,t,n){yn(e,n,()=>{t.isConnected&&wn(t,rr)})}function oh(e,t){yn(e,t,()=>{let n=e.closest('[class*="addBlock"]');n!==null&&wn(n,rr,!0)})}function la(e){return e.querySelector('[class*="editorActions"]')??e.querySelector('[class*="modelEntry"]')??void 0}function Vl(){return la(Ze())!==void 0}function ih(e,t,n){let r={routeId:t.routeId,modelName:t.modelName,baseUrl:t.baseUrl,apiProtocol:t.apiProtocol},o=new Set;for(let i of Array.from(e.querySelectorAll('[class*="editor"], [class*="addCard"], [class*="rowCard"]')))ta(i,t.apiProtocol)&&ta(i,t.baseUrl)&&o.add(i);for(let i of o)fl(i,r,{t:n})}function ca(e,t,n){if(n.disposed||!e.isConnected)return;let r=t.labels(),o=la(e)!==void 0;for(let s of Array.from(e.querySelectorAll('[class*="rowCard"], [class*="setupCard"]')))for(let d of eh(s,r))th(d,n.editWired);for(let s of Array.from(e.querySelectorAll('[class*="rowCard"], [class*="setupCard"], [class*="addCard"]')))for(let d of nh(s,r))rh(d,s,n.addModelWired);for(let s of Array.from(e.querySelectorAll('button[class*="addButton"]')))s.closest("[data-plugin]")===null&&oh(s,n.addProviderWired);ih(e,r,t.t);let i=Array.from(e.querySelectorAll("button[aria-label]")).some(s=>r.capacity.some(d=>(s.getAttribute("aria-label")??"").startsWith(d)));if(!o){if(Qr(e,[],{t:t.t}),n.mounted.size>0){for(let[d,l]of n.mounted)Zn(d),Ji(d),l.editor.unmount();n.mounted.clear()}let s=n.editing;n.editing=!1,(s!==!1||Ll(n)&&Date.now()>=n.nextFlushAt)&&gg(t,n,s===!0).catch(d=>{console.error(`[bre] idle pass failed: ${d instanceof Error?d.message:String(d)}`)});return}if(n.editing=!0,!i){for(let[d,l]of n.mounted)Zn(d),Ji(d),l.editor.unmount();n.mounted.clear(),n.describePromise??(n.describePromise=t.describeNamespace({allowStale:!0}));let s=r;n.describePromise.then(d=>{Og(e,t,n,d,s)}).catch(d=>{n.describePromise=void 0,console.error(`[bre] empty-catalog seat failed: ${d instanceof Error?d.message:String(d)}`)});return}for(let s of r.capacity)for(let d of Array.from(e.querySelectorAll("button[aria-label]")))(d.getAttribute("aria-label")??"").startsWith(s)&&Zg(d,n.disclosureWired);n.describePromise??(n.describePromise=t.describeNamespace({allowStale:!0}));let a=s=>{if(n.disposed||!e.isConnected)return;let d=s.namespace,l=xe(d),c=[];for(let m of r.capacity){let u=Array.from(e.querySelectorAll("button[aria-label]")).filter(p=>(p.getAttribute("aria-label")??"").startsWith(m));for(let p of u){let h=tr(p);if(h===void 0)continue;let g=p.closest('[class*="modelEntry"]')??h,y=De(g,r.modelId);y.length!==0&&c.push({container:Sg(p),row:g,modelId:y,card:h})}}Qr(e,Fg(c,l,r),{t:t.t,onRequest:m=>_l(n,t,m,Bg(e,m,l,r))});for(let[m,u]of n.mounted)c.some(p=>p.container===m)||(Zn(m),Ji(m),u.editor.unmount(),n.mounted.delete(m));if(n.pending.size>0){let m=new Map;for(let p of c){let h=mt(p.card,l,r);if(h===void 0)continue;let g=m.get(h.route);g===void 0&&m.set(h.route,g=new Set),g.add(p.modelId)}let u=new Map;for(let[p,h]of n.pending){if(!mn(l,p))continue;let g=m.get(p),y=[...h.keys()].filter(k=>!g?.has(k));y.length>0&&u.set(p,new Set(y))}for(let[p,h]of u){let g=n.missedScans.get(p);if(g!==void 0)for(let y of h)g.has(y)&&(gn(n,p,y,void 0),g.delete(y),h.delete(y))}n.missedScans=u}else n.missedScans=new Map;let f=new Set(c.map(m=>m.card));for(let m of f){let u=mt(m,l,r);if(u===void 0)continue;let p=u.route,h=zg(m,r);h===void 0?n.signalsUnavailable=!0:(n.signalsUnavailable=!1,yn(h.submit,n.submitWired,()=>{let g=mt(m,l,r)?.route??p;n.committing.add(g),st(n)}),yn(h.cancel,n.cancelWired,()=>{let g=mt(m,l,r)?.route??p;wg(n,g)}))}c.forEach((m,u)=>{let p=m.container;if(p===void 0)return;let h=mt(m.card,l,r);if(h===void 0)return;let{route:g,staged:y}=h,k=l[g]??{},w=nn(l,g),C=new Set(w.map(z=>z.id)),K=y||!C.has(m.modelId),J=K?n.pending.get(g)?.get(m.modelId)?.efforts:void 0,W=K?J==="keep"?void 0:J:Kr(w,m.modelId),I=!K&&w.some(z=>z.id===m.modelId&&z[Ge]===!0),N=K?n.pending.get(g)?.get(m.modelId)?.input:qr(w,m.modelId),j=K?n.pending.get(g)?.get(m.modelId)?.imageGen:zn(w,m.modelId),S=K?n.pending.get(g)?.get(m.modelId)?.compat:Gr(w,m.modelId),R=K?n.pending.get(g)?.get(m.modelId)?.defaultEffort??void 0:zr(w,m.modelId),_=K?De(m.row,r.modelName):"",b=K?_.length>0?_:void 0:Wr(w,m.modelId),L=y?De(m.card,r.apiProtocol):"",H=y?De(m.card,r.baseUrl):"",ne=y&&L.length>0?L:typeof k.api=="string"?k.api:void 0,$=y&&H.length>0?H:typeof k.baseURL=="string"?k.baseURL:void 0,re={route:g,routeDisplayName:y?g:typeof k.displayName=="string"?k.displayName:g,...ne===void 0?{}:{routeApi:ne},...$===void 0?{}:{routeBaseURL:$},modelId:m.modelId,...b===void 0?{}:{modelName:b},...W===void 0?{}:{efforts:W},...I?{effortsUnset:I}:{},...N===void 0?{}:{input:N},...j?{imageGen:!0}:{},...S===void 0?{}:{compat:S},...R===void 0?{}:{defaultEffort:R},index:u,staged:K,officialInputTypes:ho(p),api:{...Ur(t.api,void 0,(z,Z,te,fe,ve,q,Y)=>{gn(n,z,Z,te,fe,ea(p,ve,r.inputImage),q,Y)},(z,Z,te)=>{Al(n,z,Z,{...te,input:ea(p,te.input,r.inputImage)})},z=>{yg(n,z,m.modelId)},()=>(mt(m.card,l,r)?.staged??y)||!C.has(m.modelId)),fillCapacities:(z,Z)=>{Dl(p,r,{...z===void 0?{}:{contextWindow:z},...Z===void 0?{}:{maxTokens:Z}})},readCapacities:()=>Ng(p,r),setCapacities:z=>{Ig(p,r,z)}},readOnly:s.writable!==!0,t:t.t};aa(p),Cg(p);let ee=n.mounted.get(p);if(ee!==void 0){qg(ee.props,re)||(ee.props=re,ee.editor.render(re));return}if(Kg(p))return;wn(tr(p)??m.card,Bl);let de=t.mount(p,re);n.mounted.set(p,{editor:de,props:re})})};n.describePromise.then(a,()=>{n.describePromise=void 0}).catch(s=>{console.error(`[bre] editor reconcile failed: ${s instanceof Error?s.message:String(s)}`)})}var ua=require("react");var ce=require("react");var je=require("react"),Jl=require("react-dom"),dt=require("react/jsx-runtime"),Yl=6,ah=292,ko=8,sh=52;function Xl(e,t){let n=e.getBoundingClientRect(),r=t*sh+46,o=window.innerWidth||0,i=window.innerHeight||0,a=Math.max(ko,Math.min(n.left,o-ah-ko)),s=n.bottom+Yl,d=n.top-Yl-r,l=i>0&&s+r>i-ko&&d>ko?d:s;return{left:a,top:l}}function Ql(e){let{anchor:t,label:n,options:r,selected:o,onPick:i,onClose:a}=e,[s,d]=(0,je.useState)(()=>Xl(t,r.length)),l=(0,je.useRef)(null),c=(0,je.useRef)([]);(0,je.useLayoutEffect)(()=>{let u=()=>{d(Xl(t,r.length))};return u(),window.addEventListener("resize",u),window.addEventListener("scroll",u,!0),()=>{window.removeEventListener("resize",u),window.removeEventListener("scroll",u,!0)}},[t,r.length]),(0,je.useEffect)(()=>{let u=Math.max(0,r.findIndex(p=>p.value===o));c.current[u]?.focus()},[r,o]),(0,je.useEffect)(()=>{let u=p=>{let h=p.target;h instanceof Node&&l.current?.contains(h)!==!0&&(t.contains(h)||a())};return document.addEventListener("pointerdown",u,!0),()=>{document.removeEventListener("pointerdown",u,!0)}},[t,a]);let f=(0,je.useCallback)(u=>{if(r.length===0)return;let p=(u+r.length)%r.length;c.current[p]?.focus()},[r.length]),m=u=>{let p=c.current.findIndex(h=>h===document.activeElement);if(u.key==="Escape"){u.preventDefault(),u.stopPropagation(),a();return}if(u.key==="ArrowDown"){u.preventDefault(),f(p+1);return}if(u.key==="ArrowUp"){u.preventDefault(),f(p<0?r.length-1:p-1);return}if(u.key==="Home"){u.preventDefault(),f(0);return}u.key==="End"&&(u.preventDefault(),f(r.length-1))};return(0,Jl.createPortal)((0,dt.jsxs)("div",{ref:l,className:"bre-protocol-menu",style:{left:s.left,top:s.top},onKeyDown:m,children:[(0,dt.jsx)("p",{className:"bre-protocol-menu-title",children:n}),(0,dt.jsx)("ul",{className:"bre-protocol-menu-list",role:"listbox","aria-label":n,children:r.map((u,p)=>{let h=u.value===o;return(0,dt.jsx)("li",{children:(0,dt.jsx)("button",{ref:g=>{c.current[p]=g},type:"button",role:"option","aria-selected":h,"data-protocol-value":u.value,className:"bre-protocol-option",tabIndex:-1,onClick:()=>{i(u.value)},children:(0,dt.jsxs)("span",{className:"bre-protocol-option-text",children:[(0,dt.jsx)("span",{className:"bre-protocol-option-title",children:u.title}),(0,dt.jsx)("span",{className:"bre-protocol-option-hint",children:u.hint})]})})},u.value)})})]}),document.body)}var B=require("react/jsx-runtime"),dh=["M8 3.9v8.2","M3.9 8h8.2"],lh="M3.9 8.35 6.6 11.05 12.1 5.5";function Zl({paths:e}){return(0,B.jsx)("svg",{viewBox:"0 0 16 16",width:16,height:16,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:e.map(t=>(0,B.jsx)("path",{d:t},t))})}function ch(e,t){return e.masked!==void 0?e.masked:e.configured===!1?t("keysMissing"):"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"}function ec(e){return e.alias??e.masked??e.ref}function uh(e,t){return e.models===void 0?t("keysScopeAll"):e.models.length===0?t("keysScopeNone"):t("keysScopeCount",{count:e.models.length})}var nc=["openai-completions","openai-responses","anthropic-messages"],fh={openai:null,anthropic:null},ph=2e3,mh=150,gh=300,hh=new Intl.Collator("en",{numeric:!0,sensitivity:"base"});function bh(e,t){return nc.filter(n=>n===t?!0:(e[so(n)]??"").length>0)}function rc(e,t){return t(e==="anthropic-messages"?"keysProtocolAnthropic":e==="openai-responses"?"keysProtocolResponses":e==="openai-completions"?"keysProtocolOpenAI":"keysProtocolDefault")}function yh(e,t){return t(e==="anthropic-messages"?"keysProtocolAnthropicHint":e==="openai-responses"?"keysProtocolResponsesHint":e==="openai-completions"?"keysProtocolOpenAIHint":"keysProtocolDefaultHint")}function tc(e,t,n,r=!1){return[void 0,...r?nc:bh(e,t)].map(i=>({value:i??"",title:rc(i,n),hint:yh(i,n)}))}function Eo(e){let{route:t,t:n,draft:r}=e,o=e.client??Pe,[i,a]=(0,ce.useState)(()=>o.cached?.(t)?.entries),[s,d]=(0,ce.useState)(()=>o.cached?.(t)?.models??[]),[l,c]=(0,ce.useState)(void 0),[f,m]=(0,ce.useState)(!1),[u,p]=(0,ce.useState)(void 0),[h,g]=(0,ce.useState)(""),[y,k]=(0,ce.useState)(""),[w,C]=(0,ce.useState)([]),[K,J]=(0,ce.useState)(void 0);(0,ce.useEffect)(()=>{r===!0&&p({kind:"add"})},[r]);let[W,I]=(0,ce.useState)(void 0),[N,j]=(0,ce.useState)(void 0),[S,R]=(0,ce.useState)(()=>o.cached?.(t)?.endpoints??fh),[_,b]=(0,ce.useState)(!1),L=(0,ce.useRef)(0),H=(0,ce.useCallback)((x,M)=>{if(!x.ok){c({kind:"error",text:x.error??n("keysUnreachable")});return}a(x.entries),d(x.models??[]),R(x.endpoints),b(x.probing===!0),c(M===void 0?void 0:{kind:"status",text:M})},[n]),ne=(0,ce.useRef)(t);(0,ce.useEffect)(()=>{ne.current=t},[t]);let $=(0,ce.useCallback)(async x=>{let M=o.cached?.(x)!==void 0,F=await o.list(x);ne.current===x&&(M&&!F.ok||H(F,void 0))},[H,o]);(0,ce.useEffect)(()=>{$(t)},[$,t]),(0,ce.useEffect)(()=>{let x,M=()=>{x===void 0&&(x=setTimeout(()=>{x=void 0,$(t)},gh))};return document.addEventListener(qn,M),()=>{document.removeEventListener(qn,M),x!==void 0&&clearTimeout(x)}},[$,t]),(0,ce.useEffect)(()=>{if(!_){L.current=0;return}let x=!0,M=setInterval(()=>{if(L.current+=1,L.current>mh){b(!1);return}(async()=>{let F=await o.list(t);!x||ne.current!==t||(F.ok?H(F,void 0):b(!1))})()},ph);return()=>{x=!1,clearInterval(M)}},[H,o,_,t]),(0,ce.useEffect)(()=>{let x=M=>{let V=M.detail?.route;V!==void 0&&V!==t||(async()=>{let ue=await o.list(t);ue.ok&&H(ue,void 0)})()};return document.addEventListener(Kn,x),()=>{document.removeEventListener(Kn,x)}},[H,o,t]);let re=()=>{p(void 0),g(""),k(""),C([]),J(void 0)},ee=(0,ce.useCallback)(async(x,M)=>{let F=u,V=t;m(!0),I(void 0);try{let ue=await x();if(ne.current!==V)return;H(ue,M),ue.ok&&F!==void 0&&F.kind!=="add"&&!ue.entries.some(ae=>ae.ref===F.ref)&&re()}finally{m(!1)}},[H,u,t]),de=(x,M)=>{p({kind:x,ref:M.ref}),g(x==="alias"?M.alias??"":""),k(""),C((M.models??[]).filter(F=>s.includes(F))),J(void 0),I(void 0)},z=()=>{if(f||u===void 0)return;let x=u.kind,M=u.ref;if(x!=="alias"&&x!=="scope"&&!ut(y))return;let F=zd(h),V=K,ue=t,ae=()=>ne.current!==ue;m(!0),(async()=>{try{if(x==="add"){let X=new Set((i??[]).map(qe=>qe.ref)),be=await o.add(t,y,F);if(ae())return;if(!be.ok){H(be,n("keysAdded"));return}if(H(be,n("keysAdded")),re(),V===void 0)return;let Me=be.entries.find(qe=>qe.ref===be.addedRef)??be.entries.find(qe=>!X.has(qe.ref)),$t=Me===void 0?{ok:!1}:await o.setProtocol(t,Me.ref,V);ae()||H($t,n("keysAdded"));return}if(M===void 0)return;if(x==="scope"){let X=await o.setScope(t,M,w.length===0?void 0:w);ae()||(H(X,n("keysScopeSaved")),X.ok&&re());return}let pe=x==="alias"?await o.rename(t,M,F):await o.replace(t,M,y);ae()||(H(pe,n(x==="alias"?"keysRenamed":"keysReplaced")),pe.ok&&re())}finally{m(!1)}})()},Z=x=>{C(M=>M.includes(x)?M.filter(F=>F!==x):[...M,x])},te=[...new Set(s)].sort(hh.compare),fe=()=>{if(u===void 0)return null;let x=u.kind,M=x==="add"||x==="value",F=x==="scope",V=x==="scope"&&u?.ref!==void 0?i?.find(X=>X.ref===u.ref)?.observed??[]:[],ue=x==="scope"&&u?.ref!==void 0?i?.find(X=>X.ref===u.ref)?.auto===!0:!1,ae=te.filter(X=>V.includes(X)),pe=M&&y.length>0&&!ut(y);return(0,B.jsxs)("div",{className:"bre-keys-form",children:[F?(0,B.jsx)("div",{className:"bre-keys-chips",role:"group","aria-label":n("keysScope"),children:te.length===0?(0,B.jsx)("p",{className:"bre-keys-hint",children:n("keysScopeEmpty")}):te.map(X=>{let be=w.includes(X);return(0,B.jsx)("button",{type:"button",className:be?"bre-keys-chip is-selected":"bre-keys-chip","aria-pressed":be,disabled:f,onClick:()=>Z(X),children:X},X)})}):(0,B.jsxs)("div",{className:"bre-keys-form-fields",children:[x==="value"?null:(0,B.jsx)("input",{className:"bre-text-input bre-keys-name",type:"text",value:h,placeholder:n("keysAliasPlaceholder"),"aria-label":n("keysAlias"),disabled:f,autoFocus:x==="alias",onChange:X=>g(X.target.value)}),M?(0,B.jsx)("input",{className:"bre-text-input bre-keys-secret",type:"password",autoComplete:"new-password",spellCheck:!1,value:y,placeholder:n(x==="add"?"keysValuePlaceholder":"keysNewValuePlaceholder"),"aria-label":n("keysValue"),"aria-invalid":pe,disabled:f,autoFocus:!0,onChange:X=>k(X.target.value)}):null]}),x==="add"?(0,B.jsx)("div",{className:"bre-keys-chips",role:"group","aria-label":n("keysProtocolCreate"),children:tc(S,void 0,n,r===!0).map(X=>{let be=X.value===""?void 0:X.value,Me=K===be;return(0,B.jsx)("button",{type:"button",className:Me?"bre-keys-chip is-selected":"bre-keys-chip","aria-pressed":Me,title:X.hint,disabled:f,onClick:()=>J(be),children:X.title},X.value)})}):null,x==="add"?(0,B.jsx)("p",{className:"bre-keys-hint",children:n("keysProtocolCreateHint")}):null,F?(0,B.jsx)("p",{className:"bre-keys-hint",children:n("keysScopeHint")}):null,F&&ue?(0,B.jsx)("p",{className:"bre-keys-hint",children:n("keysScopeAutoHint")}):null,ae.length>0&&ae.length<te.length?(0,B.jsx)("p",{className:"bre-keys-hint",children:n("keysScopeObservedHint",{count:ae.length,total:te.length})}):null,pe?(0,B.jsx)("p",{className:"bre-effort-message bre-error",role:"alert",children:n("keysAddIllegal")}):null,(0,B.jsxs)("div",{className:"bre-keys-form-actions",children:[F&&ae.length>0?(0,B.jsx)("button",{type:"button",className:"bre-link-button bre-keys-allmodels",disabled:f,onClick:()=>C(ae),children:n("keysScopeObserved",{count:ae.length})}):null,F?(0,B.jsx)("button",{type:"button",className:"bre-link-button bre-keys-allmodels",disabled:f,onClick:()=>C([]),children:n("keysScopeAll")}):null,(0,B.jsx)("button",{type:"button",className:"bre-link-button",disabled:f,onClick:re,children:n("keysCancel")}),(0,B.jsx)("button",{type:"button",className:"bre-primary-button",disabled:f||M&&!ut(y),onClick:z,children:n(x==="add"?"keysAddConfirm":"keysSave")})]})]})},ve=()=>u?.kind==="add"?(0,B.jsx)("li",{className:"bre-keys-form-row",children:fe()}):(0,B.jsx)("li",{className:"bre-keys-add-row",children:(0,B.jsxs)("button",{type:"button",className:"bre-keys-add",disabled:f,onClick:()=>{p({kind:"add"}),g(""),k(""),C([]),I(void 0)},children:[(0,B.jsx)("span",{className:"bre-keys-add-mark","aria-hidden":"true",children:(0,B.jsx)(Zl,{paths:dh})}),n("keysAdd")]})}),q=(x,M)=>{let F=M===""?void 0:M;j(void 0),ee(()=>o.setProtocol(t,x.ref,F),n("keysProtocolSaved"))},Y=N===void 0?void 0:i?.find(x=>x.ref===N.ref);if(i===void 0)return l===void 0?(0,B.jsx)("div",{className:"bre-keys","aria-busy":"true",children:(0,B.jsx)("p",{role:"status",children:n("keysLoading")})}):(0,B.jsxs)("div",{className:"bre-keys",children:[(0,B.jsx)("p",{className:"bre-effort-message bre-"+l.kind,role:l.kind==="error"?"alert":"status",children:l.text}),(0,B.jsx)("ul",{className:"bre-keys-list",children:ve()})]});let me=i.reduce((x,M)=>M.enabled?x+1:x,0);return(0,B.jsxs)("div",{className:"bre-keys",children:[(0,B.jsxs)("ul",{className:"bre-keys-list",children:[i.map(x=>{let M=ec(x),F=x.enabled&&me<=1;return(0,B.jsxs)(ce.Fragment,{children:[(0,B.jsxs)("li",{className:x.enabled?"bre-keys-row":"bre-keys-row is-off","data-state":x.configured===!1?"missing":"ready",children:[(0,B.jsx)("button",{type:"button",className:x.enabled?"bre-keys-toggle is-on":"bre-keys-toggle","aria-pressed":x.enabled,"aria-label":n(x.enabled?"keysDisable":"keysEnable",{name:M}),title:n(x.enabled?"keysDisable":"keysEnable",{name:M}),disabled:f||F,onClick:()=>{ee(()=>o.setEnabled(t,x.ref,!x.enabled),void 0)},children:(0,B.jsx)("span",{className:"bre-keys-toggle-mark","aria-hidden":"true",children:(0,B.jsx)(Zl,{paths:[lh]})})}),x.alias===void 0?null:(0,B.jsx)("span",{className:"bre-keys-alias",children:x.alias}),(0,B.jsx)("span",{className:x.alias===void 0?"bre-keys-mask bre-keys-mask-plain":"bre-keys-mask",children:ch(x,n)}),(0,B.jsx)("span",{className:W===x.ref?"bre-keys-actions is-confirming":"bre-keys-actions",children:W===x.ref?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("button",{type:"button",className:"bre-link-button bre-keys-danger",disabled:f,onClick:()=>{ee(()=>o.remove(t,x.ref),n("keysRemoved"))},children:n("keysConfirmRemove")}),(0,B.jsx)("button",{type:"button",className:"bre-link-button",disabled:f,onClick:()=>I(void 0),children:n("keysCancel")})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)("span",{className:"bre-keys-protocol-wrap",children:(0,B.jsxs)("button",{type:"button",className:"bre-keys-protocol","aria-haspopup":"listbox","aria-expanded":N?.ref===x.ref,"aria-label":n("keysProtocolLabel",{name:M}),title:n("keysProtocolLabel",{name:M}),disabled:f,onClick:V=>{let ue=V.currentTarget;j(ae=>ae?.ref===x.ref?void 0:{ref:x.ref,anchor:ue}),I(void 0)},children:[(0,B.jsx)("span",{className:"bre-keys-protocol-label",children:rc(x.protocol,n)}),(0,B.jsx)("span",{className:"bre-keys-protocol-caret","aria-hidden":"true",children:"\u203A"})]})}),(0,B.jsx)("button",{type:"button",className:"bre-link-button",disabled:f,onClick:()=>de("alias",x),children:n("keysAlias")}),r===!0?null:(0,B.jsx)("button",{type:"button",className:"bre-link-button bre-keys-scope",disabled:f,title:n("keysScope",{name:M}),onClick:()=>de("scope",x),children:uh(x,n)}),(0,B.jsx)("button",{type:"button",className:"bre-link-button",disabled:f,onClick:()=>de("value",x),children:n("keysEdit")}),(0,B.jsx)("button",{type:"button",className:"bre-link-button",disabled:f,onClick:()=>{I(x.ref),p(void 0)},children:n("keysRemove")})]})})]}),u!==void 0&&u.ref===x.ref?(0,B.jsx)("li",{className:"bre-keys-form-row",children:fe()}):null]},x.ref)}),ve()]}),r===!0?(0,B.jsx)("p",{className:"bre-keys-note",children:n("keysDraftHint")}):null,l===void 0?null:(0,B.jsx)("p",{className:"bre-effort-message bre-"+l.kind,role:l.kind==="error"?"alert":"status",children:l.text}),N===void 0||Y===void 0?null:(0,B.jsx)(Ql,{anchor:N.anchor,label:n("keysProtocolLabel",{name:ec(Y)}),options:tc(S,Y.protocol,n,r===!0),selected:Y.protocol??"",onPick:x=>q(Y,x),onClose:()=>j(void 0)})]})}var Bt="bre-key-managed",wh="bre-keys-host",fa="data-bre-key-host",vh="data-bre-key-input",To="data-bre-region",Et=new WeakMap;function xh(e){let t=e.querySelector(`input[${vh}]`);if(t instanceof HTMLInputElement)return t;let n=e.querySelector('input[type="password"]');return n instanceof HTMLInputElement?n:void 0}function oc(e){let t=Et.get(e)?.host;if(t!==void 0&&t.isConnected)return t;let n=e.nextElementSibling;return n instanceof HTMLElement&&n.hasAttribute(fa)?n:void 0}function ic(e,t){let n=t.route;if(n===void 0||n.length===0||xh(e)===void 0||e.parentElement===null)return;Se(e,Bt,!0);let r=Et.get(e),o=oc(e);o===void 0&&(r!==void 0&&ac(e,r),o=e.ownerDocument.createElement("div"),o.className=wh,e.after(o)),se(o,fa,n);let i=e.getAttribute(To);i===null?o.hasAttribute(To)&&o.removeAttribute(To):se(o,To,i);let a=()=>(0,ua.createElement)(Ie,{fallbackText:t.t("keysPanelFailed")},(0,ua.createElement)(Eo,{route:n,t:t.t,client:t.client})),s=Et.get(e);if(s!==void 0&&s.route===n){(s.t!==t.t||s.client!==t.client)&&(s.t=t.t,s.client=t.client,s.mount.root.render(a()));return}s!==void 0&&(Et.delete(e),s.mount.root.unmount()),Et.set(e,{route:n,host:o,mount:et(o,a(),{sync:!0}),t:t.t,client:t.client})}function ac(e,t){Et.delete(e),ke(t.mount)}function So(e){Se(e,Bt,!1);let t=Et.get(e);t!==void 0&&ac(e,t),oc(e)?.remove()}function sc(){for(let e of Array.from(document.querySelectorAll(`[${fa}]`))){let t=e.previousElementSibling;t instanceof HTMLElement&&Et.has(t)?So(t):e.remove()}}var dc="http://www.w3.org/2000/svg",kh="data-bre-icon";function Eh(e){let t=document.createElementNS(dc,"path");return t.setAttribute("d",e),t}function Mo(e,t){let n=document.createElementNS(dc,"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(kh,e),n.append(...t.map(Eh)),n}var qt="bre-key-field",uc="bre-key-eye",or="data-bre-key-input",fc="data-bre-eye-show",pc="data-bre-eye-hide",lc=["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"],Lo=new WeakMap,Kt=new WeakMap;function Ao(e){let t=e.querySelector(`input[${or}]`);if(t instanceof HTMLInputElement)return t;let n=e.querySelector('input[type="password"]');return n instanceof HTMLInputElement?n:void 0}function ma(e){for(let t of Array.from(e.children))if(t instanceof HTMLButtonElement&&t.classList.contains(uc))return t}function mc(e){let t=Ao(e);t!==void 0&&(se(t,or,""),Se(e,qt,!0))}function gc(e,t){let n=Ao(e);if(n===void 0){vn(e);return}Lo.get(e)?.route!==t.route&&Kt.delete(e),Lo.set(e,t),se(n,or,""),Se(e,qt,!0);let r=ma(e)??Sh(e);se(r,fc,t.t("keyRevealShow")),se(r,pc,t.t("keyRevealHide")),pa(r,n)}function vn(e){let t=ma(e);t!==void 0&&t.remove(),Lo.delete(e),Se(e,qt,!1);let n=e.querySelector(`input[${or}]`);n instanceof HTMLInputElement&&(n.removeAttribute(or),n.type="password");let r=Kt.get(e);Kt.delete(e),r!==void 0&&n instanceof HTMLInputElement&&n.value===r&&ir(n,"")}async function Th(e){try{let t=await fetch(`${Sr}?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 pa(e,t){let n=t.type!=="password";se(e,"aria-pressed",n?"true":"false");let r=e.getAttribute(n?pc:fc);r!==null&&(se(e,"aria-label",r),se(e,"title",r)),tt(e,t.disabled)}function ir(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 Sh(e){let t=document.createElement("button");t.type="button",t.className=uc,t.append(cc("eye"),cc("eye-off"));let n=async()=>{let r=Ao(e),o=Lo.get(e);if(r===void 0||o===void 0||t.hasAttribute("aria-busy"))return;if(r.type!=="password"){let a=Kt.get(e);Kt.delete(e),a!==void 0&&r.value===a&&ir(r,""),r.type="password",pa(t,r);return}let i=o.route;if(i!==void 0&&Kt.get(e)===void 0&&r.value.length===0){se(t,"aria-busy","true");let a;try{a=await(o.loadKey??Th)(i)}catch{a=void 0}if(t.hasAttribute("aria-busy")&&t.removeAttribute("aria-busy"),a===void 0){let s=o.t("keyRevealFailed");se(t,"aria-label",s),se(t,"title",s);return}if(ma(e)!==t||!t.isConnected||Ao(e)!==r||r.value.length>0)return;Kt.set(e,a),ir(r,a)}r.type="text",pa(t,r)};return t.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation(),n()}),e.append(t),t}function cc(e){let t=e==="eye-off"?[...lc,"M2.5 13.5 13.5 2.5"]:lc;return Mo(e,t)}var ha="bre-editor-tabs",Mh="bre-editor-tab",Ro="data-bre-tab-id",sr="bre-tabbed",St="data-bre-tab",hc="data-bre-provider",$e="data-bre-region",ar="data-bre-editor-body",Tn="data-bre-footer",Lh="row",Ah="path",dr="data-bre-details";var Rh=".bre-headers",Hh=".bre-fingerprint",Ch="data-bre-fingerprint",Tt="provider",xn="models",kn="fingerprint",En="advanced",Nh=[Tt,xn,En,kn],Ih="none",bc=Nh,yc=ha,wc=Mh,vc=Ro,Ho='[class*="editorActions"], [class*="modelList"], [class*="modelCatalog"], [class*="modelEntry"]',Ph='[class*="modelCatalog"], [class*="modelList"], [class*="modelEntry"]',xc='[class*="rowCard"], [class*="addCard"], li',Dh='[class*="addPanel"]',ga=".bre-create-host";function kc(){return{warned:new WeakSet}}function Sn(e){return e===null?null:e.closest(xc)}function Ec(e){let t=Sn(e);return t!==null&&t.querySelector(ga)!==null}function Tc(e){for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.matches(Dh)&&!t.hidden)return t;return e}function Sc(e,t){let n=oo(e),r=e.getBoundingClientRect().top,o=n?.scrollTop??0;n!==void 0&&(n.style.overflowAnchor="none"),se(e,St,t),Ac(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 ba(e,t,n){if(!e.isConnected)return;let r=new Set;for(let o of Array.from(e.querySelectorAll(Ho))){let i=o.closest(xc);i!==null&&r.add(i)}for(let o of Array.from(e.querySelectorAll(`.${sr}`)))r.has(o)||Co(o);for(let o of r)try{qh(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)),Co(o)}}function Mc(){for(let e of Array.from(document.querySelectorAll(`.${sr}`))){e.classList.remove(sr),e.removeAttribute(St),e.removeAttribute(ar);for(let t of Array.from(e.querySelectorAll(`[${$e}]`)))t.removeAttribute($e)}for(let e of Array.from(document.querySelectorAll(`[${St}]`)))e.removeAttribute(St);for(let e of Array.from(document.querySelectorAll(`[${$e}]`)))e.removeAttribute($e);for(let e of Array.from(document.querySelectorAll(`[${ar}]`)))e.removeAttribute(ar);for(let e of Array.from(document.querySelectorAll(`[${Tn}]`)))e.removeAttribute(Tn);for(let e of Array.from(document.querySelectorAll(`details[${dr}]`)))e.removeAttribute("open"),e.removeAttribute(dr);for(let e of Array.from(document.querySelectorAll(`.${qt}`)))vn(e);for(let e of Array.from(document.querySelectorAll(`.${Bt}`)))So(e);sc()}function Oh(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(Ho)!==null||n.querySelector("input, select")!==null))return n;let t=e.querySelector(Ho);for(;t!==null&&t.parentElement!==e;)t=t.parentElement;return t!==null&&t!==e?t:void 0}function _h(e){let t={header:void 0,models:void 0,actions:void 0,fields:[]};Lc(e,t,0);let{actions:n,fields:r,header:o,models:i}=t;if(!(n===void 0||r.length===0)&&r.some(a=>a.querySelector("input, select, textarea")!==null))return{header:o,models:i,actions:n,fields:r}}var Fh=4;function Lc(e,t,n){if(!(n>Fh)){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(Ph)){t.models??(t.models=r);continue}if(r.querySelector(Ho)!==null){Lc(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 Bh(e,t){if(!t.contains(e))return;se(e,Tn,Lh);let n=e.parentElement;for(;n!==null&&(se(n,Tn,Ah),n!==t);)n=n.parentElement}function Kh(e){let n=e.querySelector(`[${hc}]`)?.getAttribute(hc);return n==null||n===""?void 0:n}function qh(e,t){let n=Tc(e),r=Oh(n);if(r===void 0){Co(e);return}let o=_h(r);if(o===void 0){Co(e);return}let i=n.querySelector(Rh),a=Kh(n);for(let f of o.fields)se(f,$e,Tt),gc(f,{t:t.t,route:a}),ic(f,{t:t.t,route:a});o.header!==void 0&&se(o.header,$e,Ih),o.models!==void 0&&se(o.models,$e,xn),se(r,ar,""),n.querySelector(ga)!==null&&Bh(o.actions,r),i!==null&&se(i,$e,En);let s=n.querySelector(Hh);s!==null&&se(s,$e,kn),Wh(r);let d=new Set([Tt]);o.models!==void 0&&d.add(xn),i!==null&&d.add(En);let l=n.querySelector(ga)!==null;s!==null&&!l&&s.getAttribute(Ch)==="ready"&&d.add(kn);let c=e.getAttribute(St)??Tt;se(e,St,d.has(c)?c:Tt),Se(e,sr,!0),Gh(e,n,t,d)}function Gh(e,t,n,r){let o=t.querySelector(`.${ha}`);o!==null&&(se(o,"aria-label",n.t("editorTabsLabel")),Vn(Gt(o,Tt),n.t("editorTabProvider")),Vn(Gt(o,xn),n.t("editorTabModels")),Vn(Gt(o,En),n.t("editorTabAdvanced")),Vn(Gt(o,kn),n.t("editorTabFingerprint")),tt(Gt(o,xn),!r.has(xn)),tt(Gt(o,En),!r.has(En)),tt(Gt(o,kn),!r.has(kn)),Ac(e,o))}function Ac(e,t){let n=t??Tc(e).querySelector(`.${ha}`);if(n===null)return;let r=e.getAttribute(St)??Tt;for(let o of Array.from(n.querySelectorAll(`[${Ro}]`)))se(o,"aria-selected",o.getAttribute(Ro)===r?"true":"false")}function Gt(e,t){for(let n of Array.from(e.children))if(n instanceof HTMLElement&&n.getAttribute(Ro)===t)return n}function Co(e){e.classList.remove(sr),e.removeAttribute(St),e.removeAttribute(ar);for(let t of Array.from(e.querySelectorAll(`[${$e}]`)))t.getAttribute($e)===Tt&&(vn(t),So(t)),t.removeAttribute($e);for(let t of Array.from(e.querySelectorAll(`[${Tn}]`)))t.removeAttribute(Tn);zh(e)}function Wh(e){for(let t of Array.from(e.querySelectorAll("details")))t.hasAttribute("open")||(se(t,dr,"closed"),se(t,"open",""))}function zh(e){for(let t of Array.from(e.querySelectorAll(`details[${dr}]`)))t.removeAttribute("open"),t.removeAttribute(dr)}var pu=require("react");var Oe=require("react");var he=require("react");var Uh='p[class*="savedNotice"]',Cc="data-bre-saved-hidden",jh="bre-auto-effort-note",$h="data-bre-auto-effort-phase",Rc="bre-auto-effort-note-text",Mn=new Map,Hc=new WeakMap,Ln=null,No=null;function Nc(e){let t=Array.from(e.querySelectorAll(Uh));for(let n of t){let r=n.textContent?.trim()??"";Hc.get(n)!==r&&(Hc.set(n,r),r.length>0&&Oc(r)),!Mn.has(n)&&(Mn.set(n,n.style.display),n.setAttribute(Cc,""),n.style.display="none")}for(let[n,r]of Array.from(Mn))n.isConnected&&t.includes(n)||(Pc(n,r),Mn.delete(n))}function Ic(){for(let[e,t]of Array.from(Mn))Pc(e,t);Mn.clear(),ya()}function Pc(e,t){e.style.display=t,e.removeAttribute(Cc)}function Dc(e){Oc(e)}function Oc(e){if(Ln!==null&&Ln.isConnected&&Ln.textContent===e)return;ya();let t=document.createElement("div");t.className=jh,t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute($h,"done"),t.innerHTML=`<span class="${Rc}"></span>`;let n=t.querySelector(`.${Rc}`);n!==null&&(n.textContent=e),t.style.setProperty("--bre-note-hold","3000ms"),document.body.append(t),Ln=t,No=setTimeout(()=>{ya()},3e3)}function ya(){No!==null&&(clearTimeout(No),No=null),Ln?.remove(),Ln=null}var Wt="data-bre-settle",_c='[class*="rowActions"] > button:not(.bre-provider-switch):not(.bre-provider-delete)';var lt=null,wa=0,Io=0,lr=!1,An=null;function Fc(e){return e.className.includes("dangerButton")?"remove":"edit"}function va(e,t){return Array.from(e.querySelectorAll(_c)).find(r=>Fc(r)===t)??null}function Vh(e){return typeof requestAnimationFrame=="function"?requestAnimationFrame(e):setTimeout(e,16)}function Yh(e){typeof cancelAnimationFrame=="function"?cancelAnimationFrame(e):clearTimeout(e)}function Bc(e=document){cr();let t=[];for(let n of Array.from(e.querySelectorAll(_c))){if(n.disabled)continue;let r=n.closest("li")??n.parentElement;if(r===null)continue;let o=Fc(n);t.some(i=>i.row===r&&i.role===o)||t.push({row:r,role:o})}t.length!==0&&(lt=t,Io=Date.now(),wa=Io+8e3,Xh(),Kc())}function xa(){if(lt===null)return;let e=Date.now();if(e>wa){cr();return}let t=0;if(lt=lt.filter(n=>{if(!n.row.isConnected)return!1;let r=va(n.row,n.role);return r===null||(r.disabled?(lr=!0,t+=1,r.hasAttribute(Wt)||r.setAttribute(Wt,"")):lr&&r.hasAttribute(Wt)&&r.removeAttribute(Wt)),!0}),lr&&t===0){cr();return}if(!lr&&e-Io>1500){cr();return}Kc()}function Kc(){An!==null||lt===null||(An=Vh(()=>{An=null,xa()}))}function Xh(){if(lt!==null)for(let e of lt){let t=va(e.row,e.role);t!==null&&!t.hasAttribute(Wt)&&t.setAttribute(Wt,"")}}function qc(){cr()}function cr(){if(An!==null&&(Yh(An),An=null),lt!==null)for(let e of lt){let t=va(e.row,e.role);t!==null&&t.removeAttribute(Wt)}lt=null,lr=!1,wa=0,Io=0}var U=require("react/jsx-runtime"),Jh=["claude-cli/2.1.161 (external, cli)","claude-code/1.0.0","Kilo-Code/1.0"];function Gc(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 Wc(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 Po({route:e,api:t,t:n,onDismiss:r,deferred:o}){let i=(0,he.useId)(),[a,s]=(0,he.useState)(void 0),[d,l]=(0,he.useState)({rows:[]}),[c,f]=(0,he.useState)(!1),[m,u]=(0,he.useState)(!1),[p,h]=(0,he.useState)(!0),[g,y]=(0,he.useState)(!1),[k,w]=(0,he.useState)(!1),[C,K]=(0,he.useState)(void 0),[J,W]=(0,he.useState)(void 0),[I,N]=(0,he.useState)(!1),j=(0,he.useRef)(0),S=(0,he.useRef)(null),R=o!==void 0,_=o?.onDraft,b=(0,he.useRef)(void 0);(0,he.useEffect)(()=>{if(R&&b.current!==void 0)return;b.current=e;let q=!0;return(async()=>{try{let Y=await ie(t);if(!q)return;let me=vi(Y.namespace,e);s(me),l(Gc(me,j)),w(Y.writable!==!0)}catch{q&&w(!0)}finally{q&&h(!1)}})(),()=>{q=!1}},[t,e,R]),(0,he.useEffect)(()=>{_!==void 0&&_(Wc(d))},[d,_]),(0,he.useEffect)(()=>{let q=!0;return(async()=>{try{let me=await(await fetch(ns,{method:"GET"})).json();q&&me.ok===!0&&me.data!==void 0&&W(me.data)}catch{}})(),()=>{q=!1}},[]),(0,he.useEffect)(()=>{let q=S.current;if(q===null)return;let Y=()=>{N(q.dataset.breRegion==="advanced")};Y();let me=new MutationObserver(Y);return me.observe(q,{attributes:!0,attributeFilter:["data-bre-region"]}),()=>{me.disconnect()}},[]);let L=()=>{l(q=>({...q,rows:[...q.rows,{id:j.current+=1,name:"",value:""}]})),K(void 0)},H=(q,Y)=>{l(me=>({...me,rows:me.rows.map(x=>x.id===q?{...x,...Y}:x)})),K(void 0)},ne=q=>{l(Y=>({...Y,rows:Y.rows.filter(me=>me.id!==q)})),K(void 0)},$=()=>{l({rows:[{id:j.current+=1,name:"",value:""}]}),K(void 0)},re=()=>{if(l(Gc(a,j)),u(!1),K(void 0),o!==void 0){o.onCancel();return}I&&r?.()},ee=async q=>{y(!0),K(void 0),Bc();let Y;try{Y=await Un(t,e,q)}catch(x){Y={ok:!1,error:x instanceof Error?x.message:String(x)}}if(y(!1),!Y.ok){K({kind:"error",text:Y.error==="no-route"?n("headersNoRoute"):Y.error==="read-only"?n("headersReadOnly"):n("headersError",{error:Y.error})});return}s(q),u(!1);let me=Object.keys(q).length===0?n("headersCleared"):n("headersSaved");if(I){Dc(me),r?.();return}K({kind:"success",text:me})},de=Object.entries(a??{}),z=k||g,Z=I||R,te=m||Z?d.rows.filter(q=>q.name.trim().length>0).length:de.length,fe=d.rows.some(q=>q.name.trim().length>0||q.value.length>0),ve=c||m||Z;return(0,U.jsxs)("div",{className:"bre-headers",ref:S,"data-plugin":we,"data-open":c?"1":"0",children:[(0,U.jsx)("div",{className:"bre-headers-head",children:m||Z?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("span",{className:"bre-effort-title",children:n("headersTitle")}),te===0?null:(0,U.jsx)("span",{className:"bre-headers-count",children:te}),k||!fe?null:(0,U.jsx)("button",{type:"button",className:"bre-headers-clear",disabled:z,onClick:$,children:n("headersClear")})]}):(0,U.jsxs)("button",{type:"button",className:"bre-headers-disclosure","aria-expanded":c,"aria-label":`${n("headersTitle")} ${e}`,onClick:()=>{f(!c),K(void 0)},children:[(0,U.jsx)("span",{className:"bre-effort-title",children:n("headersTitle")}),p||te===0?null:(0,U.jsx)("span",{className:"bre-headers-count",children:te}),(0,U.jsx)("span",{className:"bre-headers-chevron","aria-hidden":"true",children:"\u203A"})]})}),ve?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)("p",{className:"bre-effort-note",children:n("headersHint")}),J===void 0?null:(0,U.jsxs)(U.Fragment,{children:[J.environment.preferOfficialLayer?(0,U.jsx)("p",{className:"bre-effort-note bre-warn",children:n("headersConflictPatched")}):null,J.conflicts.length===0&&(J.headerConflicts?.length??0)===0?null:(0,U.jsx)("p",{className:"bre-effort-note bre-warn",children:n("headersConflictOrigin")}),J.environment.siblings.length===0?null:(0,U.jsx)("p",{className:"bre-effort-note bre-warn",children:n("headersConflictSiblings",{names:J.environment.siblings.map(q=>q.name).join(", ")})})]}),p?null:m||Z?(0,U.jsxs)("div",{className:"bre-headers-edit",children:[(0,U.jsxs)("div",{className:"bre-headers-columns","aria-hidden":"true",children:[(0,U.jsx)("span",{children:n("headersName")}),(0,U.jsx)("span",{children:n("headersValue")}),(0,U.jsx)("span",{})]}),d.rows.map(q=>(0,U.jsxs)("div",{className:"bre-headers-row",children:[(0,U.jsx)("input",{type:"text",className:"bre-text-input bre-headers-name",value:q.name,disabled:z,placeholder:n("headersNamePlaceholder"),"aria-label":n("headersName"),onChange:Y=>{H(q.id,{name:Y.target.value})}}),(0,U.jsx)("input",{type:"text",className:"bre-text-input bre-headers-value",value:q.value,disabled:z,list:q.name.trim().toLowerCase()==="user-agent"?i:void 0,placeholder:n("headersValue"),"aria-label":n("headersValue"),onChange:Y=>{H(q.id,{value:Y.target.value})}}),(0,U.jsx)("button",{type:"button",className:"bre-headers-remove",disabled:z,"aria-label":`${n("headersRemove")} ${q.name}`,title:n("headersRemove"),onClick:()=>{ne(q.id)},children:"\xD7"})]},q.id)),(0,U.jsx)("button",{type:"button",className:"bre-headers-add",disabled:z,onClick:L,children:n("headersAdd")}),(0,U.jsx)("datalist",{id:i,children:Jh.map(q=>(0,U.jsx)("option",{value:q},q))})]}):(0,U.jsxs)("div",{className:"bre-headers-rows",children:[de.length===0?(0,U.jsx)("p",{className:"bre-effort-note",children:n("headersEmpty")}):de.map(([q,Y])=>(0,U.jsxs)("div",{className:"bre-headers-row",children:[(0,U.jsx)("span",{className:"bre-headers-name",children:q}),(0,U.jsx)("span",{className:"bre-headers-value bre-headers-masked",children:"\u2022".repeat(Math.min(Y.length,24))})]},q)),k?null:(0,U.jsx)("div",{className:"bre-effort-actions",children:(0,U.jsx)("button",{type:"button",className:"bre-secondary-button",disabled:z,onClick:()=>{u(!0),K(void 0)},children:n("headersEdit")})})]})]}):null,!p&&(Z||m)?(0,U.jsxs)("div",{className:"bre-effort-actions bre-headers-actions",children:[(0,U.jsx)("button",{type:"button",className:"bre-secondary-button",disabled:g,onClick:re,children:n("headersCancel")}),R?null:(0,U.jsx)("button",{type:"button",className:"bre-primary-button",disabled:z,onClick:()=>{ee(Wc(d))},children:n("headersSave")})]}):null,C===void 0?null:(0,U.jsx)("p",{className:"bre-effort-message bre-"+C.kind,role:C.kind==="error"?"alert":"status",children:C.text})]})}var ka=require("react");var Qh={provider:"editorTabProvider",models:"editorTabModels",fingerprint:"editorTabFingerprint",advanced:"editorTabAdvanced"};function Do({host:e,t}){return(0,ka.createElement)("div",{className:yc,role:"tablist","aria-label":t("editorTabsLabel")},...bc.map(n=>(0,ka.createElement)("button",{key:n,type:"button",role:"tab",className:wc,[vc]:n,onClick:r=>{r.preventDefault(),r.stopPropagation();let o=Sn(e.current);o!==null&&Sc(o,n)}},t(Qh[n]))))}var Zh=15e3;function Uc(){return{intents:new Map,baseline:new Map,flushing:!1}}function Ea(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 Ta(e,t){e.intents.delete(t)}function jc(e,t){let n=e.intents.get(t);n!==void 0&&(n.releasedAt=Date.now())}function $c(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 Vc(e,t){return t.length>0&&!e.baseline.has(t)}async function Yc(e,t){if(e.flushing)return zc(e);if(e.intents.size===0)return 0;e.flushing=!0;try{let n=await ie(t),r,o=async a=>ze(n.namespace,a)?!0:(r??(r=await ie(t,{fresh:!0})),ze(r.namespace,a)),i=Date.now();for(let[a,s]of Array.from(e.intents)){if(s.declaredBefore===void 0){s.releasedAt!==void 0&&s.noted!==!0&&(s.noted=!0,console.warn("[bre] deferred request headers: nobody said whether this id existed before, so the draft is held:",a));continue}if(s.declaredBefore){e.intents.delete(a);continue}if(!await o(a)){s.releasedAt!==void 0&&i-s.releasedAt>Zh?(e.intents.delete(a),console.info("[bre] deferred request headers: gave up on a draft whose card closed first:",a)):s.releasedAt!==void 0&&console.info("[bre] deferred request headers: waiting for the closed card to declare",a);continue}console.info("[bre] deferred request headers: the route is declared, writing the held draft:",a);let d;try{d=await Un(t,a,s.headers)}catch(l){d={ok:!1,error:l instanceof Error?l.message:String(l)}}if(d.ok){e.intents.delete(a),console.info("[bre] deferred request headers: saved",a,Object.keys(s.headers).length,"header(s)");continue}d.error!=="no-route"&&(e.intents.delete(a),console.error("[bre] deferred request headers: the write was refused:",d.error,a))}}catch(n){console.error("[bre] deferred request headers: could not read the settings document:",n)}finally{e.flushing=!1}return zc(e)}function zc(e){let t=0;for(let n of e.intents.values())n.releasedAt!==void 0&&(t+=1);return t}var zt=require("react/jsx-runtime");function Jc({host:e,api:t,t:n,routeIdLabels:r,staged:o}){let[i,a]=(0,Oe.useState)(()=>ur(e.current,r)),s=(0,Oe.useRef)(i),d=(0,Oe.useRef)(void 0),l=(0,Oe.useRef)(new Set),c=(0,Oe.useRef)(!1),f=(0,Oe.useRef)(null);return f.current===null&&(f.current={onDraft:m=>{d.current=m;let u=s.current;if(u.length===0){!c.current&&Object.keys(m).length>0&&(c.current=!0,console.info("[bre] deferred request headers: holding a draft until the provider id is typed"));return}Ea(o,u,m),Xc(t,o,u,l.current)},onCancel:()=>{d.current=void 0,Ta(o,s.current)}}),(0,Oe.useEffect)(()=>{let m=Oo(e.current);if(m===null)return;let u=()=>{a(ur(e.current,r))};return m.addEventListener("input",u,!0),()=>{m.removeEventListener("input",u,!0)}},[e,r]),(0,Oe.useEffect)(()=>{i.length>0&&Xc(t,o,i,l.current)},[t,o,i]),(0,Oe.useEffect)(()=>{let m=s.current;if(m===i)return;Ta(o,m),s.current=i;let u=d.current;u!==void 0&&i.length>0&&Ea(o,i,u)},[i,o]),(0,Oe.useEffect)(()=>()=>{jc(o,s.current)},[o]),(0,zt.jsxs)(zt.Fragment,{children:[(0,zt.jsx)(Do,{host:e,t:n}),(0,zt.jsx)(Po,{route:i,api:t,t:n,deferred:f.current})]})}function Xc(e,t,n,r){!Vc(t,n)||r.has(n)||(r.add(n),(async()=>{try{let o=await ie(e);$c(t,n,ze(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 Oo(e){let t=e?.parentElement;return t==null?null:t.parentElement?.closest('[class*="addCard"]')??t}function ur(e,t){let n=e?.parentElement;if(n==null)return"";let r=t(),o=De(n,r).trim();if(o.length>0)return o;let i=Oo(e);return i===null||i===n?"":De(i,r).trim()}var Aa=require("react");var _e=require("react");var fr=15e3,eb=3;function Zc(){return{intents:new Map,baseline:new Map,baselinePending:new Set,baselineFailures:new Set,activeIntents:new Map,draining:!1,drainAgain:!1}}function Sa(e,t,n){if(t.length===0)return;if(n.length===0){Ma(e,t);return}let r=e.intents.get(t);if(r===void 0){let o=e.activeIntents.get(t);e.intents.set(t,{drafts:[...n],landed:o?.landed??[],revision:0,declaredBefore:e.baseline.get(t),attempts:0}),e.draining&&(e.drainAgain=!0);return}tb(r.drafts,n)||(r.drafts=[...n],r.revision+=1,r.baselineMissing=!1,e.draining&&(e.drainAgain=!0))}function tb(e,t){return e.length===t.length&&e.every((n,r)=>{let o=t[r];return o!==void 0&&n.ref===o.ref&&n.value===o.value&&n.alias===o.alias&&n.protocol===o.protocol&&n.enabled===o.enabled})}function Ma(e,t){e.intents.delete(t),e.draining&&(e.drainAgain=!0)}function eu(e,t){let n=e.intents.get(t);n!==void 0&&(n.releasedAt=Date.now())}function La(e,t,n){if(t.length===0)return;e.baseline.has(t)||e.baseline.set(t,n),e.baselinePending.delete(t),e.baselineFailures.delete(t);let r=e.intents.get(t);r!==void 0&&(r.declaredBefore=e.baseline.get(t),r.baselineMissing=!1),e.draining&&(e.drainAgain=!0)}function tu(e,t){return nb(e,t)?(e.baselinePending.add(t),!0):!1}function nu(e,t){e.baselinePending.delete(t),e.baseline.has(t)||e.baselineFailures.add(t),e.draining&&(e.drainAgain=!0)}function nb(e,t){return t.length>0&&!e.baseline.has(t)&&!e.baselinePending.has(t)&&!e.baselineFailures.has(t)}async function ru(e,t,n){if(e.draining)return Qc(e);if(e.intents.size===0)return 0;e.draining=!0;try{do{e.drainAgain=!1;let r=await ie(t),o,i=async s=>ze(r.namespace,s)?!0:(o??(o=await ie(t,{fresh:!0})),ze(o.namespace,s)),a=Date.now();for(let[s,d]of Array.from(e.intents)){if(e.intents.get(s)!==d)continue;let l=d.revision;e.activeIntents.set(s,d);try{if(d.declaredBefore===void 0){if(e.baselinePending.has(s)){d.releasedAt!==void 0&&a-d.releasedAt>fr&&(e.intents.delete(s),console.error("[bre] deferred api keys: the pre-save baseline timed out; refusing to write held keys:",s));continue}if(e.baselineFailures.has(s)){let m=await i(s);if(e.intents.get(s)!==d)continue;if(d.revision!==l||d.declaredBefore!==void 0){e.drainAgain=!0;continue}m?(d.baselineMissing=!0,d.noted!==!0&&(d.noted=!0,console.error("[bre] deferred api keys: the pre-save baseline failed and this route now exists; refusing to guess ownership:",s)),d.releasedAt!==void 0&&a-d.releasedAt>fr&&(e.intents.delete(s),console.error("[bre] deferred api keys: the pre-save baseline remained unknown; refusing to write held keys:",s))):(La(e,s,!1),d.releasedAt!==void 0&&a-d.releasedAt>fr&&(e.intents.delete(s),console.info("[bre] deferred api keys: gave up on drafts whose card closed first:",s)));continue}d.baselineMissing=!0,d.noted!==!0&&(d.noted=!0,console.error("[bre] deferred api keys: no pre-save baseline is available; refusing to write held keys:",s)),d.releasedAt!==void 0&&a-d.releasedAt>fr&&e.intents.delete(s);continue}if(d.declaredBefore){e.intents.delete(s);continue}let c=await i(s);if(e.intents.get(s)!==d)continue;if(d.revision!==l){e.drainAgain=!0;continue}if(!c){d.releasedAt!==void 0&&a-d.releasedAt>fr&&(e.intents.delete(s),console.info("[bre] deferred api keys: gave up on drafts whose card closed first:",s));continue}let f=await rb(e,s,d,n);if(e.intents.get(s)!==d||d.revision!==l)continue;f&&(e.intents.delete(s),console.info("[bre] deferred api keys: the route is declared, saved the held key list:",s))}finally{e.activeIntents.get(s)===d&&e.activeIntents.delete(s)}}}while(e.drainAgain&&e.intents.size>0)}catch(r){console.error("[bre] deferred api keys: could not read the settings document:",r)}finally{e.draining=!1}return Qc(e)}async function rb(e,t,n,r){let o=n.revision,i=[...n.drafts],a=!1,s=!1,d=()=>e.intents.get(t)!==n?!0:n.revision!==o?(e.drainAgain=!0,!0):!1,l=()=>{a=!0,n.attempts+=1};for(let c of i){if(d())return!1;let f=n.landed.find(m=>m.ref===c.ref);if(f===void 0){let m=await r.add(t,c.value,c.alias);if(!m.ok){if(d())return!1;l();break}let p=(m.addedRef!==void 0&&m.entries.some(w=>w.ref===m.addedRef)?m.addedRef:void 0)??m.entries.map(w=>w.ref).find(w=>!n.landed.some(C=>C.hostRef===w));if(p===void 0){if(d())return!1;l();break}let h=m.entries.find(w=>w.ref===p),{alias:g,protocol:y,...k}=c;if(f={ref:c.ref,hostRef:p,draft:{...k,...h?.alias===void 0?{}:{alias:h.alias},...h?.protocol===void 0?{}:{protocol:h.protocol},enabled:h?.enabled??!0}},n.landed.push(f),s=!0,d())return!1;continue}if(f.draft.value!==c.value){if(!(await r.replace(t,f.hostRef,c.value)).ok){if(d())return!1;l();break}if(f.draft={...f.draft,value:c.value},s=!0,d())return!1}if(f.draft.alias!==c.alias){let{alias:m,...u}=f.draft;if(!(await r.rename(t,f.hostRef,c.alias)).ok){if(d())return!1;l();break}if(f.draft={...u,...c.alias===void 0?{}:{alias:c.alias}},s=!0,d())return!1}}if(!a)for(let c of i){if(d())return!1;let f=n.landed.find(h=>h.ref===c.ref);if(f===void 0||f.draft.protocol===c.protocol)continue;if(!(await r.setProtocol(t,f.hostRef,c.protocol)).ok){if(d())return!1;l();break}let{protocol:u,...p}=f.draft;if(f.draft={...p,...c.protocol===void 0?{}:{protocol:c.protocol}},s=!0,d())return!1}if(!a)for(let c of[!0,!1]){for(let f of i){if(d())return!1;if(f.enabled!==c)continue;let m=n.landed.find(p=>p.ref===f.ref);if(m===void 0||m.draft.enabled===c)continue;if(!(await r.setEnabled(t,m.hostRef,c)).ok){if(d())return!1;l();break}if(m.draft={...m.draft,enabled:c},s=!0,d())return!1}if(a)break}return a?(s&&(n.attempts=0),n.attempts>=eb?(console.error("[bre] deferred api keys: the write was refused; giving up on the held key list:",t),!0):!1):(n.attempts=0,!d())}function Qc(e){let t=0;for(let n of e.intents.values())n.releasedAt!==void 0&&(t+=1);return t}var ob={openai:null,anthropic:null};function ib(e){let t=new Set(e.map(n=>n.ref));for(let n=1;n<=999;n+=1){let r=`key-${n}`;if(!t.has(r))return r}return`key-${Date.now()}`}function ou(e,t){let n=()=>({ok:!0,route:"",entries:e.drafts.map(a=>({ref:a.ref,...a.alias===void 0?{}:{alias:a.alias},enabled:a.enabled,configured:!0,masked:Ud(a.value),...a.protocol===void 0?{}:{protocol:a.protocol}})),endpoints:ob}),r=a=>(t.onChange(e.drafts),{...n(),...a===void 0?{}:{addedRef:a}}),o=a=>e.drafts.find(s=>s.ref===a),i=(a,s)=>(e.drafts=e.drafts.map(d=>d.ref===a?s:d),r());return{list:async()=>n(),cached:()=>n(),add:async(a,s,d)=>{if(!ut(s))return{ok:!1,error:t.t("keysAddIllegal")};let l=ib(e.drafts);return e.drafts=[...e.drafts,{ref:l,value:s,enabled:!0,...d===void 0?{}:{alias:d}}],r(l)},rename:async(a,s,d)=>{let l=o(s);if(l===void 0)return{ok:!1};let{alias:c,...f}=l;return i(s,{...f,...d===void 0?{}:{alias:d}})},replace:async(a,s,d)=>{let l=o(s);return l===void 0||!ut(d)?{ok:!1,error:t.t("keysAddIllegal")}:i(s,{...l,value:d})},remove:async(a,s)=>(e.drafts=e.drafts.filter(d=>d.ref!==s),r()),setScope:async()=>n(),setEnabled:async(a,s,d)=>{let l=o(s);return l===void 0?{ok:!1}:!d&&!e.drafts.some(c=>c.ref!==s&&c.enabled)?{ok:!1,error:t.t("keysLastEnabledOff")}:i(s,{...l,enabled:d})},setProtocol:async(a,s,d)=>{let l=o(s);if(l===void 0)return{ok:!1};let{protocol:c,...f}=l;return i(s,{...f,...d===void 0?{}:{protocol:d}})},setEndpoints:async()=>n(),reveal:async(a,s)=>o(s)?.value}}var au=require("react/jsx-runtime");function iu({host:e,store:t,api:n,t:r,routeIdLabels:o,staged:i,onChange:a}){let[s,d]=(0,_e.useState)(()=>ur(e.current,o)),l=(0,_e.useRef)(s),c=(0,_e.useRef)(new Set),f=(0,_e.useRef)(!1),m=(0,_e.useMemo)(()=>ou(t,{t:r,onChange:u=>{a?.(u);let p=l.current;if(p.length===0){!f.current&&u.length>0&&(f.current=!0,console.info("[bre] deferred api keys: holding the list until the provider id is typed"));return}Sa(i,p,u)}}),[a,i,t,r]);return(0,_e.useEffect)(()=>{let u=Oo(e.current);if(u===null)return;let p=()=>{d(ur(e.current,o))};return u.addEventListener("input",p,!0),()=>{u.removeEventListener("input",p,!0)}},[e,o]),(0,_e.useEffect)(()=>{s.length>0&&ab(n,i,s,c.current)},[n,i,s]),(0,_e.useEffect)(()=>{let u=l.current;u!==s&&(Ma(i,u),l.current=s),t.drafts.length>0&&s.length>0&&Sa(i,s,t.drafts)},[s,i,t]),(0,_e.useEffect)(()=>()=>{eu(i,l.current)},[i]),(0,au.jsx)(Eo,{route:s,t:r,client:m,draft:!0})}function ab(e,t,n,r){r.has(n)||!tu(t,n)||(r.add(n),(async()=>{try{let o=await ie(e);La(t,n,ze(o.namespace,n))}catch(o){nu(t,n),console.warn("[bre] deferred api keys: could not read the settings document for this route:",o)}})())}var Fo="data-bre-create-keys",sb="bre-keys-host",db="data-bre-key-input",_o="data-bre-region",Rn=new WeakMap;function su(e){let t=e.querySelector(`input[${db}]`);if(t instanceof HTMLInputElement)return t;let n=e.querySelector('input[type="password"]');return n instanceof HTMLInputElement?n:void 0}function du(e){let t=Rn.get(e)?.host;if(t!==void 0&&t.isConnected)return t;let n=e.nextElementSibling;return n instanceof HTMLDivElement&&n.hasAttribute(Fo)?n:void 0}function lu(e,t){if(e.closest(`[${Fo}]`)!==null){Hn(e);return}let n=su(e);if(n===void 0){Hn(e);return}if(e.parentElement===null)return;Se(e,Bt,!0);let r=Rn.get(e),o=du(e);o===void 0&&(r!==void 0&&Ra(e,r),o=e.ownerDocument.createElement("div"),o.className=sb,e.after(o)),se(o,Fo,"");let i=e.getAttribute(_o);if(i===null?o.hasAttribute(_o)&&o.removeAttribute(_o):se(o,_o,i),r!==void 0&&r.host===o)return;r!==void 0&&Ra(e,r);let a={drafts:ut(n.value)?[{ref:"key-1",value:n.value,enabled:!0}]:[]},s=o,d=et(o,t.refreshed(()=>(0,Aa.createElement)(Ie,{fallbackText:t.t("keysPanelFailed")},(0,Aa.createElement)(iu,{host:{current:s},store:a,api:t.api,t:t.t,routeIdLabels:t.routeIdLabels,staged:t.staged,onChange:l=>{let c=su(e);if(c===void 0||c.disabled)return;let f=l.find(m=>m.enabled)?.value??"";c.value!==f&&ir(c,f)}}))),{sync:!0});Rn.set(e,{host:o,mount:d})}function Ra(e,t){Rn.delete(e),ke(t.mount)}function Hn(e){Se(e,Bt,!1);let t=Rn.get(e);t!==void 0&&Ra(e,t),du(e)?.remove()}function cu(){for(let e of Array.from(document.querySelectorAll(`[${Fo}]`))){let t=e.previousElementSibling;t instanceof HTMLElement&&Rn.has(t)?Hn(t):e.remove()}}var Ca="bre-create-host",Ha="bre-add-mode-picker",lb='[class*="addCard"]',cb='[class*="addPanel"]',ub='[class*="addModes"]',uu="-custom-panel",fb="-custom";function mu(){return{hosts:new Map}}function Na(e,t,n){if(!e.isConnected)return;let r=new Set;for(let o of Array.from(e.querySelectorAll(lb)))if(o.isConnected)try{pb(o,t,n),r.add(o)}catch(i){Bo(o,n);for(let a of Ia(o))try{Hn(a)}catch{}gu(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)&&Bo(o,n)}function pb(e,t,n){let r=fu(e,uu);(r===void 0||r.hidden)&&(yb(e,()=>da(e)),r=fu(e,uu),r===void 0||r.hidden)||(e.getAttribute("data-bre-add-card")!=="1"&&e.setAttribute("data-bre-add-card","1"),vb(e,r,t,n),hb(e),bb(r,t),gu(e,!0))}var mb=".field, label",gb=".bre-keys-host, .bre-keys, .bre-create-host";function Ia(e){let t=[],n=e.querySelectorAll('input[type="password"], input[data-bre-key-input]');for(let r of Array.from(n)){if(r.closest(gb)!==null)continue;let o=r.closest(mb)??r.parentElement;o!==null&&!t.includes(o)&&t.push(o)}return t}function hb(e){for(let t of Ia(e))try{mc(t)}catch(n){console.warn("[bre] add provider card: could not mark a key field:",n)}}function bb(e,t){for(let n of Ia(e))try{lu(n,{t:t.t,api:t.api,routeIdLabels:t.routeIdLabels,staged:t.stagedKeys,refreshed:t.refreshed})}catch(r){Hn(n),console.warn("[bre] add provider card: could not mount the key list:",r)}}function gu(e,t){let n=hu(e);n!==void 0&&Se(n,Ha,t)}function fu(e,t){for(let n of Array.from(e.querySelectorAll(cb)))if(n.id.endsWith(t))return n}function hu(e){let t=e.querySelector(ub);if(t!==null){for(let n of Array.from(t.children))if(n instanceof HTMLElement&&n.getAttribute("role")==="tablist")return n}}function yb(e,t){let n=hu(e);if(n!==void 0){for(let r of Array.from(n.querySelectorAll('[role="tab"]')))if(r.id.endsWith(fb)){if(r.disabled)return;r.getAttribute("aria-selected")!=="true"&&(t(),r.click());return}}}function wb(e){for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.classList.contains(Ca))return t}function vb(e,t,n,r){let o=r.hosts.get(e),i=wb(t);if(i!==void 0&&o!==void 0&&o.host===i)return;Bo(e,r),i!==void 0&&i.remove();let a=e.ownerDocument.createElement("div");a.className=Ca,t.insertBefore(a,t.firstChild),da(e);let s=et(a,n.refreshed(()=>(0,pu.createElement)(Jc,{host:{current:a},api:n.api,t:n.t,routeIdLabels:n.routeIdLabels,staged:n.staged})),{sync:!0});r.hosts.set(e,{host:a,mount:s})}function Bo(e,t){let n=t.hosts.get(e);n!==void 0&&(t.hosts.delete(e),ke(n.mount))}function bu(e){for(let t of Array.from(e.hosts.keys()))Bo(t,e);for(let t of Array.from(document.querySelectorAll(`.${Ca}`)))t.remove();for(let t of Array.from(document.querySelectorAll(`.${Ha}`)))Se(t,Ha,!1);for(let t of Array.from(document.querySelectorAll(`.${qt}`)))vn(t);cu()}var pr="data-bre-row-provider",yu="{provider}",xb=["rowCard","setupCard"];function wu(){return to()}function Fe(e){for(let t of xb)for(let n of Array.from(e.querySelectorAll(`[class*="${t}"]`))){let r=n.parentElement;if(!(r===null||r.tagName!=="UL")&&He(r).length!==0)return r}}function Ut(e){return e.querySelector('[class*="rowHead"]')??void 0}function Cn(e){let t=e.querySelector('[class*="rowName"]')?.textContent?.trim();return t!==void 0&&t.length>0?t:void 0}function kb(e){let t=e.indexOf(yu);if(!(t<0))return{prefix:e.slice(0,t),suffix:e.slice(t+yu.length)}}function Eb(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 Tb='[class*="rowCard"], [class*="setupCard"], [class*="addCard"]';function Sb(e){let t=e.closest(Tb);for(let n=e;n!==null&&n!==t;n=n.parentElement)if(n.matches('[data-plugin], [class*="bre-"]'))return!0;return!1}function Be(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=kb(r);if(o!==void 0)for(let i of Array.from(e.querySelectorAll("button[aria-label]"))){if(Sb(i))continue;let a=i.getAttribute("aria-label")??"";if(a.length<=o.prefix.length+o.suffix.length||!a.startsWith(o.prefix)||!a.endsWith(o.suffix))continue;let s=Eb(a.slice(o.prefix.length,a.length-o.suffix.length));if(s!==void 0)return s}}}function Pa(e){let t=e.getAttribute(pr);return t===null||t.length===0?void 0:t}function Mb(e){return Xn(e,Pa)}function vu(e,t,n){if(!e.isConnected)return;let r=Fe(e);if(r===void 0)return;let o=t.labels();for(let i of He(r)){let a=Be(i,o);if(a===void 0){i.removeAttribute(pr);continue}Pa(i)!==a&&i.setAttribute(pr,a)}io(e,r,Lb(t),n)}function Lb(e){return{rowOf:t=>{let n=t.closest("li");return n instanceof HTMLElement?n:void 0},idOf:Pa,labelOf:Cn,order:t=>gs(t),commit:t=>{ps(Mb(t))},seatOf:Ut,seatDrags:!0,gripLabel:(t,n)=>e.t("providerReorderAria",{provider:Cn(t)??n}),gripHint:()=>e.t("providerReorderHint")}}function xu(e){ao(e);let t=Array.from(document.querySelectorAll(`[${pr}]`));ro(t);for(let n of t)n.removeAttribute(pr)}var Nn="data-bre-provider-switch",Ko="bre-row-disabled";function Eu(){return{switches:new WeakSet}}function Tu(e,t,n){if(!e.isConnected)return;let r=Fe(e);if(r===void 0)return;let o=t.labels();for(let i of Array.from(r.children)){if(!(i instanceof HTMLElement))continue;let a=Be(i,o);if(a===void 0)continue;let s=Ut(i);s!==void 0&&(Ab(i,s,a,t,n),i.classList.toggle(Ko,!tn(a)))}}function Su(){for(let e of Array.from(document.querySelectorAll(`[${Nn}]`)))e.remove();for(let e of Array.from(document.querySelectorAll(`.${Ko}`)))e.classList.remove(Ko)}function Ab(e,t,n,r,o){let i=t.querySelector(`[${Nn}]`);if(i!==null){ku(i,e,n,r);return}let a=document.createElement("button");a.className="bre-provider-switch",a.setAttribute("type","button"),a.setAttribute("role","switch"),a.setAttribute(Nn,n),ku(a,e,n,r),Rb(a,e,o);let s=t.querySelector('[class*="rowActions"]');s===null?t.appendChild(a):s.insertBefore(a,s.firstChild)}function ku(e,t,n,r){let o=r.t("providerToggleAria",{provider:Cn(t)??n}),i=r.t("providerToggleHint"),a=tn(n)?"true":"false";e.getAttribute(Nn)!==n&&e.setAttribute(Nn,n),e.getAttribute("aria-checked")!==a&&e.setAttribute("aria-checked",a),e.getAttribute("aria-label")!==o&&e.setAttribute("aria-label",o),e.getAttribute("title")!==i&&e.setAttribute("title",i)}function Rb(e,t,n){n.switches.has(e)||(n.switches.add(e),e.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation();let o=e.getAttribute(Nn);if(o===null)return;let i=!tn(o);ys(o,i),e.setAttribute("aria-checked",i?"true":"false"),t.classList.toggle(Ko,!i)}))}var Hb=["balance","totalbalance","availablebalance","remainingbalance","creditbalance","balanceusd","totalavailable","available","remaining","credits","credit","amount","left","remain","remainingquota","quotaremaining","remainquota","availablequota","points"],Cb=new Map(Hb.map((e,t)=>[e,t])),Yx=(Cb.get("totalavailable")??0)+.5;var Nb=new Map([["USD","$"],["US$","$"],["$","$"],["CNY","\xA5"],["RMB","\xA5"],["\xA5","\xA5"],["EUR","\u20AC"],["\u20AC","\u20AC"],["GBP","\xA3"],["\xA3","\xA3"],["JPY","\xA5"],["KRW","\u20A9"],["HKD","HK$"],["TWD","NT$"]]);function Ib(e){let t=e<0?"-":"",n=Math.abs(e),r=Number.isInteger(n)?String(n):n.toFixed(2).replace(/0+$/,"").replace(/\.$/,""),[o="0",i]=r.split("."),a=o.replace(/\B(?=(\d{3})+(?!\d))/g,",");return`${t}${a}${i===void 0?"":`.${i}`}`}function Mu(e){let t=Ib(e.amount),n=e.currency?.trim()??"";if(n.length===0)return t;let r=Nb.get(n.toUpperCase());return r!==void 0?`${r}${t}`:`${t} ${n}`}async function Pb(e){try{let t=await fetch(`${es}?route=${encodeURIComponent(e)}`,{method:"GET",cache:"no-store",credentials:"same-origin"}),n;try{n=await t.json()}catch{n=void 0}if(!G(n))return{ok:!1};if(n.ok===!0){let i=n.configured!==!1,a=typeof n.amount=="number"&&Number.isFinite(n.amount)?n.amount:void 0,s=typeof n.currency=="string"&&n.currency.length>0?n.currency:void 0;return{ok:!0,configured:i,...a===void 0?{}:{amount:a},...s===void 0?{}:{currency:s}}}let r=typeof n.error=="string"&&n.error.length>0?n.error:void 0,o=typeof n.configured=="boolean"?n.configured:void 0;return{ok:!1,...o===void 0?{}:{configured:o},...r===void 0?{}:{error:r}}}catch{return{ok:!1}}}var Lu={read:Pb};var ht="data-bre-provider-balance",Db="data-bre-provider-switch",qo="data-bre-provider-balance-refresh",Ob=["M13.4 8a5.4 5.4 0 1 1-1.6-3.8","M13.8 2.2v3.5h-3.5"];function Ru(){return{readings:new Map,errors:new Map,requested:new Set,inflight:new Set,pending:new Set,visible:!1}}function Da(e,t,n){let r=Fe(e);if(r===void 0){n.visible=!1;return}n.visible||(n.visible=!0,n.requested.clear());let o=t.labels();for(let i of Array.from(r.children)){if(!(i instanceof HTMLElement))continue;let a=Be(i,o);if(a===void 0)continue;let s=Ut(i);s!==void 0&&(Nu(s,a,t,n),Oa(s,a,t,n))}}function Hu(e,t){e.requested.delete(t),e.readings.delete(t),e.errors.delete(t),e.inflight.has(t)&&e.pending.add(t)}function Cu(){for(let e of Array.from(document.querySelectorAll(`[${ht}]`)))e.remove()}function Nu(e,t,n,r){let o=r.readings.get(t);if(o!==void 0){Iu(e,t,o,n,r);return}let i=r.errors.get(t);if(i!==void 0){_b(e,t,i,n,r);return}_u(e)}function Iu(e,t,n,r,o){let i=Pu(e,t,r,o);Du(i,`${r.t("providerBalanceLabel")} ${Mu(n)}`,r.t("providerBalanceHint"),r),Ou(e,i)}function _b(e,t,n,r,o){let i=Pu(e,t,r,o),a=n.length>0?n:r.t("providerBalanceHint");Du(i,r.t("providerBalanceUnavailable"),a,r),Ou(e,i)}function Pu(e,t,n,r){let o=e.querySelector(`[${ht}]`);return o===null?(o=document.createElement("span"),o.className="bre-provider-balance",o.setAttribute(ht,t)):o.getAttribute(ht)!==t&&o.setAttribute(ht,t),(o.querySelector(".bre-provider-balance-text")===null||o.querySelector(`[${qo}]`)===null)&&(o.replaceChildren(),Fb(o,e,n,r)),o}function Fb(e,t,n,r){let o=document.createElement("span");o.className="bre-provider-balance-text";let i=document.createElement("button");i.type="button",i.className="bre-provider-balance-refresh",i.setAttribute(qo,"1"),i.setAttribute("aria-label",n.t("providerBalanceRefresh")),i.title=n.t("providerBalanceRefresh"),i.append(Mo("balance-refresh",Ob)),i.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation();let s=e.getAttribute(ht);if(!(s===null||s.length===0)){if(r.inflight.has(s)){r.pending.add(s);return}r.requested.delete(s),Oa(t,s,n,r)}}),e.append(o,i)}function Du(e,t,n,r){let o=e.querySelector(".bre-provider-balance-text");o!==null&&o.textContent!==t&&(o.textContent=t),e.getAttribute("title")!==n&&e.setAttribute("title",n);let i=e.querySelector(`[${qo}]`);if(i!==null){let a=r.t("providerBalanceRefresh");i.getAttribute("aria-label")!==a&&i.setAttribute("aria-label",a),i.getAttribute("title")!==a&&i.setAttribute("title",a)}}function Au(e,t,n){let r=e.querySelector(`[${ht}]`);if(r===null||r.getAttribute(ht)!==t)return;let o=r.querySelector(`[${qo}]`);o!==null&&(o.classList.toggle("is-spinning",n),n?o.setAttribute("aria-busy","true"):o.removeAttribute("aria-busy"))}function Ou(e,t){let n=e.querySelector(`[${Db}]`);if(n!==null){t.nextElementSibling!==n&&n.before(t);return}if(t.parentElement!==null)return;let r=e.querySelector('[class*="rowActions"]');r!==null?r.insertBefore(t,r.firstChild):e.appendChild(t)}function _u(e){for(let t of Array.from(e.querySelectorAll(`[${ht}]`)))t.remove()}function Oa(e,t,n,r){if(r.requested.has(t)||r.inflight.has(t))return;r.requested.add(t),r.inflight.add(t),Au(e,t,!0),(n.client??Lu).read(t).then(i=>{if(i.ok&&i.configured!==!1&&typeof i.amount=="number"&&Number.isFinite(i.amount)){r.errors.delete(t);let a={amount:i.amount,...i.currency===void 0?{}:{currency:i.currency}};r.readings.set(t,a),e.isConnected&&Iu(e,t,a,n,r);return}if(i.ok&&i.configured===!1){r.readings.delete(t),r.errors.delete(t),e.isConnected&&_u(e);return}i.configured===!0&&r.errors.set(t,i.error??""),e.isConnected&&Nu(e,t,n,r)}).catch(()=>{}).finally(()=>{r.inflight.delete(t),Au(e,t,!1),e.isConnected||n.repaint?.(),r.pending.delete(t)&&(r.requested.delete(t),Oa(e,t,n,r))})}function Fu(){return{requested:new Set,visible:!1}}function _a(e,t,n){let r=Fe(e);if(r===void 0){n.visible=!1;return}n.visible||(n.visible=!0,n.requested.clear());let o=t.client;if(o===void 0)return;let i=t.labels();for(let a of Array.from(r.children)){if(!(a instanceof HTMLElement))continue;let s=Be(a,i);s===void 0||n.requested.has(s)||(n.requested.add(s),o.list(s).catch(()=>{}))}}var Go="data-bre-provider-delete",Bu='[class*="rowActions"]',Ku='[class*="dangerButton"]',Bb="bre-provider-delete";function qu(e,t){if(!e.isConnected)return;let n=Fe(e);if(n===void 0)return;let r=t.labels(),o=Kb(n)??t.t("providerRemoveDisabled");for(let i of Array.from(n.children)){if(!(i instanceof HTMLElement))continue;let a=Be(i,r);if(a===void 0)continue;let s=Ut(i);if(s===void 0)continue;let d=s.querySelector(Bu);if(d===null)continue;let l=d.querySelector(`[${Go}]`);if(d.querySelector(Ku)!==null){l!==null&&l.remove();continue}let c=l??qb();d.lastElementChild!==c&&d.appendChild(c),Gb(c,a,o,t.t("providerRemoveLocked",{provider:Cn(i)??a}))}}function Gu(){for(let e of Array.from(document.querySelectorAll(`[${Go}]`)))e.remove()}function Kb(e){let n=e.querySelector(`${Bu} ${Ku}`)?.textContent?.trim()??"";return n.length>0?n:void 0}function qb(){let e=document.createElement("button");return e.className=Bb,e.setAttribute("type","button"),e.setAttribute("disabled",""),e}function Gb(e,t,n,r){e.getAttribute(Go)!==t&&e.setAttribute(Go,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 Wo="data-bre-provider-disabled-group",Wb="bre-provider-disabled-seat",Wu="bre-provider-disabled-group",Fa="bre-row-folded",Ba="bre-row-hidden";function zu(){return{expanded:!1}}function Uu(e,t,n){if(!e.isConnected)return;let r=Fe(e);if(r===void 0)return;let o=$u(r,t.labels()),i=o.filter(l=>!l.enabled).length,a=Vu(r);if(i===0){a!==void 0&&a.remove(),Ka(o,n);return}let s=a??zb(r,t,n);(s.parentElement!==r||r.lastElementChild!==s)&&r.append(s),Ka(o,n);let d=Yu(s);d!==void 0&&Xu(d,i,t,n)}function ju(){for(let e of Array.from(document.querySelectorAll(`[${Wo}]`)))e.remove();for(let e of Array.from(document.querySelectorAll(`.${Ba}, .${Fa}`)))e.classList.remove(Ba,Fa)}function $u(e,t){let n=[];for(let r of Array.from(e.children)){if(!(r instanceof HTMLElement)||r.getAttribute(Wo)!==null)continue;let o=Be(r,t);o!==void 0&&n.push({row:r,id:o,enabled:tn(o)})}return n}function Ka(e,t){for(let n of e){let r=!n.enabled;n.row.classList.toggle(Fa,r),n.row.classList.toggle(Ba,r&&!t.expanded)}}function Vu(e){for(let t of Array.from(e.children))if(t instanceof HTMLElement&&t.getAttribute(Wo)!==null)return t}function Yu(e){return e.querySelector(`button.${Wu}`)??void 0}function zb(e,t,n){let r=document.createElement("li");r.className=Wb,r.setAttribute(Wo,"");let o=document.createElement("button");return o.className=Wu,o.setAttribute("type","button"),o.addEventListener("click",i=>{i.preventDefault(),i.stopPropagation(),n.expanded=!n.expanded,Ub(e,t,n)}),r.appendChild(o),e.append(r),r}function Ub(e,t,n){let r=$u(e,t.labels());Ka(r,n);let o=Vu(e);if(o===void 0)return;let i=r.filter(s=>!s.enabled).length;if(i===0){o.remove();return}let a=Yu(o);a!==void 0&&Xu(a,i,t,n)}function Xu(e,t,n,r){let o=n.t(r.expanded?"providerDisabledGroupHide":"providerDisabledGroupShow",{count:t}),i=n.t("providerDisabledGroupHint"),a=r.expanded?"true":"false";e.textContent!==o&&(e.textContent=o),e.getAttribute("aria-expanded")!==a&&e.setAttribute("aria-expanded",a),e.getAttribute("aria-label")!==o&&e.setAttribute("aria-label",o),e.getAttribute("title")!==i&&e.setAttribute("title",i)}var mr="data-bre-row-model",qa="bre-model-grid";function Qu(){return to()}function jb(e){let t=[];for(let n of Array.from(e.querySelectorAll('[class*="modelList"]')))He(n).filter(o=>o.matches('[class*="modelEntry"]')).length!==0&&t.push(n);return t}function Zu(e){for(let t of e){if(t.type!=="childList")continue;let n=t.target;if(n instanceof HTMLElement&&n.matches('[class*="modelList"]')&&He(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 zo(e){let t=e.getAttribute(mr);return t===null||t.length===0?void 0:t}function Ga(e,t){let n=e.closest("li");if(n!==null)return Be(n,t.labels())}function Ju(e,t){let n=De(e,t.labels().modelName);return n.length>0?n:zo(e)}function $b(e,t){return{rowOf:n=>{let r=n.closest('[class*="modelEntry"]');return r instanceof HTMLElement?r:void 0},idOf:zo,labelOf:n=>Ju(n,t),order:n=>{let r=Ga(e,t);return r===void 0?n:Ls(r,n)},commit:n=>{let r=Ga(n,t);r!==void 0&&Ss(r,Xn(n,zo))},seatOf:n=>n.querySelector('[class*="modelRow"]')??void 0,seatDrags:!1,gripLabel:(n,r)=>t.t("modelReorderAria",{model:Ju(n,t)??r}),gripHint:()=>t.t("modelReorderHint"),decorate:(n,r)=>{r.classList.add(qa)}}}function ef(e,t,n){if(!e.isConnected)return;let r=t.labels();for(let o of jb(e))if(Ga(o,t)!==void 0){for(let i of He(o)){let a=De(i,r.modelId);if(a.length===0){i.removeAttribute(mr);continue}zo(i)!==a&&i.setAttribute(mr,a)}io(e,o,$b(o,t),n)}}function tf(e){ao(e);for(let n of Array.from(document.querySelectorAll(`.${qa}`)))n.classList.remove(qa);let t=Array.from(document.querySelectorAll(`[${mr}]`));ro(t);for(let n of t)n.removeAttribute(mr)}var bt=require("react");async function Wa(e){try{let t=await e.json();if(typeof t.error=="string"&&t.error.length>0)return t.error}catch{}return`image request failed (${e.status})`}async function nf(e,t){try{let n=await fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t)}),r=await n.json().catch(()=>({}));return n.ok&&r.ok===!0?{ok:!0,data:r}:{ok:!1,error:typeof r.error=="string"?r.error:await Wa(n)}}catch(n){return{ok:!1,error:n instanceof Error?n.message:String(n)}}}var rf;function Uo(){return rf}function of(){Mt()}async function Mt(){try{let e=await fetch(Lr,{method:"GET"}),t=await e.json();if(e.ok&&t.ok===!0&&typeof t.models<"u"){let n=t;return rf=n,{ok:!0,data:n}}return{ok:!1,error:typeof t.error=="string"?t.error:await Wa(e)}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}}async function In(e){let t=await nf(Lr,{op:"save",...e});return t.ok?{ok:!0,data:void 0}:t}async function af(e){let t=await nf(Lr,{op:"test",id:e});return t.ok?{ok:!0,data:{status:typeof t.data.status=="string"?t.data.status:"unverified",...typeof t.data.checkedAt=="string"?{checkedAt:t.data.checkedAt}:{}}}:t}async function za(e){try{let t=await fetch(rs,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(e)}),n=await t.json().catch(()=>({})),r=Array.isArray(n.images)?n.images.filter(o=>typeof o=="string"):void 0;return t.ok&&n.ok===!0&&r!==void 0?{ok:!0,data:{images:r,model:String(n.model??""),paramsUsed:n.paramsUsed,...typeof n.warning=="string"?{warning:n.warning}:{}}}:{ok:!1,error:typeof n.error=="string"?n.error:await Wa(t)}}catch(t){return{ok:!1,error:t instanceof Error?t.message:String(t)}}}var Vb=["\u6A21\u578B","Models","models"],df='[class*="rowCard"], [class*="setupCard"], [class*="addCard"]',Yb='h1,h2,h3,h4,h5,h6,[role="heading"]',Xb=/title|heading/i,Jb='nav, button, [role="menu"], [role="menuitem"], [class*="rowName"], [class*="rowCard"]',Qb=4;function Zb(e,t){let n="";for(let r of e.childNodes)if(r.nodeType===r.TEXT_NODE)n+=r.textContent??"";else if(r.nodeType===r.ELEMENT_NODE){if(r.classList?.contains(gr))continue;return!1}return n.replace(/\s+/g," ").trim()===t}function ey(e,t){for(let n=e;n!==null;n=n.parentElement){if(n.matches(Yb)||Xb.test(String(n.className??"")))return n;if(n===t)break}return null}function ty(e,t){for(let n of Vb)for(let r of e.querySelectorAll("*")){if(!Zb(r,n)||r.closest(Jb)!==null||(r.compareDocumentPosition(t)&Qb)===0)continue;let o=ey(r,e);if(o!==null)return o}return null}function lf(e){let t=e.querySelector(df);if(t===null)return null;let n=t.ownerDocument?.body??null;for(let r=t.parentElement;r!==null&&r!==n;r=r.parentElement){let o=ty(r,t);if(o!==null)return ny(o,r)}return null}function ny(e,t){let n=e,r=n.parentElement;for(;r!==null&&r!==t;){let o=Array.from(r.childNodes).filter(a=>a.nodeType===a.TEXT_NODE).map(a=>a.textContent??"").join("").replace(/\s+/g," ").trim();if(Array.from(r.children).filter(a=>!a.classList?.contains(gr)).length>1||o.length>0)return r.querySelector(df)!==null?n:r;n=r,r=r.parentElement}return r===t?n:null}var gr="bre-config-host",ja="bre-config-title-line",Ua={display:"flex",alignItems:"center"},jo=new WeakMap;function sf(e){e.classList.add(ja),jo.has(e)||jo.set(e,{display:e.style.display,alignItems:e.style.alignItems}),e.style.display=Ua.display,e.style.alignItems=Ua.alignItems}function ry(e){return e.classList.contains(ja)&&e.style.display===Ua.display}function cf(e){e.classList.remove(ja);let t=jo.get(e);jo.delete(e),e.style.display=t?.display??"",e.style.alignItems=t?.alignItems??""}function uf(){return{mounts:new Map}}function ff(e,t,n){let r=n.mounts.get(e),o=e.querySelector(`:scope > .${gr}`);if(o!==null&&r!==void 0&&r.wrapper===o){ry(e)||sf(e);return}pf(e,n),o?.remove(),sf(e);let i=e.ownerDocument.createElement("div");i.className=gr,e.appendChild(i);let a=et(i,(0,bt.createElement)(iy,{t:t.t,onOpen:t.onOpen}),{sync:!0});n.mounts.set(e,a)}function pf(e,t){cf(e);let n=t.mounts.get(e);n!==void 0&&(t.mounts.delete(e),ke(n))}function mf(e){for(let t of Array.from(e.mounts.keys()))pf(t,e);for(let t of Array.from(document.querySelectorAll(`.${gr}`))){let n=t.parentElement;n!==null&&cf(n),t.remove()}}function oy(){return(0,bt.createElement)("svg",{className:"bre-config-btn-icon",width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false"},(0,bt.createElement)("rect",{x:3,y:4,width:18,height:16,rx:2.5}),(0,bt.createElement)("circle",{cx:8.5,cy:9.5,r:1.6}),(0,bt.createElement)("path",{d:"M3.6 17.6 9 12.2l4.4 4.4 3-3 4 4"}))}function iy(e){return(0,bt.useEffect)(()=>{of()},[]),(0,bt.createElement)("button",{className:"bre-config-btn",type:"button",title:e.t("configButtonHint"),"aria-label":e.t("configButton"),onClick:()=>e.onOpen()},oy())}var ay="settings.models",Ke={capacity:["modelAdvanced","Model options","Capacities"],modelId:["modelId","Model ID"],modelName:["modelName","Display name"],routeId:["customRoute","Provider ID"],baseUrl:["baseUrl","Base URL"],apiProtocol:["customApi","API protocol"],apply:["apply","Apply"],cancel:["cancel","Cancel"],editProvider:["editProvider","Edit {provider}"],inputImage:["modelInputImage","Image"],contextWindow:["modelContextWindow","contextWindow","Context window","\u4E0A\u4E0B\u6587\u7A97\u53E3"],maxOutput:["modelMaxOutput","maxOutput","maxTokens","Max output","\u6700\u5927\u8F93\u51FA"],addModel:["addModel","Add model","\u6DFB\u52A0\u6A21\u578B"]};function bf(e){let{ctx:t,api:n,t:r,onIdle:o,refreshed:i}=e,a=()=>{let M=t.locale.bind(ay),F=V=>{let ue=[];for(let ae of V){let pe=M(ae);pe!==ae&&pe.trim()!==""&&!ue.includes(pe)&&ue.push(pe)}return ue.length===0?V:[...ue,...V.filter(ae=>!ue.includes(ae))]};return{capacity:F(Ke.capacity),modelId:F(Ke.modelId),modelName:F(Ke.modelName),routeId:F(Ke.routeId),baseUrl:F(Ke.baseUrl),apiProtocol:F(Ke.apiProtocol),apply:F(Ke.apply),cancel:F(Ke.cancel),editProvider:F(Ke.editProvider),inputImage:F(Ke.inputImage),contextWindow:F(Ke.contextWindow),maxOutput:F(Ke.maxOutput),addModel:F(Ke.addModel)}},s=120,d=1e3,l=Sl(),c=wu(),f={t:r,labels:a},m=Eu(),u={t:r,labels:a},p=Ru(),h={t:r,labels:a,repaint:()=>fe()},g=Fu(),y={labels:a,client:Pe},k={t:r,labels:a},w=zu(),C={t:r,labels:a},K=Qu(),J={t:r,labels:a},W=kc(),I={t:r},N=mu(),j=uf(),S=Uc(),R=Zc(),_={t:r,api:n,routeIdLabels:()=>a().routeId,staged:S,stagedKeys:R,refreshed:i},b,L,H,ne,$=M=>{for(let F of M)for(let V of Array.from(F.addedNodes)){if(!(V instanceof HTMLElement))continue;let ue=V.matches('[class*="modelAdvanced"]')?[V]:Array.from(V.querySelectorAll('[class*="modelAdvanced"]'));for(let ae of ue)aa(ae)}},re=!1,ee={api:n,describeNamespace:M=>ie(n,M),t:r,labels:a,onIdle:o,onBackoff:M=>{z(M)},onPendingChanged:()=>{fe()},mount(M,F){let V=document.createElement("div");V.className="bre-effort-slot",V.dataset.plugin=we,M.appendChild(V);let ue=(0,hf.createRoot)(V),ae=pe=>{ue.render((0,$a.createElement)(Ie,{fallbackText:r("renderFailed"),children:i(()=>(0,$a.createElement)(Jr,pe))}))};return(0,gf.flushSync)(()=>{ae(F)}),{unmount:()=>{try{ue.unmount()}finally{V.remove()}},render:ae}}},de=0;function z(M){if(re)return;let F=Date.now()+M;L!==void 0&&F>=de||(L!==void 0&&window.clearTimeout(L),de=F,L=window.setTimeout(()=>{L=void 0,de=0,fe()},M))}let Z=()=>{let M=Ze();if(Fe(M)===void 0){Da(M,h,p),_a(M,y,g);return}if(vu(M,f,c),Tu(M,u,m),Da(M,h,p),_a(M,y,g),qu(M,k),Uu(M,C,w),ef(M,J,K),e.configSeat!==void 0){let F=lf(M);F!==null&&ff(F,{t:e.configSeat.t,onOpen:e.configSeat.onOpen},j)}xa(),Nc(M)},te=(M,F)=>{try{F()}catch(V){console.error(`[bre] ${M} failed:`,V)}};function fe(){re||b!==void 0||(b=window.setTimeout(()=>{b=void 0,te("composer mutation",()=>{ne?.()}),te("editor reconcile",()=>{ca(Ze(),ee,l)}),te("add-card reconcile",()=>{Na(Ze(),_,N)}),te("editor tabs reconcile",()=>{ba(Ze(),I,W)}),te("dom decorations",()=>{Z()}),Yc(S,n).then(M=>{M>0&&z(d)}),ru(R,n,Pe).then(M=>{M>0&&z(d)})},s))}let ve=M=>{let V=M.detail?.route;typeof V!="string"||V.length===0||(Hu(p,V),fe())},q=M=>{if(re||H!==void 0)return;ne=M,te("models page startup",()=>{M(),Z()}),Ul();let F=V=>{M(),te("editor reconcile",()=>{ca(Ze(),ee,l)}),Na(Ze(),_,N),ba(Ze(),I,W),Z(),Zu(V)&&$l(Ze())};H=new MutationObserver(V=>{te("models mutation",()=>{F(V)}),te("early reasoning hide",()=>{$(V)}),fe()}),H.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden"]}),document.addEventListener(Gn,ve),fe()},Y=()=>{re=!0,b!==void 0&&(window.clearTimeout(b),b=void 0),L!==void 0&&(window.clearTimeout(L),L=void 0),document.removeEventListener(Gn,ve),H?.disconnect(),H=void 0};return{state:l,labels:a,start:q,stopObserver:Y,teardown:()=>{if(!l.disposed){Y(),l.disposed=!0,Fl(),El(l,ee);for(let[M,F]of l.mounted)Zn(M),F.editor.unmount();l.mounted.clear(),xu(c),Su(),Cu(),Gu(),ju(),wd(),mf(j),Ic(),qc(),tf(K),bu(N),Mc(),pl(),jl()}},flushOnUnload:()=>{Tl(l,ee)},schedule:fe}}var wf=e=>`?route=${encodeURIComponent(e)}`;async function vf(e){try{let t=await e.json();if(typeof t.error=="string"&&t.error.length>0)return t.error}catch{}return`fingerprint request failed (${e.status})`}async function Va(e){try{let t=await fetch(`${Zo}${wf(e)}`,{method:"GET"}),n=await t.json();if(t.ok&&n.ok===!0){let r=n.data;return{ok:!0,data:{bank:r?.bank??{},records:Array.isArray(r?.records)?r.records:[]}}}return{ok:!1,error:typeof n.error=="string"?n.error:await vf(t)}}catch(t){return{ok:!1,error:t instanceof Error?t.message:String(t)}}}function xf(e,t,n){let r=new AbortController,o=!1;return{done:(async()=>{let a;try{let s=await fetch(`${Zo}${wf(e)}`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({model:t}),signal:r.signal});if(!s.ok)return{ok:!1,error:await vf(s)};let d=s.body?.getReader();if(d===void 0)return{ok:!1,error:"the fingerprint route sent no body"};let l=new TextDecoder,c="";for(;;){let{done:m,value:u}=await d.read();if(m)break;c+=l.decode(u,{stream:!0});let p=c.indexOf(`
|
|
4566
|
+
`);for(;p>=0;){let h=c.slice(0,p).trim();if(c=c.slice(p+1),h.length>0){let g=yf(h);g!==void 0&&(n(g),g.type==="result"?a={ok:!0,record:g.record}:g.type==="error"&&(a={ok:!1,error:g.error}))}p=c.indexOf(`
|
|
4567
|
+
`)}}let f=c.trim();if(f.length>0){let m=yf(f);m!==void 0&&(n(m),m.type==="result"?a={ok:!0,record:m.record}:m.type==="error"&&(a={ok:!1,error:m.error}))}}catch(s){return o?{ok:!1,error:"cancelled"}:{ok:!1,error:s instanceof Error?s.message:String(s)}}return a!==void 0?a:o?{ok:!1,error:"cancelled"}:{ok:!1,error:"the fingerprint route ended without a verdict"}})(),abort:()=>{o=!0,r.abort()}}}function yf(e){let t;try{t=JSON.parse(e)}catch{return}if(typeof t!="object"||t===null)return;let n=t,r=n.type;if(r==="progress")return{type:"progress",index:Number(n.index??0),ok:n.ok===!0,...typeof n.error=="string"?{error:n.error}:{}};if(r==="result"){let o=n.record;return typeof o!="object"||o===null?void 0:{type:"result",record:o}}if(r==="error")return{type:"error",error:typeof n.error=="string"?n.error:"fingerprint route failed"}}var sy=3,dy=2,ly=15e3,cy=/\b429\b|rate.?limit|too many requests/i,Ya=new Map;function uy(e){return Ya.get(e)??{run:(t,n,r)=>xf(t,n,r)}}var Xa=class{constructor(t,n=dy,r=ly){Te(this,"route",t);Te(this,"concurrency",n);Te(this,"backoffMs",r);Te(this,"listeners",new Set);Te(this,"recordListeners",new Set);Te(this,"failureListeners",new Set);Te(this,"state",{running:new Map,queued:[]});Te(this,"handles",new Set);Te(this,"draining",!1);Te(this,"disposed",!1);Te(this,"throttled",!1);Te(this,"backoffUntil",0)}getState(){return this.state}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}onRecord(t){return this.recordListeners.add(t),()=>{this.recordListeners.delete(t)}}onFailure(t){return this.failureListeners.add(t),()=>{this.failureListeners.delete(t)}}idle(){return this.state.running.size===0&&this.state.queued.length===0}check(t){this.checkAll([t])}checkAll(t){if(this.disposed)return;let n=[...this.state.queued];for(let r of t)n.includes(r)||this.state.running.has(r)||n.push(r);n.length!==this.state.queued.length&&(this.publish({...this.state,queued:n}),this.drain())}abort(){this.publish({running:new Map,queued:[]});for(let t of[...this.handles])t.abort();this.handles.clear(),this.throttled=!1,this.backoffUntil=0}dispose(){this.disposed||(this.disposed=!0,this.abort(),this.listeners.clear(),this.recordListeners.clear(),this.failureListeners.clear(),$o.delete(this.route),Ya.delete(this.route))}setSender(t){Ya.set(this.route,t)}publish(t){this.state=t;for(let n of[...this.listeners])n()}limit(){return this.throttled?1:Math.max(1,this.concurrency)}async drain(){if(this.draining||this.disposed)return;this.draining=!0;let t=new Set;try{for(;!this.disposed;){for(;!this.disposed&&t.size<this.limit()&&this.state.queued.length>0&&Date.now()>=this.backoffUntil;){let r=this.state.queued[0];if(r===void 0)break;this.publish({running:new Map(this.state.running).set(r,0),queued:this.state.queued.slice(1)});let o=this.runOne(r).finally(()=>{t.delete(o)});t.add(o)}if(this.disposed||t.size===0||(await Promise.race(t),this.disposed))break;let n=this.backoffUntil-Date.now();n>0&&await new Promise(r=>setTimeout(r,n))}}finally{t.clear(),this.throttled=!1,this.backoffUntil=0,this.draining=!1}}async runOne(t){let n=uy(this.route),r=0,o=n.run(this.route,t,i=>{i.type==="progress"&&(r+=1,this.publish({running:new Map(this.state.running).set(t,Math.min(r,sy)),queued:this.state.queued}))});this.handles.add(o);try{let i=await o.done;if(this.disposed)return;if(i.ok)for(let a of[...this.recordListeners])a(i.record);else{cy.test(i.error)&&(this.throttled=!0,this.backoffUntil=Date.now()+this.backoffMs);for(let a of[...this.failureListeners])a(t,i.error)}}finally{if(this.handles.delete(o),this.state.running.has(t)){let i=new Map(this.state.running);i.delete(t),this.publish({running:i,queued:this.state.queued})}}}},$o=new Map;function kf(e,t){let n=$o.get(e);return n===void 0&&(n=new Xa(e,t?.concurrency,t?.backoffMs),$o.set(e,n)),n}function Ef(){for(let e of[...$o.values()])e.dispose()}function fy(e,t){let n=e?.list?.getSnapshot(),r=n?.current;if(typeof r=="string"&&r.length>0)return r;let o=t?.adapter?.current?.getSnapshot?.()?.key;if(typeof o=="string"&&o.length>0)return o;for(let[i,a]of Object.entries(n?.byId??{}))if(!(a===void 0||(a.retainedBy?.mainView??0)<=0))return typeof a.id=="string"&&a.id.length>0?a.id:i}function Tf(e){let t,n=new Map,r=(a,s)=>{for(let[d,l]of n){if(d===s)continue;let c;try{c=a.directoryFor(l.sessionId)===d}catch{c=!1}c||(l.restore(),n.delete(d))}};return{ensure:()=>{let a=e.ctx,s=a.get?.("sessions"),d=a.get?.("uiSession"),l=a.get?.("modelDirectories"),c=fy(s,d);if(!(c===void 0||l===void 0))try{let f=l.directoryFor(c);return r(l,f),t!==void 0&&t.sessionId===c&&t.directory===f||(n.has(f)||n.set(f,{sessionId:c,restore:Ws(f,{configuredEffort:e.configuredEffort})}),t={sessionId:c,directory:f}),f}catch{t=void 0;return}},dispose:()=>{for(let[,a]of n)a.restore();n.clear()}}}var nt=require("react");var O=require("react");function Sf(e){let t=[];for(let i of e){let a=i.timing?.durationMs;typeof a=="number"&&Number.isFinite(a)&&a>0&&t.push(a)}if(t.length===0)return;t.sort((i,a)=>i-a);let n=t.length>>1,o=(t.length%2===1?t[n]:(t[n-1]+t[n])/2)/1e3;return o>=75?{unit:"minutes",value:Math.max(1,Math.round(o/60))}:{unit:"seconds",value:Math.max(5,Math.round(o/5)*5)}}var py=/^(gpt-|chatgpt-|o[134](-|$)|claude-)/;function my(e){let t=String(e??"").trim(),n=t.lastIndexOf("/");return n===-1?t:t.slice(n+1)}function Mf(e){let t=my(e).toLowerCase();return t.length>0&&py.test(t)}var Lf={running:new Map,queued:[]};function br(e){return typeof e!="number"||!Number.isFinite(e)?"\u2014":`${Math.round(e*100)}%`}function gy(e){return!Number.isFinite(e)||e<=0?"\u2014":new Date(e).toLocaleString()}function Af(e){return typeof e!="number"||!Number.isFinite(e)||e<0?"\u2014":(Math.round(e/100)/10).toFixed(1)}function hy(e,t){return t===void 0?e("fpCostUnknown",{count:3}):t.unit==="minutes"?e("fpCostMinutes",{count:3,minutes:t.value}):e("fpCost",{count:3,seconds:t.value})}function Rf({route:e,api:t,t:n,ctx:r,host:o}){let[i]=(0,O.useState)(()=>Ec(o.current)),[a,s]=(0,O.useState)([]),[d,l]=(0,O.useState)(new Map),[c,f]=(0,O.useState)(void 0),[m,u]=(0,O.useState)(void 0),[p,h]=(0,O.useState)(new Set),g=(0,O.useCallback)(R=>{h(_=>{let b=new Set(_);return b.has(R)?b.delete(R):b.add(R),b})},[]),y=(0,O.useMemo)(()=>i?void 0:kf(e),[i,e]),k=(0,O.useSyncExternalStore)((0,O.useCallback)(R=>y?.subscribe(R)??(()=>{}),[y]),(0,O.useCallback)(()=>y?.getState()??Lf,[y]),(0,O.useCallback)(()=>Lf,[]));(0,O.useEffect)(()=>{if(y!==void 0)return y.onRecord(R=>{u(void 0),l(_=>{let b=new Map(_);return b.set(R.model,R),b})})},[y]),(0,O.useEffect)(()=>{if(y!==void 0)return y.onFailure((R,_)=>{u({model:R,error:_})})},[y]);let w=(0,O.useCallback)(async()=>{if(i)return;let _=(await ie(t)).namespace?.value?.providers,b=nn(_,e).map(H=>H.id).filter(H=>typeof H=="string"&&H.length>0).filter(Mf);s(b.map(H=>({model:H})));let L=await Va(e);L.ok?(f(void 0),l(new Map(L.data.records.map(H=>[H.model,H])))):f(L.error)},[t,i,e]);if((0,O.useEffect)(()=>{i||w()},[i,w]),(0,O.useEffect)(()=>{if(!(i||r===void 0))return r.remote.$on("settings/document-updated",()=>{w()})},[i,r,w]),i)return null;let C=a.length,K=a.filter(R=>d.has(R.model)).length,J=a.filter(R=>d.get(R.model)?.status==="identified").length,W=a.filter(R=>d.get(R.model)?.status==="doubtful").length,I=a.filter(R=>d.get(R.model)?.status==="failed").length,N=k.running.size>0,j=k.running.size+k.queued.length,S=(0,O.useMemo)(()=>Sf([...d.values()]),[d]);return(0,O.createElement)("div",{className:"bre-fingerprint","data-bre-fingerprint":C>0?"ready":"none"},(0,O.createElement)("div",{className:"bre-fp-head"},(0,O.createElement)("span",{className:"bre-fp-title"},n("fpTitle")),(0,O.createElement)("span",{className:"bre-fp-count"},n("fpCount",{count:C})),(0,O.createElement)("span",{className:"bre-fp-summary",role:"status","aria-live":"polite"},N?n("fpRunning",{done:k.running.size,total:j}):K===0?n("fpSummaryNone"):n("fpSummary",{identified:J,doubtful:W,failed:I})),(0,O.createElement)("span",{className:"grow"}),(0,O.createElement)("button",{type:"button",className:"bre-fp-all",disabled:N||C===0,onClick:()=>{y?.checkAll(a.map(R=>R.model))}},n("fpDetectAll"))),(0,O.createElement)("p",{className:"bre-fp-intro"},n("fpIntro")),c!==void 0?(0,O.createElement)("p",{className:"bre-fp-error"},n("fpLoadFailed",{error:c})):null,m!==void 0?(0,O.createElement)("p",{className:"bre-fp-error",role:"alert"},n("fpRunFailed",{error:`${m.model}: ${m.error}`})):null,(0,O.createElement)("div",{className:"bre-fp-rows"},...a.map(R=>yy(R,{t:n,runner:y,runnerState:k,records:d,route:e,expanded:p,estimate:S,onToggle:g}))))}function by(e){return(0,O.createElement)("svg",{className:"bre-fp-chev"+(e?" is-open":""),viewBox:"0 0 16 16",width:12,height:12,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,focusable:!1},(0,O.createElement)("path",{d:e?"M4.5 6.5 8 10 11.5 6.5":"M6.5 4.5 10 8 6.5 11.5"}))}function yy(e,t){let{t:n,runner:r,runnerState:o,records:i,expanded:a,estimate:s,onToggle:d}=t,l=i.get(e.model),c=o.running.get(e.model),f=o.queued.indexOf(e.model),m=c!==void 0,u=f>=0,p=a.has(e.model),h=m?{className:"is-running",text:n("fpStateRunning",{done:c,total:3})}:u?{className:"is-queued",text:n("fpQueued",{position:f+1})}:l===void 0?{className:"is-idle",text:n("fpStateUnchecked")}:l.status==="failed"?{className:"is-failed",text:n("fpStateFailed")}:l.status==="doubtful"?{className:"is-doubtful",text:n("fpStateDoubtful",{probability:br(l.probability)})}:{className:"is-identified",text:n("fpStateIdentified",{model:l.predictionName??l.prediction??e.model,probability:br(l.probability)})},g=l===void 0?"fpDetect":l.status==="failed"?"fpRetry":"fpRetest";return(0,O.createElement)("div",{className:"bre-fp-row",key:e.model,"data-bre-fp-open":p?"1":void 0},(0,O.createElement)("div",{className:"bre-fp-row-head"},(0,O.createElement)("button",{type:"button",className:"bre-fp-fold","aria-expanded":p,"aria-label":n(p?"fpDetailHide":"fpDetailShow")+" "+e.model,title:n(p?"fpDetailHide":"fpDetailShow"),onClick:()=>{d(e.model)}},by(p),(0,O.createElement)("span",{className:"bre-fp-model"},e.model)),(0,O.createElement)("span",{className:`bre-fp-badge ${h.className}`},h.text),(0,O.createElement)("span",{className:"grow"}),(0,O.createElement)("span",{className:"bre-fp-evidence"},l===void 0?hy(n,s):n("fpEvidence",{used:l.usedOutputs,total:3})),(0,O.createElement)("button",{type:"button",className:"bre-fp-action",disabled:m||u,onClick:()=>{r?.check(e.model)}},n(g))),!p||l===void 0?null:l.status!=="failed"?vy(l,n):wy(l,n))}function Hf(e,t){return e===void 0||e.length===0?null:(0,O.createElement)("div",{className:"bre-fp-chals",title:t("fpChallengeTitle")},...e.map(n=>{let r=n.skipped===!0?" is-skipped":n.accepted?" is-counted":" is-rejected",o=n.skipped===!0?t("fpChallengeSkipped",{index:n.index,numbers:n.expected}):n.accepted?t("fpChallengeCounted",{index:n.index,numbers:n.expected}):t("fpChallengeRejected",{index:n.index,parsed:n.parsed,numbers:n.expected});return(0,O.createElement)("span",{className:`bre-fp-chal${r}`,key:n.index},o)}))}function wy(e,t){let n=e.challenges,r=n!==void 0&&n.length>0;return e.error===void 0&&!r?null:(0,O.createElement)("div",{className:"bre-fp-body"},e.error===void 0?null:(0,O.createElement)("p",{className:"bre-fp-error"},e.error),Hf(n,t))}function vy(e,t){let n=e.top??[],r=e.timing;return(0,O.createElement)("div",{className:"bre-fp-body"},(0,O.createElement)("div",{className:"bre-fp-family"},(0,O.createElement)("span",{className:"bre-fp-k"},t("fpFamily")),(0,O.createElement)("span",{className:"bre-fp-v"},`${e.familyPrediction??"\u2014"} \xB7 ${br(e.familyProbability)}`),(0,O.createElement)("span",{className:"bre-fp-k"},t("fpSimilarity")),(0,O.createElement)("span",{className:"bre-fp-v"},br(e.top?.[0]?.similarity)),(0,O.createElement)("span",{className:"grow"}),(0,O.createElement)("span",{className:"bre-fp-k"},t("fpCheckedAt",{time:gy(e.checkedAt)}))),Hf(e.challenges,t),r!==void 0?(0,O.createElement)("p",{className:"bre-fp-timing"},t("fpTiming",{first:Af(r.firstTokenMs),total:Af(r.durationMs),rate:r.charsPerSecond===void 0?"\u2014":String(Math.round(r.charsPerSecond))})):null,(0,O.createElement)("div",{className:"bre-fp-k",style:{marginTop:"8px"}},t("fpCandidates")),(0,O.createElement)("div",{className:"bre-fp-bars"},...n.map((o,i)=>(0,O.createElement)("div",{className:"bre-fp-bar",key:o.model},(0,O.createElement)("span",{className:"bre-fp-bar-name"},o.model),(0,O.createElement)("span",{className:`bre-fp-bar-fill${i===0?" is-top":""}`,style:{width:`${Math.max(2,Math.round(o.probability*100))}%`}}),(0,O.createElement)("span",{className:"bre-fp-bar-value"},br(o.probability))))),(0,O.createElement)("p",{className:"bre-fp-note"},t("fpClosedSet")))}var Cf="settings.models.provider-card";function xy(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 ky({provider:e,api:t,t:n,ctx:r}){let o=(0,nt.useRef)(null),i=e?.provider,a=(0,nt.useCallback)(()=>{xy(Sn(o.current))},[]);return(0,nt.useLayoutEffect)(()=>{let s=o.current,d=Sn(s);if(s===null||d===null)return;let l=d,c=()=>d.querySelector('[class*="_editor"]')!==null,f=()=>{let u=c()?"1":"0";s.dataset.edit!==u&&(s.dataset.edit=u)};f();let m=new MutationObserver(f);return m.observe(l,{childList:!0,subtree:!0}),()=>{m.disconnect()}},[i]),typeof i!="string"||i.length===0?null:(0,nt.createElement)("div",{ref:o,className:"bre-headers-host","data-bre-provider":i},(0,nt.createElement)(Do,{host:o,t:n}),(0,nt.createElement)(Po,{route:i,api:t,t:n,onDismiss:a}),(0,nt.createElement)(Rf,{route:i,api:t,t:n,ctx:r,host:o}))}function Nf(e,t,n){let r=e,o=r.slots?.inject(Cf,()=>{r.slots?.register({name:Cf,key:Ce,inject:()=>({api:t,t:n,ctx:e})},ky)});return typeof o=="function"?o:()=>{}}var Ve=require("react");function If(e){let{t}=e,n=(0,Ve.useSyncExternalStore)(Rr,Je),r=()=>{ds(!n)};return(0,Ve.createElement)("div",{className:"bre-slider-setting"},(0,Ve.createElement)("div",{className:"bre-slider-setting-row"},(0,Ve.createElement)("div",{className:"bre-slider-setting-copy"},(0,Ve.createElement)("div",{className:"bre-slider-setting-title"},t("sliderToggleTitle")),(0,Ve.createElement)("div",{className:"bre-slider-setting-description"},t("sliderToggleDescription"))),(0,Ve.createElement)("div",{className:"bre-slider-setting-control"},(0,Ve.createElement)("span",{className:"bre-slider-setting-state"},t(n?"settingOn":"settingOff")),(0,Ve.createElement)("button",{type:"button",role:"switch","aria-label":t("sliderToggleAria"),"aria-checked":n,className:"bre-slider-setting-switch"+(n?" is-on":""),onClick:r},(0,Ve.createElement)("span",{className:"bre-slider-setting-switch-knob","aria-hidden":!0})))))}function Pf(e,t){let n=e,r=n.slots?.inject("settings.models.footer",()=>{n.slots?.register({name:"settings.models.footer",id:we+"-slider-toggle",order:15,inject:()=>({t})},If)});return typeof r=="function"?r:()=>{}}var A=require("react"),Of=require("react-dom/client");var Vo=[{label:"1K",value:"1024x1024",edge:1024},{label:"2K",value:"2048x2048",edge:2048},{label:"4K",value:"4096x4096",edge:4096}];function Ey(e){let t=/^(\d{2,5})x(\d{2,5})$/.exec(e.trim());if(t!==null)return Math.max(Number(t[1]),Number(t[2]))}function Ty(e){let t=Ey(e),n=Vo[0];if(t===void 0)return n;let r=Number.POSITIVE_INFINITY;for(let o of Vo){let i=Math.abs(o.edge-t);i<r&&(n=o,r=i)}return n}function Df(e){return Ty(e).value}function Sy(e,t){return t==="ok"?{className:"bre-config-badge bre-config-badge-ok",text:e("imagegenEndpointOk")}:t==="unsupported"?{className:"bre-config-badge bre-config-badge-bad",text:e("imagegenEndpointUnsupported")}:{className:"bre-config-badge bre-config-badge-unknown",text:e("imagegenEndpointUnverified")}}var My=[5,10,15,30,60];function Ly(e){let t=My.map(n=>n*6e4);return t.includes(e)?t:[e,...t]}function Ay(e){let{api:t,t:n}=e,[r,o]=(0,A.useState)(()=>Uo()),[i,a]=(0,A.useState)(void 0),[s,d]=(0,A.useState)(void 0),[l,c]=(0,A.useState)(void 0),[f,m]=(0,A.useState)(void 0),[u,p]=(0,A.useState)(!1);(0,A.useEffect)(()=>{let b=!0;return Mt().then(L=>{b&&(L.ok?o(L.data):a(L.error))}),()=>{b=!1}},[]);let[h,g]=(0,A.useState)({});(0,A.useEffect)(()=>{let b=!0;return ie(t).then(L=>{let H={};for(let[ne,$]of Object.entries(xe(L.namespace))){let re=typeof $.displayName=="string"?$.displayName.trim():"";re.length>0&&(H[ne]=re)}b&&g(H)}).catch(()=>{}),()=>{b=!1}},[t]);let y=(0,A.useCallback)(()=>{Mt().then(b=>{b.ok&&o(b.data)})},[]),k=(0,A.useCallback)(()=>{ie(t).then(b=>{let L=b.namespace,H=xe(L),ne=[];for(let[$,re]of Object.entries(H)){let ee=Array.isArray(re.models)?re.models.filter(de=>typeof de=="object"&&de!==null):[];for(let de of ee){let z=typeof de.id=="string"?de.id:"";if(z.length===0||zn(ee,z)||!bi(z))continue;let Z=typeof de.name=="string"&&de.name.trim().length>0?de.name.trim():z;ne.push({route:$,modelId:z,label:Z})}}m(ne)})},[t]),w=(0,A.useCallback)(()=>{let b=f??[];if(b.length===0)return;d("mark");let L=new Map;for(let H of b){let ne=L.get(H.route)??[];ne.push(H),L.set(H.route,ne)}Promise.all([...L.entries()].map(([H,ne])=>Nt(t,H,ne.map($=>({modelId:$.modelId,efforts:"keep",imageGen:!0}))))).then(H=>{d(void 0);let ne=H.every($=>$.every(re=>re.ok));c(ne?n("imagegenMarked",{count:b.length}):n("writeError",{message:n("imagegenMarkFailed")})),k(),y()})},[t,f,n,k,y]),C=(0,A.useCallback)(b=>{b.length!==0&&(d("default"),In({defaultModel:b}).then(L=>{d(void 0),L.ok?(c(void 0),y()):c(L.error)}))},[y]),K=(0,A.useCallback)(b=>{if(r===void 0)return;let L=Number(b);!Number.isFinite(L)||L<6e4||L>36e5||L!==r.defaults.timeoutMs&&In({defaults:{timeoutMs:L}}).then(H=>{H.ok?(c(void 0),y()):c(H.error)})},[r,y]),J=(0,A.useCallback)(b=>{d(b),af(b).then(L=>{d(void 0),L.ok?(c(void 0),y()):c(L.error)})},[y]),W=(0,A.useCallback)(()=>{p(!0),za({prompt:"a red apple on a white table"}).then(b=>{p(!1),b.ok?c(b.data.images.length===1?n("imagegenProbeDone",{path:b.data.images[0]}):n("imagegenProbeDoneMulti",{count:b.data.images.length,paths:b.data.images.join("\u3001")})):c(b.error)})},[n]),I=(0,A.useCallback)(b=>{d(b),za({model:b,prompt:"a red apple on a white table"}).then(L=>{d(void 0),L.ok?c(n("imagegenProbeDone",{path:L.data.images[0]??""})):c(L.error)})},[n]);if(r===void 0)return(0,A.createElement)("div",{className:"bre-config-loading","aria-busy":!0},(0,A.createElement)("div",{className:"bre-config-loading-text"},i===void 0?n("imagegenLoading"):`${n("imagegenLoadFailed")}: ${i}`),(0,A.createElement)("div",{className:"bre-config-skeleton"},...[0,1,2].map(b=>(0,A.createElement)("div",{key:b,className:"bre-config-skeleton-row"}))));let N=n,j=r.models,S=j.length===0,R=new Map;for(let b of j)R.set(b.label,(R.get(b.label)??0)+1);let _=b=>{if((R.get(b.label)??0)<2)return b.label;let L=h[b.route]??b.providerLabel??b.route;return`${b.label} \xB7 ${L}`};return(0,A.createElement)("div",{className:"bre-config-card"},(0,A.createElement)("div",{className:"bre-config-card-head"},(0,A.createElement)("span",{className:"bre-config-card-title"},n("imagegenSectionTitle")),(0,A.createElement)("span",{className:"bre-config-card-sub"},n("imagegenSectionSub")),(0,A.createElement)("span",{className:"bre-config-badge"},n("imagegenModelCount",{count:j.length}))),l!==void 0&&(0,A.createElement)("div",{className:"bre-config-notice"},l),(0,A.createElement)("div",{className:"bre-config-defaults"},(0,A.createElement)("label",null,n("imagegenDefaultsLabel")),(0,A.createElement)("select",{className:"bre-config-select",value:Df(r.defaults.size),"aria-label":n("imagegenSizeLabel"),onChange:b=>{In({defaults:{size:b.target.value}}).then(y)}},Vo.map(b=>(0,A.createElement)("option",{key:b.label,value:b.value},b.label))),(0,A.createElement)("select",{className:"bre-config-select",value:r.defaults.quality,"aria-label":n("imagegenQualityLabel"),onChange:b=>{In({defaults:{quality:b.target.value}}).then(y)}},["low","medium","high","auto"].map(b=>(0,A.createElement)("option",{key:b,value:b},b))),(0,A.createElement)("select",{className:"bre-config-select",value:String(r.defaults.n),"aria-label":n("imagegenCountLabel"),onChange:b=>{In({defaults:{n:Number(b.target.value)}}).then(y)}},[1,2,3,4].map(b=>(0,A.createElement)("option",{key:b,value:String(b)},`n=${b}`))),(0,A.createElement)("label",{className:"bre-config-timeout",title:n("imagegenTimeoutHint")},(0,A.createElement)("span",{className:"bre-config-timeout-label"},n("imagegenTimeoutLabel")),(0,A.createElement)("select",{className:"bre-config-select",value:String(r.defaults.timeoutMs),"aria-label":n("imagegenTimeoutLabel"),onChange:b=>{K(b.target.value)}},Ly(r.defaults.timeoutMs).map(b=>(0,A.createElement)("option",{key:b,value:String(b)},n("imagegenTimeoutMinutes",{minutes:Math.round(b/6e4)})))))),!S&&(0,A.createElement)("div",{className:"bre-config-default-row"},(0,A.createElement)("label",{className:"bre-config-default-label"},n("imagegenDefaultModelLabel")),(0,A.createElement)("select",{className:"bre-config-select bre-config-default-select",value:r.defaultModel??"","aria-label":n("imagegenDefaultModelLabel"),disabled:s==="default",onChange:b=>C(b.target.value)},r.defaultModel===null&&(0,A.createElement)("option",{value:"",disabled:!0},n("imagegenDefaultModelNone")),j.map(b=>(0,A.createElement)("option",{key:b.id,value:b.id},_(b))))),S?(0,A.createElement)("div",{className:"bre-config-empty"},(0,A.createElement)("div",{className:"bre-config-empty-text"},n("imagegenEmptyText")),(0,A.createElement)("div",{className:"bre-config-empty-hint"},n("imagegenEmptyHint")),f===void 0?(0,A.createElement)("button",{className:"bre-config-btn-ghost",type:"button",onClick:k},n("imagegenFindSuspects")):f.length===0?(0,A.createElement)("div",{className:"bre-config-empty-hint"},n("imagegenNoSuspects")):(0,A.createElement)("div",{className:"bre-config-suspects"},f.map(b=>(0,A.createElement)("div",{key:`${b.route}/${b.modelId}`,className:"bre-config-suspect"},`${b.route} \xB7 ${b.label}`)),(0,A.createElement)("button",{className:"bre-config-btn-primary",type:"button",disabled:s==="mark",onClick:w},n("imagegenMarkSuspects",{count:f.length})),(0,A.createElement)("button",{className:"bre-config-btn-ghost",type:"button",onClick:()=>m(void 0)},n("cancel")))):(0,A.createElement)("div",{className:"bre-config-rows"},j.map(b=>{let L=r.defaultModel===b.id,H=Sy(N,b.endpoint.status);return(0,A.createElement)("div",{key:b.id,className:"bre-config-row"},(0,A.createElement)("div",{className:"bre-config-name"},(0,A.createElement)("div",{className:"bre-config-name-main"},b.label,L&&(0,A.createElement)("span",{className:"bre-config-badge bre-config-badge-default"},n("imagegenDefaultBadge"))),(0,A.createElement)("div",{className:"bre-config-name-sub"},h[b.route]??b.providerLabel??b.route,(0,A.createElement)("span",{className:H.className,title:n("imagegenEndpointBadgeHint")},H.text))),b.api!=="images"?(0,A.createElement)("span",{className:"bre-config-badge bre-config-badge-bad"},n("imagegenNoEndpoint")):(0,A.createElement)("div",{className:"bre-config-row-controls"},(0,A.createElement)("button",{className:"bre-config-btn-ghost",type:"button",disabled:s===b.id,onClick:()=>J(b.id)},n("imagegenTestEndpoint")),(0,A.createElement)("button",{className:"bre-config-btn-ghost",type:"button",disabled:s===b.id,onClick:()=>I(b.id)},n("imagegenProbe"))))})),(0,A.createElement)("div",{className:"bre-config-tool"},(0,A.createElement)("div",{className:"bre-config-tool-head"},(0,A.createElement)("span",null,n("imagegenToolTitle")),(0,A.createElement)("span",{className:"bre-config-tool-name"},r.tool.registered?r.tool.name??"generate_image":"\u2014")),(0,A.createElement)("div",{className:"bre-config-tool-status"},r.tool.registered?n("imagegenToolRegistered",{name:r.tool.name??"generate_image"}):n("imagegenToolUnregistered")),(0,A.createElement)("div",{className:"bre-config-tool-actions"},(0,A.createElement)("button",{className:"bre-config-btn-ghost",type:"button",disabled:u||S||r.defaultModel===null,onClick:W},n("imagegenToolTest"))),(0,A.createElement)("div",{className:"bre-config-tool-hint"},n("imagegenToolHint"))))}function Ry(e){let{t,onClose:n}=e,r=(0,A.useRef)(null);return(0,A.useEffect)(()=>{let o=i=>{i.key==="Escape"&&n()};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[n]),(0,A.createElement)("div",{className:"bre-config-backdrop",onMouseDown:o=>{o.target===o.currentTarget&&n()}},(0,A.createElement)("div",{className:"bre-config-pane",ref:r},(0,A.createElement)("div",{className:"bre-config-head"},(0,A.createElement)("span",{className:"bre-config-title"},t("configPaneTitle")),(0,A.createElement)("button",{className:"bre-config-close",type:"button","aria-label":t("configPaneClose"),onClick:n},"\u2715")),(0,A.createElement)("div",{className:"bre-config-body"},(0,A.createElement)(Ie,{fallbackText:t("configPaneFailed")},(0,A.createElement)(Ay,{api:e.api,t:e.t}))),(0,A.createElement)("div",{className:"bre-config-foot"},t("configPaneFoot"))))}function _f(e){let t=document.createElement("div");t.className="bre-config-pane-host",document.body.appendChild(t);let n=(0,Of.createRoot)(t),r=!0,o=()=>{r&&(r=!1,ke({wrapper:t,root:n}))};return n.render((0,A.createElement)(Ry,{api:e.api,t:e.t,onClose:o})),{close:o}}function Ff(e,t){let n=e.toLowerCase(),r=t.toLowerCase();return r.length===0||n.includes(r)}function Bf(e,t){let n=e.replace(/^\s+/,"");if(n.length===0)return t.map(a=>({label:a.isDefault?`${a.label}\uFF08\u9ED8\u8BA4\uFF09`:a.label,insertText:a.id,kind:"model",hint:a.id}));let r=n.match(/^(\S+)(\s+[\s\S]*)?$/);if(r===null)return[];let o=r[1];return t.filter(a=>Ff(a.id,o)||Ff(a.label,o)).map(a=>({label:a.isDefault?`${a.label}\uFF08\u9ED8\u8BA4\uFF09`:a.label,insertText:a.id,kind:"model",hint:a.id}))}var Hy="imagegen",Cy=3e4,yr;function Kf(){yr=void 0}async function Ny(){if(yr!==void 0&&Date.now()-yr.at<Cy)return yr.models;let e=await Mt(),t=e.ok?e.data.models.map(n=>({id:n.id,label:n.label,isDefault:e.data.defaultModel===n.id})):[];return yr={at:Date.now(),models:t},t}function qf(e){let t;try{t=e.inputTriggers}catch{t=void 0}if(t===void 0||typeof t.registerSource!="function")return()=>{};let n=!0;try{t.registerSource({trigger:"/",name:Hy,order:900,candidates:r=>{let o=typeof r?.text=="string"?r.text:"";return/^\/?生图(?:\s|$)/.test(o)?Ny().then(i=>Bf(o.replace(/^\/?生图/,""),i)):[]}})}catch{n=!1}return()=>{n=!1}}var jt=require("react");var Gf="tool.call.images";function Iy(e){if(e===void 0||typeof e!="object")return[];let t=e.resultView?.content??e.content;if(!Array.isArray(t))return[];let n=[];for(let r of t)if(r!==null&&typeof r=="object"&&r.type==="image"){let o=r.attachment;o!==void 0&&typeof o.attachmentId=="string"&&n.push({attachment:o})}return n}function Py(e){let t=Array.isArray(e.content)?e.content:[];for(let n of t)if(n!==null&&typeof n=="object"&&n.type==="text"&&typeof n.text=="string")return n.text;return null}function Dy(e){let t=e.meta;if(t===void 0||typeof t!="object")return null;let n=[],r=t.paramsUsed;typeof t.model=="string"&&t.model.length>0&&n.push(r===void 0?t.model:`${t.model} \xB7 ${r.size} \xB7 ${r.quality} \xB7 n ${r.n}`);let o=(t.images??[]).map(i=>i.filePath).filter(i=>typeof i=="string");return o.length>0&&n.push(o.join(`
|
|
4568
|
+
`)),Array.isArray(t.revisions)&&t.revisions.length>0&&n.push(t.revisions.join("\u3001")),n.length>0?n.join(`
|
|
4569
|
+
`):null}function Oy(e){let t=e.block;if(!(t!==void 0&&typeof t=="object"&&"kind"in t))return(0,jt.createElement)("div",{className:"bre-image-card","aria-busy":!0},(0,jt.createElement)("span",{className:"bre-image-card-running"},e.t("imagegenCardRunning")));let r=Iy(t);if(r.length===0){let i=Py(t);return(0,jt.createElement)("div",{className:"bre-image-card"},i===null?null:(0,jt.createElement)("div",{className:"bre-image-card-caption"},i))}let o=Dy(t);return(0,jt.createElement)("div",{className:"bre-image-card"},typeof e.renderSlot=="function"&&typeof e.loadImage=="function"?e.renderSlot(Gf,{images:r,loadImage:e.loadImage,align:"start"}):null,o===null?null:(0,jt.createElement)("div",{className:"bre-image-card-caption"},o))}function _y(e,t,n){if(e===void 0)return()=>{};let r;try{let o=e.register.bind(e),i=e.inject("tool.call.toolview",()=>o({name:"tool.call.toolview",key:t,children:{[Gf]:{kind:"single",scope:"session"}}},a=>Oy({...a,t:n})));typeof i=="function"&&(r=i)}catch{return()=>{}}return()=>{r?.()}}function Wf(e,t){let n=e.slots;e.effect(()=>{let r,o=!0,i=a=>{!o||r!==void 0||typeof a!="string"||a.length===0||(r=_y(n,a,t))};return i(Uo()?.tool.name),r===void 0&&Mt().then(a=>{a.ok&&i(a.data.tool.name)}).catch(()=>{}),()=>{o=!1,r?.()}},"dsh-model-think-level: image tool card")}var Uf=200,Fy=we,By=["slots","locale","connection","remote","remote.settings"];function Ky(e){e.effect(()=>e.locale.register(ei,{zh:as,en:is}),"dsh-model-think-level: dictionaries");let t=document.createElement("style");t.dataset.plugin=we,t.dataset.pluginStyles=we,t.textContent=As,document.head.appendChild(t),e.effect(()=>()=>t.remove(),"dsh-model-think-level: stylesheet");let n=(()=>{try{let h=e.get?.("configForms");try{let y=h?.get?.(Ce);if(y!==void 0)return y}catch{}return e.get?.("settingsScope")?.bind?.({namespace:Ce})}catch{return}})(),r=n===void 0?{settings:e.remote.settings}:{settings:e.remote.settings,scope:n},o=e.locale.bind(ei),i=()=>{let h=e.locale;return typeof h.subscribe=="function"&&typeof h.getSnapshot=="function"?h:void 0},a=h=>{let g=i();return g===void 0?h():(0,zf.createElement)(os,{locale:g,children:h})},s=ld({api:r}),d=Fs(r),l=Tf({ctx:e,configuredEffort:s.of}),c=dd({menuOf:id,triggerOf:ad,t:o,refreshed:a,sliderEnabled:Je,directory:l.ensure,configuredInputs:d}),f=cd({api:r}),m,u=bf({ctx:e,api:r,t:o,onIdle:f.run,refreshed:a,configSeat:{t:o,onOpen:()=>{m?.close(),m=_f({api:r,t:o})}}}),p=()=>{l.ensure(),c.reconcile()};e.effect(()=>(u.start(p),()=>{u.teardown(),c.dispose(),l.dispose(),m?.close(),m=void 0}),"dsh-model-think-level: DOM injector"),e.effect(()=>{let h=()=>{u.flushOnUnload(),Ef()};return window.addEventListener("pagehide",h),()=>{window.removeEventListener("pagehide",h)}},"dsh-model-think-level: ledger flush on unload"),e.effect(()=>{let g=Qa(()=>{u.state.describePromise=void 0,s.invalidate(),d.invalidate(),f.invalidate(),Kf(),u.schedule()},Uf),y=[e.remote.$on("settings/document-updated",k=>{k===Ce&&(g.schedule(),document.dispatchEvent(new CustomEvent(qn,{detail:{ns:k}})))}),e.on("connection/reset",g.schedule)];return()=>{g.dispose();for(let k of y)k()}},"dsh-model-think-level: pushed invalidations"),e.effect(()=>{let h=C=>{C.key===Ar?ls(C.newValue!=="false"):C.key===Hr?ms(Zt(C.newValue)):C.key===Nr?ws(hs(C.newValue)):C.key===Pr&&Ms(li(C.newValue))};window.addEventListener("storage",h);let g=Rr(()=>{u.schedule()}),y=Cr(()=>{u.schedule()}),k=Ir(()=>{u.schedule()}),w=Dr(()=>{u.schedule()});return()=>{window.removeEventListener("storage",h),g(),y(),k(),w()}},"dsh-model-think-level: client preferences"),e.effect(()=>Pf(e,o),"dsh-model-think-level: footer slot activation"),e.effect(()=>Nf(e,r,o),"dsh-model-think-level: provider-card slot activation"),e.effect(()=>qf(e),"dsh-model-think-level: imagegen completion source"),e.effect(()=>Wf(e,o),"dsh-model-think-level: image tool card")}
|
|
3927
4570
|
|
|
3928
4571
|
return module.exports;
|
|
3929
4572
|
}
|