@tickernelz/wardmote-ui 2026.1114.1 → 2026.1114.3
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/dist/assets/{ActiveAgentsPanel-CKzCe8AC.js → ActiveAgentsPanel-CF0fwsze.js} +1 -1
- package/dist/assets/{AdapterManager-DFPaPUUr.js → AdapterManager-DUXWwNxv.js} +1 -1
- package/dist/assets/{AdvancedToolsRoute-CN5fWS4T.js → AdvancedToolsRoute-BamlkE3p.js} +1 -1
- package/dist/assets/{AgentActionButtons-a9LacJPP.js → AgentActionButtons-CPIhsP04.js} +1 -1
- package/dist/assets/{AgentBubbleActionRow-DIr3TdR9.js → AgentBubbleActionRow-BUAUmJKa.js} +1 -1
- package/dist/assets/{AgentChat-D5FDUYuV.js → AgentChat-BAn_ghsu.js} +1 -1
- package/dist/assets/{AgentChats-TN5SE_gN.js → AgentChats-f73hodzr.js} +1 -1
- package/dist/assets/{AgentDefaults-CiVVS_pQ.js → AgentDefaults-BL1XYvEo.js} +1 -1
- package/dist/assets/{AgentDetail-bCAmWRXs.js → AgentDetail-DthxFfuB.js} +1 -1
- package/dist/assets/{AgentTodoCard-BpmvHEsm.js → AgentTodoCard-BvgkWD0T.js} +1 -1
- package/dist/assets/{Agents-CToMMxGu.js → Agents-D5qI6yZZ.js} +3 -3
- package/dist/assets/{AppDetail-P807ou0a.js → AppDetail-B6PtMl8J.js} +1 -1
- package/dist/assets/{AppNotConnected-DuA4PukX.js → AppNotConnected-C_tGn786.js} +1 -1
- package/dist/assets/{ApprovalCard-BDdZDBMj.js → ApprovalCard-DrfZAdGQ.js} +1 -1
- package/dist/assets/{ApprovalDetail-CVgy1uNi.js → ApprovalDetail-sfPpfdXc.js} +1 -1
- package/dist/assets/{ApprovalPayload-H5zW6yQ4.js → ApprovalPayload-C4F3ItGH.js} +1 -1
- package/dist/assets/{Approvals-DL6kx45P.js → Approvals-DZoMl7_m.js} +1 -1
- package/dist/assets/{AppsConnect-DH7aSjtS.js → AppsConnect-D8Gu187f.js} +1 -1
- package/dist/assets/{AppsReview-Bf7oB0ES.js → AppsReview-DokFETm0.js} +1 -1
- package/dist/assets/{ArtifactCard-Cp4KPgZl.js → ArtifactCard-BTf2-JIV.js} +1 -1
- package/dist/assets/{Artifacts-Dz3eHCaQ.js → Artifacts-CK8FaygC.js} +1 -1
- package/dist/assets/{AssistantConnection-5Y4fBVXq.js → AssistantConnection-BlKC7jk0.js} +1 -1
- package/dist/assets/{AttentionInteractionResolver-DlP6a6AG.js → AttentionInteractionResolver-C2iz6oqT.js} +1 -1
- package/dist/assets/{AuditHub-Dz2UXl0c.js → AuditHub-DMhunMn8.js} +1 -1
- package/dist/assets/{BoardChat-DsMVXf5M.js → BoardChat-C4W8JLKB.js} +1 -1
- package/dist/assets/{BootstrapSetupUxLab-CWWisaHp.js → BootstrapSetupUxLab-D58OwniR.js} +1 -1
- package/dist/assets/{Browse-Be6aSv-F.js → Browse-BDjohBak.js} +1 -1
- package/dist/assets/{BudgetPolicyCard-Dka022-Z.js → BudgetPolicyCard-DfAAgk9Z.js} +1 -1
- package/dist/assets/{CaseDetail-DdJrlm0m.js → CaseDetail-CL0FC5sG.js} +1 -1
- package/dist/assets/{Cases-Da1szfrr.js → Cases-C-7dXrEt.js} +1 -1
- package/dist/assets/{ChatEndpointDetail-DSOH-zfs.js → ChatEndpointDetail-C-IYAYG8.js} +1 -1
- package/dist/assets/{ChatEndpointSetup-J23lq-xi.js → ChatEndpointSetup-CM3QixMj.js} +1 -1
- package/dist/assets/{ChoiceControls-B9yrYshK.js → ChoiceControls-3Qpci4yE.js} +1 -1
- package/dist/assets/{Companies-BkHWSxdB.js → Companies-97toQ8Cw.js} +1 -1
- package/dist/assets/{CompanyAccess-BaiGlxY1.js → CompanyAccess-CKhS1BaS.js} +1 -1
- package/dist/assets/{CompanyActivity-CMBXXwCw.js → CompanyActivity-DzNrAyAb.js} +1 -1
- package/dist/assets/{CompanyConnections-CVzsivTW.js → CompanyConnections-ORCH4i3U.js} +1 -1
- package/dist/assets/{CompanyEnvironments-K7piWRrx.js → CompanyEnvironments-DphURbtb.js} +1 -1
- package/dist/assets/{CompanyExport-Bo8tUPaY.js → CompanyExport-XeVCUcK3.js} +1 -1
- package/dist/assets/{CompanyImport-CBVjSXPA.js → CompanyImport-DPKpUaRa.js} +1 -1
- package/dist/assets/{CompanySettings-CuU9qSp5.js → CompanySettings-4JQpzuS1.js} +1 -1
- package/dist/assets/{CompanySettingsPluginPage-59_bMQQ3.js → CompanySettingsPluginPage-cVvXh0_G.js} +1 -1
- package/dist/assets/{CompanySkills-GBJMThWx.js → CompanySkills-BA_9Ztwj.js} +1 -1
- package/dist/assets/{ComposerAddMenu-D9z2INup.js → ComposerAddMenu-DNp4ecG8.js} +1 -1
- package/dist/assets/{ConfigureBuiltInAgentModal-D8Xnl51H.js → ConfigureBuiltInAgentModal-CQCHDkl4.js} +1 -1
- package/dist/assets/{ConnectionSetupFlow-DKjP5RBZ.js → ConnectionSetupFlow-BaarToKu.js} +1 -1
- package/dist/assets/{CopyableGatewayUrl-GuvA-DoQ.js → CopyableGatewayUrl-DxQsV7Hr.js} +1 -1
- package/dist/assets/{Dashboard-Cgj9BeTt.js → Dashboard--iaPJqJp.js} +1 -1
- package/dist/assets/{DashboardLive-Ku1cHAj9.js → DashboardLive-4rGeotay.js} +1 -1
- package/dist/assets/{DecisionDateChips-Z97mgInq.js → DecisionDateChips-CJOLtNrJ.js} +1 -1
- package/dist/assets/{DecisionModelSettings-NrNERkaW.js → DecisionModelSettings-D-OxKIGP.js} +1 -1
- package/dist/assets/{DecisionQueuePage-D8cyKm4V.js → DecisionQueuePage-D-kNFav_.js} +1 -1
- package/dist/assets/{DesignGuide-DvO3NaE-.js → DesignGuide-D7486q4b.js} +1 -1
- package/dist/assets/{DocumentFrameHeader-DTSqcw4Q.js → DocumentFrameHeader-B61HhahB.js} +1 -1
- package/dist/assets/{EmailEndpointSetup-Cm_KKjjw.js → EmailEndpointSetup-6OHb9B4q.js} +1 -1
- package/dist/assets/{ExecutionWorkspaceDetail-CVB4ZY8I.js → ExecutionWorkspaceDetail-BGV-9D5Y.js} +1 -1
- package/dist/assets/{FolderControls-B7TWghGc.js → FolderControls-L2RzbfdQ.js} +1 -1
- package/dist/assets/{GatewayDetail-DB1J44bF.js → GatewayDetail-CdXNQ9gD.js} +1 -1
- package/dist/assets/{GatewaysList-CKSwMmOi.js → GatewaysList-B0Jq1IRC.js} +1 -1
- package/dist/assets/{GoalDetail-Bscma2qU.js → GoalDetail-D2VhPtvw.js} +1 -1
- package/dist/assets/{GoalTree-jEFB788p.js → GoalTree-kFpgH4dA.js} +1 -1
- package/dist/assets/{Goals-jLNZ4UKT.js → Goals-B-_gq_Qu.js} +1 -1
- package/dist/assets/{ImageGalleryModal-CghUxjQC.js → ImageGalleryModal-DzKBMOnu.js} +1 -1
- package/dist/assets/{Inbox-DHwNNh-Z.js → Inbox-zllmqRcB.js} +1 -1
- package/dist/assets/{InstanceAdvanced-C5IIPBwh.js → InstanceAdvanced-B7tDfjwG.js} +1 -1
- package/dist/assets/{InviteLanding-BHmCRaWY.js → InviteLanding-brwa_8NC.js} +1 -1
- package/dist/assets/{IssueChatLongThreadPerf-JH8rtLk0.js → IssueChatLongThreadPerf-D0HJe6IV.js} +1 -1
- package/dist/assets/{IssueChatThread-ByTyrsxz.js → IssueChatThread-CMXzuvrF.js} +1 -1
- package/dist/assets/{IssueDetail-BIif8Swu.js → IssueDetail-DGdg-mB8.js} +1 -1
- package/dist/assets/{IssueDocumentAnnotations-BVdH4RTa.js → IssueDocumentAnnotations-BK-LgExc.js} +1 -1
- package/dist/assets/{IssueOutputSection-CFE6aU9L.js → IssueOutputSection-aSyiE1pg.js} +1 -1
- package/dist/assets/{IssueRecoveryActionCard-DBgE7aMm.js → IssueRecoveryActionCard-vAuL_OEC.js} +1 -1
- package/dist/assets/{IssueThreadInteractionCard-C3LFe8cu.js → IssueThreadInteractionCard-wFidFTIh.js} +1 -1
- package/dist/assets/{Issues-B5QG33RC.js → Issues-CsmM33z_.js} +1 -1
- package/dist/assets/{LiveNowTodoLine-D52WDE8-.js → LiveNowTodoLine-CP32NNp_.js} +1 -1
- package/dist/assets/{ManagedAiConnectionDetails-C9nV0oIT.js → ManagedAiConnectionDetails-Ba0awZ-O.js} +1 -1
- package/dist/assets/{McpConnect-Bk8Qskqw.js → McpConnect-CYLP1yLX.js} +1 -1
- package/dist/assets/{MembershipAction-DjdBY6Bk.js → MembershipAction-CKs7Ua9x.js} +1 -1
- package/dist/assets/{ModelsAndProviders-BtbhNxf_.js → ModelsAndProviders-gaR7HDQm.js} +1 -1
- package/dist/assets/{NewAgent-C4JqnMkp.js → NewAgent-DBQzvxIr.js} +1 -1
- package/dist/assets/{OmpAllSettings-aHENTYf5.js → OmpAllSettings-B_Knr51Z.js} +1 -1
- package/dist/assets/{PipelineSettings-CCoxV9Es.js → PipelineSettings-Dl-94FB5.js} +1 -1
- package/dist/assets/{Pipelines-DaQPh688.js → Pipelines-CY9hGe0h.js} +1 -1
- package/dist/assets/{PixelsOffice-D1X7mdpk.js → PixelsOffice-BgyGZsiV.js} +1 -1
- package/dist/assets/{PluginPage-B4kdPADI.js → PluginPage-CMA4Ei50.js} +1 -1
- package/dist/assets/{PluginSettings-yP8NX-sM.js → PluginSettings-Cm4H1JRT.js} +1 -1
- package/dist/assets/{ProfileDetailRoute-DMdAvFmb.js → ProfileDetailRoute-BEBctbC6.js} +1 -1
- package/dist/assets/{ProfileSettings-DVm3Tqzs.js → ProfileSettings-Djo7BLIj.js} +1 -1
- package/dist/assets/{ProfileWizardRoute-CijS7-aN.js → ProfileWizardRoute-DxLujEtD.js} +1 -1
- package/dist/assets/{ProjectDetail-DeLSGbmz.js → ProjectDetail-CmmdvUHn.js} +1 -1
- package/dist/assets/{ProjectWorkspaceDetail-DPajDjA-.js → ProjectWorkspaceDetail-BsA0hJ-k.js} +1 -1
- package/dist/assets/{ProjectWorkspacesContent-BCATCcZI.js → ProjectWorkspacesContent-BNNI_WAk.js} +1 -1
- package/dist/assets/{Projects-DPmo6PFV.js → Projects-BTAauZr0.js} +1 -1
- package/dist/assets/{PublicIssueSharePage-B_W1Qpy_.js → PublicIssueSharePage-DdPjfmD9.js} +1 -1
- package/dist/assets/{ReviewQueueCard-DhfCjwYP.js → ReviewQueueCard-BC6VY8Bc.js} +1 -1
- package/dist/assets/{RichWorkProductCard-rJC8tWnB.js → RichWorkProductCard-ClpMt_Bh.js} +1 -1
- package/dist/assets/{RoutineDetail-Cb0oYk5B.js → RoutineDetail-BT6_GKnC.js} +1 -1
- package/dist/assets/{RoutineRunVariablesDialog-CWNUGmiH.js → RoutineRunVariablesDialog-D_Mls1sV.js} +1 -1
- package/dist/assets/{Routines-Ct6W3Ht-.js → Routines-4LevOfvV.js} +1 -1
- package/dist/assets/{ScrollToBottom-BvL4b3BQ.js → ScrollToBottom-jItsgDR8.js} +1 -1
- package/dist/assets/{Search-CXiBakEC.js → Search-bmcm0_m_.js} +1 -1
- package/dist/assets/{Secrets-XUpMCMhK.js → Secrets-DfR1fBAZ.js} +1 -1
- package/dist/assets/{SkillSourceTree-Brg47aIX.js → SkillSourceTree--FWKWyF3.js} +1 -1
- package/dist/assets/{SkillSources-C3kuN9Hz.js → SkillSources-jUDjqy5i.js} +1 -1
- package/dist/assets/{SkillStudio-DVVVKjdn.js → SkillStudio-BsqtUnzF.js} +1 -1
- package/dist/assets/{SourceTrustBadge-D-MXuX_l.js → SourceTrustBadge-CfBrvKL3.js} +1 -1
- package/dist/assets/{StatusCards-BmNOGr1d.js → StatusCards-Dt3zorUZ.js} +1 -1
- package/dist/assets/{SummarySlotCard-DiTaQ4km.js → SummarySlotCard-D1C0qH2L.js} +1 -1
- package/dist/assets/{TaskChatLab-fOJfHKjI.js → TaskChatLab-B0coUvdp.js} +1 -1
- package/dist/assets/{TaskChatMarker-Cgyrmeab.js → TaskChatMarker-C40twVjh.js} +1 -1
- package/dist/assets/{TaskChatProtocolCard-DrIe_IYV.js → TaskChatProtocolCard--bi_tc6i.js} +1 -1
- package/dist/assets/{TaskChatThreadView-DKqNA1fZ.js → TaskChatThreadView-DkzFDrLW.js} +1 -1
- package/dist/assets/{TaskDetailRelationsPanel-C9mJfMvL.js → TaskDetailRelationsPanel-DZGkinoJ.js} +1 -1
- package/dist/assets/{TaskTreeControls-B1CSnDVK.js → TaskTreeControls-DznugVpi.js} +1 -1
- package/dist/assets/Terminal-NjEb5-2b.js +1 -0
- package/dist/assets/TerminalView-DZxK2Ei5.js +58 -0
- package/dist/assets/{TrustPresetSection-D4qB_VZo.js → TrustPresetSection-CjNwNBo3.js} +1 -1
- package/dist/assets/{UserProfile-Cavc3nhB.js → UserProfile-Dujv3qdz.js} +1 -1
- package/dist/assets/{WhatNeedsMe-B7BSt_wb.js → WhatNeedsMe-C9P2EsqQ.js} +1 -1
- package/dist/assets/{Workspaces-CDTiwIHd.js → Workspaces-BTgSx9nA.js} +1 -1
- package/dist/assets/{connection-owner-Cx9obLlP.js → connection-owner-DL4yKhSt.js} +1 -1
- package/dist/assets/dist-ypeTPGg_.js +1 -0
- package/dist/assets/dropdown-menu-DEO3mF_E.js +1 -0
- package/dist/assets/{environment-variables-editor-CCxeFKKk.js → environment-variables-editor-0qgSPgNN.js} +1 -1
- package/dist/assets/{index-B7mmhFG7.js → index-3AxqhPET.js} +4 -4
- package/dist/assets/index-B5bd7Tk6.css +2 -0
- package/dist/assets/{issue-properties-C_y5-tny.js → issue-properties-B1cYnBDU.js} +1 -1
- package/dist/assets/{issue-workspace-selection-ChtddJZC.js → issue-workspace-selection-S8UgGgK1.js} +1 -1
- package/dist/assets/{pipeline-stage-presentation-jxAxpF6f.js → pipeline-stage-presentation-5UBw7nsb.js} +1 -1
- package/dist/assets/{shared-hwt7Xn4W.js → shared-4LF6wQ38.js} +1 -1
- package/dist/assets/{tool-taxonomy-6170LibQ.js → tool-taxonomy-B5zpbkHA.js} +1 -1
- package/dist/assets/{transcript-adapter-C9uEslxp.js → transcript-adapter-C29ZJiU2.js} +1 -1
- package/dist/assets/{useSummaryDraftStream-BulT3Wwh.js → useSummaryDraftStream-R2Y2bAUU.js} +1 -1
- package/dist/index.html +7 -6
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/dist/assets/Terminal-CGmILZtz.js +0 -1
- package/dist/assets/TerminalView-BqCU9Vc3.js +0 -58
- package/dist/assets/dropdown-menu-CqRAF7Oj.js +0 -1
- package/dist/assets/index-KZ2bEg2H.css +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
var Oe=Object.defineProperty;var s=(a,t)=>Oe(a,"name",{value:t,configurable:!0});import{i as Ce}from"./rolldown-runtime-ZpX3ckPj.js";import{Ai as Me,An as Z,Cn as Fe,Dn as Ke,En as Ue,Fi as ze,Mn as Ge,On as Be,Sn as re,Tn as qe,h as Ve,jn as We,ki as He,kn as ne,l as J,na as $e,qi as Qe,ta as Ye,wn as Je}from"./createLucideIcon-DJi9suAC.js";import{g as Xe}from"./star-BZgQbzhV.js";import{X as Q,_ as A,p as le,t as w,v as ae}from"./queryKeys-DYV5MhM_.js";import{u as H}from"./companies-query-D9PxIiMT.js";import{n as Ze}from"./CompanyContext-CSrVsSze.js";import{n as ea,r as aa,t as sa}from"./collapsible-CqjPlqOa.js";import{a as ta,c as na,i as ia,n as ra,o as la,r as oa,s as ca,t as da}from"./alert-dialog-Blls2GnU.js";import{t as ma}from"./chevron-down-BCvxsWfI.js";import{t as je}from"./SearchableSelect-CIJ5K8ih.js";import{t as N}from"./button-CMwV3L1P.js";import{t as ua}from"./minus-WOgDAWiC.js";import{t as ha}from"./plus-C6fnr28l.js";import{t as Te}from"./x-DRDFdlYE.js";import{t as xa}from"./badge-DuA2EgZC.js";import{n as pa}from"./ToastContext-DMdt9oTd.js";import{t as L}from"./instanceSettings-D8g_QlS-.js";import{t as K}from"./input-DobnTAyB.js";import{t as ga}from"./health-DF7yrggW.js";import{n as Ae}from"./BreadcrumbContext-BVZDZoC0.js";import{t as va}from"./assets-TRDkBfss.js";import{t as $}from"./toggle-switch-BHxNtSq9.js";import{i as fa,n as ya,o as ba,r as ja,s as Na,t as ce}from"./select-V0Hm_q4f.js";import{a as de,o as ka}from"./agent-config-primitives-BsZUnbf2.js";import{Jr as Sa,Rt as wa,Yr as Ea,ka as Ca,qr as Ta,xa as _e}from"./index-B7mmhFG7.js";import{r as Le}from"./interaction-audience-BRS_4X7S.js";import{t as Aa}from"./DecisionModelSettings-NrNERkaW.js";var _a={openai_compatible:["af","ar","hy","az","be","bs","bg","ca","zh","hr","cs","da","nl","en","et","fi","fr","gl","de","el","he","hi","hu","is","id","it","ja","kn","kk","ko","lv","lt","mk","ms","mr","mi","ne","no","fa","pl","pt","ro","ru","sr","sk","sl","es","sw","sv","tl","ta","th","tr","uk","ur","vi","cy"],deepgram:["multi","af","af-ZA","ar","ar-AE","ar-SA","ar-QA","ar-KW","ar-SY","ar-LB","ar-PS","ar-JO","ar-EG","ar-SD","ar-TD","ar-MA","ar-DZ","ar-TN","ar-IQ","ar-IR","hy","as","as-IN","be","bn","bs","bg","ca","zh-HK","zh","zh-CN","zh-Hans","zh-TW","zh-Hant","hr","cs","cs-CZ","da","da-DK","nl","en","en-US","en-AU","en-GB","en-IN","en-NZ","et","fi","nl-BE","fr","fr-CA","ka","ka-GE","de","de-CH","el","gu","gu-IN","he","hi","hu","id","it","ja","kn","kk","kk-KZ","ko","ko-KR","lv","lt","mk","ms","mr","mn","ne","no","ps","ps-AF","fa","pl","pt","pt-BR","pt-PT","pa","pa-IN","ro","ru","sr","sk","sl","es","es-419","sv","sv-SE","tl","ta","te","th","th-TH","tr","tr-TR","uk","ur","vi"],elevenlabs:["af","am","ar","hy","as","ast","az","be","bn","bs","bg","my","yue","ca","ceb","hr","cs","da","nl","en","et","fil","fi","fr","ff","gl","ka","de","el","gu","ha","he","hi","hu","is","id","it","ja","jv","kam","kn","kk","ko","ky","lo","lv","ln","lt","lg","lb","mk","ms","ml","mt","zh","mi","mr","mn","ne","no","oc","or","ps","fa","pl","pt","pa","ro","ru","sr","sn","sd","sk","sl","so","ckb","es","sw","sv","tg","ta","te","th","tr","uk","ur","uz","vi","cy","wo","zu"],google:["af-ZA","am-ET","ar-AE","ar-BH","ar-DZ","ar-EG","ar-IL","ar-IQ","ar-JO","ar-KW","ar-LB","ar-MA","ar-MR","ar-OM","ar-PS","ar-QA","ar-SA","ar-SY","ar-TN","ar-XA","ar-YE","as-IN","ast-ES","az-AZ","be-BY","bg-BG","bn-BD","bn-IN","bs-BA","ca-ES","ceb-PH","ckb-IQ","cmn-Hans-CN","cmn-Hant-TW","cs-CZ","cy-GB","da-DK","de-DE","el-GR","en-AU","en-GB","en-IN","en-PH","en-US","es-419","es-ES","es-MX","es-US","et-EE","eu-ES","fa-IR","ff-SN","fi-FI","fil-PH","fr-CA","fr-FR","ga-IE","gl-ES","gu-IN","ha-NG","hi-IN","hr-HR","hu-HU","hy-AM","id-ID","ig-NG","is-IS","it-IT","iw-IL","ja-JP","jv-ID","ka-GE","kam-KE","kea-CV","kk-KZ","km-KH","kn-IN","ko-KR","ky-KG","lb-LU","lg-UG","ln-CD","lo-LA","lt-LT","luo-KE","lv-LV","mi-NZ","mk-MK","ml-IN","mn-MN","mr-IN","ms-MY","mt-MT","my-MM","ne-NP","nl-NL","no-NO","nso-ZA","ny-MW","oc-FR","om-ET","or-IN","pa-Guru-IN","pl-PL","ps-AF","pt-BR","pt-PT","ro-RO","ru-RU","rup-BG","sd-IN","si-LK","sk-SK","sl-SI","sn-ZW","so-SO","sq-AL","sr-RS","su-ID","sv-SE","sw","sw-KE","ta-IN","te-IN","tg-TJ","th-TH","tr-TR","uk-UA","umb-AO","ur-PK","uz-UZ","vi-VN","wo-SN","xh-ZA","yo-NG","yue-Hant-HK","zu-ZA"]},La=["us","eu","global"],me={openai_compatible:"OPENAI_API_KEY",deepgram:"DEEPGRAM_API_KEY",elevenlabs:"ELEVENLABS_API_KEY",google:"GOOGLE_APPLICATION_CREDENTIALS"},j=Ce($e(),1),e=Ce(Ye(),1),Pa={suggest_tasks:"Suggested tasks",ask_user_questions:"Ask user questions",request_confirmation:"Confirmations",request_checkbox_confirmation:"Checkbox confirmations",request_item_verdicts:"Item verdicts",connection_intent:"Connection requests"},ge="default",Ra=["not_creator","human_only"],Pe={defaultPolicy:"Anyone (default)",cap:"No cap"},fe={defaultPolicy:"New cards are open — the board or any agent can respond, including the one that asked.",cap:"A request keeps whatever audience it asks for."},Ia={anyone:fe.defaultPolicy,not_creator:"New cards exclude the agent that created them, so the answer comes from someone else.",human_only:"New cards wait for a person on the board. Agents are turned away.",chat_endpoint_owner:"Reserved for chat-channel approvals."},Da={anyone:fe.cap,not_creator:"Even a card that asks for Anyone is narrowed to exclude its creator.",human_only:"Every card of this kind waits for a person, whatever it asked for.",chat_endpoint_owner:"Reserved for chat-channel approvals."};function Oa(a){const t=a==="cap"?Da:Ia;return[{value:ge,label:Pe[a],effect:fe[a]},...Ra.map(r=>({value:r,label:Le(r),effect:t[r]}))]}s(Oa,"governanceOptions");function Ma(a,t){return t==="default"?Pe[a]:Le(t)}s(Ma,"governanceValueLabel");function Ne(a){if(!a)return ge;const t=Qe(a);return t==="anyone"?ge:t}s(Ne,"toGovernanceSelectValue");function Fa(a,t,r,o){const n={...a},c={...n[t]??{}};return o==="default"?delete c[r]:c[r]=o,c.defaultPolicy===void 0&&c.cap===void 0?delete n[t]:n[t]=c,n}s(Fa,"applyGovernanceChange");function ke({field:a,value:t,onChange:r,disabled:o,testId:n,ariaLabel:c,mobileLabel:d}){const x=Oa(a);return(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("span",{className:"mb-1 block text-xs font-medium text-ink-3 uppercase tracking-wide sm:hidden",children:d}),(0,e.jsxs)(ya,{value:t,onValueChange:s(l=>r(l),"onValueChange"),disabled:o,children:[(0,e.jsx)(ba,{size:"sm","aria-label":c,className:"w-full min-w-0 text-xs sm:w-(--sz-208px)","data-testid":n,children:(0,e.jsx)(Na,{children:Ma(a,t)})}),(0,e.jsx)(ja,{className:"max-w-(--sz-280px) sm:max-w-(--sz-360px)",children:x.map(l=>(0,e.jsx)(fa,{value:l.value,textValue:l.label,className:"text-xs",children:(0,e.jsxs)("span",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,e.jsx)("span",{children:l.label}),(0,e.jsx)("span",{className:"text-(length:--text-micro) text-ink-3",children:l.effect})]})},l.value))})]})]})}s(ke,"GovernanceSelect");function Ka({governance:a,onChange:t,isPending:r,errorMessage:o}){return(0,e.jsxs)("div",{className:"space-y-4","data-testid":"company-settings-interaction-governance-section",children:[(0,e.jsx)("div",{className:"text-xs font-medium text-ink-3 uppercase tracking-wide",children:"Interaction governance"}),(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("p",{className:"text-sm text-ink-3",children:["Thread interactions are open by default:"," ",(0,e.jsx)("span",{className:"font-medium text-ink",children:"Anyone"})," in the organization — the board or any agent, including the one that asked — can respond. Narrow a kind only when you need to."," ",(0,e.jsx)("span",{className:"font-medium text-ink",children:"Default policy"})," is the audience new cards get when the requester does not ask for one;"," ",(0,e.jsx)("span",{className:"font-medium text-ink",children:"Cap"})," narrows every request of that kind and can never widen one. Tool-approval confirmations always stay"," ",(0,e.jsx)("span",{className:"font-medium text-ink",children:"Human only"}),"."]}),(0,e.jsxs)("div",{className:"grid grid-cols-1 gap-y-4 sm:grid-cols-[1fr_auto_auto] sm:items-center sm:gap-x-4 sm:gap-y-2.5",children:[(0,e.jsx)("div",{className:"hidden text-xs font-medium text-ink-3 uppercase tracking-wide sm:block",children:"Kind"}),(0,e.jsx)("div",{className:"hidden text-xs font-medium text-ink-3 uppercase tracking-wide sm:block",children:"Default policy"}),(0,e.jsx)("div",{className:"hidden text-xs font-medium text-ink-3 uppercase tracking-wide sm:block",children:"Cap"}),ze.map(n=>{const c=a[n]??{},d=Pa[n];return(0,e.jsxs)(j.Fragment,{children:[(0,e.jsx)("div",{className:"text-sm font-medium sm:font-normal",children:d}),(0,e.jsx)(ke,{field:"defaultPolicy",testId:`governance-${n}-default`,ariaLabel:`Default resolver audience for ${d}`,mobileLabel:"Default policy",value:Ne(c.defaultPolicy),disabled:r,onChange:s(x=>t(n,"defaultPolicy",x),"onChange")}),(0,e.jsx)(ke,{field:"cap",testId:`governance-${n}-cap`,ariaLabel:`Resolver cap for ${d}`,mobileLabel:"Cap",value:Ne(c.cap),disabled:r,onChange:s(x=>t(n,"cap",x),"onChange")})]},n)})]}),o?(0,e.jsx)("span",{className:"text-xs text-bad",children:o}):null]})]})}s(Ka,"InteractionGovernancePanel");function Ua({deploymentMode:a,deploymentExposure:t}){if(!a)return null;const r=a==="local_trusted"?"Local trusted":`Authenticated ${t??"private"}`;return(0,e.jsx)(xa,{variant:"outline",children:r})}s(Ua,"ModeBadge");var za={orphan_objects:"Orphaned files in storage",orphan_assets:"Unreferenced uploads",closed_tasks:"Attachments of closed tasks"},Ga={setting:"set here",env:"from WARDMOTE_ATTACHMENT_MAX_BYTES",default:"built-in default"};function ee(a,t){return a instanceof Error&&a.message?a.message:t}s(ee,"errorText");function ve(a,t,r){const o=a.trim();if(!/^\d+$/.test(o))return null;const n=Number(o);return n>=t&&n<=r?n:null}s(ve,"parseWholeNumber");function Ba({attachmentMaxMegabytes:a,attachmentRetention:t,effectiveLimit:r}){return(0,e.jsxs)("section",{className:"space-y-6",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Files and storage"}),(0,e.jsx)("p",{className:"max-w-2xl text-sm text-ink-3",children:"Control how large uploaded files may be and whether old attachments are cleaned up automatically."})]}),(0,e.jsx)(qa,{value:a,effectiveLimit:r},String(a)),(0,e.jsx)(Wa,{value:t},JSON.stringify(t))]})}s(Ba,"FilesAndStorageSection");function qa({value:a,effectiveLimit:t}){const r=Q(),o=a===null?"":String(a),[n,c]=(0,j.useState)(o),[d,x]=(0,j.useState)(null),l=A({mutationFn:s(g=>L.updateGeneral({attachmentMaxMegabytes:g}),"mutationFn"),onSuccess:s(async()=>{await Promise.all([r.invalidateQueries({queryKey:w.instance.generalSettings}),r.invalidateQueries({queryKey:w.health})])},"onSuccess")}),y=s(()=>{if(n.trim()===""){x(null),l.mutate(null);return}const g=ve(n,1,500);if(g===null){x("Enter a whole number from 1 to 500 MB, or leave it blank to use the default.");return}x(null),l.mutate(g)},"submit"),S=n.trim()!==o,b=d??(l.error?ee(l.error,"Failed to save the upload limit."):null);return(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Upload size limit"}),(0,e.jsxs)("p",{className:"max-w-2xl text-sm text-ink-3",children:["Largest file anyone can attach, in MB (",1,"–",500,"). Leave blank to use the default: the WARDMOTE_ATTACHMENT_MAX_BYTES environment variable when set, otherwise ",100," MB."]}),t?(0,e.jsxs)("p",{className:"text-sm","data-testid":"attachment-limit-effective",children:["Current limit: ",(0,e.jsx)("span",{className:"font-medium tabular-nums",children:le(t.maxBytes)})," ",(0,e.jsxs)("span",{className:"text-ink-3",children:["(",Ga[t.source],")"]})]}):null]}),(0,e.jsxs)("form",{noValidate:!0,className:"flex flex-col gap-2 sm:flex-row sm:items-end",onSubmit:s(g=>{g.preventDefault(),y()},"onSubmit"),children:[(0,e.jsxs)("label",{className:"space-y-1.5 sm:w-48",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Limit (MB)"}),(0,e.jsx)(K,{type:"number",inputMode:"numeric",min:1,max:500,step:1,value:n,placeholder:"Default (100)","aria-label":"Upload size limit in MB","aria-invalid":d?!0:void 0,disabled:l.isPending,onChange:s(g=>{c(g.target.value),x(null)},"onChange")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,e.jsx)(N,{type:"submit",size:"sm",disabled:l.isPending||!S,children:l.isPending?"Saving...":"Save upload limit"}),(0,e.jsx)(N,{type:"button",variant:"secondary",size:"sm",disabled:l.isPending||!S,onClick:s(()=>{c(o),x(null)},"onClick"),children:"Reset"})]})]}),b?(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:b}):null]})}s(qa,"UploadLimitForm");function Se(a){return{enabled:a.enabled,orphanAfterDays:String(a.orphanAfterDays),closedTasksEnabled:a.closedTasks.enabled,closedTasksAfterDays:String(a.closedTasks.afterDays)}}s(Se,"toDraft$1");function Va(a){const t=ve(a.orphanAfterDays,1,365),r=ve(a.closedTasksAfterDays,7,re),o=[];return t===null&&o.push("Unused files must be kept for 1–365 whole days."),r===null&&o.push(`Closed task attachments must be kept for 7–${re} whole days.`),t===null||r===null?{settings:null,errors:o}:{settings:{enabled:a.enabled,orphanAfterDays:t,closedTasks:{enabled:a.closedTasksEnabled,afterDays:r}},errors:o}}s(Va,"parseDraft");function Wa({value:a}){const t=Q(),[r,o]=(0,j.useState)(()=>Se(a)),[n,c]=(0,j.useState)(!1),[d,x]=(0,j.useState)(!1),{settings:l,errors:y}=Va(r),S=JSON.stringify(r)!==JSON.stringify(Se(a)),b=ae({queryKey:w.instance.attachmentRetention,queryFn:s(()=>L.getAttachmentRetention(),"queryFn"),retry:!1}),g=A({mutationFn:s(m=>L.updateGeneral({attachmentRetention:m}),"mutationFn"),onSuccess:s(async()=>{await Promise.all([t.invalidateQueries({queryKey:w.instance.generalSettings}),t.invalidateQueries({queryKey:w.instance.attachmentRetention})])},"onSuccess")}),E=A({mutationFn:s(m=>L.previewAttachmentRetention(m),"mutationFn")}),C=A({mutationFn:s(()=>L.runAttachmentRetention(),"mutationFn"),onSuccess:s(async()=>{E.reset(),await t.invalidateQueries({queryKey:w.instance.attachmentRetention})},"onSuccess")}),h=s(m=>{o(p=>({...p,...m})),E.reset()},"update"),v=g.isPending||C.isPending,k=n?y:[],P=g.error?ee(g.error,"Failed to save cleanup settings."):E.error?ee(E.error,"Failed to preview cleanup."):C.error?ee(C.error,"Cleanup did not run."):null;return(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Automatic attachment cleanup"}),(0,e.jsx)("p",{className:"max-w-2xl text-sm text-ink-3",children:"Off by default. When on, Wardmote periodically deletes stored files nothing refers to any more and, if you choose, attachments of tasks closed long ago. Each removed attachment leaves a tombstone, so tasks show “File removed by retention” with the date instead of a broken file."})]}),(0,e.jsx)($,{checked:r.enabled,onCheckedChange:s(()=>h({enabled:!r.enabled}),"onCheckedChange"),disabled:v,"aria-label":"Toggle automatic attachment cleanup"})]}),(0,e.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,e.jsxs)("label",{className:"space-y-1.5",children:[(0,e.jsxs)("span",{className:"text-xs font-medium text-ink-3",children:["Remove unused files after (days, ",1,"–",365,")"]}),(0,e.jsx)(K,{type:"number",inputMode:"numeric",min:1,max:365,step:1,value:r.orphanAfterDays,"aria-label":"Remove unused files after days",disabled:v,onChange:s(m=>h({orphanAfterDays:m.target.value}),"onChange")})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsxs)("span",{className:"min-w-0 text-xs font-medium text-ink-3",children:["Remove attachments of closed tasks after (days, ",7,"–",re,")"]}),(0,e.jsx)($,{checked:r.closedTasksEnabled,onCheckedChange:s(()=>h({closedTasksEnabled:!r.closedTasksEnabled}),"onCheckedChange"),disabled:v,"aria-label":"Toggle closed task attachment cleanup"})]}),(0,e.jsx)(K,{type:"number",inputMode:"numeric",min:7,max:re,step:1,value:r.closedTasksAfterDays,"aria-label":"Remove attachments of closed tasks after days",disabled:v||!r.closedTasksEnabled,onChange:s(m=>h({closedTasksAfterDays:m.target.value}),"onChange")})]})]}),k.length>0?(0,e.jsx)("div",{role:"alert",className:"space-y-1 text-sm text-bad",children:k.map(m=>(0,e.jsx)("p",{children:m},m))}):null,(0,e.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,e.jsx)(N,{size:"sm",disabled:v||!S,onClick:s(()=>{c(!0),l&&g.mutate(l)},"onClick"),children:g.isPending?"Saving...":"Save cleanup settings"}),(0,e.jsx)(N,{variant:"secondary",size:"sm",disabled:v||E.isPending,onClick:s(()=>{c(!0),l&&E.mutate(l)},"onClick"),children:E.isPending?"Previewing...":"Preview"}),(0,e.jsx)(N,{variant:"secondary",size:"sm",disabled:v,onClick:s(()=>x(!0),"onClick"),children:C.isPending?"Running...":"Run now"})]}),P?(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:P}):null,E.data?(0,e.jsx)($a,{title:"Preview — nothing deleted yet",report:E.data}):null,(0,e.jsxs)("div",{className:"space-y-1.5","data-testid":"attachment-retention-last-run",children:[(0,e.jsx)("h4",{className:"text-xs font-medium uppercase tracking-wide text-ink-3",children:"Last run"}),b.isLoading?(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Loading cleanup history..."}):b.error?(0,e.jsx)("p",{className:"text-sm text-ink-3",children:ee(b.error,"Cleanup history is unavailable.")}):b.data?.lastRun?(0,e.jsx)(Ha,{report:b.data.lastRun}):(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Cleanup has not run yet."})]}),(0,e.jsx)(da,{open:d,onOpenChange:x,children:(0,e.jsxs)(ia,{children:[(0,e.jsxs)(ca,{children:[(0,e.jsx)(na,{children:"Run attachment cleanup now?"}),(0,e.jsxs)(ta,{children:["This permanently deletes the files matched by the saved cleanup settings, even while automatic cleanup is off. Removed attachments leave a tombstone in their tasks.",S?" Unsaved changes on this page are not used.":""]})]}),(0,e.jsxs)(la,{children:[(0,e.jsx)(oa,{children:"Cancel"}),(0,e.jsx)(ra,{onClick:s(()=>C.mutate(),"onClick"),children:"Delete files now"})]})]})})]})}s(Wa,"RetentionForm");function Ha({report:a}){return(0,e.jsxs)("div",{className:"space-y-0.5 text-sm",children:[(0,e.jsxs)("p",{children:[(0,e.jsx)("span",{className:"tabular-nums",children:Ve(a.finishedAt)}),(0,e.jsxs)("span",{className:"text-ink-3",children:[" · ",a.trigger==="manual"?"Manual":"Scheduled"]})]}),(0,e.jsxs)("p",{className:"text-ink-3",children:[(0,e.jsx)("span",{className:"tabular-nums",children:a.totalCount})," ",a.totalCount===1?"file":"files"," removed ·"," ",(0,e.jsx)("span",{className:"tabular-nums",children:le(a.totalBytes)})," freed",a.failedCount>0?(0,e.jsxs)("span",{className:"text-bad",children:[" · ",(0,e.jsx)("span",{className:"tabular-nums",children:a.failedCount})," failed"]}):null]})]})}s(Ha,"LastRunSummary");function $a({title:a,report:t}){return(0,e.jsxs)("div",{className:"space-y-2","data-testid":"attachment-retention-preview",children:[(0,e.jsx)("h4",{className:"text-xs font-medium uppercase tracking-wide text-ink-3",children:a}),(0,e.jsxs)("ul",{className:"space-y-1.5",children:[t.rules.map(r=>(0,e.jsxs)("li",{"data-rule":r.rule,className:"flex items-start justify-between gap-3 text-sm",children:[(0,e.jsx)("span",{className:"min-w-0",children:za[r.rule]}),(0,e.jsxs)("span",{className:"shrink-0 text-right tabular-nums text-ink-3",children:[r.count," ",r.count===1?"file":"files"," · ",le(r.bytes)]})]},r.rule)),(0,e.jsxs)("li",{className:"flex items-start justify-between gap-3 text-sm font-medium",children:[(0,e.jsx)("span",{className:"min-w-0",children:"Total"}),(0,e.jsxs)("span",{className:"shrink-0 text-right tabular-nums",children:[t.totalCount," ",t.totalCount===1?"file":"files"," · ",le(t.totalBytes)]})]})]})]})}s($a,"RetentionReportSummary");var we={deepgram:"Deepgram",elevenlabs:"ElevenLabs",google:"Google Cloud Speech-to-Text",openai_compatible:"OpenAI-compatible endpoint"},ue="__other__",Qa={stt_disabled:"Speech-to-text is not configured. Choose a provider and a model.",stt_missing_key:"No API key is saved for this provider. Enter it next to Provider and save.",stt_invalid_credentials:"The Google service account key cannot be read. Paste the service account JSON key next to Provider.",stt_too_long:"The audio is longer than the limit. Use a shorter file or raise Max audio in Advanced.",stt_too_large:"The file is larger than the provider accepts. Use a smaller file.",stt_empty:"The file is empty. Choose another audio file.",stt_timeout:"The provider did not answer in time. Try again.",stt_rejected:"The provider rejected the request. Check the key, the model and the language.",stt_unavailable:"The provider is busy or down. Try again in a minute.",stt_network:"Wardmote could not reach the provider. Check the server's network access.",stt_invalid_response:"The provider answered in an unexpected format. Check the base URL and model."},Ya=(()=>{try{return new Intl.DisplayNames(["en"],{type:"language"})}catch{return null}})();function se(a){if(a==="")return"Automatic (detect language)";if(a==="multi")return"Multilingual (Nova-3, mixed languages)";let t;try{t=Ya?.of(a)}catch{t=void 0}return t&&t!==a?t+" ("+a+")":a}s(se,"speechToTextLanguageLabel");function Ja(a){return Qa[a]??"Speech-to-text failed."}s(Ja,"speechToTextErrorText");function Xa(a,t,r=""){const o={};a.provider==="openai_compatible"&&a.baseUrl.trim()===""&&(o.baseUrl="Enter the endpoint base URL, for example https://api.openai.com/v1."),a.model.trim()===""&&(o.model="Choose a model.");const n=t?.[a.provider],c=r.trim();if(c!==""?a.provider==="google"&&!c.startsWith("{")&&(o.key="Paste the service account JSON key itself."):n?.stored?a.provider==="google"&&n.usable===!1&&(o.key="The saved key is not a usable service account JSON key. Replace it."):a.apiKeyEnvVar.trim()===""||n&&a.apiKeyEnvVar===n.envVar&&!n.set?o.key="Enter the API key.":n&&a.provider==="google"&&a.apiKeyEnvVar===n.envVar&&n.usable===!1&&(o.key="Enter the service account JSON key: the fallback "+n.envVar+" is not a usable key."),a.provider==="google"){const d=a.model.startsWith("chirp");!d&&a.model!==""&&a.language===""&&(o.language="Choose a language: only Chirp models detect it automatically."),a.google.alternativeLanguages.length>0&&(d||a.language==="")&&(o.alternativeLanguages="Remove the alternative languages, or choose a language and the long, short or telephony model.")}return o}s(Xa,"speechToTextFieldErrors");function X({message:a}){return a?(0,e.jsx)("p",{className:"text-xs text-bad",children:a}):null}s(X,"FieldError");function ie({label:a,checked:t,disabled:r,onChange:o}){return(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)("span",{className:"text-sm",children:a}),(0,e.jsx)($,{checked:t,onCheckedChange:s(()=>o(!t),"onCheckedChange"),disabled:r,"aria-label":a})]})}s(ie,"ToggleRow");function he({label:a,value:t,min:r,max:o,step:n,unit:c,defaultValue:d,disabled:x,onChange:l}){const y=t??d??r,S=s(b=>Math.min(o,Math.max(r,b)),"clamp");return(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:a}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(N,{variant:"secondary",size:"sm","aria-label":"Decrease "+a,disabled:x||t!==null&&t<=r,onClick:s(()=>l(S(y-n)),"onClick"),children:(0,e.jsx)(ua,{className:"size-3"})}),(0,e.jsx)("span",{className:"min-w-20 text-center text-sm tabular-nums","aria-label":a,children:t===null?"Automatic":t+" "+c}),(0,e.jsx)(N,{variant:"secondary",size:"sm","aria-label":"Increase "+a,disabled:x||y>=o,onClick:s(()=>l(S(t===null?r:y+n)),"onClick"),children:(0,e.jsx)(ha,{className:"size-3"})}),t!==d?(0,e.jsxs)(N,{variant:"ghost",size:"sm",disabled:x,onClick:s(()=>l(d),"onClick"),children:["Default (",d===null?"automatic":d+" "+c,")"]}):null]})]})}s(he,"Stepper");function Za({values:a,disabled:t,onChange:r}){const[o,n]=(0,j.useState)(""),c=a.length>=100,d=s(()=>{const l=o.trim();!l||c||l.length>50||a.includes(l)||/[<>{}[\]\\]/.test(l)||(r([...a,l]),n(""))},"add"),x=s(l=>{l.key==="Enter"&&(l.preventDefault(),d())},"onKeyDown");return(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsxs)("span",{className:"text-xs font-medium text-ink-3",children:["Keyterms (",a.length,"/",100,")"]}),(0,e.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.map(l=>(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full border border-line px-2 py-0.5 text-xs",children:[l,(0,e.jsx)("button",{type:"button","aria-label":"Remove "+l,disabled:t,onClick:s(()=>r(a.filter(y=>y!==l)),"onClick"),children:(0,e.jsx)(Te,{className:"size-3"})})]},l))}),(0,e.jsx)(K,{"aria-label":"Add keyterm",value:o,maxLength:50,placeholder:c?"Limit reached":"Type a word or name, then press Enter",disabled:t||c,onChange:s(l=>n(l.target.value),"onChange"),onKeyDown:x})]})}s(Za,"KeytermChips");function Ee(a,t){const r=a.map(o=>({key:o,value:o,label:se(o),searchText:o}));return t?[{key:"auto",value:"",label:se(""),searchText:"auto detect"},...r]:r}s(Ee,"languageOptions");function es({result:a}){return a.ok?(0,e.jsxs)("div",{className:"space-y-1 text-sm",role:"status",children:[(0,e.jsxs)("p",{className:"text-xs text-ink-3",children:["Transcribed in ",(a.durationMs/1e3).toFixed(1)," s",a.language?" · "+se(a.language):""]}),a.segments&&new Set(a.segments.map(t=>t.speaker)).size>1?a.segments.map((t,r)=>(0,e.jsxs)("p",{children:[(0,e.jsxs)("span",{className:"font-medium",children:[t.speaker,":"]})," ",t.text]},r)):(0,e.jsx)("p",{children:a.text||"(no speech detected)"})]}):(0,e.jsxs)("div",{className:"space-y-0.5 text-sm",role:"status",children:[(0,e.jsx)("p",{className:"text-bad",children:Ja(a.code)}),(0,e.jsxs)("p",{className:"text-xs text-ink-3",children:[a.code,a.status?" · HTTP "+a.status:""]})]})}s(es,"TestResult");function as({value:a,disabled:t,onSave:r}){const o=a.apiKeyEnvVar===""?{...a,apiKeyEnvVar:me[a.provider]}:a,[n,c]=(0,j.useState)(o),[d,x]=(0,j.useState)(null),[l,y]=(0,j.useState)(()=>a.model!==""&&!ne[a.provider].includes(a.model)),[S,b]=(0,j.useState)(!1),[g,E]=(0,j.useState)(null),[C,h]=(0,j.useState)(""),[v,k]=(0,j.useState)(!1),P=Q(),m=n.provider,p=s(i=>c(Y=>({...Y,...i})),"update"),B=ae({queryKey:w.instance.speechToTextCredentials,queryFn:s(()=>L.getSpeechToTextCredentials(),"queryFn"),retry:!1}),O=B.data,R=O?.[m],z=me[m],M=n.apiKeyEnvVar!==z,u=Xa(n,O,C),_=Object.keys(u).length>0,T=C.trim(),G=JSON.stringify(n)!==JSON.stringify(a),te=G||T!=="",f=R?.stored===!0,I=!f||v,W=(0,j.useMemo)(()=>{const i=d?.provider===m?d.models:[...ne[m]];return n.model&&!l&&!i.includes(n.model)?[n.model,...i]:i},[d,m,n.model,l]),q=(0,j.useMemo)(()=>{const i=d?.provider==="google"&&d.locations.length>0?d.locations:[...La];return i.includes(n.google.location)?i:[n.google.location,...i]},[d,n.google.location]),F=_a[m],oe=(0,j.useMemo)(()=>{const i=m!=="google"||n.model.startsWith("chirp");return Ee(n.language&&!F.includes(n.language)?[n.language,...F]:F,i)},[m,n.model,n.language,F]),Re=(0,j.useMemo)(()=>Ee(F.filter(i=>i!==n.language&&!n.google.alternativeLanguages.includes(i)),!1),[F,n.language,n.google.alternativeLanguages]),V=A({mutationFn:s(()=>L.listSpeechToTextModels({provider:m,baseUrl:n.baseUrl.trim(),apiKeyEnvVar:n.apiKeyEnvVar.trim(),...T?{apiKey:T}:{},...m==="google"?{google:{location:n.google.location,projectId:n.google.projectId}}:{}}),"mutationFn"),onSuccess:s(i=>x({provider:m,models:i.models.map(Y=>Y.id),locations:i.locations??[],source:i.source}),"onSuccess")}),U=A({mutationFn:s(i=>L.testSpeechToText(n,i,T),"mutationFn")}),D=A({mutationFn:s(i=>i===null?L.removeSpeechToTextKey(m):L.saveSpeechToTextKey(m,i),"mutationFn"),onSuccess:s(i=>{P.setQueryData(w.instance.speechToTextCredentials,i),h(""),k(!1)},"onSuccess")}),Ie=s(async()=>{T&&await D.mutateAsync(T),G&&r(n)},"save"),De=s(i=>{V.reset(),U.reset(),D.reset(),h(""),k(!1),y(!1),p({provider:i,model:ne[i][0]??"",baseUrl:"",apiKeyEnvVar:me[i],language:"",diarize:i==="openai_compatible"?!1:n.diarize,google:{...n.google,alternativeLanguages:[]}})},"changeProvider"),ye=B.isLoading?{tone:"text-ink-3",text:"Checking..."}:f?{tone:"text-ok",text:"Saved"}:M&&n.apiKeyEnvVar?{tone:"text-ink-3",text:"Not set here. Falls back to "+n.apiKeyEnvVar+"; run Test to confirm it works."}:R?.set&&n.apiKeyEnvVar?{tone:"text-ink-3",text:"Not set here. Using "+z+" from the server environment."}:{tone:"text-ink-3",text:"Not set"},be=n.google.projectId||R?.projectId||"";return(0,e.jsx)("section",{children:(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Speech-to-text"}),(0,e.jsx)("p",{className:"max-w-2xl text-sm text-ink-3",children:"Transcribe WhatsApp voice notes and any audio or video attachment agents read. API keys are stored encrypted and never shown again. Off by default."})]}),(0,e.jsx)($,{checked:n.enabled,onCheckedChange:s(()=>p({enabled:!n.enabled}),"onCheckedChange"),disabled:t||!n.enabled&&_,"aria-label":"Toggle speech-to-text"})]}),(0,e.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,e.jsxs)("label",{className:"space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Provider"}),(0,e.jsx)(ce,{"aria-label":"Speech-to-text provider",value:m,disabled:t,onChange:s(i=>De(i.target.value),"onChange"),children:Object.keys(we).map(i=>(0,e.jsx)("option",{value:i,children:we[i]},i))})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"API key"}),(0,e.jsx)("p",{className:"text-sm "+ye.tone,"data-testid":"stt-key-status",children:ye.text}),I?(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(K,{type:"password","aria-label":"Speech-to-text API key",value:C,autoComplete:"new-password",spellCheck:!1,placeholder:m==="google"?"Paste the service account JSON key":"Paste the API key",disabled:t||D.isPending,onChange:s(i=>h(i.target.value),"onChange")}),v?(0,e.jsx)(N,{variant:"ghost",size:"sm",disabled:D.isPending,onClick:s(()=>{k(!1),h("")},"onClick"),children:"Cancel"}):null]}):(0,e.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,e.jsx)(N,{variant:"secondary",size:"sm",disabled:t||D.isPending,onClick:s(()=>k(!0),"onClick"),children:"Replace"}),(0,e.jsx)(N,{variant:"ghost",size:"sm",disabled:t||D.isPending,onClick:s(()=>D.mutate(null),"onClick"),children:"Remove"})]}),D.isError?(0,e.jsx)("p",{className:"text-xs text-bad",children:D.error instanceof Error?D.error.message:"The key could not be saved."}):null,m==="google"&&be?(0,e.jsxs)("p",{className:"text-xs text-ink-3",children:["Project ",be,n.google.projectId?" (set in Advanced)":" (from the service account)"]}):null,(0,e.jsx)(X,{message:u.key})]}),m==="openai_compatible"?(0,e.jsxs)("label",{className:"space-y-1.5 md:col-span-2",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Endpoint base URL"}),(0,e.jsx)(K,{"aria-label":"Speech-to-text base URL",value:n.baseUrl,placeholder:"https://api.openai.com/v1",disabled:t,onChange:s(i=>p({baseUrl:i.target.value}),"onChange")}),(0,e.jsx)(X,{message:u.baseUrl})]}):null,(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Model"}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsxs)(ce,{"aria-label":"Speech-to-text model",value:l?ue:n.model,disabled:t,onChange:s(i=>{i.target.value===ue?(y(!0),p({model:""})):(y(!1),p({model:i.target.value}))},"onChange"),children:[W.map(i=>(0,e.jsx)("option",{value:i,children:i},i)),(0,e.jsx)("option",{value:ue,children:"Other model..."})]}),(0,e.jsx)(N,{variant:"secondary",size:"sm",disabled:t||V.isPending,onClick:s(()=>V.mutate(),"onClick"),children:V.isPending?"Fetching...":"Fetch"})]}),l?(0,e.jsx)(K,{"aria-label":"Other model id",value:n.model,placeholder:"Model id from the provider",disabled:t,onChange:s(i=>p({model:i.target.value.trim()}),"onChange")}):null,V.isError?(0,e.jsxs)("p",{className:"text-xs text-bad",children:[V.error instanceof Error?V.error.message:"Could not list models."," The suggested list stays available."]}):d?.provider===m?(0,e.jsxs)("p",{className:"text-xs text-ink-3",children:[d.models.length," models ",d.source==="provider"?"from the provider":"from Wardmote's list (the provider publishes none)"]}):null,(0,e.jsx)(X,{message:u.model})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Language"}),(0,e.jsx)(je,{value:n.language,groups:[{id:"languages",options:oe}],onValueChange:s(i=>p({language:i}),"onValueChange"),placeholder:"Choose a language",searchPlaceholder:"Search languages...",triggerAriaLabel:"Speech-to-text language",disabled:t,renderValue:s(i=>i?.label??se(n.language),"renderValue")}),(0,e.jsx)(X,{message:u.language})]})]}),(0,e.jsxs)(sa,{open:S,onOpenChange:b,children:[(0,e.jsx)(aa,{asChild:!0,children:(0,e.jsxs)(N,{variant:"ghost",size:"sm","aria-expanded":S,children:[(0,e.jsx)(ma,{className:"size-4 transition-transform "+(S?"rotate-180":"")}),"Advanced"]})}),(0,e.jsx)(ea,{children:(0,e.jsxs)("div",{className:"mt-3 grid gap-4 md:grid-cols-2",children:[m!=="openai_compatible"?(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)(ie,{label:"Speaker diarization",checked:n.diarize,disabled:t,onChange:s(i=>p({diarize:i}),"onChange")}),m==="deepgram"?(0,e.jsx)(ie,{label:"Smart formatting",checked:n.deepgram.smartFormat,disabled:t,onChange:s(i=>p({deepgram:{smartFormat:i}}),"onChange")}):null,m==="elevenlabs"?(0,e.jsx)(ie,{label:"Tag audio events",checked:n.elevenlabs.tagAudioEvents,disabled:t,onChange:s(i=>p({elevenlabs:{...n.elevenlabs,tagAudioEvents:i}}),"onChange")}):null,m==="google"?(0,e.jsx)(ie,{label:"Automatic punctuation",checked:n.google.autoPunctuation,disabled:t,onChange:s(i=>p({google:{...n.google,autoPunctuation:i}}),"onChange")}):null,m==="elevenlabs"&&n.diarize?(0,e.jsx)(he,{label:"Maximum speakers",value:n.elevenlabs.numSpeakers,min:1,max:32,step:1,unit:"speakers",defaultValue:null,disabled:t,onChange:s(i=>p({elevenlabs:{...n.elevenlabs,numSpeakers:i}}),"onChange")}):null]}):null,m!=="openai_compatible"?(0,e.jsx)(Za,{values:n.keyterms,disabled:t,onChange:s(i=>p({keyterms:i}),"onChange")}):null,m==="google"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("label",{className:"space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Location"}),(0,e.jsx)(ce,{"aria-label":"Google location",value:n.google.location,disabled:t,onChange:s(i=>p({google:{...n.google,location:i.target.value}}),"onChange"),children:q.map(i=>(0,e.jsx)("option",{value:i,children:i},i))}),(0,e.jsx)("span",{className:"block text-xs text-ink-3",children:"Chirp 3 runs in us and eu. Fetch lists every location your project can use."})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsxs)("span",{className:"text-xs font-medium text-ink-3",children:["Alternative languages (",n.google.alternativeLanguages.length,"/",2,")"]}),(0,e.jsx)("div",{className:"flex flex-wrap gap-1.5",children:n.google.alternativeLanguages.map(i=>(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full border border-line px-2 py-0.5 text-xs",children:[se(i),(0,e.jsx)("button",{type:"button","aria-label":"Remove "+i,disabled:t,onClick:s(()=>p({google:{...n.google,alternativeLanguages:n.google.alternativeLanguages.filter(Y=>Y!==i)}}),"onClick"),children:(0,e.jsx)(Te,{className:"size-3"})})]},i))}),(0,e.jsx)(je,{value:"",groups:[{id:"alternatives",options:Re}],onValueChange:s(i=>p({google:{...n.google,alternativeLanguages:[...n.google.alternativeLanguages,i]}}),"onValueChange"),placeholder:"Add a language",searchPlaceholder:"Search languages...",triggerAriaLabel:"Add alternative language",disabled:t||n.google.alternativeLanguages.length>=2}),(0,e.jsx)("span",{className:"block text-xs text-ink-3",children:"For the long, short and telephony models, next to the chosen language."}),(0,e.jsx)(X,{message:u.alternativeLanguages})]})]}):null,(0,e.jsx)(he,{label:"Max audio",value:n.maxAudioSeconds,min:30,max:7200,step:30,unit:"s",defaultValue:Z.maxAudioSeconds,disabled:t,onChange:s(i=>p({maxAudioSeconds:i??Z.maxAudioSeconds}),"onChange")}),(0,e.jsx)(he,{label:"Voice note wait",value:n.sttWaitSeconds,min:1,max:120,step:5,unit:"s",defaultValue:Z.sttWaitSeconds,disabled:t,onChange:s(i=>p({sttWaitSeconds:i??Z.sttWaitSeconds}),"onChange")}),(0,e.jsx)("p",{className:"text-xs text-ink-3 md:col-span-2",children:"Max audio is checked for Ogg Opus voice notes; other formats are limited by size only. Voice note wait is how long a WhatsApp wake waits for the transcript before it continues without it."}),(0,e.jsxs)("label",{className:"space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Fallback key variable (server environment)"}),(0,e.jsx)(K,{"aria-label":"Fallback key variable",value:n.apiKeyEnvVar,autoComplete:"off",spellCheck:!1,disabled:t,onChange:s(i=>p({apiKeyEnvVar:i.target.value.trim()}),"onChange")}),M?(0,e.jsxs)(N,{variant:"ghost",size:"sm",disabled:t,onClick:s(()=>p({apiKeyEnvVar:z}),"onClick"),children:["Use ",z]}):null]}),m!=="openai_compatible"?(0,e.jsxs)("label",{className:"space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Base URL override"}),(0,e.jsx)(K,{"aria-label":"Base URL override",value:n.baseUrl,placeholder:m==="google"?n.google.location==="global"?"https://speech.googleapis.com":"https://"+n.google.location+"-speech.googleapis.com":We[m],disabled:t,onChange:s(i=>p({baseUrl:i.target.value.trim()}),"onChange")})]}):null,m==="google"?(0,e.jsxs)("label",{className:"space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Project id override"}),(0,e.jsx)(K,{"aria-label":"Google project id",value:n.google.projectId,placeholder:R?.projectId??"From the service account key",disabled:t,onChange:s(i=>p({google:{...n.google,projectId:i.target.value.trim()}}),"onChange")})]}):null]})})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Test with an audio file"}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("input",{type:"file",accept:"audio/*,video/*","aria-label":"Speech-to-text test audio",disabled:t,onChange:s(i=>{E(i.target.files?.[0]??null),U.reset()},"onChange"),className:"text-sm"}),(0,e.jsx)(N,{variant:"secondary",size:"sm",disabled:t||_||!g||U.isPending,onClick:s(()=>g&&U.mutate(g),"onClick"),children:U.isPending?"Transcribing...":"Test speech-to-text"})]}),U.data?(0,e.jsx)(es,{result:U.data}):null,U.isError?(0,e.jsx)("p",{className:"text-sm text-bad",children:U.error instanceof Error?U.error.message:"Test failed."}):null]}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(N,{size:"sm",disabled:t||!te||D.isPending||T!==""&&!!u.key,onClick:s(()=>{Ie().catch(()=>{})},"onClick"),children:D.isPending?"Saving...":"Save speech-to-text"}),(0,e.jsx)(N,{variant:"secondary",size:"sm",disabled:t||!te,onClick:s(()=>{c(o),h(""),k(!1),y(a.model!==""&&!ne[a.provider].includes(a.model))},"onClick"),children:"Reset"})]})]})})}s(as,"SpeechToTextSection");var xe=[{key:"maxConcurrentRuns",label:"Max running local runs",min:1,max:64,fallback:20},{key:"maxConcurrentStarts",label:"Max runs starting at once",min:1,max:64,fallback:4},{key:"startWaitBypassSec",label:"Start wait bypass (seconds)",min:1,max:Me,fallback:120},{key:"memoryReservePercent",label:"Memory reserve (% of RAM)",min:1,max:90,fallback:20},{key:"memoryGateCooldownSec",label:"Memory gate cooldown after an OOM kill (seconds)",min:1,max:He,fallback:120}],ss={env:"environment variable",setting:"set here",default:"built-in default"};function ts(a){return{maxConcurrentRuns:a.maxConcurrentRuns===null?"":String(a.maxConcurrentRuns),maxConcurrentStarts:a.maxConcurrentStarts===null?"":String(a.maxConcurrentStarts),startWaitBypassSec:a.startWaitBypassSec===null?"":String(a.startWaitBypassSec),memoryReservePercent:a.memoryReservePercent===null?"":String(a.memoryReservePercent),memoryGateCooldownSec:a.memoryGateCooldownSec===null?"":String(a.memoryGateCooldownSec)}}s(ts,"toDraft");function ns(a,t,r){const o=a.trim();if(o==="")return null;if(!/^\d+$/.test(o))return;const n=Number(o);return n>=t&&n<=r?n:void 0}s(ns,"parseLimit");function is({value:a,disabled:t=!1}){const r=Q(),o=ts(a),[n,c]=(0,j.useState)(o),[d,x]=(0,j.useState)(null),l=ae({queryKey:w.instance.localRunLimits,queryFn:s(()=>L.getLocalRunLimits(),"queryFn")}).data,y=A({mutationFn:s(h=>L.updateGeneral({localRuns:h}),"mutationFn"),onSuccess:s(async()=>{await Promise.all([r.invalidateQueries({queryKey:w.instance.generalSettings}),r.invalidateQueries({queryKey:w.instance.localRunLimits})])},"onSuccess")}),S=s(h=>l?.[h].source==="env","envLocked"),b=xe.some(({key:h})=>n[h].trim()!==o[h]),g=t||y.isPending,E=s(()=>{const h={...a};for(const v of xe){if(S(v.key))continue;const k=ns(n[v.key],v.min,v.max);if(k===void 0){x(`${v.label}: enter a whole number from ${v.min} to ${v.max}, or leave it blank to use the default.`);return}h[v.key]=k}x(null),y.mutate(h)},"submit"),C=d??(y.error instanceof Error&&y.error.message?y.error.message:y.error?"Failed to save local run limits.":null);return(0,e.jsx)("section",{children:(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Local run limits"}),(0,e.jsx)("p",{className:"max-w-2xl text-sm text-ink-3",children:"Cap how many local CLI agent runs this instance runs at once and how many may be starting up together. Changes apply to the next run admission without a restart; lowering a limit never stops runs that are already running. The memory reserve and cooldown only drive the memory gate's log line for now: each local run start records whether it would have been held, and no start is delayed. Leave a field blank to use the built-in default. A server environment variable, when set, overrides the value saved here."})]}),(0,e.jsxs)("form",{noValidate:!0,className:"space-y-3",onSubmit:s(h=>{h.preventDefault(),E()},"onSubmit"),children:[(0,e.jsx)("div",{className:"grid gap-3 md:grid-cols-3",children:xe.map(h=>{const v=l?.[h.key],k=v?.source==="env";return(0,e.jsxs)("label",{className:"space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:h.label}),(0,e.jsx)(K,{type:"number",inputMode:"numeric",min:h.min,max:h.max,step:1,value:k?String(v.value):n[h.key],placeholder:`Default (${h.fallback})`,"aria-label":h.label,readOnly:k,disabled:g||k,onChange:s(P=>{const m=P.target.value;c(p=>({...p,[h.key]:m})),x(null)},"onChange")}),k?(0,e.jsxs)("span",{className:"block text-xs text-ink-3","data-testid":`local-run-limit-env-${h.key}`,children:["Overridden by the ",v.envVar," environment variable. Unset it to manage this here."]}):v?(0,e.jsxs)("span",{className:"block text-xs text-ink-3","data-testid":`local-run-limit-effective-${h.key}`,children:["In force: ",(0,e.jsx)("span",{className:"font-medium tabular-nums",children:v.value})," (",ss[v.source],"). Range ",h.min,"–",h.max,"."]}):null]},h.key)})}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,e.jsx)(N,{type:"submit",size:"sm",disabled:g||!b,children:y.isPending?"Saving...":"Save local run limits"}),(0,e.jsx)(N,{type:"button",variant:"secondary",size:"sm",disabled:g||!b,onClick:s(()=>{c(o),x(null)},"onClick"),children:"Reset"})]})]}),C?(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:C}):null]})})}s(is,"LocalRunLimitsSection");function rs({embedded:a=!1}){const{setBreadcrumbs:t}=Ae(),r=Q(),[o,n]=(0,j.useState)(null),c=Ea();(0,j.useEffect)(()=>{a||t([{label:"Settings",href:"/company/settings"},{label:"General"}])},[a,t]);const d=ae({queryKey:w.instance.generalSettings,queryFn:s(()=>L.getGeneral(),"queryFn")}),x=ae({queryKey:w.health,queryFn:s(()=>ga.get(),"queryFn"),retry:!1}),l=A({mutationFn:L.updateGeneral,onMutate:s(()=>{n(null),c.reset()},"onMutate"),onSuccess:s(async()=>{n(null),c.reset(),await r.invalidateQueries({queryKey:w.instance.generalSettings})},"onSuccess"),onError:s(u=>{n(u instanceof Error?u.message:"Failed to update general settings.")},"onError")});if(d.isLoading||x.isLoading)return(0,e.jsx)("div",{className:"text-sm text-ink-3",children:"Loading general settings..."});if(d.error)return(0,e.jsx)("div",{className:"text-sm text-bad",children:d.error instanceof Error?d.error.message:"Failed to load general settings."});const y=d.data?.censorUsernameInLogs===!0,S=d.data?.feedbackDataSharingPreference??"prompt",b=d.data?.backupRetention??Ue,g=new Set(x.data?.hiddenSettings??[]),E=!g.has("instance.general.deploymentStatus"),C=!g.has("instance.general.censorUsernameInLogs"),h=!g.has("instance.general.backupRetention"),v=!g.has("instance.general.feedbackDataSharingPreference"),k=!g.has("instance.general.speechToText"),P=d.data?.speechToText??Z,m=!g.has("instance.general.signOut"),p=!g.has("instance.general.autoInstallUpdates"),B=d.data?.autoInstallUpdates===!0,O=d.data?.localRuns??Ke,R=[...C?["log display"]:[],...h?["backup retention"]:[],...v?["data sharing"]:[],...k?["speech-to-text"]:[],"local run limits","files and storage"],z=R.length>2?`${R.slice(0,-1).join(", ")}, and ${R[R.length-1]}`:R.join(" and "),M=c.error instanceof Error?c.error.message:c.error?"Failed to sign out.":o;return(0,e.jsxs)("div",{className:a?"space-y-8":"max-w-4xl space-y-8",children:[a?null:(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(_e,{className:"h-5 w-5 text-ink-3"}),(0,e.jsx)("h1",{className:"text-lg font-semibold",children:"General"})]}),(0,e.jsxs)("p",{className:"text-sm text-ink-3",children:["Configure instance-wide preferences",R.length>0?(0,e.jsxs)(e.Fragment,{children:[" including ",z]}):null,"."]})]}),M&&(0,e.jsx)("div",{className:"rounded-md border border-bad/40 bg-bad/5 px-3 py-2 text-sm text-bad",children:M}),E&&(0,e.jsx)("section",{children:(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Deployment and auth"}),(0,e.jsx)(Ua,{deploymentMode:x.data?.deploymentMode,deploymentExposure:x.data?.deploymentExposure})]}),(0,e.jsx)("div",{className:"text-sm text-ink-3",children:x.data?.deploymentMode==="local_trusted"?"Local trusted mode is optimized for a local operator. Browser requests run as local board context and no sign-in is required.":x.data?.deploymentExposure==="public"?"Authenticated public mode requires sign-in for board access and is intended for public URLs.":"Authenticated private mode requires sign-in and is intended for LAN, VPN, or other private-network deployments."}),(0,e.jsxs)("div",{className:"grid gap-3 md:grid-cols-3",children:[(0,e.jsx)(pe,{label:"Auth readiness",value:x.data?.authReady?"Ready":"Not ready"}),(0,e.jsx)(pe,{label:"Bootstrap status",value:x.data?.bootstrapStatus==="bootstrap_pending"?"Setup required":"Ready"}),(0,e.jsx)(pe,{label:"Bootstrap invite",value:x.data?.bootstrapInviteActive?"Active":"None"})]})]})}),p&&(0,e.jsx)("section",{children:(0,e.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Install updates automatically"}),(0,e.jsx)("p",{className:"max-w-2xl text-sm text-ink-3",children:"When a newer Wardmote release is published on this install's channel, install it while no runs are active or queued. Running work is never stopped; the update waits for the next quiet check. A version that fails and rolls back is not retried automatically. Only managed service installs on Linux can update themselves. This is off by default."})]}),(0,e.jsx)($,{checked:B,onCheckedChange:s(()=>l.mutate({autoInstallUpdates:!B}),"onCheckedChange"),disabled:l.isPending||c.isPending,"aria-label":"Toggle automatic updates"})]})}),C&&(0,e.jsx)("section",{children:(0,e.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Censor username in logs"}),(0,e.jsx)("p",{className:"max-w-2xl text-sm text-ink-3",children:"Hide the username segment in home-directory paths and similar operator-visible log output. Standalone username mentions outside of paths are not yet masked in the live transcript view. This is off by default."})]}),(0,e.jsx)($,{checked:y,onCheckedChange:s(()=>l.mutate({censorUsernameInLogs:!y}),"onCheckedChange"),disabled:l.isPending||c.isPending,"aria-label":"Toggle username log censoring"})]})}),h&&(0,e.jsx)("section",{children:(0,e.jsxs)("div",{className:"space-y-5",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Backup retention"}),(0,e.jsx)("p",{className:"max-w-2xl text-sm text-ink-3",children:"Configure how many automatic database backups are kept. Backups run roughly every hour, are compressed with gzip, and are verified before an older backup is removed. Keeping the last few backups bounds disk use; tiered retention keeps every backup in the daily window plus one per week and month, and grows with the database."})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h3",{className:"text-xs font-medium text-ink-3 uppercase tracking-wide",children:"Keep"}),(0,e.jsx)("div",{className:"flex flex-wrap gap-2",children:[...Fe,null].map(u=>{const _=b.maxFiles===u,T=u===null?"Tiered":`Last ${u}`;return(0,e.jsx)("button",{type:"button",disabled:l.isPending||c.isPending,className:J("rounded-lg border px-3 py-2 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-60",_?"border-ink bg-bg-3 text-ink":"border-line bg-bg hover:bg-bg-3/50"),onClick:s(()=>l.mutate({backupRetention:{...b,maxFiles:u}}),"onClick"),children:(0,e.jsx)("div",{className:"text-sm font-medium",children:T})},T)})})]}),b.maxFiles===null&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h3",{className:"text-xs font-medium text-ink-3 uppercase tracking-wide",children:"Daily"}),(0,e.jsx)("div",{className:"flex flex-wrap gap-2",children:Je.map(u=>{const _=b.dailyDays===u;return(0,e.jsx)("button",{type:"button",disabled:l.isPending||c.isPending,className:J("rounded-lg border px-3 py-2 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-60",_?"border-ink bg-bg-3 text-ink":"border-line bg-bg hover:bg-bg-3/50"),onClick:s(()=>l.mutate({backupRetention:{...b,dailyDays:u}}),"onClick"),children:(0,e.jsxs)("div",{className:"text-sm font-medium",children:[u," days"]})},u)})})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h3",{className:"text-xs font-medium text-ink-3 uppercase tracking-wide",children:"Weekly"}),(0,e.jsx)("div",{className:"flex flex-wrap gap-2",children:Ge.map(u=>{const _=b.weeklyWeeks===u,T=u===1?"1 week":`${u} weeks`;return(0,e.jsx)("button",{type:"button",disabled:l.isPending||c.isPending,className:J("rounded-lg border px-3 py-2 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-60",_?"border-ink bg-bg-3 text-ink":"border-line bg-bg hover:bg-bg-3/50"),onClick:s(()=>l.mutate({backupRetention:{...b,weeklyWeeks:u}}),"onClick"),children:(0,e.jsx)("div",{className:"text-sm font-medium",children:T})},u)})})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h3",{className:"text-xs font-medium text-ink-3 uppercase tracking-wide",children:"Monthly"}),(0,e.jsx)("div",{className:"flex flex-wrap gap-2",children:Be.map(u=>{const _=b.monthlyMonths===u,T=u===1?"1 month":`${u} months`;return(0,e.jsx)("button",{type:"button",disabled:l.isPending||c.isPending,className:J("rounded-lg border px-3 py-2 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-60",_?"border-ink bg-bg-3 text-ink":"border-line bg-bg hover:bg-bg-3/50"),onClick:s(()=>l.mutate({backupRetention:{...b,monthlyMonths:u}}),"onClick"),children:(0,e.jsx)("div",{className:"text-sm font-medium",children:T})},u)})})]})]})]})}),k&&(0,e.jsx)(as,{value:P,disabled:l.isPending||c.isPending,onSave:s(u=>l.mutate({speechToText:u}),"onSave")},JSON.stringify(P)),(0,e.jsx)(is,{value:O,disabled:c.isPending},JSON.stringify(O)),(0,e.jsx)(Ba,{attachmentMaxMegabytes:d.data?.attachmentMaxMegabytes??null,attachmentRetention:d.data?.attachmentRetention??qe,effectiveLimit:x.data?.attachmentLimit}),v&&(0,e.jsx)("section",{children:(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"AI feedback sharing"}),(0,e.jsx)("p",{className:"max-w-2xl text-sm text-ink-3",children:"Control whether thumbs up and thumbs down votes can send the voted AI output to this instance's feedback export. Votes are always saved locally."}),null]}),S==="prompt"?(0,e.jsx)("div",{className:"rounded-lg bg-bg-3/20 px-3 py-2 text-sm text-ink-3",children:"No default is saved yet. The next thumbs up or thumbs down choice will ask once and then save the answer here."}):null,(0,e.jsx)("div",{className:"flex flex-wrap gap-2",children:[{value:"allowed",label:"Always allow",description:"Share voted AI outputs automatically."},{value:"not_allowed",label:"Don't allow",description:"Keep voted AI outputs local only."}].map(u=>{const _=S===u.value;return(0,e.jsxs)("button",{type:"button",disabled:l.isPending||c.isPending,className:J("rounded-lg border px-3 py-2 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-60",_?"border-ink bg-bg-3 text-ink":"border-line bg-bg hover:bg-bg-3/50"),onClick:s(()=>l.mutate({feedbackDataSharingPreference:u.value}),"onClick"),children:[(0,e.jsx)("div",{className:"text-sm font-medium",children:u.label}),(0,e.jsx)("div",{className:"text-xs text-ink-3",children:u.description})]},u.value)})}),(0,e.jsxs)("p",{className:"text-xs text-ink-3",children:["To retest the first-use prompt in local dev, remove the"," ",(0,e.jsx)("code",{children:"feedbackDataSharingPreference"})," key from the"," ",(0,e.jsx)("code",{children:"instance_settings.general"})," JSON row for this instance, or set it back to"," ",(0,e.jsx)("code",{children:'"prompt"'}),". Unset and ",(0,e.jsx)("code",{children:'"prompt"'})," both mean no default has been chosen yet."]})]})}),m&&(0,e.jsx)("section",{children:(0,e.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Sign out"}),(0,e.jsx)("p",{className:"max-w-2xl text-sm text-ink-3",children:"Sign out of this Wardmote instance. You will be redirected to the login page."})]}),(0,e.jsxs)(N,{variant:"secondary",size:"sm",disabled:c.isPending||l.isPending,onClick:s(()=>{n(null),c.mutate()},"onClick"),children:[(0,e.jsx)(Ca,{className:"size-4"}),c.isPending?"Signing out...":"Sign out"]})]})})]})}s(rs,"InstanceGeneralSettings");function pe({label:a,value:t}){return(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-ink-3",children:a}),(0,e.jsx)("div",{className:"text-sm font-medium",children:t})]})}s(pe,"StatusBox");function Ds(){const{companies:a,selectedCompany:t,selectedCompanyId:r,setSelectedCompanyId:o}=Ze(),{setBreadcrumbs:n}=Ae(),c=Q(),d=Xe(),x=pa(),l=Ta(),[y,S]=(0,j.useState)(""),[b,g]=(0,j.useState)(""),[E,C]=(0,j.useState)(""),[h,v]=(0,j.useState)(null),[k,P]=(0,j.useState)({});(0,j.useEffect)(()=>{t&&(S(t.name),g(t.description??""),C(t.logoUrl??""),P(t.interactionResolverGovernance??{}))},[t]);const m=!!t&&(y!==t.name||b!==(t.description??"")),p=A({mutationFn:s(f=>H.update(r,f),"mutationFn"),onSuccess:s(()=>{c.invalidateQueries({queryKey:w.companies.all})},"onSuccess")}),B=A({mutationFn:s(f=>H.update(r,{requireBoardApprovalForNewAgents:f}),"mutationFn"),onSuccess:s(()=>{c.invalidateQueries({queryKey:w.companies.all})},"onSuccess")}),O=A({mutationFn:s(f=>H.update(r,{interactionResolverGovernance:f}),"mutationFn"),onSuccess:s(f=>{P(f.interactionResolverGovernance??{}),c.invalidateQueries({queryKey:w.companies.all})},"onSuccess")});function R(f,I,W){const q=Fa(k,f,I,W);P(q),O.mutate(q)}s(R,"handleGovernanceChange");const z=s(f=>{C(f??""),c.invalidateQueries({queryKey:w.companies.all})},"syncLogoState"),M=A({mutationFn:s(f=>va.uploadCompanyLogo(r,f).then(I=>H.update(r,{logoAssetId:I.assetId})),"mutationFn"),onSuccess:s(f=>{z(f.logoUrl),v(null)},"onSuccess")}),u=A({mutationFn:s(()=>H.update(r,{logoAssetId:null}),"mutationFn"),onSuccess:s(f=>{v(null),z(f.logoUrl)},"onSuccess")});function _(f){const I=f.target.files?.[0]??null;f.currentTarget.value="",I&&(v(null),M.mutate(I))}s(_,"handleLogoFileChange");function T(){u.mutate()}s(T,"handleClearLogo");const G=A({mutationFn:s(({companyId:f})=>H.archive(f),"mutationFn"),onSuccess:s(async(f,{companyId:I})=>{const W=a.find(oe=>oe.id===I),q=W?.name??"Organization",F=wa({archivedCompanyId:I,companies:a});F.kind==="company"?(x?.pushToast({title:`${q} is archived`,body:`Switched to ${F.company.name}.`,tone:"info",dedupeKey:`company-archive-departure:${I}`}),o(F.company.id),d(`/${F.company.issuePrefix}/dashboard`,{replace:!0})):(x?.pushToast({title:`${q} is archived`,body:"You can unarchive it from this list.",tone:"info",dedupeKey:`company-archive-departure:${I}`}),d(`/${W?.issuePrefix??""}/companies`,{replace:!0})),await c.invalidateQueries({queryKey:w.companies.all}),await c.invalidateQueries({queryKey:w.companies.stats})},"onSuccess")});if((0,j.useEffect)(()=>{n([{label:t?.name??"Company",href:"/dashboard"},{label:"Settings"}])},[n,t?.name]),!t)return(0,e.jsx)("div",{className:"text-sm text-ink-3",children:"No organization selected. Select an organization from the switcher above."});function te(){p.mutate({name:y.trim(),description:b.trim()||null})}return s(te,"handleSaveGeneral"),(0,e.jsxs)("div",{className:"max-w-6xl space-y-8",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(_e,{className:"h-5 w-5 text-ink-3"}),(0,e.jsx)("h1",{className:"text-lg font-semibold",children:"General"})]}),(0,e.jsxs)("div",{className:"max-w-2xl space-y-4",children:[(0,e.jsx)("div",{className:"text-xs font-medium text-ink-3 uppercase tracking-wide",children:"General"}),(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)(de,{label:"Organization name",hint:"The display name for your organization.",children:(0,e.jsx)("input",{className:"w-full rounded-md border border-line bg-transparent px-2.5 py-1.5 text-sm outline-none",type:"text",value:y,onChange:s(f=>S(f.target.value),"onChange")})}),(0,e.jsx)(de,{label:"Description",hint:"Optional description shown in the organization profile.",children:(0,e.jsx)("input",{className:"w-full rounded-md border border-line bg-transparent px-2.5 py-1.5 text-sm outline-none",type:"text",value:b,placeholder:"Optional organization description",onChange:s(f=>g(f.target.value),"onChange")})})]})]}),(0,e.jsxs)("div",{className:"max-w-2xl space-y-4",children:[(0,e.jsx)("div",{className:"text-xs font-medium text-ink-3 uppercase tracking-wide",children:"Appearance"}),(0,e.jsx)("div",{className:"space-y-3",children:(0,e.jsxs)("div",{className:"flex items-start gap-4",children:[(0,e.jsx)("div",{className:"shrink-0",children:(0,e.jsx)(Sa,{companyName:y||t.name,logoUrl:E||null,className:"rounded-(--rad-14)"})}),(0,e.jsx)("div",{className:"flex-1 space-y-3",children:(0,e.jsx)(de,{label:"Logo",hint:"Upload a PNG, JPEG, WEBP, GIF, or SVG logo image.",children:(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("input",{type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/svg+xml",onChange:_,className:"w-full rounded-md border border-line bg-transparent px-2.5 py-1.5 text-sm outline-none file:mr-4 file:rounded-md file:border-0 file:bg-bg-3 file:px-2.5 file:py-1 file:text-xs"}),E&&(0,e.jsx)("div",{className:"flex items-center gap-2",children:(0,e.jsx)(N,{size:"sm",variant:"secondary",onClick:T,disabled:u.isPending,children:u.isPending?"Removing...":"Remove logo"})}),(M.isError||h)&&(0,e.jsx)("span",{className:"text-xs text-bad",children:h??(M.error instanceof Error?M.error.message:"Logo upload failed")}),u.isError&&(0,e.jsx)("span",{className:"text-xs text-bad",children:u.error.message}),M.isPending&&(0,e.jsx)("span",{className:"text-xs text-ink-3",children:"Uploading logo..."})]})})})]})})]}),m&&(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(N,{size:"sm",onClick:te,disabled:p.isPending||!y.trim(),children:p.isPending?"Saving...":"Save changes"}),p.isSuccess&&(0,e.jsx)("span",{className:"text-xs text-ink-3",children:"Saved"}),p.isError&&(0,e.jsx)("span",{className:"text-xs text-bad",children:p.error instanceof Error?p.error.message:"Failed to save"})]}),(0,e.jsxs)("div",{className:"max-w-2xl space-y-4","data-testid":"company-settings-team-section",children:[(0,e.jsx)("div",{className:"text-xs font-medium text-ink-3 uppercase tracking-wide",children:"Hiring"}),(0,e.jsx)("div",{children:(0,e.jsx)(ka,{label:"Require board approval for new hires",hint:"New agent hires stay pending until approved by board.",checked:!!t.requireBoardApprovalForNewAgents,onChange:s(f=>B.mutate(f),"onChange"),toggleTestId:"company-settings-team-approval-toggle"})})]}),(0,e.jsx)(Ka,{governance:k,onChange:R,isPending:O.isPending,errorMessage:O.isError?O.error instanceof Error?O.error.message:"Failed to save interaction governance":null}),l.loaded&&!l.enabled&&(0,e.jsx)(Aa,{companyId:r},r),(0,e.jsx)(rs,{embedded:!0}),(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)("div",{className:"text-xs font-medium text-bad uppercase tracking-wide",children:"Danger Zone"}),(0,e.jsxs)("div",{className:"space-y-3 bg-bad/5 px-4 py-4",children:[(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Archive this organization to hide it from the sidebar. This persists in the database."}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(N,{size:"sm",variant:"danger",disabled:G.isPending||t.status==="archived",onClick:s(()=>{r&&window.confirm(`Archive organization "${t.name}"? It will be hidden from the sidebar.`)&&G.mutate({companyId:r})},"onClick"),children:G.isPending?"Archiving...":t.status==="archived"?"Already archived":"Archive organization"}),G.isError&&(0,e.jsx)("span",{className:"text-xs text-bad",children:G.error instanceof Error?G.error.message:"Failed to archive organization"})]})]})]})]})}s(Ds,"CompanySettings");export{Ds as CompanySettings};
|
|
1
|
+
var Oe=Object.defineProperty;var s=(a,t)=>Oe(a,"name",{value:t,configurable:!0});import{i as Ce}from"./rolldown-runtime-ZpX3ckPj.js";import{Ai as Me,An as Z,Cn as Fe,Dn as Ke,En as Ue,Fi as ze,Mn as Ge,On as Be,Sn as re,Tn as qe,h as Ve,jn as We,ki as He,kn as ne,l as J,na as $e,qi as Qe,ta as Ye,wn as Je}from"./createLucideIcon-DJi9suAC.js";import{g as Xe}from"./star-BZgQbzhV.js";import{X as Q,_ as A,p as le,t as w,v as ae}from"./queryKeys-DYV5MhM_.js";import{u as H}from"./companies-query-D9PxIiMT.js";import{n as Ze}from"./CompanyContext-CSrVsSze.js";import{n as ea,r as aa,t as sa}from"./collapsible-CqjPlqOa.js";import{a as ta,c as na,i as ia,n as ra,o as la,r as oa,s as ca,t as da}from"./alert-dialog-Blls2GnU.js";import{t as ma}from"./chevron-down-BCvxsWfI.js";import{t as je}from"./SearchableSelect-CIJ5K8ih.js";import{t as N}from"./button-CMwV3L1P.js";import{t as ua}from"./minus-WOgDAWiC.js";import{t as ha}from"./plus-C6fnr28l.js";import{t as Te}from"./x-DRDFdlYE.js";import{t as xa}from"./badge-DuA2EgZC.js";import{n as pa}from"./ToastContext-DMdt9oTd.js";import{t as L}from"./instanceSettings-D8g_QlS-.js";import{t as K}from"./input-DobnTAyB.js";import{t as ga}from"./health-DF7yrggW.js";import{n as Ae}from"./BreadcrumbContext-BVZDZoC0.js";import{t as va}from"./assets-TRDkBfss.js";import{t as $}from"./toggle-switch-BHxNtSq9.js";import{i as fa,n as ya,o as ba,r as ja,s as Na,t as ce}from"./select-V0Hm_q4f.js";import{a as de,o as ka}from"./agent-config-primitives-BsZUnbf2.js";import{Jr as Sa,Rt as wa,Yr as Ea,ka as Ca,qr as Ta,xa as _e}from"./index-3AxqhPET.js";import{r as Le}from"./interaction-audience-BRS_4X7S.js";import{t as Aa}from"./DecisionModelSettings-D-OxKIGP.js";var _a={openai_compatible:["af","ar","hy","az","be","bs","bg","ca","zh","hr","cs","da","nl","en","et","fi","fr","gl","de","el","he","hi","hu","is","id","it","ja","kn","kk","ko","lv","lt","mk","ms","mr","mi","ne","no","fa","pl","pt","ro","ru","sr","sk","sl","es","sw","sv","tl","ta","th","tr","uk","ur","vi","cy"],deepgram:["multi","af","af-ZA","ar","ar-AE","ar-SA","ar-QA","ar-KW","ar-SY","ar-LB","ar-PS","ar-JO","ar-EG","ar-SD","ar-TD","ar-MA","ar-DZ","ar-TN","ar-IQ","ar-IR","hy","as","as-IN","be","bn","bs","bg","ca","zh-HK","zh","zh-CN","zh-Hans","zh-TW","zh-Hant","hr","cs","cs-CZ","da","da-DK","nl","en","en-US","en-AU","en-GB","en-IN","en-NZ","et","fi","nl-BE","fr","fr-CA","ka","ka-GE","de","de-CH","el","gu","gu-IN","he","hi","hu","id","it","ja","kn","kk","kk-KZ","ko","ko-KR","lv","lt","mk","ms","mr","mn","ne","no","ps","ps-AF","fa","pl","pt","pt-BR","pt-PT","pa","pa-IN","ro","ru","sr","sk","sl","es","es-419","sv","sv-SE","tl","ta","te","th","th-TH","tr","tr-TR","uk","ur","vi"],elevenlabs:["af","am","ar","hy","as","ast","az","be","bn","bs","bg","my","yue","ca","ceb","hr","cs","da","nl","en","et","fil","fi","fr","ff","gl","ka","de","el","gu","ha","he","hi","hu","is","id","it","ja","jv","kam","kn","kk","ko","ky","lo","lv","ln","lt","lg","lb","mk","ms","ml","mt","zh","mi","mr","mn","ne","no","oc","or","ps","fa","pl","pt","pa","ro","ru","sr","sn","sd","sk","sl","so","ckb","es","sw","sv","tg","ta","te","th","tr","uk","ur","uz","vi","cy","wo","zu"],google:["af-ZA","am-ET","ar-AE","ar-BH","ar-DZ","ar-EG","ar-IL","ar-IQ","ar-JO","ar-KW","ar-LB","ar-MA","ar-MR","ar-OM","ar-PS","ar-QA","ar-SA","ar-SY","ar-TN","ar-XA","ar-YE","as-IN","ast-ES","az-AZ","be-BY","bg-BG","bn-BD","bn-IN","bs-BA","ca-ES","ceb-PH","ckb-IQ","cmn-Hans-CN","cmn-Hant-TW","cs-CZ","cy-GB","da-DK","de-DE","el-GR","en-AU","en-GB","en-IN","en-PH","en-US","es-419","es-ES","es-MX","es-US","et-EE","eu-ES","fa-IR","ff-SN","fi-FI","fil-PH","fr-CA","fr-FR","ga-IE","gl-ES","gu-IN","ha-NG","hi-IN","hr-HR","hu-HU","hy-AM","id-ID","ig-NG","is-IS","it-IT","iw-IL","ja-JP","jv-ID","ka-GE","kam-KE","kea-CV","kk-KZ","km-KH","kn-IN","ko-KR","ky-KG","lb-LU","lg-UG","ln-CD","lo-LA","lt-LT","luo-KE","lv-LV","mi-NZ","mk-MK","ml-IN","mn-MN","mr-IN","ms-MY","mt-MT","my-MM","ne-NP","nl-NL","no-NO","nso-ZA","ny-MW","oc-FR","om-ET","or-IN","pa-Guru-IN","pl-PL","ps-AF","pt-BR","pt-PT","ro-RO","ru-RU","rup-BG","sd-IN","si-LK","sk-SK","sl-SI","sn-ZW","so-SO","sq-AL","sr-RS","su-ID","sv-SE","sw","sw-KE","ta-IN","te-IN","tg-TJ","th-TH","tr-TR","uk-UA","umb-AO","ur-PK","uz-UZ","vi-VN","wo-SN","xh-ZA","yo-NG","yue-Hant-HK","zu-ZA"]},La=["us","eu","global"],me={openai_compatible:"OPENAI_API_KEY",deepgram:"DEEPGRAM_API_KEY",elevenlabs:"ELEVENLABS_API_KEY",google:"GOOGLE_APPLICATION_CREDENTIALS"},j=Ce($e(),1),e=Ce(Ye(),1),Pa={suggest_tasks:"Suggested tasks",ask_user_questions:"Ask user questions",request_confirmation:"Confirmations",request_checkbox_confirmation:"Checkbox confirmations",request_item_verdicts:"Item verdicts",connection_intent:"Connection requests"},ge="default",Ra=["not_creator","human_only"],Pe={defaultPolicy:"Anyone (default)",cap:"No cap"},fe={defaultPolicy:"New cards are open — the board or any agent can respond, including the one that asked.",cap:"A request keeps whatever audience it asks for."},Ia={anyone:fe.defaultPolicy,not_creator:"New cards exclude the agent that created them, so the answer comes from someone else.",human_only:"New cards wait for a person on the board. Agents are turned away.",chat_endpoint_owner:"Reserved for chat-channel approvals."},Da={anyone:fe.cap,not_creator:"Even a card that asks for Anyone is narrowed to exclude its creator.",human_only:"Every card of this kind waits for a person, whatever it asked for.",chat_endpoint_owner:"Reserved for chat-channel approvals."};function Oa(a){const t=a==="cap"?Da:Ia;return[{value:ge,label:Pe[a],effect:fe[a]},...Ra.map(r=>({value:r,label:Le(r),effect:t[r]}))]}s(Oa,"governanceOptions");function Ma(a,t){return t==="default"?Pe[a]:Le(t)}s(Ma,"governanceValueLabel");function Ne(a){if(!a)return ge;const t=Qe(a);return t==="anyone"?ge:t}s(Ne,"toGovernanceSelectValue");function Fa(a,t,r,o){const n={...a},c={...n[t]??{}};return o==="default"?delete c[r]:c[r]=o,c.defaultPolicy===void 0&&c.cap===void 0?delete n[t]:n[t]=c,n}s(Fa,"applyGovernanceChange");function ke({field:a,value:t,onChange:r,disabled:o,testId:n,ariaLabel:c,mobileLabel:d}){const x=Oa(a);return(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("span",{className:"mb-1 block text-xs font-medium text-ink-3 uppercase tracking-wide sm:hidden",children:d}),(0,e.jsxs)(ya,{value:t,onValueChange:s(l=>r(l),"onValueChange"),disabled:o,children:[(0,e.jsx)(ba,{size:"sm","aria-label":c,className:"w-full min-w-0 text-xs sm:w-(--sz-208px)","data-testid":n,children:(0,e.jsx)(Na,{children:Ma(a,t)})}),(0,e.jsx)(ja,{className:"max-w-(--sz-280px) sm:max-w-(--sz-360px)",children:x.map(l=>(0,e.jsx)(fa,{value:l.value,textValue:l.label,className:"text-xs",children:(0,e.jsxs)("span",{className:"flex min-w-0 flex-col gap-0.5",children:[(0,e.jsx)("span",{children:l.label}),(0,e.jsx)("span",{className:"text-(length:--text-micro) text-ink-3",children:l.effect})]})},l.value))})]})]})}s(ke,"GovernanceSelect");function Ka({governance:a,onChange:t,isPending:r,errorMessage:o}){return(0,e.jsxs)("div",{className:"space-y-4","data-testid":"company-settings-interaction-governance-section",children:[(0,e.jsx)("div",{className:"text-xs font-medium text-ink-3 uppercase tracking-wide",children:"Interaction governance"}),(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("p",{className:"text-sm text-ink-3",children:["Thread interactions are open by default:"," ",(0,e.jsx)("span",{className:"font-medium text-ink",children:"Anyone"})," in the organization — the board or any agent, including the one that asked — can respond. Narrow a kind only when you need to."," ",(0,e.jsx)("span",{className:"font-medium text-ink",children:"Default policy"})," is the audience new cards get when the requester does not ask for one;"," ",(0,e.jsx)("span",{className:"font-medium text-ink",children:"Cap"})," narrows every request of that kind and can never widen one. Tool-approval confirmations always stay"," ",(0,e.jsx)("span",{className:"font-medium text-ink",children:"Human only"}),"."]}),(0,e.jsxs)("div",{className:"grid grid-cols-1 gap-y-4 sm:grid-cols-[1fr_auto_auto] sm:items-center sm:gap-x-4 sm:gap-y-2.5",children:[(0,e.jsx)("div",{className:"hidden text-xs font-medium text-ink-3 uppercase tracking-wide sm:block",children:"Kind"}),(0,e.jsx)("div",{className:"hidden text-xs font-medium text-ink-3 uppercase tracking-wide sm:block",children:"Default policy"}),(0,e.jsx)("div",{className:"hidden text-xs font-medium text-ink-3 uppercase tracking-wide sm:block",children:"Cap"}),ze.map(n=>{const c=a[n]??{},d=Pa[n];return(0,e.jsxs)(j.Fragment,{children:[(0,e.jsx)("div",{className:"text-sm font-medium sm:font-normal",children:d}),(0,e.jsx)(ke,{field:"defaultPolicy",testId:`governance-${n}-default`,ariaLabel:`Default resolver audience for ${d}`,mobileLabel:"Default policy",value:Ne(c.defaultPolicy),disabled:r,onChange:s(x=>t(n,"defaultPolicy",x),"onChange")}),(0,e.jsx)(ke,{field:"cap",testId:`governance-${n}-cap`,ariaLabel:`Resolver cap for ${d}`,mobileLabel:"Cap",value:Ne(c.cap),disabled:r,onChange:s(x=>t(n,"cap",x),"onChange")})]},n)})]}),o?(0,e.jsx)("span",{className:"text-xs text-bad",children:o}):null]})]})}s(Ka,"InteractionGovernancePanel");function Ua({deploymentMode:a,deploymentExposure:t}){if(!a)return null;const r=a==="local_trusted"?"Local trusted":`Authenticated ${t??"private"}`;return(0,e.jsx)(xa,{variant:"outline",children:r})}s(Ua,"ModeBadge");var za={orphan_objects:"Orphaned files in storage",orphan_assets:"Unreferenced uploads",closed_tasks:"Attachments of closed tasks"},Ga={setting:"set here",env:"from WARDMOTE_ATTACHMENT_MAX_BYTES",default:"built-in default"};function ee(a,t){return a instanceof Error&&a.message?a.message:t}s(ee,"errorText");function ve(a,t,r){const o=a.trim();if(!/^\d+$/.test(o))return null;const n=Number(o);return n>=t&&n<=r?n:null}s(ve,"parseWholeNumber");function Ba({attachmentMaxMegabytes:a,attachmentRetention:t,effectiveLimit:r}){return(0,e.jsxs)("section",{className:"space-y-6",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Files and storage"}),(0,e.jsx)("p",{className:"max-w-2xl text-sm text-ink-3",children:"Control how large uploaded files may be and whether old attachments are cleaned up automatically."})]}),(0,e.jsx)(qa,{value:a,effectiveLimit:r},String(a)),(0,e.jsx)(Wa,{value:t},JSON.stringify(t))]})}s(Ba,"FilesAndStorageSection");function qa({value:a,effectiveLimit:t}){const r=Q(),o=a===null?"":String(a),[n,c]=(0,j.useState)(o),[d,x]=(0,j.useState)(null),l=A({mutationFn:s(g=>L.updateGeneral({attachmentMaxMegabytes:g}),"mutationFn"),onSuccess:s(async()=>{await Promise.all([r.invalidateQueries({queryKey:w.instance.generalSettings}),r.invalidateQueries({queryKey:w.health})])},"onSuccess")}),y=s(()=>{if(n.trim()===""){x(null),l.mutate(null);return}const g=ve(n,1,500);if(g===null){x("Enter a whole number from 1 to 500 MB, or leave it blank to use the default.");return}x(null),l.mutate(g)},"submit"),S=n.trim()!==o,b=d??(l.error?ee(l.error,"Failed to save the upload limit."):null);return(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Upload size limit"}),(0,e.jsxs)("p",{className:"max-w-2xl text-sm text-ink-3",children:["Largest file anyone can attach, in MB (",1,"–",500,"). Leave blank to use the default: the WARDMOTE_ATTACHMENT_MAX_BYTES environment variable when set, otherwise ",100," MB."]}),t?(0,e.jsxs)("p",{className:"text-sm","data-testid":"attachment-limit-effective",children:["Current limit: ",(0,e.jsx)("span",{className:"font-medium tabular-nums",children:le(t.maxBytes)})," ",(0,e.jsxs)("span",{className:"text-ink-3",children:["(",Ga[t.source],")"]})]}):null]}),(0,e.jsxs)("form",{noValidate:!0,className:"flex flex-col gap-2 sm:flex-row sm:items-end",onSubmit:s(g=>{g.preventDefault(),y()},"onSubmit"),children:[(0,e.jsxs)("label",{className:"space-y-1.5 sm:w-48",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Limit (MB)"}),(0,e.jsx)(K,{type:"number",inputMode:"numeric",min:1,max:500,step:1,value:n,placeholder:"Default (100)","aria-label":"Upload size limit in MB","aria-invalid":d?!0:void 0,disabled:l.isPending,onChange:s(g=>{c(g.target.value),x(null)},"onChange")})]}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,e.jsx)(N,{type:"submit",size:"sm",disabled:l.isPending||!S,children:l.isPending?"Saving...":"Save upload limit"}),(0,e.jsx)(N,{type:"button",variant:"secondary",size:"sm",disabled:l.isPending||!S,onClick:s(()=>{c(o),x(null)},"onClick"),children:"Reset"})]})]}),b?(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:b}):null]})}s(qa,"UploadLimitForm");function Se(a){return{enabled:a.enabled,orphanAfterDays:String(a.orphanAfterDays),closedTasksEnabled:a.closedTasks.enabled,closedTasksAfterDays:String(a.closedTasks.afterDays)}}s(Se,"toDraft$1");function Va(a){const t=ve(a.orphanAfterDays,1,365),r=ve(a.closedTasksAfterDays,7,re),o=[];return t===null&&o.push("Unused files must be kept for 1–365 whole days."),r===null&&o.push(`Closed task attachments must be kept for 7–${re} whole days.`),t===null||r===null?{settings:null,errors:o}:{settings:{enabled:a.enabled,orphanAfterDays:t,closedTasks:{enabled:a.closedTasksEnabled,afterDays:r}},errors:o}}s(Va,"parseDraft");function Wa({value:a}){const t=Q(),[r,o]=(0,j.useState)(()=>Se(a)),[n,c]=(0,j.useState)(!1),[d,x]=(0,j.useState)(!1),{settings:l,errors:y}=Va(r),S=JSON.stringify(r)!==JSON.stringify(Se(a)),b=ae({queryKey:w.instance.attachmentRetention,queryFn:s(()=>L.getAttachmentRetention(),"queryFn"),retry:!1}),g=A({mutationFn:s(m=>L.updateGeneral({attachmentRetention:m}),"mutationFn"),onSuccess:s(async()=>{await Promise.all([t.invalidateQueries({queryKey:w.instance.generalSettings}),t.invalidateQueries({queryKey:w.instance.attachmentRetention})])},"onSuccess")}),E=A({mutationFn:s(m=>L.previewAttachmentRetention(m),"mutationFn")}),C=A({mutationFn:s(()=>L.runAttachmentRetention(),"mutationFn"),onSuccess:s(async()=>{E.reset(),await t.invalidateQueries({queryKey:w.instance.attachmentRetention})},"onSuccess")}),h=s(m=>{o(p=>({...p,...m})),E.reset()},"update"),v=g.isPending||C.isPending,k=n?y:[],P=g.error?ee(g.error,"Failed to save cleanup settings."):E.error?ee(E.error,"Failed to preview cleanup."):C.error?ee(C.error,"Cleanup did not run."):null;return(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,e.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,e.jsx)("h3",{className:"text-sm font-medium",children:"Automatic attachment cleanup"}),(0,e.jsx)("p",{className:"max-w-2xl text-sm text-ink-3",children:"Off by default. When on, Wardmote periodically deletes stored files nothing refers to any more and, if you choose, attachments of tasks closed long ago. Each removed attachment leaves a tombstone, so tasks show “File removed by retention” with the date instead of a broken file."})]}),(0,e.jsx)($,{checked:r.enabled,onCheckedChange:s(()=>h({enabled:!r.enabled}),"onCheckedChange"),disabled:v,"aria-label":"Toggle automatic attachment cleanup"})]}),(0,e.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,e.jsxs)("label",{className:"space-y-1.5",children:[(0,e.jsxs)("span",{className:"text-xs font-medium text-ink-3",children:["Remove unused files after (days, ",1,"–",365,")"]}),(0,e.jsx)(K,{type:"number",inputMode:"numeric",min:1,max:365,step:1,value:r.orphanAfterDays,"aria-label":"Remove unused files after days",disabled:v,onChange:s(m=>h({orphanAfterDays:m.target.value}),"onChange")})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsxs)("span",{className:"min-w-0 text-xs font-medium text-ink-3",children:["Remove attachments of closed tasks after (days, ",7,"–",re,")"]}),(0,e.jsx)($,{checked:r.closedTasksEnabled,onCheckedChange:s(()=>h({closedTasksEnabled:!r.closedTasksEnabled}),"onCheckedChange"),disabled:v,"aria-label":"Toggle closed task attachment cleanup"})]}),(0,e.jsx)(K,{type:"number",inputMode:"numeric",min:7,max:re,step:1,value:r.closedTasksAfterDays,"aria-label":"Remove attachments of closed tasks after days",disabled:v||!r.closedTasksEnabled,onChange:s(m=>h({closedTasksAfterDays:m.target.value}),"onChange")})]})]}),k.length>0?(0,e.jsx)("div",{role:"alert",className:"space-y-1 text-sm text-bad",children:k.map(m=>(0,e.jsx)("p",{children:m},m))}):null,(0,e.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,e.jsx)(N,{size:"sm",disabled:v||!S,onClick:s(()=>{c(!0),l&&g.mutate(l)},"onClick"),children:g.isPending?"Saving...":"Save cleanup settings"}),(0,e.jsx)(N,{variant:"secondary",size:"sm",disabled:v||E.isPending,onClick:s(()=>{c(!0),l&&E.mutate(l)},"onClick"),children:E.isPending?"Previewing...":"Preview"}),(0,e.jsx)(N,{variant:"secondary",size:"sm",disabled:v,onClick:s(()=>x(!0),"onClick"),children:C.isPending?"Running...":"Run now"})]}),P?(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:P}):null,E.data?(0,e.jsx)($a,{title:"Preview — nothing deleted yet",report:E.data}):null,(0,e.jsxs)("div",{className:"space-y-1.5","data-testid":"attachment-retention-last-run",children:[(0,e.jsx)("h4",{className:"text-xs font-medium uppercase tracking-wide text-ink-3",children:"Last run"}),b.isLoading?(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Loading cleanup history..."}):b.error?(0,e.jsx)("p",{className:"text-sm text-ink-3",children:ee(b.error,"Cleanup history is unavailable.")}):b.data?.lastRun?(0,e.jsx)(Ha,{report:b.data.lastRun}):(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Cleanup has not run yet."})]}),(0,e.jsx)(da,{open:d,onOpenChange:x,children:(0,e.jsxs)(ia,{children:[(0,e.jsxs)(ca,{children:[(0,e.jsx)(na,{children:"Run attachment cleanup now?"}),(0,e.jsxs)(ta,{children:["This permanently deletes the files matched by the saved cleanup settings, even while automatic cleanup is off. Removed attachments leave a tombstone in their tasks.",S?" Unsaved changes on this page are not used.":""]})]}),(0,e.jsxs)(la,{children:[(0,e.jsx)(oa,{children:"Cancel"}),(0,e.jsx)(ra,{onClick:s(()=>C.mutate(),"onClick"),children:"Delete files now"})]})]})})]})}s(Wa,"RetentionForm");function Ha({report:a}){return(0,e.jsxs)("div",{className:"space-y-0.5 text-sm",children:[(0,e.jsxs)("p",{children:[(0,e.jsx)("span",{className:"tabular-nums",children:Ve(a.finishedAt)}),(0,e.jsxs)("span",{className:"text-ink-3",children:[" · ",a.trigger==="manual"?"Manual":"Scheduled"]})]}),(0,e.jsxs)("p",{className:"text-ink-3",children:[(0,e.jsx)("span",{className:"tabular-nums",children:a.totalCount})," ",a.totalCount===1?"file":"files"," removed ·"," ",(0,e.jsx)("span",{className:"tabular-nums",children:le(a.totalBytes)})," freed",a.failedCount>0?(0,e.jsxs)("span",{className:"text-bad",children:[" · ",(0,e.jsx)("span",{className:"tabular-nums",children:a.failedCount})," failed"]}):null]})]})}s(Ha,"LastRunSummary");function $a({title:a,report:t}){return(0,e.jsxs)("div",{className:"space-y-2","data-testid":"attachment-retention-preview",children:[(0,e.jsx)("h4",{className:"text-xs font-medium uppercase tracking-wide text-ink-3",children:a}),(0,e.jsxs)("ul",{className:"space-y-1.5",children:[t.rules.map(r=>(0,e.jsxs)("li",{"data-rule":r.rule,className:"flex items-start justify-between gap-3 text-sm",children:[(0,e.jsx)("span",{className:"min-w-0",children:za[r.rule]}),(0,e.jsxs)("span",{className:"shrink-0 text-right tabular-nums text-ink-3",children:[r.count," ",r.count===1?"file":"files"," · ",le(r.bytes)]})]},r.rule)),(0,e.jsxs)("li",{className:"flex items-start justify-between gap-3 text-sm font-medium",children:[(0,e.jsx)("span",{className:"min-w-0",children:"Total"}),(0,e.jsxs)("span",{className:"shrink-0 text-right tabular-nums",children:[t.totalCount," ",t.totalCount===1?"file":"files"," · ",le(t.totalBytes)]})]})]})]})}s($a,"RetentionReportSummary");var we={deepgram:"Deepgram",elevenlabs:"ElevenLabs",google:"Google Cloud Speech-to-Text",openai_compatible:"OpenAI-compatible endpoint"},ue="__other__",Qa={stt_disabled:"Speech-to-text is not configured. Choose a provider and a model.",stt_missing_key:"No API key is saved for this provider. Enter it next to Provider and save.",stt_invalid_credentials:"The Google service account key cannot be read. Paste the service account JSON key next to Provider.",stt_too_long:"The audio is longer than the limit. Use a shorter file or raise Max audio in Advanced.",stt_too_large:"The file is larger than the provider accepts. Use a smaller file.",stt_empty:"The file is empty. Choose another audio file.",stt_timeout:"The provider did not answer in time. Try again.",stt_rejected:"The provider rejected the request. Check the key, the model and the language.",stt_unavailable:"The provider is busy or down. Try again in a minute.",stt_network:"Wardmote could not reach the provider. Check the server's network access.",stt_invalid_response:"The provider answered in an unexpected format. Check the base URL and model."},Ya=(()=>{try{return new Intl.DisplayNames(["en"],{type:"language"})}catch{return null}})();function se(a){if(a==="")return"Automatic (detect language)";if(a==="multi")return"Multilingual (Nova-3, mixed languages)";let t;try{t=Ya?.of(a)}catch{t=void 0}return t&&t!==a?t+" ("+a+")":a}s(se,"speechToTextLanguageLabel");function Ja(a){return Qa[a]??"Speech-to-text failed."}s(Ja,"speechToTextErrorText");function Xa(a,t,r=""){const o={};a.provider==="openai_compatible"&&a.baseUrl.trim()===""&&(o.baseUrl="Enter the endpoint base URL, for example https://api.openai.com/v1."),a.model.trim()===""&&(o.model="Choose a model.");const n=t?.[a.provider],c=r.trim();if(c!==""?a.provider==="google"&&!c.startsWith("{")&&(o.key="Paste the service account JSON key itself."):n?.stored?a.provider==="google"&&n.usable===!1&&(o.key="The saved key is not a usable service account JSON key. Replace it."):a.apiKeyEnvVar.trim()===""||n&&a.apiKeyEnvVar===n.envVar&&!n.set?o.key="Enter the API key.":n&&a.provider==="google"&&a.apiKeyEnvVar===n.envVar&&n.usable===!1&&(o.key="Enter the service account JSON key: the fallback "+n.envVar+" is not a usable key."),a.provider==="google"){const d=a.model.startsWith("chirp");!d&&a.model!==""&&a.language===""&&(o.language="Choose a language: only Chirp models detect it automatically."),a.google.alternativeLanguages.length>0&&(d||a.language==="")&&(o.alternativeLanguages="Remove the alternative languages, or choose a language and the long, short or telephony model.")}return o}s(Xa,"speechToTextFieldErrors");function X({message:a}){return a?(0,e.jsx)("p",{className:"text-xs text-bad",children:a}):null}s(X,"FieldError");function ie({label:a,checked:t,disabled:r,onChange:o}){return(0,e.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,e.jsx)("span",{className:"text-sm",children:a}),(0,e.jsx)($,{checked:t,onCheckedChange:s(()=>o(!t),"onCheckedChange"),disabled:r,"aria-label":a})]})}s(ie,"ToggleRow");function he({label:a,value:t,min:r,max:o,step:n,unit:c,defaultValue:d,disabled:x,onChange:l}){const y=t??d??r,S=s(b=>Math.min(o,Math.max(r,b)),"clamp");return(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:a}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(N,{variant:"secondary",size:"sm","aria-label":"Decrease "+a,disabled:x||t!==null&&t<=r,onClick:s(()=>l(S(y-n)),"onClick"),children:(0,e.jsx)(ua,{className:"size-3"})}),(0,e.jsx)("span",{className:"min-w-20 text-center text-sm tabular-nums","aria-label":a,children:t===null?"Automatic":t+" "+c}),(0,e.jsx)(N,{variant:"secondary",size:"sm","aria-label":"Increase "+a,disabled:x||y>=o,onClick:s(()=>l(S(t===null?r:y+n)),"onClick"),children:(0,e.jsx)(ha,{className:"size-3"})}),t!==d?(0,e.jsxs)(N,{variant:"ghost",size:"sm",disabled:x,onClick:s(()=>l(d),"onClick"),children:["Default (",d===null?"automatic":d+" "+c,")"]}):null]})]})}s(he,"Stepper");function Za({values:a,disabled:t,onChange:r}){const[o,n]=(0,j.useState)(""),c=a.length>=100,d=s(()=>{const l=o.trim();!l||c||l.length>50||a.includes(l)||/[<>{}[\]\\]/.test(l)||(r([...a,l]),n(""))},"add"),x=s(l=>{l.key==="Enter"&&(l.preventDefault(),d())},"onKeyDown");return(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsxs)("span",{className:"text-xs font-medium text-ink-3",children:["Keyterms (",a.length,"/",100,")"]}),(0,e.jsx)("div",{className:"flex flex-wrap gap-1.5",children:a.map(l=>(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full border border-line px-2 py-0.5 text-xs",children:[l,(0,e.jsx)("button",{type:"button","aria-label":"Remove "+l,disabled:t,onClick:s(()=>r(a.filter(y=>y!==l)),"onClick"),children:(0,e.jsx)(Te,{className:"size-3"})})]},l))}),(0,e.jsx)(K,{"aria-label":"Add keyterm",value:o,maxLength:50,placeholder:c?"Limit reached":"Type a word or name, then press Enter",disabled:t||c,onChange:s(l=>n(l.target.value),"onChange"),onKeyDown:x})]})}s(Za,"KeytermChips");function Ee(a,t){const r=a.map(o=>({key:o,value:o,label:se(o),searchText:o}));return t?[{key:"auto",value:"",label:se(""),searchText:"auto detect"},...r]:r}s(Ee,"languageOptions");function es({result:a}){return a.ok?(0,e.jsxs)("div",{className:"space-y-1 text-sm",role:"status",children:[(0,e.jsxs)("p",{className:"text-xs text-ink-3",children:["Transcribed in ",(a.durationMs/1e3).toFixed(1)," s",a.language?" · "+se(a.language):""]}),a.segments&&new Set(a.segments.map(t=>t.speaker)).size>1?a.segments.map((t,r)=>(0,e.jsxs)("p",{children:[(0,e.jsxs)("span",{className:"font-medium",children:[t.speaker,":"]})," ",t.text]},r)):(0,e.jsx)("p",{children:a.text||"(no speech detected)"})]}):(0,e.jsxs)("div",{className:"space-y-0.5 text-sm",role:"status",children:[(0,e.jsx)("p",{className:"text-bad",children:Ja(a.code)}),(0,e.jsxs)("p",{className:"text-xs text-ink-3",children:[a.code,a.status?" · HTTP "+a.status:""]})]})}s(es,"TestResult");function as({value:a,disabled:t,onSave:r}){const o=a.apiKeyEnvVar===""?{...a,apiKeyEnvVar:me[a.provider]}:a,[n,c]=(0,j.useState)(o),[d,x]=(0,j.useState)(null),[l,y]=(0,j.useState)(()=>a.model!==""&&!ne[a.provider].includes(a.model)),[S,b]=(0,j.useState)(!1),[g,E]=(0,j.useState)(null),[C,h]=(0,j.useState)(""),[v,k]=(0,j.useState)(!1),P=Q(),m=n.provider,p=s(i=>c(Y=>({...Y,...i})),"update"),B=ae({queryKey:w.instance.speechToTextCredentials,queryFn:s(()=>L.getSpeechToTextCredentials(),"queryFn"),retry:!1}),O=B.data,R=O?.[m],z=me[m],M=n.apiKeyEnvVar!==z,u=Xa(n,O,C),_=Object.keys(u).length>0,T=C.trim(),G=JSON.stringify(n)!==JSON.stringify(a),te=G||T!=="",f=R?.stored===!0,I=!f||v,W=(0,j.useMemo)(()=>{const i=d?.provider===m?d.models:[...ne[m]];return n.model&&!l&&!i.includes(n.model)?[n.model,...i]:i},[d,m,n.model,l]),q=(0,j.useMemo)(()=>{const i=d?.provider==="google"&&d.locations.length>0?d.locations:[...La];return i.includes(n.google.location)?i:[n.google.location,...i]},[d,n.google.location]),F=_a[m],oe=(0,j.useMemo)(()=>{const i=m!=="google"||n.model.startsWith("chirp");return Ee(n.language&&!F.includes(n.language)?[n.language,...F]:F,i)},[m,n.model,n.language,F]),Re=(0,j.useMemo)(()=>Ee(F.filter(i=>i!==n.language&&!n.google.alternativeLanguages.includes(i)),!1),[F,n.language,n.google.alternativeLanguages]),V=A({mutationFn:s(()=>L.listSpeechToTextModels({provider:m,baseUrl:n.baseUrl.trim(),apiKeyEnvVar:n.apiKeyEnvVar.trim(),...T?{apiKey:T}:{},...m==="google"?{google:{location:n.google.location,projectId:n.google.projectId}}:{}}),"mutationFn"),onSuccess:s(i=>x({provider:m,models:i.models.map(Y=>Y.id),locations:i.locations??[],source:i.source}),"onSuccess")}),U=A({mutationFn:s(i=>L.testSpeechToText(n,i,T),"mutationFn")}),D=A({mutationFn:s(i=>i===null?L.removeSpeechToTextKey(m):L.saveSpeechToTextKey(m,i),"mutationFn"),onSuccess:s(i=>{P.setQueryData(w.instance.speechToTextCredentials,i),h(""),k(!1)},"onSuccess")}),Ie=s(async()=>{T&&await D.mutateAsync(T),G&&r(n)},"save"),De=s(i=>{V.reset(),U.reset(),D.reset(),h(""),k(!1),y(!1),p({provider:i,model:ne[i][0]??"",baseUrl:"",apiKeyEnvVar:me[i],language:"",diarize:i==="openai_compatible"?!1:n.diarize,google:{...n.google,alternativeLanguages:[]}})},"changeProvider"),ye=B.isLoading?{tone:"text-ink-3",text:"Checking..."}:f?{tone:"text-ok",text:"Saved"}:M&&n.apiKeyEnvVar?{tone:"text-ink-3",text:"Not set here. Falls back to "+n.apiKeyEnvVar+"; run Test to confirm it works."}:R?.set&&n.apiKeyEnvVar?{tone:"text-ink-3",text:"Not set here. Using "+z+" from the server environment."}:{tone:"text-ink-3",text:"Not set"},be=n.google.projectId||R?.projectId||"";return(0,e.jsx)("section",{children:(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Speech-to-text"}),(0,e.jsx)("p",{className:"max-w-2xl text-sm text-ink-3",children:"Transcribe WhatsApp voice notes and any audio or video attachment agents read. API keys are stored encrypted and never shown again. Off by default."})]}),(0,e.jsx)($,{checked:n.enabled,onCheckedChange:s(()=>p({enabled:!n.enabled}),"onCheckedChange"),disabled:t||!n.enabled&&_,"aria-label":"Toggle speech-to-text"})]}),(0,e.jsxs)("div",{className:"grid gap-3 md:grid-cols-2",children:[(0,e.jsxs)("label",{className:"space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Provider"}),(0,e.jsx)(ce,{"aria-label":"Speech-to-text provider",value:m,disabled:t,onChange:s(i=>De(i.target.value),"onChange"),children:Object.keys(we).map(i=>(0,e.jsx)("option",{value:i,children:we[i]},i))})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"API key"}),(0,e.jsx)("p",{className:"text-sm "+ye.tone,"data-testid":"stt-key-status",children:ye.text}),I?(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(K,{type:"password","aria-label":"Speech-to-text API key",value:C,autoComplete:"new-password",spellCheck:!1,placeholder:m==="google"?"Paste the service account JSON key":"Paste the API key",disabled:t||D.isPending,onChange:s(i=>h(i.target.value),"onChange")}),v?(0,e.jsx)(N,{variant:"ghost",size:"sm",disabled:D.isPending,onClick:s(()=>{k(!1),h("")},"onClick"),children:"Cancel"}):null]}):(0,e.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,e.jsx)(N,{variant:"secondary",size:"sm",disabled:t||D.isPending,onClick:s(()=>k(!0),"onClick"),children:"Replace"}),(0,e.jsx)(N,{variant:"ghost",size:"sm",disabled:t||D.isPending,onClick:s(()=>D.mutate(null),"onClick"),children:"Remove"})]}),D.isError?(0,e.jsx)("p",{className:"text-xs text-bad",children:D.error instanceof Error?D.error.message:"The key could not be saved."}):null,m==="google"&&be?(0,e.jsxs)("p",{className:"text-xs text-ink-3",children:["Project ",be,n.google.projectId?" (set in Advanced)":" (from the service account)"]}):null,(0,e.jsx)(X,{message:u.key})]}),m==="openai_compatible"?(0,e.jsxs)("label",{className:"space-y-1.5 md:col-span-2",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Endpoint base URL"}),(0,e.jsx)(K,{"aria-label":"Speech-to-text base URL",value:n.baseUrl,placeholder:"https://api.openai.com/v1",disabled:t,onChange:s(i=>p({baseUrl:i.target.value}),"onChange")}),(0,e.jsx)(X,{message:u.baseUrl})]}):null,(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Model"}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsxs)(ce,{"aria-label":"Speech-to-text model",value:l?ue:n.model,disabled:t,onChange:s(i=>{i.target.value===ue?(y(!0),p({model:""})):(y(!1),p({model:i.target.value}))},"onChange"),children:[W.map(i=>(0,e.jsx)("option",{value:i,children:i},i)),(0,e.jsx)("option",{value:ue,children:"Other model..."})]}),(0,e.jsx)(N,{variant:"secondary",size:"sm",disabled:t||V.isPending,onClick:s(()=>V.mutate(),"onClick"),children:V.isPending?"Fetching...":"Fetch"})]}),l?(0,e.jsx)(K,{"aria-label":"Other model id",value:n.model,placeholder:"Model id from the provider",disabled:t,onChange:s(i=>p({model:i.target.value.trim()}),"onChange")}):null,V.isError?(0,e.jsxs)("p",{className:"text-xs text-bad",children:[V.error instanceof Error?V.error.message:"Could not list models."," The suggested list stays available."]}):d?.provider===m?(0,e.jsxs)("p",{className:"text-xs text-ink-3",children:[d.models.length," models ",d.source==="provider"?"from the provider":"from Wardmote's list (the provider publishes none)"]}):null,(0,e.jsx)(X,{message:u.model})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Language"}),(0,e.jsx)(je,{value:n.language,groups:[{id:"languages",options:oe}],onValueChange:s(i=>p({language:i}),"onValueChange"),placeholder:"Choose a language",searchPlaceholder:"Search languages...",triggerAriaLabel:"Speech-to-text language",disabled:t,renderValue:s(i=>i?.label??se(n.language),"renderValue")}),(0,e.jsx)(X,{message:u.language})]})]}),(0,e.jsxs)(sa,{open:S,onOpenChange:b,children:[(0,e.jsx)(aa,{asChild:!0,children:(0,e.jsxs)(N,{variant:"ghost",size:"sm","aria-expanded":S,children:[(0,e.jsx)(ma,{className:"size-4 transition-transform "+(S?"rotate-180":"")}),"Advanced"]})}),(0,e.jsx)(ea,{children:(0,e.jsxs)("div",{className:"mt-3 grid gap-4 md:grid-cols-2",children:[m!=="openai_compatible"?(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)(ie,{label:"Speaker diarization",checked:n.diarize,disabled:t,onChange:s(i=>p({diarize:i}),"onChange")}),m==="deepgram"?(0,e.jsx)(ie,{label:"Smart formatting",checked:n.deepgram.smartFormat,disabled:t,onChange:s(i=>p({deepgram:{smartFormat:i}}),"onChange")}):null,m==="elevenlabs"?(0,e.jsx)(ie,{label:"Tag audio events",checked:n.elevenlabs.tagAudioEvents,disabled:t,onChange:s(i=>p({elevenlabs:{...n.elevenlabs,tagAudioEvents:i}}),"onChange")}):null,m==="google"?(0,e.jsx)(ie,{label:"Automatic punctuation",checked:n.google.autoPunctuation,disabled:t,onChange:s(i=>p({google:{...n.google,autoPunctuation:i}}),"onChange")}):null,m==="elevenlabs"&&n.diarize?(0,e.jsx)(he,{label:"Maximum speakers",value:n.elevenlabs.numSpeakers,min:1,max:32,step:1,unit:"speakers",defaultValue:null,disabled:t,onChange:s(i=>p({elevenlabs:{...n.elevenlabs,numSpeakers:i}}),"onChange")}):null]}):null,m!=="openai_compatible"?(0,e.jsx)(Za,{values:n.keyterms,disabled:t,onChange:s(i=>p({keyterms:i}),"onChange")}):null,m==="google"?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("label",{className:"space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Location"}),(0,e.jsx)(ce,{"aria-label":"Google location",value:n.google.location,disabled:t,onChange:s(i=>p({google:{...n.google,location:i.target.value}}),"onChange"),children:q.map(i=>(0,e.jsx)("option",{value:i,children:i},i))}),(0,e.jsx)("span",{className:"block text-xs text-ink-3",children:"Chirp 3 runs in us and eu. Fetch lists every location your project can use."})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsxs)("span",{className:"text-xs font-medium text-ink-3",children:["Alternative languages (",n.google.alternativeLanguages.length,"/",2,")"]}),(0,e.jsx)("div",{className:"flex flex-wrap gap-1.5",children:n.google.alternativeLanguages.map(i=>(0,e.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full border border-line px-2 py-0.5 text-xs",children:[se(i),(0,e.jsx)("button",{type:"button","aria-label":"Remove "+i,disabled:t,onClick:s(()=>p({google:{...n.google,alternativeLanguages:n.google.alternativeLanguages.filter(Y=>Y!==i)}}),"onClick"),children:(0,e.jsx)(Te,{className:"size-3"})})]},i))}),(0,e.jsx)(je,{value:"",groups:[{id:"alternatives",options:Re}],onValueChange:s(i=>p({google:{...n.google,alternativeLanguages:[...n.google.alternativeLanguages,i]}}),"onValueChange"),placeholder:"Add a language",searchPlaceholder:"Search languages...",triggerAriaLabel:"Add alternative language",disabled:t||n.google.alternativeLanguages.length>=2}),(0,e.jsx)("span",{className:"block text-xs text-ink-3",children:"For the long, short and telephony models, next to the chosen language."}),(0,e.jsx)(X,{message:u.alternativeLanguages})]})]}):null,(0,e.jsx)(he,{label:"Max audio",value:n.maxAudioSeconds,min:30,max:7200,step:30,unit:"s",defaultValue:Z.maxAudioSeconds,disabled:t,onChange:s(i=>p({maxAudioSeconds:i??Z.maxAudioSeconds}),"onChange")}),(0,e.jsx)(he,{label:"Voice note wait",value:n.sttWaitSeconds,min:1,max:120,step:5,unit:"s",defaultValue:Z.sttWaitSeconds,disabled:t,onChange:s(i=>p({sttWaitSeconds:i??Z.sttWaitSeconds}),"onChange")}),(0,e.jsx)("p",{className:"text-xs text-ink-3 md:col-span-2",children:"Max audio is checked for Ogg Opus voice notes; other formats are limited by size only. Voice note wait is how long a WhatsApp wake waits for the transcript before it continues without it."}),(0,e.jsxs)("label",{className:"space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Fallback key variable (server environment)"}),(0,e.jsx)(K,{"aria-label":"Fallback key variable",value:n.apiKeyEnvVar,autoComplete:"off",spellCheck:!1,disabled:t,onChange:s(i=>p({apiKeyEnvVar:i.target.value.trim()}),"onChange")}),M?(0,e.jsxs)(N,{variant:"ghost",size:"sm",disabled:t,onClick:s(()=>p({apiKeyEnvVar:z}),"onClick"),children:["Use ",z]}):null]}),m!=="openai_compatible"?(0,e.jsxs)("label",{className:"space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Base URL override"}),(0,e.jsx)(K,{"aria-label":"Base URL override",value:n.baseUrl,placeholder:m==="google"?n.google.location==="global"?"https://speech.googleapis.com":"https://"+n.google.location+"-speech.googleapis.com":We[m],disabled:t,onChange:s(i=>p({baseUrl:i.target.value.trim()}),"onChange")})]}):null,m==="google"?(0,e.jsxs)("label",{className:"space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Project id override"}),(0,e.jsx)(K,{"aria-label":"Google project id",value:n.google.projectId,placeholder:R?.projectId??"From the service account key",disabled:t,onChange:s(i=>p({google:{...n.google,projectId:i.target.value.trim()}}),"onChange")})]}):null]})})]}),(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:"Test with an audio file"}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,e.jsx)("input",{type:"file",accept:"audio/*,video/*","aria-label":"Speech-to-text test audio",disabled:t,onChange:s(i=>{E(i.target.files?.[0]??null),U.reset()},"onChange"),className:"text-sm"}),(0,e.jsx)(N,{variant:"secondary",size:"sm",disabled:t||_||!g||U.isPending,onClick:s(()=>g&&U.mutate(g),"onClick"),children:U.isPending?"Transcribing...":"Test speech-to-text"})]}),U.data?(0,e.jsx)(es,{result:U.data}):null,U.isError?(0,e.jsx)("p",{className:"text-sm text-bad",children:U.error instanceof Error?U.error.message:"Test failed."}):null]}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(N,{size:"sm",disabled:t||!te||D.isPending||T!==""&&!!u.key,onClick:s(()=>{Ie().catch(()=>{})},"onClick"),children:D.isPending?"Saving...":"Save speech-to-text"}),(0,e.jsx)(N,{variant:"secondary",size:"sm",disabled:t||!te,onClick:s(()=>{c(o),h(""),k(!1),y(a.model!==""&&!ne[a.provider].includes(a.model))},"onClick"),children:"Reset"})]})]})})}s(as,"SpeechToTextSection");var xe=[{key:"maxConcurrentRuns",label:"Max running local runs",min:1,max:64,fallback:20},{key:"maxConcurrentStarts",label:"Max runs starting at once",min:1,max:64,fallback:4},{key:"startWaitBypassSec",label:"Start wait bypass (seconds)",min:1,max:Me,fallback:120},{key:"memoryReservePercent",label:"Memory reserve (% of RAM)",min:1,max:90,fallback:20},{key:"memoryGateCooldownSec",label:"Memory gate cooldown after an OOM kill (seconds)",min:1,max:He,fallback:120}],ss={env:"environment variable",setting:"set here",default:"built-in default"};function ts(a){return{maxConcurrentRuns:a.maxConcurrentRuns===null?"":String(a.maxConcurrentRuns),maxConcurrentStarts:a.maxConcurrentStarts===null?"":String(a.maxConcurrentStarts),startWaitBypassSec:a.startWaitBypassSec===null?"":String(a.startWaitBypassSec),memoryReservePercent:a.memoryReservePercent===null?"":String(a.memoryReservePercent),memoryGateCooldownSec:a.memoryGateCooldownSec===null?"":String(a.memoryGateCooldownSec)}}s(ts,"toDraft");function ns(a,t,r){const o=a.trim();if(o==="")return null;if(!/^\d+$/.test(o))return;const n=Number(o);return n>=t&&n<=r?n:void 0}s(ns,"parseLimit");function is({value:a,disabled:t=!1}){const r=Q(),o=ts(a),[n,c]=(0,j.useState)(o),[d,x]=(0,j.useState)(null),l=ae({queryKey:w.instance.localRunLimits,queryFn:s(()=>L.getLocalRunLimits(),"queryFn")}).data,y=A({mutationFn:s(h=>L.updateGeneral({localRuns:h}),"mutationFn"),onSuccess:s(async()=>{await Promise.all([r.invalidateQueries({queryKey:w.instance.generalSettings}),r.invalidateQueries({queryKey:w.instance.localRunLimits})])},"onSuccess")}),S=s(h=>l?.[h].source==="env","envLocked"),b=xe.some(({key:h})=>n[h].trim()!==o[h]),g=t||y.isPending,E=s(()=>{const h={...a};for(const v of xe){if(S(v.key))continue;const k=ns(n[v.key],v.min,v.max);if(k===void 0){x(`${v.label}: enter a whole number from ${v.min} to ${v.max}, or leave it blank to use the default.`);return}h[v.key]=k}x(null),y.mutate(h)},"submit"),C=d??(y.error instanceof Error&&y.error.message?y.error.message:y.error?"Failed to save local run limits.":null);return(0,e.jsx)("section",{children:(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Local run limits"}),(0,e.jsx)("p",{className:"max-w-2xl text-sm text-ink-3",children:"Cap how many local CLI agent runs this instance runs at once and how many may be starting up together. Changes apply to the next run admission without a restart; lowering a limit never stops runs that are already running. The memory reserve and cooldown only drive the memory gate's log line for now: each local run start records whether it would have been held, and no start is delayed. Leave a field blank to use the built-in default. A server environment variable, when set, overrides the value saved here."})]}),(0,e.jsxs)("form",{noValidate:!0,className:"space-y-3",onSubmit:s(h=>{h.preventDefault(),E()},"onSubmit"),children:[(0,e.jsx)("div",{className:"grid gap-3 md:grid-cols-3",children:xe.map(h=>{const v=l?.[h.key],k=v?.source==="env";return(0,e.jsxs)("label",{className:"space-y-1.5",children:[(0,e.jsx)("span",{className:"text-xs font-medium text-ink-3",children:h.label}),(0,e.jsx)(K,{type:"number",inputMode:"numeric",min:h.min,max:h.max,step:1,value:k?String(v.value):n[h.key],placeholder:`Default (${h.fallback})`,"aria-label":h.label,readOnly:k,disabled:g||k,onChange:s(P=>{const m=P.target.value;c(p=>({...p,[h.key]:m})),x(null)},"onChange")}),k?(0,e.jsxs)("span",{className:"block text-xs text-ink-3","data-testid":`local-run-limit-env-${h.key}`,children:["Overridden by the ",v.envVar," environment variable. Unset it to manage this here."]}):v?(0,e.jsxs)("span",{className:"block text-xs text-ink-3","data-testid":`local-run-limit-effective-${h.key}`,children:["In force: ",(0,e.jsx)("span",{className:"font-medium tabular-nums",children:v.value})," (",ss[v.source],"). Range ",h.min,"–",h.max,"."]}):null]},h.key)})}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,e.jsx)(N,{type:"submit",size:"sm",disabled:g||!b,children:y.isPending?"Saving...":"Save local run limits"}),(0,e.jsx)(N,{type:"button",variant:"secondary",size:"sm",disabled:g||!b,onClick:s(()=>{c(o),x(null)},"onClick"),children:"Reset"})]})]}),C?(0,e.jsx)("p",{role:"alert",className:"text-sm text-bad",children:C}):null]})})}s(is,"LocalRunLimitsSection");function rs({embedded:a=!1}){const{setBreadcrumbs:t}=Ae(),r=Q(),[o,n]=(0,j.useState)(null),c=Ea();(0,j.useEffect)(()=>{a||t([{label:"Settings",href:"/company/settings"},{label:"General"}])},[a,t]);const d=ae({queryKey:w.instance.generalSettings,queryFn:s(()=>L.getGeneral(),"queryFn")}),x=ae({queryKey:w.health,queryFn:s(()=>ga.get(),"queryFn"),retry:!1}),l=A({mutationFn:L.updateGeneral,onMutate:s(()=>{n(null),c.reset()},"onMutate"),onSuccess:s(async()=>{n(null),c.reset(),await r.invalidateQueries({queryKey:w.instance.generalSettings})},"onSuccess"),onError:s(u=>{n(u instanceof Error?u.message:"Failed to update general settings.")},"onError")});if(d.isLoading||x.isLoading)return(0,e.jsx)("div",{className:"text-sm text-ink-3",children:"Loading general settings..."});if(d.error)return(0,e.jsx)("div",{className:"text-sm text-bad",children:d.error instanceof Error?d.error.message:"Failed to load general settings."});const y=d.data?.censorUsernameInLogs===!0,S=d.data?.feedbackDataSharingPreference??"prompt",b=d.data?.backupRetention??Ue,g=new Set(x.data?.hiddenSettings??[]),E=!g.has("instance.general.deploymentStatus"),C=!g.has("instance.general.censorUsernameInLogs"),h=!g.has("instance.general.backupRetention"),v=!g.has("instance.general.feedbackDataSharingPreference"),k=!g.has("instance.general.speechToText"),P=d.data?.speechToText??Z,m=!g.has("instance.general.signOut"),p=!g.has("instance.general.autoInstallUpdates"),B=d.data?.autoInstallUpdates===!0,O=d.data?.localRuns??Ke,R=[...C?["log display"]:[],...h?["backup retention"]:[],...v?["data sharing"]:[],...k?["speech-to-text"]:[],"local run limits","files and storage"],z=R.length>2?`${R.slice(0,-1).join(", ")}, and ${R[R.length-1]}`:R.join(" and "),M=c.error instanceof Error?c.error.message:c.error?"Failed to sign out.":o;return(0,e.jsxs)("div",{className:a?"space-y-8":"max-w-4xl space-y-8",children:[a?null:(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(_e,{className:"h-5 w-5 text-ink-3"}),(0,e.jsx)("h1",{className:"text-lg font-semibold",children:"General"})]}),(0,e.jsxs)("p",{className:"text-sm text-ink-3",children:["Configure instance-wide preferences",R.length>0?(0,e.jsxs)(e.Fragment,{children:[" including ",z]}):null,"."]})]}),M&&(0,e.jsx)("div",{className:"rounded-md border border-bad/40 bg-bad/5 px-3 py-2 text-sm text-bad",children:M}),E&&(0,e.jsx)("section",{children:(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Deployment and auth"}),(0,e.jsx)(Ua,{deploymentMode:x.data?.deploymentMode,deploymentExposure:x.data?.deploymentExposure})]}),(0,e.jsx)("div",{className:"text-sm text-ink-3",children:x.data?.deploymentMode==="local_trusted"?"Local trusted mode is optimized for a local operator. Browser requests run as local board context and no sign-in is required.":x.data?.deploymentExposure==="public"?"Authenticated public mode requires sign-in for board access and is intended for public URLs.":"Authenticated private mode requires sign-in and is intended for LAN, VPN, or other private-network deployments."}),(0,e.jsxs)("div",{className:"grid gap-3 md:grid-cols-3",children:[(0,e.jsx)(pe,{label:"Auth readiness",value:x.data?.authReady?"Ready":"Not ready"}),(0,e.jsx)(pe,{label:"Bootstrap status",value:x.data?.bootstrapStatus==="bootstrap_pending"?"Setup required":"Ready"}),(0,e.jsx)(pe,{label:"Bootstrap invite",value:x.data?.bootstrapInviteActive?"Active":"None"})]})]})}),p&&(0,e.jsx)("section",{children:(0,e.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Install updates automatically"}),(0,e.jsx)("p",{className:"max-w-2xl text-sm text-ink-3",children:"When a newer Wardmote release is published on this install's channel, install it while no runs are active or queued. Running work is never stopped; the update waits for the next quiet check. A version that fails and rolls back is not retried automatically. Only managed service installs on Linux can update themselves. This is off by default."})]}),(0,e.jsx)($,{checked:B,onCheckedChange:s(()=>l.mutate({autoInstallUpdates:!B}),"onCheckedChange"),disabled:l.isPending||c.isPending,"aria-label":"Toggle automatic updates"})]})}),C&&(0,e.jsx)("section",{children:(0,e.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Censor username in logs"}),(0,e.jsx)("p",{className:"max-w-2xl text-sm text-ink-3",children:"Hide the username segment in home-directory paths and similar operator-visible log output. Standalone username mentions outside of paths are not yet masked in the live transcript view. This is off by default."})]}),(0,e.jsx)($,{checked:y,onCheckedChange:s(()=>l.mutate({censorUsernameInLogs:!y}),"onCheckedChange"),disabled:l.isPending||c.isPending,"aria-label":"Toggle username log censoring"})]})}),h&&(0,e.jsx)("section",{children:(0,e.jsxs)("div",{className:"space-y-5",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Backup retention"}),(0,e.jsx)("p",{className:"max-w-2xl text-sm text-ink-3",children:"Configure how many automatic database backups are kept. Backups run roughly every hour, are compressed with gzip, and are verified before an older backup is removed. Keeping the last few backups bounds disk use; tiered retention keeps every backup in the daily window plus one per week and month, and grows with the database."})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h3",{className:"text-xs font-medium text-ink-3 uppercase tracking-wide",children:"Keep"}),(0,e.jsx)("div",{className:"flex flex-wrap gap-2",children:[...Fe,null].map(u=>{const _=b.maxFiles===u,T=u===null?"Tiered":`Last ${u}`;return(0,e.jsx)("button",{type:"button",disabled:l.isPending||c.isPending,className:J("rounded-lg border px-3 py-2 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-60",_?"border-ink bg-bg-3 text-ink":"border-line bg-bg hover:bg-bg-3/50"),onClick:s(()=>l.mutate({backupRetention:{...b,maxFiles:u}}),"onClick"),children:(0,e.jsx)("div",{className:"text-sm font-medium",children:T})},T)})})]}),b.maxFiles===null&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h3",{className:"text-xs font-medium text-ink-3 uppercase tracking-wide",children:"Daily"}),(0,e.jsx)("div",{className:"flex flex-wrap gap-2",children:Je.map(u=>{const _=b.dailyDays===u;return(0,e.jsx)("button",{type:"button",disabled:l.isPending||c.isPending,className:J("rounded-lg border px-3 py-2 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-60",_?"border-ink bg-bg-3 text-ink":"border-line bg-bg hover:bg-bg-3/50"),onClick:s(()=>l.mutate({backupRetention:{...b,dailyDays:u}}),"onClick"),children:(0,e.jsxs)("div",{className:"text-sm font-medium",children:[u," days"]})},u)})})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h3",{className:"text-xs font-medium text-ink-3 uppercase tracking-wide",children:"Weekly"}),(0,e.jsx)("div",{className:"flex flex-wrap gap-2",children:Ge.map(u=>{const _=b.weeklyWeeks===u,T=u===1?"1 week":`${u} weeks`;return(0,e.jsx)("button",{type:"button",disabled:l.isPending||c.isPending,className:J("rounded-lg border px-3 py-2 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-60",_?"border-ink bg-bg-3 text-ink":"border-line bg-bg hover:bg-bg-3/50"),onClick:s(()=>l.mutate({backupRetention:{...b,weeklyWeeks:u}}),"onClick"),children:(0,e.jsx)("div",{className:"text-sm font-medium",children:T})},u)})})]}),(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h3",{className:"text-xs font-medium text-ink-3 uppercase tracking-wide",children:"Monthly"}),(0,e.jsx)("div",{className:"flex flex-wrap gap-2",children:Be.map(u=>{const _=b.monthlyMonths===u,T=u===1?"1 month":`${u} months`;return(0,e.jsx)("button",{type:"button",disabled:l.isPending||c.isPending,className:J("rounded-lg border px-3 py-2 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-60",_?"border-ink bg-bg-3 text-ink":"border-line bg-bg hover:bg-bg-3/50"),onClick:s(()=>l.mutate({backupRetention:{...b,monthlyMonths:u}}),"onClick"),children:(0,e.jsx)("div",{className:"text-sm font-medium",children:T})},u)})})]})]})]})}),k&&(0,e.jsx)(as,{value:P,disabled:l.isPending||c.isPending,onSave:s(u=>l.mutate({speechToText:u}),"onSave")},JSON.stringify(P)),(0,e.jsx)(is,{value:O,disabled:c.isPending},JSON.stringify(O)),(0,e.jsx)(Ba,{attachmentMaxMegabytes:d.data?.attachmentMaxMegabytes??null,attachmentRetention:d.data?.attachmentRetention??qe,effectiveLimit:x.data?.attachmentLimit}),v&&(0,e.jsx)("section",{children:(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"AI feedback sharing"}),(0,e.jsx)("p",{className:"max-w-2xl text-sm text-ink-3",children:"Control whether thumbs up and thumbs down votes can send the voted AI output to this instance's feedback export. Votes are always saved locally."}),null]}),S==="prompt"?(0,e.jsx)("div",{className:"rounded-lg bg-bg-3/20 px-3 py-2 text-sm text-ink-3",children:"No default is saved yet. The next thumbs up or thumbs down choice will ask once and then save the answer here."}):null,(0,e.jsx)("div",{className:"flex flex-wrap gap-2",children:[{value:"allowed",label:"Always allow",description:"Share voted AI outputs automatically."},{value:"not_allowed",label:"Don't allow",description:"Keep voted AI outputs local only."}].map(u=>{const _=S===u.value;return(0,e.jsxs)("button",{type:"button",disabled:l.isPending||c.isPending,className:J("rounded-lg border px-3 py-2 text-left transition-colors disabled:cursor-not-allowed disabled:opacity-60",_?"border-ink bg-bg-3 text-ink":"border-line bg-bg hover:bg-bg-3/50"),onClick:s(()=>l.mutate({feedbackDataSharingPreference:u.value}),"onClick"),children:[(0,e.jsx)("div",{className:"text-sm font-medium",children:u.label}),(0,e.jsx)("div",{className:"text-xs text-ink-3",children:u.description})]},u.value)})}),(0,e.jsxs)("p",{className:"text-xs text-ink-3",children:["To retest the first-use prompt in local dev, remove the"," ",(0,e.jsx)("code",{children:"feedbackDataSharingPreference"})," key from the"," ",(0,e.jsx)("code",{children:"instance_settings.general"})," JSON row for this instance, or set it back to"," ",(0,e.jsx)("code",{children:'"prompt"'}),". Unset and ",(0,e.jsx)("code",{children:'"prompt"'})," both mean no default has been chosen yet."]})]})}),m&&(0,e.jsx)("section",{children:(0,e.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,e.jsxs)("div",{className:"space-y-1.5",children:[(0,e.jsx)("h2",{className:"text-sm font-semibold",children:"Sign out"}),(0,e.jsx)("p",{className:"max-w-2xl text-sm text-ink-3",children:"Sign out of this Wardmote instance. You will be redirected to the login page."})]}),(0,e.jsxs)(N,{variant:"secondary",size:"sm",disabled:c.isPending||l.isPending,onClick:s(()=>{n(null),c.mutate()},"onClick"),children:[(0,e.jsx)(Ca,{className:"size-4"}),c.isPending?"Signing out...":"Sign out"]})]})})]})}s(rs,"InstanceGeneralSettings");function pe({label:a,value:t}){return(0,e.jsxs)("div",{className:"space-y-1",children:[(0,e.jsx)("div",{className:"text-xs font-medium uppercase tracking-wide text-ink-3",children:a}),(0,e.jsx)("div",{className:"text-sm font-medium",children:t})]})}s(pe,"StatusBox");function Ds(){const{companies:a,selectedCompany:t,selectedCompanyId:r,setSelectedCompanyId:o}=Ze(),{setBreadcrumbs:n}=Ae(),c=Q(),d=Xe(),x=pa(),l=Ta(),[y,S]=(0,j.useState)(""),[b,g]=(0,j.useState)(""),[E,C]=(0,j.useState)(""),[h,v]=(0,j.useState)(null),[k,P]=(0,j.useState)({});(0,j.useEffect)(()=>{t&&(S(t.name),g(t.description??""),C(t.logoUrl??""),P(t.interactionResolverGovernance??{}))},[t]);const m=!!t&&(y!==t.name||b!==(t.description??"")),p=A({mutationFn:s(f=>H.update(r,f),"mutationFn"),onSuccess:s(()=>{c.invalidateQueries({queryKey:w.companies.all})},"onSuccess")}),B=A({mutationFn:s(f=>H.update(r,{requireBoardApprovalForNewAgents:f}),"mutationFn"),onSuccess:s(()=>{c.invalidateQueries({queryKey:w.companies.all})},"onSuccess")}),O=A({mutationFn:s(f=>H.update(r,{interactionResolverGovernance:f}),"mutationFn"),onSuccess:s(f=>{P(f.interactionResolverGovernance??{}),c.invalidateQueries({queryKey:w.companies.all})},"onSuccess")});function R(f,I,W){const q=Fa(k,f,I,W);P(q),O.mutate(q)}s(R,"handleGovernanceChange");const z=s(f=>{C(f??""),c.invalidateQueries({queryKey:w.companies.all})},"syncLogoState"),M=A({mutationFn:s(f=>va.uploadCompanyLogo(r,f).then(I=>H.update(r,{logoAssetId:I.assetId})),"mutationFn"),onSuccess:s(f=>{z(f.logoUrl),v(null)},"onSuccess")}),u=A({mutationFn:s(()=>H.update(r,{logoAssetId:null}),"mutationFn"),onSuccess:s(f=>{v(null),z(f.logoUrl)},"onSuccess")});function _(f){const I=f.target.files?.[0]??null;f.currentTarget.value="",I&&(v(null),M.mutate(I))}s(_,"handleLogoFileChange");function T(){u.mutate()}s(T,"handleClearLogo");const G=A({mutationFn:s(({companyId:f})=>H.archive(f),"mutationFn"),onSuccess:s(async(f,{companyId:I})=>{const W=a.find(oe=>oe.id===I),q=W?.name??"Organization",F=wa({archivedCompanyId:I,companies:a});F.kind==="company"?(x?.pushToast({title:`${q} is archived`,body:`Switched to ${F.company.name}.`,tone:"info",dedupeKey:`company-archive-departure:${I}`}),o(F.company.id),d(`/${F.company.issuePrefix}/dashboard`,{replace:!0})):(x?.pushToast({title:`${q} is archived`,body:"You can unarchive it from this list.",tone:"info",dedupeKey:`company-archive-departure:${I}`}),d(`/${W?.issuePrefix??""}/companies`,{replace:!0})),await c.invalidateQueries({queryKey:w.companies.all}),await c.invalidateQueries({queryKey:w.companies.stats})},"onSuccess")});if((0,j.useEffect)(()=>{n([{label:t?.name??"Company",href:"/dashboard"},{label:"Settings"}])},[n,t?.name]),!t)return(0,e.jsx)("div",{className:"text-sm text-ink-3",children:"No organization selected. Select an organization from the switcher above."});function te(){p.mutate({name:y.trim(),description:b.trim()||null})}return s(te,"handleSaveGeneral"),(0,e.jsxs)("div",{className:"max-w-6xl space-y-8",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(_e,{className:"h-5 w-5 text-ink-3"}),(0,e.jsx)("h1",{className:"text-lg font-semibold",children:"General"})]}),(0,e.jsxs)("div",{className:"max-w-2xl space-y-4",children:[(0,e.jsx)("div",{className:"text-xs font-medium text-ink-3 uppercase tracking-wide",children:"General"}),(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsx)(de,{label:"Organization name",hint:"The display name for your organization.",children:(0,e.jsx)("input",{className:"w-full rounded-md border border-line bg-transparent px-2.5 py-1.5 text-sm outline-none",type:"text",value:y,onChange:s(f=>S(f.target.value),"onChange")})}),(0,e.jsx)(de,{label:"Description",hint:"Optional description shown in the organization profile.",children:(0,e.jsx)("input",{className:"w-full rounded-md border border-line bg-transparent px-2.5 py-1.5 text-sm outline-none",type:"text",value:b,placeholder:"Optional organization description",onChange:s(f=>g(f.target.value),"onChange")})})]})]}),(0,e.jsxs)("div",{className:"max-w-2xl space-y-4",children:[(0,e.jsx)("div",{className:"text-xs font-medium text-ink-3 uppercase tracking-wide",children:"Appearance"}),(0,e.jsx)("div",{className:"space-y-3",children:(0,e.jsxs)("div",{className:"flex items-start gap-4",children:[(0,e.jsx)("div",{className:"shrink-0",children:(0,e.jsx)(Sa,{companyName:y||t.name,logoUrl:E||null,className:"rounded-(--rad-14)"})}),(0,e.jsx)("div",{className:"flex-1 space-y-3",children:(0,e.jsx)(de,{label:"Logo",hint:"Upload a PNG, JPEG, WEBP, GIF, or SVG logo image.",children:(0,e.jsxs)("div",{className:"space-y-2",children:[(0,e.jsx)("input",{type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/svg+xml",onChange:_,className:"w-full rounded-md border border-line bg-transparent px-2.5 py-1.5 text-sm outline-none file:mr-4 file:rounded-md file:border-0 file:bg-bg-3 file:px-2.5 file:py-1 file:text-xs"}),E&&(0,e.jsx)("div",{className:"flex items-center gap-2",children:(0,e.jsx)(N,{size:"sm",variant:"secondary",onClick:T,disabled:u.isPending,children:u.isPending?"Removing...":"Remove logo"})}),(M.isError||h)&&(0,e.jsx)("span",{className:"text-xs text-bad",children:h??(M.error instanceof Error?M.error.message:"Logo upload failed")}),u.isError&&(0,e.jsx)("span",{className:"text-xs text-bad",children:u.error.message}),M.isPending&&(0,e.jsx)("span",{className:"text-xs text-ink-3",children:"Uploading logo..."})]})})})]})})]}),m&&(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(N,{size:"sm",onClick:te,disabled:p.isPending||!y.trim(),children:p.isPending?"Saving...":"Save changes"}),p.isSuccess&&(0,e.jsx)("span",{className:"text-xs text-ink-3",children:"Saved"}),p.isError&&(0,e.jsx)("span",{className:"text-xs text-bad",children:p.error instanceof Error?p.error.message:"Failed to save"})]}),(0,e.jsxs)("div",{className:"max-w-2xl space-y-4","data-testid":"company-settings-team-section",children:[(0,e.jsx)("div",{className:"text-xs font-medium text-ink-3 uppercase tracking-wide",children:"Hiring"}),(0,e.jsx)("div",{children:(0,e.jsx)(ka,{label:"Require board approval for new hires",hint:"New agent hires stay pending until approved by board.",checked:!!t.requireBoardApprovalForNewAgents,onChange:s(f=>B.mutate(f),"onChange"),toggleTestId:"company-settings-team-approval-toggle"})})]}),(0,e.jsx)(Ka,{governance:k,onChange:R,isPending:O.isPending,errorMessage:O.isError?O.error instanceof Error?O.error.message:"Failed to save interaction governance":null}),l.loaded&&!l.enabled&&(0,e.jsx)(Aa,{companyId:r},r),(0,e.jsx)(rs,{embedded:!0}),(0,e.jsxs)("div",{className:"space-y-4",children:[(0,e.jsx)("div",{className:"text-xs font-medium text-bad uppercase tracking-wide",children:"Danger Zone"}),(0,e.jsxs)("div",{className:"space-y-3 bg-bad/5 px-4 py-4",children:[(0,e.jsx)("p",{className:"text-sm text-ink-3",children:"Archive this organization to hide it from the sidebar. This persists in the database."}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(N,{size:"sm",variant:"danger",disabled:G.isPending||t.status==="archived",onClick:s(()=>{r&&window.confirm(`Archive organization "${t.name}"? It will be hidden from the sidebar.`)&&G.mutate({companyId:r})},"onClick"),children:G.isPending?"Archiving...":t.status==="archived"?"Already archived":"Archive organization"}),G.isError&&(0,e.jsx)("span",{className:"text-xs text-bad",children:G.error instanceof Error?G.error.message:"Failed to archive organization"})]})]})]})]})}s(Ds,"CompanySettings");export{Ds as CompanySettings};
|
package/dist/assets/{CompanySettingsPluginPage-59_bMQQ3.js → CompanySettingsPluginPage-cVvXh0_G.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
var v=Object.defineProperty;var c=(t,s)=>v(t,"name",{value:s,configurable:!0});import{i as f}from"./rolldown-runtime-ZpX3ckPj.js";import{na as j,ta as _}from"./createLucideIcon-DJi9suAC.js";import{v as C}from"./star-BZgQbzhV.js";import{n as S}from"./CompanyContext-CSrVsSze.js";import"./router-2UfGeejU.js";import{o as N,t as M}from"./slots-Dw517dxP.js";import{n as B}from"./BreadcrumbContext-BVZDZoC0.js";import{Lt as x}from"./index-
|
|
1
|
+
var v=Object.defineProperty;var c=(t,s)=>v(t,"name",{value:s,configurable:!0});import{i as f}from"./rolldown-runtime-ZpX3ckPj.js";import{na as j,ta as _}from"./createLucideIcon-DJi9suAC.js";import{v as C}from"./star-BZgQbzhV.js";import{n as S}from"./CompanyContext-CSrVsSze.js";import"./router-2UfGeejU.js";import{o as N,t as M}from"./slots-Dw517dxP.js";import{n as B}from"./BreadcrumbContext-BVZDZoC0.js";import{Lt as x}from"./index-3AxqhPET.js";var l=f(j(),1),e=f(_(),1);function F(){const{companyPrefix:t,settingsRoutePath:s}=C(),{companies:a,selectedCompanyId:g}=S(),{setBreadcrumbs:m}=B(),u=(0,l.useMemo)(()=>{if(!t)return null;const o=t.toUpperCase();return a.find(P=>P.issuePrefix.toUpperCase()===o)??null},[a,t]),b=!!t&&!u,r=u?.id??(t?null:g??null),y=r?a.find(o=>o.id===r)?.issuePrefix??null:null,{slots:d,isLoading:h,errorMessage:p}=N({slotTypes:["companySettingsPage"],companyId:r,enabled:!!(r&&s)}),i=(0,l.useMemo)(()=>s?d.filter(o=>o.routePath===s):[],[s,d]),n=i.length===1?i[0]:null;return(0,l.useEffect)(()=>{n&&m([{label:"Settings",href:"/company/settings"},{label:n.displayName}])},[n,m]),r?!s||h?(0,e.jsx)("div",{className:"text-sm text-ink-3",children:"Loading..."}):p?(0,e.jsxs)("div",{className:"rounded-md border border-bad/30 bg-bad/5 px-3 py-2 text-sm text-bad",children:["Plugin extensions unavailable: ",p]}):i.length>1?(0,e.jsxs)("div",{className:"rounded-md border border-bad/30 bg-bad/5 px-3 py-2 text-sm text-bad",children:["Multiple plugins declare the company settings route ",(0,e.jsx)("code",{children:s}),". Disable one plugin or change its route."]}):n?(0,e.jsx)("div",{className:"max-w-6xl",children:(0,e.jsx)(M,{slot:n,context:{companyId:r,companyPrefix:y},className:"min-h-(--sz-200px)",missingBehavior:"placeholder"})}):(0,e.jsx)(x,{scope:"board"}):b?(0,e.jsx)(x,{scope:"invalid_company_prefix",requestedPrefix:t}):(0,e.jsx)("div",{className:"text-sm text-ink-3",children:"Select an organization to view this page."})}c(F,"CompanySettingsPluginPage");export{F as CompanySettingsPluginPage};
|