@jait/gateway 0.1.481 → 0.1.482

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 (59) hide show
  1. package/dist/plugins/manager.d.ts.map +1 -1
  2. package/dist/plugins/manager.js +15 -0
  3. package/dist/plugins/manager.js.map +1 -1
  4. package/package.json +1 -1
  5. package/web-dist/assets/{_basePickBy-qZfmOA0w.js → _basePickBy-BOlYaE1w.js} +1 -1
  6. package/web-dist/assets/{_baseUniq-Bic_0Ku1.js → _baseUniq-7iT7EHp3.js} +1 -1
  7. package/web-dist/assets/{arc-CEc8Gtj6.js → arc-CrJP2NK-.js} +1 -1
  8. package/web-dist/assets/{architectureDiagram-2XIMDMQ5-BU1Io8ja.js → architectureDiagram-2XIMDMQ5-CTXTLOZg.js} +1 -1
  9. package/web-dist/assets/{blockDiagram-WCTKOSBZ-sCUOeM9Y.js → blockDiagram-WCTKOSBZ-DjpfTolF.js} +1 -1
  10. package/web-dist/assets/{c4Diagram-IC4MRINW-kYgaGoR6.js → c4Diagram-IC4MRINW-BxuZtyKK.js} +1 -1
  11. package/web-dist/assets/channel-C5J0dtJR.js +1 -0
  12. package/web-dist/assets/{chunk-4BX2VUAB-g9fQ-S69.js → chunk-4BX2VUAB-DjAJy1Vd.js} +1 -1
  13. package/web-dist/assets/{chunk-55IACEB6-Ct3rpton.js → chunk-55IACEB6-CrXW5I_d.js} +1 -1
  14. package/web-dist/assets/{chunk-FMBD7UC4-BYYKYT48.js → chunk-FMBD7UC4-Cjpu7XH8.js} +1 -1
  15. package/web-dist/assets/{chunk-JSJVCQXG-BsVoy3Ui.js → chunk-JSJVCQXG-2eTi0-s7.js} +1 -1
  16. package/web-dist/assets/{chunk-KX2RTZJC-CicUJ_9h.js → chunk-KX2RTZJC-D3Wqa_Cx.js} +1 -1
  17. package/web-dist/assets/{chunk-NQ4KR5QH-Yvo4cuvD.js → chunk-NQ4KR5QH-DPLTGbc2.js} +1 -1
  18. package/web-dist/assets/{chunk-QZHKN3VN-DrBpz-k_.js → chunk-QZHKN3VN-DNsJlDXv.js} +1 -1
  19. package/web-dist/assets/{chunk-WL4C6EOR-D2_sBPE_.js → chunk-WL4C6EOR-Co9yEaXx.js} +1 -1
  20. package/web-dist/assets/classDiagram-VBA2DB6C-CJR8ILFD.js +1 -0
  21. package/web-dist/assets/classDiagram-v2-RAHNMMFH-CJR8ILFD.js +1 -0
  22. package/web-dist/assets/clone-BbelQPTZ.js +1 -0
  23. package/web-dist/assets/{cose-bilkent-S5V4N54A-BrtHBM6x.js → cose-bilkent-S5V4N54A-_u0YnyBo.js} +1 -1
  24. package/web-dist/assets/{dagre-KLK3FWXG-BzrpmYZL.js → dagre-KLK3FWXG-DKlMzH-N.js} +1 -1
  25. package/web-dist/assets/{diagram-E7M64L7V-BlNFSjWJ.js → diagram-E7M64L7V-DXqyTn3i.js} +1 -1
  26. package/web-dist/assets/{diagram-IFDJBPK2-Dqsr0-8e.js → diagram-IFDJBPK2-x4UfB8Jh.js} +1 -1
  27. package/web-dist/assets/{diagram-P4PSJMXO-BqgEtSgl.js → diagram-P4PSJMXO-7fmmLg7E.js} +1 -1
  28. package/web-dist/assets/{erDiagram-INFDFZHY-DQKdSExU.js → erDiagram-INFDFZHY-tdSesr0u.js} +1 -1
  29. package/web-dist/assets/{flowDiagram-PKNHOUZH-Dfb4F2Jr.js → flowDiagram-PKNHOUZH-CB9agj4M.js} +1 -1
  30. package/web-dist/assets/{ganttDiagram-A5KZAMGK-C9pvM7B0.js → ganttDiagram-A5KZAMGK-C4SghQ4X.js} +1 -1
  31. package/web-dist/assets/{gitGraphDiagram-K3NZZRJ6-DF1ng26T.js → gitGraphDiagram-K3NZZRJ6-DQg4IHrW.js} +1 -1
  32. package/web-dist/assets/{graph-B0qCsau1.js → graph-C1Tddpva.js} +1 -1
  33. package/web-dist/assets/{index-bPwc_s9j.js → index-BQW3h_mQ.js} +1 -1
  34. package/web-dist/assets/{index-CbK7Sq05.js → index-CBgOcQOv.js} +1 -1
  35. package/web-dist/assets/{index-DFyEPY0C.js → index-gBy_Mqet.js} +5 -5
  36. package/web-dist/assets/{infoDiagram-LFFYTUFH-DqktoSKY.js → infoDiagram-LFFYTUFH-DeZ8U7_l.js} +1 -1
  37. package/web-dist/assets/{ishikawaDiagram-PHBUUO56-BSD3bhDW.js → ishikawaDiagram-PHBUUO56-Dzb2FwTV.js} +1 -1
  38. package/web-dist/assets/{journeyDiagram-4ABVD52K-C1XiiAHp.js → journeyDiagram-4ABVD52K-DMUpxgrL.js} +1 -1
  39. package/web-dist/assets/{kanban-definition-K7BYSVSG-Bnl3u8lM.js → kanban-definition-K7BYSVSG-8tciWF1Y.js} +1 -1
  40. package/web-dist/assets/{layout-DuulVMp8.js → layout-DCm16DY0.js} +1 -1
  41. package/web-dist/assets/{linear-BdWH0fqS.js → linear-DW69pMXl.js} +1 -1
  42. package/web-dist/assets/{mindmap-definition-YRQLILUH-CP7IM4ly.js → mindmap-definition-YRQLILUH-BTzb4KqR.js} +1 -1
  43. package/web-dist/assets/{pieDiagram-SKSYHLDU-C2dg01pY.js → pieDiagram-SKSYHLDU-C3MRIn-U.js} +1 -1
  44. package/web-dist/assets/{quadrantDiagram-337W2JSQ-Ci0HHhZZ.js → quadrantDiagram-337W2JSQ-DqSCsLTu.js} +1 -1
  45. package/web-dist/assets/{requirementDiagram-Z7DCOOCP-Cpa6xzfS.js → requirementDiagram-Z7DCOOCP-PVnN4DIw.js} +1 -1
  46. package/web-dist/assets/{sankeyDiagram-WA2Y5GQK-YC0w4y3m.js → sankeyDiagram-WA2Y5GQK-Bm-JwlZA.js} +1 -1
  47. package/web-dist/assets/{sequenceDiagram-2WXFIKYE-DFR_JRAl.js → sequenceDiagram-2WXFIKYE-Z0iLTIan.js} +1 -1
  48. package/web-dist/assets/{stateDiagram-RAJIS63D-DjS0hYUM.js → stateDiagram-RAJIS63D-DZ9Qstd6.js} +1 -1
  49. package/web-dist/assets/stateDiagram-v2-FVOUBMTO-CI244ggG.js +1 -0
  50. package/web-dist/assets/{timeline-definition-YZTLITO2-74ZokkIK.js → timeline-definition-YZTLITO2-HqkKyQAQ.js} +1 -1
  51. package/web-dist/assets/{treemap-KZPCXAKY-B-TU24Ni.js → treemap-KZPCXAKY-BtSSaAdi.js} +1 -1
  52. package/web-dist/assets/{vennDiagram-LZ73GAT5-DjG2mV1S.js → vennDiagram-LZ73GAT5-B-DXipE7.js} +1 -1
  53. package/web-dist/assets/{xychartDiagram-JWTSCODW-BgRI_wmA.js → xychartDiagram-JWTSCODW-BMnEKAac.js} +1 -1
  54. package/web-dist/index.html +1 -1
  55. package/web-dist/assets/channel-BPhEc6il.js +0 -1
  56. package/web-dist/assets/classDiagram-VBA2DB6C-COYaHGot.js +0 -1
  57. package/web-dist/assets/classDiagram-v2-RAHNMMFH-COYaHGot.js +0 -1
  58. package/web-dist/assets/clone-DfJVhmv7.js +0 -1
  59. package/web-dist/assets/stateDiagram-v2-FVOUBMTO-DXwakUby.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./angular-html-DA-rfuFy.js","./html-pp8916En.js","./javascript-wDzz0qaB.js","./css-CLj8gQPS.js","./angular-ts-BrjP3tb8.js","./scss-D5BDwBP9.js","./astro-HNnZUWAn.js","./json-Cp-IABpG.js","./typescript-BPQ3VLAy.js","./postcss-CXtECtnM.js","./tsx-COt5Ahok.js","./blade-BjGOyj-B.js","./html-derivative-DlHx6ybY.js","./xml-sdJ4AIDG.js","./java-CylS5w8V.js","./sql-BLtJtn59.js","./coffee-Ch7k5sss.js","./cpp-CofmeUqb.js","./regexp-CDVJQ6XC.js","./glsl-DplSGwfg.js","./c-BIGW1oBm.js","./graphql-ChdNCCLP.js","./jsx-g9-lgVsj.js","./haml-D5jkg6IW.js","./handlebars-BpdQsYii.js","./yaml-Buea-lGh.js","./http-jrhK8wxY.js","./shellscript-Yzrsuije.js","./hurl-irOxFIW8.js","./csv-fuZLfV_i.js","./jinja-f2NsQr07.js","./jison-wvAkD_A8.js","./julia-CxzCAyBv.js","./python-B6aJPvgy.js","./r-Dspwwk_N.js","./marko-DjSrsDqO.js","./less-B1dDrJ26.js","./mdc-DTYItulj.js","./markdown-Cvjx9yec.js","./php-R6g_5hLQ.js","./pug-DKIMFp6K.js","./svelte-Cy7k_4gC.js","./ts-tags-DQrlYJgV.js","./vue-D2xRrEX4.js","./vue-html-AaS7Mt5G.js","./vue-vine-BoDAl6tE.js","./stylus-BEDo0Tqx.js","./dagre-KLK3FWXG-BzrpmYZL.js","./graph-B0qCsau1.js","./_baseUniq-Bic_0Ku1.js","./layout-DuulVMp8.js","./_basePickBy-qZfmOA0w.js","./clone-DfJVhmv7.js","./cose-bilkent-S5V4N54A-BrtHBM6x.js","./cytoscape.esm-BQaXIfA_.js","./c4Diagram-IC4MRINW-kYgaGoR6.js","./chunk-JSJVCQXG-BsVoy3Ui.js","./flowDiagram-PKNHOUZH-Dfb4F2Jr.js","./chunk-FMBD7UC4-BYYKYT48.js","./chunk-55IACEB6-Ct3rpton.js","./chunk-KX2RTZJC-CicUJ_9h.js","./channel-BPhEc6il.js","./erDiagram-INFDFZHY-DQKdSExU.js","./gitGraphDiagram-K3NZZRJ6-DF1ng26T.js","./chunk-4BX2VUAB-g9fQ-S69.js","./chunk-QZHKN3VN-DrBpz-k_.js","./treemap-KZPCXAKY-B-TU24Ni.js","./ganttDiagram-A5KZAMGK-C9pvM7B0.js","./linear-BdWH0fqS.js","./defaultLocale-DX6XiGOO.js","./infoDiagram-LFFYTUFH-DqktoSKY.js","./pieDiagram-SKSYHLDU-C2dg01pY.js","./arc-CEc8Gtj6.js","./quadrantDiagram-337W2JSQ-Ci0HHhZZ.js","./xychartDiagram-JWTSCODW-BgRI_wmA.js","./requirementDiagram-Z7DCOOCP-Cpa6xzfS.js","./sequenceDiagram-2WXFIKYE-DFR_JRAl.js","./classDiagram-VBA2DB6C-COYaHGot.js","./chunk-WL4C6EOR-D2_sBPE_.js","./classDiagram-v2-RAHNMMFH-COYaHGot.js","./stateDiagram-RAJIS63D-DjS0hYUM.js","./chunk-NQ4KR5QH-Yvo4cuvD.js","./stateDiagram-v2-FVOUBMTO-DXwakUby.js","./journeyDiagram-4ABVD52K-C1XiiAHp.js","./timeline-definition-YZTLITO2-74ZokkIK.js","./mindmap-definition-YRQLILUH-CP7IM4ly.js","./kanban-definition-K7BYSVSG-Bnl3u8lM.js","./diagram-P4PSJMXO-BqgEtSgl.js","./diagram-IFDJBPK2-Dqsr0-8e.js","./blockDiagram-WCTKOSBZ-sCUOeM9Y.js","./architectureDiagram-2XIMDMQ5-BU1Io8ja.js","./diagram-E7M64L7V-BlNFSjWJ.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./angular-html-DA-rfuFy.js","./html-pp8916En.js","./javascript-wDzz0qaB.js","./css-CLj8gQPS.js","./angular-ts-BrjP3tb8.js","./scss-D5BDwBP9.js","./astro-HNnZUWAn.js","./json-Cp-IABpG.js","./typescript-BPQ3VLAy.js","./postcss-CXtECtnM.js","./tsx-COt5Ahok.js","./blade-BjGOyj-B.js","./html-derivative-DlHx6ybY.js","./xml-sdJ4AIDG.js","./java-CylS5w8V.js","./sql-BLtJtn59.js","./coffee-Ch7k5sss.js","./cpp-CofmeUqb.js","./regexp-CDVJQ6XC.js","./glsl-DplSGwfg.js","./c-BIGW1oBm.js","./graphql-ChdNCCLP.js","./jsx-g9-lgVsj.js","./haml-D5jkg6IW.js","./handlebars-BpdQsYii.js","./yaml-Buea-lGh.js","./http-jrhK8wxY.js","./shellscript-Yzrsuije.js","./hurl-irOxFIW8.js","./csv-fuZLfV_i.js","./jinja-f2NsQr07.js","./jison-wvAkD_A8.js","./julia-CxzCAyBv.js","./python-B6aJPvgy.js","./r-Dspwwk_N.js","./marko-DjSrsDqO.js","./less-B1dDrJ26.js","./mdc-DTYItulj.js","./markdown-Cvjx9yec.js","./php-R6g_5hLQ.js","./pug-DKIMFp6K.js","./svelte-Cy7k_4gC.js","./ts-tags-DQrlYJgV.js","./vue-D2xRrEX4.js","./vue-html-AaS7Mt5G.js","./vue-vine-BoDAl6tE.js","./stylus-BEDo0Tqx.js","./dagre-KLK3FWXG-DKlMzH-N.js","./graph-C1Tddpva.js","./_baseUniq-7iT7EHp3.js","./layout-DCm16DY0.js","./_basePickBy-BOlYaE1w.js","./clone-BbelQPTZ.js","./cose-bilkent-S5V4N54A-_u0YnyBo.js","./cytoscape.esm-BQaXIfA_.js","./c4Diagram-IC4MRINW-BxuZtyKK.js","./chunk-JSJVCQXG-2eTi0-s7.js","./flowDiagram-PKNHOUZH-CB9agj4M.js","./chunk-FMBD7UC4-Cjpu7XH8.js","./chunk-55IACEB6-CrXW5I_d.js","./chunk-KX2RTZJC-D3Wqa_Cx.js","./channel-C5J0dtJR.js","./erDiagram-INFDFZHY-tdSesr0u.js","./gitGraphDiagram-K3NZZRJ6-DQg4IHrW.js","./chunk-4BX2VUAB-DjAJy1Vd.js","./chunk-QZHKN3VN-DNsJlDXv.js","./treemap-KZPCXAKY-BtSSaAdi.js","./ganttDiagram-A5KZAMGK-C4SghQ4X.js","./linear-DW69pMXl.js","./defaultLocale-DX6XiGOO.js","./infoDiagram-LFFYTUFH-DeZ8U7_l.js","./pieDiagram-SKSYHLDU-C3MRIn-U.js","./arc-CrJP2NK-.js","./quadrantDiagram-337W2JSQ-DqSCsLTu.js","./xychartDiagram-JWTSCODW-BMnEKAac.js","./requirementDiagram-Z7DCOOCP-PVnN4DIw.js","./sequenceDiagram-2WXFIKYE-Z0iLTIan.js","./classDiagram-VBA2DB6C-CJR8ILFD.js","./chunk-WL4C6EOR-Co9yEaXx.js","./classDiagram-v2-RAHNMMFH-CJR8ILFD.js","./stateDiagram-RAJIS63D-DZ9Qstd6.js","./chunk-NQ4KR5QH-DPLTGbc2.js","./stateDiagram-v2-FVOUBMTO-CI244ggG.js","./journeyDiagram-4ABVD52K-DMUpxgrL.js","./timeline-definition-YZTLITO2-HqkKyQAQ.js","./mindmap-definition-YRQLILUH-BTzb4KqR.js","./kanban-definition-K7BYSVSG-8tciWF1Y.js","./diagram-P4PSJMXO-7fmmLg7E.js","./diagram-IFDJBPK2-x4UfB8Jh.js","./blockDiagram-WCTKOSBZ-DjpfTolF.js","./architectureDiagram-2XIMDMQ5-CTXTLOZg.js","./diagram-E7M64L7V-DXqyTn3i.js"])))=>i.map(i=>d[i]);
2
2
  var Ife=Object.defineProperty;var Bfe=(e,r,n)=>r in e?Ife(e,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[r]=n;var Ke=(e,r,n)=>Bfe(e,typeof r!="symbol"?r+"":r,n);function zfe(e,r){for(var n=0;n<r.length;n++){const i=r[n];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in e)){const a=Object.getOwnPropertyDescriptor(i,s);a&&Object.defineProperty(e,s,a.get?a:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const r=document.createElement("link").relList;if(r&&r.supports&&r.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function i(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();function my(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function pxt(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var r=e.default;if(typeof r=="function"){var n=function i(){return this instanceof i?Reflect.construct(r,arguments,this.constructor):r.apply(this,arguments)};n.prototype=r.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(i){var s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(n,i,s.get?s:{enumerable:!0,get:function(){return e[i]}})}),n}var Y6={exports:{}},kb={};/**
3
3
  * @license React
4
4
  * react-jsx-runtime.production.js
@@ -934,7 +934,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
934
934
  monaco.config({ paths: { vs: '...' } })
935
935
 
936
936
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
937
- `},uF=O$e(L$e)(Jee),$$e={config:R$e},D$e=function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return function(s){return n.reduceRight(function(a,o){return o(a)},s)}};function Zee(e,r){return Object.keys(r).forEach(function(n){r[n]instanceof Object&&e[n]&&Object.assign(r[n],Zee(e[n],r[n]))}),oF(oF({},e),r)}var I$e={type:"cancelation",msg:"operation is manually canceled"};function PE(e){var r=!1,n=new Promise(function(i,s){e.then(function(a){return r?s(I$e):i(a)}),e.catch(s)});return n.cancel=function(){return r=!0},n}var B$e=["monaco"],z$e=E$e.create({config:A$e,isInitialized:!1,resolve:null,reject:null,monaco:null}),Qee=d$e(z$e,2),ck=Qee[0],kN=Qee[1];function F$e(e){var r=$$e.config(e),n=r.monaco,i=c$e(r,B$e);kN(function(s){return{config:Zee(s.config,i),monaco:n}})}function H$e(){var e=ck(function(r){var n=r.monaco,i=r.isInitialized,s=r.resolve;return{monaco:n,isInitialized:i,resolve:s}});if(!e.isInitialized){if(kN({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),PE(LE);if(window.monaco&&window.monaco.editor)return ete(window.monaco),e.resolve(window.monaco),PE(LE);D$e(W$e,V$e)(q$e)}return PE(LE)}function W$e(e){return document.body.appendChild(e)}function U$e(e){var r=document.createElement("script");return e&&(r.src=e),r}function V$e(e){var r=ck(function(i){var s=i.config,a=i.reject;return{config:s,reject:a}}),n=U$e("".concat(r.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=r.reject,n}function q$e(){var e=ck(function(n){var i=n.config,s=n.resolve,a=n.reject;return{config:i,resolve:s,reject:a}}),r=window.require;r.config(e.config),r(["vs/editor/editor.main"],function(n){var i=n.m||n;ete(i),e.resolve(i)},function(n){e.reject(n)})}function ete(e){ck().monaco||kN({monaco:e})}function G$e(){return ck(function(e){var r=e.monaco;return r})}var LE=new Promise(function(e,r){return kN({resolve:e,reject:r})}),CN={config:F$e,init:H$e,__getMonacoInstance:G$e};const tte=Object.freeze(JSON.parse('{"colors":{"actionBar.toggledBackground":"#383a49","activityBarBadge.background":"#007ACC","checkbox.border":"#6B6B6B","editor.background":"#1E1E1E","editor.foreground":"#D4D4D4","editor.inactiveSelectionBackground":"#3A3D41","editor.selectionHighlightBackground":"#ADD6FF26","editorIndentGuide.activeBackground1":"#707070","editorIndentGuide.background1":"#404040","input.placeholderForeground":"#A6A6A6","list.activeSelectionIconForeground":"#FFF","list.dropBackground":"#383B3D","menu.background":"#252526","menu.border":"#454545","menu.foreground":"#CCCCCC","menu.selectionBackground":"#0078d4","menu.separatorBackground":"#454545","ports.iconRunningProcessForeground":"#369432","sideBarSectionHeader.background":"#0000","sideBarSectionHeader.border":"#ccc3","sideBarTitle.foreground":"#BBBBBB","statusBarItem.remoteBackground":"#16825D","statusBarItem.remoteForeground":"#FFF","tab.lastPinnedBorder":"#ccc3","tab.selectedBackground":"#222222","tab.selectedForeground":"#ffffffa0","terminal.inactiveSelectionBackground":"#3A3D41","widget.border":"#303031"},"displayName":"Dark Plus","name":"dark-plus","semanticHighlighting":true,"semanticTokenColors":{"customLiteral":"#DCDCAA","newOperator":"#C586C0","numberLiteral":"#b5cea8","stringLiteral":"#ce9178"},"tokenColors":[{"scope":["meta.embedded","source.groovy.embedded","string meta.image.inline.markdown","variable.legacy.builtin.python"],"settings":{"foreground":"#D4D4D4"}},{"scope":"emphasis","settings":{"fontStyle":"italic"}},{"scope":"strong","settings":{"fontStyle":"bold"}},{"scope":"header","settings":{"foreground":"#000080"}},{"scope":"comment","settings":{"foreground":"#6A9955"}},{"scope":"constant.language","settings":{"foreground":"#569cd6"}},{"scope":["constant.numeric","variable.other.enummember","keyword.operator.plus.exponent","keyword.operator.minus.exponent"],"settings":{"foreground":"#b5cea8"}},{"scope":"constant.regexp","settings":{"foreground":"#646695"}},{"scope":"entity.name.tag","settings":{"foreground":"#569cd6"}},{"scope":["entity.name.tag.css","entity.name.tag.less"],"settings":{"foreground":"#d7ba7d"}},{"scope":"entity.other.attribute-name","settings":{"foreground":"#9cdcfe"}},{"scope":["entity.other.attribute-name.class.css","source.css entity.other.attribute-name.class","entity.other.attribute-name.id.css","entity.other.attribute-name.parent-selector.css","entity.other.attribute-name.parent.less","source.css entity.other.attribute-name.pseudo-class","entity.other.attribute-name.pseudo-element.css","source.css.less entity.other.attribute-name.id","entity.other.attribute-name.scss"],"settings":{"foreground":"#d7ba7d"}},{"scope":"invalid","settings":{"foreground":"#f44747"}},{"scope":"markup.underline","settings":{"fontStyle":"underline"}},{"scope":"markup.bold","settings":{"fontStyle":"bold","foreground":"#569cd6"}},{"scope":"markup.heading","settings":{"fontStyle":"bold","foreground":"#569cd6"}},{"scope":"markup.italic","settings":{"fontStyle":"italic"}},{"scope":"markup.strikethrough","settings":{"fontStyle":"strikethrough"}},{"scope":"markup.inserted","settings":{"foreground":"#b5cea8"}},{"scope":"markup.deleted","settings":{"foreground":"#ce9178"}},{"scope":"markup.changed","settings":{"foreground":"#569cd6"}},{"scope":"punctuation.definition.quote.begin.markdown","settings":{"foreground":"#6A9955"}},{"scope":"punctuation.definition.list.begin.markdown","settings":{"foreground":"#6796e6"}},{"scope":"markup.inline.raw","settings":{"foreground":"#ce9178"}},{"scope":"punctuation.definition.tag","settings":{"foreground":"#808080"}},{"scope":["meta.preprocessor","entity.name.function.preprocessor"],"settings":{"foreground":"#569cd6"}},{"scope":"meta.preprocessor.string","settings":{"foreground":"#ce9178"}},{"scope":"meta.preprocessor.numeric","settings":{"foreground":"#b5cea8"}},{"scope":"meta.structure.dictionary.key.python","settings":{"foreground":"#9cdcfe"}},{"scope":"meta.diff.header","settings":{"foreground":"#569cd6"}},{"scope":"storage","settings":{"foreground":"#569cd6"}},{"scope":"storage.type","settings":{"foreground":"#569cd6"}},{"scope":["storage.modifier","keyword.operator.noexcept"],"settings":{"foreground":"#569cd6"}},{"scope":["string","meta.embedded.assembly"],"settings":{"foreground":"#ce9178"}},{"scope":"string.tag","settings":{"foreground":"#ce9178"}},{"scope":"string.value","settings":{"foreground":"#ce9178"}},{"scope":"string.regexp","settings":{"foreground":"#d16969"}},{"scope":["punctuation.definition.template-expression.begin","punctuation.definition.template-expression.end","punctuation.section.embedded"],"settings":{"foreground":"#569cd6"}},{"scope":["meta.template.expression"],"settings":{"foreground":"#d4d4d4"}},{"scope":["support.type.vendored.property-name","support.type.property-name","source.css variable","source.coffee.embedded"],"settings":{"foreground":"#9cdcfe"}},{"scope":"keyword","settings":{"foreground":"#569cd6"}},{"scope":"keyword.control","settings":{"foreground":"#569cd6"}},{"scope":"keyword.operator","settings":{"foreground":"#d4d4d4"}},{"scope":["keyword.operator.new","keyword.operator.expression","keyword.operator.cast","keyword.operator.sizeof","keyword.operator.alignof","keyword.operator.typeid","keyword.operator.alignas","keyword.operator.instanceof","keyword.operator.logical.python","keyword.operator.wordlike"],"settings":{"foreground":"#569cd6"}},{"scope":"keyword.other.unit","settings":{"foreground":"#b5cea8"}},{"scope":["punctuation.section.embedded.begin.php","punctuation.section.embedded.end.php"],"settings":{"foreground":"#569cd6"}},{"scope":"support.function.git-rebase","settings":{"foreground":"#9cdcfe"}},{"scope":"constant.sha.git-rebase","settings":{"foreground":"#b5cea8"}},{"scope":["storage.modifier.import.java","variable.language.wildcard.java","storage.modifier.package.java"],"settings":{"foreground":"#d4d4d4"}},{"scope":"variable.language","settings":{"foreground":"#569cd6"}},{"scope":["entity.name.function","support.function","support.constant.handlebars","source.powershell variable.other.member","entity.name.operator.custom-literal"],"settings":{"foreground":"#DCDCAA"}},{"scope":["support.class","support.type","entity.name.type","entity.name.namespace","entity.other.attribute","entity.name.scope-resolution","entity.name.class","storage.type.numeric.go","storage.type.byte.go","storage.type.boolean.go","storage.type.string.go","storage.type.uintptr.go","storage.type.error.go","storage.type.rune.go","storage.type.cs","storage.type.generic.cs","storage.type.modifier.cs","storage.type.variable.cs","storage.type.annotation.java","storage.type.generic.java","storage.type.java","storage.type.object.array.java","storage.type.primitive.array.java","storage.type.primitive.java","storage.type.token.java","storage.type.groovy","storage.type.annotation.groovy","storage.type.parameters.groovy","storage.type.generic.groovy","storage.type.object.array.groovy","storage.type.primitive.array.groovy","storage.type.primitive.groovy"],"settings":{"foreground":"#4EC9B0"}},{"scope":["meta.type.cast.expr","meta.type.new.expr","support.constant.math","support.constant.dom","support.constant.json","entity.other.inherited-class","punctuation.separator.namespace.ruby"],"settings":{"foreground":"#4EC9B0"}},{"scope":["keyword.control","source.cpp keyword.operator.new","keyword.operator.delete","keyword.other.using","keyword.other.directive.using","keyword.other.operator","entity.name.operator"],"settings":{"foreground":"#C586C0"}},{"scope":["variable","meta.definition.variable.name","support.variable","entity.name.variable","constant.other.placeholder"],"settings":{"foreground":"#9CDCFE"}},{"scope":["variable.other.constant","variable.other.enummember"],"settings":{"foreground":"#4FC1FF"}},{"scope":["meta.object-literal.key"],"settings":{"foreground":"#9CDCFE"}},{"scope":["support.constant.property-value","support.constant.font-name","support.constant.media-type","support.constant.media","constant.other.color.rgb-value","constant.other.rgb-value","support.constant.color"],"settings":{"foreground":"#CE9178"}},{"scope":["punctuation.definition.group.regexp","punctuation.definition.group.assertion.regexp","punctuation.definition.character-class.regexp","punctuation.character.set.begin.regexp","punctuation.character.set.end.regexp","keyword.operator.negation.regexp","support.other.parenthesis.regexp"],"settings":{"foreground":"#CE9178"}},{"scope":["constant.character.character-class.regexp","constant.other.character-class.set.regexp","constant.other.character-class.regexp","constant.character.set.regexp"],"settings":{"foreground":"#d16969"}},{"scope":["keyword.operator.or.regexp","keyword.control.anchor.regexp"],"settings":{"foreground":"#DCDCAA"}},{"scope":"keyword.operator.quantifier.regexp","settings":{"foreground":"#d7ba7d"}},{"scope":["constant.character","constant.other.option"],"settings":{"foreground":"#569cd6"}},{"scope":"constant.character.escape","settings":{"foreground":"#d7ba7d"}},{"scope":"entity.name.label","settings":{"foreground":"#C8C8C8"}}],"type":"dark"}')),K$e=Object.freeze(Object.defineProperty({__proto__:null,default:tte},Symbol.toStringTag,{value:"Module"})),Y$e=["editor theme","vscode theme","monaco theme","workbench colors"],$E=new Set,Hw="dark-plus",dF=new WeakSet,hF=tte,X$e={"editor.background":"#0B0C0E","editorGutter.background":"#0B0C0E","editorStickyScroll.background":"#0B0C0E","editorStickyScrollGutter.background":"#0B0C0E","minimap.background":"#0B0C0E","editor.lineHighlightBackground":"#151922","editorWidget.background":"#16181D","editorHoverWidget.background":"#16181D","editorWidget.border":"#363B44","editorHoverWidget.border":"#363B44","editorGroupHeader.tabsBackground":"#0B0C0E"},J$e={base:"vs-dark",inherit:!1,rules:[...nte(hF.tokenColors??[]),...iDe()],colors:{...ite(hF.colors??{}),...X$e}};function Z$e(){return Y$e}function rte(e){var r,n;(n=(r=e==null?void 0:e.editor)==null?void 0:r.defineTheme)==null||n.call(r,Hw,J$e)}function Q$e(e){!e||typeof e!="object"||dF.has(e)||(dF.add(e),Promise.all([nt(()=>import("./index-CbK7Sq05.js"),[],import.meta.url),nt(()=>import("./index-bPwc_s9j.js"),[],import.meta.url)]).then(async([{shikiToMonaco:r},{createHighlighter:n}])=>{var l,d,u;const i=e.languages,s=new Set(((l=i==null?void 0:i.getLanguages)==null?void 0:l.call(i).map(h=>h.id))??[]);for(const h of["javascript","typescript","json","css","html","markdown","python","yaml","diff"])s.has(h)||((d=i==null?void 0:i.register)==null||d.call(i,{id:h}),s.add(h));const a=await n({themes:["dark-plus"],langs:["javascript","typescript","jsx","tsx","json","css","html","markdown","python","yaml","diff"]});r(a,e),rte(e);const o=e.editor;typeof document<"u"&&document.documentElement.dataset.monacoTheme===Hw&&((u=o==null?void 0:o.setTheme)==null||u.call(o,Hw))}).catch(r=>{console.error("Failed to initialize Shiki Monaco Dark Plus theme:",r)}))}function eDe(e){var o;const r=tDe(e.text),n=ite(r.colors??{}),i=aDe(r,n),s=((o=r.name)==null?void 0:o.trim())||e.sourceLabel.trim()||"Imported Theme",a=`jait-vscode-${fDe(s)}-${e.id}`;return{id:e.id,name:s,sourceLabel:e.sourceLabel,importedAt:e.importedAt??new Date().toISOString(),colorMode:i,monacoThemeName:a,monacoThemeData:{base:i==="dark"?"vs-dark":"vs",inherit:!0,rules:nte(r.tokenColors??[]),colors:n},cssVariables:sDe(n),rawColors:n,hasInclude:typeof r.include=="string"&&r.include.trim().length>0}}function tDe(e){const r=hDe(dDe(e)),n=JSON.parse(r);if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Theme file must contain a JSON object.");return n}function rDe(e,r){var n;!r||!((n=e==null?void 0:e.editor)!=null&&n.defineTheme)||e.editor.defineTheme(r.monacoThemeName,r.monacoThemeData)}function nDe(e){if(typeof document>"u")return;const r=document.documentElement;r.classList.toggle("dark",e.colorMode==="dark"),r.dataset.monacoTheme=e.monacoThemeName;for(const n of $E)r.style.removeProperty(n);if($E.clear(),!!e.theme)for(const[n,i]of Object.entries(e.theme.cssVariables))r.style.setProperty(n,i),$E.add(n)}function nte(e){var n;const r=[];for(const i of e){const s=i.settings??{},a=oDe(i.scope);if(a.length===0)continue;const o=pF(s.foreground),l=pF(s.background),d=((n=s.fontStyle)==null?void 0:n.trim())||void 0;for(const u of a)r.push({token:u,foreground:o,background:l,fontStyle:d})}return r}function iDe(){return[{token:"",foreground:"D4D4D4",background:"1E1E1E"},{token:"invalid",foreground:"F44747"},{token:"emphasis",fontStyle:"italic"},{token:"strong",fontStyle:"bold"},{token:"comment",foreground:"6A9955"},{token:"constant",foreground:"569CD6"},{token:"number",foreground:"B5CEA8"},{token:"regexp",foreground:"D16969"},{token:"string",foreground:"CE9178"},{token:"string.key.json",foreground:"9CDCFE"},{token:"string.value.json",foreground:"CE9178"},{token:"keyword",foreground:"569CD6"},{token:"keyword.flow",foreground:"C586C0"},{token:"keyword.operator",foreground:"D4D4D4"},{token:"keyword.operator.new",foreground:"C586C0"},{token:"operator",foreground:"D4D4D4"},{token:"type",foreground:"4EC9B0"},{token:"type.identifier",foreground:"4EC9B0"},{token:"class",foreground:"4EC9B0"},{token:"interface",foreground:"4EC9B0"},{token:"enum",foreground:"4EC9B0"},{token:"namespace",foreground:"4EC9B0"},{token:"identifier",foreground:"9CDCFE"},{token:"identifier.function",foreground:"DCDCAA"},{token:"function",foreground:"DCDCAA"},{token:"member",foreground:"DCDCAA"},{token:"method",foreground:"DCDCAA"},{token:"property",foreground:"9CDCFE"},{token:"variable",foreground:"9CDCFE"},{token:"variable.parameter",foreground:"9CDCFE"},{token:"parameter",foreground:"9CDCFE"},{token:"delimiter",foreground:"D4D4D4"},{token:"delimiter.html",foreground:"808080"},{token:"delimiter.xml",foreground:"808080"},{token:"tag",foreground:"569CD6"},{token:"attribute.name",foreground:"9CDCFE"},{token:"attribute.value",foreground:"CE9178"}]}function sDe(e){const r={},n=li(e,["editor.background","sideBar.background","panel.background"]),i=li(e,["editor.foreground","foreground"]),s=li(e,["sideBar.background","panel.background","editorWidget.background"]),a=li(e,["panel.background","tab.inactiveBackground","editorGroupHeader.tabsBackground"]),o=li(e,["list.hoverBackground","tab.activeBackground","editor.lineHighlightBackground"]),l=li(e,["button.background","focusBorder","textLink.foreground"]),d=li(e,["widget.border","panel.border","sideBar.border","contrastBorder"]);Li(r,"--background",n),Li(r,"--foreground",i),Li(r,"--card",s),Li(r,"--card-foreground",li(e,["sideBar.foreground","foreground"])??i),Li(r,"--popover",li(e,["editorWidget.background","panel.background"])??s),Li(r,"--popover-foreground",li(e,["editorWidget.foreground","foreground"])??i),Li(r,"--primary",l),Li(r,"--primary-foreground",fF(l)),Li(r,"--secondary",li(e,["tab.inactiveBackground","panel.background"])??a),Li(r,"--secondary-foreground",li(e,["tab.inactiveForeground","foreground"])??i),Li(r,"--muted",a),Li(r,"--muted-foreground",li(e,["descriptionForeground","input.placeholderForeground","disabledForeground"])),Li(r,"--accent",o),Li(r,"--accent-foreground",li(e,["list.activeSelectionForeground","foreground"])??i),Li(r,"--destructive",li(e,["inputValidation.errorBackground","errorForeground","list.errorForeground"])),Li(r,"--destructive-foreground",fF(li(e,["inputValidation.errorBackground","errorForeground"]))),Li(r,"--border",d),Li(r,"--input",li(e,["input.background","editorWidget.background","dropdown.background"])??d),Li(r,"--ring",li(e,["focusBorder","button.background","textLink.foreground"])??l),Li(r,"--scrollbar-track",li(e,["editor.background","sideBar.background","panel.background"])??n),Li(r,"--scrollbar-thumb",li(e,["scrollbarSlider.background","scrollbar.shadow"])),Li(r,"--scrollbar-thumb-hover",li(e,["scrollbarSlider.hoverBackground","scrollbarSlider.activeBackground","scrollbarSlider.background"])),Li(r,"--toast-bg",li(e,["notifications.background","editorWidget.background","panel.background"])??s,!0),Li(r,"--toast-border",li(e,["notifications.border","widget.border","panel.border"])??d,!0),Li(r,"--toast-success-accent",li(e,["testing.iconPassed","terminal.ansiGreen"])),Li(r,"--toast-info-accent",li(e,["textLink.foreground","focusBorder"])??l),Li(r,"--toast-warning-accent",li(e,["editorWarning.foreground","terminal.ansiYellow"])),Li(r,"--toast-error-accent",li(e,["editorError.foreground","terminal.ansiRed"]));const u=li(e,["editorGroupHeader.tabsBackground","tab.inactiveBackground","sideBar.background"]);u&&(r["--tab-bg"]=u);const h=li(e,["activityBarBadge.background","button.background","focusBorder"]),f=li(e,["textLink.foreground","terminal.ansiBlue"]),g=li(e,["editorWarning.foreground","terminal.ansiYellow"]),v=li(e,["terminal.ansiMagenta","badge.background"]);return h&&(r["--ctx-system"]=h),f&&(r["--ctx-history"]=f),g&&(r["--ctx-tool-results"]=g),v&&(r["--ctx-tools"]=v),r}function Li(e,r,n,i=!1){if(!n)return;const s=lDe(n,i);s&&(e[r]=s)}function fF(e){const r=V9(e);return r?(.2126*r.r+.7152*r.g+.0722*r.b)/255>.55?"0 0% 7%":"0 0% 100%":null}function aDe(e,r){if(e.type==="light"||e.type==="hc-light")return"light";if(e.type==="dark"||e.type==="hc-dark")return"dark";const n=V9(r["editor.background"]??r["sideBar.background"]??"");return n&&(.2126*n.r+.7152*n.g+.0722*n.b)/255>.55?"light":"dark"}function ite(e){const r={};for(const[n,i]of Object.entries(e))typeof i=="string"&&i.trim()&&(r[n]=i.trim());return r}function oDe(e){return Array.isArray(e)?e.flatMap(r=>r.split(",")).map(r=>r.trim()).filter(Boolean):typeof e!="string"?[]:e.split(",").map(r=>r.trim()).filter(Boolean)}function pF(e){if(!e)return;const r=e.trim();if(r.startsWith("#"))return ste(r).slice(1)}function li(e,r){for(const n of r){const i=e[n];if(typeof i=="string"&&i.trim())return i.trim()}return null}function lDe(e,r=!1){const n=V9(e);if(!n)return null;const i=n.r/255,s=n.g/255,a=n.b/255,o=Math.max(i,s,a),l=Math.min(i,s,a),d=o-l,u=(o+l)/2;let h=0;d!==0&&(o===i?h=(s-a)/d%6:o===s?h=(a-i)/d+2:h=(i-s)/d+4,h*=60),h<0&&(h+=360);const f=d===0?0:d/(1-Math.abs(2*u-1)),g=`${Math.round(h)} ${Math.round(f*100)}% ${Math.round(u*100)}%`;return r&&n.a<1?`${g} / ${Number(n.a.toFixed(3))}`:g}function V9(e){if(!e)return null;const r=e.trim();if(!r)return null;if(r.startsWith("#"))return cDe(r);const n=r.match(/^rgba?\(([^)]+)\)$/i);if(!n)return null;const i=n[1].split(",").map(d=>d.trim());if(i.length<3)return null;const s=DE(i[0]),a=DE(i[1]),o=DE(i[2]),l=i[3]==null?1:uDe(i[3]);return s==null||a==null||o==null||l==null?null:{r:s,g:a,b:o,a:l}}function cDe(e){const r=ste(e).slice(1);return r.length===6?{r:Number.parseInt(r.slice(0,2),16),g:Number.parseInt(r.slice(2,4),16),b:Number.parseInt(r.slice(4,6),16),a:1}:r.length===8?{r:Number.parseInt(r.slice(0,2),16),g:Number.parseInt(r.slice(2,4),16),b:Number.parseInt(r.slice(4,6),16),a:Number.parseInt(r.slice(6,8),16)/255}:null}function DE(e){if(e.endsWith("%")){const n=Number.parseFloat(e.slice(0,-1));return Number.isFinite(n)?mF(Math.round(n/100*255)):null}const r=Number.parseFloat(e);return Number.isFinite(r)?mF(Math.round(r)):null}function uDe(e){const r=Number.parseFloat(e);return Number.isFinite(r)?Math.max(0,Math.min(1,r)):null}function mF(e){return Math.max(0,Math.min(255,e))}function ste(e){const r=e.trim().slice(1);return r.length===3||r.length===4?`#${r.split("").map(n=>`${n}${n}`).join("").toLowerCase()}`:`#${r.toLowerCase()}`}function dDe(e){let r="",n=!1,i=!1,s=!1,a=!1;for(let o=0;o<e.length;o+=1){const l=e[o],d=e[o+1];if(i){l===`
937
+ `},uF=O$e(L$e)(Jee),$$e={config:R$e},D$e=function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return function(s){return n.reduceRight(function(a,o){return o(a)},s)}};function Zee(e,r){return Object.keys(r).forEach(function(n){r[n]instanceof Object&&e[n]&&Object.assign(r[n],Zee(e[n],r[n]))}),oF(oF({},e),r)}var I$e={type:"cancelation",msg:"operation is manually canceled"};function PE(e){var r=!1,n=new Promise(function(i,s){e.then(function(a){return r?s(I$e):i(a)}),e.catch(s)});return n.cancel=function(){return r=!0},n}var B$e=["monaco"],z$e=E$e.create({config:A$e,isInitialized:!1,resolve:null,reject:null,monaco:null}),Qee=d$e(z$e,2),ck=Qee[0],kN=Qee[1];function F$e(e){var r=$$e.config(e),n=r.monaco,i=c$e(r,B$e);kN(function(s){return{config:Zee(s.config,i),monaco:n}})}function H$e(){var e=ck(function(r){var n=r.monaco,i=r.isInitialized,s=r.resolve;return{monaco:n,isInitialized:i,resolve:s}});if(!e.isInitialized){if(kN({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),PE(LE);if(window.monaco&&window.monaco.editor)return ete(window.monaco),e.resolve(window.monaco),PE(LE);D$e(W$e,V$e)(q$e)}return PE(LE)}function W$e(e){return document.body.appendChild(e)}function U$e(e){var r=document.createElement("script");return e&&(r.src=e),r}function V$e(e){var r=ck(function(i){var s=i.config,a=i.reject;return{config:s,reject:a}}),n=U$e("".concat(r.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=r.reject,n}function q$e(){var e=ck(function(n){var i=n.config,s=n.resolve,a=n.reject;return{config:i,resolve:s,reject:a}}),r=window.require;r.config(e.config),r(["vs/editor/editor.main"],function(n){var i=n.m||n;ete(i),e.resolve(i)},function(n){e.reject(n)})}function ete(e){ck().monaco||kN({monaco:e})}function G$e(){return ck(function(e){var r=e.monaco;return r})}var LE=new Promise(function(e,r){return kN({resolve:e,reject:r})}),CN={config:F$e,init:H$e,__getMonacoInstance:G$e};const tte=Object.freeze(JSON.parse('{"colors":{"actionBar.toggledBackground":"#383a49","activityBarBadge.background":"#007ACC","checkbox.border":"#6B6B6B","editor.background":"#1E1E1E","editor.foreground":"#D4D4D4","editor.inactiveSelectionBackground":"#3A3D41","editor.selectionHighlightBackground":"#ADD6FF26","editorIndentGuide.activeBackground1":"#707070","editorIndentGuide.background1":"#404040","input.placeholderForeground":"#A6A6A6","list.activeSelectionIconForeground":"#FFF","list.dropBackground":"#383B3D","menu.background":"#252526","menu.border":"#454545","menu.foreground":"#CCCCCC","menu.selectionBackground":"#0078d4","menu.separatorBackground":"#454545","ports.iconRunningProcessForeground":"#369432","sideBarSectionHeader.background":"#0000","sideBarSectionHeader.border":"#ccc3","sideBarTitle.foreground":"#BBBBBB","statusBarItem.remoteBackground":"#16825D","statusBarItem.remoteForeground":"#FFF","tab.lastPinnedBorder":"#ccc3","tab.selectedBackground":"#222222","tab.selectedForeground":"#ffffffa0","terminal.inactiveSelectionBackground":"#3A3D41","widget.border":"#303031"},"displayName":"Dark Plus","name":"dark-plus","semanticHighlighting":true,"semanticTokenColors":{"customLiteral":"#DCDCAA","newOperator":"#C586C0","numberLiteral":"#b5cea8","stringLiteral":"#ce9178"},"tokenColors":[{"scope":["meta.embedded","source.groovy.embedded","string meta.image.inline.markdown","variable.legacy.builtin.python"],"settings":{"foreground":"#D4D4D4"}},{"scope":"emphasis","settings":{"fontStyle":"italic"}},{"scope":"strong","settings":{"fontStyle":"bold"}},{"scope":"header","settings":{"foreground":"#000080"}},{"scope":"comment","settings":{"foreground":"#6A9955"}},{"scope":"constant.language","settings":{"foreground":"#569cd6"}},{"scope":["constant.numeric","variable.other.enummember","keyword.operator.plus.exponent","keyword.operator.minus.exponent"],"settings":{"foreground":"#b5cea8"}},{"scope":"constant.regexp","settings":{"foreground":"#646695"}},{"scope":"entity.name.tag","settings":{"foreground":"#569cd6"}},{"scope":["entity.name.tag.css","entity.name.tag.less"],"settings":{"foreground":"#d7ba7d"}},{"scope":"entity.other.attribute-name","settings":{"foreground":"#9cdcfe"}},{"scope":["entity.other.attribute-name.class.css","source.css entity.other.attribute-name.class","entity.other.attribute-name.id.css","entity.other.attribute-name.parent-selector.css","entity.other.attribute-name.parent.less","source.css entity.other.attribute-name.pseudo-class","entity.other.attribute-name.pseudo-element.css","source.css.less entity.other.attribute-name.id","entity.other.attribute-name.scss"],"settings":{"foreground":"#d7ba7d"}},{"scope":"invalid","settings":{"foreground":"#f44747"}},{"scope":"markup.underline","settings":{"fontStyle":"underline"}},{"scope":"markup.bold","settings":{"fontStyle":"bold","foreground":"#569cd6"}},{"scope":"markup.heading","settings":{"fontStyle":"bold","foreground":"#569cd6"}},{"scope":"markup.italic","settings":{"fontStyle":"italic"}},{"scope":"markup.strikethrough","settings":{"fontStyle":"strikethrough"}},{"scope":"markup.inserted","settings":{"foreground":"#b5cea8"}},{"scope":"markup.deleted","settings":{"foreground":"#ce9178"}},{"scope":"markup.changed","settings":{"foreground":"#569cd6"}},{"scope":"punctuation.definition.quote.begin.markdown","settings":{"foreground":"#6A9955"}},{"scope":"punctuation.definition.list.begin.markdown","settings":{"foreground":"#6796e6"}},{"scope":"markup.inline.raw","settings":{"foreground":"#ce9178"}},{"scope":"punctuation.definition.tag","settings":{"foreground":"#808080"}},{"scope":["meta.preprocessor","entity.name.function.preprocessor"],"settings":{"foreground":"#569cd6"}},{"scope":"meta.preprocessor.string","settings":{"foreground":"#ce9178"}},{"scope":"meta.preprocessor.numeric","settings":{"foreground":"#b5cea8"}},{"scope":"meta.structure.dictionary.key.python","settings":{"foreground":"#9cdcfe"}},{"scope":"meta.diff.header","settings":{"foreground":"#569cd6"}},{"scope":"storage","settings":{"foreground":"#569cd6"}},{"scope":"storage.type","settings":{"foreground":"#569cd6"}},{"scope":["storage.modifier","keyword.operator.noexcept"],"settings":{"foreground":"#569cd6"}},{"scope":["string","meta.embedded.assembly"],"settings":{"foreground":"#ce9178"}},{"scope":"string.tag","settings":{"foreground":"#ce9178"}},{"scope":"string.value","settings":{"foreground":"#ce9178"}},{"scope":"string.regexp","settings":{"foreground":"#d16969"}},{"scope":["punctuation.definition.template-expression.begin","punctuation.definition.template-expression.end","punctuation.section.embedded"],"settings":{"foreground":"#569cd6"}},{"scope":["meta.template.expression"],"settings":{"foreground":"#d4d4d4"}},{"scope":["support.type.vendored.property-name","support.type.property-name","source.css variable","source.coffee.embedded"],"settings":{"foreground":"#9cdcfe"}},{"scope":"keyword","settings":{"foreground":"#569cd6"}},{"scope":"keyword.control","settings":{"foreground":"#569cd6"}},{"scope":"keyword.operator","settings":{"foreground":"#d4d4d4"}},{"scope":["keyword.operator.new","keyword.operator.expression","keyword.operator.cast","keyword.operator.sizeof","keyword.operator.alignof","keyword.operator.typeid","keyword.operator.alignas","keyword.operator.instanceof","keyword.operator.logical.python","keyword.operator.wordlike"],"settings":{"foreground":"#569cd6"}},{"scope":"keyword.other.unit","settings":{"foreground":"#b5cea8"}},{"scope":["punctuation.section.embedded.begin.php","punctuation.section.embedded.end.php"],"settings":{"foreground":"#569cd6"}},{"scope":"support.function.git-rebase","settings":{"foreground":"#9cdcfe"}},{"scope":"constant.sha.git-rebase","settings":{"foreground":"#b5cea8"}},{"scope":["storage.modifier.import.java","variable.language.wildcard.java","storage.modifier.package.java"],"settings":{"foreground":"#d4d4d4"}},{"scope":"variable.language","settings":{"foreground":"#569cd6"}},{"scope":["entity.name.function","support.function","support.constant.handlebars","source.powershell variable.other.member","entity.name.operator.custom-literal"],"settings":{"foreground":"#DCDCAA"}},{"scope":["support.class","support.type","entity.name.type","entity.name.namespace","entity.other.attribute","entity.name.scope-resolution","entity.name.class","storage.type.numeric.go","storage.type.byte.go","storage.type.boolean.go","storage.type.string.go","storage.type.uintptr.go","storage.type.error.go","storage.type.rune.go","storage.type.cs","storage.type.generic.cs","storage.type.modifier.cs","storage.type.variable.cs","storage.type.annotation.java","storage.type.generic.java","storage.type.java","storage.type.object.array.java","storage.type.primitive.array.java","storage.type.primitive.java","storage.type.token.java","storage.type.groovy","storage.type.annotation.groovy","storage.type.parameters.groovy","storage.type.generic.groovy","storage.type.object.array.groovy","storage.type.primitive.array.groovy","storage.type.primitive.groovy"],"settings":{"foreground":"#4EC9B0"}},{"scope":["meta.type.cast.expr","meta.type.new.expr","support.constant.math","support.constant.dom","support.constant.json","entity.other.inherited-class","punctuation.separator.namespace.ruby"],"settings":{"foreground":"#4EC9B0"}},{"scope":["keyword.control","source.cpp keyword.operator.new","keyword.operator.delete","keyword.other.using","keyword.other.directive.using","keyword.other.operator","entity.name.operator"],"settings":{"foreground":"#C586C0"}},{"scope":["variable","meta.definition.variable.name","support.variable","entity.name.variable","constant.other.placeholder"],"settings":{"foreground":"#9CDCFE"}},{"scope":["variable.other.constant","variable.other.enummember"],"settings":{"foreground":"#4FC1FF"}},{"scope":["meta.object-literal.key"],"settings":{"foreground":"#9CDCFE"}},{"scope":["support.constant.property-value","support.constant.font-name","support.constant.media-type","support.constant.media","constant.other.color.rgb-value","constant.other.rgb-value","support.constant.color"],"settings":{"foreground":"#CE9178"}},{"scope":["punctuation.definition.group.regexp","punctuation.definition.group.assertion.regexp","punctuation.definition.character-class.regexp","punctuation.character.set.begin.regexp","punctuation.character.set.end.regexp","keyword.operator.negation.regexp","support.other.parenthesis.regexp"],"settings":{"foreground":"#CE9178"}},{"scope":["constant.character.character-class.regexp","constant.other.character-class.set.regexp","constant.other.character-class.regexp","constant.character.set.regexp"],"settings":{"foreground":"#d16969"}},{"scope":["keyword.operator.or.regexp","keyword.control.anchor.regexp"],"settings":{"foreground":"#DCDCAA"}},{"scope":"keyword.operator.quantifier.regexp","settings":{"foreground":"#d7ba7d"}},{"scope":["constant.character","constant.other.option"],"settings":{"foreground":"#569cd6"}},{"scope":"constant.character.escape","settings":{"foreground":"#d7ba7d"}},{"scope":"entity.name.label","settings":{"foreground":"#C8C8C8"}}],"type":"dark"}')),K$e=Object.freeze(Object.defineProperty({__proto__:null,default:tte},Symbol.toStringTag,{value:"Module"})),Y$e=["editor theme","vscode theme","monaco theme","workbench colors"],$E=new Set,Hw="dark-plus",dF=new WeakSet,hF=tte,X$e={"editor.background":"#0B0C0E","editorGutter.background":"#0B0C0E","editorStickyScroll.background":"#0B0C0E","editorStickyScrollGutter.background":"#0B0C0E","minimap.background":"#0B0C0E","editor.lineHighlightBackground":"#151922","editorWidget.background":"#16181D","editorHoverWidget.background":"#16181D","editorWidget.border":"#363B44","editorHoverWidget.border":"#363B44","editorGroupHeader.tabsBackground":"#0B0C0E"},J$e={base:"vs-dark",inherit:!1,rules:[...nte(hF.tokenColors??[]),...iDe()],colors:{...ite(hF.colors??{}),...X$e}};function Z$e(){return Y$e}function rte(e){var r,n;(n=(r=e==null?void 0:e.editor)==null?void 0:r.defineTheme)==null||n.call(r,Hw,J$e)}function Q$e(e){!e||typeof e!="object"||dF.has(e)||(dF.add(e),Promise.all([nt(()=>import("./index-CBgOcQOv.js"),[],import.meta.url),nt(()=>import("./index-BQW3h_mQ.js"),[],import.meta.url)]).then(async([{shikiToMonaco:r},{createHighlighter:n}])=>{var l,d,u;const i=e.languages,s=new Set(((l=i==null?void 0:i.getLanguages)==null?void 0:l.call(i).map(h=>h.id))??[]);for(const h of["javascript","typescript","json","css","html","markdown","python","yaml","diff"])s.has(h)||((d=i==null?void 0:i.register)==null||d.call(i,{id:h}),s.add(h));const a=await n({themes:["dark-plus"],langs:["javascript","typescript","jsx","tsx","json","css","html","markdown","python","yaml","diff"]});r(a,e),rte(e);const o=e.editor;typeof document<"u"&&document.documentElement.dataset.monacoTheme===Hw&&((u=o==null?void 0:o.setTheme)==null||u.call(o,Hw))}).catch(r=>{console.error("Failed to initialize Shiki Monaco Dark Plus theme:",r)}))}function eDe(e){var o;const r=tDe(e.text),n=ite(r.colors??{}),i=aDe(r,n),s=((o=r.name)==null?void 0:o.trim())||e.sourceLabel.trim()||"Imported Theme",a=`jait-vscode-${fDe(s)}-${e.id}`;return{id:e.id,name:s,sourceLabel:e.sourceLabel,importedAt:e.importedAt??new Date().toISOString(),colorMode:i,monacoThemeName:a,monacoThemeData:{base:i==="dark"?"vs-dark":"vs",inherit:!0,rules:nte(r.tokenColors??[]),colors:n},cssVariables:sDe(n),rawColors:n,hasInclude:typeof r.include=="string"&&r.include.trim().length>0}}function tDe(e){const r=hDe(dDe(e)),n=JSON.parse(r);if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Theme file must contain a JSON object.");return n}function rDe(e,r){var n;!r||!((n=e==null?void 0:e.editor)!=null&&n.defineTheme)||e.editor.defineTheme(r.monacoThemeName,r.monacoThemeData)}function nDe(e){if(typeof document>"u")return;const r=document.documentElement;r.classList.toggle("dark",e.colorMode==="dark"),r.dataset.monacoTheme=e.monacoThemeName;for(const n of $E)r.style.removeProperty(n);if($E.clear(),!!e.theme)for(const[n,i]of Object.entries(e.theme.cssVariables))r.style.setProperty(n,i),$E.add(n)}function nte(e){var n;const r=[];for(const i of e){const s=i.settings??{},a=oDe(i.scope);if(a.length===0)continue;const o=pF(s.foreground),l=pF(s.background),d=((n=s.fontStyle)==null?void 0:n.trim())||void 0;for(const u of a)r.push({token:u,foreground:o,background:l,fontStyle:d})}return r}function iDe(){return[{token:"",foreground:"D4D4D4",background:"1E1E1E"},{token:"invalid",foreground:"F44747"},{token:"emphasis",fontStyle:"italic"},{token:"strong",fontStyle:"bold"},{token:"comment",foreground:"6A9955"},{token:"constant",foreground:"569CD6"},{token:"number",foreground:"B5CEA8"},{token:"regexp",foreground:"D16969"},{token:"string",foreground:"CE9178"},{token:"string.key.json",foreground:"9CDCFE"},{token:"string.value.json",foreground:"CE9178"},{token:"keyword",foreground:"569CD6"},{token:"keyword.flow",foreground:"C586C0"},{token:"keyword.operator",foreground:"D4D4D4"},{token:"keyword.operator.new",foreground:"C586C0"},{token:"operator",foreground:"D4D4D4"},{token:"type",foreground:"4EC9B0"},{token:"type.identifier",foreground:"4EC9B0"},{token:"class",foreground:"4EC9B0"},{token:"interface",foreground:"4EC9B0"},{token:"enum",foreground:"4EC9B0"},{token:"namespace",foreground:"4EC9B0"},{token:"identifier",foreground:"9CDCFE"},{token:"identifier.function",foreground:"DCDCAA"},{token:"function",foreground:"DCDCAA"},{token:"member",foreground:"DCDCAA"},{token:"method",foreground:"DCDCAA"},{token:"property",foreground:"9CDCFE"},{token:"variable",foreground:"9CDCFE"},{token:"variable.parameter",foreground:"9CDCFE"},{token:"parameter",foreground:"9CDCFE"},{token:"delimiter",foreground:"D4D4D4"},{token:"delimiter.html",foreground:"808080"},{token:"delimiter.xml",foreground:"808080"},{token:"tag",foreground:"569CD6"},{token:"attribute.name",foreground:"9CDCFE"},{token:"attribute.value",foreground:"CE9178"}]}function sDe(e){const r={},n=li(e,["editor.background","sideBar.background","panel.background"]),i=li(e,["editor.foreground","foreground"]),s=li(e,["sideBar.background","panel.background","editorWidget.background"]),a=li(e,["panel.background","tab.inactiveBackground","editorGroupHeader.tabsBackground"]),o=li(e,["list.hoverBackground","tab.activeBackground","editor.lineHighlightBackground"]),l=li(e,["button.background","focusBorder","textLink.foreground"]),d=li(e,["widget.border","panel.border","sideBar.border","contrastBorder"]);Li(r,"--background",n),Li(r,"--foreground",i),Li(r,"--card",s),Li(r,"--card-foreground",li(e,["sideBar.foreground","foreground"])??i),Li(r,"--popover",li(e,["editorWidget.background","panel.background"])??s),Li(r,"--popover-foreground",li(e,["editorWidget.foreground","foreground"])??i),Li(r,"--primary",l),Li(r,"--primary-foreground",fF(l)),Li(r,"--secondary",li(e,["tab.inactiveBackground","panel.background"])??a),Li(r,"--secondary-foreground",li(e,["tab.inactiveForeground","foreground"])??i),Li(r,"--muted",a),Li(r,"--muted-foreground",li(e,["descriptionForeground","input.placeholderForeground","disabledForeground"])),Li(r,"--accent",o),Li(r,"--accent-foreground",li(e,["list.activeSelectionForeground","foreground"])??i),Li(r,"--destructive",li(e,["inputValidation.errorBackground","errorForeground","list.errorForeground"])),Li(r,"--destructive-foreground",fF(li(e,["inputValidation.errorBackground","errorForeground"]))),Li(r,"--border",d),Li(r,"--input",li(e,["input.background","editorWidget.background","dropdown.background"])??d),Li(r,"--ring",li(e,["focusBorder","button.background","textLink.foreground"])??l),Li(r,"--scrollbar-track",li(e,["editor.background","sideBar.background","panel.background"])??n),Li(r,"--scrollbar-thumb",li(e,["scrollbarSlider.background","scrollbar.shadow"])),Li(r,"--scrollbar-thumb-hover",li(e,["scrollbarSlider.hoverBackground","scrollbarSlider.activeBackground","scrollbarSlider.background"])),Li(r,"--toast-bg",li(e,["notifications.background","editorWidget.background","panel.background"])??s,!0),Li(r,"--toast-border",li(e,["notifications.border","widget.border","panel.border"])??d,!0),Li(r,"--toast-success-accent",li(e,["testing.iconPassed","terminal.ansiGreen"])),Li(r,"--toast-info-accent",li(e,["textLink.foreground","focusBorder"])??l),Li(r,"--toast-warning-accent",li(e,["editorWarning.foreground","terminal.ansiYellow"])),Li(r,"--toast-error-accent",li(e,["editorError.foreground","terminal.ansiRed"]));const u=li(e,["editorGroupHeader.tabsBackground","tab.inactiveBackground","sideBar.background"]);u&&(r["--tab-bg"]=u);const h=li(e,["activityBarBadge.background","button.background","focusBorder"]),f=li(e,["textLink.foreground","terminal.ansiBlue"]),g=li(e,["editorWarning.foreground","terminal.ansiYellow"]),v=li(e,["terminal.ansiMagenta","badge.background"]);return h&&(r["--ctx-system"]=h),f&&(r["--ctx-history"]=f),g&&(r["--ctx-tool-results"]=g),v&&(r["--ctx-tools"]=v),r}function Li(e,r,n,i=!1){if(!n)return;const s=lDe(n,i);s&&(e[r]=s)}function fF(e){const r=V9(e);return r?(.2126*r.r+.7152*r.g+.0722*r.b)/255>.55?"0 0% 7%":"0 0% 100%":null}function aDe(e,r){if(e.type==="light"||e.type==="hc-light")return"light";if(e.type==="dark"||e.type==="hc-dark")return"dark";const n=V9(r["editor.background"]??r["sideBar.background"]??"");return n&&(.2126*n.r+.7152*n.g+.0722*n.b)/255>.55?"light":"dark"}function ite(e){const r={};for(const[n,i]of Object.entries(e))typeof i=="string"&&i.trim()&&(r[n]=i.trim());return r}function oDe(e){return Array.isArray(e)?e.flatMap(r=>r.split(",")).map(r=>r.trim()).filter(Boolean):typeof e!="string"?[]:e.split(",").map(r=>r.trim()).filter(Boolean)}function pF(e){if(!e)return;const r=e.trim();if(r.startsWith("#"))return ste(r).slice(1)}function li(e,r){for(const n of r){const i=e[n];if(typeof i=="string"&&i.trim())return i.trim()}return null}function lDe(e,r=!1){const n=V9(e);if(!n)return null;const i=n.r/255,s=n.g/255,a=n.b/255,o=Math.max(i,s,a),l=Math.min(i,s,a),d=o-l,u=(o+l)/2;let h=0;d!==0&&(o===i?h=(s-a)/d%6:o===s?h=(a-i)/d+2:h=(i-s)/d+4,h*=60),h<0&&(h+=360);const f=d===0?0:d/(1-Math.abs(2*u-1)),g=`${Math.round(h)} ${Math.round(f*100)}% ${Math.round(u*100)}%`;return r&&n.a<1?`${g} / ${Number(n.a.toFixed(3))}`:g}function V9(e){if(!e)return null;const r=e.trim();if(!r)return null;if(r.startsWith("#"))return cDe(r);const n=r.match(/^rgba?\(([^)]+)\)$/i);if(!n)return null;const i=n[1].split(",").map(d=>d.trim());if(i.length<3)return null;const s=DE(i[0]),a=DE(i[1]),o=DE(i[2]),l=i[3]==null?1:uDe(i[3]);return s==null||a==null||o==null||l==null?null:{r:s,g:a,b:o,a:l}}function cDe(e){const r=ste(e).slice(1);return r.length===6?{r:Number.parseInt(r.slice(0,2),16),g:Number.parseInt(r.slice(2,4),16),b:Number.parseInt(r.slice(4,6),16),a:1}:r.length===8?{r:Number.parseInt(r.slice(0,2),16),g:Number.parseInt(r.slice(2,4),16),b:Number.parseInt(r.slice(4,6),16),a:Number.parseInt(r.slice(6,8),16)/255}:null}function DE(e){if(e.endsWith("%")){const n=Number.parseFloat(e.slice(0,-1));return Number.isFinite(n)?mF(Math.round(n/100*255)):null}const r=Number.parseFloat(e);return Number.isFinite(r)?mF(Math.round(r)):null}function uDe(e){const r=Number.parseFloat(e);return Number.isFinite(r)?Math.max(0,Math.min(1,r)):null}function mF(e){return Math.max(0,Math.min(255,e))}function ste(e){const r=e.trim().slice(1);return r.length===3||r.length===4?`#${r.split("").map(n=>`${n}${n}`).join("").toLowerCase()}`:`#${r.toLowerCase()}`}function dDe(e){let r="",n=!1,i=!1,s=!1,a=!1;for(let o=0;o<e.length;o+=1){const l=e[o],d=e[o+1];if(i){l===`
938
938
  `&&(i=!1,r+=l);continue}if(s){l==="*"&&d==="/"&&(s=!1,o+=1);continue}if(n){r+=l,a?a=!1:l==="\\"?a=!0:l==='"'&&(n=!1);continue}if(l==='"'){n=!0,r+=l;continue}if(l==="/"&&d==="/"){i=!0,o+=1;continue}if(l==="/"&&d==="*"){s=!0,o+=1;continue}r+=l}return r}function hDe(e){return e.replace(/,\s*([}\]])/g,"$1")}function fDe(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"theme"}function gF(){if(typeof document>"u")return"vs";const e=document.documentElement;return e.dataset.monacoTheme??(e.classList.contains("dark")?Hw:"vs")}function uk(){const[e,r]=y.useState(gF);return y.useEffect(()=>{if(typeof document>"u")return;const n=document.documentElement,i=()=>r(gF());i();const s=new MutationObserver(i);return s.observe(n,{attributes:!0,attributeFilter:["class","data-monaco-theme"]}),()=>s.disconnect()},[]),e}const q9="jait:vscode-theme-store",d5=new Set;let nh=ote(),yF=!1;function ate(){if(typeof window>"u")return null;try{return window.localStorage}catch{return null}}function ote(){const e=ate();if(!e)return{importedThemes:[],activeThemeId:null};let r=null;try{r=e.getItem(q9)}catch{return{importedThemes:[],activeThemeId:null}}if(!r)return{importedThemes:[],activeThemeId:null};try{const n=JSON.parse(r),i=Array.isArray(n.importedThemes)?n.importedThemes.filter(a=>!!(a&&typeof a.id=="string"&&typeof a.monacoThemeName=="string")):[],s=typeof n.activeThemeId=="string"?n.activeThemeId:null;return{importedThemes:i,activeThemeId:i.some(a=>a.id===s)?s:null}}catch{return{importedThemes:[],activeThemeId:null}}}function G9(e){nh=e;const r=ate();if(r)try{r.setItem(q9,JSON.stringify(e))}catch{}for(const n of d5)n()}function pDe(e){return!yF&&typeof window<"u"&&(yF=!0,window.addEventListener("storage",r=>{if(r.key===q9){nh=ote();for(const n of d5)n()}})),d5.add(e),()=>d5.delete(e)}function vF(){return nh}function lte(){const e=y.useSyncExternalStore(pDe,vF,vF);return{...e,activeTheme:e.importedThemes.find(r=>r.id===e.activeThemeId)??null}}function cte(){return nh.importedThemes.find(e=>e.id===nh.activeThemeId)??null}function mDe(e,r){const n=`${Date.now().toString(36)}-${vDe(e+r)}`,i=eDe({id:n,sourceLabel:e,text:r});return G9({importedThemes:[...nh.importedThemes.filter(s=>s.id!==n),i],activeThemeId:n}),i}function _j(e){G9({...nh,activeThemeId:e&&nh.importedThemes.some(r=>r.id===e)?e:null})}function gDe(e){G9({importedThemes:nh.importedThemes.filter(r=>r.id!==e),activeThemeId:nh.activeThemeId===e?null:nh.activeThemeId})}function yDe(e){rte(e);const r=cte();r?rDe(e,r):Q$e(e)}function vc(e,r){var n,i;yDe(e),r&&((i=(n=e==null?void 0:e.editor)==null?void 0:n.setTheme)==null||i.call(n,r))}function vDe(e){let r=0;for(let n=0;n<e.length;n+=1)r=(r<<5)-r+e.charCodeAt(n)|0;return Math.abs(r).toString(36)}function M1(e,r){return Math.max(1,e||r||1)}function Ww({original:e,modified:r,language:n,modelKey:i,className:s,editorClassName:a,renderSideBySide:o=!1,emptyMessage:l="Files are identical.",options:d}){const u=y.useRef(null),h=y.useRef(null),f=y.useRef(null),g=y.useRef(null),v=y.useRef({original:null,modified:null}),[b,_]=y.useState(!1),[S,w]=y.useState([]),[C,j]=y.useState(0),E=uk(),A=y.useRef(E);y.useEffect(()=>{A.current=E},[E]);const N=y.useMemo(()=>`inmemory://jait-diff/${encodeURIComponent(i??`${n}:${e.length}:${r.length}`)}`,[n,i,r.length,e.length]),R=y.useMemo(()=>({readOnly:!0,renderSideBySide:o,minimap:{enabled:!1},"semanticHighlighting.enabled":!0,fontSize:13,automaticLayout:!0,scrollBeyondLastLine:!1,renderOverviewRuler:!0,ignoreTrimWhitespace:!1,...d}),[d,o]),B=y.useCallback(()=>{var I;const z=h.current;if(!z)return;const W=((I=z.getLineChanges)==null?void 0:I.call(z))??[];w(W.map(O=>({originalStartLineNumber:O.originalStartLineNumber,originalEndLineNumber:O.originalEndLineNumber,modifiedStartLineNumber:O.modifiedStartLineNumber,modifiedEndLineNumber:O.modifiedEndLineNumber})))},[]);y.useEffect(()=>{let z=!1;const W=CN.init();return W.then(I=>{if(z||!u.current)return;f.current=I,vc(I,A.current);const O=I.editor.createDiffEditor(u.current,{automaticLayout:!0,...R});h.current=O,g.current=O.onDidUpdateDiff(()=>B()),_(!0),B()}).catch(I=>{!z&&(I==null?void 0:I.type)!=="cancelation"&&console.error("Monaco initialization: error:",I)}),()=>{var D,P,$,V,K,F;z=!0,(D=g.current)==null||D.dispose(),g.current=null;const I=h.current,O=v.current;try{I==null||I.setModel(null)}catch{}(P=I==null?void 0:I.dispose)==null||P.call(I),(V=($=O.original)==null?void 0:$.dispose)==null||V.call($),(F=(K=O.modified)==null?void 0:K.dispose)==null||F.call(K),v.current={original:null,modified:null},h.current=null,f.current=null,_(!1),W.cancel()}},[B]),y.useEffect(()=>{j(0)},[e,r,n]),y.useEffect(()=>{var V,K;const z=h.current,W=f.current;if(!b||!z||!W)return;const I=v.current,O=W.Uri.parse(`${N}.original`),D=W.Uri.parse(`${N}.modified`);(V=W.editor.getModel(O))==null||V.dispose(),(K=W.editor.getModel(D))==null||K.dispose();const P=W.editor.createModel(e,n,O),$=W.editor.createModel(r,n,D);return z.setModel({original:P,modified:$}),v.current={original:P,modified:$},B(),()=>{var F,U,Q,q;try{z.setModel(null)}catch{}(U=(F=I.original)==null?void 0:F.dispose)==null||U.call(F),(q=(Q=I.modified)==null?void 0:Q.dispose)==null||q.call(Q),P.dispose(),$.dispose(),(v.current.original===P||v.current.modified===$)&&(v.current={original:null,modified:null})}},[b,n,N,r,e,B]),y.useEffect(()=>{const z=f.current;z&&vc(z,E)},[E]),y.useEffect(()=>{var z,W;(W=(z=h.current)==null?void 0:z.updateOptions)==null||W.call(z,R)},[R]),y.useEffect(()=>{S.length!==0&&j(z=>Math.min(z,S.length-1))},[S]),y.useEffect(()=>{const z=h.current;if(!z||S.length===0)return;const W=S[C];if(!W)return;const I=z.getModifiedEditor(),O=z.getOriginalEditor();try{W.modifiedStartLineNumber>0||W.modifiedEndLineNumber>0?I.revealLineInCenter(M1(W.modifiedStartLineNumber,W.modifiedEndLineNumber)):O.revealLineInCenter(M1(W.originalStartLineNumber,W.originalEndLineNumber))}catch{}},[C,S]),y.useEffect(()=>{const z=h.current,W=f.current;if(!z||!W||S.length===0)return;const I=S[C];if(!I)return;const O=[];(I.originalStartLineNumber>0||I.originalEndLineNumber>0)&&O.push({editor:z.getOriginalEditor(),range:new W.Range(M1(I.originalStartLineNumber,I.originalEndLineNumber),1,M1(I.originalEndLineNumber,I.originalStartLineNumber),1)}),(I.modifiedStartLineNumber>0||I.modifiedEndLineNumber>0)&&O.push({editor:z.getModifiedEditor(),range:new W.Range(M1(I.modifiedStartLineNumber,I.modifiedEndLineNumber),1,M1(I.modifiedEndLineNumber,I.modifiedStartLineNumber),1)});const D=O.map(({editor:P,range:$})=>P.deltaDecorations([],[{range:$,options:{isWholeLine:!0,className:"diff-change-active"}}]));return()=>{var P;for(let $=0;$<O.length;$++)try{(P=O[$])==null||P.editor.deltaDecorations(D[$]??[],[])}catch{}}},[C,S]);const G=y.useCallback(()=>{j(z=>Math.max(z-1,0))},[]),H=y.useCallback(()=>{j(z=>Math.min(z+1,S.length-1))},[S.length]);return c.jsxs("div",{className:Ae("relative min-h-0",s),children:[c.jsx("div",{className:Ae("h-full min-h-0",a),children:c.jsx("div",{ref:u,className:"h-full min-h-0"})}),!b&&c.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-sm text-muted-foreground",children:"Loading diff..."}),S.length>1&&c.jsxs("div",{className:"absolute right-3 top-1/2 z-10 flex -translate-y-1/2 flex-col gap-1.5",children:[c.jsx(we,{size:"sm",variant:"secondary",className:"h-9 w-9 rounded-full border bg-background/90 p-0 shadow-lg backdrop-blur-sm hover:bg-background",onClick:G,disabled:C===0,title:"Previous change",children:c.jsx(mR,{className:"h-5 w-5"})}),c.jsxs("span",{className:"text-center font-medium tabular-nums text-2xs text-muted-foreground",children:[C+1,"/",S.length]}),c.jsx(we,{size:"sm",variant:"secondary",className:"h-9 w-9 rounded-full border bg-background/90 p-0 shadow-lg backdrop-blur-sm hover:bg-background",onClick:H,disabled:C===S.length-1,title:"Next change",children:c.jsx(Dl,{className:"h-5 w-5"})})]}),S.length===0&&e===r&&b&&c.jsx("div",{className:"pointer-events-none absolute inset-x-3 bottom-3 rounded-md border bg-background/90 px-3 py-2 text-center text-xs text-muted-foreground shadow-sm",children:l}),c.jsx("style",{children:`
939
939
  .diff-change-active { outline: 1px solid rgba(99, 102, 241, 0.5); outline-offset: -1px; }
940
940
  `})]})}var xDe={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},IE=xDe,bDe={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},_De=bDe;function wDe({children:e}){return Bt.createElement("div",{style:_De.container},e)}var SDe=wDe,kDe=SDe;function CDe({width:e,height:r,isEditorReady:n,loading:i,_ref:s,className:a,wrapperProps:o}){return Bt.createElement("section",{style:{...IE.wrapper,width:e,height:r},...o},!n&&Bt.createElement(kDe,null,i),Bt.createElement("div",{ref:s,style:{...IE.fullWidth,...!n&&IE.hide},className:a}))}var jDe=CDe,ute=y.memo(jDe);function NDe(e){y.useEffect(e,[])}var dte=NDe;function TDe(e,r,n=!0){let i=y.useRef(!0);y.useEffect(i.current||!n?()=>{i.current=!1}:e,r)}var Yc=TDe;function c2(){}function Z1(e,r,n,i){return EDe(e,i)||ADe(e,r,n,i)}function EDe(e,r){return e.editor.getModel(hte(e,r))}function ADe(e,r,n,i){return e.editor.createModel(r,n,i?hte(e,i):void 0)}function hte(e,r){return e.Uri.parse(r)}function ODe({original:e,modified:r,language:n,originalLanguage:i,modifiedLanguage:s,originalModelPath:a,modifiedModelPath:o,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:d=!1,theme:u="light",loading:h="Loading...",options:f={},height:g="100%",width:v="100%",className:b,wrapperProps:_={},beforeMount:S=c2,onMount:w=c2}){let[C,j]=y.useState(!1),[E,A]=y.useState(!0),N=y.useRef(null),R=y.useRef(null),B=y.useRef(null),G=y.useRef(w),H=y.useRef(S),z=y.useRef(!1);dte(()=>{let D=CN.init();return D.then(P=>(R.current=P)&&A(!1)).catch(P=>(P==null?void 0:P.type)!=="cancelation"&&console.error("Monaco initialization: error:",P)),()=>N.current?O():D.cancel()}),Yc(()=>{if(N.current&&R.current){let D=N.current.getOriginalEditor(),P=Z1(R.current,e||"",i||n||"text",a||"");P!==D.getModel()&&D.setModel(P)}},[a],C),Yc(()=>{if(N.current&&R.current){let D=N.current.getModifiedEditor(),P=Z1(R.current,r||"",s||n||"text",o||"");P!==D.getModel()&&D.setModel(P)}},[o],C),Yc(()=>{let D=N.current.getModifiedEditor();D.getOption(R.current.editor.EditorOption.readOnly)?D.setValue(r||""):r!==D.getValue()&&(D.executeEdits("",[{range:D.getModel().getFullModelRange(),text:r||"",forceMoveMarkers:!0}]),D.pushUndoStop())},[r],C),Yc(()=>{var D,P;(P=(D=N.current)==null?void 0:D.getModel())==null||P.original.setValue(e||"")},[e],C),Yc(()=>{let{original:D,modified:P}=N.current.getModel();R.current.editor.setModelLanguage(D,i||n||"text"),R.current.editor.setModelLanguage(P,s||n||"text")},[n,i,s],C),Yc(()=>{var D;(D=R.current)==null||D.editor.setTheme(u)},[u],C),Yc(()=>{var D;(D=N.current)==null||D.updateOptions(f)},[f],C);let W=y.useCallback(()=>{var $;if(!R.current)return;H.current(R.current);let D=Z1(R.current,e||"",i||n||"text",a||""),P=Z1(R.current,r||"",s||n||"text",o||"");($=N.current)==null||$.setModel({original:D,modified:P})},[n,r,s,e,i,a,o]),I=y.useCallback(()=>{var D;!z.current&&B.current&&(N.current=R.current.editor.createDiffEditor(B.current,{automaticLayout:!0,...f}),W(),(D=R.current)==null||D.editor.setTheme(u),j(!0),z.current=!0)},[f,u,W]);y.useEffect(()=>{C&&G.current(N.current,R.current)},[C]),y.useEffect(()=>{!E&&!C&&I()},[E,C,I]);function O(){var P,$,V,K;let D=(P=N.current)==null?void 0:P.getModel();l||(($=D==null?void 0:D.original)==null||$.dispose()),d||((V=D==null?void 0:D.modified)==null||V.dispose()),(K=N.current)==null||K.dispose()}return Bt.createElement(ute,{width:v,height:g,isEditorReady:C,loading:h,_ref:B,className:b,wrapperProps:_})}var MDe=ODe,RDe=y.memo(MDe);function PDe(e){let r=y.useRef();return y.useEffect(()=>{r.current=e},[e]),r.current}var LDe=PDe,n3=new Map;function $De({defaultValue:e,defaultLanguage:r,defaultPath:n,value:i,language:s,path:a,theme:o="light",line:l,loading:d="Loading...",options:u={},overrideServices:h={},saveViewState:f=!0,keepCurrentModel:g=!1,width:v="100%",height:b="100%",className:_,wrapperProps:S={},beforeMount:w=c2,onMount:C=c2,onChange:j,onValidate:E=c2}){let[A,N]=y.useState(!1),[R,B]=y.useState(!0),G=y.useRef(null),H=y.useRef(null),z=y.useRef(null),W=y.useRef(C),I=y.useRef(w),O=y.useRef(),D=y.useRef(i),P=LDe(a),$=y.useRef(!1),V=y.useRef(!1);dte(()=>{let U=CN.init();return U.then(Q=>(G.current=Q)&&B(!1)).catch(Q=>(Q==null?void 0:Q.type)!=="cancelation"&&console.error("Monaco initialization: error:",Q)),()=>H.current?F():U.cancel()}),Yc(()=>{var Q,q,te,ee;let U=Z1(G.current,e||i||"",r||s||"",a||n||"");U!==((Q=H.current)==null?void 0:Q.getModel())&&(f&&n3.set(P,(q=H.current)==null?void 0:q.saveViewState()),(te=H.current)==null||te.setModel(U),f&&((ee=H.current)==null||ee.restoreViewState(n3.get(a))))},[a],A),Yc(()=>{var U;(U=H.current)==null||U.updateOptions(u)},[u],A),Yc(()=>{!H.current||i===void 0||(H.current.getOption(G.current.editor.EditorOption.readOnly)?H.current.setValue(i):i!==H.current.getValue()&&(V.current=!0,H.current.executeEdits("",[{range:H.current.getModel().getFullModelRange(),text:i,forceMoveMarkers:!0}]),H.current.pushUndoStop(),V.current=!1))},[i],A),Yc(()=>{var Q,q;let U=(Q=H.current)==null?void 0:Q.getModel();U&&s&&((q=G.current)==null||q.editor.setModelLanguage(U,s))},[s],A),Yc(()=>{var U;l!==void 0&&((U=H.current)==null||U.revealLine(l))},[l],A),Yc(()=>{var U;(U=G.current)==null||U.editor.setTheme(o)},[o],A);let K=y.useCallback(()=>{var U;if(!(!z.current||!G.current)&&!$.current){I.current(G.current);let Q=a||n,q=Z1(G.current,i||e||"",r||s||"",Q||"");H.current=(U=G.current)==null?void 0:U.editor.create(z.current,{model:q,automaticLayout:!0,...u},h),f&&H.current.restoreViewState(n3.get(Q)),G.current.editor.setTheme(o),l!==void 0&&H.current.revealLine(l),N(!0),$.current=!0}},[e,r,n,i,s,a,u,h,f,o,l]);y.useEffect(()=>{A&&W.current(H.current,G.current)},[A]),y.useEffect(()=>{!R&&!A&&K()},[R,A,K]),D.current=i,y.useEffect(()=>{var U,Q;A&&j&&((U=O.current)==null||U.dispose(),O.current=(Q=H.current)==null?void 0:Q.onDidChangeModelContent(q=>{V.current||j(H.current.getValue(),q)}))},[A,j]),y.useEffect(()=>{if(A){let U=G.current.editor.onDidChangeMarkers(Q=>{var te;let q=(te=H.current.getModel())==null?void 0:te.uri;if(q&&Q.find(ee=>ee.path===q.path)){let ee=G.current.editor.getModelMarkers({resource:q});E==null||E(ee)}});return()=>{U==null||U.dispose()}}return()=>{}},[A,E]);function F(){var U,Q;(U=O.current)==null||U.dispose(),g?f&&n3.set(a,H.current.saveViewState()):(Q=H.current.getModel())==null||Q.dispose(),H.current.dispose()}return Bt.createElement(ute,{width:v,height:b,isEditorReady:A,loading:d,_ref:z,className:_,wrapperProps:S})}var DDe=$De,IDe=y.memo(DDe),dk=IDe;const BDe=qn();function zDe(){return Gm()}function FDe(e=!1){const r={};e&&(r["Content-Type"]="application/json");const n=zDe();return n&&(r.Authorization=`Bearer ${n}`),r}async function Ki(e,r){const n=await fetch(`${BDe}/api/git/${e}`,{method:"POST",headers:FDe(!0),body:JSON.stringify(r)});if(!n.ok){const i=await n.json().catch(()=>({}));throw new Error(i.error||`Git ${e} failed: ${n.statusText}`)}return n.json()}const $s={status(e,r){return Ki("status",{cwd:e,...r?{branch:r}:{}})},listBranches(e){return Ki("branches",{cwd:e})},pull(e){return Ki("pull",{cwd:e})},sync(e){return Ki("sync",{cwd:e})},fetch(e,r=!1){return Ki("fetch",{cwd:e,all:r})},runStackedAction(e,r,n){return Ki("run-stacked-action",{cwd:e,action:r,...n!=null&&n.commitMessage?{commitMessage:n.commitMessage}:{},...n!=null&&n.featureBranch?{featureBranch:!0}:{},...n!=null&&n.baseBranch?{baseBranch:n.baseBranch}:{}})},checkout(e,r){return Ki("checkout",{cwd:e,branch:r})},createBranch(e,r,n){return Ki("create-branch",{cwd:e,branch:r,baseBranch:n})},discard(e,r){return Ki("discard",{cwd:e,paths:r})},stage(e,r){return Ki("stage",{cwd:e,paths:r})},unstage(e,r){return Ki("unstage",{cwd:e,paths:r})},init(e){return Ki("init",{cwd:e})},diff(e){return Ki("diff",{cwd:e})},diffStats(e,r,n){return Ki("diff-stats",{cwd:e,...r?{baseBranch:r}:{},...n?{branch:n}:{}})},fileDiffs(e,r,n){return Ki("file-diffs",{cwd:e,...r?{baseBranch:r}:{},...n?{branch:n}:{}}).then(i=>i.files)},createWorktree(e,r,n,i){return Ki("create-worktree",{cwd:e,baseBranch:r,newBranch:n,...i?{path:i}:{}})},removeWorktree(e,r,n=!1){return Ki("remove-worktree",{cwd:e,path:r,force:n})},ghStatus(e){return Ki("gh-status",{...e?{cwd:e}:{}})},ghAuth(e,r){return Ki("gh-auth",{token:e,...r?{cwd:r}:{}})},forgeStatus(e,r){return Ki("forge-status",{...e?{cwd:e}:{},...r?{remoteUrl:r}:{}})},forgeAuth(e,r,n){return Ki("forge-auth",{token:e,...r?{cwd:r}:{},...n?{remoteUrl:n}:{}})},forgePrChecks(e,r,n){return Ki("forge-pr-checks",{cwd:e,branch:r,...n?{remoteUrl:n}:{}})},identity(e){return Ki("identity",{cwd:e})},setIdentity(e,r,n){return Ki("identity",{cwd:e,name:r,email:n})},prChecks(e,r){return Ki("pr-checks",{cwd:e,branch:r})},generateCommitMessage(e,r,n){return Ki("generate-commit-message",{cwd:e,...r?{provider:r}:{},...n?{model:n}:{}})}};var fte=Object.defineProperty,X=(e,r)=>fte(e,"name",{value:r,configurable:!0}),HDe=(e,r)=>{for(var n in r)fte(e,n,{get:r[n],enumerable:!0})},tp={trace:0,debug:1,info:2,warn:3,error:4,fatal:5},At={trace:X((...e)=>{},"trace"),debug:X((...e)=>{},"debug"),info:X((...e)=>{},"info"),warn:X((...e)=>{},"warn"),error:X((...e)=>{},"error"),fatal:X((...e)=>{},"fatal")},K9=X(function(e="fatal"){let r=tp.fatal;typeof e=="string"?e.toLowerCase()in tp&&(r=tp[e]):typeof e=="number"&&(r=e),At.trace=()=>{},At.debug=()=>{},At.info=()=>{},At.warn=()=>{},At.error=()=>{},At.fatal=()=>{},r<=tp.fatal&&(At.fatal=console.error?console.error.bind(console,Pu("FATAL"),"color: orange"):console.log.bind(console,"\x1B[35m",Pu("FATAL"))),r<=tp.error&&(At.error=console.error?console.error.bind(console,Pu("ERROR"),"color: orange"):console.log.bind(console,"\x1B[31m",Pu("ERROR"))),r<=tp.warn&&(At.warn=console.warn?console.warn.bind(console,Pu("WARN"),"color: orange"):console.log.bind(console,"\x1B[33m",Pu("WARN"))),r<=tp.info&&(At.info=console.info?console.info.bind(console,Pu("INFO"),"color: lightblue"):console.log.bind(console,"\x1B[34m",Pu("INFO"))),r<=tp.debug&&(At.debug=console.debug?console.debug.bind(console,Pu("DEBUG"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Pu("DEBUG"))),r<=tp.trace&&(At.trace=console.debug?console.debug.bind(console,Pu("TRACE"),"color: lightgreen"):console.log.bind(console,"\x1B[32m",Pu("TRACE")))},"setLogLevel"),Pu=X(e=>`%c${aAe().format("ss.SSS")} : ${e} : `,"format");const h5={min:{r:0,g:0,b:0,s:0,l:0,a:0},max:{r:255,g:255,b:255,h:360,s:100,l:100,a:1},clamp:{r:e=>e>=255?255:e<0?0:e,g:e=>e>=255?255:e<0?0:e,b:e=>e>=255?255:e<0?0:e,h:e=>e%360,s:e=>e>=100?100:e<0?0:e,l:e=>e>=100?100:e<0?0:e,a:e=>e>=1?1:e<0?0:e},toLinear:e=>{const r=e/255;return e>.03928?Math.pow((r+.055)/1.055,2.4):r/12.92},hue2rgb:(e,r,n)=>(n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(r-e)*6*n:n<1/2?r:n<2/3?e+(r-e)*(2/3-n)*6:e),hsl2rgb:({h:e,s:r,l:n},i)=>{if(!r)return n*2.55;e/=360,r/=100,n/=100;const s=n<.5?n*(1+r):n+r-n*r,a=2*n-s;switch(i){case"r":return h5.hue2rgb(a,s,e+1/3)*255;case"g":return h5.hue2rgb(a,s,e)*255;case"b":return h5.hue2rgb(a,s,e-1/3)*255}},rgb2hsl:({r:e,g:r,b:n},i)=>{e/=255,r/=255,n/=255;const s=Math.max(e,r,n),a=Math.min(e,r,n),o=(s+a)/2;if(i==="l")return o*100;if(s===a)return 0;const l=s-a,d=o>.5?l/(2-s-a):l/(s+a);if(i==="s")return d*100;switch(s){case e:return((r-n)/l+(r<n?6:0))*60;case r:return((n-e)/l+2)*60;case n:return((e-r)/l+4)*60;default:return-1}}},WDe={clamp:(e,r,n)=>r>n?Math.min(r,Math.max(n,e)):Math.min(n,Math.max(r,e)),round:e=>Math.round(e*1e10)/1e10},UDe={dec2hex:e=>{const r=Math.round(e).toString(16);return r.length>1?r:`0${r}`}},kn={channel:h5,lang:WDe,unit:UDe},$m={};for(let e=0;e<=255;e++)$m[e]=kn.unit.dec2hex(e);const Yo={ALL:0,RGB:1,HSL:2};class VDe{constructor(){this.type=Yo.ALL}get(){return this.type}set(r){if(this.type&&this.type!==r)throw new Error("Cannot change both RGB and HSL channels at the same time");this.type=r}reset(){this.type=Yo.ALL}is(r){return this.type===r}}class qDe{constructor(r,n){this.color=n,this.changed=!1,this.data=r,this.type=new VDe}set(r,n){return this.color=n,this.changed=!1,this.data=r,this.type.type=Yo.ALL,this}_ensureHSL(){const r=this.data,{h:n,s:i,l:s}=r;n===void 0&&(r.h=kn.channel.rgb2hsl(r,"h")),i===void 0&&(r.s=kn.channel.rgb2hsl(r,"s")),s===void 0&&(r.l=kn.channel.rgb2hsl(r,"l"))}_ensureRGB(){const r=this.data,{r:n,g:i,b:s}=r;n===void 0&&(r.r=kn.channel.hsl2rgb(r,"r")),i===void 0&&(r.g=kn.channel.hsl2rgb(r,"g")),s===void 0&&(r.b=kn.channel.hsl2rgb(r,"b"))}get r(){const r=this.data,n=r.r;return!this.type.is(Yo.HSL)&&n!==void 0?n:(this._ensureHSL(),kn.channel.hsl2rgb(r,"r"))}get g(){const r=this.data,n=r.g;return!this.type.is(Yo.HSL)&&n!==void 0?n:(this._ensureHSL(),kn.channel.hsl2rgb(r,"g"))}get b(){const r=this.data,n=r.b;return!this.type.is(Yo.HSL)&&n!==void 0?n:(this._ensureHSL(),kn.channel.hsl2rgb(r,"b"))}get h(){const r=this.data,n=r.h;return!this.type.is(Yo.RGB)&&n!==void 0?n:(this._ensureRGB(),kn.channel.rgb2hsl(r,"h"))}get s(){const r=this.data,n=r.s;return!this.type.is(Yo.RGB)&&n!==void 0?n:(this._ensureRGB(),kn.channel.rgb2hsl(r,"s"))}get l(){const r=this.data,n=r.l;return!this.type.is(Yo.RGB)&&n!==void 0?n:(this._ensureRGB(),kn.channel.rgb2hsl(r,"l"))}get a(){return this.data.a}set r(r){this.type.set(Yo.RGB),this.changed=!0,this.data.r=r}set g(r){this.type.set(Yo.RGB),this.changed=!0,this.data.g=r}set b(r){this.type.set(Yo.RGB),this.changed=!0,this.data.b=r}set h(r){this.type.set(Yo.HSL),this.changed=!0,this.data.h=r}set s(r){this.type.set(Yo.HSL),this.changed=!0,this.data.s=r}set l(r){this.type.set(Yo.HSL),this.changed=!0,this.data.l=r}set a(r){this.changed=!0,this.data.a=r}}const jN=new qDe({r:0,g:0,b:0,a:0},"transparent"),dv={re:/^#((?:[a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i,parse:e=>{if(e.charCodeAt(0)!==35)return;const r=e.match(dv.re);if(!r)return;const n=r[1],i=parseInt(n,16),s=n.length,a=s%4===0,o=s>4,l=o?1:17,d=o?8:4,u=a?0:-1,h=o?255:15;return jN.set({r:(i>>d*(u+3)&h)*l,g:(i>>d*(u+2)&h)*l,b:(i>>d*(u+1)&h)*l,a:a?(i&h)*l/255:1},e)},stringify:e=>{const{r,g:n,b:i,a:s}=e;return s<1?`#${$m[Math.round(r)]}${$m[Math.round(n)]}${$m[Math.round(i)]}${$m[Math.round(s*255)]}`:`#${$m[Math.round(r)]}${$m[Math.round(n)]}${$m[Math.round(i)]}`}},M0={re:/^hsla?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(?:deg|grad|rad|turn)?)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?%)(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e-?\d+)?(%)?))?\s*?\)$/i,hueRe:/^(.+?)(deg|grad|rad|turn)$/i,_hue2deg:e=>{const r=e.match(M0.hueRe);if(r){const[,n,i]=r;switch(i){case"grad":return kn.channel.clamp.h(parseFloat(n)*.9);case"rad":return kn.channel.clamp.h(parseFloat(n)*180/Math.PI);case"turn":return kn.channel.clamp.h(parseFloat(n)*360)}}return kn.channel.clamp.h(parseFloat(e))},parse:e=>{const r=e.charCodeAt(0);if(r!==104&&r!==72)return;const n=e.match(M0.re);if(!n)return;const[,i,s,a,o,l]=n;return jN.set({h:M0._hue2deg(i),s:kn.channel.clamp.s(parseFloat(s)),l:kn.channel.clamp.l(parseFloat(a)),a:o?kn.channel.clamp.a(l?parseFloat(o)/100:parseFloat(o)):1},e)},stringify:e=>{const{h:r,s:n,l:i,a:s}=e;return s<1?`hsla(${kn.lang.round(r)}, ${kn.lang.round(n)}%, ${kn.lang.round(i)}%, ${s})`:`hsl(${kn.lang.round(r)}, ${kn.lang.round(n)}%, ${kn.lang.round(i)}%)`}},u2={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyanaqua:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",transparent:"#00000000",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},parse:e=>{e=e.toLowerCase();const r=u2.colors[e];if(r)return dv.parse(r)},stringify:e=>{const r=dv.stringify(e);for(const n in u2.colors)if(u2.colors[n]===r)return n}},O_={re:/^rgba?\(\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))\s*?(?:,|\s)\s*?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?))(?:\s*?(?:,|\/)\s*?\+?(-?(?:\d+(?:\.\d+)?|(?:\.\d+))(?:e\d+)?(%?)))?\s*?\)$/i,parse:e=>{const r=e.charCodeAt(0);if(r!==114&&r!==82)return;const n=e.match(O_.re);if(!n)return;const[,i,s,a,o,l,d,u,h]=n;return jN.set({r:kn.channel.clamp.r(s?parseFloat(i)*2.55:parseFloat(i)),g:kn.channel.clamp.g(o?parseFloat(a)*2.55:parseFloat(a)),b:kn.channel.clamp.b(d?parseFloat(l)*2.55:parseFloat(l)),a:u?kn.channel.clamp.a(h?parseFloat(u)/100:parseFloat(u)):1},e)},stringify:e=>{const{r,g:n,b:i,a:s}=e;return s<1?`rgba(${kn.lang.round(r)}, ${kn.lang.round(n)}, ${kn.lang.round(i)}, ${kn.lang.round(s)})`:`rgb(${kn.lang.round(r)}, ${kn.lang.round(n)}, ${kn.lang.round(i)})`}},pf={format:{keyword:u2,hex:dv,rgb:O_,rgba:O_,hsl:M0,hsla:M0},parse:e=>{if(typeof e!="string")return e;const r=dv.parse(e)||O_.parse(e)||M0.parse(e)||u2.parse(e);if(r)return r;throw new Error(`Unsupported color format: "${e}"`)},stringify:e=>!e.changed&&e.color?e.color:e.type.is(Yo.HSL)||e.data.r===void 0?M0.stringify(e):e.a<1||!Number.isInteger(e.r)||!Number.isInteger(e.g)||!Number.isInteger(e.b)?O_.stringify(e):dv.stringify(e)},pte=(e,r)=>{const n=pf.parse(e);for(const i in r)n[i]=kn.channel.clamp[i](r[i]);return pf.stringify(n)},d2=(e,r,n=0,i=1)=>{if(typeof e!="number")return pte(e,{a:r});const s=jN.set({r:kn.channel.clamp.r(e),g:kn.channel.clamp.g(r),b:kn.channel.clamp.b(n),a:kn.channel.clamp.a(i)});return pf.stringify(s)},GDe=e=>{const{r,g:n,b:i}=pf.parse(e),s=.2126*kn.channel.toLinear(r)+.7152*kn.channel.toLinear(n)+.0722*kn.channel.toLinear(i);return kn.lang.round(s)},KDe=e=>GDe(e)>=.5,hk=e=>!KDe(e),mte=(e,r,n)=>{const i=pf.parse(e),s=i[r],a=kn.channel.clamp[r](s+n);return s!==a&&(i[r]=a),pf.stringify(i)},Cr=(e,r)=>mte(e,"l",r),Zr=(e,r)=>mte(e,"l",-r),Ie=(e,r)=>{const n=pf.parse(e),i={};for(const s in r)r[s]&&(i[s]=n[s]+r[s]);return pte(e,i)},YDe=(e,r,n=50)=>{const{r:i,g:s,b:a,a:o}=pf.parse(e),{r:l,g:d,b:u,a:h}=pf.parse(r),f=n/100,g=f*2-1,v=o-h,_=((g*v===-1?g:(g+v)/(1+g*v))+1)/2,S=1-_,w=i*_+l*S,C=s*_+d*S,j=a*_+u*S,E=o*f+h*(1-f);return d2(w,C,j,E)},lr=(e,r=100)=>{const n=pf.parse(e);return n.r=255-n.r,n.g=255-n.g,n.b=255-n.b,YDe(n,e,r)};/*! @license DOMPurify 3.3.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.2/LICENSE */const{entries:gte,setPrototypeOf:xF,isFrozen:XDe,getPrototypeOf:JDe,getOwnPropertyDescriptor:ZDe}=Object;let{freeze:Ll,seal:ad,create:f5}=Object,{apply:aO,construct:oO}=typeof Reflect<"u"&&Reflect;Ll||(Ll=function(r){return r});ad||(ad=function(r){return r});aO||(aO=function(r,n){for(var i=arguments.length,s=new Array(i>2?i-2:0),a=2;a<i;a++)s[a-2]=arguments[a];return r.apply(n,s)});oO||(oO=function(r){for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return new r(...i)});const i3=$l(Array.prototype.forEach),QDe=$l(Array.prototype.lastIndexOf),bF=$l(Array.prototype.pop),Bb=$l(Array.prototype.push),eIe=$l(Array.prototype.splice),p5=$l(String.prototype.toLowerCase),BE=$l(String.prototype.toString),zE=$l(String.prototype.match),zb=$l(String.prototype.replace),tIe=$l(String.prototype.indexOf),rIe=$l(String.prototype.trim),Gc=$l(Object.prototype.hasOwnProperty),kl=$l(RegExp.prototype.test),Fb=nIe(TypeError);function $l(e){return function(r){r instanceof RegExp&&(r.lastIndex=0);for(var n=arguments.length,i=new Array(n>1?n-1:0),s=1;s<n;s++)i[s-1]=arguments[s];return aO(e,r,i)}}function nIe(e){return function(){for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return oO(e,n)}}function Fn(e,r){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:p5;xF&&xF(e,null);let i=r.length;for(;i--;){let s=r[i];if(typeof s=="string"){const a=n(s);a!==s&&(XDe(r)||(r[i]=a),s=a)}e[s]=!0}return e}function iIe(e){for(let r=0;r<e.length;r++)Gc(e,r)||(e[r]=null);return e}function qh(e){const r=f5(null);for(const[n,i]of gte(e))Gc(e,n)&&(Array.isArray(i)?r[n]=iIe(i):i&&typeof i=="object"&&i.constructor===Object?r[n]=qh(i):r[n]=i);return r}function Hb(e,r){for(;e!==null;){const i=ZDe(e,r);if(i){if(i.get)return $l(i.get);if(typeof i.value=="function")return $l(i.value)}e=JDe(e)}function n(){return null}return n}const _F=Ll(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),FE=Ll(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),HE=Ll(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),sIe=Ll(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),WE=Ll(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),aIe=Ll(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),wF=Ll(["#text"]),SF=Ll(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),UE=Ll(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),kF=Ll(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),s3=Ll(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),oIe=ad(/\{\{[\w\W]*|[\w\W]*\}\}/gm),lIe=ad(/<%[\w\W]*|[\w\W]*%>/gm),cIe=ad(/\$\{[\w\W]*/gm),uIe=ad(/^data-[\-\w.\u00B7-\uFFFF]+$/),dIe=ad(/^aria-[\-\w]+$/),yte=ad(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),hIe=ad(/^(?:\w+script|data):/i),fIe=ad(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),vte=ad(/^html$/i),pIe=ad(/^[a-z][.\w]*(-[.\w]+)+$/i);var CF=Object.freeze({__proto__:null,ARIA_ATTR:dIe,ATTR_WHITESPACE:fIe,CUSTOM_ELEMENT:pIe,DATA_ATTR:uIe,DOCTYPE_NAME:vte,ERB_EXPR:lIe,IS_ALLOWED_URI:yte,IS_SCRIPT_OR_DATA:hIe,MUSTACHE_EXPR:oIe,TMPLIT_EXPR:cIe});const Wb={element:1,text:3,progressingInstruction:7,comment:8,document:9},mIe=function(){return typeof window>"u"?null:window},gIe=function(r,n){if(typeof r!="object"||typeof r.createPolicy!="function")return null;let i=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(i=n.getAttribute(s));const a="dompurify"+(i?"#"+i:"");try{return r.createPolicy(a,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+a+" could not be created."),null}},jF=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function xte(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:mIe();const r=dt=>xte(dt);if(r.version="3.3.2",r.removed=[],!e||!e.document||e.document.nodeType!==Wb.document||!e.Element)return r.isSupported=!1,r;let{document:n}=e;const i=n,s=i.currentScript,{DocumentFragment:a,HTMLTemplateElement:o,Node:l,Element:d,NodeFilter:u,NamedNodeMap:h=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:g,trustedTypes:v}=e,b=d.prototype,_=Hb(b,"cloneNode"),S=Hb(b,"remove"),w=Hb(b,"nextSibling"),C=Hb(b,"childNodes"),j=Hb(b,"parentNode");if(typeof o=="function"){const dt=n.createElement("template");dt.content&&dt.content.ownerDocument&&(n=dt.content.ownerDocument)}let E,A="";const{implementation:N,createNodeIterator:R,createDocumentFragment:B,getElementsByTagName:G}=n,{importNode:H}=i;let z=jF();r.isSupported=typeof gte=="function"&&typeof j=="function"&&N&&N.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:W,ERB_EXPR:I,TMPLIT_EXPR:O,DATA_ATTR:D,ARIA_ATTR:P,IS_SCRIPT_OR_DATA:$,ATTR_WHITESPACE:V,CUSTOM_ELEMENT:K}=CF;let{IS_ALLOWED_URI:F}=CF,U=null;const Q=Fn({},[..._F,...FE,...HE,...WE,...wF]);let q=null;const te=Fn({},[...SF,...UE,...kF,...s3]);let ee=Object.seal(f5(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),se=null,ae=null;const re=Object.seal(f5(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let de=!0,pe=!0,_e=!1,me=!0,qe=!1,oe=!0,it=!1,Xe=!1,gt=!1,Mt=!1,Ht=!1,Yt=!1,tr=!0,ft=!1;const Ye="user-content-";let ht=!0,Tt=!1,Te={},Oe=null;const Je=Fn({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let lt=null;const yt=Fn({},["audio","video","img","source","image","track"]);let zt=null;const or=Fn({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Pe="http://www.w3.org/1998/Math/MathML",Ne="http://www.w3.org/2000/svg",be="http://www.w3.org/1999/xhtml";let He=be,at=!1,Ve=null;const $t=Fn({},[Pe,Ne,be],BE);let Et=Fn({},["mi","mo","mn","ms","mtext"]),Xt=Fn({},["annotation-xml"]);const rr=Fn({},["title","style","font","a","script"]);let nr=null;const Se=["application/xhtml+xml","text/html"],Fe="text/html";let et=null,wt=null;const Ze=n.createElement("form"),vt=function(ge){return ge instanceof RegExp||ge instanceof Function},Rt=function(){let ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(wt&&wt===ge)){if((!ge||typeof ge!="object")&&(ge={}),ge=qh(ge),nr=Se.indexOf(ge.PARSER_MEDIA_TYPE)===-1?Fe:ge.PARSER_MEDIA_TYPE,et=nr==="application/xhtml+xml"?BE:p5,U=Gc(ge,"ALLOWED_TAGS")?Fn({},ge.ALLOWED_TAGS,et):Q,q=Gc(ge,"ALLOWED_ATTR")?Fn({},ge.ALLOWED_ATTR,et):te,Ve=Gc(ge,"ALLOWED_NAMESPACES")?Fn({},ge.ALLOWED_NAMESPACES,BE):$t,zt=Gc(ge,"ADD_URI_SAFE_ATTR")?Fn(qh(or),ge.ADD_URI_SAFE_ATTR,et):or,lt=Gc(ge,"ADD_DATA_URI_TAGS")?Fn(qh(yt),ge.ADD_DATA_URI_TAGS,et):yt,Oe=Gc(ge,"FORBID_CONTENTS")?Fn({},ge.FORBID_CONTENTS,et):Je,se=Gc(ge,"FORBID_TAGS")?Fn({},ge.FORBID_TAGS,et):qh({}),ae=Gc(ge,"FORBID_ATTR")?Fn({},ge.FORBID_ATTR,et):qh({}),Te=Gc(ge,"USE_PROFILES")?ge.USE_PROFILES:!1,de=ge.ALLOW_ARIA_ATTR!==!1,pe=ge.ALLOW_DATA_ATTR!==!1,_e=ge.ALLOW_UNKNOWN_PROTOCOLS||!1,me=ge.ALLOW_SELF_CLOSE_IN_ATTR!==!1,qe=ge.SAFE_FOR_TEMPLATES||!1,oe=ge.SAFE_FOR_XML!==!1,it=ge.WHOLE_DOCUMENT||!1,Mt=ge.RETURN_DOM||!1,Ht=ge.RETURN_DOM_FRAGMENT||!1,Yt=ge.RETURN_TRUSTED_TYPE||!1,gt=ge.FORCE_BODY||!1,tr=ge.SANITIZE_DOM!==!1,ft=ge.SANITIZE_NAMED_PROPS||!1,ht=ge.KEEP_CONTENT!==!1,Tt=ge.IN_PLACE||!1,F=ge.ALLOWED_URI_REGEXP||yte,He=ge.NAMESPACE||be,Et=ge.MATHML_TEXT_INTEGRATION_POINTS||Et,Xt=ge.HTML_INTEGRATION_POINTS||Xt,ee=ge.CUSTOM_ELEMENT_HANDLING||{},ge.CUSTOM_ELEMENT_HANDLING&&vt(ge.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(ee.tagNameCheck=ge.CUSTOM_ELEMENT_HANDLING.tagNameCheck),ge.CUSTOM_ELEMENT_HANDLING&&vt(ge.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(ee.attributeNameCheck=ge.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),ge.CUSTOM_ELEMENT_HANDLING&&typeof ge.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(ee.allowCustomizedBuiltInElements=ge.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),qe&&(pe=!1),Ht&&(Mt=!0),Te&&(U=Fn({},wF),q=f5(null),Te.html===!0&&(Fn(U,_F),Fn(q,SF)),Te.svg===!0&&(Fn(U,FE),Fn(q,UE),Fn(q,s3)),Te.svgFilters===!0&&(Fn(U,HE),Fn(q,UE),Fn(q,s3)),Te.mathMl===!0&&(Fn(U,WE),Fn(q,kF),Fn(q,s3))),Gc(ge,"ADD_TAGS")||(re.tagCheck=null),Gc(ge,"ADD_ATTR")||(re.attributeCheck=null),ge.ADD_TAGS&&(typeof ge.ADD_TAGS=="function"?re.tagCheck=ge.ADD_TAGS:(U===Q&&(U=qh(U)),Fn(U,ge.ADD_TAGS,et))),ge.ADD_ATTR&&(typeof ge.ADD_ATTR=="function"?re.attributeCheck=ge.ADD_ATTR:(q===te&&(q=qh(q)),Fn(q,ge.ADD_ATTR,et))),ge.ADD_URI_SAFE_ATTR&&Fn(zt,ge.ADD_URI_SAFE_ATTR,et),ge.FORBID_CONTENTS&&(Oe===Je&&(Oe=qh(Oe)),Fn(Oe,ge.FORBID_CONTENTS,et)),ge.ADD_FORBID_CONTENTS&&(Oe===Je&&(Oe=qh(Oe)),Fn(Oe,ge.ADD_FORBID_CONTENTS,et)),ht&&(U["#text"]=!0),it&&Fn(U,["html","head","body"]),U.table&&(Fn(U,["tbody"]),delete se.tbody),ge.TRUSTED_TYPES_POLICY){if(typeof ge.TRUSTED_TYPES_POLICY.createHTML!="function")throw Fb('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof ge.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Fb('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=ge.TRUSTED_TYPES_POLICY,A=E.createHTML("")}else E===void 0&&(E=gIe(v,s)),E!==null&&typeof A=="string"&&(A=E.createHTML(""));Ll&&Ll(ge),wt=ge}},Gt=Fn({},[...FE,...HE,...sIe]),$e=Fn({},[...WE,...aIe]),Me=function(ge){let fe=j(ge);(!fe||!fe.tagName)&&(fe={namespaceURI:He,tagName:"template"});const Be=p5(ge.tagName),ut=p5(fe.tagName);return Ve[ge.namespaceURI]?ge.namespaceURI===Ne?fe.namespaceURI===be?Be==="svg":fe.namespaceURI===Pe?Be==="svg"&&(ut==="annotation-xml"||Et[ut]):!!Gt[Be]:ge.namespaceURI===Pe?fe.namespaceURI===be?Be==="math":fe.namespaceURI===Ne?Be==="math"&&Xt[ut]:!!$e[Be]:ge.namespaceURI===be?fe.namespaceURI===Ne&&!Xt[ut]||fe.namespaceURI===Pe&&!Et[ut]?!1:!$e[Be]&&(rr[Be]||!Gt[Be]):!!(nr==="application/xhtml+xml"&&Ve[ge.namespaceURI]):!1},mt=function(ge){Bb(r.removed,{element:ge});try{j(ge).removeChild(ge)}catch{S(ge)}},Wt=function(ge,fe){try{Bb(r.removed,{attribute:fe.getAttributeNode(ge),from:fe})}catch{Bb(r.removed,{attribute:null,from:fe})}if(fe.removeAttribute(ge),ge==="is")if(Mt||Ht)try{mt(fe)}catch{}else try{fe.setAttribute(ge,"")}catch{}},Ot=function(ge){let fe=null,Be=null;if(gt)ge="<remove></remove>"+ge;else{const Pt=zE(ge,/^[\r\n\t ]+/);Be=Pt&&Pt[0]}nr==="application/xhtml+xml"&&He===be&&(ge='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+ge+"</body></html>");const ut=E?E.createHTML(ge):ge;if(He===be)try{fe=new g().parseFromString(ut,nr)}catch{}if(!fe||!fe.documentElement){fe=N.createDocument(He,"template",null);try{fe.documentElement.innerHTML=at?A:ut}catch{}}const Nt=fe.body||fe.documentElement;return ge&&Be&&Nt.insertBefore(n.createTextNode(Be),Nt.childNodes[0]||null),He===be?G.call(fe,it?"html":"body")[0]:it?fe.documentElement:Nt},Hr=function(ge){return R.call(ge.ownerDocument||ge,ge,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},mr=function(ge){return ge instanceof f&&(typeof ge.nodeName!="string"||typeof ge.textContent!="string"||typeof ge.removeChild!="function"||!(ge.attributes instanceof h)||typeof ge.removeAttribute!="function"||typeof ge.setAttribute!="function"||typeof ge.namespaceURI!="string"||typeof ge.insertBefore!="function"||typeof ge.hasChildNodes!="function")},Dr=function(ge){return typeof l=="function"&&ge instanceof l};function jt(dt,ge,fe){i3(dt,Be=>{Be.call(r,ge,fe,wt)})}const qr=function(ge){let fe=null;if(jt(z.beforeSanitizeElements,ge,null),mr(ge))return mt(ge),!0;const Be=et(ge.nodeName);if(jt(z.uponSanitizeElement,ge,{tagName:Be,allowedTags:U}),oe&&ge.hasChildNodes()&&!Dr(ge.firstElementChild)&&kl(/<[/\w!]/g,ge.innerHTML)&&kl(/<[/\w!]/g,ge.textContent)||ge.nodeType===Wb.progressingInstruction||oe&&ge.nodeType===Wb.comment&&kl(/<[/\w]/g,ge.data))return mt(ge),!0;if(!(re.tagCheck instanceof Function&&re.tagCheck(Be))&&(!U[Be]||se[Be])){if(!se[Be]&&js(Be)&&(ee.tagNameCheck instanceof RegExp&&kl(ee.tagNameCheck,Be)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(Be)))return!1;if(ht&&!Oe[Be]){const ut=j(ge)||ge.parentNode,Nt=C(ge)||ge.childNodes;if(Nt&&ut){const Pt=Nt.length;for(let cn=Pt-1;cn>=0;--cn){const Nn=_(Nt[cn],!0);Nn.__removalCount=(ge.__removalCount||0)+1,ut.insertBefore(Nn,w(ge))}}}return mt(ge),!0}return ge instanceof d&&!Me(ge)||(Be==="noscript"||Be==="noembed"||Be==="noframes")&&kl(/<\/no(script|embed|frames)/i,ge.innerHTML)?(mt(ge),!0):(qe&&ge.nodeType===Wb.text&&(fe=ge.textContent,i3([W,I,O],ut=>{fe=zb(fe,ut," ")}),ge.textContent!==fe&&(Bb(r.removed,{element:ge.cloneNode()}),ge.textContent=fe)),jt(z.afterSanitizeElements,ge,null),!1)},Wr=function(ge,fe,Be){if(ae[fe]||tr&&(fe==="id"||fe==="name")&&(Be in n||Be in Ze))return!1;if(!(pe&&!ae[fe]&&kl(D,fe))){if(!(de&&kl(P,fe))){if(!(re.attributeCheck instanceof Function&&re.attributeCheck(fe,ge))){if(!q[fe]||ae[fe]){if(!(js(ge)&&(ee.tagNameCheck instanceof RegExp&&kl(ee.tagNameCheck,ge)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(ge))&&(ee.attributeNameCheck instanceof RegExp&&kl(ee.attributeNameCheck,fe)||ee.attributeNameCheck instanceof Function&&ee.attributeNameCheck(fe,ge))||fe==="is"&&ee.allowCustomizedBuiltInElements&&(ee.tagNameCheck instanceof RegExp&&kl(ee.tagNameCheck,Be)||ee.tagNameCheck instanceof Function&&ee.tagNameCheck(Be))))return!1}else if(!zt[fe]){if(!kl(F,zb(Be,V,""))){if(!((fe==="src"||fe==="xlink:href"||fe==="href")&&ge!=="script"&&tIe(Be,"data:")===0&&lt[ge])){if(!(_e&&!kl($,zb(Be,V,"")))){if(Be)return!1}}}}}}}return!0},js=function(ge){return ge!=="annotation-xml"&&zE(ge,K)},sr=function(ge){jt(z.beforeSanitizeAttributes,ge,null);const{attributes:fe}=ge;if(!fe||mr(ge))return;const Be={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:q,forceKeepAttr:void 0};let ut=fe.length;for(;ut--;){const Nt=fe[ut],{name:Pt,namespaceURI:cn,value:Nn}=Nt,Ir=et(Pt),On=Nn;let Gn=Pt==="value"?On:rIe(On);if(Be.attrName=Ir,Be.attrValue=Gn,Be.keepAttr=!0,Be.forceKeepAttr=void 0,jt(z.uponSanitizeAttribute,ge,Be),Gn=Be.attrValue,ft&&(Ir==="id"||Ir==="name")&&(Wt(Pt,ge),Gn=Ye+Gn),oe&&kl(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Gn)){Wt(Pt,ge);continue}if(Ir==="attributename"&&zE(Gn,"href")){Wt(Pt,ge);continue}if(Be.forceKeepAttr)continue;if(!Be.keepAttr){Wt(Pt,ge);continue}if(!me&&kl(/\/>/i,Gn)){Wt(Pt,ge);continue}qe&&i3([W,I,O],Kn=>{Gn=zb(Gn,Kn," ")});const cr=et(ge.nodeName);if(!Wr(cr,Ir,Gn)){Wt(Pt,ge);continue}if(E&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!cn)switch(v.getAttributeType(cr,Ir)){case"TrustedHTML":{Gn=E.createHTML(Gn);break}case"TrustedScriptURL":{Gn=E.createScriptURL(Gn);break}}if(Gn!==On)try{cn?ge.setAttributeNS(cn,Pt,Gn):ge.setAttribute(Pt,Gn),mr(ge)?mt(ge):bF(r.removed)}catch{Wt(Pt,ge)}}jt(z.afterSanitizeAttributes,ge,null)},jr=function dt(ge){let fe=null;const Be=Hr(ge);for(jt(z.beforeSanitizeShadowDOM,ge,null);fe=Be.nextNode();)jt(z.uponSanitizeShadowNode,fe,null),qr(fe),sr(fe),fe.content instanceof a&&dt(fe.content);jt(z.afterSanitizeShadowDOM,ge,null)};return r.sanitize=function(dt){let ge=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},fe=null,Be=null,ut=null,Nt=null;if(at=!dt,at&&(dt="<!-->"),typeof dt!="string"&&!Dr(dt))if(typeof dt.toString=="function"){if(dt=dt.toString(),typeof dt!="string")throw Fb("dirty is not a string, aborting")}else throw Fb("toString is not a function");if(!r.isSupported)return dt;if(Xe||Rt(ge),r.removed=[],typeof dt=="string"&&(Tt=!1),Tt){if(dt.nodeName){const Nn=et(dt.nodeName);if(!U[Nn]||se[Nn])throw Fb("root node is forbidden and cannot be sanitized in-place")}}else if(dt instanceof l)fe=Ot("<!---->"),Be=fe.ownerDocument.importNode(dt,!0),Be.nodeType===Wb.element&&Be.nodeName==="BODY"||Be.nodeName==="HTML"?fe=Be:fe.appendChild(Be);else{if(!Mt&&!qe&&!it&&dt.indexOf("<")===-1)return E&&Yt?E.createHTML(dt):dt;if(fe=Ot(dt),!fe)return Mt?null:Yt?A:""}fe&&gt&&mt(fe.firstChild);const Pt=Hr(Tt?dt:fe);for(;ut=Pt.nextNode();)qr(ut),sr(ut),ut.content instanceof a&&jr(ut.content);if(Tt)return dt;if(Mt){if(Ht)for(Nt=B.call(fe.ownerDocument);fe.firstChild;)Nt.appendChild(fe.firstChild);else Nt=fe;return(q.shadowroot||q.shadowrootmode)&&(Nt=H.call(i,Nt,!0)),Nt}let cn=it?fe.outerHTML:fe.innerHTML;return it&&U["!doctype"]&&fe.ownerDocument&&fe.ownerDocument.doctype&&fe.ownerDocument.doctype.name&&kl(vte,fe.ownerDocument.doctype.name)&&(cn="<!DOCTYPE "+fe.ownerDocument.doctype.name+`>
@@ -1179,8 +1179,8 @@ Please report this to https://github.com/markedjs/marked.`,r){let s="<p>An error
1179
1179
  node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`);const i=e.x,s=e.y,a=Math.abs(i-n.x),o=e.width/2;let l=n.x<r.x?o-a:o+a;const d=e.height/2,u=Math.abs(r.y-n.y),h=Math.abs(r.x-n.x);if(Math.abs(s-r.y)*o>Math.abs(i-r.x)*d){let f=n.y<r.y?r.y-d-s:s-d-r.y;l=h*f/u;const g={x:n.x<r.x?n.x+l:n.x-h+l,y:n.y<r.y?n.y+u-f:n.y-u+f};return l===0&&(g.x=r.x,g.y=r.y),h===0&&(g.x=r.x),u===0&&(g.y=r.y),At.debug(`abc89 top/bottom calc, Q ${u}, q ${f}, R ${h}, r ${l}`,g),g}else{n.x<r.x?l=r.x-o-i:l=i-o-r.x;let f=u*l/h,g=n.x<r.x?n.x+h-l:n.x-h+l,v=n.y<r.y?n.y+f:n.y-f;return At.debug(`sides calc abc89, Q ${u}, q ${f}, R ${h}, r ${l}`,{_x:g,_y:v}),l===0&&(g=r.x,v=r.y),h===0&&(g=r.x),u===0&&(v=r.y),{x:g,y:v}}},"intersection"),KH=X((e,r)=>{At.warn("abc88 cutPathAtIntersect",e,r);let n=[],i=e[0],s=!1;return e.forEach(a=>{if(At.info("abc88 checking point",a,r),!LYe(r,a)&&!s){const o=$Ye(r,i,a);At.debug("abc88 inside",a,i,o),At.debug("abc88 intersection",o,r);let l=!1;n.forEach(d=>{l=l||d.x===o.x&&d.y===o.y}),n.some(d=>d.x===o.x&&d.y===o.y)?At.warn("abc88 no intersect",o,n):n.push(o),s=!0}else At.warn("abc88 outside",a,i),i=a,s||n.push(a)}),At.debug("returning points",n),n},"cutPathAtIntersect");function zae(e){const r=[],n=[];for(let i=1;i<e.length-1;i++){const s=e[i-1],a=e[i],o=e[i+1];(s.x===a.x&&a.y===o.y&&Math.abs(a.x-o.x)>5&&Math.abs(a.y-s.y)>5||s.y===a.y&&a.x===o.x&&Math.abs(a.x-s.x)>5&&Math.abs(a.y-o.y)>5)&&(r.push(a),n.push(i))}return{cornerPoints:r,cornerPointPositions:n}}X(zae,"extractCornerPoints");var YH=X(function(e,r,n){const i=r.x-e.x,s=r.y-e.y,a=Math.sqrt(i*i+s*s),o=n/a;return{x:r.x-o*i,y:r.y-o*s}},"findAdjacentPoint"),DYe=X(function(e){const{cornerPointPositions:r}=zae(e),n=[];for(let i=0;i<e.length;i++)if(r.includes(i)){const s=e[i-1],a=e[i+1],o=e[i],l=YH(s,o,5),d=YH(a,o,5),u=d.x-l.x,h=d.y-l.y;n.push(l);const f=Math.sqrt(2)*2;let g={x:o.x,y:o.y};if(Math.abs(a.x-s.x)>10&&Math.abs(a.y-s.y)>=10){At.debug("Corner point fixing",Math.abs(a.x-s.x),Math.abs(a.y-s.y));const v=5;o.x===l.x?g={x:u<0?l.x-v+f:l.x+v-f,y:h<0?l.y-f:l.y+f}:g={x:u<0?l.x-f:l.x+f,y:h<0?l.y-v+f:l.y+v-f}}else At.debug("Corner point skipping fixing",Math.abs(a.x-s.x),Math.abs(a.y-s.y));n.push(g,d)}else n.push(e[i]);return n},"fixCorners"),IYe=X((e,r,n)=>{const i=e-r-n,s=2,a=2,o=s+a,l=Math.floor(i/o),d=Array(l).fill(`${s} ${a}`).join(" ");return`0 ${r} ${d} ${n}`},"generateDashArray"),BYe=X(function(e,r,n,i,s,a,o,l=!1){var P;const{handDrawnSeed:d}=gi();let u=r.points,h=!1;const f=s;var g=a;const v=[];for(const $ in r.cssCompiledStyles)zie($)||v.push(r.cssCompiledStyles[$]);At.debug("UIO intersect check",r.points,g.x,f.x),g.intersect&&f.intersect&&!l&&(u=u.slice(1,r.points.length-1),u.unshift(f.intersect(u[0])),At.debug("Last point UIO",r.start,"-->",r.end,u[u.length-1],g,g.intersect(u[u.length-1])),u.push(g.intersect(u[u.length-1])));const b=btoa(JSON.stringify(u));r.toCluster&&(At.info("to cluster abc88",n.get(r.toCluster)),u=KH(r.points,n.get(r.toCluster).node),h=!0),r.fromCluster&&(At.debug("from cluster abc88",n.get(r.fromCluster),JSON.stringify(u,null,2)),u=KH(u.reverse(),n.get(r.fromCluster).node).reverse(),h=!0);let _=u.filter($=>!Number.isNaN($.y));const S=MYe(r.curve);S!=="rounded"&&(_=DYe(_));let w=p2;switch(S){case"linear":w=p2;break;case"basis":w=SO;break;case"cardinal":w=bre;break;case"bumpX":w=mre;break;case"bumpY":w=gre;break;case"catmullRom":w=wre;break;case"monotoneX":w=Tre;break;case"monotoneY":w=Ere;break;case"natural":w=Ore;break;case"step":w=Mre;break;case"stepAfter":w=Pre;break;case"stepBefore":w=Rre;break;case"rounded":w=p2;break;default:w=SO}const{x:C,y:j}=LUe(r),E=dWe().x(C).y(j).curve(w);let A;switch(r.thickness){case"normal":A="edge-thickness-normal";break;case"thick":A="edge-thickness-thick";break;case"invisible":A="edge-thickness-invisible";break;default:A="edge-thickness-normal"}switch(r.pattern){case"solid":A+=" edge-pattern-solid";break;case"dotted":A+=" edge-pattern-dotted";break;case"dashed":A+=" edge-pattern-dashed";break;default:A+=" edge-pattern-solid"}let N,R=S==="rounded"?Fae(Hae(_,r),5):E(_);const B=Array.isArray(r.style)?r.style:[r.style];let G=B.find($=>$==null?void 0:$.startsWith("stroke:")),H="";r.animate&&(H="edge-animation-fast"),r.animation&&(H="edge-animation-"+r.animation);let z=!1;if(r.look==="handDrawn"){const $=Mr.svg(e);Object.assign([],_);const V=$.path(R,{roughness:.3,seed:d});A+=" transition",N=nn(V).select("path").attr("id",r.id).attr("class"," "+A+(r.classes?" "+r.classes:"")+(H?" "+H:"")).attr("style",B?B.reduce((F,U)=>F+";"+U,""):"");let K=N.attr("d");N.attr("d",K),e.node().appendChild(N.node())}else{const $=v.join(";"),V=B?B.reduce((te,ee)=>te+ee+";",""):"",K=($?$+";"+V+";":V)+";"+(B?B.reduce((te,ee)=>te+";"+ee,""):"");N=e.append("path").attr("d",R).attr("id",r.id).attr("class"," "+A+(r.classes?" "+r.classes:"")+(H?" "+H:"")).attr("style",K),G=(P=K.match(/stroke:([^;]+)/))==null?void 0:P[1],z=r.animate===!0||!!r.animation||$.includes("animation");const F=N.node(),U=typeof F.getTotalLength=="function"?F.getTotalLength():0,Q=uH[r.arrowTypeStart]||0,q=uH[r.arrowTypeEnd]||0;if(r.look==="neo"&&!z){const ee=`stroke-dasharray: ${r.pattern==="dotted"||r.pattern==="dashed"?IYe(U,Q,q):`0 ${Q} ${U-Q-q} ${q}`}; stroke-dashoffset: 0;`;N.attr("style",ee+N.attr("style"))}}N.attr("data-edge",!0),N.attr("data-et","edge"),N.attr("data-id",r.id),N.attr("data-points",b),r.showPoints&&_.forEach($=>{e.append("circle").style("stroke","red").style("fill","red").attr("r",1).attr("cx",$.x).attr("cy",$.y)});let W="";(gi().flowchart.arrowMarkerAbsolute||gi().state.arrowMarkerAbsolute)&&(W=window.location.protocol+"//"+window.location.host+window.location.pathname+window.location.search,W=W.replace(/\(/g,"\\(").replace(/\)/g,"\\)")),At.info("arrowTypeStart",r.arrowTypeStart),At.info("arrowTypeEnd",r.arrowTypeEnd),AYe(N,r,W,o,i,G);const I=Math.floor(u.length/2),O=u[I];Gd.isLabelCoordinateInPath(O,N.attr("d"))||(h=!0);let D={};return h&&(D.updatedPath=u),D.originalPath=r.points,D},"insertEdge");function Fae(e,r){if(e.length<2)return"";let n="";const i=e.length,s=1e-5;for(let a=0;a<i;a++){const o=e[a],l=e[a-1],d=e[a+1];if(a===0)n+=`M${o.x},${o.y}`;else if(a===i-1)n+=`L${o.x},${o.y}`;else{const u=o.x-l.x,h=o.y-l.y,f=d.x-o.x,g=d.y-o.y,v=Math.hypot(u,h),b=Math.hypot(f,g);if(v<s||b<s){n+=`L${o.x},${o.y}`;continue}const _=u/v,S=h/v,w=f/b,C=g/b,j=_*w+S*C,E=Math.max(-1,Math.min(1,j)),A=Math.acos(E);if(A<s||Math.abs(Math.PI-A)<s){n+=`L${o.x},${o.y}`;continue}const N=Math.min(r/Math.sin(A/2),v/2,b/2),R=o.x-_*N,B=o.y-S*N,G=o.x+w*N,H=o.y+C*N;n+=`L${R},${B}`,n+=`Q${o.x},${o.y} ${G},${H}`}}return n}X(Fae,"generateRoundedPath");function JO(e,r){if(!e||!r)return{angle:0,deltaX:0,deltaY:0};const n=r.x-e.x,i=r.y-e.y;return{angle:Math.atan2(i,n),deltaX:n,deltaY:i}}X(JO,"calculateDeltaAndAngle");function Hae(e,r){const n=e.map(s=>({...s}));if(e.length>=2&&Xo[r.arrowTypeStart]){const s=Xo[r.arrowTypeStart],a=e[0],o=e[1],{angle:l}=JO(a,o),d=s*Math.cos(l),u=s*Math.sin(l);n[0].x=a.x+d,n[0].y=a.y+u}const i=e.length;if(i>=2&&Xo[r.arrowTypeEnd]){const s=Xo[r.arrowTypeEnd],a=e[i-1],o=e[i-2],{angle:l}=JO(o,a),d=s*Math.cos(l),u=s*Math.sin(l);n[i-1].x=a.x-d,n[i-1].y=a.y-u}return n}X(Hae,"applyMarkerOffsetsToPoints");var zYe=X((e,r,n,i)=>{r.forEach(s=>{rXe[s](e,n,i)})},"insertMarkers"),FYe=X((e,r,n)=>{At.trace("Making markers for ",n),e.append("defs").append("marker").attr("id",n+"_"+r+"-extensionStart").attr("class","marker extension "+r).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 1,7 L18,13 V 1 Z"),e.append("defs").append("marker").attr("id",n+"_"+r+"-extensionEnd").attr("class","marker extension "+r).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 1,1 V 13 L18,7 Z")},"extension"),HYe=X((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-compositionStart").attr("class","marker composition "+r).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",n+"_"+r+"-compositionEnd").attr("class","marker composition "+r).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"composition"),WYe=X((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-aggregationStart").attr("class","marker aggregation "+r).attr("refX",18).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",n+"_"+r+"-aggregationEnd").attr("class","marker aggregation "+r).attr("refX",1).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L1,7 L9,1 Z")},"aggregation"),UYe=X((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-dependencyStart").attr("class","marker dependency "+r).attr("refX",6).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("path").attr("d","M 5,7 L9,13 L1,7 L9,1 Z"),e.append("defs").append("marker").attr("id",n+"_"+r+"-dependencyEnd").attr("class","marker dependency "+r).attr("refX",13).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"dependency"),VYe=X((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-lollipopStart").attr("class","marker lollipop "+r).attr("refX",13).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6),e.append("defs").append("marker").attr("id",n+"_"+r+"-lollipopEnd").attr("class","marker lollipop "+r).attr("refX",1).attr("refY",7).attr("markerWidth",190).attr("markerHeight",240).attr("orient","auto").append("circle").attr("fill","transparent").attr("cx",7).attr("cy",7).attr("r",6)},"lollipop"),qYe=X((e,r,n)=>{e.append("marker").attr("id",n+"_"+r+"-pointEnd").attr("class","marker "+r).attr("viewBox","0 0 10 10").attr("refX",5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",n+"_"+r+"-pointStart").attr("class","marker "+r).attr("viewBox","0 0 10 10").attr("refX",4.5).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",8).attr("markerHeight",8).attr("orient","auto").append("path").attr("d","M 0 5 L 10 10 L 10 0 z").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"point"),GYe=X((e,r,n)=>{e.append("marker").attr("id",n+"_"+r+"-circleEnd").attr("class","marker "+r).attr("viewBox","0 0 10 10").attr("refX",11).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0"),e.append("marker").attr("id",n+"_"+r+"-circleStart").attr("class","marker "+r).attr("viewBox","0 0 10 10").attr("refX",-1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("circle").attr("cx","5").attr("cy","5").attr("r","5").attr("class","arrowMarkerPath").style("stroke-width",1).style("stroke-dasharray","1,0")},"circle"),KYe=X((e,r,n)=>{e.append("marker").attr("id",n+"_"+r+"-crossEnd").attr("class","marker cross "+r).attr("viewBox","0 0 11 11").attr("refX",12).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0"),e.append("marker").attr("id",n+"_"+r+"-crossStart").attr("class","marker cross "+r).attr("viewBox","0 0 11 11").attr("refX",-1).attr("refY",5.2).attr("markerUnits","userSpaceOnUse").attr("markerWidth",11).attr("markerHeight",11).attr("orient","auto").append("path").attr("d","M 1,1 l 9,9 M 10,1 l -9,9").attr("class","arrowMarkerPath").style("stroke-width",2).style("stroke-dasharray","1,0")},"cross"),YYe=X((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-barbEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",14).attr("markerUnits","userSpaceOnUse").attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"barb"),XYe=X((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-onlyOneStart").attr("class","marker onlyOne "+r).attr("refX",0).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M9,0 L9,18 M15,0 L15,18"),e.append("defs").append("marker").attr("id",n+"_"+r+"-onlyOneEnd").attr("class","marker onlyOne "+r).attr("refX",18).attr("refY",9).attr("markerWidth",18).attr("markerHeight",18).attr("orient","auto").append("path").attr("d","M3,0 L3,18 M9,0 L9,18")},"only_one"),JYe=X((e,r,n)=>{const i=e.append("defs").append("marker").attr("id",n+"_"+r+"-zeroOrOneStart").attr("class","marker zeroOrOne "+r).attr("refX",0).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",21).attr("cy",9).attr("r",6),i.append("path").attr("d","M9,0 L9,18");const s=e.append("defs").append("marker").attr("id",n+"_"+r+"-zeroOrOneEnd").attr("class","marker zeroOrOne "+r).attr("refX",30).attr("refY",9).attr("markerWidth",30).attr("markerHeight",18).attr("orient","auto");s.append("circle").attr("fill","white").attr("cx",9).attr("cy",9).attr("r",6),s.append("path").attr("d","M21,0 L21,18")},"zero_or_one"),ZYe=X((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-oneOrMoreStart").attr("class","marker oneOrMore "+r).attr("refX",18).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M0,18 Q 18,0 36,18 Q 18,36 0,18 M42,9 L42,27"),e.append("defs").append("marker").attr("id",n+"_"+r+"-oneOrMoreEnd").attr("class","marker oneOrMore "+r).attr("refX",27).attr("refY",18).attr("markerWidth",45).attr("markerHeight",36).attr("orient","auto").append("path").attr("d","M3,9 L3,27 M9,18 Q27,0 45,18 Q27,36 9,18")},"one_or_more"),QYe=X((e,r,n)=>{const i=e.append("defs").append("marker").attr("id",n+"_"+r+"-zeroOrMoreStart").attr("class","marker zeroOrMore "+r).attr("refX",18).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");i.append("circle").attr("fill","white").attr("cx",48).attr("cy",18).attr("r",6),i.append("path").attr("d","M0,18 Q18,0 36,18 Q18,36 0,18");const s=e.append("defs").append("marker").attr("id",n+"_"+r+"-zeroOrMoreEnd").attr("class","marker zeroOrMore "+r).attr("refX",39).attr("refY",18).attr("markerWidth",57).attr("markerHeight",36).attr("orient","auto");s.append("circle").attr("fill","white").attr("cx",9).attr("cy",18).attr("r",6),s.append("path").attr("d","M21,18 Q39,0 57,18 Q39,36 21,18")},"zero_or_more"),eXe=X((e,r,n)=>{e.append("defs").append("marker").attr("id",n+"_"+r+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("path").attr("d",`M0,0
1180
1180
  L20,10
1181
1181
  M20,10
1182
- L0,20`)},"requirement_arrow"),tXe=X((e,r,n)=>{const i=e.append("defs").append("marker").attr("id",n+"_"+r+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),rXe={extension:FYe,composition:HYe,aggregation:WYe,dependency:UYe,lollipop:VYe,point:qYe,circle:GYe,cross:KYe,barb:YYe,only_one:XYe,zero_or_one:JYe,one_or_more:ZYe,zero_or_more:QYe,requirement_arrow:eXe,requirement_contains:tXe},nXe=zYe,iXe={common:pk,getConfig:nl,insertCluster:uYe,insertEdge:BYe,insertEdgeLabel:RYe,insertMarkers:nXe,insertNode:Bae,interpolateToCurve:TP,labelHelper:dn,log:At,positionEdgeLabel:PYe},nS={},Wae=X(e=>{for(const r of e)nS[r.name]=r},"registerLayoutLoaders"),sXe=X(()=>{Wae([{name:"dagre",loader:X(async()=>await nt(()=>import("./dagre-KLK3FWXG-BzrpmYZL.js"),__vite__mapDeps([47,48,49,50,51,52]),import.meta.url),"loader")},{name:"cose-bilkent",loader:X(async()=>await nt(()=>import("./cose-bilkent-S5V4N54A-BrtHBM6x.js"),__vite__mapDeps([53,54]),import.meta.url),"loader")}])},"registerDefaultLayoutLoaders");sXe();var hbt=X(async(e,r)=>{if(!(e.layoutAlgorithm in nS))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const n=nS[e.layoutAlgorithm];return(await n.loader()).render(e,r,iXe,{algorithm:n.algorithm})},"render"),fbt=X((e="",{fallback:r="dagre"}={})=>{if(e in nS)return e;if(r in nS)return At.warn(`Layout algorithm ${e} is not registered. Using ${r} as fallback.`),r;throw new Error(`Both layout algorithms ${e} and ${r} are not registered.`)},"getRegisteredLayoutAlgorithm"),aXe=xie(Object.keys,Object),oXe=Object.prototype,lXe=oXe.hasOwnProperty;function cXe(e){if(!zN(e))return aXe(e);var r=[];for(var n in Object(e))lXe.call(e,n)&&n!="constructor"&&r.push(n);return r}var ZO=jy(gh,"DataView"),QO=jy(gh,"Promise"),e7=jy(gh,"Set"),t7=jy(gh,"WeakMap"),XH="[object Map]",uXe="[object Object]",JH="[object Promise]",ZH="[object Set]",QH="[object WeakMap]",eW="[object DataView]",dXe=Cy(ZO),hXe=Cy(tS),fXe=Cy(QO),pXe=Cy(e7),mXe=Cy(t7),S0=ky;(ZO&&S0(new ZO(new ArrayBuffer(1)))!=eW||tS&&S0(new tS)!=XH||QO&&S0(QO.resolve())!=JH||e7&&S0(new e7)!=ZH||t7&&S0(new t7)!=QH)&&(S0=function(e){var r=ky(e),n=r==uXe?e.constructor:void 0,i=n?Cy(n):"";if(i)switch(i){case dXe:return eW;case hXe:return XH;case fXe:return JH;case pXe:return ZH;case mXe:return QH}return r});var gXe="[object Map]",yXe="[object Set]",vXe=Object.prototype,xXe=vXe.hasOwnProperty;function tW(e){if(e==null)return!0;if(FN(e)&&(Vj(e)||typeof e=="string"||typeof e.splice=="function"||jP(e)||NP(e)||Uj(e)))return!e.length;var r=S0(e);if(r==gXe||r==yXe)return!e.size;if(zN(e))return!cXe(e).length;for(var n in e)if(xXe.call(e,n))return!1;return!0}var Uae="c4",bXe=X(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),_Xe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./c4Diagram-IC4MRINW-kYgaGoR6.js");return{diagram:r}},__vite__mapDeps([55,56]),import.meta.url);return{id:Uae,diagram:e}},"loader"),wXe={id:Uae,detector:bXe,loader:_Xe},SXe=wXe,Vae="flowchart",kXe=X((e,r)=>{var n,i;return((n=r==null?void 0:r.flowchart)==null?void 0:n.defaultRenderer)==="dagre-wrapper"||((i=r==null?void 0:r.flowchart)==null?void 0:i.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),CXe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-Dfb4F2Jr.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:Vae,diagram:e}},"loader"),jXe={id:Vae,detector:kXe,loader:CXe},NXe=jXe,qae="flowchart-v2",TXe=X((e,r)=>{var n,i,s;return((n=r==null?void 0:r.flowchart)==null?void 0:n.defaultRenderer)==="dagre-d3"?!1:(((i=r==null?void 0:r.flowchart)==null?void 0:i.defaultRenderer)==="elk"&&(r.layout="elk"),/^\s*graph/.test(e)&&((s=r==null?void 0:r.flowchart)==null?void 0:s.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),EXe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-Dfb4F2Jr.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:qae,diagram:e}},"loader"),AXe={id:qae,detector:TXe,loader:EXe},OXe=AXe,Gae="er",MXe=X(e=>/^\s*erDiagram/.test(e),"detector"),RXe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./erDiagram-INFDFZHY-DQKdSExU.js");return{diagram:r}},__vite__mapDeps([62,59,60,61]),import.meta.url);return{id:Gae,diagram:e}},"loader"),PXe={id:Gae,detector:MXe,loader:RXe},LXe=PXe,Kae="gitGraph",$Xe=X(e=>/^\s*gitGraph/.test(e),"detector"),DXe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./gitGraphDiagram-K3NZZRJ6-DF1ng26T.js");return{diagram:r}},__vite__mapDeps([63,64,65,66,49,51,52]),import.meta.url);return{id:Kae,diagram:e}},"loader"),IXe={id:Kae,detector:$Xe,loader:DXe},BXe=IXe,Yae="gantt",zXe=X(e=>/^\s*gantt/.test(e),"detector"),FXe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./ganttDiagram-A5KZAMGK-C9pvM7B0.js");return{diagram:r}},__vite__mapDeps([67,68,69]),import.meta.url);return{id:Yae,diagram:e}},"loader"),HXe={id:Yae,detector:zXe,loader:FXe},WXe=HXe,Xae="info",UXe=X(e=>/^\s*info/.test(e),"detector"),VXe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./infoDiagram-LFFYTUFH-DqktoSKY.js");return{diagram:r}},__vite__mapDeps([70,66,49,51,52]),import.meta.url);return{id:Xae,diagram:e}},"loader"),qXe={id:Xae,detector:UXe,loader:VXe},Jae="pie",GXe=X(e=>/^\s*pie/.test(e),"detector"),KXe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./pieDiagram-SKSYHLDU-C2dg01pY.js");return{diagram:r}},__vite__mapDeps([71,64,66,49,51,52,72]),import.meta.url);return{id:Jae,diagram:e}},"loader"),YXe={id:Jae,detector:GXe,loader:KXe},Zae="quadrantChart",XXe=X(e=>/^\s*quadrantChart/.test(e),"detector"),JXe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./quadrantDiagram-337W2JSQ-Ci0HHhZZ.js");return{diagram:r}},__vite__mapDeps([73,68,69]),import.meta.url);return{id:Zae,diagram:e}},"loader"),ZXe={id:Zae,detector:XXe,loader:JXe},QXe=ZXe,Qae="xychart",eJe=X(e=>/^\s*xychart(-beta)?/.test(e),"detector"),tJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./xychartDiagram-JWTSCODW-BgRI_wmA.js");return{diagram:r}},__vite__mapDeps([74,68,69]),import.meta.url);return{id:Qae,diagram:e}},"loader"),rJe={id:Qae,detector:eJe,loader:tJe},nJe=rJe,eoe="requirement",iJe=X(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),sJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./requirementDiagram-Z7DCOOCP-Cpa6xzfS.js");return{diagram:r}},__vite__mapDeps([75,59,60]),import.meta.url);return{id:eoe,diagram:e}},"loader"),aJe={id:eoe,detector:iJe,loader:sJe},oJe=aJe,toe="sequence",lJe=X(e=>/^\s*sequenceDiagram/.test(e),"detector"),cJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./sequenceDiagram-2WXFIKYE-DFR_JRAl.js");return{diagram:r}},__vite__mapDeps([76,56,65]),import.meta.url);return{id:toe,diagram:e}},"loader"),uJe={id:toe,detector:lJe,loader:cJe},dJe=uJe,roe="class",hJe=X((e,r)=>{var n;return((n=r==null?void 0:r.class)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),fJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./classDiagram-VBA2DB6C-COYaHGot.js");return{diagram:r}},__vite__mapDeps([77,78,58,56,59,60]),import.meta.url);return{id:roe,diagram:e}},"loader"),pJe={id:roe,detector:hJe,loader:fJe},mJe=pJe,noe="classDiagram",gJe=X((e,r)=>{var n;return/^\s*classDiagram/.test(e)&&((n=r==null?void 0:r.class)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),yJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./classDiagram-v2-RAHNMMFH-COYaHGot.js");return{diagram:r}},__vite__mapDeps([79,78,58,56,59,60]),import.meta.url);return{id:noe,diagram:e}},"loader"),vJe={id:noe,detector:gJe,loader:yJe},xJe=vJe,ioe="state",bJe=X((e,r)=>{var n;return((n=r==null?void 0:r.state)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),_Je=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./stateDiagram-RAJIS63D-DjS0hYUM.js");return{diagram:r}},__vite__mapDeps([80,81,59,60,48,49,50,51]),import.meta.url);return{id:ioe,diagram:e}},"loader"),wJe={id:ioe,detector:bJe,loader:_Je},SJe=wJe,soe="stateDiagram",kJe=X((e,r)=>{var n;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((n=r==null?void 0:r.state)==null?void 0:n.defaultRenderer)==="dagre-wrapper")},"detector"),CJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./stateDiagram-v2-FVOUBMTO-DXwakUby.js");return{diagram:r}},__vite__mapDeps([82,81,59,60]),import.meta.url);return{id:soe,diagram:e}},"loader"),jJe={id:soe,detector:kJe,loader:CJe},NJe=jJe,aoe="journey",TJe=X(e=>/^\s*journey/.test(e),"detector"),EJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./journeyDiagram-4ABVD52K-C1XiiAHp.js");return{diagram:r}},__vite__mapDeps([83,58,56,72]),import.meta.url);return{id:aoe,diagram:e}},"loader"),AJe={id:aoe,detector:TJe,loader:EJe},OJe=AJe,MJe=X((e,r,n)=>{At.debug(`rendering svg for syntax error
1183
- `);const i=NWe(r),s=i.append("g");i.attr("viewBox","0 0 2412 512"),Lte(i,100,512,!0),s.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),s.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),s.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),s.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),s.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),s.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),s.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),s.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${n}`)},"draw"),ooe={draw:MJe},RJe=ooe,PJe={db:{},renderer:ooe,parser:{parse:X(()=>{},"parse")}},LJe=PJe,loe="flowchart-elk",$Je=X((e,r={})=>{var n;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((n=r==null?void 0:r.flowchart)==null?void 0:n.defaultRenderer)==="elk"?(r.layout="elk",!0):!1},"detector"),DJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-Dfb4F2Jr.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:loe,diagram:e}},"loader"),IJe={id:loe,detector:$Je,loader:DJe},BJe=IJe,coe="timeline",zJe=X(e=>/^\s*timeline/.test(e),"detector"),FJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./timeline-definition-YZTLITO2-74ZokkIK.js");return{diagram:r}},__vite__mapDeps([84,72]),import.meta.url);return{id:coe,diagram:e}},"loader"),HJe={id:coe,detector:zJe,loader:FJe},WJe=HJe,uoe="mindmap",UJe=X(e=>/^\s*mindmap/.test(e),"detector"),VJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./mindmap-definition-YRQLILUH-CP7IM4ly.js");return{diagram:r}},__vite__mapDeps([85,59,60]),import.meta.url);return{id:uoe,diagram:e}},"loader"),qJe={id:uoe,detector:UJe,loader:VJe},GJe=qJe,doe="kanban",KJe=X(e=>/^\s*kanban/.test(e),"detector"),YJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./kanban-definition-K7BYSVSG-Bnl3u8lM.js");return{diagram:r}},__vite__mapDeps([86,58]),import.meta.url);return{id:doe,diagram:e}},"loader"),XJe={id:doe,detector:KJe,loader:YJe},JJe=XJe,hoe="sankey",ZJe=X(e=>/^\s*sankey(-beta)?/.test(e),"detector"),QJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./sankeyDiagram-WA2Y5GQK-YC0w4y3m.js");return{diagram:r}},[],import.meta.url);return{id:hoe,diagram:e}},"loader"),eZe={id:hoe,detector:ZJe,loader:QJe},tZe=eZe,foe="packet",rZe=X(e=>/^\s*packet(-beta)?/.test(e),"detector"),nZe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./diagram-P4PSJMXO-BqgEtSgl.js");return{diagram:r}},__vite__mapDeps([87,64,66,49,51,52]),import.meta.url);return{id:foe,diagram:e}},"loader"),iZe={id:foe,detector:rZe,loader:nZe},poe="radar",sZe=X(e=>/^\s*radar-beta/.test(e),"detector"),aZe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./diagram-IFDJBPK2-Dqsr0-8e.js");return{diagram:r}},__vite__mapDeps([88,64,66,49,51,52]),import.meta.url);return{id:poe,diagram:e}},"loader"),oZe={id:poe,detector:sZe,loader:aZe},moe="block",lZe=X(e=>/^\s*block(-beta)?/.test(e),"detector"),cZe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./blockDiagram-WCTKOSBZ-sCUOeM9Y.js");return{diagram:r}},__vite__mapDeps([89,58,52,49,48,61]),import.meta.url);return{id:moe,diagram:e}},"loader"),uZe={id:moe,detector:lZe,loader:cZe},dZe=uZe,goe="architecture",hZe=X(e=>/^\s*architecture/.test(e),"detector"),fZe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./architectureDiagram-2XIMDMQ5-BU1Io8ja.js");return{diagram:r}},__vite__mapDeps([90,64,66,49,51,52,54]),import.meta.url);return{id:goe,diagram:e}},"loader"),pZe={id:goe,detector:hZe,loader:fZe},mZe=pZe,yoe="ishikawa",gZe=X(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),yZe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./ishikawaDiagram-PHBUUO56-BSD3bhDW.js");return{diagram:r}},[],import.meta.url);return{id:yoe,diagram:e}},"loader"),vZe={id:yoe,detector:gZe,loader:yZe},voe="venn",xZe=X(e=>/^\s*venn-beta/.test(e),"detector"),bZe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./vennDiagram-LZ73GAT5-DjG2mV1S.js");return{diagram:r}},[],import.meta.url);return{id:voe,diagram:e}},"loader"),_Ze={id:voe,detector:xZe,loader:bZe},wZe=_Ze,xoe="treemap",SZe=X(e=>/^\s*treemap/.test(e),"detector"),kZe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./diagram-E7M64L7V-BlNFSjWJ.js");return{diagram:r}},__vite__mapDeps([91,60,64,66,49,51,52,69]),import.meta.url);return{id:xoe,diagram:e}},"loader"),CZe={id:xoe,detector:SZe,loader:kZe},rW=!1,YN=X(()=>{rW||(rW=!0,jj("error",LJe,e=>e.toLowerCase().trim()==="error"),jj("---",{db:{clear:X(()=>{},"clear")},styles:{},renderer:{draw:X(()=>{},"draw")},parser:{parse:X(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:X(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),lO(BJe,GJe,mZe),lO(SXe,JJe,xJe,mJe,LXe,WXe,qXe,YXe,oJe,dJe,OXe,NXe,WJe,BXe,NJe,SJe,OJe,QXe,tZe,iZe,nJe,dZe,oZe,vZe,CZe,wZe))},"addDiagrams"),jZe=X(async()=>{At.debug("Loading registered diagrams");const r=(await Promise.allSettled(Object.entries(ry).map(async([n,{detector:i,loader:s}])=>{if(s)try{hO(n)}catch{try{const{diagram:a,id:o}=await s();jj(o,a,i)}catch(a){throw At.error(`Failed to load external diagram with key ${n}. Removing from detectors.`),delete ry[n],a}}}))).filter(n=>n.status==="rejected");if(r.length>0){At.error(`Failed to load ${r.length} external diagrams`);for(const n of r)At.error(n);throw new Error(`Failed to load ${r.length} external diagrams`)}},"loadRegisteredDiagrams"),NZe="graphics-document document";function boe(e,r){e.attr("role",NZe),r!==""&&e.attr("aria-roledescription",r)}X(boe,"setA11yDiagramInfo");function _oe(e,r,n,i){if(e.insert!==void 0){if(n){const s=`chart-desc-${i}`;e.attr("aria-describedby",s),e.insert("desc",":first-child").attr("id",s).text(n)}if(r){const s=`chart-title-${i}`;e.attr("aria-labelledby",s),e.insert("title",":first-child").attr("id",s).text(r)}}}X(_oe,"addSVGa11yTitleDescription");var q0,r7=(q0=class{constructor(r,n,i,s,a){this.type=r,this.text=n,this.db=i,this.parser=s,this.renderer=a}static async fromText(r,n={}){var u,h;const i=nl(),s=Y9(r,i);r=AGe(r)+`
1182
+ L0,20`)},"requirement_arrow"),tXe=X((e,r,n)=>{const i=e.append("defs").append("marker").attr("id",n+"_"+r+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");i.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),i.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),i.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),rXe={extension:FYe,composition:HYe,aggregation:WYe,dependency:UYe,lollipop:VYe,point:qYe,circle:GYe,cross:KYe,barb:YYe,only_one:XYe,zero_or_one:JYe,one_or_more:ZYe,zero_or_more:QYe,requirement_arrow:eXe,requirement_contains:tXe},nXe=zYe,iXe={common:pk,getConfig:nl,insertCluster:uYe,insertEdge:BYe,insertEdgeLabel:RYe,insertMarkers:nXe,insertNode:Bae,interpolateToCurve:TP,labelHelper:dn,log:At,positionEdgeLabel:PYe},nS={},Wae=X(e=>{for(const r of e)nS[r.name]=r},"registerLayoutLoaders"),sXe=X(()=>{Wae([{name:"dagre",loader:X(async()=>await nt(()=>import("./dagre-KLK3FWXG-DKlMzH-N.js"),__vite__mapDeps([47,48,49,50,51,52]),import.meta.url),"loader")},{name:"cose-bilkent",loader:X(async()=>await nt(()=>import("./cose-bilkent-S5V4N54A-_u0YnyBo.js"),__vite__mapDeps([53,54]),import.meta.url),"loader")}])},"registerDefaultLayoutLoaders");sXe();var hbt=X(async(e,r)=>{if(!(e.layoutAlgorithm in nS))throw new Error(`Unknown layout algorithm: ${e.layoutAlgorithm}`);const n=nS[e.layoutAlgorithm];return(await n.loader()).render(e,r,iXe,{algorithm:n.algorithm})},"render"),fbt=X((e="",{fallback:r="dagre"}={})=>{if(e in nS)return e;if(r in nS)return At.warn(`Layout algorithm ${e} is not registered. Using ${r} as fallback.`),r;throw new Error(`Both layout algorithms ${e} and ${r} are not registered.`)},"getRegisteredLayoutAlgorithm"),aXe=xie(Object.keys,Object),oXe=Object.prototype,lXe=oXe.hasOwnProperty;function cXe(e){if(!zN(e))return aXe(e);var r=[];for(var n in Object(e))lXe.call(e,n)&&n!="constructor"&&r.push(n);return r}var ZO=jy(gh,"DataView"),QO=jy(gh,"Promise"),e7=jy(gh,"Set"),t7=jy(gh,"WeakMap"),XH="[object Map]",uXe="[object Object]",JH="[object Promise]",ZH="[object Set]",QH="[object WeakMap]",eW="[object DataView]",dXe=Cy(ZO),hXe=Cy(tS),fXe=Cy(QO),pXe=Cy(e7),mXe=Cy(t7),S0=ky;(ZO&&S0(new ZO(new ArrayBuffer(1)))!=eW||tS&&S0(new tS)!=XH||QO&&S0(QO.resolve())!=JH||e7&&S0(new e7)!=ZH||t7&&S0(new t7)!=QH)&&(S0=function(e){var r=ky(e),n=r==uXe?e.constructor:void 0,i=n?Cy(n):"";if(i)switch(i){case dXe:return eW;case hXe:return XH;case fXe:return JH;case pXe:return ZH;case mXe:return QH}return r});var gXe="[object Map]",yXe="[object Set]",vXe=Object.prototype,xXe=vXe.hasOwnProperty;function tW(e){if(e==null)return!0;if(FN(e)&&(Vj(e)||typeof e=="string"||typeof e.splice=="function"||jP(e)||NP(e)||Uj(e)))return!e.length;var r=S0(e);if(r==gXe||r==yXe)return!e.size;if(zN(e))return!cXe(e).length;for(var n in e)if(xXe.call(e,n))return!1;return!0}var Uae="c4",bXe=X(e=>/^\s*C4Context|C4Container|C4Component|C4Dynamic|C4Deployment/.test(e),"detector"),_Xe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./c4Diagram-IC4MRINW-BxuZtyKK.js");return{diagram:r}},__vite__mapDeps([55,56]),import.meta.url);return{id:Uae,diagram:e}},"loader"),wXe={id:Uae,detector:bXe,loader:_Xe},SXe=wXe,Vae="flowchart",kXe=X((e,r)=>{var n,i;return((n=r==null?void 0:r.flowchart)==null?void 0:n.defaultRenderer)==="dagre-wrapper"||((i=r==null?void 0:r.flowchart)==null?void 0:i.defaultRenderer)==="elk"?!1:/^\s*graph/.test(e)},"detector"),CXe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-CB9agj4M.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:Vae,diagram:e}},"loader"),jXe={id:Vae,detector:kXe,loader:CXe},NXe=jXe,qae="flowchart-v2",TXe=X((e,r)=>{var n,i,s;return((n=r==null?void 0:r.flowchart)==null?void 0:n.defaultRenderer)==="dagre-d3"?!1:(((i=r==null?void 0:r.flowchart)==null?void 0:i.defaultRenderer)==="elk"&&(r.layout="elk"),/^\s*graph/.test(e)&&((s=r==null?void 0:r.flowchart)==null?void 0:s.defaultRenderer)==="dagre-wrapper"?!0:/^\s*flowchart/.test(e))},"detector"),EXe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-CB9agj4M.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:qae,diagram:e}},"loader"),AXe={id:qae,detector:TXe,loader:EXe},OXe=AXe,Gae="er",MXe=X(e=>/^\s*erDiagram/.test(e),"detector"),RXe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./erDiagram-INFDFZHY-tdSesr0u.js");return{diagram:r}},__vite__mapDeps([62,59,60,61]),import.meta.url);return{id:Gae,diagram:e}},"loader"),PXe={id:Gae,detector:MXe,loader:RXe},LXe=PXe,Kae="gitGraph",$Xe=X(e=>/^\s*gitGraph/.test(e),"detector"),DXe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./gitGraphDiagram-K3NZZRJ6-DQg4IHrW.js");return{diagram:r}},__vite__mapDeps([63,64,65,66,49,51,52]),import.meta.url);return{id:Kae,diagram:e}},"loader"),IXe={id:Kae,detector:$Xe,loader:DXe},BXe=IXe,Yae="gantt",zXe=X(e=>/^\s*gantt/.test(e),"detector"),FXe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./ganttDiagram-A5KZAMGK-C4SghQ4X.js");return{diagram:r}},__vite__mapDeps([67,68,69]),import.meta.url);return{id:Yae,diagram:e}},"loader"),HXe={id:Yae,detector:zXe,loader:FXe},WXe=HXe,Xae="info",UXe=X(e=>/^\s*info/.test(e),"detector"),VXe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./infoDiagram-LFFYTUFH-DeZ8U7_l.js");return{diagram:r}},__vite__mapDeps([70,66,49,51,52]),import.meta.url);return{id:Xae,diagram:e}},"loader"),qXe={id:Xae,detector:UXe,loader:VXe},Jae="pie",GXe=X(e=>/^\s*pie/.test(e),"detector"),KXe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./pieDiagram-SKSYHLDU-C3MRIn-U.js");return{diagram:r}},__vite__mapDeps([71,64,66,49,51,52,72]),import.meta.url);return{id:Jae,diagram:e}},"loader"),YXe={id:Jae,detector:GXe,loader:KXe},Zae="quadrantChart",XXe=X(e=>/^\s*quadrantChart/.test(e),"detector"),JXe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./quadrantDiagram-337W2JSQ-DqSCsLTu.js");return{diagram:r}},__vite__mapDeps([73,68,69]),import.meta.url);return{id:Zae,diagram:e}},"loader"),ZXe={id:Zae,detector:XXe,loader:JXe},QXe=ZXe,Qae="xychart",eJe=X(e=>/^\s*xychart(-beta)?/.test(e),"detector"),tJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./xychartDiagram-JWTSCODW-BMnEKAac.js");return{diagram:r}},__vite__mapDeps([74,68,69]),import.meta.url);return{id:Qae,diagram:e}},"loader"),rJe={id:Qae,detector:eJe,loader:tJe},nJe=rJe,eoe="requirement",iJe=X(e=>/^\s*requirement(Diagram)?/.test(e),"detector"),sJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./requirementDiagram-Z7DCOOCP-PVnN4DIw.js");return{diagram:r}},__vite__mapDeps([75,59,60]),import.meta.url);return{id:eoe,diagram:e}},"loader"),aJe={id:eoe,detector:iJe,loader:sJe},oJe=aJe,toe="sequence",lJe=X(e=>/^\s*sequenceDiagram/.test(e),"detector"),cJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./sequenceDiagram-2WXFIKYE-Z0iLTIan.js");return{diagram:r}},__vite__mapDeps([76,56,65]),import.meta.url);return{id:toe,diagram:e}},"loader"),uJe={id:toe,detector:lJe,loader:cJe},dJe=uJe,roe="class",hJe=X((e,r)=>{var n;return((n=r==null?void 0:r.class)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!1:/^\s*classDiagram/.test(e)},"detector"),fJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./classDiagram-VBA2DB6C-CJR8ILFD.js");return{diagram:r}},__vite__mapDeps([77,78,58,56,59,60]),import.meta.url);return{id:roe,diagram:e}},"loader"),pJe={id:roe,detector:hJe,loader:fJe},mJe=pJe,noe="classDiagram",gJe=X((e,r)=>{var n;return/^\s*classDiagram/.test(e)&&((n=r==null?void 0:r.class)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!0:/^\s*classDiagram-v2/.test(e)},"detector"),yJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./classDiagram-v2-RAHNMMFH-CJR8ILFD.js");return{diagram:r}},__vite__mapDeps([79,78,58,56,59,60]),import.meta.url);return{id:noe,diagram:e}},"loader"),vJe={id:noe,detector:gJe,loader:yJe},xJe=vJe,ioe="state",bJe=X((e,r)=>{var n;return((n=r==null?void 0:r.state)==null?void 0:n.defaultRenderer)==="dagre-wrapper"?!1:/^\s*stateDiagram/.test(e)},"detector"),_Je=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./stateDiagram-RAJIS63D-DZ9Qstd6.js");return{diagram:r}},__vite__mapDeps([80,81,59,60,48,49,50,51]),import.meta.url);return{id:ioe,diagram:e}},"loader"),wJe={id:ioe,detector:bJe,loader:_Je},SJe=wJe,soe="stateDiagram",kJe=X((e,r)=>{var n;return!!(/^\s*stateDiagram-v2/.test(e)||/^\s*stateDiagram/.test(e)&&((n=r==null?void 0:r.state)==null?void 0:n.defaultRenderer)==="dagre-wrapper")},"detector"),CJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./stateDiagram-v2-FVOUBMTO-CI244ggG.js");return{diagram:r}},__vite__mapDeps([82,81,59,60]),import.meta.url);return{id:soe,diagram:e}},"loader"),jJe={id:soe,detector:kJe,loader:CJe},NJe=jJe,aoe="journey",TJe=X(e=>/^\s*journey/.test(e),"detector"),EJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./journeyDiagram-4ABVD52K-DMUpxgrL.js");return{diagram:r}},__vite__mapDeps([83,58,56,72]),import.meta.url);return{id:aoe,diagram:e}},"loader"),AJe={id:aoe,detector:TJe,loader:EJe},OJe=AJe,MJe=X((e,r,n)=>{At.debug(`rendering svg for syntax error
1183
+ `);const i=NWe(r),s=i.append("g");i.attr("viewBox","0 0 2412 512"),Lte(i,100,512,!0),s.append("path").attr("class","error-icon").attr("d","m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z"),s.append("path").attr("class","error-icon").attr("d","m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z"),s.append("path").attr("class","error-icon").attr("d","m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z"),s.append("path").attr("class","error-icon").attr("d","m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z"),s.append("path").attr("class","error-icon").attr("d","m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z"),s.append("path").attr("class","error-icon").attr("d","m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z"),s.append("text").attr("class","error-text").attr("x",1440).attr("y",250).attr("font-size","150px").style("text-anchor","middle").text("Syntax error in text"),s.append("text").attr("class","error-text").attr("x",1250).attr("y",400).attr("font-size","100px").style("text-anchor","middle").text(`mermaid version ${n}`)},"draw"),ooe={draw:MJe},RJe=ooe,PJe={db:{},renderer:ooe,parser:{parse:X(()=>{},"parse")}},LJe=PJe,loe="flowchart-elk",$Je=X((e,r={})=>{var n;return/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&((n=r==null?void 0:r.flowchart)==null?void 0:n.defaultRenderer)==="elk"?(r.layout="elk",!0):!1},"detector"),DJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./flowDiagram-PKNHOUZH-CB9agj4M.js");return{diagram:r}},__vite__mapDeps([57,58,56,59,60,61]),import.meta.url);return{id:loe,diagram:e}},"loader"),IJe={id:loe,detector:$Je,loader:DJe},BJe=IJe,coe="timeline",zJe=X(e=>/^\s*timeline/.test(e),"detector"),FJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./timeline-definition-YZTLITO2-HqkKyQAQ.js");return{diagram:r}},__vite__mapDeps([84,72]),import.meta.url);return{id:coe,diagram:e}},"loader"),HJe={id:coe,detector:zJe,loader:FJe},WJe=HJe,uoe="mindmap",UJe=X(e=>/^\s*mindmap/.test(e),"detector"),VJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./mindmap-definition-YRQLILUH-BTzb4KqR.js");return{diagram:r}},__vite__mapDeps([85,59,60]),import.meta.url);return{id:uoe,diagram:e}},"loader"),qJe={id:uoe,detector:UJe,loader:VJe},GJe=qJe,doe="kanban",KJe=X(e=>/^\s*kanban/.test(e),"detector"),YJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./kanban-definition-K7BYSVSG-8tciWF1Y.js");return{diagram:r}},__vite__mapDeps([86,58]),import.meta.url);return{id:doe,diagram:e}},"loader"),XJe={id:doe,detector:KJe,loader:YJe},JJe=XJe,hoe="sankey",ZJe=X(e=>/^\s*sankey(-beta)?/.test(e),"detector"),QJe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./sankeyDiagram-WA2Y5GQK-Bm-JwlZA.js");return{diagram:r}},[],import.meta.url);return{id:hoe,diagram:e}},"loader"),eZe={id:hoe,detector:ZJe,loader:QJe},tZe=eZe,foe="packet",rZe=X(e=>/^\s*packet(-beta)?/.test(e),"detector"),nZe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./diagram-P4PSJMXO-7fmmLg7E.js");return{diagram:r}},__vite__mapDeps([87,64,66,49,51,52]),import.meta.url);return{id:foe,diagram:e}},"loader"),iZe={id:foe,detector:rZe,loader:nZe},poe="radar",sZe=X(e=>/^\s*radar-beta/.test(e),"detector"),aZe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./diagram-IFDJBPK2-x4UfB8Jh.js");return{diagram:r}},__vite__mapDeps([88,64,66,49,51,52]),import.meta.url);return{id:poe,diagram:e}},"loader"),oZe={id:poe,detector:sZe,loader:aZe},moe="block",lZe=X(e=>/^\s*block(-beta)?/.test(e),"detector"),cZe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./blockDiagram-WCTKOSBZ-DjpfTolF.js");return{diagram:r}},__vite__mapDeps([89,58,52,49,48,61]),import.meta.url);return{id:moe,diagram:e}},"loader"),uZe={id:moe,detector:lZe,loader:cZe},dZe=uZe,goe="architecture",hZe=X(e=>/^\s*architecture/.test(e),"detector"),fZe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./architectureDiagram-2XIMDMQ5-CTXTLOZg.js");return{diagram:r}},__vite__mapDeps([90,64,66,49,51,52,54]),import.meta.url);return{id:goe,diagram:e}},"loader"),pZe={id:goe,detector:hZe,loader:fZe},mZe=pZe,yoe="ishikawa",gZe=X(e=>/^\s*ishikawa(-beta)?\b/i.test(e),"detector"),yZe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./ishikawaDiagram-PHBUUO56-Dzb2FwTV.js");return{diagram:r}},[],import.meta.url);return{id:yoe,diagram:e}},"loader"),vZe={id:yoe,detector:gZe,loader:yZe},voe="venn",xZe=X(e=>/^\s*venn-beta/.test(e),"detector"),bZe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./vennDiagram-LZ73GAT5-B-DXipE7.js");return{diagram:r}},[],import.meta.url);return{id:voe,diagram:e}},"loader"),_Ze={id:voe,detector:xZe,loader:bZe},wZe=_Ze,xoe="treemap",SZe=X(e=>/^\s*treemap/.test(e),"detector"),kZe=X(async()=>{const{diagram:e}=await nt(async()=>{const{diagram:r}=await import("./diagram-E7M64L7V-DXqyTn3i.js");return{diagram:r}},__vite__mapDeps([91,60,64,66,49,51,52,69]),import.meta.url);return{id:xoe,diagram:e}},"loader"),CZe={id:xoe,detector:SZe,loader:kZe},rW=!1,YN=X(()=>{rW||(rW=!0,jj("error",LJe,e=>e.toLowerCase().trim()==="error"),jj("---",{db:{clear:X(()=>{},"clear")},styles:{},renderer:{draw:X(()=>{},"draw")},parser:{parse:X(()=>{throw new Error("Diagrams beginning with --- are not valid. If you were trying to use a YAML front-matter, please ensure that you've correctly opened and closed the YAML front-matter with un-indented `---` blocks")},"parse")},init:X(()=>null,"init")},e=>e.toLowerCase().trimStart().startsWith("---")),lO(BJe,GJe,mZe),lO(SXe,JJe,xJe,mJe,LXe,WXe,qXe,YXe,oJe,dJe,OXe,NXe,WJe,BXe,NJe,SJe,OJe,QXe,tZe,iZe,nJe,dZe,oZe,vZe,CZe,wZe))},"addDiagrams"),jZe=X(async()=>{At.debug("Loading registered diagrams");const r=(await Promise.allSettled(Object.entries(ry).map(async([n,{detector:i,loader:s}])=>{if(s)try{hO(n)}catch{try{const{diagram:a,id:o}=await s();jj(o,a,i)}catch(a){throw At.error(`Failed to load external diagram with key ${n}. Removing from detectors.`),delete ry[n],a}}}))).filter(n=>n.status==="rejected");if(r.length>0){At.error(`Failed to load ${r.length} external diagrams`);for(const n of r)At.error(n);throw new Error(`Failed to load ${r.length} external diagrams`)}},"loadRegisteredDiagrams"),NZe="graphics-document document";function boe(e,r){e.attr("role",NZe),r!==""&&e.attr("aria-roledescription",r)}X(boe,"setA11yDiagramInfo");function _oe(e,r,n,i){if(e.insert!==void 0){if(n){const s=`chart-desc-${i}`;e.attr("aria-describedby",s),e.insert("desc",":first-child").attr("id",s).text(n)}if(r){const s=`chart-title-${i}`;e.attr("aria-labelledby",s),e.insert("title",":first-child").attr("id",s).text(r)}}}X(_oe,"addSVGa11yTitleDescription");var q0,r7=(q0=class{constructor(r,n,i,s,a){this.type=r,this.text=n,this.db=i,this.parser=s,this.renderer=a}static async fromText(r,n={}){var u,h;const i=nl(),s=Y9(r,i);r=AGe(r)+`
1184
1184
  `;try{hO(s)}catch{const f=vIe(s);if(!f)throw new _te(`Diagram ${s} not found.`);const{id:g,diagram:v}=await f();jj(g,v)}const{db:a,parser:o,renderer:l,init:d}=hO(s);return o.parser&&(o.parser.yy=a),(u=a.clear)==null||u.call(a),d==null||d(i),n.title&&((h=a.setDiagramTitle)==null||h.call(a,n.title)),await o.parse(r),new q0(s,r,a,o,l)}async render(r,n){await this.renderer.draw(this.text,r,n,this)}getParser(){return this.parser}getType(){return this.type}},X(q0,"Diagram"),q0),nW=[],TZe=X(()=>{nW.forEach(e=>{e()}),nW=[]},"attachFunctions"),EZe=X(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,"").trimStart(),"cleanupComments");function woe(e){const r=e.match(bte);if(!r)return{text:e,metadata:{}};let n=PUe(r[1],{schema:RUe})??{};n=typeof n=="object"&&!Array.isArray(n)?n:{};const i={};return n.displayMode&&(i.displayMode=n.displayMode.toString()),n.title&&(i.title=n.title.toString()),n.config&&(i.config=n.config),{text:e.slice(r[0].length),metadata:i}}X(woe,"extractFrontMatter");var AZe=X(e=>e.replace(/\r\n?/g,`
1185
1185
  `).replace(/<(\w+)([^>]*)>/g,(r,n,i)=>"<"+n+i.replace(/="([^"]*)"/g,"='$1'")+">"),"cleanupText"),OZe=X(e=>{const{text:r,metadata:n}=woe(e),{displayMode:i,title:s,config:a={}}=n;return i&&(a.gantt||(a.gantt={}),a.gantt.displayMode=i),{title:s,config:a,text:r}},"processFrontmatter"),MZe=X(e=>{const r=Gd.detectInit(e)??{},n=Gd.detectDirective(e,"wrap");return Array.isArray(n)?r.wrap=n.some(({type:i})=>i==="wrap"):(n==null?void 0:n.type)==="wrap"&&(r.wrap=!0),{text:yGe(e),directive:r}},"processDirectives");function YP(e){const r=AZe(e),n=OZe(r),i=MZe(n.text),s=RP(n.config,i.directive);return e=EZe(i.text),{code:e,title:n.title,config:s}}X(YP,"preprocessDiagram");function Soe(e){const r=new TextEncoder().encode(e),n=Array.from(r,i=>String.fromCodePoint(i)).join("");return btoa(n)}X(Soe,"toBase64");var RZe=5e4,PZe="graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa",LZe="sandbox",$Ze="loose",DZe="http://www.w3.org/2000/svg",IZe="http://www.w3.org/1999/xlink",BZe="http://www.w3.org/1999/xhtml",zZe="100%",FZe="100%",HZe="border:0;margin:0;",WZe="margin:0",UZe="allow-top-navigation-by-user-activation allow-popups",VZe='The "iframe" tag is not supported by your browser.',qZe=["foreignobject"],GZe=["dominant-baseline"];function XP(e){const r=YP(e);return kj(),PIe(r.config??{}),r}X(XP,"processAndSetConfigs");async function koe(e,r){YN();try{const{code:n,config:i}=XP(e);return{diagramType:(await joe(n)).type,config:i}}catch(n){if(r!=null&&r.suppressErrors)return!1;throw n}}X(koe,"parse");var iW=X((e,r,n=[])=>`
1186
1186
  .${e} ${r} { ${n.join(" !important; ")} !important; }`,"cssImportantStyles"),KZe=X((e,r=new Map)=>{let n="";if(e.themeCSS!==void 0&&(n+=`
@@ -1227,7 +1227,7 @@ ${e.themeCSS}`),e.fontFamily!==void 0&&(n+=`
1227
1227
  `);navigator.clipboard.writeText(S),d(!0),setTimeout(()=>d(!1),1500)};y.useEffect(()=>{i&&g.length>0&&v.scrollToIndex(g.length-1,{align:"end"})},[g.length,i]);const _=y.useCallback(()=>{const S=n.current;if(!S)return;const w=S.scrollHeight-S.scrollTop-S.clientHeight<40;s(w)},[]);return c.jsxs("div",{className:"flex flex-col h-full bg-[#0d1117] text-[#c9d1d9] text-xs font-mono",children:[c.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-zinc-700/60 shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"text-xs font-semibold text-zinc-400 uppercase tracking-wider",children:"SSE Debug"}),c.jsxs("span",{className:"text-2xs text-zinc-500",children:[g.length,"/",r.length]})]}),c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("input",{type:"text",placeholder:"Filter...",value:a,onChange:S=>o(S.target.value),className:"h-5 w-28 px-1.5 text-2xs rounded bg-zinc-800 border border-zinc-700 text-zinc-300 placeholder-zinc-500 focus:outline-none focus:border-blue-500"}),c.jsx(we,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:b,title:"Copy all events",children:l?c.jsx(ms,{className:"h-3 w-3 text-green-400"}):c.jsx(hc,{className:"h-3 w-3"})}),c.jsx(we,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:Jtt,children:c.jsx(Rl,{className:"h-3 w-3"})}),c.jsx(we,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:e,children:c.jsx(Xn,{className:"h-3 w-3"})})]})]}),c.jsx("div",{ref:n,onScroll:_,className:"flex-1 overflow-y-auto overflow-x-hidden",children:c.jsx("div",{style:{height:`${v.getTotalSize()}px`,position:"relative",width:"100%"},children:v.getVirtualItems().map(S=>{const w=g[S.index],C=new Date(w.ts).toISOString().slice(11,23),j=Qtt[w.type]??"text-zinc-400",E=w.raw.length>120,A=u.has(w.id),N=E&&!A?w.raw.slice(0,120)+"…":w.raw;return c.jsxs("div",{"data-index":S.index,ref:v.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${S.start}px)`},className:Ae("flex gap-2 px-2 hover:bg-zinc-800/50 leading-tight cursor-pointer select-none",A?"items-start py-1 bg-zinc-800/30":"items-center"),onClick:()=>f(w.id),children:[c.jsx("span",{className:"text-zinc-600 shrink-0 w-20",style:{minHeight:p8},children:C}),c.jsx("span",{className:Ae("shrink-0 w-28 text-right",j),style:{minHeight:p8},children:w.type}),c.jsxs("span",{className:Ae("text-zinc-400 min-w-0",A?"break-all whitespace-pre-wrap":"truncate"),children:[N,E&&!A&&c.jsx("span",{className:"text-zinc-600 ml-1",children:"▸"})]})]},w.id)})})}),!i&&c.jsx("div",{className:"absolute bottom-2 right-4",children:c.jsx(we,{variant:"outline",size:"icon",className:"h-6 w-6 rounded-full bg-zinc-800 border-zinc-600",onClick:()=>{s(!0),v.scrollToIndex(g.length-1,{align:"end"})},children:c.jsx(pY,{className:"h-3 w-3"})})})]})}function trt(e,r=[]){let n=[];function i(a,o){const l=y.createContext(o),d=n.length;n=[...n,o];const u=f=>{var w;const{scope:g,children:v,...b}=f,_=((w=g==null?void 0:g[e])==null?void 0:w[d])||l,S=y.useMemo(()=>b,Object.values(b));return c.jsx(_.Provider,{value:S,children:v})};u.displayName=a+"Provider";function h(f,g){var _;const v=((_=g==null?void 0:g[e])==null?void 0:_[d])||l,b=y.useContext(v);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[u,h]}const s=()=>{const a=n.map(o=>y.createContext(o));return function(l){const d=(l==null?void 0:l[e])||a;return y.useMemo(()=>({[`__scope${e}`]:{...l,[e]:d}}),[l,d])}};return s.scopeName=e,[i,rrt(s,...r)]}function rrt(...e){const r=e[0];if(e.length===1)return r;const n=()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const o=i.reduce((l,{useScope:d,scopeName:u})=>{const f=d(a)[`__scope${u}`];return{...l,...f}},{});return y.useMemo(()=>({[`__scope${r.scopeName}`]:o}),[o])}};return n.scopeName=r.scopeName,n}function xle(e){const r=y.useRef({value:e,previous:e});return y.useMemo(()=>(r.current.value!==e&&(r.current.previous=r.current.value,r.current.value=e),r.current.previous),[e])}function nrt(e){const r=irt(e),n=y.forwardRef((i,s)=>{const{children:a,...o}=i,l=y.Children.toArray(a),d=l.find(art);if(d){const u=d.props.children,h=l.map(f=>f===d?y.Children.count(u)>1?y.Children.only(null):y.isValidElement(u)?u.props.children:null:f);return c.jsx(r,{...o,ref:s,children:y.isValidElement(u)?y.cloneElement(u,void 0,h):null})}return c.jsx(r,{...o,ref:s,children:a})});return n.displayName=`${e}.Slot`,n}function irt(e){const r=y.forwardRef((n,i)=>{const{children:s,...a}=n;if(y.isValidElement(s)){const o=lrt(s),l=ort(a,s.props);return s.type!==y.Fragment&&(l.ref=i?va(i,o):o),y.cloneElement(s,l)}return y.Children.count(s)>1?y.Children.only(null):null});return r.displayName=`${e}.SlotClone`,r}var srt=Symbol("radix.slottable");function art(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===srt}function ort(e,r){const n={...r};for(const i in r){const s=e[i],a=r[i];/^on[A-Z]/.test(i)?s&&a?n[i]=(...l)=>{const d=a(...l);return s(...l),d}:s&&(n[i]=s):i==="style"?n[i]={...s,...a}:i==="className"&&(n[i]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}function lrt(e){var i,s;let r=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,n=r&&"isReactWarning"in r&&r.isReactWarning;return n?e.ref:(r=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=r&&"isReactWarning"in r&&r.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var crt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ble=crt.reduce((e,r)=>{const n=nrt(`Primitive.${r}`),i=y.forwardRef((s,a)=>{const{asChild:o,...l}=s,d=o?n:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(d,{...l,ref:a})});return i.displayName=`Primitive.${r}`,{...e,[r]:i}},{}),QN="Switch",[urt]=trt(QN),[drt,hrt]=urt(QN),_le=y.forwardRef((e,r)=>{const{__scopeSwitch:n,name:i,checked:s,defaultChecked:a,required:o,disabled:l,value:d="on",onCheckedChange:u,form:h,...f}=e,[g,v]=y.useState(null),b=ui(r,j=>v(j)),_=y.useRef(!1),S=g?h||!!g.closest("form"):!0,[w,C]=Cp({prop:s,defaultProp:a??!1,onChange:u,caller:QN});return c.jsxs(drt,{scope:n,checked:w,disabled:l,children:[c.jsx(ble.button,{type:"button",role:"switch","aria-checked":w,"aria-required":o,"data-state":Cle(w),"data-disabled":l?"":void 0,disabled:l,value:d,...f,ref:b,onClick:xr(e.onClick,j=>{C(E=>!E),S&&(_.current=j.isPropagationStopped(),_.current||j.stopPropagation())})}),S&&c.jsx(kle,{control:g,bubbles:!_.current,name:i,value:d,checked:w,required:o,disabled:l,form:h,style:{transform:"translateX(-100%)"}})]})});_le.displayName=QN;var wle="SwitchThumb",Sle=y.forwardRef((e,r)=>{const{__scopeSwitch:n,...i}=e,s=hrt(wle,n);return c.jsx(ble.span,{"data-state":Cle(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:r})});Sle.displayName=wle;var frt="SwitchBubbleInput",kle=y.forwardRef(({__scopeSwitch:e,control:r,checked:n,bubbles:i=!0,...s},a)=>{const o=y.useRef(null),l=ui(o,a),d=xle(n),u=QY(r);return y.useEffect(()=>{const h=o.current;if(!h)return;const f=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(f,"checked").set;if(d!==n&&v){const b=new Event("click",{bubbles:i});v.call(h,n),h.dispatchEvent(b)}},[d,n,i]),c.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:l,style:{...s.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});kle.displayName=frt;function Cle(e){return e?"checked":"unchecked"}var jle=_le,prt=Sle;const gf=y.forwardRef(({className:e,...r},n)=>c.jsx(jle,{className:Ae("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...r,ref:n,children:c.jsx(prt,{className:Ae("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));gf.displayName=jle.displayName;const b7=[{label:"Every minute",value:"* * * * *",description:"Runs every minute"},{label:"Every 5 minutes",value:"*/5 * * * *",description:"Runs every 5 minutes"},{label:"Every 15 minutes",value:"*/15 * * * *",description:"Runs every 15 minutes"},{label:"Every 30 minutes",value:"*/30 * * * *",description:"Runs every 30 minutes"},{label:"Hourly",value:"0 * * * *",description:"Runs at the start of every hour"},{label:"Every 2 hours",value:"0 */2 * * *",description:"Runs every 2 hours"},{label:"Daily at midnight",value:"0 0 * * *",description:"Runs at 00:00 every day"},{label:"Daily at 9am",value:"0 9 * * *",description:"Runs at 09:00 every day"},{label:"Daily at 6pm",value:"0 18 * * *",description:"Runs at 18:00 every day"},{label:"Weekly (Sunday)",value:"0 0 * * 0",description:"Runs at midnight every Sunday"},{label:"Weekly (Monday)",value:"0 9 * * 1",description:"Runs at 9am every Monday"},{label:"Monthly",value:"0 0 1 * *",description:"Runs at midnight on the 1st of each month"}];function e6(e){return e.trim().split(/\s+/).join(" ")}function Qc(e){if(!/^\d+$/.test(e))return null;const r=Number.parseInt(e,10);return Number.isNaN(r)?null:r}function Nle(e){const r=e6(e),n=r.split(" ");if(n.length!==5)return r;const[i,s,a,o,l]=n,d=b7.find(h=>h.value===r);if(d)return d.description;const u=[];if(i==="*"&&s==="*"?u.push("Every minute"):i.startsWith("*/")?u.push(`Every ${i.slice(2)} minutes`):s==="*"?u.push(`At minute ${i} of every hour`):i==="0"?u.push(`At ${s}:00`):u.push(`At ${s}:${i.padStart(2,"0")}`),l!=="*"){const h=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],f=Qc(l);f!==null&&f>=0&&f<=6&&u.push(`on ${h[f]}`)}if(a!=="*"&&u.push(`on day ${a}`),o!=="*"){const h=["","January","February","March","April","May","June","July","August","September","October","November","December"],f=Qc(o);f!==null&&f>=1&&f<=12&&u.push(`in ${h[f]}`)}return u.join(" ")}function Tle(e){const r=e6(e).split(" ");if(r.length!==5)return{valid:!1,error:"Cron expression must have 5 parts (minute hour day month weekday)"};const[n,i,s,a,o]=r,l=[{name:"minute",value:n,min:0,max:59},{name:"hour",value:i,min:0,max:23},{name:"day",value:s,min:1,max:31},{name:"month",value:a,min:1,max:12},{name:"weekday",value:o,min:0,max:6}];for(const d of l)if(!mrt(d.value,d.min,d.max))return{valid:!1,error:`Invalid ${d.name}: ${d.value}`};return{valid:!0}}function mrt(e,r,n){if(e==="*")return!0;if(e.startsWith("*/")){const s=Qc(e.slice(2));return s!==null&&s>0&&s<=n}if(e.includes("-")){const s=e.split("-");if(s.length!==2)return!1;const a=Qc(s[0]??""),o=Qc(s[1]??"");return a!==null&&o!==null&&a>=r&&o<=n&&a<=o}if(e.includes(","))return e.split(",").every(s=>{const a=Qc(s);return a!==null&&a>=r&&a<=n});const i=Qc(e);return i!==null&&i>=r&&i<=n}function grt(e){try{if(!Tle(e).valid)return null;const r=new Date,n=e6(e).split(" "),[i,s]=n;if(i==="*"&&s==="*"){const a=new Date(r);return a.setMinutes(r.getMinutes()+1,0,0),a}if(i.startsWith("*/")){const a=Qc(i.slice(2));if(a===null||a<=0)return null;const o=new Date(r),l=Math.ceil(r.getMinutes()/a)*a;return l>=60?(o.setHours(o.getHours()+1),o.setMinutes(l%60)):o.setMinutes(l),o.setSeconds(0),o.setMilliseconds(0),o<=r&&o.setMinutes(o.getMinutes()+a),o}if(i!=="*"&&s==="*"){const a=Qc(i);if(a===null)return null;const o=new Date(r);return o.setMinutes(a,0,0),o<=r&&o.setHours(o.getHours()+1),o}if(i!=="*"&&s.startsWith("*/")){const a=Qc(i),o=Qc(s.slice(2));if(a===null||o===null||o<=0)return null;const l=new Date(r);l.setMinutes(a,0,0);const d=r.getHours(),u=d%o;let h=u===0?d:d+(o-u);return l.setHours(h),l<=r&&(h+=o,l.setHours(h)),l}if(i!=="*"&&s!=="*"){const a=Qc(i),o=Qc(s);if(a===null||o===null)return null;const l=new Date(r);return l.setHours(o),l.setMinutes(a),l.setSeconds(0),l.setMilliseconds(0),l<=r&&l.setDate(l.getDate()+1),l}return null}catch{return null}}function yrt(e){const r=new Date,n=e.getTime()-r.getTime();if(n<6e4)return"now";const i=Math.floor(n/6e4);if(i<60)return`in ${i}m`;const s=Math.floor(n/36e5);return s<24?`in ${s}h`:`in ${Math.floor(n/864e5)}d`}function vrt({job:e,recentRun:r,onToggle:n,onTrigger:i,onDelete:s,onEdit:a,onViewHistory:o,isLoading:l=!1}){const[d,u]=y.useState(!1),[h,f]=y.useState(!1),g=async S=>{u(!0);try{await n(e.id,S)}finally{u(!1)}},v=async()=>{f(!0);try{await i(e.id)}finally{f(!1)}},b=e.enabled?grt(e.cron_expression):null,_={agent_task:"Agent Task",system_job:"System Job"};return c.jsxs(tn,{"data-testid":`job-card-${e.id}`,className:Ae("transition-opacity",l&&"opacity-50",!e.enabled&&"opacity-75"),children:[c.jsx(gle,{className:"space-y-3 pb-3",children:c.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-start md:justify-between",children:[c.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[e.job_type==="agent_task"&&e.model&&e.provider&&c.jsx(yj,{provider:e.provider,model:e.model,size:32}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx(yle,{className:"truncate text-base md:text-lg",children:e.name}),c.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[c.jsx(Or,{variant:e.job_type==="agent_task"?"default":"secondary",children:_[e.job_type]}),e.provider&&c.jsx(Or,{variant:"outline",className:"text-xs",children:e.provider})]})]})]}),c.jsxs("div",{className:"flex items-center justify-between rounded-md border bg-muted/20 px-3 py-2 md:min-w-[92px] md:justify-end md:border-0 md:bg-transparent md:p-0",children:[c.jsx("span",{className:"text-xs text-muted-foreground md:hidden",children:e.enabled?"Enabled":"Paused"}),c.jsx(gf,{checked:e.enabled,onCheckedChange:g,disabled:d})]})]})}),c.jsxs(Kc,{className:"space-y-3 pt-0",children:[c.jsxs("div",{className:"flex flex-col gap-1 text-sm text-muted-foreground md:flex-row md:items-center md:gap-2",children:[c.jsx(vg,{className:"h-4 w-4"}),c.jsx("span",{className:"break-all font-mono",children:e.cron_expression}),c.jsxs("span",{className:"text-xs md:text-xs",children:["(",Nle(e.cron_expression),")"]})]}),b&&c.jsxs("div",{className:"text-sm text-muted-foreground",children:["Next run: ",b.toLocaleString()," (",yrt(b),")"]}),e.prompt&&c.jsxs("div",{className:"line-clamp-2 text-sm italic text-muted-foreground",children:['"',e.prompt,'"']}),r&&c.jsxs("div",{className:"flex flex-col gap-1 text-sm md:flex-row md:items-center md:gap-2",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[r.status==="completed"&&c.jsxs(c.Fragment,{children:[c.jsx(ia,{className:"h-4 w-4 text-green-500"}),c.jsx("span",{className:"text-green-600 dark:text-green-400",children:"Last run succeeded"})]}),r.status==="failed"&&c.jsxs(c.Fragment,{children:[c.jsx(na,{className:"h-4 w-4 text-red-500"}),c.jsx("span",{className:"text-red-600 dark:text-red-400",children:"Last run failed"})]}),r.status==="running"&&c.jsxs(c.Fragment,{children:[c.jsx(Ft,{className:"h-4 w-4 animate-spin text-blue-500"}),c.jsx("span",{className:"text-blue-600 dark:text-blue-400",children:"Running now..."})]})]}),r.started_at&&c.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(r.started_at).toLocaleString()})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-2 border-t pt-3 md:grid-cols-[minmax(0,1fr)_auto_auto_auto] md:items-center",children:[c.jsxs(we,{variant:"outline",size:"sm",onClick:v,disabled:h||!e.enabled,"data-testid":`job-trigger-${e.id}`,className:"w-full md:justify-self-start",children:[h?c.jsx(Ft,{className:"h-4 w-4 mr-1 animate-spin"}):c.jsx(WS,{className:"h-4 w-4 mr-1"}),"Run Now"]}),c.jsxs(we,{variant:"ghost",size:"sm",onClick:()=>o(e),"data-testid":`job-history-${e.id}`,className:"w-full md:w-auto",children:[c.jsx(U5,{className:"h-4 w-4 mr-1"}),c.jsx("span",{className:"md:hidden lg:inline",children:"History"})]}),c.jsx(we,{variant:"ghost",size:"icon",onClick:()=>a(e),"aria-label":`Edit job ${e.name}`,"data-testid":`job-edit-${e.id}`,className:"h-8 w-full md:w-8",children:c.jsx(_ve,{className:"h-4 w-4"})}),c.jsx(we,{variant:"ghost",size:"icon",onClick:()=>s(e.id),className:"h-8 w-full text-destructive hover:bg-destructive/10 hover:text-destructive md:w-8","aria-label":`Delete job ${e.name}`,"data-testid":`job-delete-${e.id}`,children:c.jsx(Rl,{className:"h-4 w-4"})})]})]})]})}function eU(e,[r,n]){return Math.min(n,Math.max(r,e))}function xrt(e,r=[]){let n=[];function i(a,o){const l=y.createContext(o),d=n.length;n=[...n,o];const u=f=>{var w;const{scope:g,children:v,...b}=f,_=((w=g==null?void 0:g[e])==null?void 0:w[d])||l,S=y.useMemo(()=>b,Object.values(b));return c.jsx(_.Provider,{value:S,children:v})};u.displayName=a+"Provider";function h(f,g){var _;const v=((_=g==null?void 0:g[e])==null?void 0:_[d])||l,b=y.useContext(v);if(b)return b;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[u,h]}const s=()=>{const a=n.map(o=>y.createContext(o));return function(l){const d=(l==null?void 0:l[e])||a;return y.useMemo(()=>({[`__scope${e}`]:{...l,[e]:d}}),[l,d])}};return s.scopeName=e,[i,brt(s,...r)]}function brt(...e){const r=e[0];if(e.length===1)return r;const n=()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const o=i.reduce((l,{useScope:d,scopeName:u})=>{const f=d(a)[`__scope${u}`];return{...l,...f}},{});return y.useMemo(()=>({[`__scope${r.scopeName}`]:o}),[o])}};return n.scopeName=r.scopeName,n}function Ele(e){const r=_rt(e),n=y.forwardRef((i,s)=>{const{children:a,...o}=i,l=y.Children.toArray(a),d=l.find(Srt);if(d){const u=d.props.children,h=l.map(f=>f===d?y.Children.count(u)>1?y.Children.only(null):y.isValidElement(u)?u.props.children:null:f);return c.jsx(r,{...o,ref:s,children:y.isValidElement(u)?y.cloneElement(u,void 0,h):null})}return c.jsx(r,{...o,ref:s,children:a})});return n.displayName=`${e}.Slot`,n}function _rt(e){const r=y.forwardRef((n,i)=>{const{children:s,...a}=n;if(y.isValidElement(s)){const o=Crt(s),l=krt(a,s.props);return s.type!==y.Fragment&&(l.ref=i?va(i,o):o),y.cloneElement(s,l)}return y.Children.count(s)>1?y.Children.only(null):null});return r.displayName=`${e}.SlotClone`,r}var wrt=Symbol("radix.slottable");function Srt(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===wrt}function krt(e,r){const n={...r};for(const i in r){const s=e[i],a=r[i];/^on[A-Z]/.test(i)?s&&a?n[i]=(...l)=>{const d=a(...l);return s(...l),d}:s&&(n[i]=s):i==="style"?n[i]={...s,...a}:i==="className"&&(n[i]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}function Crt(e){var i,s;let r=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,n=r&&"isReactWarning"in r&&r.isReactWarning;return n?e.ref:(r=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=r&&"isReactWarning"in r&&r.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var jrt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],uu=jrt.reduce((e,r)=>{const n=Ele(`Primitive.${r}`),i=y.forwardRef((s,a)=>{const{asChild:o,...l}=s,d=o?n:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(d,{...l,ref:a})});return i.displayName=`Primitive.${r}`,{...e,[r]:i}},{});function Nrt(e){const r=Trt(e),n=y.forwardRef((i,s)=>{const{children:a,...o}=i,l=y.Children.toArray(a),d=l.find(Art);if(d){const u=d.props.children,h=l.map(f=>f===d?y.Children.count(u)>1?y.Children.only(null):y.isValidElement(u)?u.props.children:null:f);return c.jsx(r,{...o,ref:s,children:y.isValidElement(u)?y.cloneElement(u,void 0,h):null})}return c.jsx(r,{...o,ref:s,children:a})});return n.displayName=`${e}.Slot`,n}function Trt(e){const r=y.forwardRef((n,i)=>{const{children:s,...a}=n;if(y.isValidElement(s)){const o=Mrt(s),l=Ort(a,s.props);return s.type!==y.Fragment&&(l.ref=i?va(i,o):o),y.cloneElement(s,l)}return y.Children.count(s)>1?y.Children.only(null):null});return r.displayName=`${e}.SlotClone`,r}var Ert=Symbol("radix.slottable");function Art(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ert}function Ort(e,r){const n={...r};for(const i in r){const s=e[i],a=r[i];/^on[A-Z]/.test(i)?s&&a?n[i]=(...l)=>{const d=a(...l);return s(...l),d}:s&&(n[i]=s):i==="style"?n[i]={...s,...a}:i==="className"&&(n[i]=[s,a].filter(Boolean).join(" "))}return{...e,...n}}function Mrt(e){var i,s;let r=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,n=r&&"isReactWarning"in r&&r.isReactWarning;return n?e.ref:(r=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,n=r&&"isReactWarning"in r&&r.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Rrt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Prt=Rrt.reduce((e,r)=>{const n=Nrt(`Primitive.${r}`),i=y.forwardRef((s,a)=>{const{asChild:o,...l}=s,d=o?n:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),c.jsx(d,{...l,ref:a})});return i.displayName=`Primitive.${r}`,{...e,[r]:i}},{}),Ale=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Lrt="VisuallyHidden",$rt=y.forwardRef((e,r)=>c.jsx(Prt.span,{...e,ref:r,style:{...Ale,...e.style}}));$rt.displayName=Lrt;var Drt=[" ","Enter","ArrowUp","ArrowDown"],Irt=[" ","Enter"],cy="Select",[t6,r6,Brt]=kR(cy),[mx]=xrt(cy,[Brt,rx]),n6=rx(),[zrt,jg]=mx(cy),[Frt,Hrt]=mx(cy),Ole=e=>{const{__scopeSelect:r,children:n,open:i,defaultOpen:s,onOpenChange:a,value:o,defaultValue:l,onValueChange:d,dir:u,name:h,autoComplete:f,disabled:g,required:v,form:b}=e,_=n6(r),[S,w]=y.useState(null),[C,j]=y.useState(null),[E,A]=y.useState(!1),N=U4(u),[R,B]=Cp({prop:i,defaultProp:s??!1,onChange:a,caller:cy}),[G,H]=Cp({prop:o,defaultProp:l,onChange:d,caller:cy}),z=y.useRef(null),W=S?b||!!S.closest("form"):!0,[I,O]=y.useState(new Set),D=Array.from(I).map(P=>P.props.value).join(";");return c.jsx(RR,{..._,children:c.jsxs(zrt,{required:v,scope:r,trigger:S,onTriggerChange:w,valueNode:C,onValueNodeChange:j,valueNodeHasChildren:E,onValueNodeHasChildrenChange:A,contentId:Zu(),value:G,onValueChange:H,open:R,onOpenChange:B,dir:N,triggerPointerDownPosRef:z,disabled:g,children:[c.jsx(t6.Provider,{scope:r,children:c.jsx(Frt,{scope:e.__scopeSelect,onNativeOptionAdd:y.useCallback(P=>{O($=>new Set($).add(P))},[]),onNativeOptionRemove:y.useCallback(P=>{O($=>{const V=new Set($);return V.delete(P),V})},[]),children:n})}),W?c.jsxs(tce,{"aria-hidden":!0,required:v,tabIndex:-1,name:h,autoComplete:f,value:G,onChange:P=>H(P.target.value),disabled:g,form:b,children:[G===void 0?c.jsx("option",{value:""}):null,Array.from(I)]},D):null]})})};Ole.displayName=cy;var Mle="SelectTrigger",Rle=y.forwardRef((e,r)=>{const{__scopeSelect:n,disabled:i=!1,...s}=e,a=n6(n),o=jg(Mle,n),l=o.disabled||i,d=ui(r,o.onTriggerChange),u=r6(n),h=y.useRef("touch"),[f,g,v]=nce(_=>{const S=u().filter(j=>!j.disabled),w=S.find(j=>j.value===o.value),C=ice(S,_,w);C!==void 0&&o.onValueChange(C.value)}),b=_=>{l||(o.onOpenChange(!0),v()),_&&(o.triggerPointerDownPosRef.current={x:Math.round(_.pageX),y:Math.round(_.pageY)})};return c.jsx(Y4,{asChild:!0,...a,children:c.jsx(uu.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":rce(o.value)?"":void 0,...s,ref:d,onClick:xr(s.onClick,_=>{_.currentTarget.focus(),h.current!=="mouse"&&b(_)}),onPointerDown:xr(s.onPointerDown,_=>{h.current=_.pointerType;const S=_.target;S.hasPointerCapture(_.pointerId)&&S.releasePointerCapture(_.pointerId),_.button===0&&_.ctrlKey===!1&&_.pointerType==="mouse"&&(b(_),_.preventDefault())}),onKeyDown:xr(s.onKeyDown,_=>{const S=f.current!=="";!(_.ctrlKey||_.altKey||_.metaKey)&&_.key.length===1&&g(_.key),!(S&&_.key===" ")&&Drt.includes(_.key)&&(b(),_.preventDefault())})})})});Rle.displayName=Mle;var Ple="SelectValue",Lle=y.forwardRef((e,r)=>{const{__scopeSelect:n,className:i,style:s,children:a,placeholder:o="",...l}=e,d=jg(Ple,n),{onValueNodeHasChildrenChange:u}=d,h=a!==void 0,f=ui(r,d.onValueNodeChange);return ya(()=>{u(h)},[u,h]),c.jsx(uu.span,{...l,ref:f,style:{pointerEvents:"none"},children:rce(d.value)?c.jsx(c.Fragment,{children:o}):a})});Lle.displayName=Ple;var Wrt="SelectIcon",$le=y.forwardRef((e,r)=>{const{__scopeSelect:n,children:i,...s}=e;return c.jsx(uu.span,{"aria-hidden":!0,...s,ref:r,children:i||"▼"})});$le.displayName=Wrt;var Urt="SelectPortal",Dle=e=>c.jsx(zS,{asChild:!0,...e});Dle.displayName=Urt;var uy="SelectContent",Ile=y.forwardRef((e,r)=>{const n=jg(uy,e.__scopeSelect),[i,s]=y.useState();if(ya(()=>{s(new DocumentFragment)},[]),!n.open){const a=i;return a?gy.createPortal(c.jsx(Ble,{scope:e.__scopeSelect,children:c.jsx(t6.Slot,{scope:e.__scopeSelect,children:c.jsx("div",{children:e.children})})}),a):null}return c.jsx(zle,{...e,ref:r})});Ile.displayName=uy;var Bd=10,[Ble,Ng]=mx(uy),Vrt="SelectContentImpl",qrt=Ele("SelectContent.RemoveScroll"),zle=y.forwardRef((e,r)=>{const{__scopeSelect:n,position:i="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:a,onPointerDownOutside:o,side:l,sideOffset:d,align:u,alignOffset:h,arrowPadding:f,collisionBoundary:g,collisionPadding:v,sticky:b,hideWhenDetached:_,avoidCollisions:S,...w}=e,C=jg(uy,n),[j,E]=y.useState(null),[A,N]=y.useState(null),R=ui(r,ae=>E(ae)),[B,G]=y.useState(null),[H,z]=y.useState(null),W=r6(n),[I,O]=y.useState(!1),D=y.useRef(!1);y.useEffect(()=>{if(j)return B4(j)},[j]),D4();const P=y.useCallback(ae=>{const[re,...de]=W().map(me=>me.ref.current),[pe]=de.slice(-1),_e=document.activeElement;for(const me of ae)if(me===_e||(me==null||me.scrollIntoView({block:"nearest"}),me===re&&A&&(A.scrollTop=0),me===pe&&A&&(A.scrollTop=A.scrollHeight),me==null||me.focus(),document.activeElement!==_e))return},[W,A]),$=y.useCallback(()=>P([B,j]),[P,B,j]);y.useEffect(()=>{I&&$()},[I,$]);const{onOpenChange:V,triggerPointerDownPosRef:K}=C;y.useEffect(()=>{if(j){let ae={x:0,y:0};const re=pe=>{var _e,me;ae={x:Math.abs(Math.round(pe.pageX)-(((_e=K.current)==null?void 0:_e.x)??0)),y:Math.abs(Math.round(pe.pageY)-(((me=K.current)==null?void 0:me.y)??0))}},de=pe=>{ae.x<=10&&ae.y<=10?pe.preventDefault():j.contains(pe.target)||V(!1),document.removeEventListener("pointermove",re),K.current=null};return K.current!==null&&(document.addEventListener("pointermove",re),document.addEventListener("pointerup",de,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",re),document.removeEventListener("pointerup",de,{capture:!0})}}},[j,V,K]),y.useEffect(()=>{const ae=()=>V(!1);return window.addEventListener("blur",ae),window.addEventListener("resize",ae),()=>{window.removeEventListener("blur",ae),window.removeEventListener("resize",ae)}},[V]);const[F,U]=nce(ae=>{const re=W().filter(_e=>!_e.disabled),de=re.find(_e=>_e.ref.current===document.activeElement),pe=ice(re,ae,de);pe&&setTimeout(()=>pe.ref.current.focus())}),Q=y.useCallback((ae,re,de)=>{const pe=!D.current&&!de;(C.value!==void 0&&C.value===re||pe)&&(G(ae),pe&&(D.current=!0))},[C.value]),q=y.useCallback(()=>j==null?void 0:j.focus(),[j]),te=y.useCallback((ae,re,de)=>{const pe=!D.current&&!de;(C.value!==void 0&&C.value===re||pe)&&z(ae)},[C.value]),ee=i==="popper"?_7:Fle,se=ee===_7?{side:l,sideOffset:d,align:u,alignOffset:h,arrowPadding:f,collisionBoundary:g,collisionPadding:v,sticky:b,hideWhenDetached:_,avoidCollisions:S}:{};return c.jsx(Ble,{scope:n,content:j,viewport:A,onViewportChange:N,itemRefCallback:Q,selectedItem:B,onItemLeave:q,itemTextRefCallback:te,focusSelectedItem:$,selectedItemText:H,position:i,isPositioned:I,searchRef:F,children:c.jsx(HS,{as:qrt,allowPinchZoom:!0,children:c.jsx(BS,{asChild:!0,trapped:C.open,onMountAutoFocus:ae=>{ae.preventDefault()},onUnmountAutoFocus:xr(s,ae=>{var re;(re=C.trigger)==null||re.focus({preventScroll:!0}),ae.preventDefault()}),children:c.jsx(IS,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:ae=>ae.preventDefault(),onDismiss:()=>C.onOpenChange(!1),children:c.jsx(ee,{role:"listbox",id:C.contentId,"data-state":C.open?"open":"closed",dir:C.dir,onContextMenu:ae=>ae.preventDefault(),...w,...se,onPlaced:()=>O(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:xr(w.onKeyDown,ae=>{const re=ae.ctrlKey||ae.altKey||ae.metaKey;if(ae.key==="Tab"&&ae.preventDefault(),!re&&ae.key.length===1&&U(ae.key),["ArrowUp","ArrowDown","Home","End"].includes(ae.key)){let pe=W().filter(_e=>!_e.disabled).map(_e=>_e.ref.current);if(["ArrowUp","End"].includes(ae.key)&&(pe=pe.slice().reverse()),["ArrowUp","ArrowDown"].includes(ae.key)){const _e=ae.target,me=pe.indexOf(_e);pe=pe.slice(me+1)}setTimeout(()=>P(pe)),ae.preventDefault()}})})})})})})});zle.displayName=Vrt;var Grt="SelectItemAlignedPosition",Fle=y.forwardRef((e,r)=>{const{__scopeSelect:n,onPlaced:i,...s}=e,a=jg(uy,n),o=Ng(uy,n),[l,d]=y.useState(null),[u,h]=y.useState(null),f=ui(r,R=>h(R)),g=r6(n),v=y.useRef(!1),b=y.useRef(!0),{viewport:_,selectedItem:S,selectedItemText:w,focusSelectedItem:C}=o,j=y.useCallback(()=>{if(a.trigger&&a.valueNode&&l&&u&&_&&S&&w){const R=a.trigger.getBoundingClientRect(),B=u.getBoundingClientRect(),G=a.valueNode.getBoundingClientRect(),H=w.getBoundingClientRect();if(a.dir!=="rtl"){const _e=H.left-B.left,me=G.left-_e,qe=R.left-me,oe=R.width+qe,it=Math.max(oe,B.width),Xe=window.innerWidth-Bd,gt=eU(me,[Bd,Math.max(Bd,Xe-it)]);l.style.minWidth=oe+"px",l.style.left=gt+"px"}else{const _e=B.right-H.right,me=window.innerWidth-G.right-_e,qe=window.innerWidth-R.right-me,oe=R.width+qe,it=Math.max(oe,B.width),Xe=window.innerWidth-Bd,gt=eU(me,[Bd,Math.max(Bd,Xe-it)]);l.style.minWidth=oe+"px",l.style.right=gt+"px"}const z=g(),W=window.innerHeight-Bd*2,I=_.scrollHeight,O=window.getComputedStyle(u),D=parseInt(O.borderTopWidth,10),P=parseInt(O.paddingTop,10),$=parseInt(O.borderBottomWidth,10),V=parseInt(O.paddingBottom,10),K=D+P+I+V+$,F=Math.min(S.offsetHeight*5,K),U=window.getComputedStyle(_),Q=parseInt(U.paddingTop,10),q=parseInt(U.paddingBottom,10),te=R.top+R.height/2-Bd,ee=W-te,se=S.offsetHeight/2,ae=S.offsetTop+se,re=D+P+ae,de=K-re;if(re<=te){const _e=z.length>0&&S===z[z.length-1].ref.current;l.style.bottom="0px";const me=u.clientHeight-_.offsetTop-_.offsetHeight,qe=Math.max(ee,se+(_e?q:0)+me+$),oe=re+qe;l.style.height=oe+"px"}else{const _e=z.length>0&&S===z[0].ref.current;l.style.top="0px";const qe=Math.max(te,D+_.offsetTop+(_e?Q:0)+se)+de;l.style.height=qe+"px",_.scrollTop=re-te+_.offsetTop}l.style.margin=`${Bd}px 0`,l.style.minHeight=F+"px",l.style.maxHeight=W+"px",i==null||i(),requestAnimationFrame(()=>v.current=!0)}},[g,a.trigger,a.valueNode,l,u,_,S,w,a.dir,i]);ya(()=>j(),[j]);const[E,A]=y.useState();ya(()=>{u&&A(window.getComputedStyle(u).zIndex)},[u]);const N=y.useCallback(R=>{R&&b.current===!0&&(j(),C==null||C(),b.current=!1)},[j,C]);return c.jsx(Yrt,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:v,onScrollButtonChange:N,children:c.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E},children:c.jsx(uu.div,{...s,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Fle.displayName=Grt;var Krt="SelectPopperPosition",_7=y.forwardRef((e,r)=>{const{__scopeSelect:n,align:i="start",collisionPadding:s=Bd,...a}=e,o=n6(n);return c.jsx(PR,{...o,...a,ref:r,align:i,collisionPadding:s,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});_7.displayName=Krt;var[Yrt,tL]=mx(uy,{}),w7="SelectViewport",Hle=y.forwardRef((e,r)=>{const{__scopeSelect:n,nonce:i,...s}=e,a=Ng(w7,n),o=tL(w7,n),l=ui(r,a.onViewportChange),d=y.useRef(0);return c.jsxs(c.Fragment,{children:[c.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),c.jsx(t6.Slot,{scope:n,children:c.jsx(uu.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:xr(s.onScroll,u=>{const h=u.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:g}=o;if(g!=null&&g.current&&f){const v=Math.abs(d.current-h.scrollTop);if(v>0){const b=window.innerHeight-Bd*2,_=parseFloat(f.style.minHeight),S=parseFloat(f.style.height),w=Math.max(_,S);if(w<b){const C=w+v,j=Math.min(b,C),E=C-j;f.style.height=j+"px",f.style.bottom==="0px"&&(h.scrollTop=E>0?E:0,f.style.justifyContent="flex-end")}}}d.current=h.scrollTop})})})]})});Hle.displayName=w7;var Wle="SelectGroup",[Xrt,Jrt]=mx(Wle),Zrt=y.forwardRef((e,r)=>{const{__scopeSelect:n,...i}=e,s=Zu();return c.jsx(Xrt,{scope:n,id:s,children:c.jsx(uu.div,{role:"group","aria-labelledby":s,...i,ref:r})})});Zrt.displayName=Wle;var Ule="SelectLabel",Vle=y.forwardRef((e,r)=>{const{__scopeSelect:n,...i}=e,s=Jrt(Ule,n);return c.jsx(uu.div,{id:s.id,...i,ref:r})});Vle.displayName=Ule;var o4="SelectItem",[Qrt,qle]=mx(o4),Gle=y.forwardRef((e,r)=>{const{__scopeSelect:n,value:i,disabled:s=!1,textValue:a,...o}=e,l=jg(o4,n),d=Ng(o4,n),u=l.value===i,[h,f]=y.useState(a??""),[g,v]=y.useState(!1),b=ui(r,C=>{var j;return(j=d.itemRefCallback)==null?void 0:j.call(d,C,i,s)}),_=Zu(),S=y.useRef("touch"),w=()=>{s||(l.onValueChange(i),l.onOpenChange(!1))};if(i==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return c.jsx(Qrt,{scope:n,value:i,disabled:s,textId:_,isSelected:u,onItemTextChange:y.useCallback(C=>{f(j=>j||((C==null?void 0:C.textContent)??"").trim())},[]),children:c.jsx(t6.ItemSlot,{scope:n,value:i,disabled:s,textValue:h,children:c.jsx(uu.div,{role:"option","aria-labelledby":_,"data-highlighted":g?"":void 0,"aria-selected":u&&g,"data-state":u?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:b,onFocus:xr(o.onFocus,()=>v(!0)),onBlur:xr(o.onBlur,()=>v(!1)),onClick:xr(o.onClick,()=>{S.current!=="mouse"&&w()}),onPointerUp:xr(o.onPointerUp,()=>{S.current==="mouse"&&w()}),onPointerDown:xr(o.onPointerDown,C=>{S.current=C.pointerType}),onPointerMove:xr(o.onPointerMove,C=>{var j;S.current=C.pointerType,s?(j=d.onItemLeave)==null||j.call(d):S.current==="mouse"&&C.currentTarget.focus({preventScroll:!0})}),onPointerLeave:xr(o.onPointerLeave,C=>{var j;C.currentTarget===document.activeElement&&((j=d.onItemLeave)==null||j.call(d))}),onKeyDown:xr(o.onKeyDown,C=>{var E;((E=d.searchRef)==null?void 0:E.current)!==""&&C.key===" "||(Irt.includes(C.key)&&w(),C.key===" "&&C.preventDefault())})})})})});Gle.displayName=o4;var z_="SelectItemText",Kle=y.forwardRef((e,r)=>{const{__scopeSelect:n,className:i,style:s,...a}=e,o=jg(z_,n),l=Ng(z_,n),d=qle(z_,n),u=Hrt(z_,n),[h,f]=y.useState(null),g=ui(r,w=>f(w),d.onItemTextChange,w=>{var C;return(C=l.itemTextRefCallback)==null?void 0:C.call(l,w,d.value,d.disabled)}),v=h==null?void 0:h.textContent,b=y.useMemo(()=>c.jsx("option",{value:d.value,disabled:d.disabled,children:v},d.value),[d.disabled,d.value,v]),{onNativeOptionAdd:_,onNativeOptionRemove:S}=u;return ya(()=>(_(b),()=>S(b)),[_,S,b]),c.jsxs(c.Fragment,{children:[c.jsx(uu.span,{id:d.textId,...a,ref:g}),d.isSelected&&o.valueNode&&!o.valueNodeHasChildren?gy.createPortal(a.children,o.valueNode):null]})});Kle.displayName=z_;var Yle="SelectItemIndicator",Xle=y.forwardRef((e,r)=>{const{__scopeSelect:n,...i}=e;return qle(Yle,n).isSelected?c.jsx(uu.span,{"aria-hidden":!0,...i,ref:r}):null});Xle.displayName=Yle;var S7="SelectScrollUpButton",Jle=y.forwardRef((e,r)=>{const n=Ng(S7,e.__scopeSelect),i=tL(S7,e.__scopeSelect),[s,a]=y.useState(!1),o=ui(r,i.onScrollButtonChange);return ya(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=d.scrollTop>0;a(u)};const d=n.viewport;return l(),d.addEventListener("scroll",l),()=>d.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?c.jsx(Qle,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:d}=n;l&&d&&(l.scrollTop=l.scrollTop-d.offsetHeight)}}):null});Jle.displayName=S7;var k7="SelectScrollDownButton",Zle=y.forwardRef((e,r)=>{const n=Ng(k7,e.__scopeSelect),i=tL(k7,e.__scopeSelect),[s,a]=y.useState(!1),o=ui(r,i.onScrollButtonChange);return ya(()=>{if(n.viewport&&n.isPositioned){let l=function(){const u=d.scrollHeight-d.clientHeight,h=Math.ceil(d.scrollTop)<u;a(h)};const d=n.viewport;return l(),d.addEventListener("scroll",l),()=>d.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?c.jsx(Qle,{...e,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:d}=n;l&&d&&(l.scrollTop=l.scrollTop+d.offsetHeight)}}):null});Zle.displayName=k7;var Qle=y.forwardRef((e,r)=>{const{__scopeSelect:n,onAutoScroll:i,...s}=e,a=Ng("SelectScrollButton",n),o=y.useRef(null),l=r6(n),d=y.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return y.useEffect(()=>()=>d(),[d]),ya(()=>{var h;const u=l().find(f=>f.ref.current===document.activeElement);(h=u==null?void 0:u.ref.current)==null||h.scrollIntoView({block:"nearest"})},[l]),c.jsx(uu.div,{"aria-hidden":!0,...s,ref:r,style:{flexShrink:0,...s.style},onPointerDown:xr(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(i,50))}),onPointerMove:xr(s.onPointerMove,()=>{var u;(u=a.onItemLeave)==null||u.call(a),o.current===null&&(o.current=window.setInterval(i,50))}),onPointerLeave:xr(s.onPointerLeave,()=>{d()})})}),ent="SelectSeparator",ece=y.forwardRef((e,r)=>{const{__scopeSelect:n,...i}=e;return c.jsx(uu.div,{"aria-hidden":!0,...i,ref:r})});ece.displayName=ent;var C7="SelectArrow",tnt=y.forwardRef((e,r)=>{const{__scopeSelect:n,...i}=e,s=n6(n),a=jg(C7,n),o=Ng(C7,n);return a.open&&o.position==="popper"?c.jsx(LR,{...s,...i,ref:r}):null});tnt.displayName=C7;var rnt="SelectBubbleInput",tce=y.forwardRef(({__scopeSelect:e,value:r,...n},i)=>{const s=y.useRef(null),a=ui(i,s),o=xle(r);return y.useEffect(()=>{const l=s.current;if(!l)return;const d=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(d,"value").set;if(o!==r&&h){const f=new Event("change",{bubbles:!0});h.call(l,r),l.dispatchEvent(f)}},[o,r]),c.jsx(uu.select,{...n,style:{...Ale,...n.style},ref:a,defaultValue:r})});tce.displayName=rnt;function rce(e){return e===""||e===void 0}function nce(e){const r=lh(e),n=y.useRef(""),i=y.useRef(0),s=y.useCallback(o=>{const l=n.current+o;r(l),(function d(u){n.current=u,window.clearTimeout(i.current),u!==""&&(i.current=window.setTimeout(()=>d(""),1e3))})(l)},[r]),a=y.useCallback(()=>{n.current="",window.clearTimeout(i.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(i.current),[]),[n,s,a]}function ice(e,r,n){const s=r.length>1&&Array.from(r).every(u=>u===r[0])?r[0]:r,a=n?e.indexOf(n):-1;let o=nnt(e,Math.max(a,0));s.length===1&&(o=o.filter(u=>u!==n));const d=o.find(u=>u.textValue.toLowerCase().startsWith(s.toLowerCase()));return d!==n?d:void 0}function nnt(e,r){return e.map((n,i)=>e[(r+i)%e.length])}var int=Ole,sce=Rle,snt=Lle,ant=$le,ont=Dle,ace=Ile,lnt=Hle,oce=Vle,lce=Gle,cnt=Kle,unt=Xle,cce=Jle,uce=Zle,dce=ece;const sh=int,ah=snt,ed=y.forwardRef(({className:e,children:r,...n},i)=>c.jsxs(sce,{ref:i,className:Ae("flex h-10 w-full items-center justify-between whitespace-nowrap rounded-lg border border-input bg-background/90 px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/60 focus:ring-offset-2 focus:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[r,c.jsx(ant,{asChild:!0,children:c.jsx(Dl,{className:"h-4 w-4 opacity-50"})})]}));ed.displayName=sce.displayName;const hce=y.forwardRef(({className:e,...r},n)=>c.jsx(cce,{ref:n,className:Ae("flex cursor-default items-center justify-center py-1",e),...r,children:c.jsx(mR,{className:"h-4 w-4"})}));hce.displayName=cce.displayName;const fce=y.forwardRef(({className:e,...r},n)=>c.jsx(uce,{ref:n,className:Ae("flex cursor-default items-center justify-center py-1",e),...r,children:c.jsx(Dl,{className:"h-4 w-4"})}));fce.displayName=uce.displayName;const td=y.forwardRef(({className:e,children:r,position:n="popper",...i},s)=>c.jsx(ont,{children:c.jsxs(ace,{ref:s,className:Ae("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-xl border border-border/70 bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...i,children:[c.jsx(hce,{}),c.jsx(lnt,{className:Ae("p-1",n==="popper"&&"w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),c.jsx(fce,{})]})}));td.displayName=ace.displayName;const dnt=y.forwardRef(({className:e,...r},n)=>c.jsx(oce,{ref:n,className:Ae("px-2 py-1.5 text-sm font-semibold",e),...r}));dnt.displayName=oce.displayName;const Ls=y.forwardRef(({className:e,children:r,...n},i)=>c.jsxs(lce,{ref:i,className:Ae("relative flex w-full cursor-default select-none items-center rounded-md py-2 pl-2.5 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[c.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:c.jsx(unt,{children:c.jsx(ms,{className:"h-4 w-4"})})}),c.jsx(cnt,{children:r})]}));Ls.displayName=lce.displayName;const hnt=y.forwardRef(({className:e,...r},n)=>c.jsx(dce,{ref:n,className:Ae("-mx-1 my-1 h-px bg-muted",e),...r}));hnt.displayName=dce.displayName;const Nm=qn();class rL{getToken(){return Gm()}getHeaders(r=!1){const n={};r&&(n["Content-Type"]="application/json");const i=this.getToken();return i&&(n.Authorization=`Bearer ${i}`),n}async listJobsPage(r=1,n=20,i=!0){const s=new URLSearchParams({page:r.toString(),size:n.toString(),include_disabled:i.toString()}),a=await fetch(`${Nm}/api/jobs?${s}`,{headers:this.getHeaders()});if(!a.ok)throw new Error(`Failed to list jobs: ${a.statusText}`);const o=await a.json();if(Array.isArray(o))return{items:o,total:o.length,page:1,size:o.length};const l=o&&typeof o=="object"?o:{},d=Array.isArray(l.items)?l.items:[],u=typeof l.total=="number"?l.total:d.length,h=typeof l.page=="number"?l.page:r,f=typeof l.size=="number"?l.size:n;return{items:d,total:u,page:h,size:f}}async listJobs(r=1,n=100,i=!0){return(await this.listJobsPage(r,n,i)).items}async getJob(r){const n=await fetch(`${Nm}/api/jobs/${r}`,{headers:this.getHeaders()});if(!n.ok)throw new Error(`Failed to get job: ${n.statusText}`);return n.json()}async createJob(r){const n=await fetch(`${Nm}/api/jobs`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify(r)});if(!n.ok){const i=await n.json().catch(()=>({detail:n.statusText}));throw new Error(i.detail||"Failed to create job")}return n.json()}async updateJob(r,n){const i=await fetch(`${Nm}/api/jobs/${r}`,{method:"PATCH",headers:this.getHeaders(!0),body:JSON.stringify(n)});if(!i.ok){const s=await i.json().catch(()=>({detail:i.statusText}));throw new Error(s.detail||"Failed to update job")}return i.json()}async deleteJob(r){const n=await fetch(`${Nm}/api/jobs/${r}`,{method:"DELETE",headers:this.getHeaders()});if(!n.ok)throw new Error(`Failed to delete job: ${n.statusText}`)}async triggerJob(r){const n=await fetch(`${Nm}/api/jobs/${r}/trigger`,{method:"POST",headers:this.getHeaders(!0),body:JSON.stringify({})});if(!n.ok){const i=await n.json().catch(()=>({detail:n.statusText}));throw new Error(i.detail||`Failed to trigger job: ${n.statusText}`)}return n.json()}async getJobRuns(r,n=20,i=1){const s=new URLSearchParams({page:i.toString(),size:n.toString()}),a=await fetch(`${Nm}/api/jobs/${r}/runs?${s}`,{headers:this.getHeaders()});if(!a.ok)throw new Error(`Failed to get job runs: ${a.statusText}`);const o=await a.json();return Array.isArray(o)?o:o.items??[]}async getAvailableProviders(){const r=await fetch(`${Nm}/api/jobs/providers/available`,{headers:this.getHeaders()});if(!r.ok)throw new Error(`Failed to get providers: ${r.statusText}`);const n=await r.json();return n.providers&&!Array.isArray(n.providers)?n.providers:n}}const C3=new rL;function fnt({isOpen:e,onClose:r,onCreated:n,editJob:i,onUpdated:s}){const[a,o]=y.useState(!1),[l,d]=y.useState(null),[u,h]=y.useState({}),[f,g]=y.useState(""),[v,b]=y.useState("agent_task"),[_,S]=y.useState("0 * * * *"),[w,C]=y.useState(""),[j,E]=y.useState(!1),[A,N]=y.useState(!0),[R,B]=y.useState(""),[G,H]=y.useState(""),[z,W]=y.useState(""),[I,O]=y.useState(""),[D,P]=y.useState("");y.useEffect(()=>{C3.getAvailableProviders().then(h).catch(console.error)},[]);const $=U=>{if(g(U.name),b(U.job_type),S(U.cron_expression),N(U.enabled),B(U.provider||""),H(U.model||""),W(U.prompt||""),U.job_type==="system_job"){const te=U.payload&&typeof U.payload=="object"?U.payload:void 0,ee=typeof(te==null?void 0:te.command)=="string"?te.command:void 0,se=typeof U.tool_name=="string"?U.tool_name:"";O(ee||se);const ae=te==null?void 0:te.args;if(ae&&typeof ae=="object")try{P(JSON.stringify(ae,null,2))}catch{P("")}else P("")}else P(""),O("");const Q=(U.cron_expression||"").trim(),q=b7.some(te=>te.value===Q);E(!q),C(q?"":Q)};y.useEffect(()=>{if(i){$(i);let U=!1;return C3.getJob(i.id).then(Q=>{U||$(Q)}).catch(()=>{}),()=>{U=!0}}else g(""),b("agent_task"),S("0 * * * *"),C(""),E(!1),N(!0),B(""),H(""),W(""),O(""),P("")},[i,e]);const V=j?w:_,K=Tle(V),F=async U=>{if(U.preventDefault(),d(null),!K.valid){d(K.error||"Invalid cron expression");return}const Q=e6(V),q={name:f,job_type:v,cron_expression:Q,enabled:A};if(v==="agent_task"){if(!R||!G||!z){d("Provider, model, and prompt are required for agent tasks");return}q.provider=R,q.model=G,q.prompt=z}else{if(!I){d("Command is required for system jobs");return}const te={command:I};if(D)try{te.args=JSON.parse(D)}catch{d("Args must be valid JSON");return}q.payload=te}o(!0);try{if(i){const te=await C3.updateJob(i.id,q);s==null||s(te)}else{const te=await C3.createJob(q);n(te)}r()}catch(te){d(te instanceof Error?te.message:"Failed to save job")}finally{o(!1)}};return e?c.jsx("div",{className:"fixed inset-0 z-50 flex items-end justify-center bg-black/50 sm:items-center",children:c.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"create-job-dialog-title","data-testid":"create-job-dialog",className:"h-[92dvh] w-full overflow-y-auto border border-border bg-background text-foreground shadow-xl sm:h-auto sm:max-h-[90vh] sm:max-w-2xl sm:rounded-lg",children:[c.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3 sm:p-4",children:[c.jsx("h2",{id:"create-job-dialog-title",className:"text-lg font-semibold sm:text-xl",children:i?"Edit Job":"Create New Job"}),c.jsx(we,{variant:"ghost",size:"sm",onClick:r,"aria-label":"Close dialog",children:c.jsx(Xn,{className:"h-5 w-5"})})]}),c.jsxs("form",{onSubmit:F,className:"space-y-5 p-4 sm:space-y-6",children:[c.jsxs(Y0,{value:v,onValueChange:U=>b(U),children:[c.jsxs(ag,{className:"grid h-auto w-full grid-cols-2",children:[c.jsx(Qs,{value:"agent_task",children:"Agent Task"}),c.jsx(Qs,{value:"system_job",children:"System Job"})]}),c.jsxs(ea,{value:"agent_task",className:"space-y-4 mt-4",children:[c.jsxs("div",{children:[c.jsx(mi,{htmlFor:"provider",children:"Provider"}),c.jsxs(sh,{value:R,onValueChange:U=>{B(U),H("")},children:[c.jsx(ed,{"data-testid":"provider-select",children:c.jsx(ah,{placeholder:"Select provider"})}),c.jsx(td,{children:Object.entries(u).map(([U,Q])=>c.jsx(Ls,{value:U,children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(yj,{provider:U,size:20}),c.jsx("span",{children:Q.name})]})},U))})]})]}),R&&u[R]&&c.jsxs("div",{children:[c.jsx(mi,{htmlFor:"model",children:"Model"}),c.jsxs(sh,{value:G,onValueChange:H,children:[c.jsx(ed,{"data-testid":"model-select",children:c.jsx(ah,{placeholder:"Select model"})}),c.jsx(td,{children:u[R].models.map(U=>c.jsx(Ls,{value:U,children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(yj,{provider:R,model:U,size:20}),c.jsx("span",{children:U})]})},U))})]})]}),c.jsxs("div",{children:[c.jsx(mi,{htmlFor:"prompt",children:"Prompt"}),c.jsx(Ep,{id:"prompt",value:z,onChange:U=>W(U.target.value),placeholder:"What should the agent do?",rows:4})]})]}),c.jsxs(ea,{value:"system_job",className:"space-y-4 mt-4",children:[c.jsxs("div",{children:[c.jsx(mi,{htmlFor:"command",children:"Command"}),c.jsx(Ln,{id:"command",value:I,onChange:U=>O(U.target.value),placeholder:"e.g., cleanup_old_files"})]}),c.jsxs("div",{children:[c.jsx(mi,{htmlFor:"args",children:"Arguments (JSON)"}),c.jsx(Ep,{id:"args",value:D,onChange:U=>P(U.target.value),placeholder:'{"days": 30}',rows:3})]})]})]}),c.jsxs("div",{className:"border-t pt-4 space-y-4",children:[c.jsxs("div",{children:[c.jsx(mi,{htmlFor:"name",children:"Job Name"}),c.jsx(Ln,{id:"name",value:f,onChange:U=>g(U.target.value),placeholder:"My scheduled job",required:!0})]}),c.jsxs("div",{children:[c.jsxs("div",{className:"mb-2 flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[c.jsx(mi,{children:"Schedule"}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(mi,{htmlFor:"custom-schedule",className:"text-sm text-muted-foreground",children:"Custom"}),c.jsx(gf,{id:"custom-schedule",checked:j,onCheckedChange:E})]})]}),j?c.jsxs("div",{children:[c.jsx(Ln,{value:w,onChange:U=>C(U.target.value),placeholder:"* * * * *",className:K.valid?"":"border-red-500"}),w&&c.jsx("p",{className:`text-sm mt-1 ${K.valid?"text-muted-foreground":"text-red-500"}`,children:K.valid?Nle(w):K.error})]}):c.jsxs(sh,{value:_,onValueChange:S,children:[c.jsx(ed,{"data-testid":"schedule-select",children:c.jsx(ah,{})}),c.jsx(td,{children:b7.map(U=>c.jsx(Ls,{value:U.value,children:c.jsxs("div",{className:"flex flex-col",children:[c.jsx("span",{children:U.label}),c.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:U.value})]})},U.value))})]})]}),c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx(mi,{htmlFor:"enabled",children:"Enabled"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Job will run according to schedule"})]}),c.jsx(gf,{id:"enabled",checked:A,onCheckedChange:N})]})]}),l&&c.jsxs("div",{className:"flex items-center gap-2 text-destructive text-sm bg-destructive/10 p-3 rounded-md",children:[c.jsx(na,{className:"h-4 w-4"}),l]}),c.jsxs("div",{className:"grid grid-cols-1 gap-3 border-t pt-4 sm:flex sm:justify-end",children:[c.jsx(we,{type:"button",variant:"outline",onClick:r,className:"w-full sm:w-auto",children:"Cancel"}),c.jsxs(we,{type:"submit",disabled:a,className:"w-full sm:w-auto",children:[a&&c.jsx(Ft,{className:"h-4 w-4 mr-2 animate-spin"}),i?"Save Changes":"Create Job"]})]})]})]})}):null}const pnt=new rL;function mnt({job:e,isOpen:r,onClose:n}){const[i,s]=y.useState([]),[a,o]=y.useState(!1),[l,d]=y.useState(null),u=async()=>{if(e){o(!0),d(null);try{const v=await pnt.getJobRuns(e.id,50);s(v)}catch(v){d(v instanceof Error?v.message:"Failed to load history")}finally{o(!1)}}};if(y.useEffect(()=>{r&&e&&u()},[r,e==null?void 0:e.id]),!r||!e)return null;const h=v=>{switch(v){case"completed":return c.jsx(ia,{className:"h-4 w-4 text-green-500"});case"failed":return c.jsx(na,{className:"h-4 w-4 text-red-500"});case"running":return c.jsx(Ft,{className:"h-4 w-4 text-blue-500 animate-spin"});case"pending":return c.jsx(vg,{className:"h-4 w-4 text-yellow-500"});default:return null}},f=v=>{const b={completed:"default",failed:"destructive",running:"secondary",pending:"outline"};return c.jsx(Or,{variant:b[v]||"outline",children:v})},g=(v,b)=>{if(!b)return"—";const _=new Date(v),w=new Date(b).getTime()-_.getTime();return w<1e3?`${w}ms`:w<6e4?`${(w/1e3).toFixed(1)}s`:`${(w/6e4).toFixed(1)}m`};return c.jsx("div",{className:"fixed inset-0 z-50 flex items-end justify-center bg-black/50 sm:items-center",children:c.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"job-history-dialog-title","data-testid":"job-history-dialog",className:"flex h-[92dvh] w-full flex-col overflow-hidden border border-border bg-background text-foreground shadow-xl sm:h-auto sm:max-h-[90vh] sm:max-w-3xl sm:rounded-lg",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3 border-b px-4 py-3 sm:p-4",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("h2",{id:"job-history-dialog-title",className:"text-lg font-semibold sm:text-xl",children:"Job History"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:e.name})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(we,{variant:"outline",size:"sm",onClick:u,disabled:a,children:c.jsx(Js,{className:`h-4 w-4 ${a?"animate-spin":""}`})}),c.jsx(we,{variant:"ghost",size:"sm",onClick:n,"aria-label":"Close history dialog",children:c.jsx(Xn,{className:"h-5 w-5"})})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[l&&c.jsxs("div",{className:"flex items-center gap-2 text-destructive text-sm bg-destructive/10 p-3 rounded-md mb-4",children:[c.jsx(na,{className:"h-4 w-4"}),l]}),a&&i.length===0?c.jsx("div",{className:"flex items-center justify-center py-12",children:c.jsx(Ft,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):i.length===0?c.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"No runs yet. This job hasn't been executed."}):c.jsx("div",{className:"space-y-3",children:i.map(v=>c.jsxs("div",{className:"border border-border rounded-lg p-4 hover:bg-muted/40 transition-colors",children:[c.jsxs("div",{className:"mb-2 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[h(v.status),f(v.status),v.triggered_by&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:["by ",v.triggered_by]})]}),c.jsxs("div",{className:"text-sm text-muted-foreground",children:["Duration: ",g(v.started_at,v.completed_at)]})]}),c.jsxs("div",{className:"mb-2 text-sm text-muted-foreground",children:[c.jsx("span",{className:"font-medium",children:"Started:"})," ",v.started_at?new Date(v.started_at).toLocaleString():"Not started",v.completed_at&&c.jsxs(c.Fragment,{children:[" → ",c.jsx("span",{className:"font-medium",children:"Completed:"})," ",new Date(v.completed_at).toLocaleString()]})]}),v.status==="completed"&&v.result&&c.jsxs("details",{className:"mt-2",children:[c.jsx("summary",{className:"text-sm text-green-600 dark:text-green-400 cursor-pointer hover:underline",children:"View result"}),c.jsx("pre",{className:"mt-2 p-2 bg-muted rounded text-xs overflow-x-auto",children:typeof v.result=="string"?v.result:JSON.stringify(v.result,null,2)})]}),v.status==="failed"&&v.error&&c.jsxs("div",{className:"mt-2 p-2 bg-destructive/10 rounded text-sm text-destructive",children:[c.jsx("strong",{children:"Error:"})," ",v.error]})]},v.id))})]})]})})}const r_=new rL,gnt=20,ynt=[10,20,50,100];function vnt(){const e=bg(),[r,n]=y.useState([]),[i,s]=y.useState({}),[a,o]=y.useState(0),[l,d]=y.useState(1),[u,h]=y.useState(gnt),[f,g]=y.useState(!0),[v,b]=y.useState(null),[_,S]=y.useState(!1),[w,C]=y.useState(null),[j,E]=y.useState(null),A=y.useCallback(async($,V)=>{g(!0),b(null);try{const K=await r_.listJobsPage($,V,!0);n(K.items),o(K.total),d(K.page),h(K.size);const F={};await Promise.all(K.items.map(async U=>{try{const Q=await r_.getJobRuns(U.id,1);F[U.id]=Q[0]||null}catch{F[U.id]=null}})),s(U=>({...U,...F}))}catch(K){b(K instanceof Error?K.message:"Failed to load jobs")}finally{g(!1)}},[]);y.useEffect(()=>{A(l,u)},[A,l,u]);const N=async($,V)=>{try{const K=await r_.updateJob($,{enabled:V});n(F=>F.map(U=>U.id===$?K:U))}catch(K){b(K instanceof Error?K.message:"Failed to update job")}},R=async $=>{try{const V=await r_.triggerJob($);s(K=>({...K,[$]:V}))}catch(V){b(V instanceof Error?V.message:"Failed to trigger job")}},B=async $=>{if(await e({title:"Delete job",description:"Are you sure you want to delete this job?",confirmLabel:"Delete",variant:"destructive"}))try{await r_.deleteJob($);const K=Math.max(0,a-1),F=Math.max(1,Math.ceil(K/u)),U=Math.min(l,F);d(U),await A(U,u)}catch(K){b(K instanceof Error?K.message:"Failed to delete job")}},G=$=>{d(1),A(1,u),S(!1)},H=$=>{n(V=>V.map(K=>K.id===$.id?$:K)),C(null)},z=Math.max(1,Math.ceil(a/u)),W=a===0?0:(l-1)*u+1,I=Math.min(a,l*u),O=r.filter($=>$.enabled).length,D=r.filter($=>$.job_type==="agent_task").length,P=r.filter($=>$.job_type==="system_job").length;return c.jsxs("div",{className:"container mx-auto max-w-6xl px-3 py-4 sm:px-4 sm:py-6",children:[c.jsxs("div",{className:"mb-6 flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("h1",{className:"flex items-center gap-2 text-xl font-bold sm:text-2xl",children:[c.jsx(n2,{className:"h-6 w-6"}),"Scheduled Jobs"]}),c.jsx("p",{className:"mt-1 text-sm text-muted-foreground sm:text-base",children:"Manage your automated tasks and agent schedules"})]}),c.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:flex sm:items-center",children:[c.jsxs(we,{variant:"outline",onClick:()=>void A(l,u),disabled:f,className:"w-full sm:w-auto",children:[c.jsx(Js,{className:`h-4 w-4 mr-2 ${f?"animate-spin":""}`}),"Refresh"]}),c.jsxs(we,{onClick:()=>S(!0),className:"w-full sm:w-auto",children:[c.jsx(Zs,{className:"h-4 w-4 mr-2"}),"New Job"]})]})]}),c.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-2 sm:flex sm:flex-wrap sm:items-center sm:gap-4",children:[c.jsxs(Or,{variant:"outline",className:"justify-center px-3 py-1 text-xs sm:text-sm",children:[a," total"]}),c.jsxs(Or,{variant:"default",className:"justify-center px-3 py-1 text-xs sm:text-sm",children:[O," enabled on page"]}),c.jsxs(Or,{variant:"secondary",className:"justify-center px-3 py-1 text-xs sm:text-sm",children:[D," agent tasks on page"]}),c.jsxs(Or,{variant:"secondary",className:"justify-center px-3 py-1 text-xs sm:text-sm",children:[P," system jobs on page"]})]}),v&&c.jsxs("div",{className:"flex items-center gap-2 text-destructive text-sm bg-destructive/10 p-3 rounded-md mb-4",children:[c.jsx(na,{className:"h-4 w-4"}),v,c.jsx(we,{variant:"ghost",size:"sm",className:"ml-auto",onClick:()=>b(null),children:"Dismiss"})]}),f&&r.length===0?c.jsx("div",{className:"flex items-center justify-center py-24",children:c.jsx(Ft,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.length===0?c.jsxs("div",{className:"rounded-lg border-2 border-dashed px-4 py-16 text-center sm:py-24",children:[c.jsx(n2,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),c.jsx("h3",{className:"text-lg font-medium mb-2",children:"No scheduled jobs yet"}),c.jsx("p",{className:"text-muted-foreground mb-4",children:"Create your first job to automate tasks or schedule agent prompts"}),c.jsxs(we,{onClick:()=>S(!0),children:[c.jsx(Zs,{className:"h-4 w-4 mr-2"}),"Create Your First Job"]})]}):c.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:r.map($=>c.jsx(vrt,{job:$,recentRun:i[$.id],onToggle:N,onTrigger:R,onDelete:B,onEdit:C,onViewHistory:E},$.id))}),c.jsxs("div",{className:"mt-6 flex flex-col gap-3 border-t pt-4 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between",children:[c.jsxs("div",{className:"text-sm text-muted-foreground",children:["Showing ",W,"–",I," of ",a]}),c.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[c.jsx("label",{className:"text-sm text-muted-foreground",htmlFor:"jobs-page-size",children:"Per page"}),c.jsx("select",{id:"jobs-page-size",className:"h-9 rounded-md border bg-background px-2 text-sm",value:u,onChange:$=>{const V=Number.parseInt($.target.value,10);!Number.isFinite(V)||V<=0||(d(1),h(V))},children:ynt.map($=>c.jsx("option",{value:$,children:$},$))}),c.jsxs("div",{className:"grid grid-cols-[1fr_auto_1fr] items-center gap-2 sm:flex sm:items-center",children:[c.jsxs(we,{variant:"outline",size:"sm",disabled:l<=1||f,onClick:()=>d($=>Math.max(1,$-1)),className:"w-full",children:[c.jsx(Nv,{className:"h-4 w-4 mr-1"}),"Prev"]}),c.jsxs("span",{className:"text-center text-sm text-muted-foreground tabular-nums",children:["Page ",l," / ",z]}),c.jsxs(we,{variant:"outline",size:"sm",disabled:l>=z||f,onClick:()=>d($=>Math.min(z,$+1)),className:"w-full",children:["Next",c.jsx(Cs,{className:"h-4 w-4 ml-1"})]})]})]})]}),c.jsx(fnt,{isOpen:_||!!w,onClose:()=>{S(!1),C(null)},onCreated:G,editJob:w,onUpdated:H}),c.jsx(mnt,{job:j,isOpen:!!j,onClose:()=>E(null)})]})}const j7="jait.todo.selected-repo.v1";function tU(e){const r=e.trim().replace(/\\/g,"/").replace(/\/+$/,"");return/^[A-Za-z]:\//.test(r)?r.toLowerCase():r}function rU(e){if(e&&typeof e=="object"&&!Array.isArray(e)){const r=e;return{repoId:typeof r.repoId=="string"&&r.repoId.trim()?r.repoId.trim():null,localPath:typeof r.localPath=="string"&&r.localPath.trim()?r.localPath.trim():null}}return typeof e=="string"?{repoId:e.trim()||null,localPath:null}:{repoId:null,localPath:null}}function xnt(e){try{return rU(JSON.parse(e))}catch{return rU(e)}}function bnt(){var e;if(typeof window>"u")return{repoId:null,localPath:null};try{const r=(e=window.localStorage.getItem(j7))==null?void 0:e.trim();return r?xnt(r):{repoId:null,localPath:null}}catch{return{repoId:null,localPath:null}}}function _nt(e,r){if(!(typeof window>"u"))try{const n=(e==null?void 0:e.trim())||null;if(!n){window.localStorage.removeItem(j7);return}window.localStorage.setItem(j7,JSON.stringify({repoId:n,localPath:(r==null?void 0:r.trim())||null}))}catch{}}function wnt(e,r,n=bnt()){var i;if(e.length===0)return r;if(n.repoId&&e.some(s=>s.id===n.repoId))return n.repoId;if(n.localPath){const s=tU(n.localPath),a=e.find(o=>tU(o.localPath)===s);if(a)return a.id}return r&&e.some(s=>s.id===r)?r:((i=e[0])==null?void 0:i.id)??null}function Snt(e){return`[${e}] Generating title…`}function knt({repo:e,providerId:r,runtimeMode:n,model:i,workingDirectory:s,branch:a}){return{title:Snt(e.name),providerId:r,runtimeMode:n,...i?{model:i}:{},kind:"delivery",workingDirectory:s,branch:a,prBaseBranch:e.defaultBranch}}function Cnt(e,r){return{message:r.message,titleTask:r.message,titlePrefix:`[${e}] `}}function nU(e){return!!e&&/[\p{L}\p{N}]/u.test(e)}function jnt(e){return e==="'"||e==="’"}function Nnt(e){var r;return((r=e.match(/[\p{L}\p{N}'’]+$/u))==null?void 0:r[0])??""}function N7(e){return e.replace(/\s+/g," ").trim()}function Tnt(e,r,n){if(n>=3)return!0;const i=e[e.length-n-1],s=r[n];if(n===2&&nU(i)&&s&&!nU(s)&&!/\s/.test(s))return!0;const a=Nnt(e);return n===1&&a.length===1&&jnt(s)}function Ent(e,r){const n=Math.min(e.length,r.length,240);for(let i=n;i>0;i--)if(Tnt(e,r,i)&&e.endsWith(r.slice(0,i)))return i;return 0}function pce(e,r){const n=N7(e),i=N7(r);if(!i)return n;if(!n)return i;if(n.endsWith(i))return n;if(i.startsWith(n))return i;const s=Ent(n,i);return s>0?`${n}${i.slice(s)}`.trim():`${n} ${i}`}const mce="jait.todo.order.v1",gce="jait.todo.filters.v1",j3=8,m8=[{value:"open",label:"Open"},{value:"in_progress",label:"In progress"},{value:"done",label:"Done"}],n_=[{value:"low",label:"Low"},{value:"normal",label:"Normal"},{value:"high",label:"High"}];function $0(e){switch(e){case"done":return{label:"Done",iconClassName:"text-emerald-500",itemClassName:"border-emerald-500/20 bg-emerald-500/[0.04]"};case"in_progress":return{label:"In progress",iconClassName:"text-sky-500",itemClassName:"border-sky-500/20 bg-sky-500/[0.035]"};case"open":default:return{label:"Open",iconClassName:"text-muted-foreground",itemClassName:"bg-card/40"}}}function yce(e){switch(e){case"high":return"text-amber-500";case"low":return"text-muted-foreground/70";case"normal":default:return"text-primary/70"}}function F_({status:e,className:r}){const n=$0(e);return e==="done"?c.jsx(ia,{className:Ae("h-5 w-5",n.iconClassName,r)}):e==="in_progress"?c.jsx(yY,{className:Ae("h-5 w-5",n.iconClassName,r)}):c.jsx(gR,{className:Ae("h-5 w-5",n.iconClassName,r)})}function iU({priority:e,className:r}){return c.jsx(xY,{className:Ae("h-4 w-4",yce(e),r)})}function g0({label:e,children:r}){return c.jsxs(wn,{children:[c.jsx(pn,{asChild:!0,children:r}),c.jsx(mn,{children:e})]})}function vce(){if(typeof window>"u")return{};try{const e=JSON.parse(window.localStorage.getItem(mce)??"{}");return!e||typeof e!="object"||Array.isArray(e)?{}:Object.fromEntries(Object.entries(e).filter(r=>typeof r[0]=="string"&&Array.isArray(r[1])&&r[1].every(n=>typeof n=="string")))}catch{return{}}}function sU(e,r){if(!(typeof window>"u"||!e))try{const n=vce();n[e]=r.map(i=>i.id),window.localStorage.setItem(mce,JSON.stringify(n))}catch{}}function Ant(e,r){const n=vce()[e];if(!(n!=null&&n.length))return r;const i=new Map(n.map((a,o)=>[a,o])),s=new Map(r.map((a,o)=>[a.id,o]));return[...r].sort((a,o)=>{const l=i.get(a.id),d=i.get(o.id);return l!=null&&d!=null?l-d:l!=null?-1:d!=null?1:(s.get(a.id)??0)-(s.get(o.id)??0)})}function Ont(){return{search:"",tags:[],savedTagFilters:[]}}function xce(e){return Array.isArray(e)?e.flatMap(r=>{if(!r||typeof r!="object")return[];const n=r,i=mc(Array.isArray(n.tags)?n.tags.filter(o=>typeof o=="string"):[]);if(i.length===0)return[];const s=typeof n.name=="string"&&n.name.trim()?n.name.trim():i.join(" + ");return[{id:typeof n.id=="string"&&n.id.trim()?n.id.trim():i.join("|"),name:s,tags:i}]}).slice(0,24):[]}function bce(){if(typeof window>"u")return{};try{const e=JSON.parse(window.localStorage.getItem(gce)??"{}");if(!e||typeof e!="object"||Array.isArray(e))return{};const r=Object.entries(e).flatMap(([n,i])=>{if(!i||typeof i!="object"||Array.isArray(i))return[];const s=i;return[[n,{search:typeof s.search=="string"?s.search:"",tags:mc(Array.isArray(s.tags)?s.tags.filter(a=>typeof a=="string"):[]),savedTagFilters:xce(s.savedTagFilters)}]]});return Object.fromEntries(r)}catch{return{}}}function Mnt(e){return bce()[e]??Ont()}function Rnt(e,r){if(!(typeof window>"u"||!e))try{const n=bce();n[e]={search:r.search,tags:mc(r.tags),savedTagFilters:xce(r.savedTagFilters)},window.localStorage.setItem(gce,JSON.stringify(n))}catch{}}function aU(e,r,n,i){const s=e.findIndex(d=>d.id===r);if(s<0)return e;const a=[...e],[o]=a.splice(s,1);if(!o)return e;if(n==null)return a.push(o),a;const l=a.findIndex(d=>d.id===n);return l<0?e:(a.splice(l+(i==="after"?1:0),0,o),a)}function oU(){if(!(typeof window>"u"))try{const e=window.AudioContext||window.webkitAudioContext;if(!e)return;const r=new e,n=r.currentTime,i=r.createGain();i.gain.setValueAtTime(1e-4,n),i.gain.exponentialRampToValueAtTime(.08,n+.012),i.gain.exponentialRampToValueAtTime(1e-4,n+.34),i.connect(r.destination);for(const[s,a]of[660,880].entries()){const o=r.createOscillator();o.type="sine",o.frequency.setValueAtTime(a,n+s*.08),o.connect(i),o.start(n+s*.08),o.stop(n+.22+s*.08)}window.setTimeout(()=>void r.close(),450)}catch{}}function Pnt({todo:e}){const r=$0(e.status);return c.jsxs("div",{className:Ae("flex items-start gap-2 rounded-lg border bg-background px-3 py-2 text-sm shadow-2xl ring-1 ring-primary/10",r.itemClassName),children:[c.jsx(F4,{className:"mt-1 h-4 w-4 shrink-0 text-muted-foreground"}),c.jsx(F_,{status:e.status,className:"mt-0.5 shrink-0"}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"mb-1 flex items-center gap-1.5 text-[11px] font-medium uppercase text-muted-foreground",children:[c.jsx("span",{children:r.label}),c.jsx(xY,{className:Ae("h-3 w-3",yce(e.priority))}),c.jsx("span",{children:e.priority})]}),c.jsx("span",{className:Ae("whitespace-pre-wrap break-words text-foreground",e.status==="done"&&"text-muted-foreground line-through"),children:e.message})]})]})}function _2(e){if(Array.isArray(e))return e;if(!e)return[];try{const r=JSON.parse(e);return Array.isArray(r)?r.filter(n=>typeof n=="string"):[]}catch{return e.split(",").map(r=>r.trim()).filter(Boolean)}}function Lnt(e){return[...new Set(e.split(",").map(r=>r.trim().toLowerCase()).filter(Boolean))]}function mc(e){return[...new Set(e.map(r=>r.trim().toLowerCase()).filter(Boolean))]}function j5(e){const r=e.getFullYear(),n=`${e.getMonth()+1}`.padStart(2,"0"),i=`${e.getDate()}`.padStart(2,"0");return`${r}-${n}-${i}`}function _ce(e){return new Intl.DateTimeFormat(void 0,{month:"long",year:"numeric"}).format(e)}function wce(e){if(!e)return null;const[r,n,i]=e.split("-").map(Number);return!r||!n||!i?null:new Date(r,n-1,i)}function gv(e){const r=wce(e);return r?new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric"}).format(r):"No due date"}function Sce(e){if(!e)return"";const r=new Date(e);return Number.isNaN(r.getTime())?"":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(r)}function lU(e,r){const n=mc(e).sort(),i=mc(r).sort();return n.length===i.length&&n.every((s,a)=>s===i[a])}function $nt(e){if(!e)return[];try{const r=JSON.parse(e);return Array.isArray(r)?r.flatMap(n=>{if(!n||typeof n!="object")return[];const i=n;if(typeof i.completedAt!="string")return[];const s=i.previousStatus==="open"||i.previousStatus==="in_progress"||i.previousStatus==="done"?i.previousStatus:null;return[{completedAt:i.completedAt,previousStatus:s}]}):[]}catch{return[]}}function Dnt(e){const r=$0(e.status),n=_2(e.tags);return[e.message,r.label,e.status,e.priority,e.dueDate,gv(e.dueDate),n.join(" "),e.sourceThreadTitle,e.createdAt,e.updatedAt,e.completedAt,Sce(e.completedAt)].filter(Boolean).join(" ").toLowerCase()}function Int(e,r){const n=r.trim().toLowerCase().split(/\s+/).filter(Boolean);if(n.length===0)return!0;const i=Dnt(e);return n.every(s=>i.includes(s))}function Bnt(e){return e.flatMap(r=>{const n=_2(r.tags),i=$nt(r.completionHistory);return(i.length>0?i:r.completedAt?[{completedAt:r.completedAt,previousStatus:null}]:[]).map(a=>({...a,todoId:r.id,message:r.message,tags:n}))}).sort((r,n)=>new Date(n.completedAt).getTime()-new Date(r.completedAt).getTime())}function znt(e){return[...e].sort((r,n)=>{const i=r.status==="done",s=n.status==="done";return i!==s?i?1:-1:0})}function kce(e){const r=new Date(e.getFullYear(),e.getMonth(),1),n=new Date(r);return n.setDate(r.getDate()-r.getDay()),Array.from({length:42},(i,s)=>{const a=new Date(n);return a.setDate(n.getDate()+s),a})}function T7({value:e,onChange:r,placeholder:n="Add date",className:i,iconOnly:s=!1}){const a=wce(e),[o,l]=y.useState(!1),[d,u]=y.useState(()=>a??new Date),h=f=>{r(f),l(!1)};return y.useEffect(()=>{a&&u(a)},[a==null?void 0:a.getTime()]),c.jsxs(A9,{open:o,onOpenChange:l,children:[c.jsx(O9,{asChild:!0,children:c.jsxs(we,{type:"button",variant:"outline",className:Ae(s?"h-8 w-8 justify-center px-0":"h-10 w-full justify-start gap-2 px-3 text-left font-normal",!e&&"text-muted-foreground",i),title:e?`Due ${gv(e)}`:n,"aria-label":e?`Due ${gv(e)}`:n,children:[c.jsx(pR,{className:"h-4 w-4 shrink-0"}),!s&&c.jsx("span",{className:"truncate",children:e?gv(e):n})]})}),c.jsxs(M9,{align:"start",className:"w-[19rem] p-3",children:[c.jsxs("div",{className:"mb-3 flex items-center justify-between gap-2",children:[c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>u(new Date(d.getFullYear(),d.getMonth()-1,1)),"aria-label":"Previous month",children:c.jsx(Nv,{className:"h-4 w-4"})}),c.jsx("div",{className:"text-sm font-medium",children:_ce(d)}),c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>u(new Date(d.getFullYear(),d.getMonth()+1,1)),"aria-label":"Next month",children:c.jsx(Cs,{className:"h-4 w-4"})})]}),c.jsx("div",{className:"grid grid-cols-7 gap-1 text-center text-[11px] font-medium text-muted-foreground",children:["S","M","T","W","T","F","S"].map((f,g)=>c.jsx("div",{className:"py-1",children:f},`${f}-${g}`))}),c.jsx("div",{className:"grid grid-cols-7 gap-1",children:kce(d).map(f=>{const g=j5(f),v=e===g,b=g===j5(new Date),_=f.getMonth()!==d.getMonth();return c.jsx(we,{type:"button",variant:v?"secondary":"ghost",size:"icon",className:Ae("h-8 w-8 rounded-md text-xs font-normal",_&&"text-muted-foreground/55",b&&!v&&"border border-border"),onClick:()=>h(g),children:f.getDate()},g)})}),c.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2 border-t pt-3",children:[c.jsx(we,{type:"button",variant:"ghost",size:"sm",className:"h-8 px-2 text-xs",onClick:()=>h(j5(new Date)),children:"Today"}),c.jsxs(we,{type:"button",variant:"ghost",size:"sm",className:"h-8 px-2 text-xs",onClick:()=>h(null),children:[c.jsx(Xn,{className:"mr-1 h-3.5 w-3.5"}),"Clear"]})]})]})]})}function Fnt({value:e,onChange:r,className:n,iconOnly:i=!1}){const[s,a]=y.useState(!!e);return y.useEffect(()=>{e&&a(!0)},[e]),s?c.jsx(T7,{value:e,onChange:o=>{r(o),o||a(!1)},className:n,iconOnly:i}):c.jsxs(we,{type:"button",variant:"outline",className:Ae(i?"h-8 w-8 justify-center px-0 text-muted-foreground":"h-10 justify-start gap-2 text-muted-foreground",n),onClick:()=>a(!0),title:"Add date","aria-label":"Add date",children:[c.jsx(pR,{className:"h-4 w-4"}),!i&&"Add date"]})}function I1({value:e,onChange:r,options:n,placeholder:i,disabled:s,className:a,triggerLabel:o,triggerIcon:l}){var u;const d=((u=n.find(h=>h.value===e))==null?void 0:u.label)??i??e;return c.jsxs(sh,{value:e,onValueChange:h=>r(h),disabled:s,children:[c.jsx(ed,{className:a,title:o?`${o}: ${d}`:d,"aria-label":o?`${o}: ${d}`:d,children:l||c.jsx(ah,{placeholder:i})}),c.jsx(td,{children:n.map(h=>c.jsx(Ls,{value:h.value,children:h.label},h.value))})]})}function N3({value:e,onChange:r,placeholder:n="Add tag...",commitOnBlur:i=!1,className:s,inputClassName:a}){const[o,l]=y.useState(""),d=mc(e),u=()=>{const f=Lnt(o);f.length!==0&&(r(mc([...d,...f])),l(""))},h=f=>{r(d.filter(g=>g!==f))};return c.jsxs("div",{className:Ae("flex min-h-10 w-full flex-wrap items-center gap-1.5 rounded-lg border border-input bg-background/90 px-2 py-1.5 shadow-sm focus-within:ring-2 focus-within:ring-ring/60 focus-within:ring-offset-2 focus-within:ring-offset-background",s),children:[d.map(f=>c.jsxs(Or,{variant:"secondary",className:"h-6 gap-1 rounded-md px-2 text-xs",children:[c.jsx("span",{children:f}),c.jsx("button",{type:"button",className:"-mr-1 inline-flex h-4 w-4 items-center justify-center rounded-sm text-muted-foreground hover:bg-foreground/10 hover:text-foreground",onClick:()=>h(f),"aria-label":`Remove ${f} tag`,children:c.jsx(Xn,{className:"h-3 w-3"})})]},f)),c.jsx("input",{value:o,onChange:f=>{const g=f.target.value;if(g.includes(",")){const v=g.split(","),b=v.pop()??"",_=mc([...d,...v]);(_.length!==d.length||_.some((S,w)=>S!==d[w]))&&r(_),l(b.trimStart());return}l(g)},onKeyDown:f=>{f.key==="Enter"||f.key===","?(f.preventDefault(),u()):f.key==="Backspace"&&!o&&d.length>0&&(f.preventDefault(),r(d.slice(0,-1)))},onBlur:()=>{i&&u()},className:Ae("h-6 min-w-28 flex-1 bg-transparent px-1 text-sm outline-none placeholder:text-muted-foreground",a),placeholder:d.length===0?n:""})]})}function Hnt({provider:e="jait",model:r=null,runtimeMode:n="full-access",onVoiceInput:i,voiceRecording:s=!1,voiceTranscribing:a=!1,onVoiceStop:o}){var ge;const[l,d]=y.useState([]),[u,h]=y.useState(""),[f,g]=y.useState([]),[v,b]=y.useState("list"),[_,S]=y.useState("all"),[w,C]=y.useState(""),[j,E]=y.useState([]),[A,N]=y.useState([]),[R,B]=y.useState(null),[G,H]=y.useState(()=>new Date),[z,W]=y.useState(""),[I,O]=y.useState("open"),[D,P]=y.useState("normal"),[$,V]=y.useState(null),[K,F]=y.useState([]),[U,Q]=y.useState(()=>new Set),[q,te]=y.useState([]),[ee,se]=y.useState("normal"),[ae,re]=y.useState(null),[de,pe]=y.useState(!0),[_e,me]=y.useState(!1),[qe,oe]=y.useState(!1),[it,Xe]=y.useState(()=>new Set),[gt,Mt]=y.useState(null),[Ht,Yt]=y.useState(!1),[tr,ft]=y.useState(0),Ye=y.useRef(null),ht=y.useRef(null),[Tt,Te]=y.useState(null),[Oe,Je]=y.useState(null),[lt,yt]=y.useState(null),zt=y.useCallback(async()=>{const fe=await gr.listRepos();d(fe),h(Be=>wnt(fe,Be)??"")},[]),or=y.useCallback(async fe=>{if(!fe){g([]),pe(!1);return}pe(!0),Mt(null);try{g(Ant(fe,await gr.listJaitTodos(fe)))}catch(Be){Mt(Be instanceof Error?Be.message:"Failed to load todo list")}finally{pe(!1)}},[]);y.useEffect(()=>{(async()=>{pe(!0),Mt(null);try{await zt()}catch(fe){Mt(fe instanceof Error?fe.message:"Failed to load repositories"),pe(!1)}})()},[zt]),y.useEffect(()=>{or(u)},[or,u]),y.useEffect(()=>{if(!u){C(""),E([]),N([]),B(null),Q(new Set);return}const fe=Mnt(u);C(fe.search),E(fe.tags),N(fe.savedTagFilters),B(u),Q(new Set)},[u]),y.useEffect(()=>{!u||R!==u||Rnt(u,{search:w,tags:j,savedTagFilters:A})},[R,w,u,A,j]);const Pe=y.useMemo(()=>znt(f.filter(fe=>{if(_!=="all"&&fe.status!==_)return!1;const Be=_2(fe.tags);return!(j.length>0&&!j.every(ut=>Be.includes(ut))||!Int(fe,w))})),[w,_,j,f]),Ne=y.useMemo(()=>({open:f.filter(fe=>fe.status==="open").length,inProgress:f.filter(fe=>fe.status==="in_progress").length,done:f.filter(fe=>fe.status==="done").length}),[f]),be=l.find(fe=>fe.id===u),He=y.useMemo(()=>l.map(fe=>({value:fe.id,label:fe.name})),[l]),at=y.useMemo(()=>f.filter(fe=>U.has(fe.id)),[U,f]),Ve=y.useMemo(()=>Pe.filter(fe=>U.has(fe.id)).length,[Pe,U]),$t=Pe.length>0&&Ve===Pe.length,Et=A.find(fe=>lU(fe.tags,j))??null,Xt=y.useMemo(()=>Bnt(f),[f]),rr=Math.max(1,Math.ceil(Xt.length/j3)),nr=Xt.slice(tr*j3,tr*j3+j3);y.useEffect(()=>{ft(fe=>Math.min(fe,rr-1))},[rr]),y.useEffect(()=>{Q(fe=>{const Be=new Set(f.map(Nt=>Nt.id)),ut=new Set([...fe].filter(Nt=>Be.has(Nt)));return ut.size===fe.size?fe:ut})},[f]);const Se=y.useCallback(fe=>{h(fe);const Be=l.find(ut=>ut.id===fe);_nt(fe,(Be==null?void 0:Be.localPath)??null)},[l]);y.useEffect(()=>{if(de||!be||v!=="list")return;const fe=window.requestAnimationFrame(()=>{var Be,ut;(Be=Ye.current)==null||Be.focus(),(ut=Ye.current)==null||ut.select()});return()=>window.cancelAnimationFrame(fe)},[de,v,be==null?void 0:be.id]);const Fe=y.useCallback(async()=>{const fe=z.trim();if(!(!u||!fe)){me(!0),Mt(null);try{const Be=await gr.createJaitTodo(u,{message:fe,status:I,priority:D,dueDate:$,tags:K});g(ut=>{const Nt=[Be,...ut];return sU(u,Nt),Nt}),W(""),O("open"),P("normal"),V(null),F([]),window.requestAnimationFrame(()=>{var ut;return(ut=Ye.current)==null?void 0:ut.focus()})}catch(Be){Mt(Be instanceof Error?Be.message:"Failed to add todo")}finally{me(!1)}}},[$,z,D,I,K,u]),et=y.useCallback(fe=>{fe.key==="Enter"&&!fe.shiftKey&&(fe.preventDefault(),Fe())},[Fe]),wt=y.useCallback(()=>{i==null||i({onTranscript:fe=>{W(Be=>pce(Be,fe)),window.requestAnimationFrame(()=>{const Be=Ye.current;Be&&(Be.focus(),Be.selectionStart=Be.value.length,Be.selectionEnd=Be.value.length,Be.scrollTop=Be.scrollHeight)})}})},[i]),Ze=y.useCallback(()=>{if(s){o==null||o();return}wt()},[wt,o,s]),vt=async(fe,Be)=>{g(ut=>ut.map(Nt=>Nt.id===fe.id?{...Nt,...Be,tags:Be.tags?JSON.stringify(Be.tags):Nt.tags}:Nt));try{const ut=await gr.updateJaitTodo(fe.id,Be);g(Nt=>Nt.map(Pt=>Pt.id===fe.id?ut:Pt))}catch(ut){Mt(ut instanceof Error?ut.message:"Failed to update todo"),or(u)}},Rt=async(fe,Be)=>{fe.status!=="done"&&Be==="done"&&oU(),await vt(fe,{status:Be})},Gt=async fe=>{const Be=f;g(ut=>ut.filter(Nt=>Nt.id!==fe)),Q(ut=>{const Nt=new Set(ut);return Nt.delete(fe),Nt});try{await gr.deleteJaitTodo(fe)}catch(ut){g(Be),Mt(ut instanceof Error?ut.message:"Failed to remove todo")}},$e=y.useCallback((fe,Be)=>{Q(ut=>{const Nt=new Set(ut);return Be?Nt.add(fe):Nt.delete(fe),Nt})},[]),Me=y.useCallback(fe=>{Q(Be=>{const ut=new Set(Be);for(const Nt of Pe)fe?ut.add(Nt.id):ut.delete(Nt.id);return ut})},[Pe]),mt=y.useCallback(()=>{const fe=mc(j);if(fe.length===0)return;const Be=fe.join("|");N(ut=>ut.some(Nt=>Nt.id===Be||lU(Nt.tags,fe))?ut:[...ut,{id:Be,name:fe.join(" + "),tags:fe}])},[j]),Wt=y.useCallback(()=>{Et&&N(fe=>fe.filter(Be=>Be.id!==Et.id))},[Et]),Ot=async(fe,Be)=>{if(at.length!==0){oe(!0),Mt(null);try{const ut=await Promise.all(at.map(Pt=>gr.updateJaitTodo(Pt.id,fe(Pt)))),Nt=new Map(ut.map(Pt=>[Pt.id,Pt]));g(Pt=>Pt.map(cn=>Nt.get(cn.id)??cn))}catch(ut){Mt(ut instanceof Error?ut.message:Be),or(u)}finally{oe(!1)}}},Hr=async fe=>{fe==="done"&&at.some(Be=>Be.status!=="done")&&oU(),await Ot(()=>({status:fe}),"Failed to update selected todo statuses")},mr=async fe=>{await Ot(()=>({priority:fe}),"Failed to update selected todo priorities")},Dr=async fe=>{await Ot(()=>({dueDate:fe}),"Failed to update selected todo due dates")},jt=async()=>{const fe=mc(q);fe.length!==0&&(await Ot(Be=>({tags:mc([..._2(Be.tags),...fe])}),"Failed to update selected todo tags"),te([]))},qr=async()=>{if(at.length===0)return;const fe=f,Be=new Set(at.map(ut=>ut.id));g(ut=>ut.filter(Nt=>!Be.has(Nt.id))),Q(new Set),oe(!0),Mt(null);try{await Promise.all([...Be].map(ut=>gr.deleteJaitTodo(ut)))}catch(ut){g(fe),Mt(ut instanceof Error?ut.message:"Failed to remove selected todos")}finally{oe(!1)}},Wr=async fe=>{if(!(!be||it.has(fe.id))){Xe(Be=>new Set(Be).add(fe.id)),Mt(null);try{const Be=`jait/${Math.random().toString(16).slice(2,10)}`,ut=be.defaultBranch;let Nt;try{Nt=(await $s.createWorktree(be.localPath,ut,Be)).path}catch{try{await $s.createBranch(be.localPath,Be,ut)}catch{}}const Pt=await gr.createThread(knt({repo:be,providerId:e,runtimeMode:n,model:r,workingDirectory:Nt??be.localPath,branch:Be}));await gr.startThread(Pt.id,Cnt(be.name,fe)),fe.status!=="done"&&await vt(fe,{status:"in_progress"})}catch(Be){Mt(Be instanceof Error?Be.message:"Failed to run todo as thread")}finally{Xe(Be=>{const ut=new Set(Be);return ut.delete(fe.id),ut})}}},js=y.useMemo(()=>{const fe=new Map;for(const Be of Pe)Be.dueDate&&fe.set(Be.dueDate,[...fe.get(Be.dueDate)??[],Be]);return fe},[Pe]);y.useEffect(()=>{if(Tt&&!Pe.some(fe=>fe.id===Tt)){Te(null),Je(null),yt(null);return}Oe!=null&&Oe.targetId&&!Pe.some(fe=>fe.id===Oe.targetId)&&Je(Tt?{targetId:Tt,placement:"before"}:null)},[Tt,Oe,Pe]),y.useEffect(()=>{var cn;if(!Tt||!lt)return;document.body.style.cursor="grabbing",document.body.style.userSelect="none",document.body.style.touchAction="none";const fe=Nn=>{var cr;const On=Array.from(document.querySelectorAll("[data-todo-id]")).filter(Kn=>Kn.dataset.todoId&&Kn.dataset.todoId!==Tt);if(On.length===0){Je({targetId:null,placement:"after"});return}for(const Kn of On){const dl=Kn.dataset.todoId;if(!dl)continue;const Qn=Kn.getBoundingClientRect();if(Nn<Qn.top+Qn.height/2){Je({targetId:dl,placement:"before"});return}}const Gn=((cr=On[On.length-1])==null?void 0:cr.dataset.todoId)??null;Je(Gn?{targetId:Gn,placement:"after"}:{targetId:null,placement:"after"})},Be=Nn=>{var On,Gn;if(Nn&&Nn.pointerId!==lt.pointerId)return;Oe&&Oe.targetId!==Tt&&g(cr=>{const Kn=aU(cr,Tt,Oe.targetId,Oe.placement);return Kn===cr?cr:(sU(u,Kn),Kn)});const Ir=ht.current;(On=Ir==null?void 0:Ir.hasPointerCapture)!=null&&On.call(Ir,lt.pointerId)&&((Gn=Ir.releasePointerCapture)==null||Gn.call(Ir,lt.pointerId)),ht.current=null,Te(null),Je(null),yt(null)},ut=Nn=>{Nn.pointerId===lt.pointerId&&(yt(Ir=>Ir&&{...Ir,x:Nn.clientX,y:Nn.clientY}),fe(Nn.clientY))},Nt=()=>Be(),Pt=()=>Be();return window.addEventListener("pointermove",ut),window.addEventListener("pointerup",Be),window.addEventListener("pointercancel",Be),window.addEventListener("blur",Pt),(cn=ht.current)==null||cn.addEventListener("lostpointercapture",Nt),()=>{var Nn;document.body.style.cursor="",document.body.style.userSelect="",document.body.style.touchAction="",window.removeEventListener("pointermove",ut),window.removeEventListener("pointerup",Be),window.removeEventListener("pointercancel",Be),window.removeEventListener("blur",Pt),(Nn=ht.current)==null||Nn.removeEventListener("lostpointercapture",Nt)}},[lt,Tt,Oe,u]);const sr=y.useCallback((fe,Be)=>{var Pt;if(Be.button!==0&&Be.pointerType!=="touch"&&Be.pointerType!=="pen")return;Be.preventDefault();const ut=Be.currentTarget.closest("[data-todo-id]");if(!ut)return;ht.current=ut,(Pt=ut.setPointerCapture)==null||Pt.call(ut,Be.pointerId);const Nt=ut.getBoundingClientRect();Te(fe),Je({targetId:fe,placement:"before"}),yt({id:fe,pointerId:Be.pointerId,x:Be.clientX,y:Be.clientY,offsetX:Be.clientX-Nt.left,offsetY:Be.clientY-Nt.top,width:Nt.width,height:Nt.height})},[]),jr=Tt&&Oe&&(Oe.targetId!==Tt||Oe.placement==="after")?aU(Pe,Tt,Oe.targetId,Oe.placement):Pe,dt=lt?jr.find(fe=>fe.id===lt.id):null;return c.jsxs("div",{className:"mx-auto flex max-w-7xl flex-col gap-4 px-3 py-4 sm:px-4 sm:py-6",children:[c.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("h1",{className:"flex items-center gap-2 text-xl font-bold sm:text-2xl",children:[c.jsx(Vm,{className:"h-6 w-6"}),"Todo"]}),c.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Global repo follow-up work, saved from agents or added directly here."})]}),c.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[c.jsxs(sh,{value:u||void 0,onValueChange:Se,disabled:l.length===0,children:[c.jsx(ed,{className:"h-10 min-w-56",children:c.jsx(ah,{placeholder:"Select repository"})}),c.jsx(td,{children:He.map(fe=>c.jsx(Ls,{value:fe.value,children:fe.label},fe.value))})]}),c.jsxs(we,{variant:"outline",onClick:()=>void or(u),disabled:de||!u,children:[c.jsx(Js,{className:Ae("mr-2 h-4 w-4",de&&"animate-spin")}),"Refresh"]}),c.jsxs(we,{variant:"outline",onClick:()=>Yt(!0),disabled:Xt.length===0,children:[c.jsx(U5,{className:"mr-2 h-4 w-4"}),"History",Xt.length>0&&c.jsx(Or,{variant:"secondary",className:"ml-1 px-1.5",children:Xt.length})]})]})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:flex sm:flex-wrap",children:[c.jsxs(Or,{variant:"outline",className:"justify-center gap-1.5 px-3 py-1",children:[c.jsx(Vm,{className:"h-3.5 w-3.5 text-primary/70"}),f.length," total"]}),c.jsxs(Or,{variant:"secondary",className:"justify-center gap-1.5 px-3 py-1",children:[c.jsx(gR,{className:"h-3.5 w-3.5 text-muted-foreground"}),Ne.open," open"]}),c.jsxs(Or,{variant:"secondary",className:"justify-center gap-1.5 px-3 py-1",children:[c.jsx(yY,{className:"h-3.5 w-3.5 text-sky-500"}),Ne.inProgress," active"]}),c.jsxs(Or,{variant:"secondary",className:"justify-center gap-1.5 px-3 py-1",children:[c.jsx(ia,{className:"h-3.5 w-3.5 text-emerald-500"}),Ne.done," done"]})]}),gt&&c.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-destructive/10 p-3 text-sm text-destructive",children:[c.jsx(na,{className:"h-4 w-4"}),gt,c.jsx(we,{variant:"ghost",size:"sm",className:"ml-auto",onClick:()=>Mt(null),children:"Dismiss"})]}),c.jsx("div",{className:"rounded-lg border p-3",children:c.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-start",children:[c.jsxs("div",{className:"min-w-0 flex-1 rounded-lg border border-input bg-background/90 shadow-sm focus-within:ring-2 focus-within:ring-ring/60 focus-within:ring-offset-2 focus-within:ring-offset-background",children:[c.jsx(Ep,{ref:Ye,value:z,onChange:fe=>W(fe.target.value),onKeyDown:et,placeholder:"Add a future agent prompt or repo task...",className:"min-h-20 resize-y border-0 bg-transparent shadow-none focus-visible:ring-0 focus-visible:ring-offset-0"}),c.jsx(N3,{value:K,onChange:F,placeholder:"Add tags...",className:"min-h-9 rounded-none rounded-b-lg border-x-0 border-b-0 border-t bg-transparent px-2 py-1 shadow-none focus-within:ring-0 focus-within:ring-offset-0",inputClassName:"text-xs"})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-1 text-xs text-muted-foreground lg:w-auto lg:flex-nowrap",children:[c.jsx(g0,{label:`Status: ${$0(I).label}`,children:c.jsx(I1,{value:I,onChange:O,options:m8,triggerLabel:"Status",triggerIcon:c.jsx(F_,{status:I,className:"h-4 w-4"}),className:"h-8 w-8 justify-center rounded-md border-transparent bg-transparent px-0 text-muted-foreground shadow-none hover:bg-accent hover:text-foreground focus:ring-1 focus:ring-ring/50 focus:ring-offset-0 [&>svg:last-child]:hidden"})}),c.jsx(g0,{label:`Priority: ${((ge=n_.find(fe=>fe.value===D))==null?void 0:ge.label)??D}`,children:c.jsx(I1,{value:D,onChange:P,options:n_,triggerLabel:"Priority",triggerIcon:c.jsx(iU,{priority:D}),className:"h-8 w-8 justify-center rounded-md border-transparent bg-transparent px-0 text-muted-foreground shadow-none hover:bg-accent hover:text-foreground focus:ring-1 focus:ring-ring/50 focus:ring-offset-0 [&>svg:last-child]:hidden"})}),c.jsx(g0,{label:$?`Due ${gv($)}`:"Add date",children:c.jsx(Fnt,{value:$,onChange:V,iconOnly:!0,className:"rounded-md border-transparent bg-transparent text-muted-foreground shadow-none hover:bg-accent hover:text-foreground focus:ring-1 focus:ring-ring/50 focus:ring-offset-0"})}),i&&c.jsx(g0,{label:s?"Stop dictation":a?"Transcribing...":"Dictate todo",children:c.jsx(we,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:Ze,disabled:a&&!s,"aria-label":s?"Stop todo dictation":"Dictate todo",children:a?c.jsx(Ft,{className:"h-4 w-4 animate-spin"}):s?c.jsx(i2,{className:"h-4 w-4"}):c.jsx(N0,{className:"h-4 w-4"})})}),c.jsxs(we,{onClick:()=>void Fe(),disabled:_e||!u||!z.trim(),size:"sm",children:[_e?c.jsx(Ft,{className:"mr-2 h-4 w-4 animate-spin"}):c.jsx(Zs,{className:"mr-2 h-4 w-4"}),"Add"]})]})]})}),c.jsxs("div",{className:"grid gap-3 rounded-lg border p-3",children:[c.jsxs("div",{className:"grid gap-2 lg:grid-cols-[minmax(14rem,1fr)_11rem_minmax(14rem,1fr)_13rem_auto]",children:[c.jsxs("div",{className:"relative",children:[c.jsx(rl,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),c.jsx(Ln,{value:w,onChange:fe=>C(fe.target.value),placeholder:"Search todo metadata...",className:"h-10 pl-9"})]}),c.jsx(I1,{value:_,onChange:S,options:[{value:"all",label:"All statuses"},...m8],className:"h-10"}),c.jsx(N3,{value:j,onChange:fe=>E(mc(fe)),placeholder:"Filter tags...",className:"min-h-10"}),c.jsxs(sh,{value:(Et==null?void 0:Et.id)??"custom",onValueChange:fe=>{if(fe==="custom"){E([]);return}const Be=A.find(ut=>ut.id===fe);Be&&E(Be.tags)},children:[c.jsx(ed,{className:"h-10",children:c.jsx(ah,{placeholder:"Saved filters"})}),c.jsxs(td,{children:[c.jsx(Ls,{value:"custom",children:"Unsaved filter"}),A.map(fe=>c.jsx(Ls,{value:fe.id,children:fe.name},fe.id))]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(we,{variant:"outline",size:"icon",className:"h-10 w-10",onClick:mt,disabled:j.length===0||!!Et,"aria-label":"Save tag filter",children:c.jsx(R2,{className:"h-4 w-4"})}),c.jsx(we,{variant:"outline",size:"icon",className:"h-10 w-10",onClick:Wt,disabled:!Et,"aria-label":"Delete saved tag filter",children:c.jsx(Rl,{className:"h-4 w-4"})})]})]}),c.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[c.jsxs(Or,{variant:"outline",className:"gap-1.5",children:[c.jsx(H0e,{className:"h-3.5 w-3.5"}),A.length," saved"]}),c.jsxs("span",{children:[Pe.length," shown"]}),(w||j.length>0||_!=="all")&&c.jsxs(we,{variant:"ghost",size:"sm",className:"h-8 px-2",onClick:()=>{C(""),E([]),S("all")},children:[c.jsx(Xn,{className:"mr-1 h-3.5 w-3.5"}),"Clear"]})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:flex",children:[c.jsxs(we,{variant:v==="list"?"secondary":"outline",onClick:()=>b("list"),children:[c.jsx(Vm,{className:"mr-2 h-4 w-4"}),"List"]}),c.jsxs(we,{variant:v==="calendar"?"secondary":"outline",onClick:()=>b("calendar"),children:[c.jsx(pR,{className:"mr-2 h-4 w-4"}),"Calendar"]})]})]})]}),at.length>0&&c.jsxs("div",{className:"grid gap-3 rounded-lg border p-3",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsxs(Or,{variant:"secondary",children:[at.length," selected"]}),c.jsx(we,{variant:"outline",size:"sm",onClick:()=>void Hr("open"),disabled:qe,children:"Open"}),c.jsx(we,{variant:"outline",size:"sm",onClick:()=>void Hr("in_progress"),disabled:qe,children:"In progress"}),c.jsx(we,{variant:"outline",size:"sm",onClick:()=>void Hr("done"),disabled:qe,children:"Done"}),c.jsx(I1,{value:ee,onChange:fe=>{se(fe),mr(fe)},options:n_,className:"h-9 w-32"}),c.jsx(T7,{value:ae,onChange:fe=>{re(fe),Dr(fe)},placeholder:"Due date",className:"h-9 w-36"}),c.jsx(we,{variant:"outline",size:"sm",onClick:()=>void Dr(null),disabled:qe,children:"Clear date"})]}),c.jsxs("div",{className:"grid gap-2 md:grid-cols-[minmax(14rem,1fr)_auto_auto]",children:[c.jsx(N3,{value:q,onChange:te,placeholder:"Add tags to selected...",className:"min-h-9"}),c.jsxs(we,{variant:"outline",size:"sm",onClick:()=>void jt(),disabled:qe||q.length===0,children:[c.jsx(Zs,{className:"mr-2 h-4 w-4"}),"Add tags"]}),c.jsxs(we,{variant:"outline",size:"sm",onClick:()=>void qr(),disabled:qe,children:[qe?c.jsx(Ft,{className:"mr-2 h-4 w-4 animate-spin"}):c.jsx(Rl,{className:"mr-2 h-4 w-4"}),"Remove"]})]})]}),c.jsx(Pl,{open:Ht,onOpenChange:Yt,children:c.jsxs(al,{className:"max-h-[85vh] max-w-2xl overflow-hidden p-0",children:[c.jsxs(xc,{className:"border-b px-4 py-3",children:[c.jsxs(ol,{className:"flex items-center gap-2 text-base",children:[c.jsx(U5,{className:"h-4 w-4 text-muted-foreground"}),"Completion history"]}),c.jsxs(id,{children:[Xt.length," completed event",Xt.length===1?"":"s"]})]}),c.jsx("div",{className:"grid max-h-[56vh] gap-2 overflow-y-auto px-4 py-3",children:nr.map(fe=>c.jsxs("div",{className:"min-w-0 rounded-md border bg-card/40 px-3 py-2",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[c.jsx(ia,{className:"h-3.5 w-3.5 text-emerald-500"}),c.jsx("span",{children:Sce(fe.completedAt)}),fe.previousStatus&&c.jsxs("span",{children:["from ",$0(fe.previousStatus).label]})]}),c.jsx("div",{className:"mt-1 text-sm",children:fe.message}),fe.tags.length>0&&c.jsx("div",{className:"mt-1 flex flex-wrap gap-1",children:fe.tags.slice(0,6).map(Be=>c.jsx(Or,{variant:"secondary",className:"h-5 rounded px-1.5 text-[11px]",children:Be},Be))})]},`${fe.todoId}-${fe.completedAt}`))}),c.jsxs(xg,{className:"flex-row items-center justify-between border-t px-4 py-3 sm:justify-between sm:space-x-0",children:[c.jsxs("div",{className:"text-xs text-muted-foreground",children:["Page ",tr+1," of ",rr]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs(we,{variant:"outline",size:"sm",onClick:()=>ft(fe=>Math.max(0,fe-1)),disabled:tr===0,children:[c.jsx(Nv,{className:"mr-1 h-4 w-4"}),"Prev"]}),c.jsxs(we,{variant:"outline",size:"sm",onClick:()=>ft(fe=>Math.min(rr-1,fe+1)),disabled:tr>=rr-1,children:["Next",c.jsx(Cs,{className:"ml-1 h-4 w-4"})]})]})]})]})}),de&&f.length===0?c.jsx("div",{className:"flex items-center justify-center py-24",children:c.jsx(Ft,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):be?v==="calendar"?c.jsxs("div",{className:"rounded-lg border",children:[c.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[c.jsxs(we,{variant:"outline",size:"sm",onClick:()=>H(new Date(G.getFullYear(),G.getMonth()-1,1)),children:[c.jsx(Nv,{className:"mr-1 h-4 w-4"}),"Prev"]}),c.jsx("div",{className:"font-medium",children:_ce(G)}),c.jsxs(we,{variant:"outline",size:"sm",onClick:()=>H(new Date(G.getFullYear(),G.getMonth()+1,1)),children:["Next",c.jsx(Cs,{className:"ml-1 h-4 w-4"})]})]}),c.jsx("div",{className:"grid grid-cols-7 border-b text-center text-xs text-muted-foreground",children:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"].map(fe=>c.jsx("div",{className:"py-2",children:fe},fe))}),c.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-7",children:kce(G).map(fe=>{const Be=j5(fe),ut=js.get(Be)??[],Nt=fe.getMonth()!==G.getMonth();return c.jsxs("div",{className:"min-h-32 border-b p-2 sm:border-r [&:nth-child(7n)]:border-r-0",children:[c.jsx("div",{className:Ae("mb-2 text-xs font-medium",Nt&&"text-muted-foreground"),children:fe.getDate()}),c.jsx("div",{className:"space-y-1",children:ut.map(Pt=>{const cn=$0(Pt.status);return c.jsxs("button",{className:Ae("flex w-full items-start gap-1.5 rounded-md border px-2 py-1 text-left text-xs hover:bg-accent",cn.itemClassName),onClick:()=>void Rt(Pt,Pt.status==="done"?"open":"done"),children:[c.jsx(F_,{status:Pt.status,className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),c.jsx("span",{className:Pt.status==="done"?"line-through text-muted-foreground":"",children:Pt.message})]},Pt.id)})})]},Be)})})]}):Pe.length===0?c.jsxs("div",{className:"rounded-lg border-2 border-dashed px-4 py-16 text-center",children:[c.jsx(Nve,{className:"mx-auto mb-4 h-10 w-10 text-muted-foreground"}),c.jsx("h3",{className:"mb-2 text-lg font-medium",children:"No todo items match"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Change filters or add the first repo-wide item."})]}):c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-lg border bg-card/40 px-3 py-2 text-sm text-muted-foreground",children:[c.jsxs("label",{className:"inline-flex items-center gap-2",children:[c.jsx("input",{type:"checkbox",className:"h-4 w-4 rounded border-input",checked:$t,onChange:fe=>Me(fe.target.checked)}),c.jsx("span",{children:Ve>0?`${Ve} selected in view`:"Select visible"})]}),c.jsxs("span",{children:[jr.length," item",jr.length===1?"":"s"]})]}),jr.map(fe=>{var Nn;const Be=_2(fe.tags),ut=$0(fe.status),Nt=it.has(fe.id),Pt=!!(Tt&&(Oe==null?void 0:Oe.targetId)===fe.id&&Oe.placement==="before"&&Tt!==fe.id),cn=!!(Tt&&(Oe==null?void 0:Oe.targetId)===fe.id&&Oe.placement==="after"&&Tt!==fe.id);return c.jsxs("div",{className:"space-y-3",children:[Pt&&c.jsx("div",{className:"relative h-0",children:c.jsx("div",{className:"absolute inset-x-2 -top-px h-0.5 rounded-full bg-primary shadow-[0_0_0_1px_hsl(var(--background))]"})}),c.jsxs("div",{"data-todo-id":fe.id,className:Ae("group rounded-lg border p-2 transition-all duration-150 ease-out sm:p-3",ut.itemClassName,Tt&&"touch-none",Tt===fe.id&&"border-dashed border-primary/35 bg-primary/5 opacity-0"),children:[c.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-2",children:[c.jsxs("div",{className:"flex flex-col items-center gap-1",children:[c.jsx("input",{"data-no-drag":"true",type:"checkbox",className:"h-4 w-4 rounded border-input",checked:U.has(fe.id),onChange:Ir=>$e(fe.id,Ir.target.checked),"aria-label":"Select todo"}),c.jsx("div",{className:"shrink-0 cursor-grab touch-none rounded p-0.5 text-muted-foreground transition-colors hover:bg-foreground/10 hover:text-foreground active:cursor-grabbing",title:"Drag to reorder","aria-label":"Drag to reorder",onPointerDown:Ir=>sr(fe.id,Ir),children:c.jsx(F4,{className:"h-4 w-4"})}),c.jsx("button",{className:"h-6 w-6 shrink-0 rounded text-muted-foreground hover:text-foreground",onClick:()=>void Rt(fe,fe.status==="done"?"open":"done"),"aria-label":"Toggle todo status",children:c.jsx(F_,{status:fe.status})})]}),c.jsxs("div",{className:"min-w-0 flex-1 rounded-lg border border-input bg-background/90 shadow-sm focus-within:ring-2 focus-within:ring-ring/60 focus-within:ring-offset-2 focus-within:ring-offset-background",children:[c.jsx(Ep,{className:Ae("min-h-20 resize-y border-0 bg-transparent shadow-none focus-visible:ring-0 focus-visible:ring-offset-0",fe.status==="done"&&"text-muted-foreground line-through"),defaultValue:fe.message,onBlur:Ir=>{const On=Ir.target.value.trim();On&&On!==fe.message&&vt(fe,{message:On})}}),c.jsx(N3,{value:Be,onChange:Ir=>{const On=mc(Ir);JSON.stringify(On)!==JSON.stringify(mc(Be))&&vt(fe,{tags:On})},placeholder:"Add tags...",commitOnBlur:!0,className:"min-h-9 rounded-none rounded-b-lg border-x-0 border-b-0 border-t bg-transparent px-2 py-1 shadow-none focus-within:ring-0 focus-within:ring-offset-0",inputClassName:"text-xs"})]}),c.jsxs("div",{className:"grid w-[4.25rem] grid-cols-2 gap-0.5 text-xs text-muted-foreground",children:[c.jsx(g0,{label:`Status: ${ut.label}`,children:c.jsx(I1,{value:fe.status,onChange:Ir=>void Rt(fe,Ir),options:m8,triggerLabel:"Status",triggerIcon:c.jsx(F_,{status:fe.status,className:"h-4 w-4"}),className:"h-8 w-8 justify-center rounded-md border-transparent bg-transparent px-0 text-muted-foreground shadow-none hover:bg-accent hover:text-foreground focus:ring-1 focus:ring-ring/50 focus:ring-offset-0 [&>svg:last-child]:hidden"})}),c.jsx(g0,{label:`Priority: ${((Nn=n_.find(Ir=>Ir.value===fe.priority))==null?void 0:Nn.label)??fe.priority}`,children:c.jsx(I1,{value:fe.priority,onChange:Ir=>void vt(fe,{priority:Ir}),options:n_,triggerLabel:"Priority",triggerIcon:c.jsx(iU,{priority:fe.priority}),className:"h-8 w-8 justify-center rounded-md border-transparent bg-transparent px-0 text-muted-foreground shadow-none hover:bg-accent hover:text-foreground focus:ring-1 focus:ring-ring/50 focus:ring-offset-0 [&>svg:last-child]:hidden"})}),c.jsx(g0,{label:fe.dueDate?`Due ${gv(fe.dueDate)}`:"Date",children:c.jsx(T7,{value:fe.dueDate??null,onChange:Ir=>void vt(fe,{dueDate:Ir}),placeholder:"Date",iconOnly:!0,className:"rounded-md border-transparent bg-transparent text-muted-foreground shadow-none hover:bg-accent hover:text-foreground focus:ring-1 focus:ring-ring/50 focus:ring-offset-0"})}),c.jsx(we,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>void Wr(fe),disabled:Nt||!be,title:"Run todo as thread","aria-label":"Run todo as thread",children:Nt?c.jsx(Ft,{className:"h-4 w-4 animate-spin"}):c.jsx(WS,{className:"h-4 w-4"})}),c.jsx(we,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-foreground",onClick:()=>void Gt(fe.id),"aria-label":"Remove todo",children:c.jsx(Rl,{className:"h-4 w-4"})})]})]}),c.jsx("div",{className:"mt-2 flex justify-end",children:fe.sourceThreadTitle&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:["Suggested by `",fe.sourceThreadTitle,"`"]})})]}),cn&&c.jsx("div",{className:"relative h-0",children:c.jsx("div",{className:"absolute inset-x-2 -top-px h-0.5 rounded-full bg-primary shadow-[0_0_0_1px_hsl(var(--background))]"})})]},fe.id)}),lt&&dt&&c.jsx("div",{className:"pointer-events-none fixed z-50",style:{left:`${lt.x-lt.offsetX}px`,top:`${lt.y-lt.offsetY}px`,width:`${lt.width}px`,minHeight:`${lt.height}px`},children:c.jsx("div",{className:"scale-[1.01] opacity-95",children:c.jsx(Pnt,{todo:dt})})})]}):c.jsx("div",{className:"rounded-lg border-2 border-dashed px-4 py-16 text-center text-sm text-muted-foreground",children:"Add a repository in manager mode before creating todo items."})]})}var Wnt="Separator",cU="horizontal",Unt=["horizontal","vertical"],Cce=y.forwardRef((e,r)=>{const{decorative:n,orientation:i=cU,...s}=e,a=Vnt(i)?i:cU,l=n?{role:"none"}:{"aria-orientation":a==="vertical"?a:void 0,role:"separator"};return c.jsx(US.div,{"data-orientation":a,...l,...s,ref:r})});Cce.displayName=Wnt;function Vnt(e){return Unt.includes(e)}var jce=Cce;const N5=y.forwardRef(({className:e,orientation:r="horizontal",decorative:n=!0,...i},s)=>c.jsx(jce,{ref:s,decorative:n,orientation:r,className:Ae("shrink-0 bg-border",r==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...i}));N5.displayName=jce.displayName;function qnt(e){if(Array.isArray(e))return e;if(!e)return[];try{const r=JSON.parse(e);return Array.isArray(r)?r.filter(n=>typeof n=="string"):[]}catch{return e.split(",").map(r=>r.trim()).filter(Boolean)}}function Gnt(e){return[...new Set(e.split(",").map(r=>r.trim().toLowerCase()).filter(Boolean))]}function i_(e){if(!e)return"No activity";const r=new Date(e);return Number.isNaN(r.getTime())?e:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(r)}function Knt(){const[e,r]=y.useState(null),[n,i]=y.useState("active"),[s,a]=y.useState("all"),[o,l]=y.useState(""),[d,u]=y.useState(""),[h,f]=y.useState("none"),[g,v]=y.useState([]),[b,_]=y.useState(""),[S,w]=y.useState(""),[C,j]=y.useState(""),[E,A]=y.useState(!0),[N,R]=y.useState(!1),[B,G]=y.useState(!1),[H,z]=y.useState(null),W=y.useCallback(async()=>{A(!0),z(null);try{r(await gr.getRemindersSnapshot({status:n,limit:200})),v(await gr.listUserSecrets())}catch(ee){z(ee instanceof Error?ee.message:"Failed to load memory")}finally{A(!1)}},[n]);y.useEffect(()=>{W()},[W]);const I=(e==null?void 0:e.projects)??[],O=y.useMemo(()=>{const ee=(e==null?void 0:e.reminders)??[];return s==="all"?ee:ee.filter(se=>se.projectId===s)},[e==null?void 0:e.reminders,s]),D=(e==null?void 0:e.threads)??[],P=y.useMemo(()=>new Map(I.map(ee=>[ee.id,ee])),[I]),$=y.useMemo(()=>{const ee=new Map;for(const se of I)for(const ae of se.sessions)ee.set(ae.id,{name:ae.name,projectId:ae.projectId});return ee},[I]),V=y.useMemo(()=>({reminders:(e==null?void 0:e.reminders.length)??0,projects:I.length,sessions:I.reduce((ee,se)=>ee+se.sessions.length,0),threads:D.length}),[e==null?void 0:e.reminders.length,D.length,I]),K=async()=>{const ee=o.trim();if(ee){R(!0),z(null);try{const se=await gr.createReminder({content:ee,projectId:h==="none"?null:h,tags:Gnt(d),sourceType:"user",sourceSurface:"web"});r(ae=>ae&&{...ae,reminders:[se,...ae.reminders]}),l(""),u("")}catch(se){z(se instanceof Error?se.message:"Failed to add memory")}finally{R(!1)}}},F=async(ee,se)=>{r(ae=>ae&&{...ae,reminders:ae.reminders.map(re=>re.id===ee.id?{...re,...se,tags:se.tags?JSON.stringify(se.tags):re.tags}:re)});try{const ae=await gr.updateReminder(ee.id,se);r(re=>re&&{...re,reminders:re.reminders.map(de=>de.id===ee.id?ae:de)})}catch(ae){z(ae instanceof Error?ae.message:"Failed to update memory"),W()}},U=async ee=>{const se=e;r(ae=>ae&&{...ae,reminders:ae.reminders.filter(re=>re.id!==ee)});try{await gr.deleteReminder(ee)}catch(ae){r(se),z(ae instanceof Error?ae.message:"Failed to delete memory")}},Q=async()=>{const ee=b.trim(),se=S.trim();if(!(!ee||!se||!C)){R(!0),z(null);try{const ae=await gr.createUserSecret({type:"ssh-password",key:se,label:ee,value:C});v(re=>[ae,...re.filter(de=>de.id!==ae.id)]),_(""),w(""),j("")}catch(ae){z(ae instanceof Error?ae.message:"Failed to save secret")}finally{R(!1)}}},q=async ee=>{const se=g;v(ae=>ae.filter(re=>re.id!==ee));try{await gr.deleteUserSecret(ee)}catch(ae){v(se),z(ae instanceof Error?ae.message:"Failed to delete secret")}},te=async()=>{z(null);try{const ee=await gr.exportMemoryMarkdown({status:n,projectId:s,limit:500});await navigator.clipboard.writeText(ee),G(!0),window.setTimeout(()=>G(!1),1400)}catch(ee){z(ee instanceof Error?ee.message:"Failed to copy memory export")}};return c.jsxs("div",{className:"mx-auto flex max-w-7xl flex-col gap-4 px-3 py-4 sm:px-4 sm:py-6",children:[c.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("h1",{className:"flex items-center gap-2 text-xl font-bold sm:text-2xl",children:[c.jsx(Zo,{className:"h-6 w-6"}),"Memory"]}),c.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Agent-readable memory with project chat history and completed thread context."})]}),c.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[c.jsxs(sh,{value:n,onValueChange:ee=>i(ee),children:[c.jsx(ed,{className:"h-10 w-full sm:w-40",children:c.jsx(ah,{})}),c.jsxs(td,{children:[c.jsx(Ls,{value:"active",children:"Active"}),c.jsx(Ls,{value:"archived",children:"Archived"}),c.jsx(Ls,{value:"all",children:"All"})]})]}),c.jsxs(we,{variant:"outline",onClick:()=>void W(),disabled:E,children:[c.jsx(Js,{className:Ae("mr-2 h-4 w-4",E&&"animate-spin")}),"Refresh"]}),c.jsxs(we,{variant:"outline",onClick:()=>void te(),children:[c.jsx(hc,{className:"mr-2 h-4 w-4"}),B?"Copied":"Copy Markdown"]})]})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:flex sm:flex-wrap",children:[c.jsxs(Or,{variant:"outline",className:"justify-center px-3 py-1",children:[V.reminders," memories"]}),c.jsxs(Or,{variant:"secondary",className:"justify-center px-3 py-1",children:[V.projects," projects"]}),c.jsxs(Or,{variant:"secondary",className:"justify-center px-3 py-1",children:[V.sessions," chats"]}),c.jsxs(Or,{variant:"secondary",className:"justify-center px-3 py-1",children:[V.threads," threads"]}),c.jsxs(Or,{variant:"secondary",className:"justify-center px-3 py-1",children:[g.length," secrets"]})]}),H&&c.jsx(tn,{className:"border-destructive/30 bg-destructive/10 shadow-none",children:c.jsxs(Kc,{className:"flex items-center gap-2 p-3 text-sm text-destructive",children:[c.jsx(na,{className:"h-4 w-4 shrink-0"}),c.jsx("span",{className:"min-w-0 flex-1",children:H}),c.jsx(we,{variant:"ghost",size:"sm",className:"shrink-0",onClick:()=>z(null),children:"Dismiss"})]})}),c.jsx(tn,{children:c.jsxs(Kc,{className:"grid gap-3 p-3 lg:grid-cols-[minmax(0,1fr)_220px_220px_auto] lg:items-end",children:[c.jsxs("div",{className:"min-w-0 space-y-2",children:[c.jsx(mi,{htmlFor:"new-reminder-content",children:"Memory"}),c.jsx(Ep,{id:"new-reminder-content",value:o,onChange:ee=>l(ee.target.value),placeholder:"Add agent-readable memory...",className:"min-h-20 lg:min-h-10"})]}),c.jsxs("div",{className:"min-w-0 space-y-2",children:[c.jsx(mi,{children:"Project"}),c.jsxs(sh,{value:h,onValueChange:f,children:[c.jsx(ed,{className:"h-10",children:c.jsx(ah,{placeholder:"Project"})}),c.jsxs(td,{children:[c.jsx(Ls,{value:"none",children:"No project"}),I.map(ee=>c.jsx(Ls,{value:ee.id,children:ee.title||ee.rootPath||"Untitled project"},ee.id))]})]})]}),c.jsxs("div",{className:"min-w-0 space-y-2",children:[c.jsx(mi,{htmlFor:"new-reminder-tags",children:"Tags"}),c.jsx(Ln,{id:"new-reminder-tags",value:d,onChange:ee=>u(ee.target.value),placeholder:"tags, comma separated"})]}),c.jsxs(we,{onClick:()=>void K(),disabled:N||!o.trim(),className:"lg:self-end",children:[N?c.jsx(Ft,{className:"mr-2 h-4 w-4 animate-spin"}):c.jsx(Zs,{className:"mr-2 h-4 w-4"}),"Add"]})]})}),c.jsxs("div",{className:"grid gap-4 xl:grid-cols-[minmax(0,1fr)_420px]",children:[c.jsxs("div",{className:"min-w-0 space-y-3",children:[c.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-between",children:[c.jsx("h2",{className:"text-sm font-semibold uppercase tracking-normal text-muted-foreground",children:"Memory List"}),c.jsxs(sh,{value:s,onValueChange:a,children:[c.jsx(ed,{className:"h-10 w-full sm:w-64",children:c.jsx(ah,{})}),c.jsxs(td,{children:[c.jsx(Ls,{value:"all",children:"All projects"}),I.map(ee=>c.jsx(Ls,{value:ee.id,children:ee.title||ee.rootPath||"Untitled project"},ee.id))]})]})]}),E&&!e?c.jsx("div",{className:"flex items-center justify-center py-24",children:c.jsx(Ft,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):O.length===0?c.jsx(tn,{className:"border-2 border-dashed shadow-none",children:c.jsxs(Kc,{className:"px-4 py-16 text-center",children:[c.jsx(Zo,{className:"mx-auto mb-4 h-10 w-10 text-muted-foreground"}),c.jsx("h3",{className:"mb-2 text-lg font-medium",children:"No memory matches"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Change filters or add the first memory entry."})]})}):O.map(ee=>{const se=ee.projectId?P.get(ee.projectId):null,ae=ee.sessionId?$.get(ee.sessionId):null,re=qnt(ee.tags),de=`${ee.sourceType}:${ee.sourceId||"none"}@${ee.sourceSurface}`;return c.jsx(tn,{children:c.jsxs(Kc,{className:"p-3",children:[c.jsx(Ep,{className:"min-h-20",defaultValue:ee.content,onBlur:pe=>{const _e=pe.target.value.trim();_e&&_e!==ee.content&&F(ee,{content:_e})}}),c.jsxs("div",{className:"mt-3 flex flex-col gap-2 text-xs text-muted-foreground sm:flex-row sm:flex-wrap sm:items-center",children:[c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(Hve,{className:"h-3.5 w-3.5"}),se?se.title||se.rootPath||"Project":"Global memory"]}),ae&&c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(Kd,{className:"h-3.5 w-3.5"}),ae.name||"Chat"]}),c.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1",title:de,children:[c.jsx(Kd,{className:"h-3.5 w-3.5"}),c.jsx("span",{className:"truncate",children:de})]}),c.jsxs("span",{className:"inline-flex items-center gap-1",title:"Usage count",children:[c.jsx(E0e,{className:"h-3.5 w-3.5"}),ee.usageCount??0," uses"]}),c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(HD,{className:"h-3.5 w-3.5"}),"Updated ",i_(ee.updatedAt)]}),c.jsxs("span",{className:"inline-flex items-center gap-1",children:[c.jsx(HD,{className:"h-3.5 w-3.5"}),"Retrieved ",i_(ee.lastRetrievedAt)]})]}),re.length>0&&c.jsx("div",{className:"mt-3 flex flex-wrap gap-1.5",children:re.map(pe=>c.jsx(Or,{variant:"secondary",className:"rounded-md",children:pe},pe))}),c.jsx(N5,{className:"my-3"}),c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsxs(we,{variant:"outline",size:"sm",onClick:()=>void F(ee,{status:ee.status==="active"?"archived":"active"}),children:[ee.status==="active"?c.jsx(fR,{className:"mr-2 h-4 w-4"}):c.jsx(ia,{className:"mr-2 h-4 w-4"}),ee.status==="active"?"Archive":"Restore"]}),c.jsxs(we,{variant:"outline",size:"sm",onClick:()=>void U(ee.id),children:[c.jsx(Rl,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]})},ee.id)})]}),c.jsx("div",{className:"min-w-0",children:c.jsxs(Y0,{defaultValue:"projects",className:"min-w-0",children:[c.jsxs(ag,{className:"grid w-full grid-cols-3",children:[c.jsx(Qs,{value:"projects",children:"Projects"}),c.jsx(Qs,{value:"threads",children:"Threads"}),c.jsx(Qs,{value:"secrets",children:"Secrets"})]}),c.jsx(ea,{value:"projects",className:"mt-3",children:c.jsx(Jc,{className:"max-h-[42rem] pr-1",children:c.jsxs("div",{className:"space-y-2",children:[I.map(ee=>c.jsx(tn,{children:c.jsxs(Kc,{className:"p-3",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-medium",children:ee.title||ee.rootPath||"Untitled project"}),c.jsx("div",{className:"truncate text-xs text-muted-foreground",children:ee.rootPath||ee.nodeId||"No path"})]}),c.jsx(Or,{variant:"outline",className:"shrink-0",children:ee.reminderCount})]}),c.jsx(N5,{className:"my-3"}),c.jsxs("div",{className:"space-y-1.5",children:[ee.sessions.slice(0,6).map(se=>c.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs",children:[c.jsx("span",{className:"min-w-0 truncate",children:se.name||"Chat"}),c.jsx("span",{className:"shrink-0 text-muted-foreground",children:i_(se.lastActiveAt)})]},se.id)),ee.sessions.length===0&&c.jsx("div",{className:"text-xs text-muted-foreground",children:"No chats yet"})]})]})},ee.id)),I.length===0&&c.jsx(tn,{className:"border-2 border-dashed shadow-none",children:c.jsx(Kc,{className:"p-6 text-center text-sm text-muted-foreground",children:"No projects yet"})})]})})}),c.jsx(ea,{value:"threads",className:"mt-3",children:c.jsx(Jc,{className:"max-h-[42rem] pr-1",children:c.jsxs("div",{className:"space-y-2",children:[D.slice(0,12).map(ee=>c.jsx(tn,{children:c.jsx(Kc,{className:"p-3",children:c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-medium",children:ee.title}),c.jsxs("div",{className:"truncate text-xs text-muted-foreground",children:[ee.providerId," · ",i_(ee.updatedAt)]})]}),c.jsx(Or,{variant:ee.status==="completed"?"secondary":"outline",className:"shrink-0",children:ee.status})]})})},ee.id)),D.length===0&&c.jsx(tn,{className:"border-2 border-dashed shadow-none",children:c.jsx(Kc,{className:"p-6 text-center text-sm text-muted-foreground",children:"No past threads yet"})})]})})}),c.jsx(ea,{value:"secrets",className:"mt-3",children:c.jsx(tn,{children:c.jsxs(Kc,{className:"space-y-3 p-3",children:[c.jsxs("div",{className:"grid gap-2",children:[c.jsx(Ln,{value:b,onChange:ee=>_(ee.target.value),placeholder:"Label"}),c.jsx(Ln,{value:S,onChange:ee=>w(ee.target.value),placeholder:"SSH key, for example jakob@192.168.178.53:22"}),c.jsx(Ln,{type:"password",value:C,onChange:ee=>j(ee.target.value),placeholder:"Password"}),c.jsxs(we,{onClick:()=>void Q(),disabled:N||!b.trim()||!S.trim()||!C,children:[N?c.jsx(Ft,{className:"mr-2 h-4 w-4 animate-spin"}):c.jsx(i1e,{className:"mr-2 h-4 w-4"}),"Save Secret"]})]}),c.jsx(N5,{}),c.jsx(Jc,{className:"max-h-[30rem] pr-1",children:c.jsxs("div",{className:"space-y-2",children:[g.map(ee=>c.jsx(tn,{children:c.jsx(Kc,{className:"p-3",children:c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsx("div",{className:"truncate text-sm font-medium",children:ee.label}),c.jsxs("div",{className:"truncate text-xs text-muted-foreground",children:[ee.type," · ",ee.key]}),c.jsxs("div",{className:"mt-1 text-xs text-muted-foreground",children:["Last used ",i_(ee.lastUsedAt)]})]}),c.jsx(we,{variant:"ghost",size:"sm",className:"shrink-0",onClick:()=>void q(ee.id),children:c.jsx(Rl,{className:"h-4 w-4"})})]})})},ee.id)),g.length===0&&c.jsx(tn,{className:"border-2 border-dashed shadow-none",children:c.jsx(Kc,{className:"p-6 text-center text-sm text-muted-foreground",children:"No saved secrets"})})]})})]})})})]})})]})]})}function uU({status:e}){switch(e){case"A":case"?":return c.jsx(Q3,{className:"h-3.5 w-3.5 text-green-500 shrink-0"});case"D":return c.jsx(Dye,{className:"h-3.5 w-3.5 text-red-500 shrink-0"});case"R":return c.jsx(Rye,{className:"h-3.5 w-3.5 text-blue-500 shrink-0"});default:return c.jsx(vY,{className:"h-3.5 w-3.5 text-yellow-500 shrink-0"})}}function dU(e){switch(e){case"A":return"Added";case"?":return"Untracked";case"D":return"Deleted";case"R":return"Renamed";default:return"Modified"}}function Ynt({cwd:e,baseBranch:r,branch:n,onClose:i}){const[s,a]=y.useState([]),[o,l]=y.useState(!0),[d,u]=y.useState(0),[h,f]=y.useState(()=>typeof window<"u"&&window.innerWidth<960);y.useEffect(()=>{let _=!1;return l(!0),$s.fileDiffs(e,r,n).then(S=>{_||(a(S),u(0))}).catch(()=>{_||a([])}).finally(()=>{_||l(!1)}),()=>{_=!0}},[r,n,e]),y.useEffect(()=>{const _=()=>f(window.innerWidth<960);return _(),window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)},[]);const g=s[d]??null,v=g?x2(g.path):"plaintext",b=y.useCallback(_=>{_.key==="Escape"?i():_.key==="ArrowDown"||_.key==="j"?(_.preventDefault(),u(S=>Math.min(S+1,s.length-1))):(_.key==="ArrowUp"||_.key==="k")&&(_.preventDefault(),u(S=>Math.max(S-1,0)))},[i,s.length]);return c.jsx("div",{className:"fixed inset-0 z-[100] bg-background/80 backdrop-blur-sm flex items-center justify-center p-4",onKeyDown:b,tabIndex:-1,children:c.jsxs("div",{className:"bg-popover border rounded-lg shadow-xl w-full max-w-6xl h-[85vh] flex flex-col",children:[c.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b shrink-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx(vY,{className:"h-4 w-4 text-muted-foreground"}),c.jsx("h3",{className:"text-sm font-medium",children:"Changes"}),!o&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.length," file",s.length!==1?"s":""," changed"]})]}),c.jsx(we,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:i,children:c.jsx(Xn,{className:"h-4 w-4"})})]}),o?c.jsx("div",{className:"flex-1 flex items-center justify-center",children:c.jsx(Ft,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):s.length===0?c.jsx("div",{className:"flex-1 flex items-center justify-center text-sm text-muted-foreground",children:"No changes detected."}):c.jsxs("div",{className:Ae("flex-1 flex min-h-0",h&&"flex-col"),children:[c.jsxs("div",{className:Ae("border-r flex flex-col shrink-0 bg-muted/20",h?"w-full border-r-0 border-b max-h-40":"w-56"),children:[c.jsx("div",{className:"px-3 py-2 border-b",children:c.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Files"})}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:s.map((_,S)=>c.jsxs("button",{className:Ae("flex items-center gap-2 w-full px-3 py-1.5 text-left text-xs hover:bg-accent/50 transition-colors",S===d&&"bg-accent"),onClick:()=>u(S),title:`${_.path} (${dU(_.status)})`,children:[c.jsx(uU,{status:_.status}),c.jsx("span",{className:"truncate font-mono",children:_.path.split(/[/\\]/).pop()})]},_.path))})]}),c.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 border-b bg-muted/10 shrink-0",children:[c.jsx(uU,{status:(g==null?void 0:g.status)??"M"}),c.jsx("span",{className:"text-xs font-mono text-muted-foreground truncate",children:g==null?void 0:g.path}),c.jsx("span",{className:Ae("text-2xs px-1.5 py-0.5 rounded font-medium",(g==null?void 0:g.status)==="A"||(g==null?void 0:g.status)==="?"?"bg-green-500/10 text-green-500":(g==null?void 0:g.status)==="D"?"bg-red-500/10 text-red-500":"bg-yellow-500/10 text-yellow-500"),children:dU((g==null?void 0:g.status)??"M")})]}),c.jsx("div",{className:"flex-1 min-h-0",children:g&&c.jsx(Ww,{original:g.original,modified:g.modified,language:v,modelKey:g.path,className:"h-full",editorClassName:"h-full",renderSideBySide:!h,options:{readOnly:!0,minimap:{enabled:!1},renderOverviewRuler:!0,ignoreTrimWhitespace:!1,enableSplitViewResizing:!0}},g.path)})]})]})]})})}const hU={github:{placeholder:"ghp_... or github_pat_...",createUrl:"https://github.com/settings/tokens/new?scopes=repo,read:org,workflow&description=Jait+CLI",createLabel:"Create a GitHub token",scopes:"repo, read:org, and workflow",cliName:"gh",cliUrl:"https://cli.github.com"},gitlab:{placeholder:"glpat-...",createUrl:"https://gitlab.com/-/user_settings/personal_access_tokens",createLabel:"Create a GitLab token",scopes:"api and write_repository",cliName:"glab",cliUrl:"https://gitlab.com/gitlab-org/cli"},gitea:{placeholder:"your-gitea-token",createUrl:"",createLabel:"Create a token in your Gitea settings",scopes:"repo access",cliName:"tea",cliUrl:"https://gitea.com/gitea/tea"},"azure-devops":{placeholder:"your-azure-devops-pat",createUrl:"https://dev.azure.com/_usersSettings/tokens",createLabel:"Create an Azure DevOps PAT",scopes:"Code (Read & Write)",cliName:"az",cliUrl:"https://learn.microsoft.com/en-us/cli/azure/install-azure-cli"},bitbucket:{placeholder:"your-bitbucket-app-password",createUrl:"https://bitbucket.org/account/settings/app-passwords/",createLabel:"Create a Bitbucket app password",scopes:"Repositories (Read/Write) and Pull Requests (Read/Write)"}};function Xnt({open:e,onOpenChange:r,cwd:n,remoteUrl:i,onReady:s}){const[a,o]=y.useState("checking"),[l,d]=y.useState(null),[u,h]=y.useState(""),[f,g]=y.useState(null),v=(l==null?void 0:l.provider)??"github",b=(l==null?void 0:l.forgeName)??"Git Forge",_=hU[v]??hU.github,S=y.useCallback(async()=>{o("checking"),g(null);try{const j=await $s.forgeStatus(n,i);d(j),!j.installed&&!j.authenticated?o("not-installed"):j.authenticated?o("success"):o("not-authenticated")}catch(j){g(j instanceof Error?j.message:"Failed to check forge status"),o("error")}},[n,i]);y.useEffect(()=>{e&&(S(),h(""))},[e,S]);const w=y.useCallback(async()=>{if(u.trim()){o("authenticating"),g(null);try{const j=await $s.forgeAuth(u.trim(),n,i);j.ok?(d(E=>E&&{...E,authenticated:!0,username:j.username}),o("success"),h("")):(g(j.error??"Authentication failed — check your token permissions."),o("not-authenticated"))}catch(j){g(j instanceof Error?j.message:"Authentication failed"),o("not-authenticated")}}},[u,n,i]),C=y.useCallback(()=>{r(!1),s==null||s()},[r,s]);return c.jsx(Pl,{open:e,onOpenChange:r,children:c.jsxs(al,{className:"max-w-md",children:[c.jsxs(xc,{children:[c.jsxs(ol,{children:[b," Setup"]}),c.jsxs(id,{children:["Pull request creation requires authentication with ",b,"."]})]}),a==="checking"&&c.jsxs("div",{className:"flex items-center gap-3 py-4",children:[c.jsx(Ft,{className:"h-5 w-5 animate-spin text-muted-foreground"}),c.jsxs("span",{className:"text-sm text-muted-foreground",children:["Checking ",b," status…"]})]}),(a==="not-installed"||a==="not-authenticated")&&c.jsxs("div",{className:"space-y-4 py-2",children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx(ch,{className:`h-5 w-5 mt-0.5 shrink-0 ${a==="not-installed"?"text-red-500":"text-amber-500"}`}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"text-sm font-medium",children:a==="not-installed"?`${b} CLI not detected`:`${b} is not authenticated`}),c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Paste a Personal Access Token with ",_.scopes," scope to sign in."]})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsx(mi,{htmlFor:"forge-token",className:"text-xs",children:"Personal Access Token"}),c.jsx(Ln,{id:"forge-token",type:"password",placeholder:_.placeholder,value:u,onChange:j=>h(j.target.value),onKeyDown:j=>{j.key==="Enter"&&w()},autoFocus:!0}),c.jsxs("p",{className:"text-2xs text-muted-foreground",children:[_.createUrl?c.jsx("a",{href:_.createUrl,target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground",children:_.createLabel}):c.jsx("span",{children:_.createLabel})," ","with ",c.jsx("code",{className:"text-2xs",children:_.scopes})," permissions."]})]}),a==="not-installed"&&_.cliName&&_.cliUrl&&c.jsxs("p",{className:"text-2xs text-muted-foreground",children:["Optionally install the ",c.jsx("code",{className:"text-2xs",children:_.cliName})," CLI:"," ",c.jsx("a",{href:_.cliUrl,target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground",children:_.cliUrl})]}),f&&c.jsx("p",{className:"text-xs text-red-500",children:f})]}),a==="authenticating"&&c.jsxs("div",{className:"flex items-center gap-3 py-4",children:[c.jsx(Ft,{className:"h-5 w-5 animate-spin text-muted-foreground"}),c.jsxs("span",{className:"text-sm text-muted-foreground",children:["Authenticating with ",b,"…"]})]}),a==="success"&&c.jsxs("div",{className:"flex items-start gap-3 py-4",children:[c.jsx(ia,{className:"h-5 w-5 text-green-500 mt-0.5 shrink-0"}),c.jsxs("div",{className:"space-y-1",children:[c.jsxs("p",{className:"text-sm font-medium",children:["Authenticated",l!=null&&l.username?` as ${l.username}`:""," on ",b]}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"You can now create pull requests."})]})]}),a==="error"&&c.jsxs("div",{className:"flex items-start gap-3 py-4",children:[c.jsx(ch,{className:"h-5 w-5 text-red-500 mt-0.5 shrink-0"}),c.jsxs("div",{className:"space-y-1",children:[c.jsx("p",{className:"text-sm font-medium",children:"Something went wrong"}),f&&c.jsx("p",{className:"text-xs text-muted-foreground",children:f})]})]}),c.jsxs(xg,{children:[(a==="not-installed"||a==="not-authenticated"||a==="error")&&c.jsxs(c.Fragment,{children:[a==="error"&&c.jsx(we,{variant:"outline",size:"sm",onClick:()=>void S(),children:"Re-check"}),c.jsx(we,{size:"sm",disabled:!u.trim(),onClick:()=>void w(),children:"Sign in"})]}),a==="success"&&c.jsx(we,{size:"sm",onClick:C,children:"Continue"})]})]})})}const Jnt=Xnt;function Nce(e,r,n,i){return e?r==="creating"||r==="open"||r==="merged"||r==="closed"||i!=null&&i.branch&&i.branch!==e?!0:n==="completed"?!((i==null?void 0:i.branch)===e&&i.hasWorkingTreeChanges):!1:!1}function fU(e,r,n,i,s){return r?Nce(r,n,i,s)?{baseBranch:e,branch:r}:{baseBranch:e}:{}}function Znt(e){return e!=="creating"}function pU(e,r,n){return e==null||r==null||n==null?null:{insertions:r,deletions:n,hasChanges:e>0}}function Qnt(e,r,n){return e?e.hasWorkingTreeChanges||!(n==="merged"||n==="closed")?!0:!!r:!1}function eit({hasRepository:e,threadKind:r,threadStatus:n,threadBranch:i,prUrl:s,prState:a}){return!e||r!=="delivery"?!1:!!(i||n==="completed"||s||a==="creating"||a==="open")}function tit({insertions:e,deletions:r}){return c.jsxs("span",{className:"inline-flex items-center gap-1 font-medium tabular-nums",children:[c.jsxs("span",{className:"text-green-600 dark:text-green-400",children:["+",e]}),c.jsxs("span",{className:"text-red-600 dark:text-red-400",children:["-",r]})]})}function nL({threadId:e,cwd:r,branch:n,baseBranch:i,threadTitle:s,prUrl:a,prState:o,threadStatus:l,threadKind:d="delivery",showStatusBadge:u=!0,changeFiles:h,changeInsertions:f,changeDeletions:g}){var de;const v=sx(),b=pU(h,f,g),[_,S]=y.useState(!1),[w,C]=y.useState(!1),[j,E]=y.useState(!1),[A,N]=y.useState(null),[R,B]=y.useState(()=>b),G=y.useRef(!1),H=y.useRef(!1),[z,W]=y.useState(a?{url:a,kind:"created"}:null);y.useEffect(()=>{W(pe=>a?{url:a,kind:"created"}:(pe==null?void 0:pe.kind)==="create"?pe:null)},[a]),y.useEffect(()=>{let pe=!1;return Znt(o)?((async()=>{try{const me=await $s.status(r,n??void 0);if(pe)return;N(me);const qe=pU(h,f,g);if(qe){B(qe);return}const oe=fU(i,n,o,l,me),it=n?await $s.diffStats(r,oe.baseBranch,oe.branch).catch(()=>null):null;if(pe)return;if(it){B({insertions:it.insertions,deletions:it.deletions,hasChanges:it.hasChanges});return}if(n){B(null);return}B({insertions:me.index.insertions+me.workingTree.insertions,deletions:me.index.deletions+me.workingTree.deletions,hasChanges:me.hasWorkingTreeChanges})}catch{pe||(N(null),B(null))}})(),()=>{pe=!0}):void 0},[i,n,g,h,f,r,o,a,l]);const[I,O]=y.useState(null),D=y.useRef(null);y.useEffect(()=>{if(!n||!a||o==="merged"||o==="closed"){O(null),D.current&&(clearInterval(D.current),D.current=null);return}const pe=async()=>{try{const _e=await $s.prChecks(r,n);if(!_e||_e.length===0){O(null);return}const me=_e.some(oe=>oe.conclusion==="failure"||oe.conclusion==="cancelled"),qe=_e.some(oe=>oe.state==="PENDING"||oe.state==="QUEUED"||oe.state==="IN_PROGRESS"||!oe.conclusion);O(me?"failing":qe?"pending":"passing")}catch{}};return pe(),D.current=setInterval(pe,15e3),()=>{D.current&&(clearInterval(D.current),D.current=null)}},[n,r,a,o]);const P=z??(a?{url:a,kind:"created"}:null)??((de=A==null?void 0:A.pr)!=null&&de.url?{url:A.pr.url,kind:"created"}:null),$=o==="creating"&&(P==null?void 0:P.kind)==="created"?"open":o,V=Nce(n,$,l,A),K=fU(i,n,$,l,A),F=$==="creating",U=b??R,Q=V?!!(U!=null&&U.hasChanges):Qnt(A,n,$),q=F&&!P?"Creating PR...":P?P.kind==="created"?"Open PR":"Open PR Page":"Create Pull Request",te=F&&!P?"Creating pull request":P?q:"Create pull request",ee=d==="delivery"&&(P!=null||l==="completed"),se=_||F,ae=y.useCallback(async()=>{if(P){window.open(P.url,"_blank");return}if(l!=="completed"){Pn.error("Thread not completed",{description:"Finish the thread before creating a pull request."});return}if(d!=="delivery"){Pn.error("PR creation unavailable",{description:"Delegation threads are helper workers and do not create pull requests."});return}if(S(!0),!H.current)try{if((await $s.status(r)).prProvider==="github"){const _e=await $s.ghStatus(r);if(!_e.installed||!_e.authenticated){S(!1),G.current=!0,E(!0);return}}}catch{}H.current=!1;try{const pe=s.replace(/^\[.*?\]\s*/,""),_e=await gr.createPullRequest(e,{commitMessage:pe,baseBranch:i}),me=_e.result;_e.pushFailed?_e.resumed?Pn.info("Push failed — thread resumed",{description:"The agent is investigating the push failure and will fix the issue."}):Pn.error("Push failed",{description:_e.error??"Git push failed. Re-open the thread to fix the issue."}):me.pr.url?W({url:me.pr.url,kind:"created"}):me.push.createPrUrl&&W({url:me.push.createPrUrl,kind:"create"})}catch(pe){Pn.error("Failed",{description:pe instanceof Error?pe.message:"Unknown error"})}finally{S(!1)}},[i,r,e,d,l,s,P]),re=y.useCallback(()=>{G.current&&(G.current=!1,H.current=!0,ae())},[ae]);return c.jsxs(c.Fragment,{children:[c.jsx(Jnt,{open:j,onOpenChange:E,cwd:r,onReady:re}),c.jsxs("div",{className:"inline-flex items-center gap-1",children:[Q&&U&&c.jsxs(we,{variant:"ghost",size:"sm",className:"h-7 gap-1 px-2 text-xs sm:h-6 sm:text-2xs",onClick:()=>C(!0),title:"View changes","aria-label":`View changes: +${U.insertions} -${U.deletions}`,children:[c.jsx(tit,{insertions:U.insertions,deletions:U.deletions}),!v&&"Changes"]}),c.jsxs(we,{variant:"ghost",size:"sm",className:"h-7 min-w-8 gap-1 px-2 text-xs sm:h-6 sm:min-w-7 sm:text-2xs",disabled:se||!ee,onClick:ae,title:d!=="delivery"?"Delegation threads do not create pull requests.":!P&&l!=="completed"?"Finish the thread before creating a pull request.":te,"aria-label":te,children:[se?c.jsx(Ft,{className:"h-3.5 w-3.5 animate-spin sm:h-3 sm:w-3"}):c.jsx(Kye,{className:"h-3.5 w-3.5 sm:h-3 sm:w-3"}),!v&&q]}),u&&P&&c.jsx(Or,{variant:"outline",className:`h-5 px-1.5 text-2xs font-medium ${$==="merged"?"border-purple-500/40 text-purple-700 bg-purple-500/10 dark:text-purple-300 dark:bg-purple-500/20 dark:border-purple-400/40":$==="closed"?"border-red-500/40 text-red-700 bg-red-500/10 dark:text-red-300 dark:bg-red-500/20 dark:border-red-400/40":$==="creating"?"border-amber-500/40 text-amber-700 bg-amber-500/10 dark:text-amber-300 dark:bg-amber-500/20 dark:border-amber-400/40":P.kind==="created"?"border-green-500/40 text-green-700 dark:text-green-300 dark:border-green-400/40":"border-amber-500/40 text-amber-700 dark:text-amber-300 dark:border-amber-400/40"}`,children:$==="merged"?"PR merged":$==="closed"?"PR closed":$==="creating"?"PR creating":P.kind==="created"?"PR open":"PR ready to open"}),u&&(P==null?void 0:P.kind)==="created"&&$==="open"&&I&&c.jsxs(Or,{variant:"outline",className:`h-5 px-1.5 text-2xs font-medium inline-flex items-center gap-0.5 ${I==="failing"?"border-red-500/40 text-red-700 bg-red-500/10 dark:text-red-300 dark:bg-red-500/20 dark:border-red-400/40":I==="pending"?"border-amber-500/40 text-amber-700 bg-amber-500/10 dark:text-amber-300 dark:bg-amber-500/20 dark:border-amber-400/40":"border-green-500/40 text-green-700 bg-green-500/10 dark:text-green-300 dark:bg-green-500/20 dark:border-green-400/40"}`,children:[I==="failing"?c.jsx(ch,{className:"h-3 w-3"}):I==="pending"?c.jsx(vg,{className:"h-3 w-3"}):c.jsx(ia,{className:"h-3 w-3"}),I==="failing"?"Checks failing":I==="pending"?"Checks pending":"Checks passed"]})]}),w&&c.jsx(Ynt,{cwd:r,baseBranch:K.baseBranch,branch:K.branch,onClose:()=>C(!1)})]})}const rit={bundled:"bg-sky-500/10 text-sky-600",user:"bg-amber-500/10 text-amber-600",project:"bg-emerald-500/10 text-emerald-600",plugin:"bg-fuchsia-500/10 text-fuchsia-600"},nit=[{pattern:/\b(debug|bug|troubleshoot|fix)\b/i,icon:mA},{pattern:/\b(review|audit|security|secure|vuln)\b/i,icon:g1e},{pattern:/\b(test|qa|spec)\b/i,icon:Ave},{pattern:/\b(perf|performance|optimi[sz]e|latency|profil)\b/i,icon:gA},{pattern:/\b(arch|design|system|topology|diagram)\b/i,icon:dc},{pattern:/\b(research|investigate|search|explore)\b/i,icon:rl},{pattern:/\b(data|analysis|analytics|report)\b/i,icon:gA},{pattern:/\b(code|generate|scaffold|tool|workflow)\b/i,icon:wR}];function iit(e){const r=`${e.id} ${e.name} ${e.description}`,n=nit.find(({pattern:i})=>i.test(r));return{icon:(n==null?void 0:n.icon)??B0e,className:rit[e.source]}}function sit(e){return e.open&&!e.attemptedLoad&&e.skillsLength===0&&!e.loading}const ait=qn();function oit({token:e,threadId:r,selectedSkillIds:n}){const[i,s]=y.useState(!1),[a,o]=y.useState([]),[l,d]=y.useState(!1),[u,h]=y.useState(null),[f,g]=y.useState(!1),[v,b]=y.useState(!1),_=y.useCallback(async()=>{d(!0),h(null);try{const A={};e&&(A.Authorization=`Bearer ${e}`);const N=await fetch(`${ait}/api/skills`,{headers:A});if(!N.ok)throw new Error(`Failed to load skills (HTTP ${N.status})`);const R=await N.json();o(R)}catch(A){h(A instanceof Error?A.message:"Failed to load skills")}finally{d(!1),g(!0)}},[e]);y.useEffect(()=>{sit({open:i,attemptedLoad:f,skillsLength:a.length,loading:l})&&_()},[f,_,l,i,a.length]);const S=y.useMemo(()=>a.filter(A=>A.enabled),[a]),w=n??S.map(A=>A.id),C=n===null,j=y.useCallback(async A=>{b(!0);try{await gr.updateThread(r,{skillIds:A})}finally{b(!1)}},[r]),E=y.useCallback(async(A,N)=>{const R=N?[...new Set([...w,A])]:w.filter(B=>B!==A);await j(R)},[w,j]);return c.jsxs(A9,{open:i,onOpenChange:s,children:[c.jsx(O9,{asChild:!0,children:c.jsxs(we,{variant:"ghost",size:"sm",className:"h-6 gap-1 px-2 text-[10px] text-muted-foreground",children:[c.jsx(o1e,{className:"h-3 w-3"}),C?"Skills:auto":`Skills:${(n==null?void 0:n.length)??0}`]})}),c.jsxs(M9,{align:"end",className:"w-80 space-y-3 p-3",children:[c.jsxs("div",{className:"flex items-start justify-between gap-2",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-medium",children:"Thread skills"}),c.jsx("p",{className:"text-xs text-muted-foreground",children:C?"Uses globally enabled skills.":"Uses only pinned skills for this thread."})]}),C?c.jsx(Or,{variant:"secondary",className:"text-[10px]",children:"global"}):c.jsx(Or,{variant:"outline",className:"text-[10px]",children:"custom"})]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(we,{size:"sm",variant:C?"secondary":"outline",className:"h-7 text-xs",disabled:v,onClick:()=>void j(null),children:"Global"}),c.jsx(we,{size:"sm",variant:!C&&((n==null?void 0:n.length)??0)===0?"secondary":"outline",className:"h-7 text-xs",disabled:v,onClick:()=>void j([]),children:"None"})]}),l?c.jsxs("div",{className:"flex items-center gap-2 py-4 text-sm text-muted-foreground",children:[c.jsx(Ft,{className:"h-4 w-4 animate-spin"}),"Loading skills..."]}):u?c.jsxs("div",{className:"space-y-3 rounded-lg border border-destructive/50 bg-destructive/5 p-3",children:[c.jsxs("div",{className:"flex items-start gap-2 text-sm text-destructive",children:[c.jsx(na,{className:"mt-0.5 h-4 w-4 shrink-0"}),c.jsx("span",{children:u})]}),c.jsx(we,{size:"sm",variant:"outline",className:"h-7 text-xs",onClick:()=>{g(!1),_()},children:"Retry"})]}):S.length===0?c.jsx("div",{className:"rounded-lg border border-dashed p-4 text-xs text-muted-foreground",children:"No enabled skills. Install/enable ClawHub skills in Settings."}):c.jsx("div",{className:"max-h-64 space-y-2 overflow-y-auto pr-1",children:S.map(A=>{const N=w.includes(A.id),R=iit(A),B=R.icon;return c.jsxs("div",{className:"flex items-start gap-3 rounded-lg border p-2.5",children:[c.jsx("div",{className:`mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-md ${R.className}`,children:c.jsx(B,{className:"h-3.5 w-3.5"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsx("p",{className:"truncate text-sm font-medium",children:A.name}),c.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:A.description})]}),c.jsx(gf,{checked:N,disabled:v||C,onCheckedChange:G=>{E(A.id,G)}})]},A.id)})})]})]})}function lit({open:e,onOpenChange:r,repoId:n,repoName:i}){const s=bg(),[a,o]=y.useState(""),[l,d]=y.useState(""),[u,h]=y.useState(!1),[f,g]=y.useState(!1),[v,b]=y.useState(!1),[_,S]=y.useState(null),w=a!==l,C=uk();y.useEffect(()=>{if(!e||!n)return;let R=!1;return h(!0),S(null),gr.getRepoStrategy(n).then(B=>{R||(o(B),d(B))}).catch(B=>{R||S(B instanceof Error?B.message:"Failed to load strategy")}).finally(()=>{R||h(!1)}),()=>{R=!0}},[e,n]);const j=y.useCallback(async()=>{g(!0),S(null);try{const R=await gr.updateRepoStrategy(n,a);d(R),o(R)}catch(R){S(R instanceof Error?R.message:"Failed to save strategy")}finally{g(!1)}},[n,a]),E=y.useCallback(async()=>{b(!0),S(null);try{const R=await gr.generateRepoStrategy(n);R&&o(R)}catch(R){S(R instanceof Error?R.message:"Failed to generate strategy")}finally{b(!1)}},[n]),A=y.useCallback(()=>{o(l)},[l]),N=y.useCallback(R=>{if(R||!w){r(R);return}(async()=>await s({title:"Discard changes",description:"You have unsaved changes. Discard them?",confirmLabel:"Discard",variant:"destructive"})&&r(!1))()},[s,w,r]);return c.jsx(Pl,{open:e,onOpenChange:N,children:c.jsxs(al,{className:"flex max-h-[85vh] w-full max-w-3xl flex-col gap-0 overflow-hidden p-0",children:[c.jsx(xc,{className:"shrink-0 border-b px-4 py-3",children:c.jsxs(ol,{className:"flex items-center gap-2 text-sm",children:[c.jsx("span",{children:"Strategy"}),c.jsx("span",{className:"text-muted-foreground",children:"—"}),c.jsx("span",{className:"font-normal text-muted-foreground",children:i}),w&&c.jsx("span",{className:"ml-1 rounded bg-amber-500/10 px-1.5 py-0.5 text-2xs text-amber-600 dark:text-amber-400",children:"unsaved"})]})}),c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[u?c.jsx("div",{className:"flex flex-1 items-center justify-center py-12",children:c.jsx(Ft,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):c.jsxs("div",{className:"relative min-h-0 flex-1",children:[c.jsx(dk,{height:"55vh",language:"markdown",beforeMount:R=>vc(R,C),theme:C,value:a,onChange:R=>o(R??""),options:{minimap:{enabled:!1},"semanticHighlighting.enabled":!0,lineNumbers:"off",wordWrap:"on",fontSize:13,padding:{top:12,bottom:12},scrollBeyondLastLine:!1,renderLineHighlight:"none",overviewRulerLanes:0,folding:!0,tabSize:2}}),!a.trim()&&c.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center px-8 text-center",children:c.jsxs("div",{className:"max-w-md space-y-2",children:[c.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Add repository guidance for your agents"}),c.jsxs("p",{className:"text-xs leading-5 text-muted-foreground/80",children:["This works like a ",c.jsx("code",{children:"CLAUDE.md"})," or ",c.jsx("code",{children:"AGENTS.md"})," file: describe build commands, test workflow, code conventions, and repo-specific rules."]})]})})]}),_&&c.jsx("div",{className:"border-t bg-destructive/5 px-4 py-2 text-xs text-destructive",children:_})]}),c.jsx(xg,{className:"shrink-0 border-t px-4 py-3",children:c.jsxs("div",{className:"flex w-full items-center justify-between",children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsxs(we,{variant:"outline",size:"sm",className:"gap-1.5 text-xs",disabled:v||u,onClick:E,children:[v?c.jsx(Ft,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(P2,{className:"h-3.5 w-3.5"}),"Generate template"]}),w&&c.jsxs(we,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs",onClick:A,children:[c.jsx(CY,{className:"h-3.5 w-3.5"}),"Reset"]})]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(we,{variant:"ghost",size:"sm",className:"text-xs",onClick:()=>r(!1),children:"Cancel"}),c.jsxs(we,{size:"sm",className:"gap-1.5 text-xs",disabled:!w||f||u,onClick:j,children:[f?c.jsx(Ft,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(R2,{className:"h-3.5 w-3.5"}),"Save"]})]})]})})]})})}const cit={proposed:{label:"Proposed",color:"text-blue-600 dark:text-blue-400",bg:"bg-blue-500/10"},approved:{label:"Ready",color:"text-green-600 dark:text-green-400",bg:"bg-green-500/10"},running:{label:"Running",color:"text-amber-600 dark:text-amber-400",bg:"bg-amber-500/10"},completed:{label:"Done",color:"text-emerald-600 dark:text-emerald-400",bg:"bg-emerald-500/10"},skipped:{label:"Skipped",color:"text-muted-foreground",bg:"bg-muted/50"}};function uit({status:e}){const r=cit[e];return c.jsx("span",{className:`inline-flex items-center rounded-full px-1.5 py-0.5 text-2xs font-medium ${r.color} ${r.bg}`,children:r.label})}function dit({open:e,onOpenChange:r,repoId:n,repoName:i,defaultBranch:s,repoLocalPath:a,provider:o,model:l,onStartThread:d}){const u=bg(),[h,f]=y.useState([]),[g,v]=y.useState(null),[b,_]=y.useState(!1),[S,w]=y.useState(!1),[C,j]=y.useState(null),[E,A]=y.useState(""),[N,R]=y.useState(new Set),[B,G]=y.useState(null),[H,z]=y.useState(""),[W,I]=y.useState(""),O=h.find(re=>re.id===g)??h[0]??null;y.useEffect(()=>{if(!e||!n)return;let re=!1;return _(!0),j(null),gr.listPlans(n).then(de=>{re||(f(de),de.length>0&&!g&&v(de[0].id))}).catch(de=>{re||j(de instanceof Error?de.message:"Failed to load plans")}).finally(()=>{re||_(!1)}),()=>{re=!0}},[e,n]);const D=y.useCallback(async()=>{j(null);try{const re=await gr.createPlan(n,{title:"New Plan"});f(de=>[re,...de]),v(re.id)}catch(re){j(re instanceof Error?re.message:"Failed to create plan")}},[n]),P=y.useCallback(async()=>{if(O){w(!0),j(null);try{const re=await gr.generatePlanTasks(O.id,{prompt:E||void 0,provider:o,model:o==="jait"?null:l??null});f(de=>de.map(pe=>pe.id===re.plan.id?re.plan:pe)),A("")}catch(re){j(re instanceof Error?re.message:"Failed to generate tasks")}finally{w(!1)}}},[O,E,l,o]),$=y.useCallback(async(re,de)=>{if(!O)return;const pe=O.tasks.map(_e=>_e.id===re?{..._e,status:de}:_e);try{const _e=await gr.updatePlan(O.id,{tasks:pe});f(me=>me.map(qe=>qe.id===_e.id?_e:qe))}catch(_e){j(_e instanceof Error?_e.message:"Failed to update task")}},[O]),V=y.useCallback(async re=>{if(!O)return;const de=O.tasks.filter(pe=>pe.id!==re);try{const pe=await gr.updatePlan(O.id,{tasks:de});f(_e=>_e.map(me=>me.id===pe.id?pe:me))}catch(pe){j(pe instanceof Error?pe.message:"Failed to remove task")}},[O]),K=y.useCallback(async()=>{if(!O||!B)return;const re=O.tasks.map(de=>de.id===B?{...de,title:H,description:W}:de);try{const de=await gr.updatePlan(O.id,{tasks:re});f(pe=>pe.map(_e=>_e.id===de.id?de:_e)),G(null)}catch(de){j(de instanceof Error?de.message:"Failed to save task")}},[O,B,H,W]),F=y.useCallback(async re=>{if(O){j(null);try{await gr.startPlanTask(O.id,re.id),d(re,O,{name:i,localPath:a,defaultBranch:s}),f(de=>de.map(pe=>pe.id===O.id?{...pe,tasks:pe.tasks.map(_e=>_e.id===re.id?{..._e,status:"running"}:_e)}:pe))}catch(de){j(de instanceof Error?de.message:"Failed to start task")}}},[O,i,a,s,d]),U=y.useCallback(async()=>{if(!O)return;j(null);const re=O.tasks.filter(pe=>pe.status==="approved"||pe.status==="proposed");if(re.length===0){j("No tasks to start. Approve some tasks first, or generate new ones.");return}const de=O.tasks.map(pe=>pe.status==="proposed"?{...pe,status:"approved"}:pe);try{const pe=await gr.updatePlan(O.id,{tasks:de,status:"active"});f(_e=>_e.map(me=>me.id===pe.id?pe:me))}catch{}for(const pe of re)try{d(pe,O,{name:i,localPath:a,defaultBranch:s}),f(_e=>_e.map(me=>me.id===O.id?{...me,tasks:me.tasks.map(qe=>qe.id===pe.id?{...qe,status:"running"}:qe)}:me)),await new Promise(_e=>setTimeout(_e,500))}catch{}},[O,i,a,s,d]),Q=y.useCallback(async()=>{if(!(!O||!await u({title:"Delete plan",description:`Delete plan "${O.title}"?`,confirmLabel:"Delete",variant:"destructive"})))try{await gr.deletePlan(O.id),f(de=>de.filter(pe=>pe.id!==O.id)),v(null)}catch(de){j(de instanceof Error?de.message:"Failed to delete plan")}},[O,u]),q=re=>{R(de=>{const pe=new Set(de);return pe.has(re)?pe.delete(re):pe.add(re),pe})},te=re=>{G(re.id),z(re.title),I(re.description),R(de=>new Set(de).add(re.id))},ee=(O==null?void 0:O.tasks.filter(re=>re.status==="approved"||re.status==="proposed").length)??0,se=(O==null?void 0:O.tasks.filter(re=>re.status==="completed").length)??0,ae=(O==null?void 0:O.tasks.length)??0;return c.jsx(Pl,{open:e,onOpenChange:r,children:c.jsxs(al,{className:"flex max-h-[85vh] w-full max-w-2xl flex-col gap-0 overflow-hidden p-0",children:[c.jsx(xc,{className:"shrink-0 border-b px-4 py-3",children:c.jsxs(ol,{className:"flex items-center gap-2 text-sm",children:[c.jsx("span",{children:"Plans"}),c.jsx("span",{className:"text-muted-foreground",children:"—"}),c.jsx("span",{className:"font-normal text-muted-foreground",children:i}),O&&ae>0&&c.jsxs("span",{className:"ml-auto text-2xs text-muted-foreground",children:[se,"/",ae," done"]})]})}),c.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden",children:[b?c.jsx("div",{className:"flex flex-1 items-center justify-center py-12",children:c.jsx(Ft,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):O?c.jsxs(c.Fragment,{children:[h.length>1&&c.jsxs("div",{className:"flex items-center gap-2 border-b px-4 py-2",children:[c.jsx("select",{className:"flex-1 rounded border bg-transparent px-2 py-1 text-xs",value:O.id,onChange:re=>v(re.target.value),children:h.map(re=>c.jsxs("option",{value:re.id,children:[re.title," (",re.tasks.length," tasks)"]},re.id))}),c.jsx(we,{variant:"ghost",size:"sm",className:"h-6 px-2 text-2xs",onClick:D,children:c.jsx(Zs,{className:"h-3 w-3"})})]}),c.jsxs("div",{className:"flex items-center gap-2 border-b px-4 py-2",children:[c.jsx(Ln,{placeholder:"Describe what you want to accomplish…",className:"h-8 flex-1 text-xs",value:E,onChange:re=>A(re.target.value),onKeyDown:re=>{re.key==="Enter"&&!re.shiftKey&&(re.preventDefault(),P())}}),c.jsxs(we,{variant:"outline",size:"sm",className:"h-8 gap-1.5 text-xs",disabled:S,onClick:()=>void P(),children:[S?c.jsx(Ft,{className:"h-3.5 w-3.5 animate-spin"}):c.jsx(P2,{className:"h-3.5 w-3.5"}),"Generate"]})]}),c.jsx("div",{className:"flex-1 overflow-y-auto",children:O.tasks.length===0?c.jsx("div",{className:"flex flex-col items-center justify-center gap-2 py-8",children:c.jsx("p",{className:"text-xs text-muted-foreground",children:"No tasks yet. Use the prompt above to generate tasks, or add them manually."})}):c.jsx("div",{className:"divide-y",children:O.tasks.map(re=>{const de=N.has(re.id),pe=B===re.id,_e=re.status==="proposed"||re.status==="approved",me=re.status==="proposed"||re.status==="approved";return c.jsxs("div",{className:"px-4 py-2.5",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("button",{type:"button",className:"shrink-0 rounded p-0.5 text-muted-foreground hover:text-foreground",onClick:()=>q(re.id),children:de?c.jsx(Dl,{className:"h-3.5 w-3.5"}):c.jsx(Cs,{className:"h-3.5 w-3.5"})}),c.jsx(uit,{status:re.status}),pe?c.jsx(Ln,{className:"h-6 flex-1 text-xs",value:H,onChange:qe=>z(qe.target.value),onKeyDown:qe=>{qe.key==="Enter"&&K(),qe.key==="Escape"&&G(null)},autoFocus:!0}):c.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[c.jsx("span",{className:`min-w-0 flex-1 truncate text-xs ${re.status==="skipped"?"line-through text-muted-foreground":"font-medium"}`,children:re.title}),re.skillCandidate&&c.jsx("span",{className:"inline-flex shrink-0 items-center rounded-full bg-violet-500/10 px-1.5 py-0.5 text-[10px] font-medium text-violet-600 dark:text-violet-400",children:"skill"})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[_e&&c.jsx("button",{type:"button",title:"Start thread",className:"rounded p-1 text-green-600 hover:bg-green-500/10 dark:text-green-400",onClick:()=>void F(re),children:c.jsx(WS,{className:"h-3.5 w-3.5",fill:"currentColor"})}),re.status==="proposed"&&c.jsx("button",{type:"button",title:"Approve",className:"rounded p-1 text-green-600 hover:bg-green-500/10 dark:text-green-400",onClick:()=>void $(re.id,"approved"),children:c.jsx(ms,{className:"h-3.5 w-3.5"})}),me&&c.jsx("button",{type:"button",title:"Skip",className:"rounded p-1 text-muted-foreground hover:bg-muted",onClick:()=>void $(re.id,"skipped"),children:c.jsx(yve,{className:"h-3.5 w-3.5"})}),!pe&&(re.status==="proposed"||re.status==="approved")&&c.jsx("button",{type:"button",title:"Edit",className:"rounded p-1 text-muted-foreground hover:bg-muted",onClick:()=>te(re),children:c.jsx(_R,{className:"h-3 w-3"})}),pe&&c.jsx("button",{type:"button",title:"Save",className:"rounded p-1 text-green-600 hover:bg-green-500/10",onClick:()=>void K(),children:c.jsx(ms,{className:"h-3.5 w-3.5"})}),(re.status==="proposed"||re.status==="approved"||re.status==="skipped")&&c.jsx("button",{type:"button",title:"Remove",className:"rounded p-1 text-muted-foreground hover:text-destructive",onClick:()=>void V(re.id),children:c.jsx(Rl,{className:"h-3 w-3"})})]})]}),de&&c.jsxs("div",{className:"mt-2 pl-6",children:[pe?c.jsx("textarea",{className:"w-full rounded border bg-transparent px-2 py-1.5 text-xs leading-relaxed focus:outline-none focus:ring-1 focus:ring-primary",rows:4,value:W,onChange:qe=>I(qe.target.value)}):c.jsx("p",{className:"whitespace-pre-wrap text-xs leading-relaxed text-muted-foreground",children:re.description||"No description."}),re.threadId&&c.jsxs("p",{className:"mt-1 text-2xs text-muted-foreground",children:["Thread: ",c.jsx("code",{className:"rounded bg-muted px-1",children:re.threadId.slice(-8)})]}),(re.skillCandidate||re.skillRationale||re.skillTitle)&&c.jsxs("div",{className:"mt-2 rounded-md border border-violet-500/20 bg-violet-500/5 px-2 py-1.5 text-[10px] text-muted-foreground",children:[c.jsxs("p",{children:["Skill eval: ",re.skillCandidate?"yes":"no",re.skillTitle?` · ${re.skillTitle}`:""]}),re.skillRationale&&c.jsx("p",{className:"mt-1 whitespace-pre-wrap",children:re.skillRationale})]})]})]},re.id)})})})]}):c.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 py-12",children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:"No plans yet for this repository."}),c.jsxs(we,{size:"sm",className:"gap-1.5 text-xs",onClick:D,children:[c.jsx(Zs,{className:"h-3.5 w-3.5"}),"Create plan"]})]}),C&&c.jsx("div",{className:"border-t bg-destructive/5 px-4 py-2 text-xs text-destructive",children:C})]}),c.jsx(xg,{className:"shrink-0 border-t px-4 py-3",children:c.jsxs("div",{className:"flex w-full items-center justify-between",children:[c.jsxs("div",{className:"flex gap-2",children:[!O&&c.jsxs(we,{size:"sm",className:"gap-1.5 text-xs",onClick:D,children:[c.jsx(Zs,{className:"h-3.5 w-3.5"}),"New plan"]}),O&&c.jsxs(we,{variant:"ghost",size:"sm",className:"gap-1.5 text-xs text-destructive hover:text-destructive",onClick:()=>void Q(),children:[c.jsx(Rl,{className:"h-3.5 w-3.5"}),"Delete plan"]})]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx(we,{variant:"ghost",size:"sm",className:"text-xs",onClick:()=>r(!1),children:"Close"}),O&&ee>0&&c.jsxs(we,{size:"sm",className:"gap-1.5 text-xs",onClick:()=>void U(),children:[c.jsx(aye,{className:"h-3.5 w-3.5"}),"Start all (",ee,")"]})]})]})})]})})}function hit(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const r=e;return typeof r.id!="string"||typeof r.scope!="string"||r.scope!=="project"&&r.scope!=="contact"?null:{id:r.id,scope:r.scope,source:typeof r.source=="string"?r.source:"",sourceType:typeof r.sourceType=="string"?r.sourceType:void 0,sourceId:typeof r.sourceId=="string"?r.sourceId:void 0,sourceSurface:typeof r.sourceSurface=="string"?r.sourceSurface:void 0,updatedAt:typeof r.updatedAt=="string"?r.updatedAt:"",content:typeof r.content=="string"?r.content:""}}function g8(e){return Array.isArray(e)?e.filter(r=>typeof r=="string"):[]}function E7(e){const r=e.memory&&typeof e.memory=="object"&&!Array.isArray(e.memory)?e.memory:null,n=Array.isArray(r==null?void 0:r.retrieved)?r.retrieved.map(hit).filter(s=>!!s):[],i=r?{query:typeof r.query=="string"?r.query:"",retrieved:n,injectedIds:g8(r.injectedIds),ignoredIds:g8(r.ignoredIds),savedIds:g8(r.savedIds)}:void 0;return{provider:String(e.provider??"jait"),model:typeof e.model=="string"?e.model:void 0,rounds:Array.isArray(e.rounds)?e.rounds:[],note:typeof e.note=="string"?e.note:void 0,...i?{memory:i}:{}}}function Vv(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function Ys(e){return typeof e=="string"&&e.trim()?e:null}function Tce(e){if(typeof e!="string")return null;try{const r=JSON.parse(e);return Vv(r)}catch{return null}}function H_(...e){const r={};for(const n of e)if(n)for(const[i,s]of Object.entries(n))s!=null&&s!==""&&(r[i]=s);return r}function y8(e,r){const n=Vv(e.args),i=Vv(e.data),s=Tce(e.message),a=r.replace("_","."),o=H_(i,s);return Object.keys(n??{}).length>0?H_(o,n):a==="edit"||a.startsWith("file.")?H_(o,{path:Ys(e.path)??Ys(e.file)??Ys(e.name)??Ys(i==null?void 0:i.path)??Ys(i==null?void 0:i.file)??"",search:e.search??(i==null?void 0:i.search),replace:e.replace??(i==null?void 0:i.replace),content:e.content??(i==null?void 0:i.content)}):a==="web"||a.startsWith("web.")||a.startsWith("browser.")?H_(o,{url:Ys(e.url)??Ys(i==null?void 0:i.url)??Ys(i==null?void 0:i.finalUrl)??"",query:Ys(e.query)??Ys(e.name)??Ys(i==null?void 0:i.query)??"",content:e.content??(i==null?void 0:i.content)}):o}function fit(e,r){const n=Ys(e.message)??Ys(e.output)??Ys(e.content)??Ys(e.text)??Ys(e.summary);if(n)return n;const i=Vv(e.data),s=Ys(i==null?void 0:i.message)??Ys(i==null?void 0:i.output)??Ys(i==null?void 0:i.content)??Ys(i==null?void 0:i.text)??Ys(i==null?void 0:i.summary);return s||r}function pit(e){const r=[];let n=null,i=[];const s=new Map;let a=[];function o(){a.length>0&&(i.push({type:"toolGroup",callIds:[...a]}),a=[])}function l(){n&&(o(),i.length>0&&(n.segments=[...i]),r.push(n),n=null,i=[])}function d(u){return(!n||n.role!=="assistant")&&(l(),n={id:u,role:"assistant",content:"",toolCalls:[]},i=[]),n}for(const u of e){const h=u.payload??{};switch(u.kind){case"message":{const f=h.role,g=typeof h.content=="string"?h.content:u.summary,v=Array.isArray(h.referencedFiles)?h.referencedFiles.flatMap(_=>{if(!_||typeof _!="object")return[];const S=typeof _.path=="string"?_.path:null,w=typeof _.name=="string"?_.name:null;return S&&w?[{path:S,name:w}]:[]}):void 0,b=pj(h.displaySegments);if(f==="user")l(),r.push({id:u.id,role:"user",content:g,displayContent:b.length>0?J0(b):g,referencedFiles:v,displaySegments:b.length>0?b:void 0});else{const _=d(u.id);o();const S=g??"";S&&(_.content+=(_.content?`
1228
1228
  `:"")+S,i.push({type:"text",content:S}))}break}case"tool.start":{const f=d(u.id),g=h.callId??u.id,v=h.tool??"unknown";if(s.has(g))break;const b={callId:g,parentCallId:h.parentCallId,tool:v,args:nu(v,y8(h,v)),status:"running",startedAt:new Date(u.createdAt).getTime()};f.toolCalls=f.toolCalls??[],f.toolCalls.push(b),s.set(g,b),a.push(g);break}case"tool.output":{const f=h.callId;if(f&&s.has(f)){const g=s.get(f);g.streamingOutput=(g.streamingOutput??"")+(h.content??"")}break}case"tool.result":case"tool.error":{const f=h.callId,g=h.tool??"unknown",v=typeof h.ok=="boolean"?h.ok:u.kind==="tool.result",b=fit(h,u.summary),_=h.data!==void 0?h.data:Tce(h.message);let S=f?s.get(f):void 0;if(!S){const w=d(u.id),C=f??u.id;S={callId:C,parentCallId:h.parentCallId,tool:g,args:nu(g,y8(h,g),Vv(_)??void 0),status:v?"success":"error",startedAt:new Date(u.createdAt).getTime()},w.toolCalls=w.toolCalls??[],w.toolCalls.push(S),s.set(C,S),a.push(C)}S.args=nu(S.tool,H_(S.args,y8(h,g)),Vv(_)??void 0),S.parentCallId=S.parentCallId??h.parentCallId,S.status=v?"success":"error",S.result={ok:v,message:b,..._!==void 0?{data:_}:{}},S.completedAt=new Date(u.createdAt).getTime();break}case"tool.approval":{const f=d(u.id),g=h.requestId??u.id,v={callId:g,parentCallId:h.parentCallId,tool:h.tool??"unknown",args:nu(String(h.tool??"unknown"),h.args??{}),status:"pending",startedAt:new Date(u.createdAt).getTime()};f.toolCalls=f.toolCalls??[],f.toolCalls.push(v),s.set(g,v),a.push(g);break}case"skill.active":{const f=d(u.id),g=Array.isArray(h.names)?h.names.join(", "):"unknown",v=Array.isArray(h.skills)?h.skills:[],b=u.id,_={callId:b,parentCallId:h.parentCallId,tool:"skill",args:{skills:v.map(S=>S.name).join(", ")},status:"success",startedAt:new Date(u.createdAt).getTime(),completedAt:new Date(u.createdAt).getTime(),result:{ok:!0,message:`Using skills: ${g}`}};f.toolCalls=f.toolCalls??[],f.toolCalls.push(_),s.set(b,_),a.push(b);break}case"context_flow":{const f=E7(h),g=n;if(g&&g.role==="assistant")g.contextFlow=f;else for(let v=r.length-1;v>=0;v--){const b=r[v];if(b&&b.role==="assistant"){b.contextFlow=f;break}}break}case"session":{l();break}case"error":{const f=d(u.id);o();const g=`**Error:** ${u.summary}`;f.content+=(f.content?`
1229
1229
  `:"")+g,i.push({type:"text",content:g});break}case"thinking":{const f=typeof h.content=="string"?h.content:typeof h.text=="string"?h.text:typeof h.message=="string"?h.message:u.summary;if(f){const g=d(u.id);o(),g.thinking=(g.thinking??"")+f;const v=i[i.length-1];(v==null?void 0:v.type)==="thinking"?v.content+=f:i.push({type:"thinking",content:f})}break}default:{const g=(typeof h.content=="string"?h.content:typeof h.text=="string"?h.text:typeof h.message=="string"?h.message:null)??(u.kind==="activity"?u.summary:null);if(h.role==="user"&&g)l(),r.push({id:u.id,role:"user",content:g});else if(g){const b=d(u.id);o(),b.content+=(b.content?`
1230
- `:"")+g,i.push({type:"text",content:g})}break}}}return l(),r}const mU=qn(),gU={core:{variant:"default",label:"core"},standard:{variant:"secondary",label:"standard"},external:{variant:"warning",label:"external"}},yU=["meta","terminal","filesystem","os","agent","browser","web","surfaces","scheduler","memory","voice","screen","gateway","external"];function mit({token:e}){const[r,n]=y.useState([]),[i,s]=y.useState(!0),[a,o]=y.useState(!1),[l,d]=y.useState(null),[u,h]=y.useState("");y.useEffect(()=>{if(!e)return;let S=!1;return(async()=>{try{const w=await fetch(`${mU}/auth/settings/tools`,{headers:{Authorization:`Bearer ${e}`}});if(!S)if(w.ok){const C=await w.json();n(C.tools)}else d(`Failed to load tools (${w.status})`)}catch{S||d("Failed to load tools")}finally{S||s(!1)}})(),()=>{S=!0}},[e]);const f=y.useCallback(async(S,w)=>{if(e){n(C=>C.map(j=>j.name===S?{...j,enabled:w}:j)),o(!0),d(null);try{const C=r.map(E=>E.name===S?{...E,enabled:w}:E).filter(E=>!E.enabled&&!E.locked).map(E=>E.name);if(!(await fetch(`${mU}/auth/settings/tools`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({disabled_tools:C})})).ok)throw new Error("Failed to save")}catch{n(C=>C.map(j=>j.name===S?{...j,enabled:!w}:j)),d("Failed to update tool setting")}finally{o(!1)}}},[e,r]),g=new Map,v=u.trim().toLowerCase();for(const S of r){if(v&&!`${S.name} ${S.description} ${S.category}`.toLowerCase().includes(v))continue;const w=S.category;g.has(w)||g.set(w,[]),g.get(w).push(S)}const b=[...g.keys()].sort((S,w)=>{const C=yU.indexOf(S),j=yU.indexOf(w);return(C===-1?999:C)-(j===-1?999:j)}),_={total:r.length,enabled:r.filter(S=>S.enabled).length,core:r.filter(S=>S.tier==="core").length,standard:r.filter(S=>S.tier==="standard").length,external:r.filter(S=>S.tier==="external").length};return i?c.jsx(tn,{className:"p-5",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading tools..."})}):c.jsxs(tn,{className:"p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:"Tools"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage which tools are available to the AI agent. Core tools are always enabled. Standard tools can be toggled. External (MCP) tools are discovered on demand."})]}),c.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(H4,{className:"h-3.5 w-3.5"}),_.core," core"]}),c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(wR,{className:"h-3.5 w-3.5"}),_.standard," standard"]}),c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(M2,{className:"h-3.5 w-3.5"}),_.external," external"]}),c.jsxs("span",{className:"ml-auto",children:[_.enabled,"/",_.total," enabled"]})]}),c.jsxs("div",{className:"relative",children:[c.jsx(rl,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),c.jsx(Ln,{placeholder:"Filter tools...",value:u,onChange:S=>h(S.target.value),className:"pl-9"})]}),l&&c.jsx("p",{className:"text-sm text-destructive",children:l}),c.jsxs("div",{className:"space-y-5",children:[b.map(S=>{const w=g.get(S);return c.jsxs("div",{children:[c.jsx("h3",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wide mb-2",children:S}),c.jsx("div",{className:"space-y-1",children:w.map(C=>{const j=gU[C.tier]??gU.standard;return c.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded-md hover:bg-muted/50 transition-colors",children:[c.jsx(gf,{checked:C.enabled,onCheckedChange:E=>{f(C.name,E)},disabled:C.locked||a,"aria-label":`Toggle ${C.name}`}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-mono text-sm font-medium",children:C.name}),c.jsx(Or,{variant:j.variant,className:"text-2xs px-1.5 py-0",children:j.label}),C.source==="mcp"&&c.jsx(Or,{variant:"outline",className:"text-2xs px-1.5 py-0",children:"MCP"})]}),c.jsx("p",{className:"text-xs text-muted-foreground truncate",children:C.description})]})]},C.name)})})]},S)}),b.length===0&&c.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:v?"No tools match your filter.":"No tools available."})]})]})}const W_=qn(),git={installed:{variant:"secondary",label:"installed"},enabled:{variant:"default",label:"enabled"},disabled:{variant:"outline",label:"disabled"},error:{variant:"destructive",label:"error"}};function Ece(e){return y.useCallback(()=>{const r={};return e&&(r.Authorization=`Bearer ${e}`),r},[e])}function yit({token:e}){const[r,n]=y.useState([]),[i,s]=y.useState(!0),[a,o]=y.useState(null),[l,d]=y.useState(""),[u,h]=y.useState(null),f=Ece(e),g=y.useCallback(async()=>{s(!0),o(null);try{const C=await fetch(`${W_}/api/plugins`,{headers:f()});if(!C.ok)throw new Error(`Failed to load extensions (HTTP ${C.status})`);const j=await C.json();n(j)}catch(C){o(C instanceof Error?C.message:"Failed to load extensions")}finally{s(!1)}},[f]);y.useEffect(()=>{g()},[g]);const v=y.useCallback(async(C,j)=>{h(C);try{const E=j?"enable":"disable",A=await fetch(`${W_}/api/plugins/${encodeURIComponent(C)}/${E}`,{method:"POST",headers:f()});if(!A.ok){const N=await A.json().catch(()=>({}));throw new Error(N.error??`Failed to ${E} (HTTP ${A.status})`)}await g()}catch(E){o(E instanceof Error?E.message:"Action failed")}finally{h(null)}},[f,g]),b=y.useCallback(async C=>{h(C);try{const j=await fetch(`${W_}/api/plugins/${encodeURIComponent(C)}`,{method:"DELETE",headers:f()});if(!j.ok){const E=await j.json().catch(()=>({}));throw new Error(E.error??`Failed to uninstall (HTTP ${j.status})`)}await g()}catch(j){o(j instanceof Error?j.message:"Action failed")}finally{h(null)}},[f,g]),_=y.useCallback(async()=>{s(!0);try{const C=await fetch(`${W_}/api/plugins/scan`,{method:"POST",headers:f()});if(!C.ok)throw new Error(`Scan failed (HTTP ${C.status})`);const j=await C.json();n(j)}catch(C){o(C instanceof Error?C.message:"Scan failed")}finally{s(!1)}},[f]),S=l.toLowerCase(),w=r.filter(C=>S?C.id.toLowerCase().includes(S)||C.displayName.toLowerCase().includes(S)||(C.description??"").toLowerCase().includes(S)||(C.author??"").toLowerCase().includes(S):!0);return i&&r.length===0?c.jsx(tn,{className:"p-5",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading extensions..."})}):c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsx(rl,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),c.jsx(Ln,{value:l,onChange:C=>d(C.target.value),placeholder:"Filter extensions...",className:"pl-9"})]}),c.jsxs(we,{variant:"outline",size:"sm",onClick:()=>void _(),disabled:i,children:[c.jsx(Js,{className:`mr-1.5 h-3.5 w-3.5 ${i?"animate-spin":""}`}),"Scan"]})]}),a&&c.jsxs(tn,{className:"flex items-start gap-2 border-destructive/50 bg-destructive/5 p-4",children:[c.jsx(na,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),c.jsx("p",{className:"text-sm text-destructive",children:a})]}),w.length===0&&!i&&c.jsxs(tn,{className:"p-8 text-center",children:[c.jsx(M2,{className:"mx-auto h-8 w-8 text-muted-foreground/40"}),c.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:r.length===0?"No extensions installed. Drop plugin folders into ~/.jait/extensions/ and click Scan.":"No extensions match your filter."})]}),w.map(C=>{const j=git[C.status],E=C.status==="enabled",A=u===C.id;return c.jsxs(tn,{className:"flex items-start gap-4 p-4",children:[c.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:c.jsx(M2,{className:"h-5 w-5 text-muted-foreground"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium",children:C.displayName}),c.jsx(Or,{variant:j.variant,className:"text-2xs",children:j.label}),c.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",C.version]})]}),C.description&&c.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground line-clamp-2",children:C.description}),C.author&&c.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["by ",C.author]}),C.error&&c.jsx("p",{className:"mt-1 text-xs text-destructive",children:C.error}),c.jsx("p",{className:"mt-0.5 text-2xs text-muted-foreground/60 font-mono",children:C.id})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[c.jsx(gf,{checked:E,disabled:A,onCheckedChange:N=>void v(C.id,N),"aria-label":E?"Disable":"Enable"}),c.jsx(we,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",disabled:A,onClick:()=>void b(C.id),title:"Uninstall",children:c.jsx(Rl,{className:"h-4 w-4"})})]})]},C.id)})]})}function vit({token:e}){const[r,n]=y.useState([]),[i,s]=y.useState(!0),[a,o]=y.useState(null),l=Ece(e),d=y.useCallback(async()=>{s(!0),o(null);try{const u=await fetch(`${W_}/api/store/packages?limit=50`,{headers:l()});if(!u.ok)throw new Error(`Failed to browse ClawHub (HTTP ${u.status})`);const h=await u.json();n(h.items??[])}catch(u){o(u instanceof Error?u.message:"Failed to load marketplace")}finally{s(!1)}},[l]);return y.useEffect(()=>{d()},[d]),c.jsxs("div",{className:"space-y-4",children:[c.jsxs(tn,{className:"bg-muted/30 p-4 text-sm text-muted-foreground",children:["Browse OpenClaw plugins on"," ",c.jsx("a",{href:"https://clawhub.ai/plugins",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground",children:"ClawHub"}),". To install, download the plugin and place it in"," ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"~/.jait/extensions/"}),", then click Scan on the Installed tab."]}),a&&c.jsxs(tn,{className:"flex items-start gap-2 border-destructive/50 bg-destructive/5 p-4",children:[c.jsx(na,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),c.jsx("p",{className:"text-sm text-destructive",children:a})]}),i&&r.length===0&&c.jsxs(tn,{className:"flex items-center justify-center gap-2 p-8",children:[c.jsx(Ft,{className:"h-5 w-5 animate-spin text-muted-foreground"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading from ClawHub..."})]}),!i&&r.length===0&&c.jsxs(tn,{className:"p-8 text-center",children:[c.jsx(M2,{className:"mx-auto h-8 w-8 text-muted-foreground/40"}),c.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"No packages available."})]}),r.map((u,h)=>{const f=u.displayName??u.name??"Unknown",g=u.description??"",v=u.type??"plugin";return c.jsxs(tn,{className:"flex items-start gap-3 p-4",children:[c.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted",children:c.jsx(M2,{className:"h-4 w-4 text-muted-foreground"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium",children:f}),u.version&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",u.version]}),c.jsx(Or,{variant:"outline",className:"text-2xs",children:v})]}),c.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground line-clamp-2",children:g}),u.author&&c.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["by @",u.author]})]}),c.jsx("a",{href:`https://clawhub.ai/plugins/${encodeURIComponent(u.name??"")}`,target:"_blank",rel:"noopener noreferrer",children:c.jsxs(we,{variant:"outline",size:"sm",className:"h-7 text-xs",children:[c.jsx(jp,{className:"mr-1 h-3 w-3"}),"View"]})})]},u.name??h)})]})}function xit({token:e}){return c.jsxs(Y0,{defaultValue:"installed",className:"space-y-4",children:[c.jsxs(tn,{className:"space-y-3 p-5",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:"Extensions"}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:["Manage plugins and extensions. Browse the"," ",c.jsx("a",{href:"https://clawhub.ai/plugins",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground",children:"ClawHub"})," ","marketplace or drop plugins into"," ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"~/.jait/extensions/"}),"."]})]}),c.jsxs(ag,{children:[c.jsx(Qs,{value:"installed",children:"Installed"}),c.jsx(Qs,{value:"marketplace",children:"Marketplace"})]})]}),c.jsx(ea,{value:"installed",className:"mt-0 space-y-4",children:c.jsx(yit,{token:e})}),c.jsx(ea,{value:"marketplace",className:"mt-0 space-y-4",children:c.jsx(vit,{token:e})})]})}const w2=qn();function vU(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}const xU={bundled:{variant:"default",label:"bundled"},user:{variant:"secondary",label:"user"},project:{variant:"outline",label:"project"},plugin:{variant:"secondary",label:"plugin"}};function Ace(e){return y.useCallback(()=>{const r={"Content-Type":"application/json"};return e&&(r.Authorization=`Bearer ${e}`),r},[e])}function bit({token:e}){const[r,n]=y.useState([]),[i,s]=y.useState(!0),[a,o]=y.useState(null),[l,d]=y.useState(""),[u,h]=y.useState(null),[f,g]=y.useState(null),v=Ace(e),b=y.useCallback(async()=>{s(!0),o(null);try{const j=await fetch(`${w2}/api/skills`,{headers:v()});if(!j.ok)throw new Error(`Failed to load skills (HTTP ${j.status})`);const E=await j.json();n(E)}catch(j){o(j instanceof Error?j.message:"Failed to load skills")}finally{s(!1)}},[v]);y.useEffect(()=>{b()},[b]);const _=y.useCallback(async(j,E)=>{h(j);try{const A=await fetch(`${w2}/api/skills/${encodeURIComponent(j)}`,{method:"PATCH",headers:v(),body:JSON.stringify({enabled:E})});if(!A.ok)throw new Error(`Failed to update skill (HTTP ${A.status})`);n(N=>N.map(R=>R.id===j?{...R,enabled:E}:R))}catch(A){o(A instanceof Error?A.message:"Action failed")}finally{h(null)}},[v]),S=y.useCallback(async j=>{g(j),o(null);try{const E=await fetch(`${w2}/api/skills/${encodeURIComponent(j)}/install-tool`,{method:"POST",headers:v(),body:JSON.stringify({})}),A=await E.json().catch(()=>({}));if(!E.ok)throw new Error(A.error??`Install failed (HTTP ${E.status})`);const N=A.skill;N?n(R=>R.map(B=>B.id===j?N:B)):await b()}catch(E){o(E instanceof Error?E.message:"Install failed")}finally{g(null)}},[v,b]),w=l.toLowerCase(),C=r.filter(j=>w?j.id.toLowerCase().includes(w)||j.name.toLowerCase().includes(w)||j.description.toLowerCase().includes(w)||j.source.includes(w):!0);return i&&r.length===0?c.jsx(tn,{className:"p-5",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading skills..."})}):c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"relative",children:[c.jsx(rl,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),c.jsx(Ln,{value:l,onChange:j=>d(j.target.value),placeholder:"Filter installed skills...",className:"pl-9"})]}),a&&c.jsxs(tn,{className:"flex items-start gap-2 border-destructive/50 bg-destructive/5 p-4",children:[c.jsx(na,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),c.jsx("p",{className:"text-sm text-destructive",children:a})]}),C.length===0&&!i&&c.jsxs(tn,{className:"p-8 text-center",children:[c.jsx(H5,{className:"mx-auto h-8 w-8 text-muted-foreground/40"}),c.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:r.length===0?"No skills discovered. Install from the Marketplace or create a SKILL.md in ~/.jait/skills/.":"No skills match your filter."})]}),C.map(j=>{var N;const E=xU[j.source]??xU.user,A=u===j.id;return c.jsxs(tn,{className:"flex items-start gap-3 p-4",children:[c.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted",children:c.jsx(H5,{className:"h-4 w-4 text-muted-foreground"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium",children:j.name}),c.jsx(Or,{variant:E.variant,className:"text-2xs",children:E.label})]}),c.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground line-clamp-2",children:j.description}),c.jsx("p",{className:"mt-0.5 text-2xs text-muted-foreground/60 font-mono truncate",children:j.filePath}),j.missingTools&&j.missingTools.length>0&&c.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[c.jsxs("span",{className:"flex items-center gap-1 text-2xs text-amber-600 dark:text-amber-500",children:[c.jsx(na,{className:"h-3 w-3"}),"Needs: ",j.missingTools.join(", ")]}),j.install&&j.install.length>0&&c.jsxs(we,{size:"sm",variant:"outline",disabled:f===j.id,onClick:()=>void S(j.id),className:"h-6 text-2xs",children:[f===j.id?c.jsx(Ft,{className:"mr-1 h-3 w-3 animate-spin"}):c.jsx(gp,{className:"mr-1 h-3 w-3"}),((N=j.install[0])==null?void 0:N.label)??"Install tool"]})]})]}),c.jsx(gf,{checked:j.enabled,disabled:A,onCheckedChange:R=>void _(j.id,R),"aria-label":j.enabled?"Disable":"Enable",className:"shrink-0"})]},j.id)})]})}function _it({token:e}){const[r,n]=y.useState([]),[i,s]=y.useState(!0),[a,o]=y.useState(null),[l,d]=y.useState(""),[u,h]=y.useState("tool workflow agent"),[f,g]=y.useState(null),v=y.useRef(null),b=Ace(e),_=y.useCallback(async(C,j)=>{s(!0),o(null);try{const E=new URLSearchParams;C?E.set("q",C):E.set("sort",j??"tool workflow agent"),E.set("limit","25");const A=await fetch(`${w2}/api/store/skills?${E}`,{headers:b()});if(!A.ok)throw new Error(`Failed to browse ClawHub (HTTP ${A.status})`);const N=await A.json();n(N.results??[])}catch(E){o(E instanceof Error?E.message:"Failed to load marketplace")}finally{s(!1)}},[b]);y.useEffect(()=>{_(void 0,u)},[_,u]);const S=y.useCallback(C=>{d(C),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{_(C||void 0,u)},400)},[_,u]),w=y.useCallback(async C=>{g(C),o(null);try{const j=await fetch(`${w2}/api/store/skills/${encodeURIComponent(C)}/install`,{method:"POST",headers:b(),body:JSON.stringify({})});if(!j.ok){const E=await j.json().catch(()=>({}));throw new Error(E.error??`Install failed (HTTP ${j.status})`)}n(E=>E.map(A=>A.slug===C?{...A,installed:!0}:A))}catch(j){o(j instanceof Error?j.message:"Install failed")}finally{g(null)}},[b]);return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsx(rl,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),c.jsx(Ln,{value:l,onChange:C=>S(C.target.value),placeholder:"Search ClawHub skills...",className:"pl-9"})]}),c.jsxs("select",{value:u,onChange:C=>h(C.target.value),className:"h-9 rounded-md border bg-background px-3 text-sm",children:[c.jsx("option",{value:"tool workflow agent",children:"Popular"}),c.jsx("option",{value:"memory learning self-improving",children:"Memory"}),c.jsx("option",{value:"search web browser automation",children:"Search"}),c.jsx("option",{value:"git github code development",children:"Development"}),c.jsx("option",{value:"calendar slack obsidian productivity",children:"Productivity"})]})]}),a&&c.jsxs(tn,{className:"flex items-start gap-2 border-destructive/50 bg-destructive/5 p-4",children:[c.jsx(na,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),c.jsx("p",{className:"text-sm text-destructive",children:a})]}),i&&r.length===0&&c.jsxs(tn,{className:"flex items-center justify-center gap-2 p-8",children:[c.jsx(Ft,{className:"h-5 w-5 animate-spin text-muted-foreground"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading from ClawHub..."})]}),!i&&r.length===0&&c.jsxs(tn,{className:"p-8 text-center",children:[c.jsx(rl,{className:"mx-auto h-8 w-8 text-muted-foreground/40"}),c.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:l?"No skills match your search.":"No skills available."})]}),r.map(C=>{var z,W,I;const j=C.slug??"",E=C.displayName??j,A=C.summary??"",N=((z=C.latestVersion)==null?void 0:z.version)??C.version??"",R=((W=C.stats)==null?void 0:W.stars)??0,B=((I=C.stats)==null?void 0:I.downloads)??0,G=C.installed===!0,H=f===j;return c.jsxs(tn,{className:"flex items-start gap-3 p-4",children:[c.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted",children:c.jsx(H5,{className:"h-4 w-4 text-muted-foreground"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium",children:E}),N&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",N]})]}),c.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground line-clamp-2",children:A}),c.jsxs("div",{className:"mt-1 flex items-center gap-3 text-xs text-muted-foreground",children:[R>0&&c.jsxs("span",{className:"flex items-center gap-0.5",children:[c.jsx(kve,{className:"h-3 w-3"}),vU(R)]}),B>0&&c.jsxs("span",{className:"flex items-center gap-0.5",children:[c.jsx(gp,{className:"h-3 w-3"}),vU(B)]}),c.jsxs("a",{href:`https://clawhub.ai/skills?focus=search&q=${encodeURIComponent(j)}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-0.5 hover:text-foreground",children:[c.jsx(jp,{className:"h-3 w-3"}),"ClawHub"]})]})]}),c.jsx("div",{className:"shrink-0",children:G?c.jsxs(Or,{variant:"secondary",className:"flex items-center gap-1 text-2xs",children:[c.jsx(ms,{className:"h-3 w-3"}),"Installed"]}):c.jsxs(we,{size:"sm",variant:"outline",disabled:H,onClick:()=>void w(j),className:"h-7 text-xs",children:[H?c.jsx(Ft,{className:"mr-1 h-3 w-3 animate-spin"}):c.jsx(gp,{className:"mr-1 h-3 w-3"}),"Install"]})})]},j)})]})}function wit({token:e}){return c.jsxs(Y0,{defaultValue:"installed",className:"space-y-4",children:[c.jsxs(tn,{className:"space-y-3 p-5",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:"Skills"}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:["Specialized instruction sets that teach the AI how to use specific tools and workflows. Install from"," ",c.jsx("a",{href:"https://clawhub.ai/skills",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground",children:"ClawHub"})," ","or place SKILL.md files in"," ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"~/.jait/skills/"}),"."]})]}),c.jsxs(ag,{children:[c.jsx(Qs,{value:"installed",children:"Installed"}),c.jsx(Qs,{value:"marketplace",children:"Marketplace"})]})]}),c.jsx(ea,{value:"installed",className:"mt-0 space-y-4",children:c.jsx(bit,{token:e})}),c.jsx(ea,{value:"marketplace",className:"mt-0 space-y-4",children:c.jsx(_it,{token:e})})]})}const U_=qn();function V_(e){return e?{Authorization:`Bearer ${e}`}:{}}const Sit={stopped:{label:"Disconnected",variant:"outline"},connecting:{label:"Connecting…",variant:"secondary"},qr:{label:"Scan QR to link",variant:"secondary"},connected:{label:"Connected",variant:"default"},error:{label:"Error",variant:"destructive"}};function kit(e){return e.id==="whatsapp"?"Link your WhatsApp so the assistant can reply to messages. Scan the QR with WhatsApp Linked devices.":e.id==="msteams"?"Connect a Microsoft Teams bot so the assistant can reply to Teams conversations.":"Connect this messaging channel so the assistant can reply through it."}function Cit({token:e,channel:r,onChanged:n}){const[i,s]=y.useState(!1),[a,o]=y.useState(null),[l,d]=y.useState(r.qr),[u,h]=y.useState(r.status),[f,g]=y.useState(),[v,b]=y.useState((r.config.allowedSenders??[]).join(", ")),[_,S]=y.useState(!!r.config.respondToAll),w=y.useRef(null),C=y.useCallback(()=>{w.current&&(clearInterval(w.current),w.current=null)},[]);y.useEffect(()=>{if(u!=="qr"&&u!=="connecting"){C();return}if(!w.current)return w.current=setInterval(async()=>{try{const B=await fetch(`${U_}/api/channels/${r.id}/status`,{headers:V_(e)});if(!B.ok)return;const G=await B.json();h(G.status),d(G.qr),g(G.error),G.status==="connected"&&(C(),n()),G.status==="error"&&C()}catch{}},2e3),C},[u,r.id,e,C,n]),y.useEffect(()=>()=>C(),[C]);const j=y.useCallback(async()=>{s(!0),o(null);try{const B=await fetch(`${U_}/api/channels/${r.id}/start`,{method:"POST",headers:V_(e)}),G=await B.json().catch(()=>({}));if(!B.ok)throw new Error(G.error??`Failed to start (HTTP ${B.status})`);h(G.status??"connecting"),d(G.qr??null)}catch(B){o(B instanceof Error?B.message:"Failed to start")}finally{s(!1)}},[r.id,e]),E=y.useCallback(async()=>{s(!0),o(null);try{const B=await fetch(`${U_}/api/channels/${r.id}/stop`,{method:"POST",headers:V_(e)});if(!B.ok)throw new Error(`Failed to stop (HTTP ${B.status})`);h("stopped"),d(null),C()}catch(B){o(B instanceof Error?B.message:"Failed to stop")}finally{s(!1)}},[r.id,e,C]),A=y.useCallback(async()=>{s(!0),o(null);try{const B=v.split(",").map(H=>H.trim()).filter(Boolean),G=await fetch(`${U_}/api/channels/${r.id}/config`,{method:"PATCH",headers:{...V_(e),"Content-Type":"application/json"},body:JSON.stringify({allowedSenders:B,respondToAll:_})});if(!G.ok)throw new Error(`Failed to save (HTTP ${G.status})`)}catch(B){o(B instanceof Error?B.message:"Failed to save")}finally{s(!1)}},[v,_,r.id,e]),N=Sit[u],R=u==="qr";return c.jsxs(tn,{className:"space-y-4 p-5",children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",children:c.jsx(w1e,{className:"h-5 w-5"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium",children:r.label}),c.jsx(Or,{variant:N.variant,className:"text-2xs",children:N.label})]}),c.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground",children:kit(r)})]}),c.jsx("div",{className:"shrink-0",children:u==="connected"?c.jsxs(we,{size:"sm",variant:"outline",disabled:i,onClick:()=>void E(),className:"h-8 text-xs",children:[i?c.jsx(Ft,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):c.jsx(Z1e,{className:"mr-1 h-3.5 w-3.5"}),"Disconnect"]}):c.jsxs(we,{size:"sm",disabled:i,onClick:()=>void j(),className:"h-8 text-xs",children:[i?c.jsx(Ft,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):c.jsx(kY,{className:"mr-1 h-3.5 w-3.5"}),u==="qr"||u==="connecting"?"Restart":"Connect"]})})]}),(a||f)&&c.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-destructive/50 bg-destructive/5 p-3 text-sm text-destructive",children:[c.jsx(na,{className:"mt-0.5 h-4 w-4 shrink-0"}),c.jsx("span",{children:a??f})]}),R&&c.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border bg-muted/30 p-5",children:[l?c.jsx("img",{src:l,alt:`${r.label} link QR code`,className:"h-56 w-56 rounded bg-white p-2"}):c.jsx("div",{className:"flex h-56 w-56 items-center justify-center",children:c.jsx(Ft,{className:"h-6 w-6 animate-spin text-muted-foreground"})}),c.jsxs("p",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[c.jsx(Js,{className:"h-3 w-3"})," QR refreshes automatically — scan it with your phone."]})]}),u==="connected"&&c.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-emerald-500/40 bg-emerald-500/5 p-3 text-sm text-emerald-700 dark:text-emerald-400",children:[c.jsx(ia,{className:"h-4 w-4"})," Linked. The assistant will reply based on the rules below."]}),c.jsxs("div",{className:"space-y-3 border-t pt-4",children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-medium",children:"Respond to everyone"}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"When off, replies only to your self-chat and the allowed numbers below."})]}),c.jsx(gf,{checked:_,onCheckedChange:S})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium",children:"Allowed senders"}),c.jsx(Ln,{value:v,onChange:B=>b(B.target.value),placeholder:"e.g. +49170…, +1202… (comma-separated, blank = self-chat only)"})]}),c.jsx(we,{size:"sm",variant:"outline",disabled:i,onClick:()=>void A(),className:"h-8 text-xs",children:"Save rules"})]})]})}function jit({token:e}){const[r,n]=y.useState([]),[i,s]=y.useState(!0),[a,o]=y.useState(null),l=y.useCallback(async()=>{s(!0),o(null);try{const d=await fetch(`${U_}/api/channels`,{headers:V_(e)});if(!d.ok)throw new Error(`Failed to load channels (HTTP ${d.status})`);n(await d.json())}catch(d){o(d instanceof Error?d.message:"Failed to load channels")}finally{s(!1)}},[e]);return y.useEffect(()=>{l()},[l]),c.jsxs("div",{className:"space-y-4",children:[c.jsxs(tn,{className:"space-y-1 p-5",children:[c.jsx("h2",{className:"text-base font-medium",children:"Channels"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect external messaging apps so your assistant can chat through them."})]}),a&&c.jsxs(tn,{className:"flex items-start gap-2 border-destructive/50 bg-destructive/5 p-4",children:[c.jsx(na,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),c.jsx("p",{className:"text-sm text-destructive",children:a})]}),i&&r.length===0?c.jsx(tn,{className:"p-5",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading channels…"})}):r.length===0?c.jsx(tn,{className:"p-5",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"No channel extensions are enabled. Enable one in Extensions, then connect it here."})}):r.map(d=>c.jsx(Cit,{token:e,channel:d,onChanged:l},d.id))]})}function Nit({events:e}){return c.jsx(Jc,{className:"h-full w-full",children:c.jsx("div",{className:"p-4 space-y-2",children:e.length===0?c.jsx("p",{className:"text-sm text-muted-foreground",children:"No activity yet."}):e.map(r=>c.jsxs("div",{className:"rounded-md border p-3",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("p",{className:"text-sm font-medium",children:r.title}),c.jsx("span",{className:"text-xs text-muted-foreground",children:r.source})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:r.detail})]},r.id))})})}function s_(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function Tit(e,r){const n=r.trim();if(!n)return s_(e);const i=e.toLowerCase(),s=n.toLowerCase();let a=0,o=i.indexOf(s);if(o===-1)return s_(e);let l="";for(;o!==-1;){o>a&&(l+=s_(e.slice(a,o)));const d=o+n.length;l+=`<mark class="rounded bg-yellow-200/80 px-0.5 text-inherit dark:bg-yellow-500/30">${s_(e.slice(o,d))}</mark>`,a=d,o=i.indexOf(s,a)}return a<e.length&&(l+=s_(e.slice(a))),l}var gx="Perplexity",Eit=.75,Ait=.2,Oce="#22B8CD",Oit=Oce,Mit="#000",Rit=.75;function aS(e){"@babel/helpers - typeof";return aS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},aS(e)}var Pit=["size","style"];function bU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function v8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?bU(Object(n),!0).forEach(function(i){Lit(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Lit(e,r,n){return r=$it(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function $it(e){var r=Dit(e,"string");return aS(r)=="symbol"?r:String(r)}function Dit(e,r){if(aS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(aS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Iit(e,r){if(e==null)return{};var n=Bit(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function Bit(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var iL=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=Iit(e,Pit);return c.jsxs("svg",v8(v8({fill:"currentColor",fillRule:"evenodd",height:n,style:v8({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:gx}),c.jsx("path",{d:"M19.785 0v7.272H22.5V17.62h-2.935V24l-7.037-6.194v6.145h-1.091v-6.152L4.392 24v-6.465H1.5V7.188h2.884V0l7.053 6.494V.19h1.09v6.49L19.786 0zm-7.257 9.044v7.319l5.946 5.234V14.44l-5.946-5.397zm-1.099-.08l-5.946 5.398v7.235l5.946-5.234V8.965zm8.136 7.58h1.844V8.349H13.46l6.105 5.54v2.655zm-8.982-8.28H2.59v8.195h1.8v-2.576l6.192-5.62zM5.475 2.476v4.71h5.115l-5.115-4.71zm13.219 0l-5.115 4.71h5.115v-4.71z"})]}))});function oS(e){"@babel/helpers - typeof";return oS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},oS(e)}function _U(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function zit(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?_U(Object(n),!0).forEach(function(i){Fit(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_U(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Fit(e,r,n){return r=Hit(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Hit(e){var r=Wit(e,"string");return oS(r)=="symbol"?r:String(r)}function Wit(e,r){if(oS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(oS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Uit(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var Vit=y.memo(function(e){var r=Object.assign({},(Uit(e),e));return c.jsx(_c,zit({Icon:iL,"aria-label":gx,background:Oit,color:Mit,iconMultiple:Rit},r))});function lS(e){"@babel/helpers - typeof";return lS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},lS(e)}var qit=["size","style"];function wU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function x8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?wU(Object(n),!0).forEach(function(i){Git(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Git(e,r,n){return r=Kit(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Kit(e){var r=Yit(e,"string");return lS(r)=="symbol"?r:String(r)}function Yit(e,r){if(lS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(lS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Xit(e,r){if(e==null)return{};var n=Jit(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function Jit(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Mce=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=Xit(e,qit);return c.jsxs("svg",x8(x8({height:n,style:x8({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:gx}),c.jsx("path",{d:"M19.785 0v7.272H22.5V17.62h-2.935V24l-7.037-6.194v6.145h-1.091v-6.152L4.392 24v-6.465H1.5V7.188h2.884V0l7.053 6.494V.19h1.09v6.49L19.786 0zm-7.257 9.044v7.319l5.946 5.234V14.44l-5.946-5.397zm-1.099-.08l-5.946 5.398v7.235l5.946-5.234V8.965zm8.136 7.58h1.844V8.349H13.46l6.105 5.54v2.655zm-8.982-8.28H2.59v8.195h1.8v-2.576l6.192-5.62zM5.475 2.476v4.71h5.115l-5.115-4.71zm13.219 0l-5.115 4.71h5.115v-4.71z",fill:"#22B8CD",fillRule:"nonzero"})]}))});function cS(e){"@babel/helpers - typeof";return cS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},cS(e)}var Zit=["size","style"];function SU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function b8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?SU(Object(n),!0).forEach(function(i){Qit(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):SU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Qit(e,r,n){return r=est(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function est(e){var r=tst(e,"string");return cS(r)=="symbol"?r:String(r)}function tst(e,r){if(cS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(cS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function rst(e,r){if(e==null)return{};var n=nst(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function nst(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Rce=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=rst(e,Zit);return c.jsxs("svg",b8(b8({fill:"currentColor",fillRule:"evenodd",height:n,style:b8({flex:"none",lineHeight:1},i),viewBox:"0 0 117 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:gx}),c.jsx("path",{d:"M38.542 5.218h1.151V7.59h-1.49c-1.167 0-2.036.281-2.612.843-.575.563-.863 1.485-.863 2.768v7.773h-2.351V5.271h2.351v2.187c0 .123.062.185.184.185.069 0 .121-.017.157-.053a.58.58 0 00.104-.211c.453-1.44 1.577-2.16 3.371-2.16h-.002zm15.36 2.938c.617 1.098.928 2.42.928 3.966 0 1.545-.309 2.867-.928 3.965-.62 1.098-1.42 1.92-2.404 2.464a6.446 6.446 0 01-3.174.817c-2.23 0-3.797-.896-4.703-2.688-.069-.14-.157-.211-.262-.211-.105 0-.157.052-.157.158v7.352h-2.351V5.271h2.351v2.345c0 .106.052.159.157.159.105 0 .191-.07.262-.211.906-1.793 2.473-2.689 4.703-2.689 1.132 0 2.19.272 3.174.817.984.545 1.785 1.366 2.404 2.464zm-1.424 3.966c0-1.617-.43-2.877-1.292-3.781-.862-.904-1.998-1.357-3.41-1.357-1.413 0-2.548.453-3.41 1.357-.863.905-1.179 2.166-1.179 3.78 0 1.616.316 2.878 1.178 3.782.863.905 2 1.356 3.41 1.356 1.411 0 2.549-.453 3.411-1.356.862-.904 1.292-2.166 1.292-3.781zM15.05 8.177c.618 1.098.928 2.42.928 3.965 0 1.546-.308 2.868-.928 3.966-.619 1.098-1.42 1.919-2.403 2.464a6.448 6.448 0 01-3.175.817c-2.23 0-3.797-.896-4.702-2.688-.07-.14-.158-.212-.262-.212-.105 0-.158.053-.158.159V24H2V5.292h2.351v2.345c0 .106.053.159.158.159.104 0 .19-.07.261-.212.906-1.792 2.473-2.688 4.703-2.688 1.132 0 2.19.272 3.175.817.983.545 1.784 1.366 2.403 2.464h-.002zm-1.423 3.965c0-1.616-.43-2.877-1.293-3.78-.862-.904-1.998-1.357-3.41-1.357-1.412 0-2.548.453-3.41 1.357-.862.905-1.178 2.165-1.178 3.78 0 1.615.316 2.878 1.178 3.781.862.906 1.998 1.357 3.41 1.357 1.412 0 2.548-.453 3.41-1.357.863-.903 1.293-2.166 1.293-3.78zm14.422 2.481h2.482c-.33 1.283-1.006 2.395-2.023 3.334-1.02.94-2.479 1.41-4.378 1.41-1.429 0-2.686-.295-3.775-.884a6.13 6.13 0 01-2.521-2.516c-.593-1.089-.889-2.372-.889-3.847 0-1.476.288-2.758.863-3.847.574-1.089 1.38-1.928 2.417-2.517 1.036-.588 2.25-.883 3.644-.883 1.393 0 2.547.29 3.514.87.968.58 1.69 1.349 2.168 2.305.48.959.719 2.008.719 3.15v1.58H19.427c.086 1.37.544 2.46 1.37 3.268.828.807 1.939 1.213 3.332 1.213 1.132 0 2-.232 2.6-.698.601-.466 1.04-1.111 1.32-1.938zm-8.595-3.82h8.204c0-1.194-.305-2.13-.914-2.807-.61-.676-1.568-1.015-2.874-1.015-1.22 0-2.217.33-2.99.988-.775.659-1.25 1.604-1.424 2.832l-.002.002zm37.238 8.17h2.352V0H56.69v18.974-.002zM89.316 3.774h2.747V.81h-2.747v2.966zm9.688 13.156c-.426.043-.684.066-.77.066a.39.39 0 01-.289-.106.395.395 0 01-.104-.29c0-.087.022-.348.065-.778.043-.43.066-1.094.066-1.988V7.279h3.354l-.66-2.008h-2.692v-3.69h-2.352v3.688h-2.557v2.008h2.557v7.214c0 1.512.367 2.636 1.098 3.374.732.737 1.846 1.107 3.345 1.107h1.83v-2.107h-.915c-.889 0-1.547.022-1.974.066h-.002zm13.759-11.662l-3.893 11.498c-.053.141-.135.326-.402.326-.268 0-.35-.185-.402-.326l-3.893-11.498h-2.398l4.508 13.703h1.594a.81.81 0 01.235.026c.053.017.096.06.131.133.07.105.06.264-.026.473l-.731 2.002c-.105.264-.305.396-.6.396-.106 0-.349-.023-.732-.066a13.71 13.71 0 00-1.49-.066h-1.907v2.107h2.508c1.463 0 2.344-.25 3.102-.75.757-.5 1.345-1.383 1.764-2.65L115 5.795v-.526h-2.237v.001zm-31.127 5.113L77.953 5.27h-2.588v.527l4.415 5.93-5.382 6.72v.526h2.64l4.285-5.507 3.998 5.507h2.535v-.526l-4.677-6.324 5.07-6.298v-.553h-2.64l-3.971 5.113-.002-.002zm7.931 8.59h2.351v-13.7h-2.35v13.702-.002zm-15.062-4.349c-.331 1.283-1.006 2.395-2.024 3.334-1.02.94-2.479 1.41-4.377 1.41-1.43 0-2.686-.295-3.775-.884a6.13 6.13 0 01-2.522-2.516c-.593-1.089-.888-2.372-.888-3.847 0-1.476.288-2.758.862-3.847.574-1.089 1.38-1.928 2.417-2.517 1.036-.588 2.25-.883 3.644-.883 1.394 0 2.547.29 3.515.87.967.58 1.689 1.349 2.168 2.305.479.959.718 2.008.718 3.15v1.58H63.401c.086 1.37.544 2.46 1.371 3.268.827.807 1.938 1.213 3.332 1.213 1.132 0 2-.232 2.6-.698.6-.466 1.04-1.111 1.319-1.938h2.482zm-11.078-3.82h8.205c0-1.194-.305-2.13-.915-2.807-.61-.676-1.568-1.015-2.873-1.015-1.22 0-2.217.33-2.991.988-.775.659-1.25 1.604-1.424 2.832l-.002.002z"})]}))});function uS(e){"@babel/helpers - typeof";return uS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},uS(e)}var ist=["type"];function kU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function sst(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?kU(Object(n),!0).forEach(function(i){ast(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function ast(e,r,n){return r=ost(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function ost(e){var r=lst(e,"string");return uS(r)=="symbol"?r:String(r)}function lst(e,r){if(uS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(uS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function cst(e,r){if(e==null)return{};var n=ust(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function ust(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var dst=y.memo(function(e){var r=e.type,n=r===void 0?"mono":r,i=cst(e,ist),s=n==="color"?Mce:iL;return c.jsx(wc,sst({Icon:s,Text:Rce,"aria-label":gx,spaceMultiple:Ait,textMultiple:Eit},i))}),Ey=iL;Ey.Color=Mce;Ey.Text=Rce;Ey.Combine=dst;Ey.Avatar=Vit;Ey.colorPrimary=Oce;Ey.title=gx;var kk="OpenRouter",hst=1,fst=.4,sL="#6566F1",pst=sL,mst="#fff",gst=.75;function dS(e){"@babel/helpers - typeof";return dS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},dS(e)}var yst=["size","style"];function CU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function _8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?CU(Object(n),!0).forEach(function(i){vst(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function vst(e,r,n){return r=xst(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function xst(e){var r=bst(e,"string");return dS(r)=="symbol"?r:String(r)}function bst(e,r){if(dS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(dS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function _st(e,r){if(e==null)return{};var n=wst(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function wst(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var aL=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=_st(e,yst);return c.jsxs("svg",_8(_8({fill:"currentColor",fillRule:"evenodd",height:n,style:_8({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:kk}),c.jsx("path",{d:"M16.804 1.957l7.22 4.105v.087L16.73 10.21l.017-2.117-.821-.03c-1.059-.028-1.611.002-2.268.11-1.064.175-2.038.577-3.147 1.352L8.345 11.03c-.284.195-.495.336-.68.455l-.515.322-.397.234.385.23.53.338c.476.314 1.17.796 2.701 1.866 1.11.775 2.083 1.177 3.147 1.352l.3.045c.694.091 1.375.094 2.825.033l.022-2.159 7.22 4.105v.087L16.589 22l.014-1.862-.635.022c-1.386.042-2.137.002-3.138-.162-1.694-.28-3.26-.926-4.881-2.059l-2.158-1.5a21.997 21.997 0 00-.755-.498l-.467-.28a55.927 55.927 0 00-.76-.43C2.908 14.73.563 14.116 0 14.116V9.888l.14.004c.564-.007 2.91-.622 3.809-1.124l1.016-.58.438-.274c.428-.28 1.072-.726 2.686-1.853 1.621-1.133 3.186-1.78 4.881-2.059 1.152-.19 1.974-.213 3.814-.138l.02-1.907z"})]}))});function hS(e){"@babel/helpers - typeof";return hS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},hS(e)}function jU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function Sst(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?jU(Object(n),!0).forEach(function(i){kst(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function kst(e,r,n){return r=Cst(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Cst(e){var r=jst(e,"string");return hS(r)=="symbol"?r:String(r)}function jst(e,r){if(hS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(hS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Nst(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var Tst=y.memo(function(e){var r=Object.assign({},(Nst(e),e));return c.jsx(_c,Sst({Icon:aL,"aria-label":kk,background:pst,color:mst,iconMultiple:gst},r))});function fS(e){"@babel/helpers - typeof";return fS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},fS(e)}var Est=["size","style"];function NU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function w8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?NU(Object(n),!0).forEach(function(i){Ast(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):NU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Ast(e,r,n){return r=Ost(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Ost(e){var r=Mst(e,"string");return fS(r)=="symbol"?r:String(r)}function Mst(e,r){if(fS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(fS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Rst(e,r){if(e==null)return{};var n=Pst(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function Pst(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Pce=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=Rst(e,Est);return c.jsxs("svg",w8(w8({fill:"currentColor",fillRule:"evenodd",height:n,style:w8({flex:"none",lineHeight:1},i),viewBox:"0 0 143 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:kk}),c.jsx("path",{d:"M9.623 2c1.46 0 2.763.35 3.91 1.05 1.149.699 2.053 1.7 2.714 3.002.66 1.303.991 2.861.991 4.675 0 1.814-.33 3.372-.991 4.675-.66 1.302-1.565 2.303-2.713 3.003-1.148.7-2.452 1.049-3.91 1.049-1.465 0-2.772-.35-3.92-1.05-1.148-.699-2.052-1.701-2.713-3.007-.66-1.305-.991-2.862-.991-4.67 0-1.814.33-3.372.991-4.675.66-1.302 1.565-2.303 2.713-3.003C6.852 2.35 8.16 2 9.624 2zm0 2.34c-.974 0-1.844.244-2.61.734-.765.489-1.37 1.208-1.813 2.156-.443.949-.664 2.114-.664 3.497s.221 2.548.664 3.497c.444.948 1.048 1.667 1.813 2.156.766.49 1.636.735 2.61.735.97 0 1.838-.245 2.606-.735.768-.489 1.374-1.208 1.817-2.156.443-.949.665-2.114.665-3.497s-.222-2.548-.665-3.497c-.443-.948-1.049-1.667-1.817-2.156-.768-.49-1.637-.735-2.606-.735zm16.32 1.974c1.024 0 1.938.26 2.742.78s1.436 1.269 1.896 2.248c.46.979.69 2.156.69 3.534 0 1.377-.23 2.556-.686 3.538-.457.981-1.085 1.736-1.883 2.264-.799.529-1.71.793-2.734.793-.771 0-1.4-.13-1.887-.39-.488-.26-.869-.564-1.144-.913a6.908 6.908 0 01-.636-.929h-.149V24h-2.47V6.48h2.412v2.065h.207c.143-.265.35-.572.62-.92.27-.349.643-.655 1.123-.917.479-.263 1.112-.394 1.9-.394zm-.528 2.107c-.716 0-1.32.185-1.813.556-.493.37-.866.887-1.12 1.55-.253.665-.38 1.439-.38 2.324 0 .896.13 1.68.389 2.356.259.674.633 1.201 1.123 1.58s1.09.568 1.8.568c.738 0 1.355-.198 1.85-.593.496-.395.872-.933 1.128-1.613.256-.68.384-1.447.384-2.298 0-.84-.125-1.596-.376-2.265-.25-.67-.625-1.197-1.123-1.584-.498-.388-1.12-.581-1.862-.581zm13.387-2.107c.716 0 1.41.119 2.082.356a5.037 5.037 0 011.809 1.12c.534.51.955 1.169 1.263 1.979.309.81.463 1.793.463 2.949v.88l-9.016-.001.002.105c.03.732.178 1.364.445 1.895.3.597.72 1.052 1.26 1.364.539.313 1.17.469 1.89.469.469 0 .895-.068 1.28-.203a2.716 2.716 0 001-.61c.281-.271.496-.606.644-1.004l2.338.423a4.247 4.247 0 01-1.004 1.813c-.482.517-1.084.918-1.808 1.203-.725.284-1.549.427-2.474.427-1.25 0-2.325-.27-3.225-.809-.9-.54-1.594-1.3-2.082-2.281-.487-.982-.73-2.134-.73-3.455 0-1.306.243-2.456.73-3.451.488-.996 1.17-1.773 2.049-2.331.878-.559 1.906-.838 3.084-.838zm.017 2.049c-.694 0-1.298.17-1.813.51-.515.34-.911.782-1.19 1.327a3.778 3.778 0 00-.39 1.303l-.02.236h6.593c0-.653-.132-1.232-.397-1.738a3.022 3.022 0 00-1.11-1.199c-.477-.293-1.034-.44-1.673-.44zm10.29 3.293v7.566H46.64V6.48h2.37v2.074h.158a3.63 3.63 0 011.375-1.626c.625-.41 1.413-.614 2.366-.614.864 0 1.622.18 2.271.543.65.362 1.154.9 1.512 1.614.358.713.537 1.595.537 2.646v8.105h-2.47v-7.806c0-.924-.24-1.647-.718-2.17-.48-.522-1.137-.784-1.974-.784-.573 0-1.081.125-1.524.374a2.65 2.65 0 00-1.05 1.09c-.255.479-.383 1.055-.383 1.73zm17.122-9.424c1.31 0 2.4.227 3.266.68.868.454 1.516 1.08 1.945 1.88.43.799.645 1.72.645 2.766 0 1.04-.216 1.954-.649 2.742-.432.788-1.082 1.4-1.949 1.837a5.1 5.1 0 01-.501.22l3.743 6.865h-2.907l-3.436-6.43h-3.634v6.43h-2.552V2.232h6.029zm-.273 2.199h-3.204v6.155h3.237c.826 0 1.5-.119 2.02-.357s.901-.583 1.144-1.037c.242-.453.363-.998.363-1.634 0-.641-.122-1.197-.367-1.667-.246-.47-.628-.831-1.148-1.083-.52-.252-1.202-.377-2.045-.377zM79.66 6.314c1.19 0 2.227.273 3.114.821.886.548 1.575 1.316 2.065 2.306s.735 2.146.735 3.468c0 1.316-.245 2.466-.735 3.45-.49.985-1.179 1.751-2.065 2.299-.887.547-1.924.82-3.114.82s-2.227-.273-3.113-.82c-.887-.548-1.575-1.314-2.065-2.298-.49-.985-.735-2.135-.735-3.451 0-1.322.245-2.478.735-3.468.49-.99 1.178-1.758 2.065-2.306.886-.548 1.924-.821 3.113-.821zm.008 2.074c-.776 0-1.419.207-1.928.622-.51.415-.887.963-1.132 1.646a6.602 6.602 0 00-.367 2.244c0 .819.122 1.568.367 2.249.245.68.623 1.225 1.132 1.634.51.41 1.152.614 1.928.614.771 0 1.41-.205 1.917-.614.506-.41.882-.954 1.127-1.634.245-.68.367-1.43.367-2.249 0-.813-.122-1.56-.367-2.244-.245-.683-.62-1.231-1.127-1.646-.507-.415-1.146-.622-1.917-.622zm16.164 5.55V6.48h2.477v12.742h-2.428v-2.207h-.132a3.956 3.956 0 01-1.4 1.697c-.641.45-1.438.676-2.391.676-.815 0-1.535-.181-2.16-.544-.625-.362-1.115-.9-1.47-1.613-.355-.714-.533-1.596-.533-2.647V6.48h2.47v7.806c0 .868.24 1.56.718 2.074.48.514 1.102.771 1.867.771.462 0 .924-.116 1.383-.348.46-.232.843-.584 1.148-1.054.306-.47.456-1.067.45-1.792zm8.58-10.511v3.052h2.602v1.992h-2.602v7.01c0 .48.072.841.215 1.082.144.24.33.404.558.49.228.085.478.128.747.128.199 0 .372-.014.52-.041l.348-.067.446 2.05a4.42 4.42 0 01-.612.17c-.264.057-.594.09-.99.095a4.331 4.331 0 01-1.818-.349 3.12 3.12 0 01-1.362-1.128c-.347-.509-.52-1.148-.52-1.916l-.002-7.525h-1.857V6.48h1.857l.001-3.053h2.47zm9.961 2.887c.716 0 1.41.119 2.081.356a5.037 5.037 0 011.81 1.12c.533.51.954 1.169 1.263 1.979.308.81.462 1.793.462 2.949v.88l-9.016-.001.003.105c.03.732.178 1.364.445 1.895.3.597.72 1.052 1.259 1.364.54.313 1.17.469 1.891.469.468 0 .895-.068 1.28-.203a2.716 2.716 0 001-.61c.28-.271.495-.606.644-1.004l2.337.423a4.247 4.247 0 01-1.003 1.813c-.482.517-1.085.918-1.809 1.203-.724.284-1.548.427-2.473.427-1.25 0-2.325-.27-3.226-.809-.9-.54-1.594-1.3-2.08-2.281-.488-.982-.732-2.134-.732-3.455 0-1.306.244-2.456.731-3.451.487-.996 1.17-1.773 2.048-2.331.879-.559 1.907-.838 3.085-.838zm.017 2.049c-.694 0-1.298.17-1.813.51-.515.34-.911.782-1.19 1.327a3.778 3.778 0 00-.39 1.303l-.02.236h6.592c0-.653-.132-1.232-.396-1.738a3.022 3.022 0 00-1.11-1.199c-.477-.293-1.035-.44-1.673-.44zm7.821 10.859V6.48h2.387v2.024h.132a3.092 3.092 0 011.227-1.622 3.485 3.485 0 011.994-.593l.396.01.153.006c.212.011.379.025.5.042v2.372c-.1-.027-.275-.059-.529-.095a5.4 5.4 0 00-.76-.054c-.583 0-1.102.123-1.556.37a2.799 2.799 0 00-1.078 1.02 2.79 2.79 0 00-.397 1.48v7.782h-2.469z"})]}))});function pS(e){"@babel/helpers - typeof";return pS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},pS(e)}var Lst=["type","iconProps"];function TU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function EU(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?TU(Object(n),!0).forEach(function(i){$st(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):TU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function $st(e,r,n){return r=Dst(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Dst(e){var r=Ist(e,"string");return pS(r)=="symbol"?r:String(r)}function Ist(e,r){if(pS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(pS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Bst(e,r){if(e==null)return{};var n=zst(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function zst(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Fst=y.memo(function(e){var r=e.type,n=r===void 0?"mono":r,i=e.iconProps,s=Bst(e,Lst);return c.jsx(wc,EU({Icon:aL,Text:Pce,"aria-label":kk,iconProps:EU({color:n==="color"?sL:void 0},i),spaceMultiple:fst,textMultiple:hst},s))}),yx=aL;yx.Text=Pce;yx.Combine=Fst;yx.Avatar=Tst;yx.colorPrimary=sL;yx.title=kk;var Ck="Grok",Hst=.75,Wst=.25,Lce="#fff",Ust=Lce,Vst="#000",qst=.65;function mS(e){"@babel/helpers - typeof";return mS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},mS(e)}var Gst=["size","style"];function AU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function S8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?AU(Object(n),!0).forEach(function(i){Kst(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):AU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Kst(e,r,n){return r=Yst(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Yst(e){var r=Xst(e,"string");return mS(r)=="symbol"?r:String(r)}function Xst(e,r){if(mS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(mS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Jst(e,r){if(e==null)return{};var n=Zst(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function Zst(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var $ce=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=Jst(e,Gst);return c.jsxs("svg",S8(S8({fill:"currentColor",fillRule:"evenodd",height:n,style:S8({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Ck}),c.jsx("path",{d:"M6.469 8.776L16.512 23h-4.464L2.005 8.776H6.47zm-.004 7.9l2.233 3.164L6.467 23H2l4.465-6.324zM22 2.582V23h-3.659V7.764L22 2.582zM22 1l-9.952 14.095-2.233-3.163L17.533 1H22z"})]}))});function gS(e){"@babel/helpers - typeof";return gS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},gS(e)}function OU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function Qst(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?OU(Object(n),!0).forEach(function(i){eat(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function eat(e,r,n){return r=tat(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function tat(e){var r=rat(e,"string");return gS(r)=="symbol"?r:String(r)}function rat(e,r){if(gS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(gS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function nat(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var Dce=y.memo(function(e){var r=Object.assign({},(nat(e),e));return c.jsx(_c,Qst({Icon:$ce,"aria-label":Ck,background:Ust,color:Vst,iconMultiple:qst},r))});function yS(e){"@babel/helpers - typeof";return yS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},yS(e)}var iat=["size","style"];function MU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function k8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?MU(Object(n),!0).forEach(function(i){sat(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):MU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function sat(e,r,n){return r=aat(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function aat(e){var r=oat(e,"string");return yS(r)=="symbol"?r:String(r)}function oat(e,r){if(yS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(yS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function lat(e,r){if(e==null)return{};var n=cat(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function cat(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Ice=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=lat(e,iat);return c.jsxs("svg",k8(k8({fill:"currentColor",fillRule:"evenodd",height:n,style:k8({flex:"none",lineHeight:1},i),viewBox:"0 0 41 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Ck}),c.jsx("path",{d:"M36.867 2h2.577v20h-2.577V2zM23.875 2h2.717l7.759 20H31.55l-2.101-5.574h-8.571L18.777 22h-2.69l7.788-20zm4.79 12.185l-3.53-9.272-3.473 9.272h7.003zM7.35 14.381L2.504 7.518h2.857l3.446 5.126 3.585-5.126h2.605l-4.762 6.835L15.501 22h-2.829l-3.977-5.854L4.689 22H2l5.35-7.619z"})]}))});function vS(e){"@babel/helpers - typeof";return vS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},vS(e)}function RU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function uat(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?RU(Object(n),!0).forEach(function(i){dat(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):RU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function dat(e,r,n){return r=hat(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function hat(e){var r=fat(e,"string");return vS(r)=="symbol"?r:String(r)}function fat(e,r){if(vS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(vS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function pat(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var mat=y.memo(function(e){var r=Object.assign({},(pat(e),e));return c.jsx(wc,uat({Icon:Dce,Text:Ice,"aria-label":Ck,iconProps:{shape:"square"},spaceMultiple:Wst,textMultiple:Hst},r))}),vx=$ce;vx.Text=Ice;vx.Combine=mat;vx.Avatar=Dce;vx.colorPrimary=Lce;vx.title=Ck;var jk="MoonshotAI",gat=.75,yat=.4,Bce="#16191E",vat=Bce,xat="#fff",bat=.75;function xS(e){"@babel/helpers - typeof";return xS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},xS(e)}var _at=["size","style"];function PU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function C8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?PU(Object(n),!0).forEach(function(i){wat(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):PU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function wat(e,r,n){return r=Sat(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Sat(e){var r=kat(e,"string");return xS(r)=="symbol"?r:String(r)}function kat(e,r){if(xS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(xS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Cat(e,r){if(e==null)return{};var n=jat(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function jat(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var oL=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=Cat(e,_at);return c.jsxs("svg",C8(C8({fill:"currentColor",fillRule:"evenodd",height:n,style:C8({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:jk}),c.jsx("path",{d:"M1.052 16.916l9.539 2.552a21.007 21.007 0 00.06 2.033l5.956 1.593a11.997 11.997 0 01-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605 11.605 0 01-.157-.02l-.107-.014-.11-.016a11.962 11.962 0 01-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293 6.293 0 01-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655 5.655 0 01-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49 6.49 0 01-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785 7.785 0 01-.054-.036l-.044-.03-.044-.03a6.066 6.066 0 01-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516 7.516 0 01-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28 13.28 0 01-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457 6.457 0 01-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175 7.175 0 01-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99 11.99 0 01-1.44-2.402zm-1.02-5.794l11.353 3.037a20.468 20.468 0 00-.469 2.011l10.817 2.894a12.076 12.076 0 01-1.845 2.005L.657 15.923l-.016-.046-.035-.104a11.965 11.965 0 01-.05-.153l-.007-.023a11.896 11.896 0 01-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01 12.01 0 01-.019-.161l-.005-.047a12.12 12.12 0 01-.034-2.145zm1.593-5.15l11.948 3.196c-.368.605-.705 1.231-1.01 1.875l11.295 3.022c-.142.82-.368 1.612-.668 2.365l-11.55-3.09L.124 10.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896 11.896 0 011.01-2.232zm4.442-4.4L17.352 4.59a20.77 20.77 0 00-1.688 1.721l7.823 2.093c.267.852.442 1.744.513 2.665L2.106 5.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084 12.084 0 012.272-1.677zM12.017 0h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6 1.353 1.283 1.909 2.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z"})]}))});function bS(e){"@babel/helpers - typeof";return bS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},bS(e)}function LU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function Nat(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?LU(Object(n),!0).forEach(function(i){Tat(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):LU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Tat(e,r,n){return r=Eat(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Eat(e){var r=Aat(e,"string");return bS(r)=="symbol"?r:String(r)}function Aat(e,r){if(bS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(bS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Oat(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var Mat=y.memo(function(e){var r=Object.assign({},(Oat(e),e));return c.jsx(_c,Nat({Icon:oL,"aria-label":jk,background:vat,color:xat,iconMultiple:bat},r))});function _S(e){"@babel/helpers - typeof";return _S=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},_S(e)}var Rat=["size","style"];function $U(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function j8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?$U(Object(n),!0).forEach(function(i){Pat(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$U(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Pat(e,r,n){return r=Lat(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Lat(e){var r=$at(e,"string");return _S(r)=="symbol"?r:String(r)}function $at(e,r){if(_S(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(_S(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Dat(e,r){if(e==null)return{};var n=Iat(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function Iat(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var zce=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=Dat(e,Rat);return c.jsxs("svg",j8(j8({fill:"currentColor",fillRule:"evenodd",height:n,style:j8({flex:"none",lineHeight:1},i),viewBox:"0 0 171 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:jk}),c.jsx("path",{d:"M165.484 2H169v19.507h-3.516V2zm-35.707 0v5.26h3.186v3.507h-3.186v10.74h-3.516v-10.74h-2.966V7.26h2.966V2h3.516zm-24.598 11.023v8.498h-3.345v-8.804c.008-2.1-2.109-2.895-3.109-2.895l-.064.001c-1.073.026-3.521.694-3.54 3.863v7.835h-3.468V2.014L95.14 2v6.918c1.228-1.986 3.93-2.243 4.755-2.243.926 0 1.768.155 2.525.465.757.31 1.378.783 1.864 1.42.413.54.665 1.096.757 1.667.092.571.138 1.503.138 2.796zM89.29 9.507l-2.362 2.41c-2.911-2.41-6.647-2.136-7.196-.93-.55 1.205 2.444 1.484 4.734 1.98l.634.146c1.731.408 4.603 1.274 4.52 4.12-.11 3.78-4.23 4.767-6.867 4.767-2.637 0-5.933-1.808-7.636-3.342l2.527-2.63c2.582 2.63 7.142 2.958 7.856 1.534.714-1.425-1.263-1.48-4.834-1.973-3.175-.438-4.837-2.85-4.813-4.13.034-1.843 1.543-4.85 6.31-4.886 3.227-.025 5.425.961 7.127 2.934zm-22.617.386l-.033.001c-1.905.083-3.443 1.453-3.458 3.746v7.867h-3.83V7.185h3.702v2.061l.088-.12c.591-.8 2.07-2.555 4.796-2.523 2.675.032 5.696 1.95 5.696 5.17v9.734H69.69v-8.813c-.01-2.197-2.102-2.824-3.016-2.8zm-33.14-3.29c4.247 0 7.69 3.434 7.69 7.671s-3.443 7.671-7.69 7.671c-4.248 0-7.692-3.434-7.692-7.671s3.444-7.671 7.691-7.671zm0 3.726a3.95 3.95 0 00-3.956 3.945 3.95 3.95 0 003.955 3.945 3.95 3.95 0 003.956-3.945 3.95 3.95 0 00-3.956-3.945zm16.7-3.726c4.247 0 7.69 3.434 7.69 7.671s-3.443 7.671-7.69 7.671c-4.248 0-7.692-3.434-7.692-7.671s3.444-7.671 7.691-7.671zm0 3.726a3.95 3.95 0 00-3.956 3.945 3.95 3.95 0 003.955 3.945 3.95 3.95 0 003.956-3.945 3.95 3.95 0 00-3.956-3.945zm64.382-3.726c4.248 0 7.69 3.434 7.69 7.671s-3.442 7.671-7.69 7.671c-4.247 0-7.69-3.434-7.69-7.671s3.443-7.671 7.69-7.671zm0 3.726a3.95 3.95 0 00-3.955 3.945 3.95 3.95 0 003.955 3.945 3.95 3.95 0 003.955-3.945 3.95 3.95 0 00-3.955-3.945zM2 21.616V2l10.987 7.89L23.919 2v19.616h-3.79V9.452l-7.17 5.26-7.169-5.26v12.164H2zM153.344 2l10.492 19.507h-4.138l-1.833-3.288h-5.235l-1.789-3.46-3.632 6.748h-4.358L153.344 2zm0 8.11l-2.478 4.602h5.044l-2.566-4.602z"})]}))});function wS(e){"@babel/helpers - typeof";return wS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},wS(e)}function DU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function Bat(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?DU(Object(n),!0).forEach(function(i){zat(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):DU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function zat(e,r,n){return r=Fat(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Fat(e){var r=Hat(e,"string");return wS(r)=="symbol"?r:String(r)}function Hat(e,r){if(wS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(wS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Wat(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var Uat=y.memo(function(e){var r=Object.assign({},(Wat(e),e));return c.jsx(wc,Bat({Icon:oL,Text:zce,"aria-label":jk,spaceMultiple:yat,textMultiple:gat},r))}),xx=oL;xx.Text=zce;xx.Combine=Uat;xx.Avatar=Mat;xx.colorPrimary=Bce;xx.title=jk;var bx="Kimi",Vat=.7,qat=.25,Fce="#000",Gat=Fce,Kat="#fff",Yat=.6;function SS(e){"@babel/helpers - typeof";return SS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},SS(e)}var Xat=["size","style"];function IU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function N8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?IU(Object(n),!0).forEach(function(i){Jat(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):IU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Jat(e,r,n){return r=Zat(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Zat(e){var r=Qat(e,"string");return SS(r)=="symbol"?r:String(r)}function Qat(e,r){if(SS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(SS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function eot(e,r){if(e==null)return{};var n=tot(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function tot(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Hce=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=eot(e,Xat);return c.jsxs("svg",N8(N8({height:n,style:N8({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:bx}),c.jsx("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z",fill:"#1783FF"}),c.jsx("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z",fill:"#fff"})]}))});function kS(e){"@babel/helpers - typeof";return kS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},kS(e)}function BU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function rot(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?BU(Object(n),!0).forEach(function(i){not(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):BU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function not(e,r,n){return r=iot(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function iot(e){var r=sot(e,"string");return kS(r)=="symbol"?r:String(r)}function sot(e,r){if(kS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(kS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function aot(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var Wce=y.memo(function(e){var r=Object.assign({},(aot(e),e));return c.jsx(_c,rot({Icon:Hce,"aria-label":bx,background:Gat,color:Kat,iconMultiple:Yat},r))});function CS(e){"@babel/helpers - typeof";return CS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},CS(e)}var oot=["size","style"];function zU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function T8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?zU(Object(n),!0).forEach(function(i){lot(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function lot(e,r,n){return r=cot(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function cot(e){var r=uot(e,"string");return CS(r)=="symbol"?r:String(r)}function uot(e,r){if(CS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(CS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function dot(e,r){if(e==null)return{};var n=hot(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function hot(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Uce=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=dot(e,oot);return c.jsxs("svg",T8(T8({fill:"currentColor",fillRule:"evenodd",height:n,style:T8({flex:"none",lineHeight:1},i),viewBox:"0 0 64 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:bx}),c.jsx("path",{d:"M24.353 21.58c0 .232.188.42.42.42h2.69a.42.42 0 00.42-.42V2.42a.42.42 0 00-.42-.42h-2.69a.42.42 0 00-.42.42v19.16zM58.47 21.58c0 .232.188.42.42.42h2.691a.42.42 0 00.419-.42V2.42a.42.42 0 00-.419-.42H58.89a.42.42 0 00-.42.42v19.16zM47.786 2a.42.42 0 00-.408.32L43.4 18.633c-.066.267-.38.267-.444 0L38.976 2.32A.417.417 0 0038.57 2H31.83a.418.418 0 00-.418.42v19.16c0 .232.188.42.42.42h2.988c.231 0 .419-.182.419-.414V5.471c0-.322.378-.389.454-.079l3.974 16.288a.42.42 0 00.407.32h6.208a.42.42 0 00.407-.32L50.66 5.394c.076-.31.455-.243.455.079V21.58c0 .231.187.419.419.419h2.987a.42.42 0 00.42-.42V2.42a.42.42 0 00-.42-.42h-6.735zM11.55 11.273l8.115-8.565A.42.42 0 0019.36 2h-3.776a.42.42 0 00-.298.124l-9.303 9.39c-.144.146-.357.016-.357-.218V2.42a.42.42 0 00-.42-.42H2.42a.42.42 0 00-.42.42v19.16c0 .232.188.42.42.42h2.786a.42.42 0 00.42-.42v-3.82c0-.085.03-.166.081-.219l2.87-2.931c.07-.07.166-.081.243-.029l7.678 5.816c1.123.778 2.552 1.288 3.861 1.5a.403.403 0 00.464-.404v-3.461c0-.206-.15-.38-.35-.423-.76-.164-1.604-.474-2.244-.918l-6.647-4.953c-.138-.095-.155-.34-.033-.465z"})]}))});function jS(e){"@babel/helpers - typeof";return jS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},jS(e)}var fot=["iconProps"];function FU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function HU(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?FU(Object(n),!0).forEach(function(i){pot(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function pot(e,r,n){return r=mot(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function mot(e){var r=got(e,"string");return jS(r)=="symbol"?r:String(r)}function got(e,r){if(jS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(jS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function yot(e,r){if(e==null)return{};var n=vot(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function vot(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var xot=y.memo(function(e){var r=e.iconProps,n=yot(e,fot);return c.jsx(wc,HU({Icon:Wce,Text:Uce,"aria-label":bx,iconProps:HU({shape:"square"},r),spaceMultiple:qat,textMultiple:Vat},n))});function NS(e){"@babel/helpers - typeof";return NS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},NS(e)}var bot=["size","style"];function WU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function E8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?WU(Object(n),!0).forEach(function(i){_ot(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):WU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function _ot(e,r,n){return r=wot(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function wot(e){var r=Sot(e,"string");return NS(r)=="symbol"?r:String(r)}function Sot(e,r){if(NS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(NS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function kot(e,r){if(e==null)return{};var n=Cot(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function Cot(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var jot=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=kot(e,bot);return c.jsxs("svg",E8(E8({fill:"currentColor",fillRule:"evenodd",height:n,style:E8({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:bx}),c.jsx("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z"}),c.jsx("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z"})]}))}),Ay=jot;Ay.Color=Hce;Ay.Text=Uce;Ay.Combine=xot;Ay.Avatar=Wce;Ay.colorPrimary=Fce;Ay.title=bx;const Vce=[{label:"OpenAI / Jait",fields:["OPENAI_API_KEY","OPENAI_BASE_URL","OPENAI_MODEL","OPENAI_TRANSCRIBE_MODEL","OPENAI_WEB_SEARCH_MODEL"]},{label:"Ollama",fields:["OLLAMA_URL","OLLAMA_MODEL"]},{label:"Perplexity",fields:["PERPLEXITY_API_KEY","PERPLEXITY_MODEL","PERPLEXITY_OPENROUTER_MODEL"]},{label:"OpenRouter",fields:["OPENROUTER_API_KEY"]},{label:"xAI / Grok",fields:["XAI_API_KEY","GROK_MODEL"]},{label:"Google Gemini",fields:["GEMINI_API_KEY","GEMINI_MODEL"]},{label:"Moonshot / Kimi",fields:["MOONSHOT_API_KEY","KIMI_BASE_URL","KIMI_MODEL"]},{label:"Brave Search",fields:["BRAVE_API_KEY"]},{label:"Speech / Home Assistant",fields:["WHISPER_URL","HA_URL","HA_TOKEN","HA_STT_ENTITY","ELEVENLABS_API_KEY","ELEVENLABS_STT_MODEL","ELEVENLABS_STT_URL","ELEVENLABS_LANGUAGE_CODE"]}],UU=Vce.flatMap(e=>e.fields),Not={OPENAI:hs,PERPLEXITY:Ey,OPENROUTER:yx,XAI:vx,GEMINI:Ap,ELEVENLABS:SY,MOONSHOT:xx,KIMI:Ay,GROK:Sy,OLLAMA:wy,HA:bY};function Tot(e){const r=e.split("_")[0];return Not[r]??null}function Eot(e){return e.endsWith("_KEY")||e.endsWith("_URL")}const Aot=qn(),VU={jait:"Jait",codex:"Codex","claude-code":"Claude Code"};function Oot(e){const r=e.auth;return e.id==="jait"||!r?!1:r.login||r.logout||r.authenticated!==null}function Mot({username:e,token:r,apiKeys:n,onSaveApiKeys:i,sttProvider:s,onSttProviderChange:a,jaitBackend:o,onJaitBackendChange:l,onClearArchive:d,onClearArchivedProjects:u,onFetchArchivedProjects:h,onRestoreProject:f,activityEvents:g,updateInfo:v,updateChecking:b,onCheckUpdate:_,onApplyUpdate:S,updateApplying:w,platform:C}){const[j,E]=y.useState(n),[A,N]=y.useState(!1),[R,B]=y.useState(!1),[G,H]=y.useState(!1),[z,W]=y.useState([]),[I,O]=y.useState(!1),[D,P]=y.useState(null),[$,V]=y.useState(null),[K,F]=y.useState(null),[U,Q]=y.useState({}),[q,te]=y.useState({}),[ee,se]=y.useState([]),[ae,re]=y.useState(!1),[de,pe]=y.useState(null),[_e,me]=y.useState("general"),[qe,oe]=y.useState(""),it=y.useRef(null),{importedThemes:Xe,activeTheme:gt}=lte(),[Mt,Ht]=y.useState(!1),[Yt,tr]=y.useState(null);y.useEffect(()=>{var Me;C!=="electron"||!((Me=window.jaitDesktop)!=null&&Me.getInfo)||window.jaitDesktop.getInfo().then(mt=>{mt.appVersion&&tr(mt.appVersion)})},[C]),y.useEffect(()=>{var Me;C!=="electron"||!((Me=window.jaitDesktop)!=null&&Me.getSetting)||window.jaitDesktop.getSetting("closeOnWindowClose",!1).then(mt=>{Ht(mt===!0)})},[C]),y.useEffect(()=>{E(n)},[n]);const ft=UU.some(Me=>(j[Me]??"")!==(n[Me]??"")),Ye=y.useCallback(async()=>{if(r){re(!0);try{const{providers:Me}=await gr.listProvidersFresh();se(Me.filter(Oot))}catch{se([])}finally{re(!1)}}},[r]);y.useEffect(()=>{Ye()},[Ye]);const ht=async Me=>{var Wt;const mt=((Wt=ee.find(Ot=>Ot.id===Me))==null?void 0:Wt.name)??VU[Me]??Me;pe(Me),F(null),V(null);try{const Ot=await gr.logoutProvider(Me);V(Ot.message||`${mt} logout completed.`),await Ye()}catch(Ot){F(Ot instanceof Error?Ot.message:`Failed to log out from ${mt}.`)}finally{pe(null)}},Tt=y.useCallback(()=>{E(n),V(null),F(null)},[n]);y.useEffect(()=>{if(!r)return;let Me=!1;return(async()=>{try{const mt=await fetch(`${Aot}/auth/settings/env-status`,{headers:{Authorization:`Bearer ${r}`}});if(mt.ok&&!Me){const Wt=await mt.json();Q(Wt.env_set)}}catch{}})(),()=>{Me=!0}},[r]);const Te=y.useCallback(Me=>{te(mt=>({...mt,[Me]:!mt[Me]}))},[]),Oe=async()=>{N(!0),F(null),V(null);try{await i(j),V("API keys saved.")}catch(Me){F(Me instanceof Error?Me.message:"Failed to save API keys")}finally{N(!1)}},Je=async()=>{B(!0),F(null),V(null);try{const Me=await d();V(`Cleared ${Me} archived session(s).`)}catch(Me){F(Me instanceof Error?Me.message:"Failed to clear archive")}finally{B(!1)}},lt=async()=>{H(!0),F(null),V(null);try{const Me=await u();W([]),V(`Cleared ${Me} archived project(s).`)}catch(Me){F(Me instanceof Error?Me.message:"Failed to clear archived projects")}finally{H(!1)}},yt=y.useCallback(async()=>{O(!0);try{const Me=await h();W(Me)}finally{O(!1)}},[h]),zt=async Me=>{P(Me);try{await f(Me)?(W(Wt=>Wt.filter(Ot=>Ot.id!==Me)),V("Project restored.")):F("Failed to restore project.")}catch{F("Failed to restore project.")}finally{P(null)}},or=y.useCallback(async Me=>{var Wt;const mt=(Wt=Me.target.files)==null?void 0:Wt[0];if(Me.target.value="",!!mt){F(null),V(null);try{const Ot=mDe(mt.name,await mt.text());V(Ot.hasInclude?`Imported theme "${Ot.name}". Relative "include" files are not resolved yet.`:`Imported theme "${Ot.name}".`)}catch(Ot){F(Ot instanceof Error?Ot.message:"Failed to import theme")}}},[]);function Pe(Me){var Ot;const mt=!!((Ot=j[Me])!=null&&Ot.trim()),Wt=!!U[Me];return mt?c.jsx(Or,{variant:"default",className:"text-2xs px-1.5 py-0",children:"user"}):Wt?c.jsx(Or,{variant:"success",className:"text-2xs px-1.5 py-0",children:".env"}):c.jsx(Or,{variant:"outline",className:"text-2xs px-1.5 py-0 text-muted-foreground",children:"empty"})}const Ne=qe.trim().toLowerCase(),be=(...Me)=>!Ne||Me.some(mt=>mt==null?void 0:mt.toLowerCase().includes(Ne)),He=Me=>c.jsx("span",{dangerouslySetInnerHTML:{__html:Tit(Me,qe)}}),at=be("software update version gateway desktop release download install",v==null?void 0:v.currentVersion,v==null?void 0:v.latestVersion,Yt),Ve=C==="electron"&&be("desktop tray close window quit minimize app",Yt),$t=C!=="web"&&be("gateway connection url domain ip server host network",qn()),Et=be("session archive archived clear delete messages history"),Xt=be("project archive archived clear delete projects remove"),rr=be("jait backend provider openai openrouter model api llm",o),nr=be("provider accounts login logout codex claude gemini opencode copilot authentication",...ee.map(Me=>{var mt;return`${Me.name} ${((mt=Me.auth)==null?void 0:mt.detail)??""}`})),Se=be("speech stt input microphone whisper wyoming home assistant transcription gpt openai elevenlabs scribe",s,j.WHISPER_URL,j.HA_URL,j.HA_TOKEN,j.HA_STT_ENTITY,j.OPENAI_TRANSCRIBE_MODEL,j.ELEVENLABS_API_KEY,j.ELEVENLABS_STT_MODEL,j.ELEVENLABS_STT_URL,j.ELEVENLABS_LANGUAGE_CODE),Fe=UU.filter(Me=>be(Me,Me.replaceAll("_"," "),j[Me])),et=be("tools permissions mcp core standard external toggle meta terminal filesystem os agent browser web surfaces scheduler memory voice screen gateway"),wt=be("activity recent messages terminal sessions feed history"),Ze=be("extensions plugins store install uninstall enable disable"),vt=be("skills instructions prompts specialized workflows SKILL.md"),Rt=be("channels whatsapp messaging connect link qr inbound outbound"),Gt=be(...Z$e(),"import json token colors workbench sidebar tabs"),$e=c.jsx(tn,{className:"p-5",children:c.jsxs("p",{className:"text-sm text-muted-foreground",children:["No settings match ",c.jsx("span",{className:"font-medium text-foreground",children:qe}),"."]})});return c.jsxs("div",{className:"mx-auto w-full max-w-5xl space-y-6 p-4 sm:p-6",children:[c.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-end md:justify-between",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"Settings"}),c.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["Signed in as ",c.jsx("span",{className:"font-medium text-foreground",children:e})]})]}),c.jsxs("div",{className:"relative w-full md:max-w-sm",children:[c.jsx(rl,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),c.jsx(Ln,{value:qe,onChange:Me=>oe(Me.target.value),placeholder:"Search settings...",className:"pl-9"})]})]}),c.jsxs(Y0,{value:_e,onValueChange:Me=>me(Me),className:"space-y-4",children:[c.jsxs(ag,{className:"flex h-auto w-full flex-wrap justify-start gap-1 rounded-xl bg-muted/70 p-1",children:[c.jsx(Qs,{value:"general",className:"flex-1 sm:flex-none",children:"General"}),c.jsx(Qs,{value:"api",className:"flex-1 sm:flex-none",children:"API"}),c.jsx(Qs,{value:"tools",className:"flex-1 sm:flex-none",children:"Tools"}),c.jsx(Qs,{value:"extensions",className:"flex-1 sm:flex-none",children:"Extensions"}),c.jsx(Qs,{value:"skills",className:"flex-1 sm:flex-none",children:"Skills"}),c.jsx(Qs,{value:"channels",className:"flex-1 sm:flex-none",children:"Channels"}),c.jsx(Qs,{value:"activity",className:"flex-1 sm:flex-none",children:"Activity"})]}),c.jsxs(ea,{value:"general",className:"space-y-6",children:[at&&c.jsxs(tn,{className:"space-y-4 p-5",children:[c.jsxs("div",{children:[c.jsxs("h2",{className:"flex items-center gap-2 text-base font-medium",children:[c.jsx(gY,{className:"h-4 w-4"}),He("Software Update")]}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:[v?c.jsxs(c.Fragment,{children:["Gateway ",c.jsxs("span",{className:"font-mono font-medium text-foreground",children:["v",v.currentVersion]})]}):"Check for the latest Jait version.",Yt&&c.jsxs(c.Fragment,{children:[" · Desktop app ",c.jsxs("span",{className:"font-mono font-medium text-foreground",children:["v",Yt]})]})]})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[c.jsxs(we,{variant:"outline",size:"sm",onClick:_,disabled:b||w,children:[b?c.jsx(Ft,{className:"mr-1.5 h-4 w-4 animate-spin"}):null,b?"Checking...":"Check for updates"]}),(v==null?void 0:v.hasUpdate)&&c.jsxs(c.Fragment,{children:[c.jsxs(we,{size:"sm",onClick:S,disabled:w,children:[w?c.jsx(Ft,{className:"mr-1.5 h-4 w-4 animate-spin"}):c.jsx(gp,{className:"mr-1.5 h-4 w-4"}),w?"Updating...":`Update gateway to v${v.latestVersion}`]}),C==="electron"?c.jsxs(we,{size:"sm",variant:"outline",onClick:async()=>{const Me=window.jaitDesktop;(await Me.checkForUpdate()).updateAvailable&&(await Me.downloadUpdate(),await Me.installUpdate())},children:[c.jsx(gp,{className:"mr-1.5 h-4 w-4"}),"Update desktop app"]}):C!=="web"&&c.jsx(we,{size:"sm",variant:"outline",asChild:!0,children:c.jsxs("a",{href:"https://github.com/Widev-e-U/Jait/releases/latest",target:"_blank",rel:"noopener noreferrer",children:[c.jsx(gp,{className:"mr-1.5 h-4 w-4"}),"Download latest APK"]})})]})]}),v&&!v.hasUpdate&&c.jsxs("p",{className:"flex items-center gap-1.5 text-sm text-green-600 dark:text-green-400",children:[c.jsx(ia,{className:"h-3.5 w-3.5"}),"You're on the latest version."]}),(v==null?void 0:v.hasUpdate)&&c.jsxs("p",{className:"flex items-center gap-1.5 text-sm text-amber-600 dark:text-amber-400",children:[c.jsx(na,{className:"h-3.5 w-3.5"}),"Version ",v.latestVersion," is available",C!=="web"?" — download from jait.dev":"","."]})]}),Gt&&c.jsxs(tn,{className:"space-y-4 p-5",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:He("Editor theme")}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Import a VS Code theme JSON file and apply its Monaco token colors plus a mapped shell palette."})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("input",{ref:it,type:"file",accept:".json,application/json",className:"hidden",onChange:Me=>{or(Me)}}),c.jsx(we,{variant:"outline",size:"sm",onClick:()=>{var Me;return(Me=it.current)==null?void 0:Me.click()},children:"Import theme JSON"}),c.jsx(we,{variant:"ghost",size:"sm",disabled:!gt,onClick:()=>_j(null),children:"Use built-in theme"})]}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"Imported themes stay local to this device. The quick light/system/dark toggle falls back to the built-in theme set."}),Xe.length>0?c.jsx("div",{className:"space-y-2",children:Xe.map(Me=>{const mt=(gt==null?void 0:gt.id)===Me.id;return c.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border px-3 py-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("p",{className:"truncate text-sm font-medium",children:Me.name}),c.jsx(Or,{variant:mt?"default":"outline",className:"h-5 px-1.5 text-2xs",children:mt?"active":Me.colorMode})]}),c.jsx("p",{className:"truncate text-xs text-muted-foreground",children:Me.sourceLabel})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[!mt&&c.jsx(we,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>_j(Me.id),children:"Apply"}),c.jsx(we,{variant:"ghost",size:"sm",className:"h-7 text-xs text-destructive hover:text-destructive",onClick:()=>gDe(Me.id),children:"Remove"})]})]},Me.id)})}):c.jsx("p",{className:"text-sm text-muted-foreground",children:"No imported themes yet."})]}),Ve&&c.jsxs(tn,{className:"space-y-4 p-5",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:He("Desktop")}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Settings specific to the desktop application."})]}),c.jsxs("div",{className:"flex max-w-md items-center justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx(mi,{htmlFor:"close-on-window-close",children:"Quit on window close"}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"When off, closing the window minimizes Jait to the system tray."})]}),c.jsx(gf,{id:"close-on-window-close",checked:Mt,onCheckedChange:Me=>{var mt;Ht(Me),(mt=window.jaitDesktop)==null||mt.setSetting("closeOnWindowClose",Me)}})]})]}),$t&&c.jsxs(tn,{className:"space-y-4 p-5",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:He("Gateway connection")}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Desktop and mobile clients can connect to a different Jait gateway."})]}),c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Current gateway: ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:qn()})]})]}),Et&&c.jsxs(tn,{className:"space-y-4 p-5",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:He("Session archive")}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Permanently remove archived sessions and their messages from your account."})]}),c.jsx("div",{children:c.jsx(we,{variant:"destructive",onClick:()=>{Je()},disabled:R,children:R?"Clearing...":"Clear archived sessions"})})]}),Xt&&c.jsxs(tn,{className:"space-y-4 p-5",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:He("Project archive")}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Restore or permanently remove archived projects and their sessions."})]}),c.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap",children:[c.jsx(we,{className:"w-full sm:w-auto",variant:"outline",onClick:()=>{yt()},disabled:I,children:I?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{className:"mr-2 h-3.5 w-3.5 animate-spin"})," Loading..."]}):"Show archived projects"}),c.jsx(we,{className:"w-full sm:w-auto",variant:"destructive",onClick:()=>{lt()},disabled:G,children:G?"Clearing...":"Clear all archived"})]}),z.length>0&&c.jsx("div",{className:"space-y-2",children:z.map(Me=>c.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border px-3 py-2",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx(yR,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("p",{className:"text-sm font-medium truncate",children:Me.title||Me.rootPath||Me.id}),Me.rootPath&&Me.title&&c.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Me.rootPath})]})]}),c.jsxs(we,{variant:"outline",size:"sm",className:"shrink-0 h-7 text-xs",onClick:()=>{zt(Me.id)},disabled:D===Me.id,children:[D===Me.id?c.jsx(Ft,{className:"mr-1.5 h-3 w-3 animate-spin"}):c.jsx(O0e,{className:"mr-1.5 h-3 w-3"}),"Restore"]})]},Me.id))})]}),rr&&c.jsxs(tn,{className:"space-y-4 p-5",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:He("Jait LLM Backend")}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose which API backend the Jait provider uses for model inference."})]}),c.jsxs("div",{className:"max-w-sm",children:[c.jsx(mi,{htmlFor:"jait-backend",className:"mb-1.5 block",children:"Backend provider"}),c.jsxs(sh,{value:o,onValueChange:Me=>{l(Me)},children:[c.jsx(ed,{id:"jait-backend",children:c.jsx(ah,{placeholder:"Select backend"})}),c.jsxs(td,{children:[c.jsx(Ls,{value:"openai",children:"OpenAI (direct)"}),c.jsx(Ls,{value:"openrouter",children:"OpenRouter"}),c.jsx(Ls,{value:"ollama",children:"Ollama (local)"})]})]}),c.jsx("p",{className:"mt-1.5 text-xs text-muted-foreground",children:o==="openrouter"?"Models will be fetched from OpenRouter. Set your OPENROUTER_API_KEY in the API tab.":o==="ollama"?"Models will be fetched from your local Ollama instance. Set OLLAMA_URL in the API tab if not running on localhost:11434.":"Uses your OPENAI_API_KEY and OPENAI_BASE_URL."})]})]}),nr&&c.jsxs(tn,{className:"space-y-4 p-5",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:He("Provider accounts")}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage CLI provider sessions. Login is started from the provider picker; logout is handled here."})]}),c.jsxs(we,{variant:"outline",size:"sm",onClick:()=>{Ye()},disabled:ae,children:[ae?c.jsx(Ft,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):c.jsx(Js,{className:"mr-1.5 h-3.5 w-3.5"}),"Refresh"]})]}),c.jsx("div",{className:"space-y-2",children:ee.length===0&&!ae?c.jsx("p",{className:"text-sm text-muted-foreground",children:"No provider account actions are available on this gateway."}):ee.map(Me=>{const mt=Me.auth,Wt=Me.id,Ot=(mt==null?void 0:mt.authenticated)===!0,Hr=(mt==null?void 0:mt.authenticated)===!1,mr=de===Wt;return c.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border px-3 py-3 sm:flex-row sm:items-center sm:justify-between",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("p",{className:"text-sm font-medium",children:VU[Wt]??Me.name}),c.jsx(Or,{variant:Ot?"success":"outline",className:"text-2xs",children:Ot?"signed in":(mt==null?void 0:mt.authenticated)===!1?"signed out":"unknown"})]}),(mt==null?void 0:mt.detail)&&c.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:mt.detail})]}),(mt==null?void 0:mt.logout)&&c.jsxs(we,{className:"w-full sm:w-auto",variant:"outline",size:"sm",onClick:()=>{ht(Wt)},disabled:mr||de!==null||Hr,children:[mr?c.jsx(Ft,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):c.jsx(yA,{className:"mr-1.5 h-3.5 w-3.5"}),"Logout"]})]},Me.id)})})]}),Se&&c.jsxs(tn,{className:"space-y-4 p-5",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:He("Spracheingabe (Speech-to-Text)")}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Wähle aus, wie gesprochene Sprache in Text umgewandelt wird, bevor sie als Nachricht gesendet wird."})]}),c.jsxs("div",{className:"max-w-sm",children:[c.jsx(mi,{htmlFor:"stt-provider",className:"mb-1.5 block",children:"STT-Anbieter"}),c.jsxs(sh,{value:s,onValueChange:Me=>{a(Me)},children:[c.jsx(ed,{id:"stt-provider",children:c.jsx(ah,{placeholder:"STT-Anbieter wählen"})}),c.jsxs(td,{children:[c.jsx(Ls,{value:"whisper",children:"Faster Whisper (lokal)"}),c.jsx(Ls,{value:"gpt",children:"GPT (OpenAI)"}),c.jsx(Ls,{value:"elevenlabs",children:"ElevenLabs Scribe"}),c.jsx(Ls,{value:"wyoming",children:"Wyoming / Whisper (Home Assistant)"})]})]})]}),s==="whisper"&&c.jsx("div",{className:"max-w-sm space-y-3 border-l-2 border-primary/20 pl-4",children:c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Uses a local Faster Whisper server for free, offline transcription. Start the server with ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"python whisper-server/server.py"})," from the gateway package. Optionally set ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"WHISPER_URL"})," in API keys below (defaults to ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"http://localhost:8178"}),")."]})}),s==="wyoming"&&c.jsx("div",{className:"max-w-sm space-y-3 border-l-2 border-primary/20 pl-4",children:c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Configure your Home Assistant Wyoming/Whisper STT integration. Set these values in the API keys section below: ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"HA_URL"}),", ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"HA_TOKEN"}),", and optionally ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"HA_STT_ENTITY"})," (defaults to ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"stt.faster_whisper"}),")."]})}),s==="gpt"&&c.jsx("div",{className:"max-w-sm space-y-3 border-l-2 border-primary/20 pl-4",children:c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Uses OpenAI audio transcription. Set ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"OPENAI_API_KEY"})," and optionally ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"OPENAI_TRANSCRIBE_MODEL"})," (defaults to ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"gpt-4o-mini-transcribe"}),")."]})}),s==="elevenlabs"&&c.jsx("div",{className:"max-w-sm space-y-3 border-l-2 border-primary/20 pl-4",children:c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Uses ElevenLabs Speech to Text. Set ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"ELEVENLABS_API_KEY"})," and optionally ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"ELEVENLABS_STT_MODEL"})," (defaults to ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"scribe_v2"}),") and ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"ELEVENLABS_LANGUAGE_CODE"}),"."]})})]}),!Gt&&!at&&!Ve&&!$t&&!Et&&!Xt&&!rr&&!nr&&!Se&&$e]}),c.jsx(ea,{value:"api",className:"space-y-6 pb-20",children:Fe.length>0?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:"Values stored here are user-specific and override environment defaults for your account."}),Vce.map(Me=>{const mt=Me.fields.filter(Ot=>Fe.includes(Ot));if(mt.length===0)return null;const Wt=Tot(mt[0]);return c.jsx(rk,{defaultOpen:!1,children:c.jsxs(tn,{className:"p-0 overflow-hidden",children:[c.jsxs(nk,{className:"flex w-full items-center gap-2 px-5 py-3.5 text-left hover:bg-muted/50 transition-colors group",children:[c.jsx(Cs,{className:"h-4 w-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-90"}),Wt?c.jsx(Wt,{size:16,className:"text-muted-foreground"}):c.jsx(SY,{className:"h-4 w-4 text-muted-foreground"}),c.jsx("span",{className:"text-sm font-semibold",children:He(Me.label)})]}),c.jsx(ik,{children:c.jsx("div",{className:"grid gap-4 px-5 pb-5 md:grid-cols-2",children:mt.map(Ot=>{const Hr=Eot(Ot),mr=!!q[Ot];return c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx(mi,{htmlFor:`api-${Ot}`,className:"font-mono text-xs",children:He(Ot)}),Pe(Ot)]}),c.jsxs("div",{className:"relative",children:[c.jsx(Ln,{id:`api-${Ot}`,type:Hr&&!mr?"password":"text",value:j[Ot]??"",onChange:Dr=>{E(jt=>({...jt,[Ot]:Dr.target.value}))},placeholder:U[Ot]?"(set via .env)":"(empty)",className:Hr?"pr-9":""}),Hr&&c.jsx("button",{type:"button",className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",onClick:()=>Te(Ot),tabIndex:-1,"aria-label":mr?"Hide value":"Show value",children:mr?c.jsx(Hd,{className:"h-4 w-4"}):c.jsx(tf,{className:"h-4 w-4"})})]})]},Ot)})})})]})},Me.label)}),c.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-30 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",children:c.jsxs("div",{className:"mx-auto flex max-w-5xl items-center gap-3 px-4 py-3 sm:px-6",children:[c.jsx(we,{onClick:()=>{Oe()},disabled:A||!ft,children:A?"Saving...":"Save API settings"}),c.jsx(we,{variant:"ghost",onClick:Tt,disabled:!ft,children:"Discard"}),$&&c.jsx("span",{className:"text-sm text-muted-foreground",children:$}),K&&c.jsx("span",{className:"text-sm text-destructive",children:K})]})})]}):$e}),c.jsx(ea,{value:"tools",className:"space-y-6",children:et?c.jsx(mit,{token:r}):$e}),c.jsx(ea,{value:"extensions",className:"space-y-6",children:Ze?c.jsx(xit,{token:r}):$e}),c.jsx(ea,{value:"skills",className:"space-y-6",children:vt?c.jsx(wit,{token:r}):$e}),c.jsx(ea,{value:"channels",className:"space-y-6",children:Rt?c.jsx(jit,{token:r}):$e}),c.jsxs(ea,{value:"activity",className:"space-y-6",children:[wt&&g&&g.length>0&&c.jsxs(tn,{className:"p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:He("Recent activity")}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Recent chat messages and terminal sessions."})]}),c.jsx(Nit,{events:g})]}),wt&&(!g||g.length===0)&&c.jsx(tn,{className:"p-5",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"No recent activity yet."})}),!wt&&$e]})]})]})}function Rot(e,r){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,s,a,o,l=[],d=!0,u=!1;try{if(a=(n=n.call(e)).next,r===0){if(Object(n)!==n)return;d=!1}else for(;!(d=(i=a.call(n)).done)&&(l.push(i.value),l.length!==r);d=!0);}catch(h){u=!0,s=h}finally{try{if(!d&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function Pot(e,r,n){return r=Hot(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function qU(e,r){return Dot(e)||Rot(e,r)||qce(e,r)||zot()}function Lot(e){return $ot(e)||Iot(e)||qce(e)||Bot()}function $ot(e){if(Array.isArray(e))return A7(e)}function Dot(e){if(Array.isArray(e))return e}function Iot(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function qce(e,r){if(e){if(typeof e=="string")return A7(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A7(e,r)}}function A7(e,r){(r==null||r>e.length)&&(r=e.length);for(var n=0,i=new Array(r);n<r;n++)i[n]=e[n];return i}function Bot(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1230
+ `:"")+g,i.push({type:"text",content:g})}break}}}return l(),r}const mU=qn(),gU={core:{variant:"default",label:"core"},standard:{variant:"secondary",label:"standard"},external:{variant:"warning",label:"external"}},yU=["meta","terminal","filesystem","os","agent","browser","web","surfaces","scheduler","memory","voice","screen","gateway","external"];function mit({token:e}){const[r,n]=y.useState([]),[i,s]=y.useState(!0),[a,o]=y.useState(!1),[l,d]=y.useState(null),[u,h]=y.useState("");y.useEffect(()=>{if(!e)return;let S=!1;return(async()=>{try{const w=await fetch(`${mU}/api/auth/settings/tools`,{headers:{Authorization:`Bearer ${e}`}});if(!S)if(w.ok){const C=await w.json();n(C.tools)}else d(`Failed to load tools (${w.status})`)}catch{S||d("Failed to load tools")}finally{S||s(!1)}})(),()=>{S=!0}},[e]);const f=y.useCallback(async(S,w)=>{if(e){n(C=>C.map(j=>j.name===S?{...j,enabled:w}:j)),o(!0),d(null);try{const C=r.map(E=>E.name===S?{...E,enabled:w}:E).filter(E=>!E.enabled&&!E.locked).map(E=>E.name);if(!(await fetch(`${mU}/api/auth/settings/tools`,{method:"PATCH",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({disabled_tools:C})})).ok)throw new Error("Failed to save")}catch{n(C=>C.map(j=>j.name===S?{...j,enabled:!w}:j)),d("Failed to update tool setting")}finally{o(!1)}}},[e,r]),g=new Map,v=u.trim().toLowerCase();for(const S of r){if(v&&!`${S.name} ${S.description} ${S.category}`.toLowerCase().includes(v))continue;const w=S.category;g.has(w)||g.set(w,[]),g.get(w).push(S)}const b=[...g.keys()].sort((S,w)=>{const C=yU.indexOf(S),j=yU.indexOf(w);return(C===-1?999:C)-(j===-1?999:j)}),_={total:r.length,enabled:r.filter(S=>S.enabled).length,core:r.filter(S=>S.tier==="core").length,standard:r.filter(S=>S.tier==="standard").length,external:r.filter(S=>S.tier==="external").length};return i?c.jsx(tn,{className:"p-5",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading tools..."})}):c.jsxs(tn,{className:"p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:"Tools"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage which tools are available to the AI agent. Core tools are always enabled. Standard tools can be toggled. External (MCP) tools are discovered on demand."})]}),c.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(H4,{className:"h-3.5 w-3.5"}),_.core," core"]}),c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(wR,{className:"h-3.5 w-3.5"}),_.standard," standard"]}),c.jsxs("span",{className:"flex items-center gap-1",children:[c.jsx(M2,{className:"h-3.5 w-3.5"}),_.external," external"]}),c.jsxs("span",{className:"ml-auto",children:[_.enabled,"/",_.total," enabled"]})]}),c.jsxs("div",{className:"relative",children:[c.jsx(rl,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),c.jsx(Ln,{placeholder:"Filter tools...",value:u,onChange:S=>h(S.target.value),className:"pl-9"})]}),l&&c.jsx("p",{className:"text-sm text-destructive",children:l}),c.jsxs("div",{className:"space-y-5",children:[b.map(S=>{const w=g.get(S);return c.jsxs("div",{children:[c.jsx("h3",{className:"text-sm font-medium text-muted-foreground uppercase tracking-wide mb-2",children:S}),c.jsx("div",{className:"space-y-1",children:w.map(C=>{const j=gU[C.tier]??gU.standard;return c.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded-md hover:bg-muted/50 transition-colors",children:[c.jsx(gf,{checked:C.enabled,onCheckedChange:E=>{f(C.name,E)},disabled:C.locked||a,"aria-label":`Toggle ${C.name}`}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-mono text-sm font-medium",children:C.name}),c.jsx(Or,{variant:j.variant,className:"text-2xs px-1.5 py-0",children:j.label}),C.source==="mcp"&&c.jsx(Or,{variant:"outline",className:"text-2xs px-1.5 py-0",children:"MCP"})]}),c.jsx("p",{className:"text-xs text-muted-foreground truncate",children:C.description})]})]},C.name)})})]},S)}),b.length===0&&c.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:v?"No tools match your filter.":"No tools available."})]})]})}const W_=qn(),git={installed:{variant:"secondary",label:"installed"},enabled:{variant:"default",label:"enabled"},disabled:{variant:"outline",label:"disabled"},error:{variant:"destructive",label:"error"}};function Ece(e){return y.useCallback(()=>{const r={};return e&&(r.Authorization=`Bearer ${e}`),r},[e])}function yit({token:e}){const[r,n]=y.useState([]),[i,s]=y.useState(!0),[a,o]=y.useState(null),[l,d]=y.useState(""),[u,h]=y.useState(null),f=Ece(e),g=y.useCallback(async()=>{s(!0),o(null);try{const C=await fetch(`${W_}/api/plugins`,{headers:f()});if(!C.ok)throw new Error(`Failed to load extensions (HTTP ${C.status})`);const j=await C.json();n(j)}catch(C){o(C instanceof Error?C.message:"Failed to load extensions")}finally{s(!1)}},[f]);y.useEffect(()=>{g()},[g]);const v=y.useCallback(async(C,j)=>{h(C);try{const E=j?"enable":"disable",A=await fetch(`${W_}/api/plugins/${encodeURIComponent(C)}/${E}`,{method:"POST",headers:f()});if(!A.ok){const N=await A.json().catch(()=>({}));throw new Error(N.error??`Failed to ${E} (HTTP ${A.status})`)}await g()}catch(E){o(E instanceof Error?E.message:"Action failed")}finally{h(null)}},[f,g]),b=y.useCallback(async C=>{h(C);try{const j=await fetch(`${W_}/api/plugins/${encodeURIComponent(C)}`,{method:"DELETE",headers:f()});if(!j.ok){const E=await j.json().catch(()=>({}));throw new Error(E.error??`Failed to uninstall (HTTP ${j.status})`)}await g()}catch(j){o(j instanceof Error?j.message:"Action failed")}finally{h(null)}},[f,g]),_=y.useCallback(async()=>{s(!0);try{const C=await fetch(`${W_}/api/plugins/scan`,{method:"POST",headers:f()});if(!C.ok)throw new Error(`Scan failed (HTTP ${C.status})`);const j=await C.json();n(j)}catch(C){o(C instanceof Error?C.message:"Scan failed")}finally{s(!1)}},[f]),S=l.toLowerCase(),w=r.filter(C=>S?C.id.toLowerCase().includes(S)||C.displayName.toLowerCase().includes(S)||(C.description??"").toLowerCase().includes(S)||(C.author??"").toLowerCase().includes(S):!0);return i&&r.length===0?c.jsx(tn,{className:"p-5",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading extensions..."})}):c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsx(rl,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),c.jsx(Ln,{value:l,onChange:C=>d(C.target.value),placeholder:"Filter extensions...",className:"pl-9"})]}),c.jsxs(we,{variant:"outline",size:"sm",onClick:()=>void _(),disabled:i,children:[c.jsx(Js,{className:`mr-1.5 h-3.5 w-3.5 ${i?"animate-spin":""}`}),"Scan"]})]}),a&&c.jsxs(tn,{className:"flex items-start gap-2 border-destructive/50 bg-destructive/5 p-4",children:[c.jsx(na,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),c.jsx("p",{className:"text-sm text-destructive",children:a})]}),w.length===0&&!i&&c.jsxs(tn,{className:"p-8 text-center",children:[c.jsx(M2,{className:"mx-auto h-8 w-8 text-muted-foreground/40"}),c.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:r.length===0?"No extensions installed. Drop plugin folders into ~/.jait/extensions/ and click Scan.":"No extensions match your filter."})]}),w.map(C=>{const j=git[C.status],E=C.status==="enabled",A=u===C.id;return c.jsxs(tn,{className:"flex items-start gap-4 p-4",children:[c.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-muted",children:c.jsx(M2,{className:"h-5 w-5 text-muted-foreground"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium",children:C.displayName}),c.jsx(Or,{variant:j.variant,className:"text-2xs",children:j.label}),c.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",C.version]})]}),C.description&&c.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground line-clamp-2",children:C.description}),C.author&&c.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["by ",C.author]}),C.error&&c.jsx("p",{className:"mt-1 text-xs text-destructive",children:C.error}),c.jsx("p",{className:"mt-0.5 text-2xs text-muted-foreground/60 font-mono",children:C.id})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[c.jsx(gf,{checked:E,disabled:A,onCheckedChange:N=>void v(C.id,N),"aria-label":E?"Disable":"Enable"}),c.jsx(we,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",disabled:A,onClick:()=>void b(C.id),title:"Uninstall",children:c.jsx(Rl,{className:"h-4 w-4"})})]})]},C.id)})]})}function vit({token:e}){const[r,n]=y.useState([]),[i,s]=y.useState(!0),[a,o]=y.useState(null),l=Ece(e),d=y.useCallback(async()=>{s(!0),o(null);try{const u=await fetch(`${W_}/api/store/packages?limit=50`,{headers:l()});if(!u.ok)throw new Error(`Failed to browse ClawHub (HTTP ${u.status})`);const h=await u.json();n(h.items??[])}catch(u){o(u instanceof Error?u.message:"Failed to load marketplace")}finally{s(!1)}},[l]);return y.useEffect(()=>{d()},[d]),c.jsxs("div",{className:"space-y-4",children:[c.jsxs(tn,{className:"bg-muted/30 p-4 text-sm text-muted-foreground",children:["Browse OpenClaw plugins on"," ",c.jsx("a",{href:"https://clawhub.ai/plugins",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground",children:"ClawHub"}),". To install, download the plugin and place it in"," ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"~/.jait/extensions/"}),", then click Scan on the Installed tab."]}),a&&c.jsxs(tn,{className:"flex items-start gap-2 border-destructive/50 bg-destructive/5 p-4",children:[c.jsx(na,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),c.jsx("p",{className:"text-sm text-destructive",children:a})]}),i&&r.length===0&&c.jsxs(tn,{className:"flex items-center justify-center gap-2 p-8",children:[c.jsx(Ft,{className:"h-5 w-5 animate-spin text-muted-foreground"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading from ClawHub..."})]}),!i&&r.length===0&&c.jsxs(tn,{className:"p-8 text-center",children:[c.jsx(M2,{className:"mx-auto h-8 w-8 text-muted-foreground/40"}),c.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"No packages available."})]}),r.map((u,h)=>{const f=u.displayName??u.name??"Unknown",g=u.description??"",v=u.type??"plugin";return c.jsxs(tn,{className:"flex items-start gap-3 p-4",children:[c.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted",children:c.jsx(M2,{className:"h-4 w-4 text-muted-foreground"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium",children:f}),u.version&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",u.version]}),c.jsx(Or,{variant:"outline",className:"text-2xs",children:v})]}),c.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground line-clamp-2",children:g}),u.author&&c.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["by @",u.author]})]}),c.jsx("a",{href:`https://clawhub.ai/plugins/${encodeURIComponent(u.name??"")}`,target:"_blank",rel:"noopener noreferrer",children:c.jsxs(we,{variant:"outline",size:"sm",className:"h-7 text-xs",children:[c.jsx(jp,{className:"mr-1 h-3 w-3"}),"View"]})})]},u.name??h)})]})}function xit({token:e}){return c.jsxs(Y0,{defaultValue:"installed",className:"space-y-4",children:[c.jsxs(tn,{className:"space-y-3 p-5",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:"Extensions"}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:["Manage plugins and extensions. Browse the"," ",c.jsx("a",{href:"https://clawhub.ai/plugins",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground",children:"ClawHub"})," ","marketplace or drop plugins into"," ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"~/.jait/extensions/"}),"."]})]}),c.jsxs(ag,{children:[c.jsx(Qs,{value:"installed",children:"Installed"}),c.jsx(Qs,{value:"marketplace",children:"Marketplace"})]})]}),c.jsx(ea,{value:"installed",className:"mt-0 space-y-4",children:c.jsx(yit,{token:e})}),c.jsx(ea,{value:"marketplace",className:"mt-0 space-y-4",children:c.jsx(vit,{token:e})})]})}const w2=qn();function vU(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}const xU={bundled:{variant:"default",label:"bundled"},user:{variant:"secondary",label:"user"},project:{variant:"outline",label:"project"},plugin:{variant:"secondary",label:"plugin"}};function Ace(e){return y.useCallback(()=>{const r={"Content-Type":"application/json"};return e&&(r.Authorization=`Bearer ${e}`),r},[e])}function bit({token:e}){const[r,n]=y.useState([]),[i,s]=y.useState(!0),[a,o]=y.useState(null),[l,d]=y.useState(""),[u,h]=y.useState(null),[f,g]=y.useState(null),v=Ace(e),b=y.useCallback(async()=>{s(!0),o(null);try{const j=await fetch(`${w2}/api/skills`,{headers:v()});if(!j.ok)throw new Error(`Failed to load skills (HTTP ${j.status})`);const E=await j.json();n(E)}catch(j){o(j instanceof Error?j.message:"Failed to load skills")}finally{s(!1)}},[v]);y.useEffect(()=>{b()},[b]);const _=y.useCallback(async(j,E)=>{h(j);try{const A=await fetch(`${w2}/api/skills/${encodeURIComponent(j)}`,{method:"PATCH",headers:v(),body:JSON.stringify({enabled:E})});if(!A.ok)throw new Error(`Failed to update skill (HTTP ${A.status})`);n(N=>N.map(R=>R.id===j?{...R,enabled:E}:R))}catch(A){o(A instanceof Error?A.message:"Action failed")}finally{h(null)}},[v]),S=y.useCallback(async j=>{g(j),o(null);try{const E=await fetch(`${w2}/api/skills/${encodeURIComponent(j)}/install-tool`,{method:"POST",headers:v(),body:JSON.stringify({})}),A=await E.json().catch(()=>({}));if(!E.ok)throw new Error(A.error??`Install failed (HTTP ${E.status})`);const N=A.skill;N?n(R=>R.map(B=>B.id===j?N:B)):await b()}catch(E){o(E instanceof Error?E.message:"Install failed")}finally{g(null)}},[v,b]),w=l.toLowerCase(),C=r.filter(j=>w?j.id.toLowerCase().includes(w)||j.name.toLowerCase().includes(w)||j.description.toLowerCase().includes(w)||j.source.includes(w):!0);return i&&r.length===0?c.jsx(tn,{className:"p-5",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading skills..."})}):c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"relative",children:[c.jsx(rl,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),c.jsx(Ln,{value:l,onChange:j=>d(j.target.value),placeholder:"Filter installed skills...",className:"pl-9"})]}),a&&c.jsxs(tn,{className:"flex items-start gap-2 border-destructive/50 bg-destructive/5 p-4",children:[c.jsx(na,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),c.jsx("p",{className:"text-sm text-destructive",children:a})]}),C.length===0&&!i&&c.jsxs(tn,{className:"p-8 text-center",children:[c.jsx(H5,{className:"mx-auto h-8 w-8 text-muted-foreground/40"}),c.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:r.length===0?"No skills discovered. Install from the Marketplace or create a SKILL.md in ~/.jait/skills/.":"No skills match your filter."})]}),C.map(j=>{var N;const E=xU[j.source]??xU.user,A=u===j.id;return c.jsxs(tn,{className:"flex items-start gap-3 p-4",children:[c.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted",children:c.jsx(H5,{className:"h-4 w-4 text-muted-foreground"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium",children:j.name}),c.jsx(Or,{variant:E.variant,className:"text-2xs",children:E.label})]}),c.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground line-clamp-2",children:j.description}),c.jsx("p",{className:"mt-0.5 text-2xs text-muted-foreground/60 font-mono truncate",children:j.filePath}),j.missingTools&&j.missingTools.length>0&&c.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[c.jsxs("span",{className:"flex items-center gap-1 text-2xs text-amber-600 dark:text-amber-500",children:[c.jsx(na,{className:"h-3 w-3"}),"Needs: ",j.missingTools.join(", ")]}),j.install&&j.install.length>0&&c.jsxs(we,{size:"sm",variant:"outline",disabled:f===j.id,onClick:()=>void S(j.id),className:"h-6 text-2xs",children:[f===j.id?c.jsx(Ft,{className:"mr-1 h-3 w-3 animate-spin"}):c.jsx(gp,{className:"mr-1 h-3 w-3"}),((N=j.install[0])==null?void 0:N.label)??"Install tool"]})]})]}),c.jsx(gf,{checked:j.enabled,disabled:A,onCheckedChange:R=>void _(j.id,R),"aria-label":j.enabled?"Disable":"Enable",className:"shrink-0"})]},j.id)})]})}function _it({token:e}){const[r,n]=y.useState([]),[i,s]=y.useState(!0),[a,o]=y.useState(null),[l,d]=y.useState(""),[u,h]=y.useState("tool workflow agent"),[f,g]=y.useState(null),v=y.useRef(null),b=Ace(e),_=y.useCallback(async(C,j)=>{s(!0),o(null);try{const E=new URLSearchParams;C?E.set("q",C):E.set("sort",j??"tool workflow agent"),E.set("limit","25");const A=await fetch(`${w2}/api/store/skills?${E}`,{headers:b()});if(!A.ok)throw new Error(`Failed to browse ClawHub (HTTP ${A.status})`);const N=await A.json();n(N.results??[])}catch(E){o(E instanceof Error?E.message:"Failed to load marketplace")}finally{s(!1)}},[b]);y.useEffect(()=>{_(void 0,u)},[_,u]);const S=y.useCallback(C=>{d(C),v.current&&clearTimeout(v.current),v.current=setTimeout(()=>{_(C||void 0,u)},400)},[_,u]),w=y.useCallback(async C=>{g(C),o(null);try{const j=await fetch(`${w2}/api/store/skills/${encodeURIComponent(C)}/install`,{method:"POST",headers:b(),body:JSON.stringify({})});if(!j.ok){const E=await j.json().catch(()=>({}));throw new Error(E.error??`Install failed (HTTP ${j.status})`)}n(E=>E.map(A=>A.slug===C?{...A,installed:!0}:A))}catch(j){o(j instanceof Error?j.message:"Install failed")}finally{g(null)}},[b]);return c.jsxs("div",{className:"space-y-4",children:[c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsx(rl,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),c.jsx(Ln,{value:l,onChange:C=>S(C.target.value),placeholder:"Search ClawHub skills...",className:"pl-9"})]}),c.jsxs("select",{value:u,onChange:C=>h(C.target.value),className:"h-9 rounded-md border bg-background px-3 text-sm",children:[c.jsx("option",{value:"tool workflow agent",children:"Popular"}),c.jsx("option",{value:"memory learning self-improving",children:"Memory"}),c.jsx("option",{value:"search web browser automation",children:"Search"}),c.jsx("option",{value:"git github code development",children:"Development"}),c.jsx("option",{value:"calendar slack obsidian productivity",children:"Productivity"})]})]}),a&&c.jsxs(tn,{className:"flex items-start gap-2 border-destructive/50 bg-destructive/5 p-4",children:[c.jsx(na,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),c.jsx("p",{className:"text-sm text-destructive",children:a})]}),i&&r.length===0&&c.jsxs(tn,{className:"flex items-center justify-center gap-2 p-8",children:[c.jsx(Ft,{className:"h-5 w-5 animate-spin text-muted-foreground"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading from ClawHub..."})]}),!i&&r.length===0&&c.jsxs(tn,{className:"p-8 text-center",children:[c.jsx(rl,{className:"mx-auto h-8 w-8 text-muted-foreground/40"}),c.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:l?"No skills match your search.":"No skills available."})]}),r.map(C=>{var z,W,I;const j=C.slug??"",E=C.displayName??j,A=C.summary??"",N=((z=C.latestVersion)==null?void 0:z.version)??C.version??"",R=((W=C.stats)==null?void 0:W.stars)??0,B=((I=C.stats)==null?void 0:I.downloads)??0,G=C.installed===!0,H=f===j;return c.jsxs(tn,{className:"flex items-start gap-3 p-4",children:[c.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-muted",children:c.jsx(H5,{className:"h-4 w-4 text-muted-foreground"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium",children:E}),N&&c.jsxs("span",{className:"text-xs text-muted-foreground",children:["v",N]})]}),c.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground line-clamp-2",children:A}),c.jsxs("div",{className:"mt-1 flex items-center gap-3 text-xs text-muted-foreground",children:[R>0&&c.jsxs("span",{className:"flex items-center gap-0.5",children:[c.jsx(kve,{className:"h-3 w-3"}),vU(R)]}),B>0&&c.jsxs("span",{className:"flex items-center gap-0.5",children:[c.jsx(gp,{className:"h-3 w-3"}),vU(B)]}),c.jsxs("a",{href:`https://clawhub.ai/skills?focus=search&q=${encodeURIComponent(j)}`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-0.5 hover:text-foreground",children:[c.jsx(jp,{className:"h-3 w-3"}),"ClawHub"]})]})]}),c.jsx("div",{className:"shrink-0",children:G?c.jsxs(Or,{variant:"secondary",className:"flex items-center gap-1 text-2xs",children:[c.jsx(ms,{className:"h-3 w-3"}),"Installed"]}):c.jsxs(we,{size:"sm",variant:"outline",disabled:H,onClick:()=>void w(j),className:"h-7 text-xs",children:[H?c.jsx(Ft,{className:"mr-1 h-3 w-3 animate-spin"}):c.jsx(gp,{className:"mr-1 h-3 w-3"}),"Install"]})})]},j)})]})}function wit({token:e}){return c.jsxs(Y0,{defaultValue:"installed",className:"space-y-4",children:[c.jsxs(tn,{className:"space-y-3 p-5",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:"Skills"}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:["Specialized instruction sets that teach the AI how to use specific tools and workflows. Install from"," ",c.jsx("a",{href:"https://clawhub.ai/skills",target:"_blank",rel:"noopener noreferrer",className:"underline hover:text-foreground",children:"ClawHub"})," ","or place SKILL.md files in"," ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"~/.jait/skills/"}),"."]})]}),c.jsxs(ag,{children:[c.jsx(Qs,{value:"installed",children:"Installed"}),c.jsx(Qs,{value:"marketplace",children:"Marketplace"})]})]}),c.jsx(ea,{value:"installed",className:"mt-0 space-y-4",children:c.jsx(bit,{token:e})}),c.jsx(ea,{value:"marketplace",className:"mt-0 space-y-4",children:c.jsx(_it,{token:e})})]})}const U_=qn();function V_(e){return e?{Authorization:`Bearer ${e}`}:{}}const Sit={stopped:{label:"Disconnected",variant:"outline"},connecting:{label:"Connecting…",variant:"secondary"},qr:{label:"Scan QR to link",variant:"secondary"},connected:{label:"Connected",variant:"default"},error:{label:"Error",variant:"destructive"}};function kit(e){return e.id==="whatsapp"?"Link your WhatsApp so the assistant can reply to messages. Scan the QR with WhatsApp Linked devices.":e.id==="msteams"?"Connect a Microsoft Teams bot so the assistant can reply to Teams conversations.":"Connect this messaging channel so the assistant can reply through it."}function Cit({token:e,channel:r,onChanged:n}){const[i,s]=y.useState(!1),[a,o]=y.useState(null),[l,d]=y.useState(r.qr),[u,h]=y.useState(r.status),[f,g]=y.useState(),[v,b]=y.useState((r.config.allowedSenders??[]).join(", ")),[_,S]=y.useState(!!r.config.respondToAll),w=y.useRef(null),C=y.useCallback(()=>{w.current&&(clearInterval(w.current),w.current=null)},[]);y.useEffect(()=>{if(u!=="qr"&&u!=="connecting"){C();return}if(!w.current)return w.current=setInterval(async()=>{try{const B=await fetch(`${U_}/api/channels/${r.id}/status`,{headers:V_(e)});if(!B.ok)return;const G=await B.json();h(G.status),d(G.qr),g(G.error),G.status==="connected"&&(C(),n()),G.status==="error"&&C()}catch{}},2e3),C},[u,r.id,e,C,n]),y.useEffect(()=>()=>C(),[C]);const j=y.useCallback(async()=>{s(!0),o(null);try{const B=await fetch(`${U_}/api/channels/${r.id}/start`,{method:"POST",headers:V_(e)}),G=await B.json().catch(()=>({}));if(!B.ok)throw new Error(G.error??`Failed to start (HTTP ${B.status})`);h(G.status??"connecting"),d(G.qr??null)}catch(B){o(B instanceof Error?B.message:"Failed to start")}finally{s(!1)}},[r.id,e]),E=y.useCallback(async()=>{s(!0),o(null);try{const B=await fetch(`${U_}/api/channels/${r.id}/stop`,{method:"POST",headers:V_(e)});if(!B.ok)throw new Error(`Failed to stop (HTTP ${B.status})`);h("stopped"),d(null),C()}catch(B){o(B instanceof Error?B.message:"Failed to stop")}finally{s(!1)}},[r.id,e,C]),A=y.useCallback(async()=>{s(!0),o(null);try{const B=v.split(",").map(H=>H.trim()).filter(Boolean),G=await fetch(`${U_}/api/channels/${r.id}/config`,{method:"PATCH",headers:{...V_(e),"Content-Type":"application/json"},body:JSON.stringify({allowedSenders:B,respondToAll:_})});if(!G.ok)throw new Error(`Failed to save (HTTP ${G.status})`)}catch(B){o(B instanceof Error?B.message:"Failed to save")}finally{s(!1)}},[v,_,r.id,e]),N=Sit[u],R=u==="qr";return c.jsxs(tn,{className:"space-y-4 p-5",children:[c.jsxs("div",{className:"flex items-start gap-3",children:[c.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",children:c.jsx(w1e,{className:"h-5 w-5"})}),c.jsxs("div",{className:"min-w-0 flex-1",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"font-medium",children:r.label}),c.jsx(Or,{variant:N.variant,className:"text-2xs",children:N.label})]}),c.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground",children:kit(r)})]}),c.jsx("div",{className:"shrink-0",children:u==="connected"?c.jsxs(we,{size:"sm",variant:"outline",disabled:i,onClick:()=>void E(),className:"h-8 text-xs",children:[i?c.jsx(Ft,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):c.jsx(Z1e,{className:"mr-1 h-3.5 w-3.5"}),"Disconnect"]}):c.jsxs(we,{size:"sm",disabled:i,onClick:()=>void j(),className:"h-8 text-xs",children:[i?c.jsx(Ft,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):c.jsx(kY,{className:"mr-1 h-3.5 w-3.5"}),u==="qr"||u==="connecting"?"Restart":"Connect"]})})]}),(a||f)&&c.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-destructive/50 bg-destructive/5 p-3 text-sm text-destructive",children:[c.jsx(na,{className:"mt-0.5 h-4 w-4 shrink-0"}),c.jsx("span",{children:a??f})]}),R&&c.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border bg-muted/30 p-5",children:[l?c.jsx("img",{src:l,alt:`${r.label} link QR code`,className:"h-56 w-56 rounded bg-white p-2"}):c.jsx("div",{className:"flex h-56 w-56 items-center justify-center",children:c.jsx(Ft,{className:"h-6 w-6 animate-spin text-muted-foreground"})}),c.jsxs("p",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[c.jsx(Js,{className:"h-3 w-3"})," QR refreshes automatically — scan it with your phone."]})]}),u==="connected"&&c.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-emerald-500/40 bg-emerald-500/5 p-3 text-sm text-emerald-700 dark:text-emerald-400",children:[c.jsx(ia,{className:"h-4 w-4"})," Linked. The assistant will reply based on the rules below."]}),c.jsxs("div",{className:"space-y-3 border-t pt-4",children:[c.jsxs("div",{className:"flex items-center justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-sm font-medium",children:"Respond to everyone"}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"When off, replies only to your self-chat and the allowed numbers below."})]}),c.jsx(gf,{checked:_,onCheckedChange:S})]}),c.jsxs("div",{children:[c.jsx("label",{className:"mb-1 block text-sm font-medium",children:"Allowed senders"}),c.jsx(Ln,{value:v,onChange:B=>b(B.target.value),placeholder:"e.g. +49170…, +1202… (comma-separated, blank = self-chat only)"})]}),c.jsx(we,{size:"sm",variant:"outline",disabled:i,onClick:()=>void A(),className:"h-8 text-xs",children:"Save rules"})]})]})}function jit({token:e}){const[r,n]=y.useState([]),[i,s]=y.useState(!0),[a,o]=y.useState(null),l=y.useCallback(async()=>{s(!0),o(null);try{const d=await fetch(`${U_}/api/channels`,{headers:V_(e)});if(!d.ok)throw new Error(`Failed to load channels (HTTP ${d.status})`);n(await d.json())}catch(d){o(d instanceof Error?d.message:"Failed to load channels")}finally{s(!1)}},[e]);return y.useEffect(()=>{l()},[l]),c.jsxs("div",{className:"space-y-4",children:[c.jsxs(tn,{className:"space-y-1 p-5",children:[c.jsx("h2",{className:"text-base font-medium",children:"Channels"}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect external messaging apps so your assistant can chat through them."})]}),a&&c.jsxs(tn,{className:"flex items-start gap-2 border-destructive/50 bg-destructive/5 p-4",children:[c.jsx(na,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),c.jsx("p",{className:"text-sm text-destructive",children:a})]}),i&&r.length===0?c.jsx(tn,{className:"p-5",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading channels…"})}):r.length===0?c.jsx(tn,{className:"p-5",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"No channel extensions are enabled. Enable one in Extensions, then connect it here."})}):r.map(d=>c.jsx(Cit,{token:e,channel:d,onChanged:l},d.id))]})}function Nit({events:e}){return c.jsx(Jc,{className:"h-full w-full",children:c.jsx("div",{className:"p-4 space-y-2",children:e.length===0?c.jsx("p",{className:"text-sm text-muted-foreground",children:"No activity yet."}):e.map(r=>c.jsxs("div",{className:"rounded-md border p-3",children:[c.jsxs("div",{className:"flex items-center justify-between gap-2",children:[c.jsx("p",{className:"text-sm font-medium",children:r.title}),c.jsx("span",{className:"text-xs text-muted-foreground",children:r.source})]}),c.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:r.detail})]},r.id))})})}function s_(e){return e.replaceAll("&","&amp;").replaceAll("<","&lt;").replaceAll(">","&gt;").replaceAll('"',"&quot;").replaceAll("'","&#39;")}function Tit(e,r){const n=r.trim();if(!n)return s_(e);const i=e.toLowerCase(),s=n.toLowerCase();let a=0,o=i.indexOf(s);if(o===-1)return s_(e);let l="";for(;o!==-1;){o>a&&(l+=s_(e.slice(a,o)));const d=o+n.length;l+=`<mark class="rounded bg-yellow-200/80 px-0.5 text-inherit dark:bg-yellow-500/30">${s_(e.slice(o,d))}</mark>`,a=d,o=i.indexOf(s,a)}return a<e.length&&(l+=s_(e.slice(a))),l}var gx="Perplexity",Eit=.75,Ait=.2,Oce="#22B8CD",Oit=Oce,Mit="#000",Rit=.75;function aS(e){"@babel/helpers - typeof";return aS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},aS(e)}var Pit=["size","style"];function bU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function v8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?bU(Object(n),!0).forEach(function(i){Lit(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Lit(e,r,n){return r=$it(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function $it(e){var r=Dit(e,"string");return aS(r)=="symbol"?r:String(r)}function Dit(e,r){if(aS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(aS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Iit(e,r){if(e==null)return{};var n=Bit(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function Bit(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var iL=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=Iit(e,Pit);return c.jsxs("svg",v8(v8({fill:"currentColor",fillRule:"evenodd",height:n,style:v8({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:gx}),c.jsx("path",{d:"M19.785 0v7.272H22.5V17.62h-2.935V24l-7.037-6.194v6.145h-1.091v-6.152L4.392 24v-6.465H1.5V7.188h2.884V0l7.053 6.494V.19h1.09v6.49L19.786 0zm-7.257 9.044v7.319l5.946 5.234V14.44l-5.946-5.397zm-1.099-.08l-5.946 5.398v7.235l5.946-5.234V8.965zm8.136 7.58h1.844V8.349H13.46l6.105 5.54v2.655zm-8.982-8.28H2.59v8.195h1.8v-2.576l6.192-5.62zM5.475 2.476v4.71h5.115l-5.115-4.71zm13.219 0l-5.115 4.71h5.115v-4.71z"})]}))});function oS(e){"@babel/helpers - typeof";return oS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},oS(e)}function _U(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function zit(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?_U(Object(n),!0).forEach(function(i){Fit(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_U(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Fit(e,r,n){return r=Hit(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Hit(e){var r=Wit(e,"string");return oS(r)=="symbol"?r:String(r)}function Wit(e,r){if(oS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(oS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Uit(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var Vit=y.memo(function(e){var r=Object.assign({},(Uit(e),e));return c.jsx(_c,zit({Icon:iL,"aria-label":gx,background:Oit,color:Mit,iconMultiple:Rit},r))});function lS(e){"@babel/helpers - typeof";return lS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},lS(e)}var qit=["size","style"];function wU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function x8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?wU(Object(n),!0).forEach(function(i){Git(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Git(e,r,n){return r=Kit(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Kit(e){var r=Yit(e,"string");return lS(r)=="symbol"?r:String(r)}function Yit(e,r){if(lS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(lS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Xit(e,r){if(e==null)return{};var n=Jit(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function Jit(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Mce=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=Xit(e,qit);return c.jsxs("svg",x8(x8({height:n,style:x8({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:gx}),c.jsx("path",{d:"M19.785 0v7.272H22.5V17.62h-2.935V24l-7.037-6.194v6.145h-1.091v-6.152L4.392 24v-6.465H1.5V7.188h2.884V0l7.053 6.494V.19h1.09v6.49L19.786 0zm-7.257 9.044v7.319l5.946 5.234V14.44l-5.946-5.397zm-1.099-.08l-5.946 5.398v7.235l5.946-5.234V8.965zm8.136 7.58h1.844V8.349H13.46l6.105 5.54v2.655zm-8.982-8.28H2.59v8.195h1.8v-2.576l6.192-5.62zM5.475 2.476v4.71h5.115l-5.115-4.71zm13.219 0l-5.115 4.71h5.115v-4.71z",fill:"#22B8CD",fillRule:"nonzero"})]}))});function cS(e){"@babel/helpers - typeof";return cS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},cS(e)}var Zit=["size","style"];function SU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function b8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?SU(Object(n),!0).forEach(function(i){Qit(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):SU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Qit(e,r,n){return r=est(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function est(e){var r=tst(e,"string");return cS(r)=="symbol"?r:String(r)}function tst(e,r){if(cS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(cS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function rst(e,r){if(e==null)return{};var n=nst(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function nst(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Rce=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=rst(e,Zit);return c.jsxs("svg",b8(b8({fill:"currentColor",fillRule:"evenodd",height:n,style:b8({flex:"none",lineHeight:1},i),viewBox:"0 0 117 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:gx}),c.jsx("path",{d:"M38.542 5.218h1.151V7.59h-1.49c-1.167 0-2.036.281-2.612.843-.575.563-.863 1.485-.863 2.768v7.773h-2.351V5.271h2.351v2.187c0 .123.062.185.184.185.069 0 .121-.017.157-.053a.58.58 0 00.104-.211c.453-1.44 1.577-2.16 3.371-2.16h-.002zm15.36 2.938c.617 1.098.928 2.42.928 3.966 0 1.545-.309 2.867-.928 3.965-.62 1.098-1.42 1.92-2.404 2.464a6.446 6.446 0 01-3.174.817c-2.23 0-3.797-.896-4.703-2.688-.069-.14-.157-.211-.262-.211-.105 0-.157.052-.157.158v7.352h-2.351V5.271h2.351v2.345c0 .106.052.159.157.159.105 0 .191-.07.262-.211.906-1.793 2.473-2.689 4.703-2.689 1.132 0 2.19.272 3.174.817.984.545 1.785 1.366 2.404 2.464zm-1.424 3.966c0-1.617-.43-2.877-1.292-3.781-.862-.904-1.998-1.357-3.41-1.357-1.413 0-2.548.453-3.41 1.357-.863.905-1.179 2.166-1.179 3.78 0 1.616.316 2.878 1.178 3.782.863.905 2 1.356 3.41 1.356 1.411 0 2.549-.453 3.411-1.356.862-.904 1.292-2.166 1.292-3.781zM15.05 8.177c.618 1.098.928 2.42.928 3.965 0 1.546-.308 2.868-.928 3.966-.619 1.098-1.42 1.919-2.403 2.464a6.448 6.448 0 01-3.175.817c-2.23 0-3.797-.896-4.702-2.688-.07-.14-.158-.212-.262-.212-.105 0-.158.053-.158.159V24H2V5.292h2.351v2.345c0 .106.053.159.158.159.104 0 .19-.07.261-.212.906-1.792 2.473-2.688 4.703-2.688 1.132 0 2.19.272 3.175.817.983.545 1.784 1.366 2.403 2.464h-.002zm-1.423 3.965c0-1.616-.43-2.877-1.293-3.78-.862-.904-1.998-1.357-3.41-1.357-1.412 0-2.548.453-3.41 1.357-.862.905-1.178 2.165-1.178 3.78 0 1.615.316 2.878 1.178 3.781.862.906 1.998 1.357 3.41 1.357 1.412 0 2.548-.453 3.41-1.357.863-.903 1.293-2.166 1.293-3.78zm14.422 2.481h2.482c-.33 1.283-1.006 2.395-2.023 3.334-1.02.94-2.479 1.41-4.378 1.41-1.429 0-2.686-.295-3.775-.884a6.13 6.13 0 01-2.521-2.516c-.593-1.089-.889-2.372-.889-3.847 0-1.476.288-2.758.863-3.847.574-1.089 1.38-1.928 2.417-2.517 1.036-.588 2.25-.883 3.644-.883 1.393 0 2.547.29 3.514.87.968.58 1.69 1.349 2.168 2.305.48.959.719 2.008.719 3.15v1.58H19.427c.086 1.37.544 2.46 1.37 3.268.828.807 1.939 1.213 3.332 1.213 1.132 0 2-.232 2.6-.698.601-.466 1.04-1.111 1.32-1.938zm-8.595-3.82h8.204c0-1.194-.305-2.13-.914-2.807-.61-.676-1.568-1.015-2.874-1.015-1.22 0-2.217.33-2.99.988-.775.659-1.25 1.604-1.424 2.832l-.002.002zm37.238 8.17h2.352V0H56.69v18.974-.002zM89.316 3.774h2.747V.81h-2.747v2.966zm9.688 13.156c-.426.043-.684.066-.77.066a.39.39 0 01-.289-.106.395.395 0 01-.104-.29c0-.087.022-.348.065-.778.043-.43.066-1.094.066-1.988V7.279h3.354l-.66-2.008h-2.692v-3.69h-2.352v3.688h-2.557v2.008h2.557v7.214c0 1.512.367 2.636 1.098 3.374.732.737 1.846 1.107 3.345 1.107h1.83v-2.107h-.915c-.889 0-1.547.022-1.974.066h-.002zm13.759-11.662l-3.893 11.498c-.053.141-.135.326-.402.326-.268 0-.35-.185-.402-.326l-3.893-11.498h-2.398l4.508 13.703h1.594a.81.81 0 01.235.026c.053.017.096.06.131.133.07.105.06.264-.026.473l-.731 2.002c-.105.264-.305.396-.6.396-.106 0-.349-.023-.732-.066a13.71 13.71 0 00-1.49-.066h-1.907v2.107h2.508c1.463 0 2.344-.25 3.102-.75.757-.5 1.345-1.383 1.764-2.65L115 5.795v-.526h-2.237v.001zm-31.127 5.113L77.953 5.27h-2.588v.527l4.415 5.93-5.382 6.72v.526h2.64l4.285-5.507 3.998 5.507h2.535v-.526l-4.677-6.324 5.07-6.298v-.553h-2.64l-3.971 5.113-.002-.002zm7.931 8.59h2.351v-13.7h-2.35v13.702-.002zm-15.062-4.349c-.331 1.283-1.006 2.395-2.024 3.334-1.02.94-2.479 1.41-4.377 1.41-1.43 0-2.686-.295-3.775-.884a6.13 6.13 0 01-2.522-2.516c-.593-1.089-.888-2.372-.888-3.847 0-1.476.288-2.758.862-3.847.574-1.089 1.38-1.928 2.417-2.517 1.036-.588 2.25-.883 3.644-.883 1.394 0 2.547.29 3.515.87.967.58 1.689 1.349 2.168 2.305.479.959.718 2.008.718 3.15v1.58H63.401c.086 1.37.544 2.46 1.371 3.268.827.807 1.938 1.213 3.332 1.213 1.132 0 2-.232 2.6-.698.6-.466 1.04-1.111 1.319-1.938h2.482zm-11.078-3.82h8.205c0-1.194-.305-2.13-.915-2.807-.61-.676-1.568-1.015-2.873-1.015-1.22 0-2.217.33-2.991.988-.775.659-1.25 1.604-1.424 2.832l-.002.002z"})]}))});function uS(e){"@babel/helpers - typeof";return uS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},uS(e)}var ist=["type"];function kU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function sst(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?kU(Object(n),!0).forEach(function(i){ast(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function ast(e,r,n){return r=ost(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function ost(e){var r=lst(e,"string");return uS(r)=="symbol"?r:String(r)}function lst(e,r){if(uS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(uS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function cst(e,r){if(e==null)return{};var n=ust(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function ust(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var dst=y.memo(function(e){var r=e.type,n=r===void 0?"mono":r,i=cst(e,ist),s=n==="color"?Mce:iL;return c.jsx(wc,sst({Icon:s,Text:Rce,"aria-label":gx,spaceMultiple:Ait,textMultiple:Eit},i))}),Ey=iL;Ey.Color=Mce;Ey.Text=Rce;Ey.Combine=dst;Ey.Avatar=Vit;Ey.colorPrimary=Oce;Ey.title=gx;var kk="OpenRouter",hst=1,fst=.4,sL="#6566F1",pst=sL,mst="#fff",gst=.75;function dS(e){"@babel/helpers - typeof";return dS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},dS(e)}var yst=["size","style"];function CU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function _8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?CU(Object(n),!0).forEach(function(i){vst(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function vst(e,r,n){return r=xst(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function xst(e){var r=bst(e,"string");return dS(r)=="symbol"?r:String(r)}function bst(e,r){if(dS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(dS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function _st(e,r){if(e==null)return{};var n=wst(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function wst(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var aL=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=_st(e,yst);return c.jsxs("svg",_8(_8({fill:"currentColor",fillRule:"evenodd",height:n,style:_8({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:kk}),c.jsx("path",{d:"M16.804 1.957l7.22 4.105v.087L16.73 10.21l.017-2.117-.821-.03c-1.059-.028-1.611.002-2.268.11-1.064.175-2.038.577-3.147 1.352L8.345 11.03c-.284.195-.495.336-.68.455l-.515.322-.397.234.385.23.53.338c.476.314 1.17.796 2.701 1.866 1.11.775 2.083 1.177 3.147 1.352l.3.045c.694.091 1.375.094 2.825.033l.022-2.159 7.22 4.105v.087L16.589 22l.014-1.862-.635.022c-1.386.042-2.137.002-3.138-.162-1.694-.28-3.26-.926-4.881-2.059l-2.158-1.5a21.997 21.997 0 00-.755-.498l-.467-.28a55.927 55.927 0 00-.76-.43C2.908 14.73.563 14.116 0 14.116V9.888l.14.004c.564-.007 2.91-.622 3.809-1.124l1.016-.58.438-.274c.428-.28 1.072-.726 2.686-1.853 1.621-1.133 3.186-1.78 4.881-2.059 1.152-.19 1.974-.213 3.814-.138l.02-1.907z"})]}))});function hS(e){"@babel/helpers - typeof";return hS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},hS(e)}function jU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function Sst(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?jU(Object(n),!0).forEach(function(i){kst(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function kst(e,r,n){return r=Cst(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Cst(e){var r=jst(e,"string");return hS(r)=="symbol"?r:String(r)}function jst(e,r){if(hS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(hS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Nst(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var Tst=y.memo(function(e){var r=Object.assign({},(Nst(e),e));return c.jsx(_c,Sst({Icon:aL,"aria-label":kk,background:pst,color:mst,iconMultiple:gst},r))});function fS(e){"@babel/helpers - typeof";return fS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},fS(e)}var Est=["size","style"];function NU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function w8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?NU(Object(n),!0).forEach(function(i){Ast(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):NU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Ast(e,r,n){return r=Ost(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Ost(e){var r=Mst(e,"string");return fS(r)=="symbol"?r:String(r)}function Mst(e,r){if(fS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(fS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Rst(e,r){if(e==null)return{};var n=Pst(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function Pst(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Pce=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=Rst(e,Est);return c.jsxs("svg",w8(w8({fill:"currentColor",fillRule:"evenodd",height:n,style:w8({flex:"none",lineHeight:1},i),viewBox:"0 0 143 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:kk}),c.jsx("path",{d:"M9.623 2c1.46 0 2.763.35 3.91 1.05 1.149.699 2.053 1.7 2.714 3.002.66 1.303.991 2.861.991 4.675 0 1.814-.33 3.372-.991 4.675-.66 1.302-1.565 2.303-2.713 3.003-1.148.7-2.452 1.049-3.91 1.049-1.465 0-2.772-.35-3.92-1.05-1.148-.699-2.052-1.701-2.713-3.007-.66-1.305-.991-2.862-.991-4.67 0-1.814.33-3.372.991-4.675.66-1.302 1.565-2.303 2.713-3.003C6.852 2.35 8.16 2 9.624 2zm0 2.34c-.974 0-1.844.244-2.61.734-.765.489-1.37 1.208-1.813 2.156-.443.949-.664 2.114-.664 3.497s.221 2.548.664 3.497c.444.948 1.048 1.667 1.813 2.156.766.49 1.636.735 2.61.735.97 0 1.838-.245 2.606-.735.768-.489 1.374-1.208 1.817-2.156.443-.949.665-2.114.665-3.497s-.222-2.548-.665-3.497c-.443-.948-1.049-1.667-1.817-2.156-.768-.49-1.637-.735-2.606-.735zm16.32 1.974c1.024 0 1.938.26 2.742.78s1.436 1.269 1.896 2.248c.46.979.69 2.156.69 3.534 0 1.377-.23 2.556-.686 3.538-.457.981-1.085 1.736-1.883 2.264-.799.529-1.71.793-2.734.793-.771 0-1.4-.13-1.887-.39-.488-.26-.869-.564-1.144-.913a6.908 6.908 0 01-.636-.929h-.149V24h-2.47V6.48h2.412v2.065h.207c.143-.265.35-.572.62-.92.27-.349.643-.655 1.123-.917.479-.263 1.112-.394 1.9-.394zm-.528 2.107c-.716 0-1.32.185-1.813.556-.493.37-.866.887-1.12 1.55-.253.665-.38 1.439-.38 2.324 0 .896.13 1.68.389 2.356.259.674.633 1.201 1.123 1.58s1.09.568 1.8.568c.738 0 1.355-.198 1.85-.593.496-.395.872-.933 1.128-1.613.256-.68.384-1.447.384-2.298 0-.84-.125-1.596-.376-2.265-.25-.67-.625-1.197-1.123-1.584-.498-.388-1.12-.581-1.862-.581zm13.387-2.107c.716 0 1.41.119 2.082.356a5.037 5.037 0 011.809 1.12c.534.51.955 1.169 1.263 1.979.309.81.463 1.793.463 2.949v.88l-9.016-.001.002.105c.03.732.178 1.364.445 1.895.3.597.72 1.052 1.26 1.364.539.313 1.17.469 1.89.469.469 0 .895-.068 1.28-.203a2.716 2.716 0 001-.61c.281-.271.496-.606.644-1.004l2.338.423a4.247 4.247 0 01-1.004 1.813c-.482.517-1.084.918-1.808 1.203-.725.284-1.549.427-2.474.427-1.25 0-2.325-.27-3.225-.809-.9-.54-1.594-1.3-2.082-2.281-.487-.982-.73-2.134-.73-3.455 0-1.306.243-2.456.73-3.451.488-.996 1.17-1.773 2.049-2.331.878-.559 1.906-.838 3.084-.838zm.017 2.049c-.694 0-1.298.17-1.813.51-.515.34-.911.782-1.19 1.327a3.778 3.778 0 00-.39 1.303l-.02.236h6.593c0-.653-.132-1.232-.397-1.738a3.022 3.022 0 00-1.11-1.199c-.477-.293-1.034-.44-1.673-.44zm10.29 3.293v7.566H46.64V6.48h2.37v2.074h.158a3.63 3.63 0 011.375-1.626c.625-.41 1.413-.614 2.366-.614.864 0 1.622.18 2.271.543.65.362 1.154.9 1.512 1.614.358.713.537 1.595.537 2.646v8.105h-2.47v-7.806c0-.924-.24-1.647-.718-2.17-.48-.522-1.137-.784-1.974-.784-.573 0-1.081.125-1.524.374a2.65 2.65 0 00-1.05 1.09c-.255.479-.383 1.055-.383 1.73zm17.122-9.424c1.31 0 2.4.227 3.266.68.868.454 1.516 1.08 1.945 1.88.43.799.645 1.72.645 2.766 0 1.04-.216 1.954-.649 2.742-.432.788-1.082 1.4-1.949 1.837a5.1 5.1 0 01-.501.22l3.743 6.865h-2.907l-3.436-6.43h-3.634v6.43h-2.552V2.232h6.029zm-.273 2.199h-3.204v6.155h3.237c.826 0 1.5-.119 2.02-.357s.901-.583 1.144-1.037c.242-.453.363-.998.363-1.634 0-.641-.122-1.197-.367-1.667-.246-.47-.628-.831-1.148-1.083-.52-.252-1.202-.377-2.045-.377zM79.66 6.314c1.19 0 2.227.273 3.114.821.886.548 1.575 1.316 2.065 2.306s.735 2.146.735 3.468c0 1.316-.245 2.466-.735 3.45-.49.985-1.179 1.751-2.065 2.299-.887.547-1.924.82-3.114.82s-2.227-.273-3.113-.82c-.887-.548-1.575-1.314-2.065-2.298-.49-.985-.735-2.135-.735-3.451 0-1.322.245-2.478.735-3.468.49-.99 1.178-1.758 2.065-2.306.886-.548 1.924-.821 3.113-.821zm.008 2.074c-.776 0-1.419.207-1.928.622-.51.415-.887.963-1.132 1.646a6.602 6.602 0 00-.367 2.244c0 .819.122 1.568.367 2.249.245.68.623 1.225 1.132 1.634.51.41 1.152.614 1.928.614.771 0 1.41-.205 1.917-.614.506-.41.882-.954 1.127-1.634.245-.68.367-1.43.367-2.249 0-.813-.122-1.56-.367-2.244-.245-.683-.62-1.231-1.127-1.646-.507-.415-1.146-.622-1.917-.622zm16.164 5.55V6.48h2.477v12.742h-2.428v-2.207h-.132a3.956 3.956 0 01-1.4 1.697c-.641.45-1.438.676-2.391.676-.815 0-1.535-.181-2.16-.544-.625-.362-1.115-.9-1.47-1.613-.355-.714-.533-1.596-.533-2.647V6.48h2.47v7.806c0 .868.24 1.56.718 2.074.48.514 1.102.771 1.867.771.462 0 .924-.116 1.383-.348.46-.232.843-.584 1.148-1.054.306-.47.456-1.067.45-1.792zm8.58-10.511v3.052h2.602v1.992h-2.602v7.01c0 .48.072.841.215 1.082.144.24.33.404.558.49.228.085.478.128.747.128.199 0 .372-.014.52-.041l.348-.067.446 2.05a4.42 4.42 0 01-.612.17c-.264.057-.594.09-.99.095a4.331 4.331 0 01-1.818-.349 3.12 3.12 0 01-1.362-1.128c-.347-.509-.52-1.148-.52-1.916l-.002-7.525h-1.857V6.48h1.857l.001-3.053h2.47zm9.961 2.887c.716 0 1.41.119 2.081.356a5.037 5.037 0 011.81 1.12c.533.51.954 1.169 1.263 1.979.308.81.462 1.793.462 2.949v.88l-9.016-.001.003.105c.03.732.178 1.364.445 1.895.3.597.72 1.052 1.259 1.364.54.313 1.17.469 1.891.469.468 0 .895-.068 1.28-.203a2.716 2.716 0 001-.61c.28-.271.495-.606.644-1.004l2.337.423a4.247 4.247 0 01-1.003 1.813c-.482.517-1.085.918-1.809 1.203-.724.284-1.548.427-2.473.427-1.25 0-2.325-.27-3.226-.809-.9-.54-1.594-1.3-2.08-2.281-.488-.982-.732-2.134-.732-3.455 0-1.306.244-2.456.731-3.451.487-.996 1.17-1.773 2.048-2.331.879-.559 1.907-.838 3.085-.838zm.017 2.049c-.694 0-1.298.17-1.813.51-.515.34-.911.782-1.19 1.327a3.778 3.778 0 00-.39 1.303l-.02.236h6.592c0-.653-.132-1.232-.396-1.738a3.022 3.022 0 00-1.11-1.199c-.477-.293-1.035-.44-1.673-.44zm7.821 10.859V6.48h2.387v2.024h.132a3.092 3.092 0 011.227-1.622 3.485 3.485 0 011.994-.593l.396.01.153.006c.212.011.379.025.5.042v2.372c-.1-.027-.275-.059-.529-.095a5.4 5.4 0 00-.76-.054c-.583 0-1.102.123-1.556.37a2.799 2.799 0 00-1.078 1.02 2.79 2.79 0 00-.397 1.48v7.782h-2.469z"})]}))});function pS(e){"@babel/helpers - typeof";return pS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},pS(e)}var Lst=["type","iconProps"];function TU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function EU(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?TU(Object(n),!0).forEach(function(i){$st(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):TU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function $st(e,r,n){return r=Dst(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Dst(e){var r=Ist(e,"string");return pS(r)=="symbol"?r:String(r)}function Ist(e,r){if(pS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(pS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Bst(e,r){if(e==null)return{};var n=zst(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function zst(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Fst=y.memo(function(e){var r=e.type,n=r===void 0?"mono":r,i=e.iconProps,s=Bst(e,Lst);return c.jsx(wc,EU({Icon:aL,Text:Pce,"aria-label":kk,iconProps:EU({color:n==="color"?sL:void 0},i),spaceMultiple:fst,textMultiple:hst},s))}),yx=aL;yx.Text=Pce;yx.Combine=Fst;yx.Avatar=Tst;yx.colorPrimary=sL;yx.title=kk;var Ck="Grok",Hst=.75,Wst=.25,Lce="#fff",Ust=Lce,Vst="#000",qst=.65;function mS(e){"@babel/helpers - typeof";return mS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},mS(e)}var Gst=["size","style"];function AU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function S8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?AU(Object(n),!0).forEach(function(i){Kst(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):AU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Kst(e,r,n){return r=Yst(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Yst(e){var r=Xst(e,"string");return mS(r)=="symbol"?r:String(r)}function Xst(e,r){if(mS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(mS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Jst(e,r){if(e==null)return{};var n=Zst(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function Zst(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var $ce=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=Jst(e,Gst);return c.jsxs("svg",S8(S8({fill:"currentColor",fillRule:"evenodd",height:n,style:S8({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Ck}),c.jsx("path",{d:"M6.469 8.776L16.512 23h-4.464L2.005 8.776H6.47zm-.004 7.9l2.233 3.164L6.467 23H2l4.465-6.324zM22 2.582V23h-3.659V7.764L22 2.582zM22 1l-9.952 14.095-2.233-3.163L17.533 1H22z"})]}))});function gS(e){"@babel/helpers - typeof";return gS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},gS(e)}function OU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function Qst(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?OU(Object(n),!0).forEach(function(i){eat(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):OU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function eat(e,r,n){return r=tat(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function tat(e){var r=rat(e,"string");return gS(r)=="symbol"?r:String(r)}function rat(e,r){if(gS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(gS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function nat(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var Dce=y.memo(function(e){var r=Object.assign({},(nat(e),e));return c.jsx(_c,Qst({Icon:$ce,"aria-label":Ck,background:Ust,color:Vst,iconMultiple:qst},r))});function yS(e){"@babel/helpers - typeof";return yS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},yS(e)}var iat=["size","style"];function MU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function k8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?MU(Object(n),!0).forEach(function(i){sat(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):MU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function sat(e,r,n){return r=aat(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function aat(e){var r=oat(e,"string");return yS(r)=="symbol"?r:String(r)}function oat(e,r){if(yS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(yS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function lat(e,r){if(e==null)return{};var n=cat(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function cat(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Ice=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=lat(e,iat);return c.jsxs("svg",k8(k8({fill:"currentColor",fillRule:"evenodd",height:n,style:k8({flex:"none",lineHeight:1},i),viewBox:"0 0 41 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:Ck}),c.jsx("path",{d:"M36.867 2h2.577v20h-2.577V2zM23.875 2h2.717l7.759 20H31.55l-2.101-5.574h-8.571L18.777 22h-2.69l7.788-20zm4.79 12.185l-3.53-9.272-3.473 9.272h7.003zM7.35 14.381L2.504 7.518h2.857l3.446 5.126 3.585-5.126h2.605l-4.762 6.835L15.501 22h-2.829l-3.977-5.854L4.689 22H2l5.35-7.619z"})]}))});function vS(e){"@babel/helpers - typeof";return vS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},vS(e)}function RU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function uat(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?RU(Object(n),!0).forEach(function(i){dat(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):RU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function dat(e,r,n){return r=hat(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function hat(e){var r=fat(e,"string");return vS(r)=="symbol"?r:String(r)}function fat(e,r){if(vS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(vS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function pat(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var mat=y.memo(function(e){var r=Object.assign({},(pat(e),e));return c.jsx(wc,uat({Icon:Dce,Text:Ice,"aria-label":Ck,iconProps:{shape:"square"},spaceMultiple:Wst,textMultiple:Hst},r))}),vx=$ce;vx.Text=Ice;vx.Combine=mat;vx.Avatar=Dce;vx.colorPrimary=Lce;vx.title=Ck;var jk="MoonshotAI",gat=.75,yat=.4,Bce="#16191E",vat=Bce,xat="#fff",bat=.75;function xS(e){"@babel/helpers - typeof";return xS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},xS(e)}var _at=["size","style"];function PU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function C8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?PU(Object(n),!0).forEach(function(i){wat(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):PU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function wat(e,r,n){return r=Sat(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Sat(e){var r=kat(e,"string");return xS(r)=="symbol"?r:String(r)}function kat(e,r){if(xS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(xS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Cat(e,r){if(e==null)return{};var n=jat(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function jat(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var oL=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=Cat(e,_at);return c.jsxs("svg",C8(C8({fill:"currentColor",fillRule:"evenodd",height:n,style:C8({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:jk}),c.jsx("path",{d:"M1.052 16.916l9.539 2.552a21.007 21.007 0 00.06 2.033l5.956 1.593a11.997 11.997 0 01-5.586.865l-.18-.016-.044-.004-.084-.009-.094-.01a11.605 11.605 0 01-.157-.02l-.107-.014-.11-.016a11.962 11.962 0 01-.32-.051l-.042-.008-.075-.013-.107-.02-.07-.015-.093-.019-.075-.016-.095-.02-.097-.023-.094-.022-.068-.017-.088-.022-.09-.024-.095-.025-.082-.023-.109-.03-.062-.02-.084-.025-.093-.028-.105-.034-.058-.019-.08-.026-.09-.031-.066-.024a6.293 6.293 0 01-.044-.015l-.068-.025-.101-.037-.057-.022-.08-.03-.087-.035-.088-.035-.079-.032-.095-.04-.063-.028-.063-.027a5.655 5.655 0 01-.041-.018l-.066-.03-.103-.047-.052-.024-.096-.046-.062-.03-.084-.04-.086-.044-.093-.047-.052-.027-.103-.055-.057-.03-.058-.032a6.49 6.49 0 01-.046-.026l-.094-.053-.06-.034-.051-.03-.072-.041-.082-.05-.093-.056-.052-.032-.084-.053-.061-.039-.079-.05-.07-.047-.053-.035a7.785 7.785 0 01-.054-.036l-.044-.03-.044-.03a6.066 6.066 0 01-.04-.028l-.057-.04-.076-.054-.069-.05-.074-.054-.056-.042-.076-.057-.076-.059-.086-.067-.045-.035-.064-.052-.074-.06-.089-.073-.046-.039-.046-.039a7.516 7.516 0 01-.043-.037l-.045-.04-.061-.053-.07-.062-.068-.06-.062-.058-.067-.062-.053-.05-.088-.084a13.28 13.28 0 01-.099-.097l-.029-.028-.041-.042-.069-.07-.05-.051-.05-.053a6.457 6.457 0 01-.168-.179l-.08-.088-.062-.07-.071-.08-.042-.049-.053-.062-.058-.068-.046-.056a7.175 7.175 0 01-.027-.033l-.045-.055-.066-.082-.041-.052-.05-.064-.02-.025a11.99 11.99 0 01-1.44-2.402zm-1.02-5.794l11.353 3.037a20.468 20.468 0 00-.469 2.011l10.817 2.894a12.076 12.076 0 01-1.845 2.005L.657 15.923l-.016-.046-.035-.104a11.965 11.965 0 01-.05-.153l-.007-.023a11.896 11.896 0 01-.207-.741l-.03-.126-.018-.08-.021-.097-.018-.081-.018-.09-.017-.084-.018-.094c-.026-.141-.05-.283-.071-.426l-.017-.118-.011-.083-.013-.102a12.01 12.01 0 01-.019-.161l-.005-.047a12.12 12.12 0 01-.034-2.145zm1.593-5.15l11.948 3.196c-.368.605-.705 1.231-1.01 1.875l11.295 3.022c-.142.82-.368 1.612-.668 2.365l-11.55-3.09L.124 10.26l.015-.1.008-.049.01-.067.015-.087.018-.098c.026-.148.056-.295.088-.442l.028-.124.02-.085.024-.097c.022-.09.045-.18.07-.268l.028-.102.023-.083.03-.1.025-.082.03-.096.026-.082.031-.095a11.896 11.896 0 011.01-2.232zm4.442-4.4L17.352 4.59a20.77 20.77 0 00-1.688 1.721l7.823 2.093c.267.852.442 1.744.513 2.665L2.106 5.213l.045-.065.027-.04.04-.055.046-.065.055-.076.054-.072.064-.086.05-.065.057-.073.055-.07.06-.074.055-.069.065-.077.054-.066.066-.077.053-.06.072-.082.053-.06.067-.074.054-.058.073-.078.058-.06.063-.067.168-.17.1-.098.059-.056.076-.071a12.084 12.084 0 012.272-1.677zM12.017 0h.097l.082.001.069.001.054.002.068.002.046.001.076.003.047.002.06.003.054.002.087.005.105.007.144.011.088.007.044.004.077.008.082.008.047.005.102.012.05.006.108.014.081.01.042.006.065.01.207.032.07.012.065.011.14.026.092.018.11.022.046.01.075.016.041.01L14.7.3l.042.01.065.015.049.012.071.017.096.024.112.03.113.03.113.032.05.015.07.02.078.024.073.023.05.016.05.016.076.025.099.033.102.036.048.017.064.023.093.034.11.041.116.045.1.04.047.02.06.024.041.018.063.026.04.018.057.025.11.048.1.046.074.035.075.036.06.028.092.046.091.045.102.052.053.028.049.026.046.024.06.033.041.022.052.029.088.05.106.06.087.051.057.034.053.032.096.059.088.055.098.062.036.024.064.041.084.056.04.027.062.042.062.043.023.017c.054.037.108.075.161.114l.083.06.065.048.056.043.086.065.082.064.04.03.05.041.086.069.079.065.085.071c.712.6 1.353 1.283 1.909 2.031L7.222.994l.062-.027.065-.028.081-.034.086-.035c.113-.045.227-.09.341-.131l.096-.035.093-.033.084-.03.096-.031c.087-.03.176-.058.264-.085l.091-.027.086-.025.102-.03.085-.023.1-.026L9.04.37l.09-.023.091-.022.095-.022.09-.02.098-.021.091-.02.095-.018.092-.018.1-.018.091-.016.098-.017.092-.014.097-.015.092-.013.102-.013.091-.012.105-.012.09-.01.105-.01c.093-.01.186-.018.28-.024l.106-.008.09-.005.11-.006.093-.004.1-.004.097-.002.099-.002.197-.002z"})]}))});function bS(e){"@babel/helpers - typeof";return bS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},bS(e)}function LU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function Nat(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?LU(Object(n),!0).forEach(function(i){Tat(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):LU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Tat(e,r,n){return r=Eat(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Eat(e){var r=Aat(e,"string");return bS(r)=="symbol"?r:String(r)}function Aat(e,r){if(bS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(bS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Oat(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var Mat=y.memo(function(e){var r=Object.assign({},(Oat(e),e));return c.jsx(_c,Nat({Icon:oL,"aria-label":jk,background:vat,color:xat,iconMultiple:bat},r))});function _S(e){"@babel/helpers - typeof";return _S=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},_S(e)}var Rat=["size","style"];function $U(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function j8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?$U(Object(n),!0).forEach(function(i){Pat(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$U(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Pat(e,r,n){return r=Lat(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Lat(e){var r=$at(e,"string");return _S(r)=="symbol"?r:String(r)}function $at(e,r){if(_S(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(_S(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Dat(e,r){if(e==null)return{};var n=Iat(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function Iat(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var zce=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=Dat(e,Rat);return c.jsxs("svg",j8(j8({fill:"currentColor",fillRule:"evenodd",height:n,style:j8({flex:"none",lineHeight:1},i),viewBox:"0 0 171 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:jk}),c.jsx("path",{d:"M165.484 2H169v19.507h-3.516V2zm-35.707 0v5.26h3.186v3.507h-3.186v10.74h-3.516v-10.74h-2.966V7.26h2.966V2h3.516zm-24.598 11.023v8.498h-3.345v-8.804c.008-2.1-2.109-2.895-3.109-2.895l-.064.001c-1.073.026-3.521.694-3.54 3.863v7.835h-3.468V2.014L95.14 2v6.918c1.228-1.986 3.93-2.243 4.755-2.243.926 0 1.768.155 2.525.465.757.31 1.378.783 1.864 1.42.413.54.665 1.096.757 1.667.092.571.138 1.503.138 2.796zM89.29 9.507l-2.362 2.41c-2.911-2.41-6.647-2.136-7.196-.93-.55 1.205 2.444 1.484 4.734 1.98l.634.146c1.731.408 4.603 1.274 4.52 4.12-.11 3.78-4.23 4.767-6.867 4.767-2.637 0-5.933-1.808-7.636-3.342l2.527-2.63c2.582 2.63 7.142 2.958 7.856 1.534.714-1.425-1.263-1.48-4.834-1.973-3.175-.438-4.837-2.85-4.813-4.13.034-1.843 1.543-4.85 6.31-4.886 3.227-.025 5.425.961 7.127 2.934zm-22.617.386l-.033.001c-1.905.083-3.443 1.453-3.458 3.746v7.867h-3.83V7.185h3.702v2.061l.088-.12c.591-.8 2.07-2.555 4.796-2.523 2.675.032 5.696 1.95 5.696 5.17v9.734H69.69v-8.813c-.01-2.197-2.102-2.824-3.016-2.8zm-33.14-3.29c4.247 0 7.69 3.434 7.69 7.671s-3.443 7.671-7.69 7.671c-4.248 0-7.692-3.434-7.692-7.671s3.444-7.671 7.691-7.671zm0 3.726a3.95 3.95 0 00-3.956 3.945 3.95 3.95 0 003.955 3.945 3.95 3.95 0 003.956-3.945 3.95 3.95 0 00-3.956-3.945zm16.7-3.726c4.247 0 7.69 3.434 7.69 7.671s-3.443 7.671-7.69 7.671c-4.248 0-7.692-3.434-7.692-7.671s3.444-7.671 7.691-7.671zm0 3.726a3.95 3.95 0 00-3.956 3.945 3.95 3.95 0 003.955 3.945 3.95 3.95 0 003.956-3.945 3.95 3.95 0 00-3.956-3.945zm64.382-3.726c4.248 0 7.69 3.434 7.69 7.671s-3.442 7.671-7.69 7.671c-4.247 0-7.69-3.434-7.69-7.671s3.443-7.671 7.69-7.671zm0 3.726a3.95 3.95 0 00-3.955 3.945 3.95 3.95 0 003.955 3.945 3.95 3.95 0 003.955-3.945 3.95 3.95 0 00-3.955-3.945zM2 21.616V2l10.987 7.89L23.919 2v19.616h-3.79V9.452l-7.17 5.26-7.169-5.26v12.164H2zM153.344 2l10.492 19.507h-4.138l-1.833-3.288h-5.235l-1.789-3.46-3.632 6.748h-4.358L153.344 2zm0 8.11l-2.478 4.602h5.044l-2.566-4.602z"})]}))});function wS(e){"@babel/helpers - typeof";return wS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},wS(e)}function DU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function Bat(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?DU(Object(n),!0).forEach(function(i){zat(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):DU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function zat(e,r,n){return r=Fat(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Fat(e){var r=Hat(e,"string");return wS(r)=="symbol"?r:String(r)}function Hat(e,r){if(wS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(wS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Wat(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var Uat=y.memo(function(e){var r=Object.assign({},(Wat(e),e));return c.jsx(wc,Bat({Icon:oL,Text:zce,"aria-label":jk,spaceMultiple:yat,textMultiple:gat},r))}),xx=oL;xx.Text=zce;xx.Combine=Uat;xx.Avatar=Mat;xx.colorPrimary=Bce;xx.title=jk;var bx="Kimi",Vat=.7,qat=.25,Fce="#000",Gat=Fce,Kat="#fff",Yat=.6;function SS(e){"@babel/helpers - typeof";return SS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},SS(e)}var Xat=["size","style"];function IU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function N8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?IU(Object(n),!0).forEach(function(i){Jat(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):IU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function Jat(e,r,n){return r=Zat(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function Zat(e){var r=Qat(e,"string");return SS(r)=="symbol"?r:String(r)}function Qat(e,r){if(SS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(SS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function eot(e,r){if(e==null)return{};var n=tot(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function tot(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Hce=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=eot(e,Xat);return c.jsxs("svg",N8(N8({height:n,style:N8({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:bx}),c.jsx("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z",fill:"#1783FF"}),c.jsx("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z",fill:"#fff"})]}))});function kS(e){"@babel/helpers - typeof";return kS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},kS(e)}function BU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function rot(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?BU(Object(n),!0).forEach(function(i){not(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):BU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function not(e,r,n){return r=iot(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function iot(e){var r=sot(e,"string");return kS(r)=="symbol"?r:String(r)}function sot(e,r){if(kS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(kS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function aot(e){if(e==null)throw new TypeError("Cannot destructure "+e)}var Wce=y.memo(function(e){var r=Object.assign({},(aot(e),e));return c.jsx(_c,rot({Icon:Hce,"aria-label":bx,background:Gat,color:Kat,iconMultiple:Yat},r))});function CS(e){"@babel/helpers - typeof";return CS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},CS(e)}var oot=["size","style"];function zU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function T8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?zU(Object(n),!0).forEach(function(i){lot(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function lot(e,r,n){return r=cot(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function cot(e){var r=uot(e,"string");return CS(r)=="symbol"?r:String(r)}function uot(e,r){if(CS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(CS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function dot(e,r){if(e==null)return{};var n=hot(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function hot(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var Uce=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=dot(e,oot);return c.jsxs("svg",T8(T8({fill:"currentColor",fillRule:"evenodd",height:n,style:T8({flex:"none",lineHeight:1},i),viewBox:"0 0 64 24",xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:bx}),c.jsx("path",{d:"M24.353 21.58c0 .232.188.42.42.42h2.69a.42.42 0 00.42-.42V2.42a.42.42 0 00-.42-.42h-2.69a.42.42 0 00-.42.42v19.16zM58.47 21.58c0 .232.188.42.42.42h2.691a.42.42 0 00.419-.42V2.42a.42.42 0 00-.419-.42H58.89a.42.42 0 00-.42.42v19.16zM47.786 2a.42.42 0 00-.408.32L43.4 18.633c-.066.267-.38.267-.444 0L38.976 2.32A.417.417 0 0038.57 2H31.83a.418.418 0 00-.418.42v19.16c0 .232.188.42.42.42h2.988c.231 0 .419-.182.419-.414V5.471c0-.322.378-.389.454-.079l3.974 16.288a.42.42 0 00.407.32h6.208a.42.42 0 00.407-.32L50.66 5.394c.076-.31.455-.243.455.079V21.58c0 .231.187.419.419.419h2.987a.42.42 0 00.42-.42V2.42a.42.42 0 00-.42-.42h-6.735zM11.55 11.273l8.115-8.565A.42.42 0 0019.36 2h-3.776a.42.42 0 00-.298.124l-9.303 9.39c-.144.146-.357.016-.357-.218V2.42a.42.42 0 00-.42-.42H2.42a.42.42 0 00-.42.42v19.16c0 .232.188.42.42.42h2.786a.42.42 0 00.42-.42v-3.82c0-.085.03-.166.081-.219l2.87-2.931c.07-.07.166-.081.243-.029l7.678 5.816c1.123.778 2.552 1.288 3.861 1.5a.403.403 0 00.464-.404v-3.461c0-.206-.15-.38-.35-.423-.76-.164-1.604-.474-2.244-.918l-6.647-4.953c-.138-.095-.155-.34-.033-.465z"})]}))});function jS(e){"@babel/helpers - typeof";return jS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},jS(e)}var fot=["iconProps"];function FU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function HU(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?FU(Object(n),!0).forEach(function(i){pot(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function pot(e,r,n){return r=mot(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function mot(e){var r=got(e,"string");return jS(r)=="symbol"?r:String(r)}function got(e,r){if(jS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(jS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function yot(e,r){if(e==null)return{};var n=vot(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function vot(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var xot=y.memo(function(e){var r=e.iconProps,n=yot(e,fot);return c.jsx(wc,HU({Icon:Wce,Text:Uce,"aria-label":bx,iconProps:HU({shape:"square"},r),spaceMultiple:qat,textMultiple:Vat},n))});function NS(e){"@babel/helpers - typeof";return NS=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(r){return typeof r}:function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},NS(e)}var bot=["size","style"];function WU(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),n.push.apply(n,i)}return n}function E8(e){for(var r=1;r<arguments.length;r++){var n=arguments[r]!=null?arguments[r]:{};r%2?WU(Object(n),!0).forEach(function(i){_ot(e,i,n[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):WU(Object(n)).forEach(function(i){Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(n,i))})}return e}function _ot(e,r,n){return r=wot(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function wot(e){var r=Sot(e,"string");return NS(r)=="symbol"?r:String(r)}function Sot(e,r){if(NS(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(NS(i)!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function kot(e,r){if(e==null)return{};var n=Cot(e,r),i,s;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(s=0;s<a.length;s++)i=a[s],!(r.indexOf(i)>=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(n[i]=e[i])}return n}function Cot(e,r){if(e==null)return{};var n={},i=Object.keys(e),s,a;for(a=0;a<i.length;a++)s=i[a],!(r.indexOf(s)>=0)&&(n[s]=e[s]);return n}var jot=y.memo(function(e){var r=e.size,n=r===void 0?"1em":r,i=e.style,s=kot(e,bot);return c.jsxs("svg",E8(E8({fill:"currentColor",fillRule:"evenodd",height:n,style:E8({flex:"none",lineHeight:1},i),viewBox:"0 0 24 24",width:n,xmlns:"http://www.w3.org/2000/svg"},s),{},{children:[c.jsx("title",{children:bx}),c.jsx("path",{d:"M21.846 0a1.923 1.923 0 110 3.846H20.15a.226.226 0 01-.227-.226V1.923C19.923.861 20.784 0 21.846 0z"}),c.jsx("path",{d:"M11.065 11.199l7.257-7.2c.137-.136.06-.41-.116-.41H14.3a.164.164 0 00-.117.051l-7.82 7.756c-.122.12-.302.013-.302-.179V3.82c0-.127-.083-.23-.185-.23H3.186c-.103 0-.186.103-.186.23V19.77c0 .128.083.23.186.23h2.69c.103 0 .186-.102.186-.23v-3.25c0-.069.025-.135.069-.178l2.424-2.406a.158.158 0 01.205-.023l6.484 4.772a7.677 7.677 0 003.453 1.283c.108.012.2-.095.2-.23v-3.06c0-.117-.07-.212-.164-.227a5.028 5.028 0 01-2.027-.807l-5.613-4.064c-.117-.078-.132-.279-.028-.381z"})]}))}),Ay=jot;Ay.Color=Hce;Ay.Text=Uce;Ay.Combine=xot;Ay.Avatar=Wce;Ay.colorPrimary=Fce;Ay.title=bx;const Vce=[{label:"OpenAI / Jait",fields:["OPENAI_API_KEY","OPENAI_BASE_URL","OPENAI_MODEL","OPENAI_TRANSCRIBE_MODEL","OPENAI_WEB_SEARCH_MODEL"]},{label:"Ollama",fields:["OLLAMA_URL","OLLAMA_MODEL"]},{label:"Perplexity",fields:["PERPLEXITY_API_KEY","PERPLEXITY_MODEL","PERPLEXITY_OPENROUTER_MODEL"]},{label:"OpenRouter",fields:["OPENROUTER_API_KEY"]},{label:"xAI / Grok",fields:["XAI_API_KEY","GROK_MODEL"]},{label:"Google Gemini",fields:["GEMINI_API_KEY","GEMINI_MODEL"]},{label:"Moonshot / Kimi",fields:["MOONSHOT_API_KEY","KIMI_BASE_URL","KIMI_MODEL"]},{label:"Brave Search",fields:["BRAVE_API_KEY"]},{label:"Speech / Home Assistant",fields:["WHISPER_URL","HA_URL","HA_TOKEN","HA_STT_ENTITY","ELEVENLABS_API_KEY","ELEVENLABS_STT_MODEL","ELEVENLABS_STT_URL","ELEVENLABS_LANGUAGE_CODE"]}],UU=Vce.flatMap(e=>e.fields),Not={OPENAI:hs,PERPLEXITY:Ey,OPENROUTER:yx,XAI:vx,GEMINI:Ap,ELEVENLABS:SY,MOONSHOT:xx,KIMI:Ay,GROK:Sy,OLLAMA:wy,HA:bY};function Tot(e){const r=e.split("_")[0];return Not[r]??null}function Eot(e){return e.endsWith("_KEY")||e.endsWith("_URL")}const Aot=qn(),VU={jait:"Jait",codex:"Codex","claude-code":"Claude Code"};function Oot(e){const r=e.auth;return e.id==="jait"||!r?!1:r.login||r.logout||r.authenticated!==null}function Mot({username:e,token:r,apiKeys:n,onSaveApiKeys:i,sttProvider:s,onSttProviderChange:a,jaitBackend:o,onJaitBackendChange:l,onClearArchive:d,onClearArchivedProjects:u,onFetchArchivedProjects:h,onRestoreProject:f,activityEvents:g,updateInfo:v,updateChecking:b,onCheckUpdate:_,onApplyUpdate:S,updateApplying:w,platform:C}){const[j,E]=y.useState(n),[A,N]=y.useState(!1),[R,B]=y.useState(!1),[G,H]=y.useState(!1),[z,W]=y.useState([]),[I,O]=y.useState(!1),[D,P]=y.useState(null),[$,V]=y.useState(null),[K,F]=y.useState(null),[U,Q]=y.useState({}),[q,te]=y.useState({}),[ee,se]=y.useState([]),[ae,re]=y.useState(!1),[de,pe]=y.useState(null),[_e,me]=y.useState("general"),[qe,oe]=y.useState(""),it=y.useRef(null),{importedThemes:Xe,activeTheme:gt}=lte(),[Mt,Ht]=y.useState(!1),[Yt,tr]=y.useState(null);y.useEffect(()=>{var Me;C!=="electron"||!((Me=window.jaitDesktop)!=null&&Me.getInfo)||window.jaitDesktop.getInfo().then(mt=>{mt.appVersion&&tr(mt.appVersion)})},[C]),y.useEffect(()=>{var Me;C!=="electron"||!((Me=window.jaitDesktop)!=null&&Me.getSetting)||window.jaitDesktop.getSetting("closeOnWindowClose",!1).then(mt=>{Ht(mt===!0)})},[C]),y.useEffect(()=>{E(n)},[n]);const ft=UU.some(Me=>(j[Me]??"")!==(n[Me]??"")),Ye=y.useCallback(async()=>{if(r){re(!0);try{const{providers:Me}=await gr.listProvidersFresh();se(Me.filter(Oot))}catch{se([])}finally{re(!1)}}},[r]);y.useEffect(()=>{Ye()},[Ye]);const ht=async Me=>{var Wt;const mt=((Wt=ee.find(Ot=>Ot.id===Me))==null?void 0:Wt.name)??VU[Me]??Me;pe(Me),F(null),V(null);try{const Ot=await gr.logoutProvider(Me);V(Ot.message||`${mt} logout completed.`),await Ye()}catch(Ot){F(Ot instanceof Error?Ot.message:`Failed to log out from ${mt}.`)}finally{pe(null)}},Tt=y.useCallback(()=>{E(n),V(null),F(null)},[n]);y.useEffect(()=>{if(!r)return;let Me=!1;return(async()=>{try{const mt=await fetch(`${Aot}/api/auth/settings/env-status`,{headers:{Authorization:`Bearer ${r}`}});if(mt.ok&&!Me){const Wt=await mt.json();Q(Wt.env_set)}}catch{}})(),()=>{Me=!0}},[r]);const Te=y.useCallback(Me=>{te(mt=>({...mt,[Me]:!mt[Me]}))},[]),Oe=async()=>{N(!0),F(null),V(null);try{await i(j),V("API keys saved.")}catch(Me){F(Me instanceof Error?Me.message:"Failed to save API keys")}finally{N(!1)}},Je=async()=>{B(!0),F(null),V(null);try{const Me=await d();V(`Cleared ${Me} archived session(s).`)}catch(Me){F(Me instanceof Error?Me.message:"Failed to clear archive")}finally{B(!1)}},lt=async()=>{H(!0),F(null),V(null);try{const Me=await u();W([]),V(`Cleared ${Me} archived project(s).`)}catch(Me){F(Me instanceof Error?Me.message:"Failed to clear archived projects")}finally{H(!1)}},yt=y.useCallback(async()=>{O(!0);try{const Me=await h();W(Me)}finally{O(!1)}},[h]),zt=async Me=>{P(Me);try{await f(Me)?(W(Wt=>Wt.filter(Ot=>Ot.id!==Me)),V("Project restored.")):F("Failed to restore project.")}catch{F("Failed to restore project.")}finally{P(null)}},or=y.useCallback(async Me=>{var Wt;const mt=(Wt=Me.target.files)==null?void 0:Wt[0];if(Me.target.value="",!!mt){F(null),V(null);try{const Ot=mDe(mt.name,await mt.text());V(Ot.hasInclude?`Imported theme "${Ot.name}". Relative "include" files are not resolved yet.`:`Imported theme "${Ot.name}".`)}catch(Ot){F(Ot instanceof Error?Ot.message:"Failed to import theme")}}},[]);function Pe(Me){var Ot;const mt=!!((Ot=j[Me])!=null&&Ot.trim()),Wt=!!U[Me];return mt?c.jsx(Or,{variant:"default",className:"text-2xs px-1.5 py-0",children:"user"}):Wt?c.jsx(Or,{variant:"success",className:"text-2xs px-1.5 py-0",children:".env"}):c.jsx(Or,{variant:"outline",className:"text-2xs px-1.5 py-0 text-muted-foreground",children:"empty"})}const Ne=qe.trim().toLowerCase(),be=(...Me)=>!Ne||Me.some(mt=>mt==null?void 0:mt.toLowerCase().includes(Ne)),He=Me=>c.jsx("span",{dangerouslySetInnerHTML:{__html:Tit(Me,qe)}}),at=be("software update version gateway desktop release download install",v==null?void 0:v.currentVersion,v==null?void 0:v.latestVersion,Yt),Ve=C==="electron"&&be("desktop tray close window quit minimize app",Yt),$t=C!=="web"&&be("gateway connection url domain ip server host network",qn()),Et=be("session archive archived clear delete messages history"),Xt=be("project archive archived clear delete projects remove"),rr=be("jait backend provider openai openrouter model api llm",o),nr=be("provider accounts login logout codex claude gemini opencode copilot authentication",...ee.map(Me=>{var mt;return`${Me.name} ${((mt=Me.auth)==null?void 0:mt.detail)??""}`})),Se=be("speech stt input microphone whisper wyoming home assistant transcription gpt openai elevenlabs scribe",s,j.WHISPER_URL,j.HA_URL,j.HA_TOKEN,j.HA_STT_ENTITY,j.OPENAI_TRANSCRIBE_MODEL,j.ELEVENLABS_API_KEY,j.ELEVENLABS_STT_MODEL,j.ELEVENLABS_STT_URL,j.ELEVENLABS_LANGUAGE_CODE),Fe=UU.filter(Me=>be(Me,Me.replaceAll("_"," "),j[Me])),et=be("tools permissions mcp core standard external toggle meta terminal filesystem os agent browser web surfaces scheduler memory voice screen gateway"),wt=be("activity recent messages terminal sessions feed history"),Ze=be("extensions plugins store install uninstall enable disable"),vt=be("skills instructions prompts specialized workflows SKILL.md"),Rt=be("channels whatsapp messaging connect link qr inbound outbound"),Gt=be(...Z$e(),"import json token colors workbench sidebar tabs"),$e=c.jsx(tn,{className:"p-5",children:c.jsxs("p",{className:"text-sm text-muted-foreground",children:["No settings match ",c.jsx("span",{className:"font-medium text-foreground",children:qe}),"."]})});return c.jsxs("div",{className:"mx-auto w-full max-w-5xl space-y-6 p-4 sm:p-6",children:[c.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-end md:justify-between",children:[c.jsxs("div",{children:[c.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"Settings"}),c.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["Signed in as ",c.jsx("span",{className:"font-medium text-foreground",children:e})]})]}),c.jsxs("div",{className:"relative w-full md:max-w-sm",children:[c.jsx(rl,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),c.jsx(Ln,{value:qe,onChange:Me=>oe(Me.target.value),placeholder:"Search settings...",className:"pl-9"})]})]}),c.jsxs(Y0,{value:_e,onValueChange:Me=>me(Me),className:"space-y-4",children:[c.jsxs(ag,{className:"flex h-auto w-full flex-wrap justify-start gap-1 rounded-xl bg-muted/70 p-1",children:[c.jsx(Qs,{value:"general",className:"flex-1 sm:flex-none",children:"General"}),c.jsx(Qs,{value:"api",className:"flex-1 sm:flex-none",children:"API"}),c.jsx(Qs,{value:"tools",className:"flex-1 sm:flex-none",children:"Tools"}),c.jsx(Qs,{value:"extensions",className:"flex-1 sm:flex-none",children:"Extensions"}),c.jsx(Qs,{value:"skills",className:"flex-1 sm:flex-none",children:"Skills"}),c.jsx(Qs,{value:"channels",className:"flex-1 sm:flex-none",children:"Channels"}),c.jsx(Qs,{value:"activity",className:"flex-1 sm:flex-none",children:"Activity"})]}),c.jsxs(ea,{value:"general",className:"space-y-6",children:[at&&c.jsxs(tn,{className:"space-y-4 p-5",children:[c.jsxs("div",{children:[c.jsxs("h2",{className:"flex items-center gap-2 text-base font-medium",children:[c.jsx(gY,{className:"h-4 w-4"}),He("Software Update")]}),c.jsxs("p",{className:"text-sm text-muted-foreground",children:[v?c.jsxs(c.Fragment,{children:["Gateway ",c.jsxs("span",{className:"font-mono font-medium text-foreground",children:["v",v.currentVersion]})]}):"Check for the latest Jait version.",Yt&&c.jsxs(c.Fragment,{children:[" · Desktop app ",c.jsxs("span",{className:"font-mono font-medium text-foreground",children:["v",Yt]})]})]})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[c.jsxs(we,{variant:"outline",size:"sm",onClick:_,disabled:b||w,children:[b?c.jsx(Ft,{className:"mr-1.5 h-4 w-4 animate-spin"}):null,b?"Checking...":"Check for updates"]}),(v==null?void 0:v.hasUpdate)&&c.jsxs(c.Fragment,{children:[c.jsxs(we,{size:"sm",onClick:S,disabled:w,children:[w?c.jsx(Ft,{className:"mr-1.5 h-4 w-4 animate-spin"}):c.jsx(gp,{className:"mr-1.5 h-4 w-4"}),w?"Updating...":`Update gateway to v${v.latestVersion}`]}),C==="electron"?c.jsxs(we,{size:"sm",variant:"outline",onClick:async()=>{const Me=window.jaitDesktop;(await Me.checkForUpdate()).updateAvailable&&(await Me.downloadUpdate(),await Me.installUpdate())},children:[c.jsx(gp,{className:"mr-1.5 h-4 w-4"}),"Update desktop app"]}):C!=="web"&&c.jsx(we,{size:"sm",variant:"outline",asChild:!0,children:c.jsxs("a",{href:"https://github.com/Widev-e-U/Jait/releases/latest",target:"_blank",rel:"noopener noreferrer",children:[c.jsx(gp,{className:"mr-1.5 h-4 w-4"}),"Download latest APK"]})})]})]}),v&&!v.hasUpdate&&c.jsxs("p",{className:"flex items-center gap-1.5 text-sm text-green-600 dark:text-green-400",children:[c.jsx(ia,{className:"h-3.5 w-3.5"}),"You're on the latest version."]}),(v==null?void 0:v.hasUpdate)&&c.jsxs("p",{className:"flex items-center gap-1.5 text-sm text-amber-600 dark:text-amber-400",children:[c.jsx(na,{className:"h-3.5 w-3.5"}),"Version ",v.latestVersion," is available",C!=="web"?" — download from jait.dev":"","."]})]}),Gt&&c.jsxs(tn,{className:"space-y-4 p-5",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:He("Editor theme")}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Import a VS Code theme JSON file and apply its Monaco token colors plus a mapped shell palette."})]}),c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("input",{ref:it,type:"file",accept:".json,application/json",className:"hidden",onChange:Me=>{or(Me)}}),c.jsx(we,{variant:"outline",size:"sm",onClick:()=>{var Me;return(Me=it.current)==null?void 0:Me.click()},children:"Import theme JSON"}),c.jsx(we,{variant:"ghost",size:"sm",disabled:!gt,onClick:()=>_j(null),children:"Use built-in theme"})]}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"Imported themes stay local to this device. The quick light/system/dark toggle falls back to the built-in theme set."}),Xe.length>0?c.jsx("div",{className:"space-y-2",children:Xe.map(Me=>{const mt=(gt==null?void 0:gt.id)===Me.id;return c.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border px-3 py-2",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("p",{className:"truncate text-sm font-medium",children:Me.name}),c.jsx(Or,{variant:mt?"default":"outline",className:"h-5 px-1.5 text-2xs",children:mt?"active":Me.colorMode})]}),c.jsx("p",{className:"truncate text-xs text-muted-foreground",children:Me.sourceLabel})]}),c.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[!mt&&c.jsx(we,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>_j(Me.id),children:"Apply"}),c.jsx(we,{variant:"ghost",size:"sm",className:"h-7 text-xs text-destructive hover:text-destructive",onClick:()=>gDe(Me.id),children:"Remove"})]})]},Me.id)})}):c.jsx("p",{className:"text-sm text-muted-foreground",children:"No imported themes yet."})]}),Ve&&c.jsxs(tn,{className:"space-y-4 p-5",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:He("Desktop")}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Settings specific to the desktop application."})]}),c.jsxs("div",{className:"flex max-w-md items-center justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx(mi,{htmlFor:"close-on-window-close",children:"Quit on window close"}),c.jsx("p",{className:"text-xs text-muted-foreground",children:"When off, closing the window minimizes Jait to the system tray."})]}),c.jsx(gf,{id:"close-on-window-close",checked:Mt,onCheckedChange:Me=>{var mt;Ht(Me),(mt=window.jaitDesktop)==null||mt.setSetting("closeOnWindowClose",Me)}})]})]}),$t&&c.jsxs(tn,{className:"space-y-4 p-5",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:He("Gateway connection")}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Desktop and mobile clients can connect to a different Jait gateway."})]}),c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Current gateway: ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:qn()})]})]}),Et&&c.jsxs(tn,{className:"space-y-4 p-5",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:He("Session archive")}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Permanently remove archived sessions and their messages from your account."})]}),c.jsx("div",{children:c.jsx(we,{variant:"destructive",onClick:()=>{Je()},disabled:R,children:R?"Clearing...":"Clear archived sessions"})})]}),Xt&&c.jsxs(tn,{className:"space-y-4 p-5",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:He("Project archive")}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Restore or permanently remove archived projects and their sessions."})]}),c.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap",children:[c.jsx(we,{className:"w-full sm:w-auto",variant:"outline",onClick:()=>{yt()},disabled:I,children:I?c.jsxs(c.Fragment,{children:[c.jsx(Ft,{className:"mr-2 h-3.5 w-3.5 animate-spin"})," Loading..."]}):"Show archived projects"}),c.jsx(we,{className:"w-full sm:w-auto",variant:"destructive",onClick:()=>{lt()},disabled:G,children:G?"Clearing...":"Clear all archived"})]}),z.length>0&&c.jsx("div",{className:"space-y-2",children:z.map(Me=>c.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-lg border px-3 py-2",children:[c.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[c.jsx(yR,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),c.jsxs("div",{className:"min-w-0",children:[c.jsx("p",{className:"text-sm font-medium truncate",children:Me.title||Me.rootPath||Me.id}),Me.rootPath&&Me.title&&c.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Me.rootPath})]})]}),c.jsxs(we,{variant:"outline",size:"sm",className:"shrink-0 h-7 text-xs",onClick:()=>{zt(Me.id)},disabled:D===Me.id,children:[D===Me.id?c.jsx(Ft,{className:"mr-1.5 h-3 w-3 animate-spin"}):c.jsx(O0e,{className:"mr-1.5 h-3 w-3"}),"Restore"]})]},Me.id))})]}),rr&&c.jsxs(tn,{className:"space-y-4 p-5",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:He("Jait LLM Backend")}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose which API backend the Jait provider uses for model inference."})]}),c.jsxs("div",{className:"max-w-sm",children:[c.jsx(mi,{htmlFor:"jait-backend",className:"mb-1.5 block",children:"Backend provider"}),c.jsxs(sh,{value:o,onValueChange:Me=>{l(Me)},children:[c.jsx(ed,{id:"jait-backend",children:c.jsx(ah,{placeholder:"Select backend"})}),c.jsxs(td,{children:[c.jsx(Ls,{value:"openai",children:"OpenAI (direct)"}),c.jsx(Ls,{value:"openrouter",children:"OpenRouter"}),c.jsx(Ls,{value:"ollama",children:"Ollama (local)"})]})]}),c.jsx("p",{className:"mt-1.5 text-xs text-muted-foreground",children:o==="openrouter"?"Models will be fetched from OpenRouter. Set your OPENROUTER_API_KEY in the API tab.":o==="ollama"?"Models will be fetched from your local Ollama instance. Set OLLAMA_URL in the API tab if not running on localhost:11434.":"Uses your OPENAI_API_KEY and OPENAI_BASE_URL."})]})]}),nr&&c.jsxs(tn,{className:"space-y-4 p-5",children:[c.jsxs("div",{className:"flex items-start justify-between gap-3",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:He("Provider accounts")}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage CLI provider sessions. Login is started from the provider picker; logout is handled here."})]}),c.jsxs(we,{variant:"outline",size:"sm",onClick:()=>{Ye()},disabled:ae,children:[ae?c.jsx(Ft,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):c.jsx(Js,{className:"mr-1.5 h-3.5 w-3.5"}),"Refresh"]})]}),c.jsx("div",{className:"space-y-2",children:ee.length===0&&!ae?c.jsx("p",{className:"text-sm text-muted-foreground",children:"No provider account actions are available on this gateway."}):ee.map(Me=>{const mt=Me.auth,Wt=Me.id,Ot=(mt==null?void 0:mt.authenticated)===!0,Hr=(mt==null?void 0:mt.authenticated)===!1,mr=de===Wt;return c.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border px-3 py-3 sm:flex-row sm:items-center sm:justify-between",children:[c.jsxs("div",{className:"min-w-0",children:[c.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[c.jsx("p",{className:"text-sm font-medium",children:VU[Wt]??Me.name}),c.jsx(Or,{variant:Ot?"success":"outline",className:"text-2xs",children:Ot?"signed in":(mt==null?void 0:mt.authenticated)===!1?"signed out":"unknown"})]}),(mt==null?void 0:mt.detail)&&c.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:mt.detail})]}),(mt==null?void 0:mt.logout)&&c.jsxs(we,{className:"w-full sm:w-auto",variant:"outline",size:"sm",onClick:()=>{ht(Wt)},disabled:mr||de!==null||Hr,children:[mr?c.jsx(Ft,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):c.jsx(yA,{className:"mr-1.5 h-3.5 w-3.5"}),"Logout"]})]},Me.id)})})]}),Se&&c.jsxs(tn,{className:"space-y-4 p-5",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:He("Spracheingabe (Speech-to-Text)")}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Wähle aus, wie gesprochene Sprache in Text umgewandelt wird, bevor sie als Nachricht gesendet wird."})]}),c.jsxs("div",{className:"max-w-sm",children:[c.jsx(mi,{htmlFor:"stt-provider",className:"mb-1.5 block",children:"STT-Anbieter"}),c.jsxs(sh,{value:s,onValueChange:Me=>{a(Me)},children:[c.jsx(ed,{id:"stt-provider",children:c.jsx(ah,{placeholder:"STT-Anbieter wählen"})}),c.jsxs(td,{children:[c.jsx(Ls,{value:"whisper",children:"Faster Whisper (lokal)"}),c.jsx(Ls,{value:"gpt",children:"GPT (OpenAI)"}),c.jsx(Ls,{value:"elevenlabs",children:"ElevenLabs Scribe"}),c.jsx(Ls,{value:"wyoming",children:"Wyoming / Whisper (Home Assistant)"})]})]})]}),s==="whisper"&&c.jsx("div",{className:"max-w-sm space-y-3 border-l-2 border-primary/20 pl-4",children:c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Uses a local Faster Whisper server for free, offline transcription. Start the server with ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"python whisper-server/server.py"})," from the gateway package. Optionally set ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"WHISPER_URL"})," in API keys below (defaults to ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"http://localhost:8178"}),")."]})}),s==="wyoming"&&c.jsx("div",{className:"max-w-sm space-y-3 border-l-2 border-primary/20 pl-4",children:c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Configure your Home Assistant Wyoming/Whisper STT integration. Set these values in the API keys section below: ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"HA_URL"}),", ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"HA_TOKEN"}),", and optionally ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"HA_STT_ENTITY"})," (defaults to ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"stt.faster_whisper"}),")."]})}),s==="gpt"&&c.jsx("div",{className:"max-w-sm space-y-3 border-l-2 border-primary/20 pl-4",children:c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Uses OpenAI audio transcription. Set ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"OPENAI_API_KEY"})," and optionally ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"OPENAI_TRANSCRIBE_MODEL"})," (defaults to ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"gpt-4o-mini-transcribe"}),")."]})}),s==="elevenlabs"&&c.jsx("div",{className:"max-w-sm space-y-3 border-l-2 border-primary/20 pl-4",children:c.jsxs("p",{className:"text-xs text-muted-foreground",children:["Uses ElevenLabs Speech to Text. Set ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"ELEVENLABS_API_KEY"})," and optionally ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"ELEVENLABS_STT_MODEL"})," (defaults to ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"scribe_v2"}),") and ",c.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-2xs",children:"ELEVENLABS_LANGUAGE_CODE"}),"."]})})]}),!Gt&&!at&&!Ve&&!$t&&!Et&&!Xt&&!rr&&!nr&&!Se&&$e]}),c.jsx(ea,{value:"api",className:"space-y-6 pb-20",children:Fe.length>0?c.jsxs(c.Fragment,{children:[c.jsx("p",{className:"text-sm text-muted-foreground",children:"Values stored here are user-specific and override environment defaults for your account."}),Vce.map(Me=>{const mt=Me.fields.filter(Ot=>Fe.includes(Ot));if(mt.length===0)return null;const Wt=Tot(mt[0]);return c.jsx(rk,{defaultOpen:!1,children:c.jsxs(tn,{className:"p-0 overflow-hidden",children:[c.jsxs(nk,{className:"flex w-full items-center gap-2 px-5 py-3.5 text-left hover:bg-muted/50 transition-colors group",children:[c.jsx(Cs,{className:"h-4 w-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-90"}),Wt?c.jsx(Wt,{size:16,className:"text-muted-foreground"}):c.jsx(SY,{className:"h-4 w-4 text-muted-foreground"}),c.jsx("span",{className:"text-sm font-semibold",children:He(Me.label)})]}),c.jsx(ik,{children:c.jsx("div",{className:"grid gap-4 px-5 pb-5 md:grid-cols-2",children:mt.map(Ot=>{const Hr=Eot(Ot),mr=!!q[Ot];return c.jsxs("div",{className:"space-y-1.5",children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx(mi,{htmlFor:`api-${Ot}`,className:"font-mono text-xs",children:He(Ot)}),Pe(Ot)]}),c.jsxs("div",{className:"relative",children:[c.jsx(Ln,{id:`api-${Ot}`,type:Hr&&!mr?"password":"text",value:j[Ot]??"",onChange:Dr=>{E(jt=>({...jt,[Ot]:Dr.target.value}))},placeholder:U[Ot]?"(set via .env)":"(empty)",className:Hr?"pr-9":""}),Hr&&c.jsx("button",{type:"button",className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",onClick:()=>Te(Ot),tabIndex:-1,"aria-label":mr?"Hide value":"Show value",children:mr?c.jsx(Hd,{className:"h-4 w-4"}):c.jsx(tf,{className:"h-4 w-4"})})]})]},Ot)})})})]})},Me.label)}),c.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-30 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",children:c.jsxs("div",{className:"mx-auto flex max-w-5xl items-center gap-3 px-4 py-3 sm:px-6",children:[c.jsx(we,{onClick:()=>{Oe()},disabled:A||!ft,children:A?"Saving...":"Save API settings"}),c.jsx(we,{variant:"ghost",onClick:Tt,disabled:!ft,children:"Discard"}),$&&c.jsx("span",{className:"text-sm text-muted-foreground",children:$}),K&&c.jsx("span",{className:"text-sm text-destructive",children:K})]})})]}):$e}),c.jsx(ea,{value:"tools",className:"space-y-6",children:et?c.jsx(mit,{token:r}):$e}),c.jsx(ea,{value:"extensions",className:"space-y-6",children:Ze?c.jsx(xit,{token:r}):$e}),c.jsx(ea,{value:"skills",className:"space-y-6",children:vt?c.jsx(wit,{token:r}):$e}),c.jsx(ea,{value:"channels",className:"space-y-6",children:Rt?c.jsx(jit,{token:r}):$e}),c.jsxs(ea,{value:"activity",className:"space-y-6",children:[wt&&g&&g.length>0&&c.jsxs(tn,{className:"p-5 space-y-4",children:[c.jsxs("div",{children:[c.jsx("h2",{className:"text-base font-medium",children:He("Recent activity")}),c.jsx("p",{className:"text-sm text-muted-foreground",children:"Recent chat messages and terminal sessions."})]}),c.jsx(Nit,{events:g})]}),wt&&(!g||g.length===0)&&c.jsx(tn,{className:"p-5",children:c.jsx("p",{className:"text-sm text-muted-foreground",children:"No recent activity yet."})}),!wt&&$e]})]})]})}function Rot(e,r){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,s,a,o,l=[],d=!0,u=!1;try{if(a=(n=n.call(e)).next,r===0){if(Object(n)!==n)return;d=!1}else for(;!(d=(i=a.call(n)).done)&&(l.push(i.value),l.length!==r);d=!0);}catch(h){u=!0,s=h}finally{try{if(!d&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function Pot(e,r,n){return r=Hot(r),r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function qU(e,r){return Dot(e)||Rot(e,r)||qce(e,r)||zot()}function Lot(e){return $ot(e)||Iot(e)||qce(e)||Bot()}function $ot(e){if(Array.isArray(e))return A7(e)}function Dot(e){if(Array.isArray(e))return e}function Iot(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function qce(e,r){if(e){if(typeof e=="string")return A7(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A7(e,r)}}function A7(e,r){(r==null||r>e.length)&&(r=e.length);for(var n=0,i=new Array(r);n<r;n++)i[n]=e[n];return i}function Bot(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1231
1231
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zot(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1232
1232
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fot(e,r){if(typeof e!="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var i=n.call(e,r);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function Hot(e){var r=Fot(e,"string");return typeof r=="symbol"?r:String(r)}var Wot=function(r,n){var i=new Set(n);return Object.assign.apply(Object,[{}].concat(Lot(Object.entries(r).filter(function(s){var a=qU(s,1),o=a[0];return!i.has(o)}).map(function(s){var a=qU(s,2),o=a[0],l=a[1];return Pot({},o,l)}))))};function O7(e,r){(r==null||r>e.length)&&(r=e.length);for(var n=0,i=Array(r);n<r;n++)i[n]=e[n];return i}function Uot(e){if(Array.isArray(e))return e}function Vot(e){if(Array.isArray(e))return O7(e)}function qot(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Got(e,r){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var i,s,a,o,l=[],d=!0,u=!1;try{if(a=(n=n.call(e)).next,r!==0)for(;!(d=(i=a.call(n)).done)&&(l.push(i.value),l.length!==r);d=!0);}catch(h){u=!0,s=h}finally{try{if(!d&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(u)throw s}}return l}}function Kot(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1233
1233
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Yot(){throw new TypeError(`Invalid attempt to spread non-iterable instance.