@xopcai/xopc 0.0.22 → 0.0.24

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.
Files changed (128) hide show
  1. package/dist/extensions/telegram/xopc.extension.json +1 -1
  2. package/dist/gateway/static/root/assets/agents-CiZMJZRp.js +216 -0
  3. package/dist/gateway/static/root/assets/agents-CiZMJZRp.js.map +1 -0
  4. package/dist/gateway/static/root/assets/apps-page-tZz69XM3.js +2 -0
  5. package/dist/gateway/static/root/assets/apps-page-tZz69XM3.js.map +1 -0
  6. package/dist/gateway/static/root/assets/{attachment-preview-renderer-CebH7fCz.js → attachment-preview-renderer-CxMJMbD2.js} +4 -4
  7. package/dist/gateway/static/root/assets/{attachment-preview-renderer-CebH7fCz.js.map → attachment-preview-renderer-CxMJMbD2.js.map} +1 -1
  8. package/dist/gateway/static/root/assets/{attachment-process-heavy-Dbf1--O6.js → attachment-process-heavy-EFXPGfWk.js} +6 -6
  9. package/dist/gateway/static/root/assets/{attachment-process-heavy-Dbf1--O6.js.map → attachment-process-heavy-EFXPGfWk.js.map} +1 -1
  10. package/dist/gateway/static/root/assets/{attachment-utils-core-Dt6UxMPV.js → attachment-utils-core-ECbeoa9H.js} +1 -1
  11. package/dist/gateway/static/root/assets/attachment-utils-core-ECbeoa9H.js.map +1 -0
  12. package/dist/gateway/static/root/assets/channels-settings-BAvk9-aK.js +9 -0
  13. package/dist/gateway/static/root/assets/{channels-settings-BGueHxMv.js.map → channels-settings-BAvk9-aK.js.map} +1 -1
  14. package/dist/gateway/static/root/assets/cn-BMCV0OMB.js +2 -0
  15. package/dist/gateway/static/root/assets/cn-BMCV0OMB.js.map +1 -0
  16. package/dist/gateway/static/root/assets/cron-page-CANqvhK7.js +2 -0
  17. package/dist/gateway/static/root/assets/{cron-page-DsVZzPqv.js.map → cron-page-CANqvhK7.js.map} +1 -1
  18. package/dist/gateway/static/root/assets/cron-utils-DyOO6TdN.js +3 -0
  19. package/dist/gateway/static/root/assets/{cron-utils-zbRs2yND.js.map → cron-utils-DyOO6TdN.js.map} +1 -1
  20. package/dist/gateway/static/root/assets/dist-Brod9LF3.js +2 -0
  21. package/dist/gateway/static/root/assets/{dist-CDA7gR_M.js.map → dist-Brod9LF3.js.map} +1 -1
  22. package/dist/gateway/static/root/assets/{docx-preview-DxcHM3sR.js → docx-preview-F-jKDMNv.js} +2 -2
  23. package/dist/gateway/static/root/assets/{docx-preview-DxcHM3sR.js.map → docx-preview-F-jKDMNv.js.map} +1 -1
  24. package/dist/gateway/static/root/assets/{excel-worksheet-utils-Dk66snKA.js → excel-worksheet-utils-DPfAinZn.js} +1 -1
  25. package/dist/gateway/static/root/assets/{excel-worksheet-utils-Dk66snKA.js.map → excel-worksheet-utils-DPfAinZn.js.map} +1 -1
  26. package/dist/gateway/static/root/assets/extension-debug-page-CDD7ozsC.js +2 -0
  27. package/dist/gateway/static/root/assets/{extension-debug-page-CDLp4DAs.js.map → extension-debug-page-CDD7ozsC.js.map} +1 -1
  28. package/dist/gateway/static/root/assets/extension-page-UUFMjoWf.js +2 -0
  29. package/dist/gateway/static/root/assets/{extension-page-DwSCjzHO.js.map → extension-page-UUFMjoWf.js.map} +1 -1
  30. package/dist/gateway/static/root/assets/extension-settings-page-CP9JNc4m.js +2 -0
  31. package/dist/gateway/static/root/assets/extension-settings-page-CP9JNc4m.js.map +1 -0
  32. package/dist/gateway/static/root/assets/index-BZvlG48D.js +150 -0
  33. package/dist/gateway/static/root/assets/index-BZvlG48D.js.map +1 -0
  34. package/dist/gateway/static/root/assets/index-DxkgyT8R.css +1 -0
  35. package/dist/gateway/static/root/assets/{jszip.min-DVUfmhpE.js → jszip.min-CL3dfyxs.js} +1 -1
  36. package/dist/gateway/static/root/assets/{jszip.min-DVUfmhpE.js.map → jszip.min-CL3dfyxs.js.map} +1 -1
  37. package/dist/gateway/static/root/assets/logs-page-Cr0eCGb4.js +2 -0
  38. package/dist/gateway/static/root/assets/{logs-page-ChJ0nsPh.js.map → logs-page-Cr0eCGb4.js.map} +1 -1
  39. package/dist/gateway/static/root/assets/{pdf--jE7rvON.js → pdf-CX6ji-QC.js} +1 -1
  40. package/dist/gateway/static/root/assets/{pdf--jE7rvON.js.map → pdf-CX6ji-QC.js.map} +1 -1
  41. package/dist/gateway/static/root/assets/sessions-page-DwLHN5GJ.js +2 -0
  42. package/dist/gateway/static/root/assets/{sessions-page-Cle4fPla.js.map → sessions-page-DwLHN5GJ.js.map} +1 -1
  43. package/dist/gateway/static/root/assets/settings-page-B3O3R0E4.js +2 -0
  44. package/dist/gateway/static/root/assets/settings-page-B3O3R0E4.js.map +1 -0
  45. package/dist/gateway/static/root/assets/skills-page-DgBYvH6B.js +3 -0
  46. package/dist/gateway/static/root/assets/{skills-page-B-smhcB2.js.map → skills-page-DgBYvH6B.js.map} +1 -1
  47. package/dist/gateway/static/root/assets/vendor-swr-B5fPo7KK.js +2 -0
  48. package/dist/gateway/static/root/assets/{vendor-swr-Dp4nzp5h.js.map → vendor-swr-B5fPo7KK.js.map} +1 -1
  49. package/dist/gateway/static/root/assets/{xlsx-DVk38js7.js → xlsx-CPtvfmVF.js} +1 -1
  50. package/dist/gateway/static/root/assets/{xlsx-DVk38js7.js.map → xlsx-CPtvfmVF.js.map} +1 -1
  51. package/dist/gateway/static/root/index.html +5 -4
  52. package/dist/package.js +1 -1
  53. package/dist/src/agent/image/tool-model-config.js +2 -2
  54. package/dist/src/agent/image/tool-model-config.js.map +1 -1
  55. package/dist/src/agent/tools/execute-code-tool.js +1 -1
  56. package/dist/src/agent/tools/execute-code-tool.js.map +1 -1
  57. package/dist/src/cli/commands/extension-dev.d.ts +2 -0
  58. package/dist/src/cli/commands/extension-dev.js +196 -0
  59. package/dist/src/cli/commands/extension-dev.js.map +1 -0
  60. package/dist/src/cli/commands/extension-marketplace.d.ts +4 -0
  61. package/dist/src/cli/commands/extension-marketplace.js +145 -0
  62. package/dist/src/cli/commands/extension-marketplace.js.map +1 -0
  63. package/dist/src/cli/commands/extension-pack.d.ts +2 -0
  64. package/dist/src/cli/commands/extension-pack.js +242 -0
  65. package/dist/src/cli/commands/extension-pack.js.map +1 -0
  66. package/dist/src/cli/commands/extension.js +13 -0
  67. package/dist/src/cli/commands/extension.js.map +1 -1
  68. package/dist/src/cli/index.js +5 -1
  69. package/dist/src/cli/index.js.map +1 -1
  70. package/dist/src/config/schema.js +1 -1
  71. package/dist/src/config/schema.js.map +1 -1
  72. package/dist/src/extensions/api.d.ts +6 -1
  73. package/dist/src/extensions/api.js +30 -0
  74. package/dist/src/extensions/api.js.map +1 -1
  75. package/dist/src/extensions/engine-check.d.ts +14 -0
  76. package/dist/src/extensions/engine-check.js +148 -0
  77. package/dist/src/extensions/engine-check.js.map +1 -0
  78. package/dist/src/extensions/loader.js +23 -0
  79. package/dist/src/extensions/loader.js.map +1 -1
  80. package/dist/src/extensions/marketplace.d.ts +24 -0
  81. package/dist/src/extensions/marketplace.js +98 -0
  82. package/dist/src/extensions/marketplace.js.map +1 -0
  83. package/dist/src/extensions/normalize-manifest.js +16 -4
  84. package/dist/src/extensions/normalize-manifest.js.map +1 -1
  85. package/dist/src/extensions/sdk/index.d.ts +2 -0
  86. package/dist/src/extensions/sdk/index.js +2 -1
  87. package/dist/src/extensions/sdk/index.js.map +1 -1
  88. package/dist/src/extensions/sdk/testing.d.ts +49 -3
  89. package/dist/src/extensions/sdk/testing.js +174 -5
  90. package/dist/src/extensions/sdk/testing.js.map +1 -1
  91. package/dist/src/extensions/types/core.d.ts +5 -0
  92. package/dist/src/extensions/types/manifest.d.ts +17 -0
  93. package/dist/src/extensions/when-context.d.ts +6 -0
  94. package/dist/src/extensions/when-context.js +28 -0
  95. package/dist/src/extensions/when-context.js.map +1 -0
  96. package/dist/src/extensions/when-expression.d.ts +11 -0
  97. package/dist/src/extensions/when-expression.js +215 -0
  98. package/dist/src/extensions/when-expression.js.map +1 -0
  99. package/dist/src/gateway/hono/app.js +1 -1
  100. package/dist/src/gateway/hono/app.js.map +1 -1
  101. package/dist/src/gateway/hono/routes/auth-registry-extensions.js +28 -0
  102. package/dist/src/gateway/hono/routes/auth-registry-extensions.js.map +1 -1
  103. package/dist/src/providers/index.d.ts +6 -3
  104. package/dist/src/providers/index.js +12 -23
  105. package/dist/src/providers/index.js.map +1 -1
  106. package/package.json +2 -1
  107. package/dist/gateway/static/root/assets/agents-BcLv59-r.js +0 -71
  108. package/dist/gateway/static/root/assets/agents-BcLv59-r.js.map +0 -1
  109. package/dist/gateway/static/root/assets/apps-page-Bl-yxbQo.js +0 -2
  110. package/dist/gateway/static/root/assets/apps-page-Bl-yxbQo.js.map +0 -1
  111. package/dist/gateway/static/root/assets/attachment-utils-core-Dt6UxMPV.js.map +0 -1
  112. package/dist/gateway/static/root/assets/channels-settings-BGueHxMv.js +0 -9
  113. package/dist/gateway/static/root/assets/cron-page-DsVZzPqv.js +0 -2
  114. package/dist/gateway/static/root/assets/cron-utils-zbRs2yND.js +0 -3
  115. package/dist/gateway/static/root/assets/dist-CDA7gR_M.js +0 -2
  116. package/dist/gateway/static/root/assets/extension-debug-page-CDLp4DAs.js +0 -2
  117. package/dist/gateway/static/root/assets/extension-page-DwSCjzHO.js +0 -2
  118. package/dist/gateway/static/root/assets/extension-settings-page-Rdmxe24_.js +0 -2
  119. package/dist/gateway/static/root/assets/extension-settings-page-Rdmxe24_.js.map +0 -1
  120. package/dist/gateway/static/root/assets/index-D9Wmfh2f.css +0 -1
  121. package/dist/gateway/static/root/assets/index-DG8WvMbu.js +0 -150
  122. package/dist/gateway/static/root/assets/index-DG8WvMbu.js.map +0 -1
  123. package/dist/gateway/static/root/assets/logs-page-ChJ0nsPh.js +0 -2
  124. package/dist/gateway/static/root/assets/sessions-page-Cle4fPla.js +0 -2
  125. package/dist/gateway/static/root/assets/settings-page-Dyo2NYdy.js +0 -2
  126. package/dist/gateway/static/root/assets/settings-page-Dyo2NYdy.js.map +0 -1
  127. package/dist/gateway/static/root/assets/skills-page-B-smhcB2.js +0 -3
  128. package/dist/gateway/static/root/assets/vendor-swr-Dp4nzp5h.js +0 -2
@@ -0,0 +1,9 @@
1
+ import{i as e,t}from"./rolldown-runtime-DWdDZTNf.js";import{i as n,t as r}from"./vendor-react-DbimaAId.js";import{i}from"./vendor-swr-B5fPo7KK.js";import{t as a}from"./cn-BMCV0OMB.js";import{A as o,Gt as s,Hn as c,Jt as l,Mr as u,Nr as d,On as f,Qt as p,Ut as m,_n as h,an as g,at as _,ct as v,dn as y,dt as b,fr as x,hr as S,in as C,k as w,l as ee,lt as te,mr as ne,nn as T,on as re,ot as ie,pr as ae,qt as oe,sn as E,st as se,ut as ce,yr as le,zn as D}from"./index-BZvlG48D.js";import{a as ue,i as O,n as de,r as fe,t as pe}from"./dist-Brod9LF3.js";var k=e(n(),1);function A(e){return(e??``).trim().toLowerCase()}function me(e){let t=e.match;return!(!t?.channel||!t.accountId||t.peerId||t.peerKind||t.guildId||t.teamId||t.memberRoleIds&&t.memberRoleIds.length>0)}function he(e){let t=Object.keys(e.accounts??{});return t.length>0?[...t].sort():typeof e.botToken==`string`&&e.botToken.trim()?[`default`]:[]}function j(e){return Object.keys(e.accounts??{}).sort()}function ge(e){let t=Object.keys(e.accounts??{});return t.length>0?[...t].sort():typeof e.appId==`string`&&e.appId.trim()&&typeof e.appSecret==`string`&&e.appSecret.trim()?[`default`]:[]}function M(e,t,n,r,i){let a={},o={},s={};for(let n of t)a[n]=(e.find(e=>A(e.match?.channel)===`telegram`&&A(e.match?.accountId)===A(n)&&me(e))?.agentId??i).trim().toLowerCase();for(let t of n)o[t]=(e.find(e=>A(e.match?.channel)===`weixin`&&A(e.match?.accountId)===A(t)&&me(e))?.agentId??i).trim().toLowerCase();for(let t of r)s[t]=(e.find(e=>A(e.match?.channel)===`feishu`&&A(e.match?.accountId)===A(t)&&me(e))?.agentId??i).trim().toLowerCase();return{telegram:a,weixin:o,feishu:s}}function N(e,t,n,r,i,a){let o=new Set(n.map(A)),s=new Set(r.map(A)),c=new Set(i.map(A)),l=e.filter(e=>{if(e.id?.startsWith(`ui:route:account:`))return!1;if(!me(e))return!0;let t=A(e.match.channel),n=A(e.match.accountId);return!n||n===`*`?!0:!(t===`telegram`&&o.has(n)||t===`weixin`&&s.has(n)||t===`feishu`&&c.has(n))}),u=[];for(let e of n){let n=(t.telegram[e]??t.telegram[A(e)]??a).trim().toLowerCase();u.push({id:`ui:route:account:telegram:${e}`,agentId:n,priority:45,enabled:!0,match:{channel:`telegram`,accountId:e}})}for(let e of r){let n=(t.weixin[e]??t.weixin[A(e)]??a).trim().toLowerCase();u.push({id:`ui:route:account:weixin:${e}`,agentId:n,priority:45,enabled:!0,match:{channel:`weixin`,accountId:e}})}for(let e of i){let n=(t.feishu[e]??t.feishu[A(e)]??a).trim().toLowerCase();u.push({id:`ui:route:account:feishu:${e}`,agentId:n,priority:45,enabled:!0,match:{channel:`feishu`,accountId:e}})}return[...l,...u]}function _e(){return{bindingsFull:[],channelAgentRoutes:{telegram:{},weixin:{},feishu:{}},defaultAgentId:`main`,telegram:{enabled:!1,botToken:``,apiRoot:``,debug:!1,allowFrom:[],groupAllowFrom:[],dmPolicy:`pairing`,groupPolicy:`open`,replyToMode:`off`,streamMode:`partial`,historyLimit:50,textChunkLimit:4e3,proxy:``,accounts:{}},weixin:{enabled:!1,dmPolicy:`pairing`,allowFrom:[],debug:!1,streamMode:`partial`,historyLimit:50,textChunkLimit:4e3,routeTag:``,accounts:{}},feishu:{enabled:!1,defaultAccount:``,appId:``,appSecret:``,domain:`feishu`,connectionMode:`websocket`,verificationToken:``,encryptKey:``,webhookHost:`127.0.0.1`,webhookPort:3e3,webhookPath:`/feishu/events`,dmPolicy:`pairing`,groupPolicy:`allowlist`,allowFrom:[],groupAllowFrom:[],requireMention:!0,historyLimit:50,textChunkLimit:4e3,renderMode:`auto`,streaming:!1,reactionNotifications:`own`,tools:{doc:!0,wiki:!0,drive:!0,scopes:!0,bitable:!0,perm:!1},actions:{reactions:!0},accounts:{}}}}function ve(e){let t=e&&typeof e==`object`?e.channels:void 0,n=t&&typeof t==`object`?t:{},r=n.telegram,i=n.weixin,a=n.feishu,o=r?.accounts,s=o&&typeof o==`object`&&!Array.isArray(o)?o:{},c=i?.accounts,l=c&&typeof c==`object`&&!Array.isArray(c)?c:{},u=(()=>{let t=(e&&typeof e==`object`?e:{}).bindings;return Array.isArray(t)?t:[]})(),d=(()=>{let t=(e&&typeof e==`object`?e:{}).agents;return t&&typeof t==`object`?t:{}})(),f=typeof d.defaultId==`string`&&d.defaultId.trim()?d.defaultId.trim().toLowerCase():`main`,p={telegram:{enabled:!!r?.enabled,botToken:typeof r?.botToken==`string`?r.botToken:``,apiRoot:typeof r?.apiRoot==`string`?r.apiRoot:``,debug:!!r?.debug,allowFrom:Array.isArray(r?.allowFrom)?[...r.allowFrom]:[],groupAllowFrom:Array.isArray(r?.groupAllowFrom)?[...r.groupAllowFrom]:[],dmPolicy:r?.dmPolicy||`pairing`,groupPolicy:r?.groupPolicy||`open`,replyToMode:r?.replyToMode||`off`,streamMode:r?.streamMode??`partial`,historyLimit:typeof r?.historyLimit==`number`?r.historyLimit:50,textChunkLimit:typeof r?.textChunkLimit==`number`?r.textChunkLimit:4e3,proxy:typeof r?.proxy==`string`?r.proxy:``,accounts:{...s}},weixin:{enabled:!!i?.enabled,dmPolicy:i?.dmPolicy||`pairing`,allowFrom:Array.isArray(i?.allowFrom)?[...i.allowFrom]:[],debug:!!i?.debug,streamMode:i?.streamMode??`partial`,historyLimit:typeof i?.historyLimit==`number`?i.historyLimit:50,textChunkLimit:typeof i?.textChunkLimit==`number`?i.textChunkLimit:4e3,routeTag:i?.routeTag==null?``:String(i.routeTag),accounts:{...l}},feishu:{enabled:!!a?.enabled,defaultAccount:typeof a?.defaultAccount==`string`?a.defaultAccount:``,appId:typeof a?.appId==`string`?a.appId:``,appSecret:typeof a?.appSecret==`string`?a.appSecret:``,domain:typeof a?.domain==`string`&&a.domain||`feishu`,connectionMode:a?.connectionMode||`websocket`,verificationToken:typeof a?.verificationToken==`string`?a.verificationToken:``,encryptKey:typeof a?.encryptKey==`string`?a.encryptKey:``,webhookHost:typeof a?.webhookHost==`string`?a.webhookHost:`127.0.0.1`,webhookPort:typeof a?.webhookPort==`number`?a.webhookPort:3e3,webhookPath:typeof a?.webhookPath==`string`?a.webhookPath:`/feishu/events`,dmPolicy:a?.dmPolicy||`pairing`,groupPolicy:a?.groupPolicy||`allowlist`,allowFrom:Array.isArray(a?.allowFrom)?[...a.allowFrom]:[],groupAllowFrom:Array.isArray(a?.groupAllowFrom)?[...a.groupAllowFrom]:[],requireMention:a?.requireMention===void 0?!0:!!a.requireMention,historyLimit:typeof a?.historyLimit==`number`?a.historyLimit:50,textChunkLimit:typeof a?.textChunkLimit==`number`?a.textChunkLimit:4e3,renderMode:a?.renderMode||`auto`,streaming:a?.streaming===void 0?!1:!!a.streaming,reactionNotifications:a?.reactionNotifications||`own`,tools:a?.tools&&typeof a.tools==`object`&&!Array.isArray(a.tools)?{...a.tools}:void 0,actions:a?.actions&&typeof a.actions==`object`&&!Array.isArray(a.actions)?{...a.actions}:void 0,accounts:a?.accounts&&typeof a.accounts==`object`&&!Array.isArray(a.accounts)?{...a.accounts}:{}}},m=M(u,he(p.telegram),j(p.weixin),ge(p.feishu),f);return{...p,bindingsFull:u.map(e=>({...e})),channelAgentRoutes:m,defaultAgentId:f}}async function ye(e){return(await s(m(`/api/channels/weixin/login/start`),{method:`POST`,body:JSON.stringify(e??{})})).payload}async function be(e){return(await s(m(`/api/channels/weixin/login/${encodeURIComponent(e)}`))).payload.status}async function xe(e){let t=e.telegram,n=e.weixin,r=e.feishu,i=N(e.bindingsFull,e.channelAgentRoutes,he(t),j(n),ge(r),e.defaultAgentId),a=(()=>{let e=n.routeTag.trim();return e?/^\d+$/.test(e)?Number(e):e:null})(),o=(await s(m(`/api/config`),{method:`PATCH`,body:JSON.stringify({bindings:i,channels:{telegram:{enabled:t.enabled,botToken:t.botToken,apiRoot:t.apiRoot||void 0,debug:t.debug,allowFrom:t.allowFrom,groupAllowFrom:t.groupAllowFrom.length?t.groupAllowFrom:void 0,dmPolicy:t.dmPolicy,groupPolicy:t.groupPolicy,replyToMode:t.replyToMode,streamMode:t.streamMode,historyLimit:t.historyLimit,textChunkLimit:t.textChunkLimit,proxy:t.proxy||void 0,accounts:t.accounts},weixin:{enabled:n.enabled,dmPolicy:n.dmPolicy,allowFrom:n.allowFrom,debug:n.debug,streamMode:n.streamMode,historyLimit:n.historyLimit,textChunkLimit:n.textChunkLimit,routeTag:a,accounts:n.accounts},feishu:{enabled:r.enabled,defaultAccount:r.defaultAccount||void 0,appId:r.appId,appSecret:r.appSecret||void 0,domain:r.domain||void 0,connectionMode:r.connectionMode,verificationToken:r.verificationToken?.trim()?r.verificationToken:void 0,encryptKey:r.encryptKey?.trim()?r.encryptKey:void 0,webhookHost:r.webhookHost?.trim()?r.webhookHost:void 0,webhookPort:typeof r.webhookPort==`number`?r.webhookPort:void 0,webhookPath:r.webhookPath?.trim()?r.webhookPath:void 0,dmPolicy:r.dmPolicy,groupPolicy:r.groupPolicy,allowFrom:r.allowFrom,groupAllowFrom:r.groupAllowFrom.length?r.groupAllowFrom:void 0,requireMention:r.requireMention,historyLimit:r.historyLimit,textChunkLimit:r.textChunkLimit,renderMode:r.renderMode,streaming:r.streaming,reactionNotifications:r.reactionNotifications,tools:r.tools,actions:r.actions,accounts:r.accounts}}})})).payload?.config;return w(),o?ve(o):{...e,bindingsFull:i}}async function Se(e){return(await s(m(`/api/channels/feishu/setup/start`),{method:`POST`,body:JSON.stringify(e??{})})).payload}async function Ce(e){return(await s(m(`/api/channels/feishu/setup/${encodeURIComponent(e)}`))).payload.status}function we(){return a(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,g,`dark:border-edge`)}function Te(){return a(C,T)}function Ee(e){return e.split(/[,\n]/).map(e=>e.trim()).filter(Boolean).map(e=>/^-?\d+$/.test(e)?Number(e):e)}function De(e){return e.map(String).join(`, `)}function Oe(e){return!!e.botToken?.trim()||Object.keys(e.accounts??{}).length>0}function ke(e){return Object.keys(e.accounts??{}).length>0||e.allowFrom.length>0}function Ae(e){return!!(e.appId?.trim()&&e.appSecret?.trim())||Object.keys(e.accounts??{}).length>0}var P=r();function F({children:e}){return(0,P.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e})}function I({children:e}){return(0,P.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-subtle`,children:e})}function L({label:e,value:t,onChange:n,options:r}){return(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:e}),(0,P.jsx)(`select`,{className:Te(),value:t,onChange:e=>n(e.target.value),children:r.map(e=>(0,P.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})}function je({accountIds:e,routes:t,defaultAgentId:n,agentItems:r,disabled:i,onChange:o,ch:s}){if(e.length===0)return null;let c=r.length>0?r:[{id:n}];return(0,P.jsxs)(`div`,{className:`space-y-3 border-t border-edge-subtle pt-4 dark:border-edge`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(F,{children:s.agentRoutingTitle}),(0,P.jsx)(I,{children:s.agentRoutingHint})]}),(0,P.jsx)(`div`,{className:`space-y-2`,children:e.map(e=>(0,P.jsxs)(`div`,{className:`grid grid-cols-1 items-start gap-2 rounded-lg border border-edge-subtle bg-surface-base px-3 py-2.5 sm:grid-cols-2 sm:items-center dark:border-edge`,children:[(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:s.agentRoutingAccountLabel}),(0,P.jsx)(`p`,{className:`mt-0.5 truncate font-mono text-sm text-fg`,title:e,children:e})]}),(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsx)(`label`,{className:`sr-only`,htmlFor:`agent-route-${e}`,children:s.agentRoutingAgentLabel}),(0,P.jsx)(`select`,{id:`agent-route-${e}`,className:a(we(),T),disabled:i,value:(t[e]??n).toLowerCase(),onChange:t=>o(e,t.target.value),children:c.map(e=>(0,P.jsx)(`option`,{value:e.id,children:e.name?.trim()?`${e.name} (${e.id})`:e.id},e.id))})]})]},e))})]})}function Me({icon:e,title:t,subtitle:n,configured:r,enabled:i,onToggle:o,toggleDisabled:s,onConfigure:c,onEdit:l,onRemove:u,ch:d}){return(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 rounded-2xl border border-edge bg-surface-base px-4 py-4 dark:border-edge sm:flex-row sm:items-center sm:gap-4`,children:[(0,P.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-4`,children:[(0,P.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-surface-hover`,"aria-hidden":!0,children:e}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t}),r?(0,P.jsx)(`span`,{className:`inline-flex items-center rounded-full bg-success-soft px-2 py-0.5 text-xs font-medium text-success`,children:d.hubConnectedBadge}):null]}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:n})]})]}),r?(0,P.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 sm:gap-3`,children:[(0,P.jsxs)(O,{children:[(0,P.jsx)(ue,{asChild:!0,children:(0,P.jsx)(E,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":d.menuMoreAria,children:(0,P.jsx)(S,{className:`size-5 text-fg-muted`,strokeWidth:1.75})})}),(0,P.jsx)(fe,{children:(0,P.jsxs)(pe,{className:`z-[70] min-w-[11rem] rounded-xl border border-edge bg-surface-panel p-1 shadow-popover dark:border-edge`,sideOffset:6,align:`end`,children:[(0,P.jsx)(de,{className:`cursor-pointer rounded-lg px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover data-[highlighted]:bg-surface-hover`,onSelect:()=>l(),children:(0,P.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(D,{className:`size-4 shrink-0 text-fg-muted`,strokeWidth:1.75}),d.menuEditConfig]})}),(0,P.jsx)(de,{className:`cursor-pointer rounded-lg px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover data-[highlighted]:bg-surface-hover`,onSelect:()=>u(),children:(0,P.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,P.jsx)(h,{className:`size-4 shrink-0`,strokeWidth:1.75}),d.menuRemoveConfig]})})]})})]}),(0,P.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":i,"aria-label":`${t} — ${d.enableChannelAria}`,disabled:s,className:a(`inline-flex h-6 w-10 shrink-0 items-center rounded-full border border-edge p-0.5 transition-colors`,i?`justify-end bg-accent`:`justify-start bg-surface-hover`,s&&`cursor-not-allowed opacity-50`),onClick:()=>void o(!i),children:(0,P.jsx)(`span`,{className:`size-4 rounded-full bg-surface-panel shadow-surface ring-1 ring-edge/40 dark:ring-edge/55`})})]}):(0,P.jsx)(`div`,{className:`flex shrink-0 justify-end sm:justify-end`,children:(0,P.jsx)(E,{type:`button`,variant:`primary`,className:`shrink-0`,onClick:c,children:d.hubConfigureButton})})]})}function Ne({tg:e,updateTelegram:t,ch:n,dmOpts:r,groupOpts:i,replyOpts:o,streamOpts:s,tgAccountsDraft:c,setTgAccountsDraft:l,tgAccountsError:u,onTgAccountsBlur:d}){let f=we;return(0,P.jsxs)(`div`,{className:`space-y-4 border-t border-edge-subtle pt-4 dark:border-edge`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:n.apiRoot}),(0,P.jsx)(`input`,{className:f(),value:e.apiRoot,onChange:e=>t({apiRoot:e.target.value}),placeholder:`https://api.telegram.org`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:n.proxy}),(0,P.jsx)(`input`,{className:f(),value:e.proxy,onChange:e=>t({proxy:e.target.value}),placeholder:`http://proxy.example.com:8080`})]}),(0,P.jsx)(L,{label:n.dmPolicy,value:e.dmPolicy,onChange:e=>t({dmPolicy:e}),options:r}),(0,P.jsx)(L,{label:n.groupPolicy,value:e.groupPolicy,onChange:e=>t({groupPolicy:e}),options:i}),(0,P.jsx)(L,{label:n.replyToMode,value:e.replyToMode,onChange:e=>t({replyToMode:e}),options:o}),(0,P.jsx)(L,{label:n.streamMode,value:e.streamMode,onChange:e=>t({streamMode:e}),options:s}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:n.allowFromGroups}),(0,P.jsx)(`textarea`,{className:a(f(),`min-h-[2.75rem] resize-y font-mono text-xs`),rows:2,placeholder:`-1001234567890`,value:De(e.groupAllowFrom),onChange:e=>t({groupAllowFrom:Ee(e.target.value)})})]}),(0,P.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:n.historyLimit}),(0,P.jsx)(`input`,{type:`number`,min:10,max:200,className:f(),value:e.historyLimit,onChange:e=>t({historyLimit:parseInt(e.target.value,10)||50})})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:n.textChunkLimit}),(0,P.jsx)(`input`,{type:`number`,min:1e3,max:1e4,step:100,className:f(),value:e.textChunkLimit,onChange:e=>t({textChunkLimit:parseInt(e.target.value,10)||4e3})})]})]}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:e.debug,onChange:e=>t({debug:e.target.checked})}),n.telegramDebug]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:n.multiAccountJson}),(0,P.jsx)(`textarea`,{className:a(f(),`min-h-[140px] resize-y font-mono text-xs`),spellCheck:!1,value:c,onChange:e=>l(e.target.value),onBlur:d,placeholder:`{ "personal": { "accountId": "personal", "botToken": "...", ... } }`}),u?(0,P.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:u}):(0,P.jsx)(I,{children:n.multiAccountJsonDesc})]})]})}function Pe({wx:e,updateWeixin:t,ch:n,dmOpts:r,streamOpts:i,wxAccountsDraft:o,setWxAccountsDraft:s,wxAccountsError:c,onWxAccountsBlur:l,channelAgentRoutesWx:u,defaultAgentId:d,agentItems:f,onAgentRouteChange:p,routingDisabled:m}){let h=we;return(0,P.jsxs)(`div`,{className:`space-y-4 border-t border-edge-subtle pt-4 dark:border-edge`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:n.weixinAllowFrom}),(0,P.jsx)(`textarea`,{className:a(h(),`min-h-[2.75rem] resize-y font-mono text-xs`),rows:2,placeholder:`wxid_..., openid_...`,value:e.allowFrom.join(`, `),onChange:e=>t({allowFrom:e.target.value.split(/[,\n]/).map(e=>e.trim()).filter(Boolean)})}),(0,P.jsx)(I,{children:n.weixinAllowFromDesc})]}),(0,P.jsx)(L,{label:n.dmPolicy,value:e.dmPolicy,onChange:e=>t({dmPolicy:e}),options:r}),(0,P.jsx)(L,{label:n.streamMode,value:e.streamMode,onChange:e=>t({streamMode:e}),options:i}),(0,P.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:n.historyLimit}),(0,P.jsx)(`input`,{type:`number`,min:10,max:200,className:h(),value:e.historyLimit,onChange:e=>t({historyLimit:parseInt(e.target.value,10)||50})})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:n.textChunkLimit}),(0,P.jsx)(`input`,{type:`number`,min:1e3,max:1e4,step:100,className:h(),value:e.textChunkLimit,onChange:e=>t({textChunkLimit:parseInt(e.target.value,10)||4e3})})]})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:n.weixinRouteTag}),(0,P.jsx)(`input`,{className:h(),value:e.routeTag,onChange:e=>t({routeTag:e.target.value}),placeholder:n.routeTagPlaceholder}),(0,P.jsx)(I,{children:n.weixinRouteTagDesc})]}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:e.debug,onChange:e=>t({debug:e.target.checked})}),n.weixinDebug]}),(0,P.jsx)(I,{children:n.weixinDebugDesc}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:n.weixinAccountsJson}),(0,P.jsx)(`textarea`,{className:a(h(),`min-h-[140px] resize-y font-mono text-xs`),spellCheck:!1,value:o,onChange:e=>s(e.target.value),onBlur:l,placeholder:`{ "personal": { "name": "...", "cdnBaseUrl": "...", "enabled": true } }`}),c?(0,P.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:c}):(0,P.jsx)(I,{children:n.weixinAccountsJsonDesc})]}),(0,P.jsx)(je,{accountIds:j(e),routes:u,defaultAgentId:d,agentItems:f,disabled:m,onChange:p,ch:n})]})}var Fe=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),R=t((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),z=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),Ie=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),Le=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),Re=t((e=>{var t=R().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),ze=t((e=>{var t=R().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Be=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),Ve=t((e=>{var t=z(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),He=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),Ue=t((e=>{var t=He();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),We=t(((e,t)=>{var n=Ue();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),Ge=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),Ke=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
2
+ ]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^`+t+`$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),B=t((e=>{var t=Ge(),n=Ke();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),V=t((e=>{var t=R(),n=Ve(),r=z(),i=B(),a=Ge(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),qe=t((e=>{var t=R(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),H=t(((e,t)=>{var n=B();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),Je=t(((e,t)=>{var n=B(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),U=t(((e,t)=>{var n=B();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),Ye=t(((e,t)=>{var n=B(),r=R();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
3
+ Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),W=t(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),Xe=t((e=>{var t=B(),n=H(),r=Je(),i=U(),a=Ye(),o=Ke(),s=R(),c=W();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
4
+ Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),G=t((e=>{var t=R(),n=z(),r=Ie(),i=Le(),a=Re(),o=ze(),s=Be(),c=Ve(),l=We(),u=V(),d=qe(),f=B(),p=Xe();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
5
+ The chosen QR Code version cannot contain this amount of data.
6
+ Minimum version required to store current data is: `+c+`.
7
+ `);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),Ze=t((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||={};let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[+!!a[t*i+r]]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),K=t((e=>{var t=Ze();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),Qe=t((e=>{var t=Ze();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
8
+ `;return typeof a==`function`&&a(null,p),p}})),q=e(t((e=>{var t=Fe(),n=G(),r=K(),i=Qe();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))(),1);function $e({open:e,onOpenChange:t,ch:n,onSetupSuccess:r}){let[i,o]=(0,k.useState)(!1),[s,c]=(0,k.useState)(`feishu`),[l,u]=(0,k.useState)(null),[d,f]=(0,k.useState)(null),[p,m]=(0,k.useState)(null),[h,g]=(0,k.useState)(null),[x,S]=(0,k.useState)(!1),[C,w]=(0,k.useState)(!0),ee=(0,k.useCallback)(async()=>{m(null),u(null),f(null),o(!0),w(!1);try{let e=await Se({domain:s});f(e.qrUrl),u(e.sessionKey)}catch(e){m(e instanceof Error?e.message:`Start failed`),w(!0)}finally{o(!1)}},[s]);(0,k.useEffect)(()=>{e||(u(null),f(null),m(null),g(null),S(!1),w(!0),o(!1))},[e]),(0,k.useEffect)(()=>{if(!l)return;let e=!1,n,i=async()=>{try{let i=await Ce(l);if(e||i.phase===`polling`)return;if(i.phase===`done`){n!==void 0&&(window.clearInterval(n),n=void 0),u(null),i.ok?(f(null),t(!1),r({appId:i.appId,domain:i.domain,openId:i.openId})):(m(i.message),f(null),w(!0));return}i.phase===`unknown`&&(n!==void 0&&window.clearInterval(n),m(i.message),u(null),f(null),w(!0))}catch(t){e||(n!==void 0&&window.clearInterval(n),m(t instanceof Error?t.message:`Request failed`),u(null),f(null),w(!0))}};return n=window.setInterval(()=>void i(),3e3),i(),()=>{e=!0,n!==void 0&&window.clearInterval(n)}},[l,t,r]),(0,k.useEffect)(()=>{if(!d){g(null),S(!1);return}let e=!1;return S(!1),q.toDataURL(d,{width:208,margin:2,errorCorrectionLevel:`M`,color:{dark:`#000000ff`,light:`#ffffffff`}}).then(t=>{e||g(t)}).catch(()=>{e||(S(!0),g(null))}),()=>{e=!0}},[d]);let T=!!(d&&l);return(0,P.jsx)(ce,{open:e,onOpenChange:t,children:(0,P.jsxs)(te,{children:[(0,P.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim backdrop-blur-[1px]`}),(0,P.jsxs)(ie,{className:a(`fixed left-1/2 top-1/2 z-[60] max-h-[min(90vh,52rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,P.jsx)(_,{asChild:!0,children:(0,P.jsx)(`button`,{type:`button`,className:`absolute right-3 top-3 z-20 rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":n.feishuQrCloseAria,children:(0,P.jsx)(y,{className:`size-4`})})}),(0,P.jsx)(b,{className:`sr-only`,children:n.feishuQrModalTitle}),(0,P.jsx)(se,{className:`sr-only`,children:n.feishuQrModalSubtitle}),(0,P.jsxs)(`div`,{className:`text-center`,children:[(0,P.jsx)(`p`,{className:`text-lg font-semibold tracking-tight text-fg`,children:n.feishuQrModalTitle}),(0,P.jsx)(`p`,{className:`mt-1.5 text-sm text-fg-muted`,children:n.feishuQrModalSubtitle})]}),C&&!T?(0,P.jsxs)(`div`,{className:`mt-6 flex flex-col items-center gap-4`,children:[(0,P.jsxs)(`div`,{className:`flex w-full flex-col gap-1.5`,children:[(0,P.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`feishu-qr-domain`,children:n.feishuQrDomainLabel}),(0,P.jsxs)(`select`,{id:`feishu-qr-domain`,className:`w-full rounded-lg border border-edge bg-surface px-3 py-2 text-sm text-fg outline-none focus:ring-2 focus:ring-accent/40`,value:s,onChange:e=>c(e.target.value),children:[(0,P.jsx)(`option`,{value:`feishu`,children:`feishu (open.feishu.cn) — China`}),(0,P.jsx)(`option`,{value:`lark`,children:`lark (open.larksuite.com) — International`})]})]}),(0,P.jsx)(E,{type:`button`,variant:`primary`,className:`h-11 w-full rounded-full`,disabled:i,onClick:()=>void ee(),children:i?n.feishuQrStarting:n.feishuQrStartButton})]}):null,(0,P.jsxs)(`div`,{className:`mt-6 flex min-h-[200px] flex-col items-center justify-center`,children:[i&&!T?(0,P.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.feishuQrStarting}):null,p?(0,P.jsx)(`p`,{className:`text-center text-sm text-red-600 dark:text-red-400`,children:p}):null,T&&d&&!p?(0,P.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-3`,children:[(0,P.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.feishuQrScanHint}),h&&!x?(0,P.jsx)(`img`,{src:h,alt:``,className:`h-52 w-52 rounded-lg border border-edge-subtle bg-white object-contain p-3 dark:border-edge`}):null,!h&&!x?(0,P.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.feishuQrEncoding}):null,x?(0,P.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-3`,children:[(0,P.jsx)(`p`,{className:`max-w-[16rem] text-center text-sm text-fg-muted`,children:n.feishuQrImageError}),(0,P.jsxs)(`a`,{href:d,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-sm text-accent underline-offset-2 hover:underline`,children:[(0,P.jsx)(ne,{className:`size-3.5 shrink-0`}),n.feishuQrOpenLink]})]}):null]}):null]}),T?(0,P.jsx)(`div`,{className:`mt-6`,children:(0,P.jsx)(E,{type:`button`,variant:`secondary`,className:`h-11 w-full rounded-full border-0 bg-fg text-surface-panel hover:opacity-90 dark:bg-fg dark:text-surface-panel`,disabled:i,onClick:()=>void ee(),children:i?n.feishuQrStarting:n.feishuQrRegenerate})}):null]})]})})}function et({open:e,onOpenChange:t,ch:n,onLoginSuccess:r,moreSettings:i}){let[o,s]=(0,k.useState)(!1),[c,l]=(0,k.useState)(null),[u,d]=(0,k.useState)(null),[f,p]=(0,k.useState)(null),[m,h]=(0,k.useState)(null),[g,x]=(0,k.useState)(null),[S,C]=(0,k.useState)(!1),w=(0,k.useCallback)(async()=>{p(null),h(null),l(null),s(!0);try{let e=await ye();d(e.qrcodeUrl),l(e.sessionKey)}catch(e){p(e instanceof Error?e.message:`Start failed`)}finally{s(!1)}},[]);(0,k.useEffect)(()=>{if(!e){l(null),d(null),p(null),x(null),C(!1),h(null);return}w()},[e,w]),(0,k.useEffect)(()=>{if(!c)return;let e=!1,i,a=async()=>{try{let a=await be(c);if(e)return;if(a.phase===`polling`){d(a.qrcodeUrl),a.qrStatus===`scaned`?h(n.weixinQrLoginScanned):h(null);return}if(a.phase===`done`){i!==void 0&&(window.clearInterval(i),i=void 0),l(null),a.ok?(d(null),t(!1),await r()):(p(a.message),d(null));return}a.phase===`unknown`&&h(null)}catch(t){e||(i!==void 0&&window.clearInterval(i),p(t instanceof Error?t.message:`Request failed`),l(null),d(null))}};return i=window.setInterval(()=>void a(),2e3),a(),()=>{e=!0,i!==void 0&&window.clearInterval(i)}},[c,n.weixinQrLoginScanned,n.weixinQrLoginSuccess,r,t]),(0,k.useEffect)(()=>{if(!u){x(null),C(!1);return}let e=!1;return C(!1),q.toDataURL(u,{width:208,margin:2,errorCorrectionLevel:`M`,color:{dark:`#000000ff`,light:`#ffffffff`}}).then(t=>{e||x(t)}).catch(()=>{e||(C(!0),x(null))}),()=>{e=!0}},[u]);let ee=!!(u&&c);return(0,P.jsx)(ce,{open:e,onOpenChange:t,children:(0,P.jsxs)(te,{children:[(0,P.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim backdrop-blur-[1px]`}),(0,P.jsxs)(ie,{className:a(`fixed left-1/2 top-1/2 z-[60] max-h-[min(90vh,52rem)] w-[min(100%-2rem,32rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,P.jsx)(_,{asChild:!0,children:(0,P.jsx)(`button`,{type:`button`,className:`absolute right-3 top-3 z-20 rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":n.weixinQrModalCloseAria,children:(0,P.jsx)(y,{className:`size-4`})})}),(0,P.jsx)(b,{className:`sr-only`,children:n.weixinQrModalTitle}),(0,P.jsx)(se,{className:`sr-only`,children:n.weixinQrModalSubtitle}),(0,P.jsxs)(`div`,{className:`text-center`,children:[(0,P.jsx)(`p`,{className:`text-lg font-semibold tracking-tight text-fg`,children:n.weixinQrModalTitle}),(0,P.jsx)(`p`,{className:`mt-1.5 text-sm text-fg-muted`,children:n.weixinQrModalSubtitle})]}),(0,P.jsxs)(`div`,{className:`mt-6 flex min-h-[200px] flex-col items-center justify-center`,children:[o&&!ee?(0,P.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.weixinQrLoginBusy}):null,f?(0,P.jsx)(`p`,{className:`text-center text-sm text-red-600 dark:text-red-400`,children:f}):null,m&&!f?(0,P.jsx)(`p`,{className:`mb-3 text-center text-sm text-accent`,children:m}):null,ee&&u&&!f?(0,P.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-3`,children:[g&&!S?(0,P.jsx)(`img`,{src:g,alt:``,className:`h-52 w-52 rounded-lg border border-edge-subtle bg-white object-contain p-3 dark:border-edge`}):null,!g&&!S?(0,P.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.weixinQrEncoding}):null,S?(0,P.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-3`,children:[(0,P.jsx)(`p`,{className:`max-w-[16rem] text-center text-sm text-fg-muted`,children:n.weixinQrImageError}),(0,P.jsxs)(`a`,{href:u,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-sm text-accent underline-offset-2 hover:underline`,children:[(0,P.jsx)(ne,{className:`size-3.5 shrink-0`}),n.weixinQrOpenLink]})]}):null]}):null]}),(0,P.jsx)(`div`,{className:`mt-6`,children:(0,P.jsx)(E,{type:`button`,variant:`secondary`,className:`h-11 w-full rounded-full border-0 bg-fg text-surface-panel hover:opacity-90 dark:bg-fg dark:text-surface-panel`,disabled:o,onClick:()=>void w(),children:o?n.weixinQrLoginBusy:n.weixinQrRegenerate})}),i?(0,P.jsx)(`div`,{className:`mt-6 border-t border-edge-subtle pt-4 dark:border-edge-subtle`,children:i}):null]})]})})}function J(){let e=we,t=p(e=>e.language),n=re(t),r=n.channelsSettings,s=!!oe(e=>e.token),[m,h]=(0,k.useState)(null),[g,S]=(0,k.useState)(null),[C,w]=(0,k.useState)(!1),[T,D]=(0,k.useState)(null),[ue,O]=(0,k.useState)(!1),[de,fe]=(0,k.useState)(!1),[pe,A]=(0,k.useState)(!1),[me,j]=(0,k.useState)(!1),[M,N]=(0,k.useState)(null),[ye,be]=(0,k.useState)(null),[Se,Ce]=(0,k.useState)(!1),[Te,L]=(0,k.useState)(null),[Fe,R]=(0,k.useState)(!1),[z,Ie]=(0,k.useState)(!1),[Le,Re]=(0,k.useState)(!1),[ze,Be]=(0,k.useState)(!1),[Ve,He]=(0,k.useState)(!1),[Ue,We]=(0,k.useState)(!1),[Ge,Ke]=(0,k.useState)(!1),[B,V]=(0,k.useState)(``),[qe,H]=(0,k.useState)(``),[Je,U]=(0,k.useState)(``),[Ye,W]=(0,k.useState)(``),[Xe,G]=(0,k.useState)(``),[Ze,K]=(0,k.useState)(``),{data:Qe}=i(s?`gateway-chat-agents-ch`:null,ee,{revalidateOnFocus:!1}),{data:q,error:J,isLoading:tt,mutate:nt}=o(s),Y=(0,k.useMemo)(()=>q?.payload?.config===void 0?null:ve(q.payload.config),[q]),rt=(0,k.useMemo)(()=>!m||!g?!1:JSON.stringify(m)!==JSON.stringify(g),[m,g]);(0,k.useEffect)(()=>{if(!s){h(null),S(null);return}Y!==null&&(rt||(h(Y),S(structuredClone(Y)),V(JSON.stringify(Y.telegram.accounts??{},null,2)),H(``),U(JSON.stringify(Y.weixin.accounts??{},null,2)),W(``),G(JSON.stringify(Y.feishu?.accounts??{},null,2)),K(``),O(!1)))},[s,Y,rt]);let it=!!(s&&tt&&q===void 0&&!J),at=J instanceof Error?J.message:J?String(J):null,ot=(0,k.useCallback)((e,t,n)=>{h(r=>{if(!r)return null;let i=e===`telegram`?`telegram`:e===`weixin`?`weixin`:`feishu`;return{...r,channelAgentRoutes:{...r.channelAgentRoutes,[i]:{...r.channelAgentRoutes[i],[t]:n.trim().toLowerCase()}}}})},[]),X=(0,k.useCallback)(e=>{h(t=>t?{...t,telegram:{...t.telegram,...e}}:null)},[]),st=(0,k.useCallback)(e=>{h(t=>t?{...t,weixin:{...t.weixin,...e}}:null)},[]),Z=(0,k.useCallback)(e=>{h(t=>t?{...t,feishu:{...t.feishu,...e}}:null)},[]),ct=(0,k.useCallback)(async()=>{if(!m||C)return!1;w(!0),D(null),O(!1);try{let e=await xe(m);h(e);let t=structuredClone(e);return S(t),V(JSON.stringify(t.telegram.accounts??{},null,2)),H(``),U(JSON.stringify(t.weixin.accounts??{},null,2)),W(``),G(JSON.stringify(t.feishu?.accounts??{},null,2)),K(``),O(!0),window.setTimeout(()=>O(!1),2500),!0}catch(e){return D(e instanceof Error?e.message:r.saveError),!1}finally{w(!1)}},[m,C,r.saveError]),lt=(0,k.useCallback)(async(e,t)=>{if(!m||C)return;let n=m,i=e===`weixin`?{...m,weixin:{...m.weixin,enabled:t}}:e===`telegram`?{...m,telegram:{...m.telegram,enabled:t}}:{...m,feishu:{...m.feishu,enabled:t}};h(i),w(!0),D(null);try{let e=await xe(i);h(e);let t=structuredClone(e);S(t),V(JSON.stringify(t.telegram.accounts??{},null,2)),U(JSON.stringify(t.weixin.accounts??{},null,2)),G(JSON.stringify(t.feishu?.accounts??{},null,2))}catch(e){D(e instanceof Error?e.message:r.saveError),h(n)}finally{w(!1)}},[m,C,r.saveError]),ut=(0,k.useCallback)(async()=>{if(!m||!M||C)return;let e=_e(),t=M===`weixin`?{...m,weixin:e.weixin}:M===`telegram`?{...m,telegram:e.telegram}:{...m,feishu:e.feishu};w(!0),D(null);try{let e=await xe(t);h(e);let n=structuredClone(e);S(n),V(JSON.stringify(n.telegram.accounts??{},null,2)),U(JSON.stringify(n.weixin.accounts??{},null,2)),H(``),W(``),G(JSON.stringify(n.feishu?.accounts??{},null,2)),K(``),N(null),O(!0),window.setTimeout(()=>O(!1),2500)}catch(e){D(e instanceof Error?e.message:r.saveError)}finally{w(!1)}},[m,M,C,r.saveError]),dt=(0,k.useCallback)(async()=>{let e=m?.telegram.botToken;e&&(await navigator.clipboard.writeText(e).catch(()=>{}),He(!0),window.setTimeout(()=>He(!1),2e3))},[m?.telegram.botToken]),ft=(0,k.useCallback)(e=>{Z({appId:e.appId,domain:e.domain,enabled:!0}),nt(),L(r.feishuQrSetupSuccess),window.setTimeout(()=>L(null),4e3)},[Z,nt,r.feishuQrSetupSuccess]),pt=(0,k.useCallback)(async()=>{let e=m?.feishu?.appSecret;e&&(await navigator.clipboard.writeText(e).catch(()=>{}),We(!0),window.setTimeout(()=>We(!1),2e3))},[m]),mt=(0,k.useCallback)(async()=>{let e=m?.feishu;if(!e)return;let t={connectionMode:e.connectionMode,verificationToken:e.verificationToken||``,encryptKey:e.encryptKey||``,webhookHost:e.webhookHost||``,webhookPort:e.webhookPort||0,webhookPath:e.webhookPath||``};await navigator.clipboard.writeText(JSON.stringify(t,null,2)).catch(()=>{}),Ke(!0),window.setTimeout(()=>Ke(!1),2e3)},[m]),ht=(0,k.useCallback)(()=>{if(!m)return;let e=B.trim();if(!e){X({accounts:{}}),H(``);return}try{let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))throw Error(r.jsonObjectAccounts);X({accounts:t}),H(``)}catch(e){H(e instanceof Error?e.message:r.jsonInvalid)}},[m,B,X,r.jsonObjectAccounts,r.jsonInvalid]),gt=(0,k.useCallback)(()=>{if(!m)return;let e=Je.trim();if(!e){st({accounts:{}}),W(``);return}try{let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))throw Error(r.jsonObjectAccounts);st({accounts:t}),W(``)}catch(e){W(e instanceof Error?e.message:r.jsonInvalid)}},[m,Je,st,r.jsonObjectAccounts,r.jsonInvalid]),_t=(0,k.useCallback)(()=>{if(!m)return;let e=Xe.trim();if(!e){Z({accounts:{}}),K(``);return}try{let t=JSON.parse(e);if(typeof t!=`object`||!t||Array.isArray(t))throw Error(r.jsonObjectAccounts);Z({accounts:t}),K(``)}catch(e){K(e instanceof Error?e.message:r.jsonInvalid)}},[m,Xe,Z,r.jsonObjectAccounts,r.jsonInvalid]),vt=(0,k.useMemo)(()=>[`pairing`,`allowlist`,`open`,`disabled`].map(e=>({value:e,label:r.policy.dm[e]})),[r.policy.dm]),yt=(0,k.useMemo)(()=>[`open`,`disabled`,`allowlist`].map(e=>({value:e,label:r.policy.group[e]})),[r.policy.group]),bt=(0,k.useMemo)(()=>[`off`,`first`,`all`].map(e=>({value:e,label:r.policy.reply[e]})),[r.policy.reply]),xt=(0,k.useMemo)(()=>[`off`,`partial`,`block`].map(e=>({value:e,label:r.policy.stream[e]})),[r.policy.stream]);if(!s)return(0,P.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-3 px-4 py-8`,children:[(0,P.jsx)(`h1`,{className:`text-lg font-semibold text-fg`,children:n.settingsSections.channels}),(0,P.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.needToken})]});if(it)return(0,P.jsxs)(`div`,{className:`mx-auto w-full max-w-app-main px-4 py-8`,children:[(0,P.jsx)(`div`,{className:`h-8 w-48 animate-pulse rounded bg-surface-hover`}),(0,P.jsx)(`div`,{className:`mt-6 h-32 animate-pulse rounded-xl bg-surface-hover`}),(0,P.jsx)(`p`,{className:`mt-4 text-sm text-fg-muted`,children:r.loading})]});if(!m)return(0,P.jsxs)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-3 px-4 py-8`,children:[(0,P.jsx)(`p`,{className:`text-sm text-fg-muted`,children:T??at??r.loadError}),(0,P.jsx)(E,{type:`button`,variant:`secondary`,onClick:()=>void nt(),children:r.retry})]});let Q=m.telegram,St=m.weixin,$=m.feishu,Ct=g?.telegram?.botToken??``,wt=!z&&!!String(Ct).trim()&&Q.botToken===Ct,Tt=g?.feishu?.appSecret??``,Et=!Le&&!!String(Tt).trim()&&$.appSecret===Tt,Dt=ke(St),Ot=Oe(Q),kt=Ae($),At=(0,P.jsxs)(`details`,{className:`group rounded-xl border border-edge-subtle bg-surface-base open:pb-3 dark:border-edge`,children:[(0,P.jsx)(`summary`,{className:`cursor-pointer list-none px-3 py-2.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover [&::-webkit-details-marker]:hidden`,children:(0,P.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,P.jsx)(u,{className:`size-4 shrink-0 text-fg-muted transition-transform group-open:rotate-180`}),r.advancedShow]})}),(0,P.jsxs)(`div`,{className:`space-y-4 border-t border-edge-subtle px-3 pb-3 pt-3 dark:border-edge-subtle`,children:[(0,P.jsx)(`p`,{className:`text-xs leading-relaxed text-fg-muted`,children:r.weixinAdvancedHint}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:St.enabled,onChange:e=>st({enabled:e.target.checked})}),(0,P.jsx)(`span`,{children:r.enableWeixinAria})]}),(0,P.jsx)(`div`,{className:`[&>div]:border-0 [&>div]:pt-0`,children:(0,P.jsx)(Pe,{wx:St,updateWeixin:st,ch:r,dmOpts:vt,streamOpts:xt,wxAccountsDraft:Je,setWxAccountsDraft:U,wxAccountsError:Ye,onWxAccountsBlur:gt,channelAgentRoutesWx:m.channelAgentRoutes.weixin,defaultAgentId:m.defaultAgentId,agentItems:Qe?.items??[],onAgentRouteChange:(e,t)=>ot(`weixin`,e,t),routingDisabled:C})}),(0,P.jsx)(E,{type:`button`,variant:`primary`,className:`w-full`,disabled:!rt||C,onClick:async()=>{await ct()},children:C?r.saving:r.save})]})]});return(0,P.jsx)(`div`,{className:`mx-auto flex w-full max-w-app-main flex-col gap-6 px-4 py-6`,children:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,P.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight text-fg`,children:n.settingsSections.channels}),(0,P.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.subtitle}),(0,P.jsxs)(`a`,{href:l(t,`channels`),target:`_blank`,rel:`noreferrer`,className:`mt-1 inline-flex items-center gap-1 text-sm text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[r.docsLink,(0,P.jsx)(ne,{className:`size-3.5`})]})]}),rt?(0,P.jsx)(`p`,{className:`text-xs text-amber-800 dark:text-amber-200`,children:r.unsavedHint}):null,ue?(0,P.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.saved}):null,T?(0,P.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:T}):null,ye?(0,P.jsx)(`p`,{className:`text-xs text-accent`,children:ye}):null,Te?(0,P.jsx)(`div`,{className:`rounded-xl border border-success/30 bg-success-soft px-4 py-3 text-sm text-success`,children:Te}):null,(0,P.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,P.jsx)(Me,{icon:(0,P.jsx)(c,{className:`size-6 text-accent`,strokeWidth:1.75}),title:r.weixinTitle,subtitle:r.weixinSubtitle,configured:Dt,enabled:St.enabled,toggleDisabled:C,onToggle:e=>void lt(`weixin`,e),onConfigure:()=>fe(!0),onEdit:()=>fe(!0),onRemove:()=>N(`weixin`),ch:r}),(0,P.jsx)(Me,{icon:(0,P.jsx)(f,{className:`size-6 text-accent`,strokeWidth:1.75}),title:r.telegramTitle,subtitle:r.telegramSubtitle,configured:Ot,enabled:Q.enabled,toggleDisabled:C,onToggle:e=>void lt(`telegram`,e),onConfigure:()=>A(!0),onEdit:()=>A(!0),onRemove:()=>N(`telegram`),ch:r}),(0,P.jsx)(Me,{icon:(0,P.jsx)(c,{className:`size-6 text-accent`,strokeWidth:1.75}),title:r.feishuTitle,subtitle:r.feishuSubtitle,configured:kt,enabled:$.enabled,toggleDisabled:C,onToggle:e=>void lt(`feishu`,e),onConfigure:()=>j(!0),onEdit:()=>j(!0),onRemove:()=>N(`feishu`),ch:r})]}),(0,P.jsx)(et,{open:de,onOpenChange:fe,ch:r,onLoginSuccess:async()=>{await nt(),be(r.weixinQrLoginSuccess),window.setTimeout(()=>be(null),4e3)},moreSettings:At}),(0,P.jsx)($e,{open:Se,onOpenChange:Ce,ch:r,onSetupSuccess:ft}),(0,P.jsx)(ce,{open:pe,onOpenChange:A,children:(0,P.jsxs)(te,{children:[(0,P.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim backdrop-blur-[1px]`}),(0,P.jsxs)(ie,{className:a(`fixed left-1/2 top-1/2 z-[60] max-h-[min(90vh,48rem)] w-[min(100%-2rem,36rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,P.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(b,{className:`text-lg font-semibold tracking-tight text-fg`,children:r.telegramTitle}),(0,P.jsx)(se,{className:`mt-1 text-sm text-fg-muted`,children:r.telegramSubtitle})]}),(0,P.jsx)(_,{asChild:!0,children:(0,P.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":r.modalCancel,children:(0,P.jsx)(y,{className:`size-4`})})})]}),(0,P.jsxs)(`label`,{className:`mt-6 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:Q.enabled,onChange:e=>X({enabled:e.target.checked})}),(0,P.jsx)(`span`,{children:r.enableTelegramAria})]}),(0,P.jsxs)(`div`,{className:`mt-6 space-y-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsxs)(F,{children:[r.telegramToken,(0,P.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:` *`})]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,P.jsx)(`input`,{className:a(e(),`min-w-0 flex-1 font-mono text-xs`),type:z?`text`:`password`,autoComplete:`off`,readOnly:wt,value:wt?`*`.repeat(Math.max(1,Q.botToken.length)):Q.botToken,onChange:e=>{wt||X({botToken:e.target.value})},placeholder:`123456789:ABCdefGHIjklMNOpqrsTUVwxyz`}),Q.botToken?(0,P.jsxs)(E,{type:`button`,variant:`secondary`,className:`px-2 py-1 text-xs`,onClick:()=>void dt(),children:[Ve?(0,P.jsx)(d,{className:`size-3.5`}):(0,P.jsx)(le,{className:`size-3.5`}),Ve?r.copied:r.copy]}):null,(0,P.jsxs)(E,{type:`button`,variant:`secondary`,className:`px-2 py-1 text-xs`,onClick:()=>Ie(e=>!e),children:[z?(0,P.jsx)(ae,{className:`size-3.5`}):(0,P.jsx)(x,{className:`size-3.5`}),z?r.hide:r.show]})]}),(0,P.jsx)(I,{children:r.telegramTokenDesc})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:r.allowFromDm}),(0,P.jsx)(`textarea`,{className:a(e(),`min-h-[2.75rem] resize-y font-mono text-xs`),rows:2,placeholder:`123456789, 987654321`,value:De(Q.allowFrom),onChange:e=>X({allowFrom:Ee(e.target.value)})}),(0,P.jsx)(I,{children:r.allowFromDmDesc})]}),m?(0,P.jsx)(je,{accountIds:he(Q),routes:m.channelAgentRoutes.telegram,defaultAgentId:m.defaultAgentId,agentItems:Qe?.items??[],disabled:C,onChange:(e,t)=>ot(`telegram`,e,t),ch:r}):null,(0,P.jsxs)(E,{type:`button`,variant:`ghost`,className:`-ml-2 h-auto justify-start px-2 py-1 text-sm text-fg-muted hover:text-fg`,onClick:()=>R(e=>!e),children:[(0,P.jsx)(u,{className:a(`mr-1 size-4 transition-transform`,Fe&&`rotate-180`)}),Fe?r.advancedHide:r.advancedShow]}),Fe?(0,P.jsx)(Ne,{tg:Q,updateTelegram:X,ch:r,dmOpts:vt,groupOpts:yt,replyOpts:bt,streamOpts:xt,tgAccountsDraft:B,setTgAccountsDraft:V,tgAccountsError:qe,onTgAccountsBlur:ht}):null]}),(0,P.jsxs)(`div`,{className:`mt-8 flex flex-wrap justify-end gap-2 border-t border-edge-subtle pt-4 dark:border-edge-subtle`,children:[(0,P.jsx)(E,{type:`button`,variant:`secondary`,onClick:()=>A(!1),children:r.modalCancel}),(0,P.jsx)(E,{type:`button`,variant:`primary`,disabled:!rt||C,onClick:async()=>{await ct()&&A(!1)},children:C?r.saving:r.save})]})]})]})}),(0,P.jsx)(ce,{open:me,onOpenChange:j,children:(0,P.jsxs)(te,{children:[(0,P.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim backdrop-blur-[1px]`}),(0,P.jsxs)(ie,{className:a(`fixed left-1/2 top-1/2 z-[60] max-h-[min(90vh,48rem)] w-[min(100%-2rem,36rem)] -translate-x-1/2 -translate-y-1/2`,`overflow-y-auto rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,P.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(b,{className:`text-lg font-semibold tracking-tight text-fg`,children:r.feishuTitle}),(0,P.jsx)(se,{className:`mt-1 text-sm text-fg-muted`,children:r.feishuSubtitle})]}),(0,P.jsx)(_,{asChild:!0,children:(0,P.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,"aria-label":r.modalCancel,children:(0,P.jsx)(y,{className:`size-4`})})})]}),(0,P.jsxs)(`label`,{className:`mt-6 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:$.enabled,onChange:e=>Z({enabled:e.target.checked})}),(0,P.jsx)(`span`,{children:r.enableFeishuAria})]}),kt?null:(0,P.jsx)(`div`,{className:`mt-6 rounded-xl border border-dashed border-accent/40 bg-accent/5 px-4 py-3 dark:bg-accent/10`,children:(0,P.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.feishuQrSetupTitle}),(0,P.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.feishuQrSetupDesc})]}),(0,P.jsx)(E,{type:`button`,variant:`primary`,className:`shrink-0`,onClick:()=>Ce(!0),children:r.feishuQrSetupButton})]})}),(0,P.jsxs)(`div`,{className:`mt-6 space-y-4`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsxs)(F,{children:[r.feishuAppId,(0,P.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:` *`})]}),(0,P.jsx)(`input`,{className:a(e(),`min-w-0 flex-1 font-mono text-xs`),value:$.appId,onChange:e=>Z({appId:e.target.value}),placeholder:`cli_xxx`}),(0,P.jsx)(I,{children:r.feishuAppIdDesc})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsxs)(F,{children:[r.feishuAppSecret,(0,P.jsx)(`span`,{className:`text-red-600 dark:text-red-400`,children:` *`})]}),(0,P.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,P.jsx)(`input`,{className:a(e(),`min-w-0 flex-1 font-mono text-xs`),type:Le?`text`:`password`,autoComplete:`off`,readOnly:Et,value:Et?`*`.repeat(Math.max(1,$.appSecret.length)):$.appSecret,onChange:e=>{Et||Z({appSecret:e.target.value})},placeholder:`••••••••`}),$.appSecret?(0,P.jsxs)(E,{type:`button`,variant:`secondary`,className:`px-2 py-1 text-xs`,onClick:()=>void pt(),children:[Ue?(0,P.jsx)(d,{className:`size-3.5`}):(0,P.jsx)(le,{className:`size-3.5`}),Ue?r.copied:r.copy]}):null,(0,P.jsxs)(E,{type:`button`,variant:`secondary`,className:`px-2 py-1 text-xs`,onClick:()=>Re(e=>!e),children:[Le?(0,P.jsx)(ae,{className:`size-3.5`}):(0,P.jsx)(x,{className:`size-3.5`}),Le?r.hide:r.show]})]}),(0,P.jsx)(I,{children:r.feishuAppSecretDesc})]}),(0,P.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:r.feishuDomain}),(0,P.jsxs)(`select`,{className:e(),value:String($.domain||`feishu`),onChange:e=>Z({domain:e.target.value}),children:[(0,P.jsx)(`option`,{value:`feishu`,children:`feishu`}),(0,P.jsx)(`option`,{value:`lark`,children:`lark`})]})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:r.connectionMode}),(0,P.jsxs)(`select`,{className:e(),value:$.connectionMode,onChange:e=>Z({connectionMode:e.target.value}),children:[(0,P.jsx)(`option`,{value:`websocket`,children:`websocket`}),(0,P.jsx)(`option`,{value:`webhook`,children:`webhook`})]}),(0,P.jsx)(I,{children:r.connectionModeDesc})]})]}),$.connectionMode===`webhook`?(0,P.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface px-4 py-3 dark:border-edge-subtle`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.webhookTitle}),(0,P.jsxs)(`div`,{className:`flex gap-2`,children:[(0,P.jsxs)(E,{type:`button`,variant:`secondary`,className:`px-2 py-1 text-xs`,onClick:()=>Be(e=>!e),children:[ze?(0,P.jsx)(ae,{className:`size-3.5`}):(0,P.jsx)(x,{className:`size-3.5`}),ze?r.hide:r.show]}),(0,P.jsxs)(E,{type:`button`,variant:`secondary`,className:`px-2 py-1 text-xs`,onClick:()=>void mt(),children:[Ge?(0,P.jsx)(d,{className:`size-3.5`}):(0,P.jsx)(le,{className:`size-3.5`}),Ge?r.copied:r.copy]})]})]}),(0,P.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:r.verificationToken}),(0,P.jsx)(`input`,{className:a(e(),`min-w-0 flex-1 font-mono text-xs`),type:ze?`text`:`password`,autoComplete:`off`,value:$.verificationToken??``,onChange:e=>Z({verificationToken:e.target.value})}),(0,P.jsx)(I,{children:r.verificationTokenDesc})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:r.encryptKey}),(0,P.jsx)(`input`,{className:a(e(),`min-w-0 flex-1 font-mono text-xs`),type:ze?`text`:`password`,autoComplete:`off`,value:$.encryptKey??``,onChange:e=>Z({encryptKey:e.target.value})}),(0,P.jsx)(I,{children:r.encryptKeyDesc})]})]}),(0,P.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-3`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5 sm:col-span-2`,children:[(0,P.jsx)(F,{children:r.webhookHost}),(0,P.jsx)(`input`,{className:a(e(),`min-w-0 flex-1 font-mono text-xs`),value:$.webhookHost??``,onChange:e=>Z({webhookHost:e.target.value}),placeholder:`127.0.0.1`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:r.webhookPort}),(0,P.jsx)(`input`,{className:a(e(),`min-w-0 flex-1 font-mono text-xs`),type:`number`,inputMode:`numeric`,value:String($.webhookPort??``),onChange:e=>Z({webhookPort:Number(e.target.value||`0`)||0}),placeholder:`3000`})]})]}),(0,P.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:r.webhookPath}),(0,P.jsx)(`input`,{className:a(e(),`min-w-0 flex-1 font-mono text-xs`),value:$.webhookPath??``,onChange:e=>Z({webhookPath:e.target.value}),placeholder:`/feishu/events`}),(0,P.jsx)(I,{children:r.webhookPathDesc})]})]}):null,(0,P.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:r.renderMode}),(0,P.jsxs)(`select`,{className:e(),value:$.renderMode,onChange:e=>Z({renderMode:e.target.value}),children:[(0,P.jsx)(`option`,{value:`auto`,children:`auto`}),(0,P.jsx)(`option`,{value:`raw`,children:`raw`}),(0,P.jsx)(`option`,{value:`card`,children:`card`})]})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:r.reactionNotifications}),(0,P.jsxs)(`select`,{className:e(),value:$.reactionNotifications,onChange:e=>Z({reactionNotifications:e.target.value}),children:[(0,P.jsx)(`option`,{value:`off`,children:`off`}),(0,P.jsx)(`option`,{value:`own`,children:`own`}),(0,P.jsx)(`option`,{value:`all`,children:`all`})]})]})]}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:$.streaming,onChange:e=>Z({streaming:e.target.checked})}),r.enableStreaming]}),(0,P.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:r.dmPolicy}),(0,P.jsx)(`select`,{className:e(),value:$.dmPolicy,onChange:e=>Z({dmPolicy:e.target.value}),children:vt.map(e=>(0,P.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:r.groupPolicy}),(0,P.jsx)(`select`,{className:e(),value:$.groupPolicy,onChange:e=>Z({groupPolicy:e.target.value}),children:yt.map(e=>(0,P.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]}),(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:$.requireMention,onChange:e=>Z({requireMention:e.target.checked})}),r.requireMention]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:r.allowFromDm}),(0,P.jsx)(`textarea`,{className:a(e(),`min-h-[2.75rem] resize-y font-mono text-xs`),rows:2,placeholder:`ou_xxx, on_xxx`,value:De($.allowFrom),onChange:e=>Z({allowFrom:Ee(e.target.value)})}),(0,P.jsx)(I,{children:r.allowFromDmDesc})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:r.allowFromGroups}),(0,P.jsx)(`textarea`,{className:a(e(),`min-h-[2.75rem] resize-y font-mono text-xs`),rows:2,placeholder:`oc_xxx, oc_yyy`,value:De($.groupAllowFrom),onChange:e=>Z({groupAllowFrom:Ee(e.target.value)})}),(0,P.jsx)(I,{children:r.allowFromGroupsDesc})]}),(0,P.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:r.historyLimit}),(0,P.jsx)(`input`,{className:a(e(),`min-w-0 flex-1 font-mono text-xs`),type:`number`,inputMode:`numeric`,value:String($.historyLimit),onChange:e=>Z({historyLimit:Number(e.target.value||`0`)||0})})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:r.textChunkLimit}),(0,P.jsx)(`input`,{className:a(e(),`min-w-0 flex-1 font-mono text-xs`),type:`number`,inputMode:`numeric`,value:String($.textChunkLimit),onChange:e=>Z({textChunkLimit:Number(e.target.value||`0`)||0})})]})]}),(0,P.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface px-4 py-3 dark:border-edge-subtle`,children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.feishuToolsTitle}),(0,P.jsx)(`div`,{className:`mt-2 grid gap-2 sm:grid-cols-2`,children:[[`doc`,r.feishuToolDoc],[`wiki`,r.feishuToolWiki],[`drive`,r.feishuToolDrive],[`perm`,r.feishuToolPerm],[`bitable`,r.feishuToolBitable],[`scopes`,r.feishuToolScopes]].map(([e,t])=>(0,P.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!$.tools?.[e],onChange:t=>Z({tools:{...$.tools,[e]:t.target.checked}})}),t]},e))}),(0,P.jsx)(`div`,{className:`mt-2`,children:(0,P.jsx)(I,{children:r.feishuToolsDesc})})]}),(0,P.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface px-4 py-3 dark:border-edge-subtle`,children:[(0,P.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.feishuActionsTitle}),(0,P.jsxs)(`label`,{className:`mt-2 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[(0,P.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:!!$.actions?.reactions,onChange:e=>Z({actions:{...$.actions,reactions:e.target.checked}})}),r.feishuActionReactions]})]}),m?(0,P.jsx)(je,{accountIds:ge($),routes:m.channelAgentRoutes.feishu,defaultAgentId:m.defaultAgentId,agentItems:Qe?.items??[],disabled:C,onChange:(e,t)=>ot(`feishu`,e,t),ch:r}):null,(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(F,{children:r.multiAccountJson}),(0,P.jsx)(`textarea`,{className:a(e(),`min-h-[140px] resize-y font-mono text-xs`),spellCheck:!1,value:Xe,onChange:e=>G(e.target.value),onBlur:_t,placeholder:`{ "default": { "appId": "...", "appSecret": "...", "enabled": true } }`}),Ze?(0,P.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:Ze}):(0,P.jsx)(I,{children:r.multiAccountJsonDesc})]})]}),(0,P.jsxs)(`div`,{className:`mt-8 flex flex-wrap justify-end gap-2 border-t border-edge-subtle pt-4 dark:border-edge-subtle`,children:[(0,P.jsx)(E,{type:`button`,variant:`secondary`,onClick:()=>j(!1),children:r.modalCancel}),(0,P.jsx)(E,{type:`button`,variant:`primary`,disabled:!rt||C,onClick:async()=>{await ct()&&j(!1)},children:C?r.saving:r.save})]})]})]})}),(0,P.jsx)(ce,{open:M!==null,onOpenChange:e=>!e&&N(null),children:(0,P.jsxs)(te,{children:[(0,P.jsx)(v,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[1px]`}),(0,P.jsxs)(ie,{className:a(`fixed left-1/2 top-1/2 z-[70] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,P.jsx)(b,{className:`text-base font-semibold text-fg`,children:r.removeChannelTitle}),(0,P.jsx)(se,{className:`mt-2 text-sm text-fg-muted`,children:M?r.removeChannelConfirm.replace(`{{name}}`,M===`weixin`?r.weixinTitle:M===`telegram`?r.telegramTitle:r.feishuTitle):`\xA0`}),(0,P.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,P.jsx)(E,{type:`button`,variant:`secondary`,onClick:()=>N(null),children:r.modalCancel}),(0,P.jsx)(E,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:C,onClick:()=>void ut(),children:C?r.saving:r.removeChannelAction})]})]})]})})]})})}export{J as ChannelsSettingsPanel};
9
+ //# sourceMappingURL=channels-settings-BAvk9-aK.js.map