nextclaw 0.20.0 → 0.20.2

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 (54) hide show
  1. package/package.json +16 -16
  2. package/ui-dist/assets/app-presenter-provider-DIcnNB9s.js +3 -0
  3. package/ui-dist/assets/{wrench-qVIwShTF.js → boxes-BvA-I63l.js} +1 -1
  4. package/ui-dist/assets/channels-list-page-wK3l7p5R.js +8 -0
  5. package/ui-dist/assets/chat-page-DgehvdJT.js +105 -0
  6. package/ui-dist/assets/{confirm-dialog-B0TP-vPd.js → confirm-dialog-CGrKHbAW.js} +1 -1
  7. package/ui-dist/assets/desktop-update-config-CehWxSSg.js +1 -0
  8. package/ui-dist/assets/doc-browser-BgxmVsTx.js +1 -0
  9. package/ui-dist/assets/doc-browser-CZn5-Qbu.js +1 -0
  10. package/ui-dist/assets/doc-browser-context-B8gk7HMr.js +1 -0
  11. package/ui-dist/assets/index-DORmh0Cy.css +1 -0
  12. package/ui-dist/assets/index-DcFpvnge.js +101 -0
  13. package/ui-dist/assets/key-round-D41Oe35x.js +1 -0
  14. package/ui-dist/assets/mcp-marketplace-page-DBLhJWOJ.js +1 -0
  15. package/ui-dist/assets/{mcp-marketplace-page-DDjeHd1I.js → mcp-marketplace-page-Dvi8mCBd.js} +2 -2
  16. package/ui-dist/assets/model-config-B-EJXGtO.js +1 -0
  17. package/ui-dist/assets/popover-YieElO8c.js +1 -0
  18. package/ui-dist/assets/{provider-scoped-model-input-t1tCP5y5.js → provider-scoped-model-input-BPRNGqYn.js} +1 -1
  19. package/ui-dist/assets/providers-list-CtBpL1ZY.js +1 -0
  20. package/ui-dist/assets/remote-BGHbHoHf.js +1 -0
  21. package/ui-dist/assets/rotate-cw-jueVCNJQ.js +1 -0
  22. package/ui-dist/assets/runtime-config-page-C1Hv7mad.js +1 -0
  23. package/ui-dist/assets/search-config-G2O1fcRb.js +1 -0
  24. package/ui-dist/assets/{secrets-config-D1AUSEXX.js → secrets-config-TenzxYbE.js} +2 -2
  25. package/ui-dist/assets/status-dot-BSMG7ZaC.js +1 -0
  26. package/ui-dist/assets/tabs-D1CjpWNX.js +1 -0
  27. package/ui-dist/assets/trash-2-DSWTsARW.js +1 -0
  28. package/ui-dist/index.html +19 -13
  29. package/ui-dist/assets/channels-list-page-DXH1qYLs.js +0 -8
  30. package/ui-dist/assets/chat-page-Cpo0AFHb.js +0 -105
  31. package/ui-dist/assets/desktop-update-config-Be8x1jNy.js +0 -1
  32. package/ui-dist/assets/doc-browser-BI7HSaMK.js +0 -3
  33. package/ui-dist/assets/doc-browser-context-DB6TTHeE.js +0 -1
  34. package/ui-dist/assets/doc-browser-route-registry.utils-x5ijvk0u.js +0 -1
  35. package/ui-dist/assets/doc-browser-yTfN7UBH.js +0 -1
  36. package/ui-dist/assets/index-GVTiCf1s.js +0 -101
  37. package/ui-dist/assets/index-v0fAGXQW.css +0 -1
  38. package/ui-dist/assets/mcp-marketplace-page-WUkc7n94.js +0 -1
  39. package/ui-dist/assets/model-config-BjXMpU9U.js +0 -1
  40. package/ui-dist/assets/providers-list-C1D5p9kK.js +0 -1
  41. package/ui-dist/assets/remote-BHeENKxL.js +0 -1
  42. package/ui-dist/assets/runtime-config-page--O0Wq01S.js +0 -1
  43. package/ui-dist/assets/search-config-Dzpizo-_.js +0 -1
  44. /package/ui-dist/assets/{book-open-cPX0Za7Z.js → book-open-CRotBOF2.js} +0 -0
  45. /package/ui-dist/assets/{config-hints-CY1lg9IE.js → config-hints-A7G_jMTU.js} +0 -0
  46. /package/ui-dist/assets/{config-split-page-BFh_Qixx.js → config-split-page-BnTO1mAM.js} +0 -0
  47. /package/ui-dist/assets/{external-link-C3usm3se.js → external-link-DHjFdCpy.js} +0 -0
  48. /package/ui-dist/assets/{play-CqNi0u02.js → play-C-0vo7hi.js} +0 -0
  49. /package/ui-dist/assets/{plus-BcIC8dG1.js → plus-Cr_akLp2.js} +0 -0
  50. /package/ui-dist/assets/{save-D10M5vQg.js → save-aYdSdK97.js} +0 -0
  51. /package/ui-dist/assets/{setting-row-8VkukJoH.js → setting-row-BNu0qhOM.js} +0 -0
  52. /package/ui-dist/assets/{tabs-custom-BBXu1OGs.js → tabs-custom-CRSN1ekg.js} +0 -0
  53. /package/ui-dist/assets/{tag-chip-ix15P-r4.js → tag-chip-DEashiw6.js} +0 -0
  54. /package/ui-dist/assets/{x-Chb07O-Y.js → x-D1v_vb54.js} +0 -0
@@ -1,8 +0,0 @@
1
- import{d as e,g as t,h as n,i as r,m as i,n as a,o,v as s}from"./react-B2X_ph0a.js";import{At as c,Ct as l,Lt as u,Mt as d,Nt as f,Rt as p,Xt as m,et as h,ft as g,jt as _,kt as v,nt as y,ot as b,tt as x,zt as S}from"./api-DruAcori.js";import{t as C}from"./createLucideIcon-Br1EFMEr.js";import{t as w}from"./search-CdhgFNwf.js";import{t as T}from"./book-open-cPX0Za7Z.js";import{t as E}from"./external-link-C3usm3se.js";import{t as D}from"./x-Chb07O-Y.js";import{$ as O,At as k,Dt as ee,Gt as A,J as j,K as M,Ot as N,Q as te,U as ne,W as re,X as ie,Xt as ae,Y as oe,Z as se,an as ce,en as le,it as ue,kt as de,ln as fe,nn as pe,pt as me,q as he,rn as ge,xt as _e}from"./index-GVTiCf1s.js";import{t as ve}from"./tabs-custom-BBXu1OGs.js";import{t as ye}from"./tag-chip-ix15P-r4.js";import{t as P}from"./config-hints-CY1lg9IE.js";import{a as F,c as I,i as be,n as xe,o as L,r as Se,s as Ce,t as we}from"./config-split-page-BFh_Qixx.js";var Te=C(`Hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Ee=C(`Mail`,[[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}]]),R=C(`MessageCircleMore`,[[`path`,{d:`M7.9 20A9 9 0 1 0 4 16.1L2 22Z`,key:`vv11sd`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]),z=C(`QrCode`,[[`rect`,{width:`5`,height:`5`,x:`3`,y:`3`,rx:`1`,key:`1tu5fj`}],[`rect`,{width:`5`,height:`5`,x:`16`,y:`3`,rx:`1`,key:`1v8r4q`}],[`rect`,{width:`5`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`1x03jg`}],[`path`,{d:`M21 16h-3a2 2 0 0 0-2 2v3`,key:`177gqh`}],[`path`,{d:`M21 21v.01`,key:`ents32`}],[`path`,{d:`M12 7v3a2 2 0 0 1-2 2H7`,key:`8crl2c`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M12 3h.01`,key:`n36tog`}],[`path`,{d:`M12 16v.01`,key:`133mhm`}],[`path`,{d:`M16 12h1`,key:`1slzba`}],[`path`,{d:`M21 12v.01`,key:`1lwtk9`}],[`path`,{d:`M12 21v-1`,key:`1880an`}]]),De=C(`ToggleLeft`,[[`rect`,{width:`20`,height:`12`,x:`2`,y:`6`,rx:`6`,ry:`6`,key:`f2vt7d`}],[`circle`,{cx:`8`,cy:`12`,r:`2`,key:`1nvbw3`}]]),B=s(n(),1),V=i();function Oe({value:t,onChange:n,className:i,placeholder:a=``}){let[o,s]=(0,B.useState)(``),c=e=>{e.key===`Enter`&&o.trim()?(e.preventDefault(),n([...t,o.trim()]),s(``)):e.key===`Backspace`&&!o&&t.length>0&&n(t.slice(0,-1))},l=e=>{n(t.filter((t,n)=>n!==e))};return(0,V.jsxs)(`div`,{className:e(`flex min-h-[42px] flex-wrap gap-2 rounded-xl border border-gray-200/80 bg-white p-2`,i),children:[t.map((e,t)=>(0,V.jsxs)(ye,{tone:`info`,className:`gap-1 px-2 py-1 text-sm`,children:[e,(0,V.jsx)(`button`,{type:`button`,onClick:()=>l(t),className:`transition-colors hover:text-rose-200`,children:(0,V.jsx)(D,{className:`h-3 w-3`})})]},t)),(0,V.jsx)(`input`,{type:`text`,value:o,onChange:e=>s(e.target.value),onKeyDown:c,className:`flex-1 outline-none min-w-[100px] bg-transparent text-sm`,placeholder:a||r(`enterTag`)})]})}function ke(e){return e.includes(`token`)||e.includes(`secret`)||e.includes(`password`)?(0,V.jsx)(ge,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`url`)||e.includes(`host`)?(0,V.jsx)(ce,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`email`)||e.includes(`mail`)?(0,V.jsx)(Ee,{className:`h-3.5 w-3.5 text-gray-500`}):e.includes(`id`)||e.includes(`from`)?(0,V.jsx)(Te,{className:`h-3.5 w-3.5 text-gray-500`}):e===`enabled`||e===`consentGranted`?(0,V.jsx)(De,{className:`h-3.5 w-3.5 text-gray-500`}):(0,V.jsx)(ae,{className:`h-3.5 w-3.5 text-gray-500`})}function Ae({channelName:e,fields:t,formData:n,jsonDrafts:i,setJsonDrafts:a,updateField:o,uiHints:s}){return(0,V.jsx)(V.Fragment,{children:t.map(t=>{let c=P(`channels.${e}.${t.name}`,s),l=c?.label??t.label,u=c?.placeholder;return(0,V.jsxs)(`div`,{className:`space-y-2.5`,children:[(0,V.jsxs)(_,{htmlFor:t.name,className:`flex items-center gap-2 text-sm font-medium text-gray-900`,children:[ke(t.name),l]}),t.type===`boolean`&&(0,V.jsxs)(`div`,{className:`flex items-center justify-between rounded-xl bg-gray-50 p-3`,children:[(0,V.jsx)(`span`,{className:`text-sm text-gray-500`,children:n[t.name]?r(`enabled`):r(`disabled`)}),(0,V.jsx)(g,{id:t.name,checked:n[t.name]||!1,onCheckedChange:e=>o(t.name,e),className:`data-[state=checked]:bg-emerald-500`})]}),(t.type===`text`||t.type===`email`)&&(0,V.jsx)(d,{id:t.name,type:t.type,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u,className:`rounded-xl`}),t.type===`password`&&(0,V.jsx)(d,{id:t.name,type:`password`,value:n[t.name]||``,onChange:e=>o(t.name,e.target.value),placeholder:u??r(`leaveBlankToKeepUnchanged`),className:`rounded-xl`}),t.type===`number`&&(0,V.jsx)(d,{id:t.name,type:`number`,value:n[t.name]||0,onChange:e=>o(t.name,parseInt(e.target.value,10)||0),placeholder:u,className:`rounded-xl`}),t.type===`tags`&&(0,V.jsx)(Oe,{value:n[t.name]||[],onChange:e=>o(t.name,e)}),t.type===`select`&&(0,V.jsxs)(M,{value:n[t.name]||``,onValueChange:e=>o(t.name,e),children:[(0,V.jsx)(oe,{className:`rounded-xl`,children:(0,V.jsx)(ie,{})}),(0,V.jsx)(he,{children:(t.options??[]).map(e=>(0,V.jsx)(j,{value:e.value,children:e.label},e.value))})]}),t.type===`json`&&(0,V.jsx)(`textarea`,{id:t.name,value:i[t.name]??`{}`,onChange:e=>a(n=>({...n,[t.name]:e.target.value})),className:`min-h-[120px] w-full resize-none rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-mono`})]},t.name)})})}var je=t(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),H=t((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),U=t((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),Me=t(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),Ne=t(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),Pe=t((e=>{var t=H().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),Fe=t((e=>{var t=H().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),Ie=t((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),W=t((e=>{var t=U(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Le=t((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),Re=t((e=>{var t=Le();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),ze=t(((e,t)=>{var n=Re();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),G=t((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),K=t((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
2
- ]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^`+t+`$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),q=t((e=>{var t=G(),n=K();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),Be=t((e=>{var t=H(),n=W(),r=U(),i=q(),a=G(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),Ve=t((e=>{var t=H(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),He=t(((e,t)=>{var n=q();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),Ue=t(((e,t)=>{var n=q(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),We=t(((e,t)=>{var n=q();function r(e){this.mode=n.BYTE,typeof e==`string`?this.data=new TextEncoder().encode(e):this.data=new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),Ge=t(((e,t)=>{var n=q(),r=H();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
3
- Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),Ke=t(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),qe=t((e=>{var t=q(),n=He(),r=Ue(),i=We(),a=Ge(),o=K(),s=H(),c=Ke();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
4
- Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),Je=t((e=>{var t=H(),n=U(),r=Me(),i=Ne(),a=Pe(),o=Fe(),s=Ie(),c=W(),l=ze(),u=Be(),d=Ve(),f=q(),p=qe();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
5
- The chosen QR Code version cannot contain this amount of data.
6
- Minimum version required to store current data is: `+c+`.
7
- `);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),Ye=t((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||={};let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[a[t*i+r]?1:0]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),Xe=t((e=>{var t=Ye();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),Ze=t((e=>{var t=Ye();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
8
- `;return typeof a==`function`&&a(null,p),p}})),Qe=t((e=>{var t=je(),n=Je(),r=Xe(),i=Ze();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))();function $e(){return p({mutationFn:({channel:e,data:t})=>y(e,t)})}function et(){return p({mutationFn:({channel:e,data:t})=>x(e,t)})}function tt(){return p({mutationFn:({channel:e,data:t})=>h(e,t)})}var nt={weixin:{title:`weixinAuthTitle`,description:`weixinAuthDescription`,hint:`weixinAuthHint`,capabilityHint:`weixinAuthCapabilityHint`,disabledHint:`weixinAuthDisabledHint`,connect:`weixinAuthConnect`,qrAlt:`weixinAuthQrAlt`,scanPrompt:`weixinAuthScanPrompt`,readyTitle:`weixinAuthReadyTitle`,readyDescription:`weixinAuthReadyDescription`,advancedTitle:`weixinAuthAdvancedTitle`,advancedDescription:`weixinAuthAdvancedDescription`},feishu:{title:`feishuAuthTitle`,description:`feishuAuthDescription`,hint:`feishuAuthHint`,capabilityHint:`feishuAuthCapabilityHint`,disabledHint:`feishuAuthDisabledHint`,connect:`feishuAuthConnect`,qrAlt:`feishuAuthQrAlt`,scanPrompt:`feishuAuthScanPrompt`,readyTitle:`feishuAuthReadyTitle`,readyDescription:`feishuAuthReadyDescription`,advancedTitle:`feishuAuthAdvancedTitle`,advancedDescription:`feishuAuthAdvancedDescription`,domainLabel:`feishuAuthDomain`}};function rt(e){let{accounts:t}=e,n=new Set;if(typeof e.defaultAccountId==`string`&&e.defaultAccountId.trim()&&n.add(e.defaultAccountId.trim()),t&&typeof t==`object`&&!Array.isArray(t))for(let e of Object.keys(t)){let t=e.trim();t&&n.add(t)}return[...n]}function it(e,t){if(typeof e.baseUrl==`string`&&e.baseUrl.trim())return e.baseUrl.trim();if(typeof t.baseUrl==`string`&&t.baseUrl.trim())return t.baseUrl.trim()}function at(e,t){return(typeof e.domain==`string`?e.domain.trim():``)||(typeof t.domain==`string`?t.domain.trim():``)||void 0}function ot(e,t){return at(e,t)===`lark`?`lark`:`feishu`}function st(e){return e===`lark`?`https://open.larksuite.com/app`:`https://open.feishu.cn/app`}function ct(e,t){return S({queryKey:[`channel-qr`,e,t],enabled:!!t,queryFn:()=>(0,Qe.toDataURL)(t,{errorCorrectionLevel:`M`,margin:1,width:480})}).data??null}function lt({activeSession:t,baseUrl:n,channelEnabled:i,copy:a,connectButtonLabel:o,connectedAccountIds:s,disabled:c,domain:l,handleStartAuth:u,hasConnectedAccount:d,primaryAccountId:p,statusLabel:m}){return(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full bg-white/90 px-3 py-1 text-xs font-medium text-primary shadow-sm`,children:[(0,V.jsx)(z,{className:`h-3.5 w-3.5`}),r(a.title)]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`text-base font-semibold text-gray-900`,children:r(a.description)}),(0,V.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:r(a.hint)})]}),(0,V.jsxs)(`div`,{className:e(`inline-flex w-fit items-center gap-2 rounded-full px-3 py-1 text-xs font-medium`,t?`bg-amber-50 text-amber-700`:d?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-600`),children:[t?(0,V.jsx)(pe,{className:`h-3.5 w-3.5 animate-spin`}):(0,V.jsx)(R,{className:`h-3.5 w-3.5`}),m]}),(0,V.jsxs)(`div`,{className:`space-y-1 text-sm text-gray-600`,children:[(0,V.jsx)(`p`,{children:r(i||!d?a.capabilityHint:a.disabledHint)}),p?(0,V.jsxs)(`p`,{children:[r(`weixinAuthPrimaryAccount`),`: `,(0,V.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:p})]}):null,s.length>1?(0,V.jsxs)(`p`,{children:[r(`weixinAuthConnectedAccounts`),`: `,(0,V.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:s.join(`, `)})]}):null,n?(0,V.jsxs)(`p`,{children:[r(`weixinAuthBaseUrl`),`: `,(0,V.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:n})]}):null,l&&a.domainLabel?(0,V.jsxs)(`p`,{children:[r(a.domainLabel),`: `,(0,V.jsx)(`span`,{className:`font-mono text-xs text-gray-900`,children:l})]}):null]}),(0,V.jsx)(f,{type:`button`,onClick:()=>void u(),disabled:c,className:`rounded-xl`,children:o})]})}function ut({activeSession:e,authMessage:t,copy:n,qrDataUrl:i}){return(0,V.jsx)(`div`,{className:`w-full max-w-sm rounded-2xl border border-dashed border-primary/25 bg-white/85 p-4 shadow-sm`,children:e?(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-gray-100 bg-white p-3`,children:i?(0,V.jsx)(`img`,{src:i,alt:r(n.qrAlt),className:`mx-auto aspect-square w-full max-w-[240px] object-contain`}):(0,V.jsx)(`div`,{className:`flex aspect-square w-full items-center justify-center rounded-xl bg-gray-50 text-gray-500`,children:(0,V.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,V.jsx)(pe,{className:`h-5 w-5 animate-spin`}),(0,V.jsx)(`p`,{className:`text-xs`,children:r(`weixinAuthStarting`)})]})})}),(0,V.jsxs)(`div`,{className:`space-y-1 text-xs text-gray-500`,children:[(0,V.jsx)(`p`,{children:t||e.note||r(n.scanPrompt)}),(0,V.jsxs)(`p`,{children:[r(`weixinAuthExpiresAt`),`: `,a(e.expiresAt)]})]}),(0,V.jsxs)(`a`,{href:e.qrCodeUrl,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-xs text-primary transition-colors hover:text-primary-hover`,children:[(0,V.jsx)(E,{className:`h-3.5 w-3.5`}),r(`weixinAuthOpenQr`)]})]}):(0,V.jsxs)(`div`,{className:`flex min-h-[280px] flex-col items-center justify-center rounded-2xl bg-gray-50/80 px-6 text-center`,children:[(0,V.jsx)(z,{className:`h-9 w-9 text-gray-300`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-gray-700`,children:r(n.readyTitle)}),(0,V.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-gray-500`,children:r(n.readyDescription)})]})})}function dt({channelConfig:e,channelEnabled:t,channelName:n,disabled:i,formData:a}){let o=m(),s=$e(),c=et(),[l,d]=(0,B.useState)(null),[f,p]=(0,B.useState)(null),[h,g]=(0,B.useState)(!1),_=(0,B.useMemo)(()=>rt(e),[e]),v=_[0],y=it(a,e),b=n===`feishu`?at(a,e):void 0,x=_.length>0,S=x&&!h?null:l,C=ct(n,S?.qrCodeUrl),w=nt[n];(0,B.useEffect)(()=>{if(!S)return;let e=!1,t=null,i=async()=>{try{let a=await c.mutateAsync({channel:n,data:{sessionId:S.sessionId}});if(e)return;if(p(a),a.status===`authorized`){await o.invalidateQueries({queryKey:[`config`]}),await o.invalidateQueries({queryKey:[`config-meta`]}),u.success(a.message||r(`weixinAuthAuthorized`)),d(null);return}if(a.status===`expired`||a.status===`error`){u.error(a.message||r(`weixinAuthRetryRequired`)),d(null);return}t=setTimeout(i,a.nextPollMs??S.intervalMs)}catch(t){e||(u.error(`${r(`error`)}: ${t instanceof Error?t.message:String(t)}`),d(null))}};return t=setTimeout(i,S.intervalMs),()=>{e=!0,t&&clearTimeout(t)}},[n,S,c,o]);let T=async()=>{try{let e=await s.mutateAsync({channel:n,data:{baseUrl:y,domain:b,accountId:typeof a.defaultAccountId==`string`&&a.defaultAccountId.trim()?a.defaultAccountId.trim():void 0}});g(x),d(e),p({channel:n,status:`pending`,message:e.note,nextPollMs:e.intervalMs})}catch(e){u.error(`${r(`error`)}: ${e instanceof Error?e.message:String(e)}`)}},E=S?f?.status===`scanned`?r(`weixinAuthScanned`):r(`weixinAuthWaiting`):r(x?t?`weixinAuthAuthorized`:`weixinAuthConnectedDisabled`:`weixinAuthNotConnected`),D=s.isPending?r(`weixinAuthStarting`):r(S?`weixinAuthWaiting`:x?`weixinAuthReconnect`:w.connect),O=x?r(`weixinAuthAuthorized`):f?.message;return(0,V.jsx)(`section`,{className:`rounded-2xl border border-primary/20 bg-gradient-to-br from-primary-50/70 via-white to-emerald-50/60 p-5`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,V.jsx)(lt,{activeSession:S,baseUrl:y,channelEnabled:t,copy:w,connectButtonLabel:D,connectedAccountIds:_,disabled:i||s.isPending||!!S,domain:b,handleStartAuth:T,hasConnectedAccount:x,primaryAccountId:v,statusLabel:E}),(0,V.jsx)(ut,{activeSession:S,authMessage:O,copy:w,qrDataUrl:C})]})})}function ft({channelConfig:e,disabled:t,formData:n}){let i=m(),a=tt(),[o,s]=(0,B.useState)(()=>ot(n,e)),[c,l]=(0,B.useState)(``),[p,h]=(0,B.useState)(``),g=st(o),v=!!(c.trim()&&p.trim())&&!t&&!a.isPending,y=async()=>{try{let e=await a.mutateAsync({channel:`feishu`,data:{domain:o,fields:{appId:c.trim(),appSecret:p.trim()}}});await i.invalidateQueries({queryKey:[`config`]}),await i.invalidateQueries({queryKey:[`config-meta`]}),u.success(e.message||r(`feishuExistingAgentConnectSuccess`)),h(``)}catch(e){u.error(`${r(`error`)}: ${e instanceof Error?e.message:String(e)}`)}};return(0,V.jsx)(`section`,{className:`rounded-2xl border border-primary/20 bg-white p-5`,children:(0,V.jsxs)(`div`,{className:`flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between`,children:[(0,V.jsxs)(`div`,{className:`max-w-xl space-y-3`,children:[(0,V.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full bg-gray-100 px-3 py-1 text-xs font-medium text-gray-700`,children:[(0,V.jsx)(R,{className:`h-3.5 w-3.5`}),r(`feishuExistingAgentTitle`)]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h4`,{className:`text-base font-semibold text-gray-900`,children:r(`feishuExistingAgentDescription`)}),(0,V.jsx)(`p`,{className:`mt-1 text-sm text-gray-600`,children:r(`feishuExistingAgentHint`)})]}),(0,V.jsxs)(`a`,{href:g,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1.5 text-sm text-primary transition-colors hover:text-primary-hover`,children:[(0,V.jsx)(E,{className:`h-4 w-4`}),r(o===`lark`?`feishuExistingAgentOpenLarkList`:`feishuExistingAgentOpenFeishuList`)]})]}),(0,V.jsxs)(`div`,{className:`w-full max-w-sm space-y-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(_,{htmlFor:`feishu-existing-platform`,children:r(`feishuPlatform`)}),(0,V.jsxs)(M,{value:o,onValueChange:e=>s(e===`lark`?`lark`:`feishu`),children:[(0,V.jsx)(oe,{id:`feishu-existing-platform`,className:`rounded-xl`,children:(0,V.jsx)(ie,{})}),(0,V.jsxs)(he,{children:[(0,V.jsx)(j,{value:`feishu`,children:`Feishu`}),(0,V.jsx)(j,{value:`lark`,children:`Lark`})]})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(_,{htmlFor:`feishu-existing-app-id`,children:`App ID`}),(0,V.jsx)(d,{id:`feishu-existing-app-id`,value:c,onChange:e=>l(e.target.value),className:`rounded-xl`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(_,{htmlFor:`feishu-existing-app-secret`,children:`App Secret`}),(0,V.jsx)(d,{id:`feishu-existing-app-secret`,type:`password`,value:p,onChange:e=>h(e.target.value),className:`rounded-xl`})]}),(0,V.jsx)(f,{type:`button`,onClick:()=>void y(),disabled:!v,className:`w-full rounded-xl`,children:a.isPending?r(`feishuExistingAgentConnecting`):r(`feishuExistingAgentConnect`)})]})]})})}function pt(e){let[t,n]=(0,B.useState)(`create`);return(0,V.jsxs)(ee,{value:t,onValueChange:e=>n(e===`existing`?`existing`:`create`),children:[(0,V.jsxs)(de,{children:[(0,V.jsx)(k,{value:`create`,children:r(`feishuAuthCreateNew`)}),(0,V.jsx)(k,{value:`existing`,children:r(`feishuAuthConnectExisting`)})]}),(0,V.jsx)(N,{value:`create`,className:`mt-4`,children:(0,V.jsx)(dt,{...e,channelName:`feishu`})}),(0,V.jsx)(N,{value:`existing`,className:`mt-4`,children:(0,V.jsx)(ft,{...e})})]})}var mt=[{value:`pairing`,label:`pairing`},{value:`allowlist`,label:`allowlist`},{value:`open`,label:`open`},{value:`disabled`,label:`disabled`}],J=[{value:`open`,label:`open`},{value:`allowlist`,label:`allowlist`},{value:`disabled`,label:`disabled`}],ht=[{value:`feishu`,label:`feishu`},{value:`lark`,label:`lark`}],gt=[{value:`off`,label:`off`},{value:`partial`,label:`partial`},{value:`block`,label:`block`},{value:`progress`,label:`progress`}];function _t(){return{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`),section:`primary`},{name:`defaultAccountId`,type:`text`,label:r(`defaultAccountId`)},{name:`domain`,type:`select`,label:r(`feishuAuthDomain`),options:ht},{name:`allowFrom`,type:`tags`,label:r(`allowFrom`)},{name:`groupPolicy`,type:`select`,label:r(`groupPolicy`),options:J},{name:`requireMention`,type:`boolean`,label:r(`requireMention`)},{name:`accounts`,type:`json`,label:r(`accountsJson`)}],layout:[{type:`fields`,section:`primary`},{type:`custom`,sectionId:`feishu-auth`},{type:`fields`,section:`advanced`,collapsible:{title:r(`feishuAuthAdvancedTitle`),description:r(`feishuAuthAdvancedDescription`)}}]}}function vt(){return{telegram:{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`)},{name:`token`,type:`password`,label:r(`botToken`)},{name:`allowFrom`,type:`tags`,label:r(`allowFrom`)},{name:`proxy`,type:`text`,label:r(`proxy`)},{name:`accountId`,type:`text`,label:r(`accountId`)},{name:`dmPolicy`,type:`select`,label:r(`dmPolicy`),options:mt},{name:`groupPolicy`,type:`select`,label:r(`groupPolicy`),options:J},{name:`groupAllowFrom`,type:`tags`,label:r(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:r(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:r(`mentionPatterns`)},{name:`groups`,type:`json`,label:r(`groupRulesJson`)}]},discord:{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`)},{name:`token`,type:`password`,label:r(`botToken`)},{name:`allowBots`,type:`boolean`,label:r(`allowBotMessages`)},{name:`allowFrom`,type:`tags`,label:r(`allowFrom`)},{name:`gatewayUrl`,type:`text`,label:r(`gatewayUrl`)},{name:`intents`,type:`number`,label:r(`intents`)},{name:`proxy`,type:`text`,label:r(`proxy`)},{name:`mediaMaxMb`,type:`number`,label:r(`attachmentMaxSizeMb`)},{name:`streaming`,type:`select`,label:r(`streamingMode`),options:gt},{name:`draftChunk`,type:`json`,label:r(`draftChunkingJson`)},{name:`textChunkLimit`,type:`number`,label:r(`textChunkLimit`)},{name:`accountId`,type:`text`,label:r(`accountId`)},{name:`dmPolicy`,type:`select`,label:r(`dmPolicy`),options:mt},{name:`groupPolicy`,type:`select`,label:r(`groupPolicy`),options:J},{name:`groupAllowFrom`,type:`tags`,label:r(`groupAllowFrom`)},{name:`requireMention`,type:`boolean`,label:r(`requireMention`)},{name:`mentionPatterns`,type:`tags`,label:r(`mentionPatterns`)},{name:`groups`,type:`json`,label:r(`groupRulesJson`)}]},whatsapp:{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`)},{name:`bridgeUrl`,type:`text`,label:r(`bridgeUrl`)},{name:`allowFrom`,type:`tags`,label:r(`allowFrom`)}]},feishu:_t(),dingtalk:{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`)},{name:`clientId`,type:`text`,label:r(`clientId`)},{name:`clientSecret`,type:`password`,label:r(`clientSecret`)},{name:`allowFrom`,type:`tags`,label:r(`allowFrom`)}]},wecom:{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`)},{name:`corpId`,type:`text`,label:r(`corpId`)},{name:`agentId`,type:`text`,label:r(`agentId`)},{name:`secret`,type:`password`,label:r(`secret`)},{name:`token`,type:`password`,label:r(`token`)},{name:`callbackPort`,type:`number`,label:r(`callbackPort`)},{name:`callbackPath`,type:`text`,label:r(`callbackPath`)},{name:`allowFrom`,type:`tags`,label:r(`allowFrom`)}]},weixin:{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`),section:`primary`},{name:`defaultAccountId`,type:`text`,label:r(`defaultAccountId`)},{name:`baseUrl`,type:`text`,label:r(`baseUrl`)},{name:`pollTimeoutMs`,type:`number`,label:r(`pollTimeoutMs`)},{name:`allowFrom`,type:`tags`,label:r(`allowFrom`)},{name:`accounts`,type:`json`,label:r(`accountsJson`)}],layout:[{type:`fields`,section:`primary`},{type:`custom`,sectionId:`weixin-auth`},{type:`fields`,section:`advanced`,collapsible:{title:r(`weixinAuthAdvancedTitle`),description:r(`weixinAuthAdvancedDescription`)}}]},slack:{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`)},{name:`mode`,type:`text`,label:r(`mode`)},{name:`webhookPath`,type:`text`,label:r(`webhookPath`)},{name:`allowBots`,type:`boolean`,label:r(`allowBotMessages`)},{name:`botToken`,type:`password`,label:r(`botToken`)},{name:`appToken`,type:`password`,label:r(`appToken`)}]},email:{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`)},{name:`consentGranted`,type:`boolean`,label:r(`consentGranted`)},{name:`imapHost`,type:`text`,label:r(`imapHost`)},{name:`imapPort`,type:`number`,label:r(`imapPort`)},{name:`imapUsername`,type:`text`,label:r(`imapUsername`)},{name:`imapPassword`,type:`password`,label:r(`imapPassword`)},{name:`fromAddress`,type:`email`,label:r(`fromAddress`)}]},qq:{fields:[{name:`enabled`,type:`boolean`,label:r(`enabled`)},{name:`appId`,type:`text`,label:r(`appId`)},{name:`secret`,type:`password`,label:r(`appSecret`)},{name:`markdownSupport`,type:`boolean`,label:r(`markdownSupport`)},{name:`allowFrom`,type:`tags`,label:r(`allowFrom`)}]}}}function Y(e){let t=o();return e.tutorialUrls?.[t]||e.tutorialUrls?.default||e.tutorialUrl}var yt=[],bt=[{type:`fields`,section:`all`}],X=new Set,Z=new Map,Q=null;function $(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function xt(e,t){let n={...e};for(let[e,r]of Object.entries(t))n[e]=$(n[e])&&$(r)?xt(n[e],r):r;return n}function St(e,t){let n={},r=n,i=e.split(`.`);for(let e=0;e<i.length-1;e+=1)r[i[e]]={},r=r[i[e]];return r[i[i.length-1]]=t,n}function Ct(e,t){return t===`all`?e:e.filter(e=>t===`primary`?e.section===`primary`:e.section!==`primary`)}function wt(e,t){let n={};return t.filter(e=>e.type===`json`).forEach(t=>{n[t.name]=JSON.stringify(e[t.name]??{},null,2)}),n}function Tt(){Q||=b.eventBus.on(l.channelConfigApplyStatus,e=>{Z.set(e.channel,e.status===`started`?{status:`applying`}:e.status===`succeeded`?{status:`applied`}:{status:`failed`,message:e.message}),X.forEach(e=>e())})}function Et(e){return X.add(e),Tt(),()=>{X.delete(e),!X.size&&Q&&(Q(),Q=null,Z.clear())}}function Dt(e){return(0,B.useSyncExternalStore)(Et,()=>e?Z.get(e)??null:null,()=>null)}function Ot(e){return e?e.status===`applying`?{className:`text-amber-600`,label:r(`channelConfigApplying`)}:e.status===`applied`?{className:`text-emerald-600`,label:r(`channelConfigApplied`)}:{className:`text-red-600`,label:`${r(`channelConfigApplyFailed`)}${e.message?`: ${e.message}`:``}`}:null}function kt({channelApplyStatus:t,channelLabel:n,channelName:i,enabled:a,tutorialUrl:o}){return(0,V.jsx)(I,{className:`px-6 py-5`,children:(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(ne,{name:i,src:re(i),className:e(`h-9 w-9 rounded-lg border`,a?`border-primary/30 bg-white`:`border-gray-200/70 bg-white`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,V.jsx)(`span`,{className:`text-sm font-semibold uppercase text-gray-500`,children:i[0]})}),(0,V.jsx)(`h3`,{className:`truncate text-lg font-semibold text-gray-900 capitalize`,children:n})]}),(0,V.jsx)(`p`,{className:`mt-2 text-sm text-gray-500`,children:r(`channelsFormDescription`)}),t?(0,V.jsx)(`p`,{className:e(`mt-2 text-xs font-medium`,t.className),children:t.label}):null,o?(0,V.jsxs)(`a`,{href:o,className:`mt-2 inline-flex items-center gap-1.5 text-xs text-primary transition-colors hover:text-primary-hover`,children:[(0,V.jsx)(T,{className:`h-3.5 w-3.5`}),r(`channelsGuideTitle`)]}):null]}),(0,V.jsx)(A,{status:a?`active`:`inactive`,label:r(a?`statusActive`:`statusInactive`)})]})})}function At({channelConfig:e,channelName:t,disabled:n,enabled:r,fields:i,formData:a,jsonDrafts:o,layoutBlocks:s,setJsonDrafts:c,uiHints:l,updateField:u}){return(0,V.jsx)(V.Fragment,{children:s.map((s,d)=>{if(s.type===`fields`){let e=Ct(i,s.section);if(e.length===0)return null;let n=(0,V.jsx)(Ae,{channelName:t,fields:e,formData:a,jsonDrafts:o,setJsonDrafts:c,updateField:u,uiHints:l});return s.collapsible?(0,V.jsxs)(`details`,{className:`group rounded-2xl border border-gray-200/80 bg-white`,children:[(0,V.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-5 py-4 text-sm font-medium text-gray-900`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{children:s.collapsible.title}),s.collapsible.description?(0,V.jsx)(`p`,{className:`mt-1 text-xs font-normal text-gray-500`,children:s.collapsible.description}):null]}),(0,V.jsx)(fe,{className:`h-4 w-4 text-gray-400 transition-transform group-open:rotate-180`})]}),(0,V.jsx)(`div`,{className:`space-y-6 border-t border-gray-100 px-5 py-5`,children:n})]},`${s.type}-${s.section}-${d}`):(0,V.jsx)(`div`,{children:n},`${s.type}-${s.section}-${d}`)}return s.sectionId===`feishu-auth`?(0,V.jsx)(pt,{channelConfig:e,formData:a,channelEnabled:r,disabled:n},`${s.type}-${s.sectionId}-${d}`):s.sectionId===`weixin-auth`?(0,V.jsx)(dt,{channelConfig:e,formData:a,channelName:`weixin`,channelEnabled:r,disabled:n},`${s.type}-${s.sectionId}-${d}`):null})})}function jt({actions:e,channelConfig:t,channelLabel:n,channelName:i,fields:a,layoutBlocks:o,tutorialUrl:s,uiHints:c}){let l=me(),d=ue(),[p,m]=(0,B.useState)(()=>({...t})),[h,g]=(0,B.useState)(()=>wt(t,a)),[_,v]=(0,B.useState)(null),y=Ot(Dt(i)),b=typeof p.enabled==`boolean`?p.enabled:!!t.enabled,x=l.isPending||!!_,S=(e,t)=>m(n=>({...n,[e]:t})),C=e=>{e.preventDefault();let t={...p};for(let e of a){if(e.type===`password`){let n=t[e.name];(typeof n!=`string`||n.length===0)&&delete t[e.name]}if(e.type===`json`)try{t[e.name]=(h[e.name]??``).trim()?JSON.parse(h[e.name]):{}}catch{u.error(`${r(`invalidJson`)}: ${e.name}`);return}}l.mutate({channel:i,data:t})},w=e=>{if(!$(e?.channels)||!$(e.channels[i]))return;let t=e.channels[i];m(e=>xt(e,t)),g(e=>{let n={...e},r=!1;for(let e of a)e.type!==`json`||!Object.prototype.hasOwnProperty.call(t,e.name)||(n[e.name]=JSON.stringify(t[e.name]??{},null,2),r=!0);return r?n:e})},T=async e=>{v(e.id);try{let t=`channels.${i}`,n={...p};e.saveBeforeRun&&(n={...n,...e.savePatch??{}},m(n),await l.mutateAsync({channel:i,data:n}));let a=await d.mutateAsync({actionId:e.id,data:{scope:t,draftConfig:St(t,n)}});w(a.patch),a.ok?u.success(a.message||r(`success`)):u.error(a.message||r(`error`))}catch(e){u.error(`${r(`error`)}: ${e instanceof Error?e.message:String(e)}`)}finally{v(null)}};return(0,V.jsxs)(F,{children:[(0,V.jsx)(kt,{channelName:i,channelLabel:n,enabled:b,tutorialUrl:s,channelApplyStatus:y}),(0,V.jsxs)(`form`,{onSubmit:C,className:`flex min-h-0 flex-1 flex-col`,children:[(0,V.jsx)(L,{className:`space-y-6 px-6 py-5`,children:(0,V.jsx)(At,{channelConfig:t,channelName:i,enabled:b,fields:a,formData:p,jsonDrafts:h,layoutBlocks:o,setJsonDrafts:g,uiHints:c,updateField:S,disabled:x})}),(0,V.jsxs)(Ce,{className:`flex flex-wrap items-center justify-between gap-3 px-6 py-4`,children:[(0,V.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:e.filter(e=>e.trigger===`manual`).map(e=>(0,V.jsx)(f,{type:`button`,onClick:()=>void T(e),disabled:x,variant:`secondary`,children:_===e.id?r(`connecting`):e.title},e.id))}),(0,V.jsx)(f,{type:`submit`,disabled:x,children:l.isPending?r(`saving`):r(`save`)})]})]})]})}function Mt({channelName:e}){let{data:t}=se(),{data:n}=te(),{data:i}=O(),a=e?t?.channels[e]??null:null,o=n?.channels.find(t=>t.name===e),s=(0,B.useMemo)(()=>vt()[e||``],[e]);if(!e||!o||!a)return(0,V.jsx)(xe,{children:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h3`,{className:`text-base font-semibold text-gray-900`,children:r(`channelsSelectTitle`)}),(0,V.jsx)(`p`,{className:`mt-2 text-sm text-gray-500`,children:r(`channelsSelectDescription`)})]})});let c=s?.fields??yt,l=s?.layout??bt,u=i?.uiHints,d=P(`channels.${e}`,u)?.label??e,f=Y(o),p=JSON.stringify({channelName:e,channelConfig:a,jsonFields:c.filter(e=>e.type===`json`).map(e=>e.name)});return(0,V.jsx)(jt,{actions:i?.actions?.filter(t=>t.scope===`channels.${e}`)??[],channelConfig:a,channelLabel:d,channelName:e,fields:c,layoutBlocks:l,tutorialUrl:f,uiHints:u},p)}var Nt={telegram:`channelDescTelegram`,slack:`channelDescSlack`,email:`channelDescEmail`,webhook:`channelDescWebhook`,discord:`channelDescDiscord`,feishu:`channelDescFeishu`,weixin:`channelDescWeixin`},Pt=[`weixin`,`feishu`,`discord`,`qq`];function Ft(e){let t=new Map(Pt.map((e,t)=>[e,t]));return e.map((e,t)=>({channel:e,index:t})).sort((e,n)=>{let r=t.get(e.channel.name)??1/0,i=t.get(n.channel.name)??1/0;return r===i?e.index-n.index:r-i}).map(({channel:e})=>e)}function It(){let{isMobile:t}=_e(),{data:n}=se(),{data:i}=te(),{data:a}=O(),[o,s]=(0,B.useState)(`enabled`),[l,u]=(0,B.useState)(null),[f,p]=(0,B.useState)(``),m=(0,B.useMemo)(()=>Ft(i?.channels??[]),[i?.channels]),h=n?.channels,g=(0,B.useMemo)(()=>{let e=f.trim().toLowerCase();return m.filter(e=>o!==`enabled`||!!h?.[e.name]?.enabled).filter(t=>e?(t.displayName||t.name).toLowerCase().includes(e)||t.name.toLowerCase().includes(e):!0)},[o,h,m,f]),_=l&&g.some(e=>e.name===l)?l:t?null:g[0]?.name??null;return!n||!i?(0,V.jsx)(`div`,{className:`p-8 text-gray-400`,children:r(`channelsLoading`)}):(0,V.jsxs)(c,{className:`pb-0 xl:flex xl:h-full xl:min-h-0 xl:flex-col`,children:[(0,V.jsx)(v,{title:r(`channelsPageTitle`),description:r(`channelsPageDescription`)}),(0,V.jsxs)(be,{className:`xl:min-h-0`,mobileView:t?_?`detail`:`list`:void 0,onMobileBack:()=>u(null),mobileListLabel:r(`channelsPageTitle`),children:[(0,V.jsxs)(F,{children:[(0,V.jsx)(I,{className:`px-4 pt-4`,children:(0,V.jsx)(ve,{tabs:[{id:`enabled`,label:r(`channelsTabEnabled`),count:m.filter(e=>h?.[e.name]?.enabled).length},{id:`all`,label:r(`channelsTabAll`),count:m.length}],activeTab:o,onChange:s,className:`mb-0`})}),(0,V.jsx)(`div`,{className:`border-b border-gray-100 px-4 py-3`,children:(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(w,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400`}),(0,V.jsx)(d,{value:f,onChange:e=>p(e.target.value),placeholder:r(`channelsFilterPlaceholder`),className:`h-10 rounded-xl pl-9`})]})}),(0,V.jsxs)(L,{className:`space-y-2 p-3`,children:[g.map(t=>{let i=!!n.channels[t.name]?.enabled,o=Y(t),s=P(`channels.${t.name}`,a?.uiHints)?.help||r(Nt[t.name]||`channelDescriptionDefault`);return(0,V.jsx)(we,{onClick:()=>u(t.name),active:_===t.name,children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,V.jsx)(ne,{name:t.name,src:re(t.name),className:e(`h-10 w-10 rounded-lg border`,i?`border-primary/30 bg-white`:`border-gray-200/70 bg-white`),imgClassName:`h-5 w-5 object-contain`,fallback:(0,V.jsx)(`span`,{className:`text-sm font-semibold uppercase text-gray-500`,children:t.name[0]})}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`p`,{className:`truncate text-sm font-semibold text-gray-900`,children:t.displayName||t.name}),(0,V.jsx)(`p`,{className:`line-clamp-1 text-[11px] text-gray-500`,children:s})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[o?(0,V.jsx)(`a`,{href:o,onClick:e=>e.stopPropagation(),className:`inline-flex h-7 w-7 items-center justify-center rounded-md text-gray-300 transition-colors hover:bg-gray-100/70 hover:text-gray-500`,title:r(`channelsGuideTitle`),children:(0,V.jsx)(E,{className:`h-3.5 w-3.5`})}):null,(0,V.jsx)(A,{status:i?`active`:`inactive`,label:r(i?`statusActive`:`statusInactive`),className:`min-w-[56px] justify-center`})]})]})},t.name)}),g.length===0?(0,V.jsx)(Se,{icon:le,title:r(`channelsNoMatch`)}):null]})]}),(0,V.jsx)(Mt,{channelName:_??void 0})]})]})}export{It as ChannelsList};
@@ -1,105 +0,0 @@
1
- import{d as e,h as t,i as n,m as r,v as i}from"./react-B2X_ph0a.js";import{A as a,At as o,D as s,E as c,Gt as l,Ht as u,Jt as d,Kt as f,Lt as p,Mt as m,Nt as h,O as g,Rt as _,Tt as v,Ut as y,Vt as b,Wt as x,Xt as S,_t as C,an as w,en as T,in as E,j as D,k as O,kt as ee,nn as te,qt as ne,rn as re,tn as k,wt as A,zt as j}from"./api-DruAcori.js";import{d as ie,f as ae,p as oe}from"./doc-browser-BI7HSaMK.js";import{a as se,c as M,i as N,l as ce,n as le,o as ue,r as de,s as P}from"./mcp-marketplace-page-DDjeHd1I.js";import{a as F,c as fe,i as I,n as pe,o as L,r as R,s as me}from"./confirm-dialog-B0TP-vPd.js";import{t as z}from"./createLucideIcon-Br1EFMEr.js";import{n as he}from"./search-CdhgFNwf.js";import{i as ge,n as _e,r as ve,t as ye}from"./provider-scoped-model-input-t1tCP5y5.js";import{t as be}from"./play-CqNi0u02.js";import{t as xe}from"./plus-BcIC8dG1.js";import{n as Se}from"./doc-browser-context-DB6TTHeE.js";import{$t as Ce,A as we,B as Te,C as Ee,Ct as De,D as Oe,E as ke,Et as Ae,F as je,H as Me,I as B,J as V,Jt as Ne,K as Pe,Kt as H,L as Fe,M as Ie,Mt as Le,N as Re,Nt as ze,O as Be,P as Ve,Q as He,Qt as Ue,R as We,S as Ge,St as Ke,T as qe,Tt as Je,V as Ye,X as Xe,Y as Ze,Yt as Qe,Z as $e,_ as et,a as tt,b as nt,c as rt,cn as it,d as at,dn as ot,f as st,fn as ct,ft as lt,g as ut,h as dt,i as ft,in as pt,j as mt,jt as ht,k as gt,l as _t,lt as vt,m as yt,n as bt,nt as xt,o as St,ot as Ct,p as wt,q as Tt,r as Et,s as Dt,sn as Ot,st as kt,t as At,tn as jt,tt as Mt,u as U,v as Nt,w as Pt,wt as Ft,x as W,xt as It,y as G,z as Lt}from"./index-GVTiCf1s.js";import{t as Rt}from"./tabs-custom-BBXu1OGs.js";import{t as zt}from"./tag-chip-ix15P-r4.js";function Bt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Vt(e,t,n){let r=e.slice(0);return r[t]=n,r}var Ht=class extends w{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,k.batch(()=>{let e=this.#i,t=this.#f(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!E(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Bt(e,n).forEach(e=>{e.destroy()}),Bt(n,e).forEach(e=>{e.subscribe(t=>{this.#p(e,t)})})),this.#m()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#f(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=re(this.#a,t(e))),this.#a}return e}#f(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new T(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#p(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Vt(this.#t,n,t),this.#m())}#m(){if(this.hasListeners()){let e=this.#a,t=this.#u(this.#t,this.#l);e!==this.#d(t,this.#r?.combine)&&k.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},K=i(t(),1);function Ut({queries:e,...t},n){let r=S(n),i=d(),a=ne(),o=K.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{b(e),x(e,a,r.getQueryCache().get(e.queryHash))}),f(a);let[s]=K.useState(()=>new Ht(r,o,t)),[c,p,m]=s.getOptimisticResult(o,t.combine),h=!i&&t.subscribed!==!1;K.useSyncExternalStore(K.useCallback(e=>h?s.subscribe(k.batchCalls(e)):te,[s,h]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),K.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let g=c.some((e,t)=>y(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&y(n,e)?u(n,new T(r,n),a):[]}):[];if(g.length>0)throw Promise.all(g);let _=c.find((e,t)=>{let n=o[t];return n&&l({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(_?.error)throw _.error;return p(m())}var Wt=z(`BriefcaseBusiness`,[[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2`,key:`1ksdt3`}],[`path`,{d:`M22 13a18.15 18.15 0 0 1-20 0`,key:`12hx5q`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`6`,rx:`2`,key:`i6l2r4`}]]),Gt=z(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Kt=z(`Clock3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16.5 12`,key:`1aq6pp`}]]),qt=z(`Compass`,[[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Jt=z(`Earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Yt=z(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Xt=z(`MessagesSquare`,[[`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z`,key:`p1xzt8`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1`,key:`1cx29u`}]]),Zt=z(`PenLine`,[[`path`,{d:`M12 20h9`,key:`t2du7b`}],[`path`,{d:`M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z`,key:`1ykcvy`}]]),Qt=z(`Power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),$t=z(`SquareTerminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),q=r(),en=K.forwardRef(({className:t,...n},r)=>(0,q.jsx)(`textarea`,{className:e(`flex min-h-28 w-full rounded-xl border border-gray-200/80 bg-white px-3.5 py-2.5 text-sm text-gray-900 placeholder:text-gray-300 placeholder:font-normal focus:outline-none focus:ring-1 focus:ring-primary/40 focus:border-primary/40 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,t),ref:r,...n}));en.displayName=`Textarea`;function tn(e){return{displayName:e.displayName??``,description:e.description??``,avatar:e.avatar??``,model:e.model??``,runtime:e.runtime??e.engine??``}}function nn(e){let{runtimeOptions:t,currentRuntime:n}=e,r=n.trim();if(!r)return t;let i=G(r);return t.some(e=>e.value===i)?t:[...t,{value:i,label:W(i),icon:null,ready:!1,reason:`unavailable`,reasonMessage:null,supportedModels:void 0,recommendedModel:null,cta:null}].sort((e,t)=>e.value===`native`?-1:t.value===`native`?1:e.value.localeCompare(t.value))}function rn({value:e,disabled:t=!1,runtimeOptions:r,defaultRuntime:i,onChange:a}){let o=e.trim()?G(e):``,s=nn({runtimeOptions:r,currentRuntime:e}),c=s.find(e=>e.value===o)??null,l=c?.reasonMessage?.trim()||(c?.ready===!1?n(`agentsRuntimeUnavailableHelp`):``);return(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsxs)(Pe,{value:o||i,onValueChange:e=>a(e===i?``:e),disabled:t,children:[(0,q.jsx)(Ze,{"aria-label":n(`agentsCardRuntimeLabel`),className:`rounded-xl`,children:(0,q.jsx)(Xe,{placeholder:n(`agentsRuntimeSelectPlaceholder`)})}),(0,q.jsx)(Tt,{className:`rounded-xl`,children:s.map(e=>(0,q.jsx)(V,{value:e.value,disabled:e.ready===!1&&e.value!==o,className:`rounded-lg`,children:e.label},e.value))})]}),l?(0,q.jsx)(`p`,{className:`text-xs text-gray-500`,children:l}):null]})}function an({agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o}){return(0,q.jsx)(R,{open:e!==null,onOpenChange:a,children:e?(0,q.jsx)(on,{agent:e,pending:t,providerCatalog:n,runtimeOptions:r,defaultRuntime:i,onOpenChange:a,onSubmit:o},e.id):null})}function on(e){let{agent:t,pending:r,providerCatalog:i,runtimeOptions:a,defaultRuntime:o,onOpenChange:s,onSubmit:c}=e,[l,u]=(0,K.useState)(tn(t));return(0,q.jsxs)(I,{className:`flex max-h-[calc(100vh-2rem)] flex-col overflow-hidden border-none bg-[linear-gradient(180deg,#fff9f1_0%,#ffffff_24%)] p-0 sm:max-h-[760px] sm:max-w-xl`,children:[(0,q.jsx)(`div`,{className:`shrink-0 border-b border-[#f0e2c8] px-6 py-6`,children:(0,q.jsxs)(me,{className:`text-left`,children:[(0,q.jsx)(fe,{children:n(`agentsEditDialogTitle`)}),(0,q.jsx)(F,{children:n(`agentsEditDialogDescription`)})]})}),(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-6`,children:(0,q.jsxs)(`div`,{className:`space-y-4`,children:[(0,q.jsx)(pe,{tone:`warning`,title:n(`agentsEditHomeReadonly`),description:n(`agentsEditHomeReadonlyHint`),children:(0,q.jsx)(`div`,{className:`break-all text-sm text-amber-950`,children:t.workspace??`-`})}),(0,q.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,q.jsx)(m,{value:l.displayName,onChange:e=>u(t=>({...t,displayName:e.target.value})),placeholder:n(`agentsFormNamePlaceholder`)}),(0,q.jsx)(en,{value:l.description,onChange:e=>u(t=>({...t,description:e.target.value})),placeholder:n(`agentsFormDescriptionPlaceholder`),rows:4,className:`md:col-span-2`}),(0,q.jsx)(m,{value:l.avatar,onChange:e=>u(t=>({...t,avatar:e.target.value})),placeholder:n(`agentsFormAvatarPlaceholder`)}),(0,q.jsx)(ye,{value:l.model,onChange:e=>u(t=>({...t,model:e})),providerCatalog:i,disabled:r,className:`md:col-span-2`}),(0,q.jsx)(rn,{value:l.runtime,onChange:e=>u(t=>({...t,runtime:e})),runtimeOptions:a,defaultRuntime:o,disabled:r})]})]})}),(0,q.jsxs)(L,{className:`shrink-0 border-t border-[#f1e7d4] px-6 py-5`,children:[(0,q.jsx)(h,{type:`button`,variant:`ghost`,onClick:()=>s(!1),disabled:r,children:n(`cancel`)}),(0,q.jsxs)(h,{type:`button`,variant:`primary`,className:`rounded-2xl px-5`,onClick:()=>c(t.id,l),disabled:r,children:[(0,q.jsx)(Ce,{className:`mr-2 h-4 w-4`}),n(`agentsEditSaveAction`)]})]})]})}var sn=`请直接创建一个默认示例 Agent,不要问我问题。创建完成后,简单告诉我它能做什么。`;function cn(e){let{agentCount:t,onCreate:r}=e;return(0,q.jsxs)(`section`,{className:`flex flex-col gap-3 border-b border-gray-200 pb-4 sm:flex-row sm:items-end sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`min-w-0 space-y-1`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h1`,{className:`text-xl font-semibold text-gray-950`,children:n(`agentsHeroEyebrow`)}),(0,q.jsx)(`span`,{className:`rounded-full border border-gray-200 bg-white px-2 py-0.5 text-xs font-medium text-gray-500`,children:t})]}),(0,q.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-gray-500`,children:n(`agentsHeroDescription`)})]}),(0,q.jsxs)(h,{type:`button`,variant:`primary`,className:`h-9 shrink-0 rounded-xl px-4 text-sm font-semibold`,onClick:r,children:[(0,q.jsx)(xe,{className:`mr-2 h-4 w-4`}),n(`agentsCreateButton`)]})]})}function ln(t){let{icon:n,label:r,disabled:i=!1,destructive:a=!1,onClick:o}=t;return(0,q.jsxs)(`button`,{type:`button`,className:e(`flex w-full items-center gap-2 rounded-lg px-3 py-2 text-left text-sm transition-colors disabled:cursor-not-allowed disabled:opacity-50`,a?`text-destructive hover:bg-destructive/10`:`text-gray-700 hover:bg-gray-100`),onClick:o,disabled:i,children:[(0,q.jsx)(n,{className:`h-4 w-4 shrink-0`}),(0,q.jsx)(`span`,{children:r})]})}function un(e){let{agent:t,runtimeOptions:r,defaultRuntimeLabel:i,updatePending:a,deletePending:o,onStartChat:s,onEdit:c,onDelete:l}=e,u=t.runtime?.trim()||t.engine?.trim()||``,d=u?r.find(e=>e.value===G(u))?.label??W(u):i;return(0,q.jsx)(A,{className:`group overflow-hidden border border-gray-200 bg-white shadow-none transition-colors duration-200 hover:border-gray-300`,children:(0,q.jsxs)(v,{className:`relative flex h-full flex-col gap-3 px-3.5 py-3.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-start gap-2.5 pr-16`,children:[(0,q.jsx)(Me,{agentId:t.id,displayName:t.displayName,avatarUrl:t.avatarUrl,className:`h-9 w-9 shrink-0`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`div`,{className:`truncate text-sm font-semibold text-gray-950`,children:t.displayName?.trim()||t.id}),t.builtIn?(0,q.jsxs)(zt,{tone:`warning`,className:`h-5 gap-1 border-amber-200 bg-amber-50 px-1.5 text-[10px] text-amber-700`,children:[(0,q.jsx)(Qe,{className:`h-3 w-3`}),n(`agentsCardBuiltInTag`)]}):null]}),(0,q.jsxs)(`div`,{className:`truncate text-xs text-gray-400`,children:[`@`,t.id]})]})]}),(0,q.jsxs)(`div`,{className:`absolute right-2.5 top-2.5 flex items-center gap-1 opacity-100 transition-opacity md:opacity-0 md:group-hover:opacity-100 md:group-focus-within:opacity-100`,children:[(0,q.jsx)(h,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":n(`agentsCardStartChat`),title:n(`agentsCardStartChat`),onClick:s,children:(0,q.jsx)(jt,{className:`h-4 w-4`})}),(0,q.jsxs)(ht,{children:[(0,q.jsx)(ze,{asChild:!0,children:(0,q.jsx)(h,{type:`button`,variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-lg text-gray-400 hover:text-gray-800`,"aria-label":n(`chatSessionMoreActions`),title:n(`chatSessionMoreActions`),children:(0,q.jsx)(Yt,{className:`h-4 w-4`})})}),(0,q.jsxs)(Le,{align:`end`,className:`w-44 p-1.5`,children:[(0,q.jsx)(ln,{icon:Ce,label:n(`agentsEditAction`),onClick:c,disabled:a}),t.builtIn?null:(0,q.jsx)(ln,{icon:H,label:n(`agentsRemoveAction`),onClick:l,disabled:o,destructive:!0})]})]})]}),(0,q.jsx)(`p`,{className:`line-clamp-2 min-h-10 text-sm leading-5 text-gray-600`,children:t.description?.trim()||(t.builtIn?n(`agentsCardBuiltInSummary`):n(`agentsCardCustomSummary`))}),(0,q.jsxs)(`div`,{className:`mt-auto grid gap-2 border-t border-gray-100 pt-2 text-xs text-gray-500`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(Ne,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,q.jsx)(`span`,{className:`truncate`,children:d})]}),(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(pt,{className:`h-3.5 w-3.5 shrink-0 text-gray-300`}),(0,q.jsx)(`span`,{className:`truncate`,children:t.workspace??`-`})]})]})]})})}function dn(){let e=Lt(),t=Ee(),r=$e(),i=He(),a=Dt(),s=qe(),c=Pt(),[l,u]=(0,K.useState)(null),d=(0,K.useMemo)(()=>t.data?.agents??[],[t.data?.agents]),f=(0,K.useMemo)(()=>[...d].sort((e,t)=>Number(!!t.builtIn)-Number(!!e.builtIn)||e.id.localeCompare(t.id)),[d]),p=(0,K.useMemo)(()=>_e({config:r.data,meta:i.data,onlyConfigured:!0}),[i.data,r.data]),m=(0,K.useMemo)(()=>Nt(a.data?.options??[]),[a.data?.options]),g=(0,K.useMemo)(()=>G(a.data?.defaultType??`native`),[a.data?.defaultType]),_=(0,K.useMemo)(()=>m.find(e=>e.value===g)?.label??W(g),[g,m]),y=e=>{u(e)},b=async(e,t)=>{await s.mutateAsync({agentId:e,data:{displayName:t.displayName,description:t.description,avatar:t.avatar,model:t.model,...t.runtime.trim()?{runtime:t.runtime.trim()}:{runtime:``}}}),u(null)},x=t=>{e.chatSessionListManager.startAgentDraftChat(t.id,nt(t,g))};return(0,q.jsxs)(o,{className:`space-y-5`,children:[(0,q.jsx)(cn,{agentCount:d.length,onCreate:()=>e.startAgentCreationDraft(sn)}),(0,q.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-3`,children:t.isLoading?(0,q.jsx)(A,{className:`md:col-span-2 xl:col-span-3 border-dashed border-[#d9dce3] bg-white/70`,children:(0,q.jsx)(v,{className:`py-14 text-center text-sm text-gray-500`,children:n(`agentsLoading`)})}):f.length===0?(0,q.jsx)(A,{className:`md:col-span-2 xl:col-span-3 overflow-hidden border-dashed border-[#d9dce3] bg-[linear-gradient(135deg,#fff7ea_0%,#f4fbff_100%)]`,children:(0,q.jsxs)(v,{className:`flex min-h-[240px] flex-col items-center justify-center px-6 py-14 text-center`,children:[(0,q.jsx)(`div`,{className:`mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-white/80 shadow-[0_18px_44px_rgba(0,0,0,0.08)]`,children:(0,q.jsx)(ot,{className:`h-8 w-8 text-[#d39a3b]`})}),(0,q.jsx)(`div`,{className:`text-lg font-semibold text-[#2f2212]`,children:n(`agentsEmpty`)}),(0,q.jsx)(`p`,{className:`mt-2 max-w-md text-sm leading-6 text-[#78644d]`,children:n(`agentsEmptyDescription`)}),(0,q.jsxs)(h,{type:`button`,variant:`primary`,className:`mt-5 rounded-2xl px-5`,onClick:()=>e.startAgentCreationDraft(sn),children:[(0,q.jsx)(xe,{className:`mr-2 h-4 w-4`}),n(`agentsCreateButton`)]})]})}):f.map(e=>(0,q.jsx)(un,{agent:e,runtimeOptions:m,defaultRuntimeLabel:_,updatePending:s.isPending,deletePending:c.isPending,onStartChat:()=>x(e),onEdit:()=>y(e),onDelete:()=>c.mutate({agentId:e.id})},e.id))}),(0,q.jsx)(an,{agent:l,pending:s.isPending,providerCatalog:p,runtimeOptions:m,defaultRuntime:g,onOpenChange:e=>{!e&&!s.isPending&&u(null)},onSubmit:b})]})}function fn(e,t){let n=t.trim().toLowerCase();return n?[e.id,e.name,e.payload.message,e.payload.sessionId??``,e.payload.channel??``,e.payload.to??``].join(` `).toLowerCase().includes(n):!0}function pn(e,t){return t===`all`?!0:t===`enabled`?e.enabled:!e.enabled}function mn(t){let{job:r,onDelete:i,onRun:a,onToggle:o}=t;return(0,q.jsx)(A,{className:`border border-gray-200`,children:(0,q.jsx)(v,{className:`pt-5 pb-5`,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,q.jsxs)(`div`,{className:`min-w-[220px] flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`text-sm font-semibold text-gray-900`,children:r.name||r.id}),(0,q.jsx)(`span`,{className:`rounded-full bg-gray-100 px-2 py-0.5 text-[10px] font-semibold text-gray-500`,children:r.id}),(0,q.jsx)(`span`,{className:e(`rounded-full px-2 py-0.5 text-[10px] font-semibold`,r.enabled?`bg-emerald-50 text-emerald-700`:`bg-gray-100 text-gray-500`),children:r.enabled?n(`enabled`):n(`disabled`)}),r.deleteAfterRun?(0,q.jsx)(`span`,{className:`rounded-full bg-amber-50 px-2 py-0.5 text-[10px] font-semibold text-amber-700`,children:n(`cronOneShot`)}):null]}),(0,q.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[n(`cronScheduleLabel`),`: `,st(r)]}),(0,q.jsx)(`div`,{className:`mt-2 whitespace-pre-wrap break-words text-sm text-gray-700`,children:r.payload.message}),(0,q.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[n(`cronSessionLabel`),`: `,wt(r)]}),(0,q.jsxs)(`div`,{className:`mt-2 text-xs text-gray-500`,children:[n(`cronDeliverTo`),`: `,at(r)]})]}),(0,q.jsxs)(`div`,{className:`min-w-[220px] space-y-2 text-xs text-gray-500`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[n(`cronNextRun`),`:`]}),` `,yt(r.state.nextRunAt)]}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[n(`cronLastRun`),`:`]}),` `,yt(r.state.lastRunAt)]}),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`span`,{className:`font-medium text-gray-700`,children:[n(`cronLastStatus`),`:`]}),` `,r.state.lastStatus??`-`]}),r.state.lastError?(0,q.jsx)(`div`,{className:`break-words text-[11px] text-red-500`,children:r.state.lastError}):null]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-end gap-2`,children:[(0,q.jsxs)(h,{variant:`subtle`,size:`sm`,onClick:()=>a(r),className:`gap-1`,children:[(0,q.jsx)(be,{className:`h-3.5 w-3.5`}),n(`cronRunNow`)]}),(0,q.jsxs)(h,{variant:r.enabled?`outline`:`primary`,size:`sm`,onClick:()=>o(r),className:`gap-1`,children:[(0,q.jsx)(Qt,{className:`h-3.5 w-3.5`}),r.enabled?n(`cronDisable`):n(`cronEnable`)]}),(0,q.jsxs)(h,{variant:`destructive`,size:`sm`,onClick:()=>i(r),className:`gap-1`,children:[(0,q.jsx)(H,{className:`h-3.5 w-3.5`}),n(`delete`)]})]})]})})})}function hn(){let[t,r]=(0,K.useState)(``),[i,a]=(0,K.useState)(`all`),s=Mt({all:!0}),c=xt(),l=lt(),u=vt(),{confirm:d,ConfirmDialog:f}=dt(),p=(0,K.useMemo)(()=>(s.data?.jobs??[]).filter(e=>fn(e,t)).filter(e=>pn(e,i)),[s.data,t,i]),g=async e=>{await d({title:`${n(`cronDeleteConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:`destructive`,confirmLabel:n(`delete`)})&&c.mutate({id:e.id})},_=async e=>{let t=!e.enabled;await d({title:t?`${n(`cronEnableConfirm`)}?`:`${n(`cronDisableConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,variant:t?`default`:`destructive`,confirmLabel:n(t?`cronEnable`:`cronDisable`)})&&l.mutate({id:e.id,enabled:t})},v=async e=>{let t=!e.enabled;await d({title:t?`${n(`cronRunForceConfirm`)}?`:`${n(`cronRunConfirm`)}?`,description:e.name?`${e.name} (${e.id})`:e.id,confirmLabel:n(`cronRunNow`)})&&u.mutate({id:e.id,force:t})};return(0,q.jsxs)(o,{fullHeight:!0,children:[(0,q.jsx)(ee,{title:n(`cronPageTitle`),description:n(`cronPageDescription`),actions:(0,q.jsx)(h,{variant:`ghost`,size:`icon`,className:`h-9 w-9 rounded-lg text-gray-400 hover:text-gray-700 hover:bg-gray-100`,onClick:()=>s.refetch(),children:(0,q.jsx)(Ue,{className:e(`h-4 w-4`,s.isFetching&&`animate-spin`)})})}),(0,q.jsx)(`div`,{className:`mb-6`,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-3 items-center`,children:[(0,q.jsxs)(`div`,{className:`relative flex-1 min-w-[240px]`,children:[(0,q.jsx)(m,{value:t,onChange:e=>r(e.target.value),placeholder:n(`cronSearchPlaceholder`),className:`pl-9`}),(0,q.jsx)(ct,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400`})]}),(0,q.jsx)(`div`,{className:`min-w-[180px]`,children:(0,q.jsxs)(Pe,{value:i,onValueChange:e=>a(e),children:[(0,q.jsx)(Ze,{className:`w-full`,children:(0,q.jsx)(Xe,{placeholder:n(`cronStatusLabel`)})}),(0,q.jsxs)(Tt,{children:[(0,q.jsx)(V,{value:`all`,children:n(`cronStatusAll`)}),(0,q.jsx)(V,{value:`enabled`,children:n(`cronStatusEnabled`)}),(0,q.jsx)(V,{value:`disabled`,children:n(`cronStatusDisabled`)})]})]})}),(0,q.jsxs)(`div`,{className:`text-xs text-gray-500 ml-auto`,children:[n(`cronTotalLabel`),`: `,s.data?.total??0,` / `,p.length]})]})}),(0,q.jsx)(`div`,{className:`flex-1 overflow-auto custom-scrollbar`,children:s.isLoading?(0,q.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:n(`cronLoading`)}):p.length===0?(0,q.jsx)(`div`,{className:`text-sm text-gray-400 p-4 text-center`,children:n(`cronEmpty`)}):(0,q.jsx)(`div`,{className:`space-y-4`,children:p.map(e=>(0,q.jsx)(mn,{job:e,onDelete:g,onRun:v,onToggle:_},e.id))})}),(0,q.jsx)(f,{})]})}function gn(e){return Array.from(new Set(e.map(e=>e.spec).filter(Boolean)))}function _n(e){let t=new Date().toISOString();return e.result.type===`skill`?{type:`skill`,spec:e.result.spec,id:e.request.skill??e.result.spec,label:e.request.skill??e.result.name??e.result.spec,source:`workspace`,installPath:e.request.installPath,installedAt:t}:{type:e.result.type,spec:e.result.spec,id:e.result.name??e.result.spec,label:e.result.name??e.result.spec,source:`marketplace`,origin:`marketplace`,enabled:e.request.enabled??!0,runtimeStatus:e.request.enabled===!1?`disabled`:`ready`,installedAt:t}}function vn(e,t){return!!(t.spec&&e.spec===t.spec||t.id&&e.id===t.id)}function yn(e,t){return t??{type:e,total:0,specs:[],records:[]}}function bn(e){let t=yn(e.result.type,e.view),n=_n(e),r=t.records.findIndex(e=>vn(e,{id:n.id,spec:n.spec})),i=[...t.records];return r>=0?i[r]={...i[r],...n}:i.unshift(n),{...t,type:e.result.type,records:i,specs:gn(i),total:i.length}}function xn(e){let t=yn(e.result.type,e.view);if(e.result.action===`uninstall`||e.result.action===`remove`){let n=t.records.filter(t=>!vn(t,{id:e.result.id,spec:e.request.spec}));return{...t,records:n,specs:gn(n),total:n.length}}let n=t.records.map(t=>vn(t,{id:e.result.id,spec:e.request.spec})?e.result.action===`disable`?{...t,enabled:!1,runtimeStatus:`disabled`}:{...t,enabled:!0,runtimeStatus:`ready`}:t);return{...t,records:n,specs:gn(n),total:n.length}}function Sn(e){let t=ce({queryKey:[`marketplace-items`,e],initialPageParam:1,queryFn:({pageParam:t})=>s({...e,page:t}),getNextPageParam:e=>e.page<e.totalPages?e.page+1:void 0,placeholderData:(t,n)=>{let r=n?.queryKey?.[1];if(!(!r||typeof r!=`object`||!r))return(`type`in r?r.type:void 0)===e.type&&Cn(r,e)?t:void 0},staleTime:15e3}),n=(0,K.useMemo)(()=>M(t.data),[t.data]);return{...t,data:n}}function Cn(e,t){return e.q===t.q&&e.tag===t.tag&&e.scene===t.scene&&e.sort===t.sort&&e.pageSize===t.pageSize}function wn(e=!0){return j({queryKey:[`marketplace-skill-scenes`],queryFn:O,enabled:e,staleTime:6e4})}function Tn(e,t=!0){let n=Ut({queries:e.map(e=>({queryKey:[`marketplace-skill-scene-count`,e.scene],queryFn:()=>s({type:`skill`,scene:e.scene,pageSize:1}),enabled:t&&typeof e.count!=`number`,staleTime:6e4}))});return(0,K.useMemo)(()=>{let t=new Map;return e.forEach((e,r)=>{let i=typeof e.count==`number`?e.count:n[r]?.data?.total;typeof i==`number`&&t.set(e.scene,i)}),t},[n,e])}function En(e){return j({queryKey:[`marketplace-installed`,e],queryFn:()=>c(e),staleTime:1e4})}function Dn(){let e=S();return _({mutationFn:e=>a(e),onSuccess:(t,r)=>{e.setQueryData([`marketplace-installed`,t.type],e=>bn({view:e,request:r,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`}),p.success(t.message||n(`marketplaceInstallSuccessSkill`))},onError:e=>{p.error(e.message||n(`marketplaceInstallFailed`))}})}function On(){let e=S();return _({mutationFn:e=>D(e),onSuccess:(t,r)=>{e.setQueryData([`marketplace-installed`,t.type],e=>xn({view:e,request:r,result:t})),e.invalidateQueries({queryKey:[`marketplace-installed`,t.type],refetchType:`inactive`});let i=t.action===`enable`?n(`marketplaceEnableSuccess`):t.action===`disable`?n(`marketplaceDisableSuccess`):n(`marketplaceUninstallSuccess`);p.success(t.message||i)},onError:e=>{p.error(e.message||n(`marketplaceOperationFailed`))}})}function kn(e){return(e??``).trim().toLowerCase()}function J(e,t){let n=kn(t);return n.length>0?`${e}:${n}`:``}function An(e){let t=new Map;for(let n of e){let e=[n.install.spec,n.slug,n.id];for(let r of e){let e=J(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function jn(e){let t=new Map;for(let n of e){let e=[n.spec,n.id,n.label];for(let r of e){let e=J(n.type,r);!e||t.has(e)||t.set(e,n)}}return t}function Mn(e,t){let n=[e.install.spec,e.slug,e.id];for(let r of n){let n=J(e.type,r);if(!n)continue;let i=t.get(n);if(i)return i}}function Nn(e,t){return t.get(J(e.type,e.spec))||t.get(J(e.type,e.id))||t.get(J(e.type,e.label))}function Pn(e,t,n,r){let i=kn(n);if(!i)return!0;let a=N(t?.summaryI18n,t?.summary,r);return[e.id,e.spec,e.label,t?.name,t?.slug,t?.summary,a,...t?.tags??[]].map(e=>kn(e)).filter(Boolean).some(e=>e.includes(i))}function Y(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}function Fn(e){let t=e.replace(/\r\n/g,`
2
- `).split(`
3
- `);if(t[0]?.trim()!==`---`)return e;let n=t.findIndex((e,t)=>t>0&&e.trim()===`---`);return n>0?t.slice(n+1).join(`
4
- `).trim():e}function X(e){return Y(e).replace(/`([^`]+)`/g,`<code>$1</code>`).replace(/\*\*([^*]+)\*\*/g,`<strong>$1</strong>`).replace(/\[([^\]]+)\]\((https?:\/\/[^)\s]+)\)/g,`<a href="$2" target="_blank" rel="noopener noreferrer">$1</a>`)}function In(e){return/^(#{1,4})\s+/.test(e)||/^([-*])\s+/.test(e)||/^\d+\.\s+/.test(e)||/^>\s?/.test(e)||/^```/.test(e)}function Ln(e,t,n){let r=[],i=t+1;for(;i<e.length&&!e[i]?.trim().startsWith("```");)r.push(e[i]??``),i+=1;return{html:`<div class="code-block">${n[1]?`<span class="code-language">${Y(n[1])}</span>`:``}<pre><code>${Y(r.join(`
5
- `))}</code></pre></div>`,nextIndex:i+1}}function Rn(e,t){let n=Math.min(4,e[1]?.length??2);return{html:`<h${n}>${X(e[2]??``)}</h${n}>`,nextIndex:t+1}}function zn(e,t,n){let r=[],i=t,a=n?/^\d+\.\s+/:/^[-*]\s+/;for(;i<e.length&&a.test(e[i]?.trim()??``);)r.push(`<li>${X((e[i]??``).trim().replace(a,``))}</li>`),i+=1;return{html:n?`<ol>${r.join(``)}</ol>`:`<ul>${r.join(``)}</ul>`,nextIndex:i}}function Bn(e,t){let n=[],r=t;for(;r<e.length&&/^>\s?/.test(e[r]?.trim()??``);)n.push((e[r]??``).trim().replace(/^>\s?/,``)),r+=1;return{html:`<blockquote>${X(n.join(` `))}</blockquote>`,nextIndex:r}}function Vn(e,t){let n=[],r=t;for(;r<e.length;){let t=e[r]?.trim()??``;if(!t||In(t))break;n.push(t),r+=1}return{html:`<p>${X(n.join(` `))}</p>`,nextIndex:r}}function Hn(e,t){let n=e[t]?.trim()??``,r=n.match(/^```(\S*)/);if(r)return Ln(e,t,r);let i=n.match(/^(#{1,4})\s+(.+)$/);return i?Rn(i,t):/^[-*]\s+/.test(n)?zn(e,t,!1):/^\d+\.\s+/.test(n)?zn(e,t,!0):/^>\s?/.test(n)?Bn(e,t):Vn(e,t)}function Un(e){let t=Fn(e).replace(/\r\n/g,`
6
- `).split(`
7
- `),n=[],r=0;for(;r<t.length;){if(!(t[r]??``).trim()){r+=1;continue}let e=Hn(t,r);n.push(e.html),r=e.nextIndex}return n.join(``)}function Wn(e){return Array.isArray(e)?e.map(e=>Wn(e)).join(`, `):e&&typeof e==`object`?JSON.stringify(e):String(e??``)}function Gn(e){try{let t=JSON.parse(e);return!t||typeof t!=`object`||Array.isArray(t)?[]:Object.entries(t).map(([e,t])=>({key:e,value:Wn(t)})).filter(e=>e.value.trim().length>0)}catch{return[]}}function Kn(e){return e.replace(/\r\n/g,`
8
- `).split(`
9
- `).map(e=>e.match(/^([A-Za-z0-9_.-]+):\s*(.+)$/)).filter(e=>!!e).map(e=>({key:e[1]??``,value:e[2]?.replace(/^["']|["']$/g,``)??``})).filter(e=>e.key&&e.value.trim().length>0)}function qn(e){let t=Gn(e),n=t.length>0?t:Kn(e);return n.length===0?`<pre class="code">${Y(e)}</pre>`:`<dl class="metadata-list">${n.map(e=>`<div><dt>${Y(e.key)}</dt><dd>${Y(e.value)}</dd></div>`).join(``)}</dl>`}function Z(e){let{title:t,typeLabel:n,spec:r,summary:i,description:a,metadataRaw:o,contentRaw:s,sourceUrl:c,sourceLabel:l,tags:u,author:d,loading:f}=e,p=o?.trim()||`-`,m=s?.trim()||`-`,h=i?.trim(),g=a?.trim(),_=!!g&&g!==h,v=qn(p),y=Un(m),b=`<!doctype html>
10
- <html>
11
- <head>
12
- <meta charset="utf-8" />
13
- <meta name="viewport" content="width=device-width, initial-scale=1" />
14
- <title>${Y(t)}</title>
15
- <style>
16
- :root { color-scheme: light; }
17
- body { margin: 0; background: #f9f8f5; color: #2f2212; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
18
- .wrap { max-width: 940px; margin: 0 auto; padding: 24px 20px 36px; }
19
- .hero { border: 1px solid #f0e2c8; border-radius: 14px; background: linear-gradient(180deg, #fff9f1 0%, #ffffff 28%); padding: 18px; box-shadow: 0 1px 3px rgba(30, 20, 10, 0.05); }
20
- .hero h1 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: 0; }
21
- .meta { margin-top: 7px; color: #78644d; font-size: 12px; overflow-wrap: anywhere; word-break: break-word; }
22
- .summary { margin: 12px 0 0; font-size: 13px; line-height: 1.65; color: #5f5142; }
23
- .grid { display: grid; grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
24
- .card { border: 1px solid #eee3d1; background: #fffdf9; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 2px rgba(30, 20, 10, 0.035); }
25
- .card h2 { margin: 0; padding: 11px 13px; font-size: 12px; font-weight: 650; color: #3f472f; border-bottom: 1px solid #f1e7d4; background: #fffaf2; }
26
- .card .body { padding: 12px 13px; font-size: 12px; color: #4e463d; line-height: 1.65; }
27
- .code { white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; line-height: 1.55; margin: 0; }
28
- .metadata-list { margin: 0; }
29
- .metadata-list div { display: grid; grid-template-columns: minmax(72px, 0.36fr) minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid #f2eadc; }
30
- .metadata-list div:last-child { border-bottom: 0; }
31
- .metadata-list dt { color: #7a5a24; font-weight: 650; overflow-wrap: anywhere; }
32
- .metadata-list dd { margin: 0; color: #4e463d; overflow-wrap: anywhere; }
33
- .markdown { font-size: 13px; line-height: 1.68; }
34
- .markdown > *:first-child { margin-top: 0; }
35
- .markdown > *:last-child { margin-bottom: 0; }
36
- .markdown h1, .markdown h2, .markdown h3, .markdown h4 { margin: 18px 0 8px; color: #2f2212; line-height: 1.25; letter-spacing: 0; }
37
- .markdown h1 { font-size: 20px; }
38
- .markdown h2 { font-size: 17px; }
39
- .markdown h3 { font-size: 15px; }
40
- .markdown h4 { font-size: 13px; }
41
- .markdown p { margin: 10px 0; }
42
- .markdown ul, .markdown ol { margin: 10px 0; padding-left: 20px; }
43
- .markdown li { margin: 5px 0; }
44
- .markdown blockquote { margin: 12px 0; padding: 8px 12px; border-left: 3px solid #d9b56f; border-radius: 8px; background: #fff7ea; color: #6d5841; }
45
- .markdown code { border: 1px solid #eadcc6; border-radius: 5px; background: #fff7ea; padding: 1px 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: #6b4b16; }
46
- .markdown a { color: #5f6b45; text-decoration: none; font-weight: 600; }
47
- .markdown a:hover { text-decoration: underline; }
48
- .code-block { position: relative; margin: 12px 0; overflow: hidden; border: 1px solid #eadcc6; border-radius: 10px; background: #2f2a24; }
49
- .code-block pre { margin: 0; overflow-x: auto; padding: 13px; }
50
- .code-block code { border: 0; border-radius: 0; background: transparent; padding: 0; color: #f7efe3; }
51
- .code-language { position: absolute; right: 10px; top: 8px; color: #d8c3a0; font-size: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
52
- .tags { margin-top: 10px; }
53
- .tag { display: inline-block; margin: 0 6px 6px 0; padding: 4px 8px; border: 1px solid #ecd9b5; border-radius: 999px; background: #fff7ea; color: #7a5a24; font-size: 11px; }
54
- .source { color: #5f6b45; text-decoration: none; overflow-wrap: anywhere; word-break: break-all; }
55
- .source:hover { text-decoration: underline; }
56
- .skeleton { display: block; border-radius: 8px; background: linear-gradient(90deg, #f0e6d6 0%, #fffaf2 42%, #f0e6d6 78%); background-size: 220% 100%; animation: shimmer 1.35s ease-in-out infinite; }
57
- .detail-skeleton .hero { padding: 18px; }
58
- .sk-title { width: 52%; height: 24px; }
59
- .sk-meta { width: 78%; height: 12px; margin-top: 12px; }
60
- .sk-line { height: 12px; margin-top: 12px; }
61
- .sk-line.short { width: 62%; }
62
- .sk-line.mid { width: 82%; }
63
- .sk-body { height: 220px; margin: 13px; }
64
- @keyframes shimmer { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
65
- @media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }
66
- </style>
67
- </head>
68
- <body>
69
- <main class="wrap${f?` detail-skeleton`:``}"${f?` aria-busy="true"`:``}>
70
- ${f?`
71
- <section class="hero">
72
- <span class="skeleton sk-title"></span>
73
- <span class="skeleton sk-meta"></span>
74
- <span class="skeleton sk-line mid"></span>
75
- <span class="skeleton sk-line"></span>
76
- <span class="skeleton sk-line short"></span>
77
- </section>
78
- <section class="grid">
79
- <article class="card"><span class="skeleton sk-body"></span></article>
80
- <article class="card"><span class="skeleton sk-body"></span></article>
81
- </section>
82
- `:`
83
- <section class="hero">
84
- <h1>${Y(t)}</h1>
85
- <div class="meta">${Y(n)} · ${Y(r)}${d?` · ${Y(d)}`:``}</div>
86
- ${h?`<p class="summary">${Y(h)}</p>`:``}
87
- ${_?`<p class="summary">${Y(g)}</p>`:``}
88
- ${u&&u.length>0?`<div class="tags">${u.map(e=>`<span class="tag">${Y(e)}</span>`).join(``)}</div>`:``}
89
- ${c?`<p class="meta" style="margin-top:12px;">${Y(l??`Source`)}: <a class="source" href="${Y(c)}" target="_blank" rel="noopener noreferrer">${Y(c)}</a></p>`:``}
90
- </section>
91
-
92
- <section class="grid">
93
- <article class="card">
94
- <h2>Metadata</h2>
95
- <div class="body">${v}</div>
96
- </article>
97
- <article class="card">
98
- <h2>Content</h2>
99
- <div class="body markdown">${y}</div>
100
- </article>
101
- </section>
102
- `}
103
- </main>
104
- </body>
105
- </html>`;return`data:text/html;charset=utf-8,${encodeURIComponent(b)}`}var Jn=[`bg-amber-600`,`bg-orange-500`,`bg-yellow-600`,`bg-emerald-600`,`bg-teal-600`,`bg-cyan-600`,`bg-stone-600`,`bg-rose-500`,`bg-violet-500`];function Yn(t){let{name:n,fallback:r,className:i}=t,a=n||r,o=a.substring(0,2).toUpperCase();return(0,q.jsx)(`div`,{className:e(`flex h-10 w-10 shrink-0 items-center justify-center rounded-xl text-sm font-semibold text-white`,Xn(a),i),children:o})}function Xn(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return Jn[Math.abs(t)%Jn.length]}function Zn({title:e,spec:t,summary:n}){return(0,q.jsxs)(Je,{delayDuration:400,children:[(0,q.jsxs)(De,{children:[(0,q.jsx)(Ae,{asChild:!0,children:(0,q.jsx)(`div`,{className:`truncate text-[14px] font-semibold leading-tight text-gray-900`,children:e})}),(0,q.jsx)(Ft,{className:`max-w-[300px] text-xs`,children:e})]}),(0,q.jsx)(`div`,{className:`mb-1.5 mt-0.5 flex min-w-0 items-center gap-1.5`,children:t?(0,q.jsxs)(De,{children:[(0,q.jsx)(Ae,{asChild:!0,children:(0,q.jsx)(`span`,{className:`max-w-full truncate text-[11px] font-mono text-gray-400`,children:t})}),(0,q.jsx)(Ft,{className:`max-w-[300px] break-all font-mono text-xs`,children:t})]}):null}),(0,q.jsx)(`p`,{className:`line-clamp-2 text-left text-[12px] leading-relaxed text-gray-500/90`,children:n})]})}function Qn(t){let{item:r,record:i,isInstalling:a,isDisabled:o,canUninstall:s,busyAction:c,busyForRecord:l,language:u,onInstall:d,onManage:f}=t,p=!!(r&&!i||i&&s);return(0,q.jsxs)(`div`,{className:e(`relative flex h-8 shrink-0 items-center justify-end`,i?`md:w-5`:`md:w-0`),children:[(0,q.jsx)(`div`,{className:e(`hidden items-center justify-end transition-opacity duration-150 md:flex`,p&&`group-hover:opacity-0 group-focus-within:opacity-0`),children:i?(0,q.jsx)($n,{disabled:o,language:u}):null}),(0,q.jsxs)(`div`,{className:e(`flex w-max items-center justify-end gap-2 transition-opacity duration-150`,`opacity-100 md:pointer-events-none md:absolute md:right-0 md:opacity-0`,`md:group-hover:pointer-events-auto md:group-hover:opacity-100`,`md:group-focus-within:pointer-events-auto md:group-focus-within:opacity-100`),children:[r&&!i&&(0,q.jsxs)(`button`,{onClick:e=>{e.stopPropagation(),d(r)},disabled:a,className:`inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-xl bg-primary px-3 text-xs font-medium text-white transition-colors hover:bg-primary-600 disabled:opacity-50`,children:[(0,q.jsx)(Ot,{className:`h-3.5 w-3.5`}),n(a?`marketplaceInstalling`:`marketplaceInstall`)]}),i&&s&&(0,q.jsxs)(`button`,{disabled:l,onClick:e=>{e.stopPropagation(),f(`uninstall`,i)},className:`inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-xl border border-gray-200/80 bg-white px-3 text-xs font-medium text-gray-500 transition-colors hover:border-rose-200 hover:bg-rose-50 hover:text-rose-600 disabled:opacity-50`,children:[(0,q.jsx)(H,{className:`h-3.5 w-3.5`}),n(c===`uninstall`?`marketplaceRemoving`:`marketplaceUninstall`)]})]})]})}function $n(t){let{disabled:n,language:r}=t,i=tr(n?{zh:`已禁用`,en:`Disabled`}:{zh:`已安装`,en:`Installed`},r);return(0,q.jsx)(Je,{delayDuration:300,children:(0,q.jsxs)(De,{children:[(0,q.jsx)(Ae,{asChild:!0,children:(0,q.jsx)(`span`,{"aria-label":i,className:e(`inline-flex h-5 w-5 items-center justify-center`,n?`text-gray-400`:`text-emerald-700`),children:n?(0,q.jsx)(Gt,{className:`h-4 w-4 opacity-40`}):(0,q.jsx)(Gt,{className:`h-4 w-4`})})}),(0,q.jsx)(Ft,{className:`text-xs`,children:i})]})})}function er(e){let{item:t,record:r,language:i,installState:a,manageState:o,onOpen:s,onInstall:c,onManage:l}=e,u=de(i),d=t?.name??r?.label??r?.id??r?.spec??n(`marketplaceUnknownItem`),f=N(t?.summaryI18n,t?.summary,u)||(r?n(`marketplaceInstalledLocalSummary`):``),p=t?.install.spec??r?.spec??``,m=r?.id||r?.spec,h=m?o.actionsByTarget.get(m):void 0,g=!!h,_=r?.type===`skill`&&r.source===`workspace`,v=r?r.enabled===!1||r.runtimeStatus===`disabled`:!1,y=t?.install.spec,b=typeof y==`string`&&a.installingSpecs.has(y);return(0,q.jsxs)(`article`,{onClick:s,className:`group flex cursor-pointer items-start justify-between gap-3.5 rounded-2xl border border-gray-200/40 bg-white px-5 py-4 shadow-sm transition-all hover:border-blue-300/80 hover:shadow-md`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 gap-3`,children:[(0,q.jsx)(Yn,{name:d,fallback:p||n(`marketplaceTypeSkill`)}),(0,q.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col justify-center`,children:(0,q.jsx)(Zn,{title:d,spec:p,summary:f})})]}),(0,q.jsx)(Qn,{item:t,record:r,isInstalling:b,isDisabled:v,canUninstall:_,busyAction:h,busyForRecord:g,language:i,onInstall:c,onManage:l})]})}function tr(e,t){return t.startsWith(`zh`)?e.zh:e.en}function nr(t){let{scope:n,title:r,summary:i,showTitle:a,showListSkeleton:o,skeletonCardCount:s,allItems:c,installedEntries:l,installedRecordLookup:u,language:d,installState:f,manageState:p,onOpen:m,onInstall:h,onManage:g}=t;return(0,q.jsxs)(`section`,{className:e(`flex min-h-full flex-col`,a&&`gap-3`),children:[a&&(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,q.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-950`,children:r}),(0,q.jsx)(`span`,{className:`text-[12px] text-gray-500`,children:i})]}),(0,q.jsxs)(`div`,{"data-testid":o?`marketplace-list-skeleton`:void 0,className:e(`grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3`,o&&`min-h-0 flex-1 auto-rows-[104px] content-start`),children:[o&&(0,q.jsx)(P,{count:s}),!o&&n===`all`&&c.map(e=>(0,q.jsx)(er,{item:e,record:Mn(e,u),language:d,installState:f,manageState:p,onOpen:()=>m(e,Mn(e,u)),onInstall:h,onManage:g},e.id)),!o&&n===`installed`&&l.map(e=>(0,q.jsx)(er,{item:e.item,record:e.record,language:d,installState:f,manageState:p,onOpen:()=>m(e.item,e.record),onInstall:h,onManage:g},e.key))]})]})}function rr(t){let{entry:r,language:i,localeFallbacks:a,installState:o,layout:s=`rail`,onOpen:c,onInstall:l}=t,{item:u,record:d}=r,f=N(u.summaryI18n,u.summary,a),p=u.install.spec,m=o.installingSpecs.has(p),h=!!d;return(0,q.jsxs)(`article`,{onClick:()=>c(r),className:e(`group flex min-h-[166px] cursor-pointer flex-col justify-between rounded-xl border border-gray-200/70 bg-white p-3 shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/60`,s===`rail`?`w-[260px] shrink-0`:`w-full min-w-0`),children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,q.jsx)(Yn,{name:u.name,fallback:u.install.spec}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,q.jsx)(`div`,{className:`truncate text-[13px] font-semibold leading-tight text-gray-950`,children:u.name}),(0,q.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] font-mono leading-tight text-gray-400`,children:ir(u)})]})]}),(0,q.jsx)(`p`,{className:`line-clamp-2 text-[12px] leading-relaxed text-gray-500`,children:f}),(0,q.jsx)(ar,{tags:u.tags})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,q.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-gray-400`,children:or(u.updatedAt)}),h?(0,q.jsxs)(`span`,{className:`inline-flex h-7 items-center gap-1.5 text-[11px] font-semibold text-emerald-700`,children:[(0,q.jsx)(Gt,{className:`h-3.5 w-3.5`}),sr({zh:`已安装`,en:`Installed`},i)]}):(0,q.jsxs)(`button`,{type:`button`,disabled:m,onClick:e=>{e.stopPropagation(),l(u)},className:`inline-flex h-7 items-center gap-1.5 rounded-md border border-gray-200 bg-white px-2 text-[11px] font-semibold text-gray-700 transition-colors hover:border-gray-300 hover:bg-gray-50 disabled:opacity-50`,children:[(0,q.jsx)(Ot,{className:`h-3.5 w-3.5`}),n(m?`marketplaceInstalling`:`marketplaceInstall`)]})]})]})}function ir(e){return e.slug||e.install.spec}function ar({tags:e}){let t=e.slice(0,2);return t.length===0?null:(0,q.jsx)(`div`,{className:`mt-2 truncate text-[11px] font-medium text-gray-400`,children:t.join(` / `)})}function or(e){return e.slice(0,10)||e}function sr(e,t){return t.startsWith(`zh`)?e.zh:e.en}var cr=[{scene:`development-debugging`,title:{zh:`开发与调试`,en:`Development`},summary:{zh:`代码审查、错误定位、架构分析与交付验证。`,en:`Review, debug, analyze, and verify delivery work.`},icon:$t,tone:`dark`,span:`md:col-span-2`},{scene:`office-collaboration`,title:{zh:`办公协作`,en:`Office Work`},summary:{zh:`连接文档、日历、会议、邮件和团队通信。`,en:`Connect docs, calendars, meetings, mail, and teams.`},icon:Wt,tone:`green`,span:`md:col-span-2`},{scene:`writing-content`,title:{zh:`写作与内容`,en:`Writing`},summary:{zh:`把调研、写作、润色和发布组织成连续工作流。`,en:`Turn research, writing, polishing, and publishing into one flow.`},icon:Zt,tone:`amber`,span:`md:col-span-2`},{scene:`browser-automation`,title:{zh:`浏览器自动化`,en:`Browser`},summary:{zh:`操作网页、捕获动态内容并验证真实用户路径。`,en:`Operate pages, capture dynamic content, and verify user paths.`},icon:Jt,tone:`blue`,span:`md:col-span-2`},{scene:`local-environment`,title:{zh:`本地环境`,en:`Local`},summary:{zh:`管理终端、文件、运行时和本地服务。`,en:`Manage shells, files, runtimes, and local services.`},icon:it,tone:`violet`,span:`md:col-span-1`},{scene:`social-platforms`,title:{zh:`社交平台`,en:`Social`},summary:{zh:`处理发布、互动、检索和内容分发。`,en:`Handle posting, interaction, search, and distribution.`},icon:Xt,tone:`sky`,span:`md:col-span-1`},{scene:`nextclaw-official`,title:{zh:`NextClaw 官方`,en:`NextClaw Official`},summary:{zh:`优先查看由 NextClaw 维护的原生能力。`,en:`Browse native capabilities maintained by NextClaw.`},icon:Ne,tone:`teal`,span:`md:col-span-2`}],lr={icon:Ne,tone:`dark`,span:`md:col-span-2`},ur={dark:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-stone-600 bg-stone-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},blue:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-cyan-600 bg-cyan-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},green:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-emerald-600 bg-emerald-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},amber:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-amber-600 bg-amber-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},violet:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-violet-500 bg-violet-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},sky:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-sky-500 bg-sky-500 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`},teal:{card:`border-gray-200/80 bg-white text-gray-950`,icon:`border-teal-600 bg-teal-600 text-white`,title:`text-gray-950`,text:`text-gray-500`,meta:`text-gray-400`}},dr=`grid grid-cols-[repeat(auto-fill,minmax(240px,320px))] justify-start gap-3`,fr=24;function pr(e){let{entries:t,scenes:n,isScenesLoading:r,isItemsLoading:i,language:a,installState:o,onOpen:s,onInstall:c,onOpenScene:l}=e,u=de(a),d=[...t].sort((e,t)=>br(e.item,t.item)).slice(0,6);return(0,q.jsxs)(`div`,{className:`mb-4 space-y-5`,children:[(0,q.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,q.jsx)(yr,{icon:qt,title:Q({zh:`场景`,en:`Scenes`},a),description:Q({zh:`按使用场景浏览适合的技能组合。`,en:`Browse skills by how you plan to use them.`},a)}),r?(0,q.jsx)(mr,{}):(0,q.jsx)(`div`,{className:`grid grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:n.map(e=>(0,q.jsx)(hr,{scene:e,language:a,onSelect:l},e.scene))})]}),(i||d.length>0)&&(0,q.jsx)(_r,{icon:Kt,title:Q({zh:`最近更新`,en:`Recently updated`},a),description:Q({zh:`看看生态最近在补齐哪些能力。`,en:`See what the ecosystem has been improving lately.`},a),entries:d,language:a,localeFallbacks:u,isLoading:i,installState:o,onOpen:s,onInstall:c})]})}function mr(){return(0,q.jsx)(`div`,{"data-testid":`marketplace-scenes-skeleton`,className:`grid grid-cols-2 gap-2 md:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5`,children:cr.map(e=>(0,q.jsxs)(`div`,{className:`flex min-h-[74px] flex-col justify-center rounded-lg border border-gray-200/70 bg-white px-3 py-2.5 shadow-sm`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(U,{className:`h-7 w-7 shrink-0 rounded-md`}),(0,q.jsx)(U,{className:`h-3.5 min-w-0 flex-1`}),(0,q.jsx)(U,{className:`h-3 w-8 shrink-0`})]}),(0,q.jsx)(U,{className:`mt-2 h-3 w-4/5`})]},e.scene))})}function hr(t){let{scene:n,language:r,onSelect:i}=t,a=xr(n.scene),o=a.icon,s=ur[a.tone];return(0,q.jsx)(`button`,{type:`button`,onClick:()=>i(n.scene),className:e(`group flex min-h-[74px] flex-col justify-center rounded-lg border px-3 py-2.5 text-left shadow-sm transition-colors hover:border-gray-300 hover:bg-gray-50/70`,s.card),children:(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`span`,{className:e(`flex h-7 w-7 shrink-0 items-center justify-center rounded-md border`,s.icon),children:(0,q.jsx)(o,{className:`h-3.5 w-3.5`})}),(0,q.jsx)(`div`,{className:`min-w-0 flex-1 truncate text-[13px] font-semibold text-gray-950`,children:Sr(n,a,r)}),typeof n.count==`number`&&(0,q.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:wr(n.count,r)})]}),(0,q.jsx)(`p`,{className:e(`mt-1 line-clamp-1 text-[11px] leading-relaxed`,s.text),children:Cr(n,a,r)})]})})}function gr(t){let{scene:n,entries:r,isLoading:i,language:a,localeFallbacks:o,installState:s,onBack:c,onOpen:l,onInstall:u}=t,d=xr(n.scene),f=d.icon,p=ur[d.tone];return(0,q.jsxs)(`section`,{className:`flex min-h-full flex-col`,children:[(0,q.jsxs)(`div`,{className:`mb-4 flex min-w-0 items-start gap-2.5`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:c,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-gray-600 transition-colors hover:bg-gray-100 hover:text-gray-900`,"aria-label":Q({zh:`返回`,en:`Back`},a),children:(0,q.jsx)(he,{className:`h-4 w-4`})}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`span`,{className:e(`flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border`,p.icon),children:(0,q.jsx)(f,{className:`h-4 w-4`})}),(0,q.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[15px] font-semibold text-gray-950`,children:Sr(n,d,a)}),(0,q.jsx)(`span`,{className:`shrink-0 text-[11px] font-medium text-gray-400`,children:Q(i?{zh:`加载中`,en:`Loading`}:{zh:`${r.length} 个技能`,en:`${r.length} skills`},a)})]}),(0,q.jsx)(`div`,{className:`mt-1.5 flex min-w-0 items-center gap-2`,children:(0,q.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[12px] leading-relaxed text-gray-500`,children:Cr(n,d,a)})})]})]}),i?(0,q.jsx)(`div`,{"data-testid":`marketplace-scene-skeleton`,className:e(dr,`min-h-0 flex-1 auto-rows-[166px] content-start`),children:(0,q.jsx)(P,{count:fr})}):r.length>0?(0,q.jsx)(`div`,{className:dr,children:r.map(e=>(0,q.jsx)(rr,{entry:e,language:a,localeFallbacks:o,installState:s,layout:`grid`,onOpen:l,onInstall:u},e.item.id))}):(0,q.jsx)(`div`,{className:`rounded-lg border border-dashed border-gray-200 py-8 text-center text-[12px] text-gray-500`,children:Q({zh:`这个模块暂无技能。`,en:`No skills in this module yet.`},a)})]})}function _r(e){let{icon:t,title:n,description:r,entries:i,language:a,localeFallbacks:o,isLoading:s,installState:c,onOpen:l,onInstall:u}=e;return(0,q.jsxs)(`section`,{className:`space-y-2.5`,children:[(0,q.jsx)(yr,{icon:t,title:n,description:r}),s?(0,q.jsx)(vr,{}):(0,q.jsx)(`div`,{className:`-mx-1 flex gap-2.5 overflow-x-auto px-1 pb-1.5 custom-scrollbar`,children:i.map(e=>(0,q.jsx)(rr,{entry:e,language:a,localeFallbacks:o,installState:c,onOpen:l,onInstall:u},e.item.id))})]})}function vr(){return(0,q.jsx)(`div`,{"data-testid":`marketplace-recent-skeleton`,className:`-mx-1 flex gap-2.5 overflow-hidden px-1 pb-1.5`,children:Array.from({length:4},(e,t)=>(0,q.jsxs)(`article`,{className:`flex min-h-[166px] w-[260px] shrink-0 flex-col justify-between rounded-xl border border-gray-200/70 bg-white p-3 shadow-sm`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`mb-2.5 flex min-w-0 items-start gap-2.5`,children:[(0,q.jsx)(U,{className:`h-10 w-10 shrink-0 rounded-xl`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1.5 pt-0.5`,children:[(0,q.jsx)(U,{className:`h-3.5 w-32 max-w-full`}),(0,q.jsx)(U,{className:`h-3 w-24 max-w-full`})]})]}),(0,q.jsx)(U,{className:`h-3 w-full`}),(0,q.jsx)(U,{className:`mt-1.5 h-3 w-4/5`}),(0,q.jsx)(U,{className:`mt-2 h-3 w-24`})]}),(0,q.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-3 border-t border-gray-100 pt-2.5`,children:[(0,q.jsx)(U,{className:`h-3 w-20`}),(0,q.jsx)(U,{className:`h-7 w-16 rounded-md`})]})]},`marketplace-recent-skeleton-${t}`))})}function yr({icon:e,title:t,description:n}){return(0,q.jsx)(`div`,{className:`flex items-end justify-between gap-4`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`h3`,{className:`flex items-center gap-2 text-[14px] font-semibold text-gray-950`,children:[(0,q.jsx)(e,{className:`h-4 w-4 text-primary`}),t]}),(0,q.jsx)(`p`,{className:`mt-0.5 text-[12px] leading-relaxed text-gray-500`,children:n})]})})}function br(e,t){let n=Date.parse(e.updatedAt),r=Date.parse(t.updatedAt);return Number.isNaN(n)||Number.isNaN(r)?t.updatedAt.localeCompare(e.updatedAt):r-n}function Q(e,t){return t.startsWith(`zh`)?e.zh:e.en}function xr(e){return cr.find(t=>t.scene===e)??{scene:e,...lr}}function Sr(e,t,n){return t.title?Q(t.title,n):e.title}function Cr(e,t,n){return t.summary?Q(t.summary,n):e.description??e.scene}function wr(e,t){return t.startsWith(`zh`)?`${e} 个技能`:`${e} skills`}function Tr(e){let{items:t,installedRecordLookup:n,scene:r,forcedType:i,typeFilter:a,scope:o,searchText:s,query:c,showListSkeleton:l,hasCatalogError:u}=e,d=wn(a===`skill`),f=(0,K.useMemo)(()=>d.data?.scenes??[],[d.data?.scenes]),p=Tn(f,a===`skill`),m=(0,K.useMemo)(()=>f.map(e=>({...e,count:typeof e.count==`number`?e.count:p.get(e.scene)})),[p,f]),h=(0,K.useMemo)(()=>t.map(e=>({item:e,record:Mn(e,n)})),[t,n]),g=(0,K.useMemo)(()=>{let e=r?.trim();if(e)return m.find(t=>t.scene===e)??{scene:e,title:e}},[r,m]),_=a===`skill`&&!!r?.trim(),v=a===`skill`&&o===`all`&&!s.trim()&&!c&&!_,y=l||t.length>=4,b=v&&!u&&y&&m.length===0&&d.isLoading;return{entries:h,scenes:m,selectedScene:g,sceneEntries:h,isSceneRoute:_,isScenesLoading:b,showShelves:v&&!u&&y&&(l||m.length>0||b),backPath:i?`/skills`:`/marketplace/skills`,pathPrefix:i?`/skills/scenes`:`/marketplace/skills/scenes`}}var Er=20,Dr=36;function Or(){return{pageTitle:`marketplaceSkillsPageTitle`,pageDescription:`marketplaceSkillsPageDescription`,tabMarketplace:`marketplaceTabMarketplaceSkills`,tabInstalled:`marketplaceTabInstalledSkills`,searchPlaceholder:`marketplaceSearchPlaceholderSkills`,sectionCatalog:`marketplaceSectionSkills`,sectionInstalled:`marketplaceSectionInstalledSkills`,errorLoadData:`marketplaceErrorLoadingSkillsData`,errorLoadInstalled:`marketplaceErrorLoadingInstalledSkills`,emptyData:`marketplaceNoSkills`,emptyInstalled:`marketplaceNoInstalledSkills`,installedCountSuffix:`marketplaceInstalledSkillsCountSuffix`}}function kr(e={}){let{forcedType:t}=e,r=ae(),i=oe(),{language:a}=Ke(),s=Se(),c=`skill`,l=(0,K.useMemo)(()=>de(a),[a]),u=Or(),[d,f]=(0,K.useState)(``),[p,m]=(0,K.useState)(``),[h,_]=(0,K.useState)(`all`),[v,y]=(0,K.useState)(`relevance`),[b,x]=(0,K.useState)(new Set),[S,C]=(0,K.useState)(new Map),w=(0,K.useRef)({byKey:new Map,seq:0});(0,K.useEffect)(()=>{let e=setTimeout(()=>{m(d.trim())},250);return()=>clearTimeout(e)},[d]);let T=En(c),E=c===`skill`?i.scene?.trim():void 0,D=Sn({q:E?void 0:p||void 0,scene:E,type:c,sort:v,pageSize:Er}),O=le({disabled:h!==`all`||D.isError||!D.hasNextPage||D.isFetchingNextPage,onLoadMore:()=>D.fetchNextPage(),watchValue:`${c}:${h}:${p}:${E??``}:${v}:${D.data?.loadedItems??0}:${D.data?.loadedPages??0}`});(0,K.useEffect)(()=>{let e=O.containerRef.current;e&&typeof e.scrollTo==`function`&&e.scrollTo({top:0})},[O.containerRef,p,E,h,v,c]);let ee=Dn(),te=On(),{confirm:ne,ConfirmDialog:re}=dt(),k=(0,K.useMemo)(()=>T.data?.records??[],[T.data?.records]),A=(0,K.useMemo)(()=>D.data?.items??[],[D.data?.items]),j=(0,K.useMemo)(()=>An(A),[A]),ie=(0,K.useMemo)(()=>jn(k),[k]),M=(0,K.useMemo)(()=>{let e=k.filter(e=>e.type===c).map(e=>({key:`${e.type}:${e.spec}:${e.id??``}`,record:e,item:Nn(e,j)})).filter(e=>Pn(e.record,e.item,p,l));return e.sort((e,t)=>{let n=e.record.installedAt?Date.parse(e.record.installedAt):NaN,r=t.record.installedAt?Date.parse(t.record.installedAt):NaN;return!Number.isNaN(n)&&!Number.isNaN(r)&&n!==r?r-n:e.record.spec.localeCompare(t.record.spec)}),e},[k,c,j,p,l]),ce=h===`installed`?M.length:D.data?.total??0,P={showCatalog:h===`all`&&D.isLoading&&!D.data,showInstalled:h===`installed`&&T.isLoading&&!T.data},F=P.showCatalog||P.showInstalled,fe=(0,K.useMemo)(()=>h===`installed`?T.isLoading&&!T.data?n(`loading`):`${M.length} ${n(u.installedCountSuffix)}`:D.data?`${A.length} / ${ce}`:n(`loading`),[h,T.data,T.isLoading,M.length,D.data,A.length,ce,u.installedCountSuffix]),I={installingSpecs:b},pe={actionsByTarget:S},L=Tr({items:A,installedRecordLookup:ie,scene:E,forcedType:t,typeFilter:c,scope:h,searchText:d,query:p,showListSkeleton:F,hasCatalogError:D.isError}),R=async e=>{let t=e.install.spec;if(!b.has(t)){x(e=>{let n=new Set(e);return n.add(t),n});try{await ee.mutateAsync({type:e.type,spec:t,kind:e.install.kind,skill:e.slug,installPath:`skills/${e.slug}`})}catch{}finally{x(e=>{if(!e.has(t))return e;let n=new Set(e);return n.delete(t),n})}}},me=async(e,t)=>{let r=t.id||t.spec;if(r&&!S.has(r)&&!(e===`uninstall`&&!await ne({title:`${n(`marketplaceUninstallTitle`)} ${r}?`,description:n(`marketplaceUninstallDescription`),confirmLabel:n(`marketplaceUninstall`),variant:`destructive`}))){C(t=>{let n=new Map(t);return n.set(r,e),n});try{await te.mutateAsync({type:t.type,action:e,id:r,spec:t.spec})}finally{C(e=>{if(!e.has(r))return e;let t=new Map(e);return t.delete(r),t})}}},z=async(e,t)=>{let r=e?.name??t?.label??t?.id??t?.spec??n(`marketplaceUnknownItem`),i=e?`marketplace:${e.type}:${e.slug}`:`marketplace:${t?.type??`unknown`}:${t?.id??t?.spec??r}`,a={title:r,kind:`content`,dedupeKey:i},o={...a,activate:!1};if(!e){let e=Z({title:r,typeLabel:n(`marketplaceTypeSkill`),spec:t?.spec??`-`,summary:n(`marketplaceInstalledLocalSummary`),metadataRaw:JSON.stringify(t??{},null,2),contentRaw:`-`});s.open(e,a);return}let c=w.current.seq+1;w.current.seq=c,w.current.byKey.set(i,c);let u=N(e.summaryI18n,e.summary,l),d={typeLabel:n(`marketplaceTypeSkill`),loadContent:()=>g(e.slug),fallbackContent:n(`marketplaceOperationFailed`),defaultContent:void 0};s.open(Z({title:r,typeLabel:d.typeLabel,spec:e.install.spec,loading:!0}),a);try{let t=await d.loadContent();if(w.current.byKey.get(i)!==c)return;let n=Z({title:r,typeLabel:d.typeLabel,spec:e.install.spec,summary:u,metadataRaw:t.metadataRaw,contentRaw:t.bodyRaw||t.raw||d.defaultContent,sourceUrl:t.sourceUrl,sourceLabel:`Source (${t.source})`,tags:e.tags,author:e.author});s.open(n,o)}catch(t){if(w.current.byKey.get(i)!==c)return;let n=Z({title:r,typeLabel:d.typeLabel,spec:e.install.spec,summary:u,metadataRaw:JSON.stringify({error:t instanceof Error?t.message:String(t)},null,2),contentRaw:d.fallbackContent});s.open(n,o)}};return(0,q.jsxs)(o,{className:`flex h-full min-h-0 flex-col pb-0`,children:[!L.isSceneRoute&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Rt,{tabs:[{id:`all`,label:n(u.tabMarketplace)},{id:`installed`,label:n(u.tabInstalled),count:T.data?.total??0}],activeTab:h,onChange:e=>_(e),className:`mb-3`}),(0,q.jsx)(se,{scope:h,searchText:d,searchPlaceholder:n(u.searchPlaceholder),sort:v,onSearchTextChange:f,onSortChange:y})]}),(0,q.jsxs)(`section`,{className:`flex min-h-0 flex-1 flex-col`,children:[!L.isSceneRoute&&!L.showShelves&&!F&&(0,q.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,q.jsx)(`h3`,{className:`text-[14px] font-semibold text-gray-900`,children:h===`installed`?n(u.sectionInstalled):a.startsWith(`zh`)?`全部技能`:`All Skills`}),(0,q.jsx)(`span`,{className:`text-[12px] text-gray-500`,children:fe})]}),h===`all`&&D.isError&&(0,q.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[n(u.errorLoadData),`: `,D.error.message]}),h===`installed`&&T.isError&&(0,q.jsxs)(`div`,{className:`rounded-xl border border-rose-200 bg-rose-50 p-4 text-sm text-rose-700`,children:[n(u.errorLoadInstalled),`: `,T.error.message]}),(0,q.jsxs)(`div`,{ref:O.containerRef,className:`min-h-0 flex-1 overflow-y-auto custom-scrollbar pr-1`,"aria-busy":F||D.isFetchingNextPage,children:[L.isSceneRoute&&L.selectedScene&&(0,q.jsx)(gr,{scene:L.selectedScene,entries:L.sceneEntries,isLoading:F,language:a,localeFallbacks:l,installState:I,onBack:()=>r(L.backPath),onOpen:e=>void z(e.item,e.record),onInstall:R}),L.showShelves&&(0,q.jsx)(pr,{entries:L.entries,scenes:L.scenes,isScenesLoading:L.isScenesLoading,isItemsLoading:F,language:a,installState:I,onOpen:e=>void z(e.item,e.record),onInstall:R,onOpenScene:e=>r(`${L.pathPrefix}/${e}`)}),!L.isSceneRoute&&(0,q.jsx)(nr,{scope:h,title:h===`installed`?n(u.sectionInstalled):a.startsWith(`zh`)?`全部技能`:`All Skills`,summary:fe,showTitle:L.showShelves,showListSkeleton:F,skeletonCardCount:Dr,allItems:A,installedEntries:M,installedRecordLookup:ie,language:a,installState:I,manageState:pe,onOpen:(e,t)=>void z(e,t),onInstall:R,onManage:me}),h===`all`&&!L.isSceneRoute&&!F&&!D.isError&&A.length===0&&(0,q.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:n(u.emptyData)}),h===`installed`&&!L.isSceneRoute&&!F&&!T.isError&&M.length===0&&(0,q.jsx)(`div`,{className:`py-8 text-center text-[13px] text-gray-500`,children:n(u.emptyInstalled)}),h===`all`&&!F&&!D.isError&&(0,q.jsx)(ue,{hasMore:!!D.hasNextPage,loading:D.isFetchingNextPage,sentinelRef:O.sentinelRef})]})]}),(0,q.jsx)(re,{})]})}function Ar(e){let{view:t,routeSessionKey:n,selectedSessionKey:r,setSelectedSessionKey:i,selectedSessionKeyRef:a,resetStreamState:o}=e;(0,K.useEffect)(()=>{if(t===`chat`){if(n){r!==n&&i(n);return}r!==null&&(i(null),o())}},[o,n,r,i,t]),(0,K.useEffect)(()=>{a.current=r},[r,a])}function jr({view:e,confirmDialog:t}){let{isMobile:n}=It();return(0,q.jsxs)(`div`,{className:`h-full flex`,children:[n?null:(0,q.jsx)(rt,{}),e===`chat`?n?(0,q.jsx)(At,{}):(0,q.jsx)(_t,{}):(0,q.jsx)(`section`,{className:`flex-1 min-h-0 overflow-hidden bg-gradient-to-b from-gray-50/60 to-white`,children:e===`cron`?(0,q.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,q.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1120px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,q.jsx)(hn,{})})}):e===`agents`?(0,q.jsx)(`div`,{className:`h-full overflow-auto custom-scrollbar`,children:(0,q.jsx)(`div`,{className:`mx-auto w-full max-w-[min(1180px,100%)] px-4 py-4 sm:px-6 sm:py-5`,children:(0,q.jsx)(dn,{})})}):(0,q.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,q.jsx)(`div`,{className:`mx-auto flex h-full min-h-0 w-full max-w-[min(1120px,100%)] flex-col px-4 py-4 sm:px-6 sm:py-5`,children:(0,q.jsx)(kr,{forcedType:`skills`})})})}),t]})}function Mr(e,t){return e.filter(e=>Ye(e,t))}function Nr(e){let{config:t,meta:n}=e;return(0,K.useMemo)(()=>{let e=_e({meta:n,config:t,onlyConfigured:!0}),r=new Set,i=[];for(let t of e)for(let e of t.models){let n=ve(t.prefix,e);!n||r.has(n)||(r.add(n),i.push({value:n,modelLabel:e,providerLabel:t.displayName,thinkingCapability:ge(t.modelThinking,e,t.aliases)}))}return i.sort((e,t)=>{let n=e.providerLabel.localeCompare(t.providerLabel);return n===0?e.modelLabel.localeCompare(t.modelLabel):n})},[t,n])}function Pr(e){let{sessions:t,sessionKey:n,sessionType:r}=e;return{recentSessionPreferredModel:(0,K.useMemo)(()=>bt({sessions:t,selectedSessionKey:n??``,sessionType:r,readPreference:e=>e.preferredModel?.trim()||void 0}),[n,r,t]),recentSessionPreferredThinking:(0,K.useMemo)(()=>bt({sessions:t,selectedSessionKey:n??``,sessionType:r,readPreference:e=>e.preferredThinking??void 0}),[n,r,t])}}function Fr(e){let{currentSelectedModel:t,modelOptions:n}=e,r=(0,K.useMemo)(()=>n.find(e=>e.value===t),[t,n]);return{supportedThinkingLevels:(0,K.useMemo)(()=>r?.thinkingCapability?.supported??[],[r?.thinkingCapability?.supported]),defaultThinkingLevel:(0,K.useMemo)(()=>r?.thinkingCapability?.default??null,[r?.thinkingCapability?.default])}}function Ir(e){let{modelOptions:t,supportedModels:n}=e;if(!n||n.length===0)return t;let r=new Set(n),i=t.filter(e=>r.has(e.value));return i.length>0?i:t}function Lr(e){let{currentSelectedModel:t,pendingSessionType:n,projectRootOverride:r,query:i,sessionKey:a,setPendingSessionType:o,setSelectedModel:s,setSelectedThinkingLevel:c}=e,l=$e(),u=He(),d=kt({limit:200}),f=Dt(),p=Ct({sessionId:a?.trim()||`draft-session`,...Object.prototype.hasOwnProperty.call(e,`projectRootOverride`)?{projectRoot:r??null}:{}}),m=(l.isFetched||l.isSuccess)&&(u.isFetched||u.isSuccess),h=Nr({config:l.data,meta:u.data}),g=(0,K.useMemo)(()=>d.data?.sessions??[],[d.data?.sessions]),_=(0,K.useMemo)(()=>Oe(g),[g]),v=(0,K.useMemo)(()=>Mr(_,i),[_,i]),y=(0,K.useMemo)(()=>_.find(e=>e.key===a)??null,[_,a]),b=(0,K.useMemo)(()=>p.data?.records??[],[p.data?.records]),x=Ge({selectedSession:y,pendingSessionType:n,setPendingSessionType:o,sessionTypesData:f.data}),S=(0,K.useMemo)(()=>Ir({modelOptions:h,supportedModels:x.selectedSessionTypeOption?.supportedModels}),[h,x.selectedSessionTypeOption?.supportedModels]),{recentSessionPreferredModel:C,recentSessionPreferredThinking:w}=Pr({sessions:_,sessionKey:a,sessionType:x.selectedSessionType}),{supportedThinkingLevels:T,defaultThinkingLevel:E}=Fr({currentSelectedModel:t,modelOptions:S});return Et({modelOptions:S,selectedSessionKey:a??``,selectedSessionExists:!!y,selectedSessionPreferredModel:y?.preferredModel,fallbackPreferredModel:x.selectedSessionTypeOption?.recommendedModel??C,defaultModel:x.selectedSessionTypeOption?.recommendedModel??l.data?.agents.defaults.model,setSelectedModel:s}),ft({supportedThinkingLevels:T,selectedSessionKey:a??``,selectedSessionExists:!!y,selectedSessionPreferredThinking:y?.preferredThinking??null,fallbackPreferredThinking:w??null,defaultThinkingLevel:E,setSelectedThinkingLevel:c}),{configQuery:l,configMetaQuery:u,sessionsQuery:d,sessionTypesQuery:f,sessionSkillsQuery:p,isProviderStateResolved:m,modelOptions:S,sessionSummaries:g,sessions:v,skillRecords:b,selectedSession:y,...x}}function Rr(e){return e.parentSessionKey?e.sessionSummaries.map(Be).filter(t=>t.parentSessionId===e.parentSessionKey).sort((e,t)=>t.updatedAt.localeCompare(e.updatedAt)).map(e=>({sessionKey:e.key,parentSessionKey:e.parentSessionId??null,label:e.label??null,agentId:e.agentId??null})):[]}function zr(e){let{availableAgents:t,parentSessionId:n,selectedAgentId:r,selectedSession:i,selectedSessionType:a,sessionKey:o,sessionSummaries:s,sessionTypeOptions:c}=e,l=i?Te(i):void 0,u=i?.agentId??r,d=t.find(e=>e.id===u)??null,f=(0,K.useMemo)(()=>{if(!n)return null;let e=s.find(e=>e.sessionId===n)??null;return e?Be(e):null},[n,s]),p=c.find(e=>e.value===a)??null;return{currentSessionDisplayName:l,currentAgentId:u,currentAgent:d,parentSession:f,currentSessionTypeLabel:p?.label??W(a),currentSessionTypeIcon:p?.icon??null,currentChildSessionTabs:(0,K.useMemo)(()=>Rr({parentSessionKey:o,sessionSummaries:s}),[o,s])}}function Br(e){(0,K.useEffect)(()=>{e.presenter.chatInputManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,defaultSessionType:e.defaultSessionType,canStopGeneration:e.canStopCurrentRun,stopDisabledReason:e.stopDisabledReason,stopSupported:!0,stopReason:void 0,sendError:e.lastSendError,isSending:e.isSending,modelOptions:e.modelOptions,sessionTypeOptions:e.sessionTypeOptions,selectedSessionType:e.selectedSessionType,canEditSessionType:e.canEditSessionType,sessionTypeUnavailable:e.sessionTypeUnavailable,skillRecords:e.skillRecords,isSkillsLoading:e.isSkillsLoading}),e.presenter.chatThreadManager.syncSnapshot({isProviderStateResolved:e.isProviderStateResolved,modelOptions:e.modelOptions,sessionTypeUnavailable:e.sessionTypeUnavailable,sessionTypeUnavailableMessage:e.sessionTypeUnavailableMessage,sessionTypeLabel:e.currentSessionTypeLabel,sessionTypeIcon:e.currentSessionTypeIcon,sessionKey:e.sessionKey??null,agentId:e.currentAgentId,agentDisplayName:e.currentAgent?.displayName??null,agentAvatarUrl:e.currentAgent?.avatarUrl??null,availableAgents:e.availableAgents,sessionDisplayName:e.currentSessionDisplayName,sessionProjectRoot:e.effectiveSessionProjectRoot,sessionProjectName:e.effectiveSessionProjectName,canDeleteSession:!!e.selectedSession,threadRef:e.threadRef,isHistoryLoading:e.agent.isHydrating,messages:e.agent.visibleMessages,isSending:e.isSending,isAwaitingAssistantOutput:e.isAwaitingAssistantOutput,contextWindow:ke(e.agent.snapshot.contextWindow),parentSessionKey:e.parentSession?.key??null,parentSessionLabel:e.parentSession?Te(e.parentSession):null,childSessionTabs:e.childSessionTabs})},[e])}function Vr(e){if(!Array.isArray(e))return[];let t=new Set;for(let n of e){let e=n.trim();e&&t.add(e)}return[...t]}function $(e,t){return e?Object.fromEntries(t.map(t=>[t,e])):{}}function Hr(e){let t=we(e.projectRoot),n={...$(e.model?.trim(),[`model`,`preferred_model`]),...$(e.thinkingLevel?.trim(),[`thinkingEffort`,`thinking`,`preferred_thinking`]),...$(e.sessionType?.trim(),[`agentRuntimeId`,`session_type`,`runtime`]),...$(e.agentId?.trim(),[`agentId`,`agent_id`]),...$(t??void 0,[`projectRoot`,`project_root`])},r=Vr(e.requestedSkills);r.length>0&&(n.requested_skill_refs=r);let i=e.composerNodes?Ie(e.composerNodes):[];return i.length>0&&(n[mt]=i),n}function Ur(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r,selectedSessionProjectRoot:i}=e;return t!==null&&n!==null&&r===n&&(i??null)===t}function Wr(e){let t=je(e=>e.snapshot.query),n=je(e=>e.snapshot.selectedSessionKey),r=je(e=>e.snapshot.selectedAgentId),i=B(e=>e.snapshot.pendingSessionType),a=B(e=>e.snapshot.pendingProjectRoot),o=B(e=>e.snapshot.pendingProjectRootSessionKey),s=B(e=>e.snapshot.selectedModel),c=C(),l=Re(c),u=Ee(),{confirm:d,ConfirmDialog:f}=dt(),p=ie(),m=ae(),{sessionId:h}=oe(),g=(0,K.useRef)(null),_=(0,K.useRef)(n),v=(0,K.useMemo)(()=>St(h),[h]),y=v??void 0,b=a!==null&&(!y||o===y),x=Lr({query:t,sessionKey:y??null,projectRootOverride:b?a:void 0,currentSelectedModel:s,pendingSessionType:i,setPendingSessionType:e.chatInputManager.setPendingSessionType,setSelectedModel:e.chatInputManager.setSelectedModel,setSelectedThinkingLevel:e.chatInputManager.setSelectedThinkingLevel});return{presenter:e,selectedSessionKey:n,selectedAgentId:r,pendingProjectRoot:a,pendingProjectRootSessionKey:o,systemStatus:c,isRuntimeBlocked:l,agentsQuery:u,confirm:d,ConfirmDialog:f,location:p,navigate:m,threadRef:g,selectedSessionKeyRef:_,routeSessionKey:v,sessionKey:y,hasSessionProjectRootOverride:b,agent:et(y),...x}}function Gr(e){let t=Wr(e),{agent:n,agentsQuery:r,hasSessionProjectRootOverride:i,pendingProjectRoot:a,isRuntimeBlocked:o,systemStatus:s,selectedAgentId:c,selectedSession:l,selectedSessionType:u,sessionKey:d,sessionSummaries:f,sessionTypeOptions:p}=t,m=i?a:l?.projectRoot??null,h=i?gt(m):l?.projectName??gt(m),g=n.hydrateError?.message??n.snapshot.error?.message??null,_=s.phase===`ready`&&ut(g)?null:g,v=(r.data?.agents?.length??0)>0?r.data?.agents??[]:[{id:l?.agentId??c}],y=zr({sessionKey:d??null,selectedSession:l,selectedAgentId:c,availableAgents:v,parentSessionId:l?.parentSessionId??null,sessionSummaries:f,selectedSessionType:u,sessionTypeOptions:p}),b=n.isRunning||l?.status===`running`;return{...t,availableAgents:v,effectiveSessionProjectRoot:m,effectiveSessionProjectName:h,isSending:n.isSending||b,isAwaitingAssistantOutput:b,canStopCurrentRun:b,stopDisabledReason:b?null:`__preparing__`,lastSendError:o?null:s.phase===`ready`?_:Ve({message:_,status:s}),...y}}function Kr(e){let{agent:t,pendingProjectRoot:n,pendingProjectRootSessionKey:r,presenter:i,selectedSession:a,selectedSessionKeyRef:o,sessionKey:s}=e;(0,K.useEffect)(()=>{i.chatStreamActionsManager.bind({sendMessage:async e=>{if((e.sessionKey??null)!==(s??null))return;let o=Hr({agentId:e.agentId,model:e.model,thinkingLevel:e.thinkingLevel,sessionType:e.sessionType,projectRoot:!e.sessionKey||e.sessionKey===r?n:a?.projectRoot??null,requestedSkills:e.requestedSkills,composerNodes:e.composerNodes}),c=Fe({sessionId:e.sessionKey,text:e.message,attachments:e.attachments,parts:e.parts,metadata:o});if(c)try{let n=await t.send(c);!e.sessionKey&&n?.sessionId&&i.chatSessionListManager.materializeRootSessionRoute(n.sessionId)}catch(t){throw e.restoreDraftOnError&&(e.composerNodes&&e.composerNodes.length>0?i.chatInputManager.restoreComposerState?.(e.composerNodes,e.attachments??[]):i.chatInputManager.setDraft(t=>t.trim().length===0?e.message:t)),t}},stopCurrentRun:async()=>{await t.abort()},resumeRun:async e=>{e.sessionKey===s&&await t.streamRun()},resetStreamState:()=>{o.current=null},applyHistoryMessages:()=>{}})},[t,n,r,i,a?.projectRoot,o,s])}function qr(e){let{pendingProjectRoot:t,pendingProjectRootSessionKey:n,selectedSession:r}=e;(0,K.useEffect)(()=>{!r||!Ur({pendingProjectRoot:t,pendingProjectRootSessionKey:n,sessionKey:r.key,selectedSessionProjectRoot:r.projectRoot??null})||B.getState().setSnapshot({pendingProjectRoot:null,pendingProjectRootSessionKey:null})},[t,n,r])}function Jr(e){let{confirm:t,location:n,navigate:r,presenter:i}=e;(0,K.useEffect)(()=>{i.chatUiManager.syncState({pathname:n.pathname}),i.chatUiManager.bindActions({navigate:r,confirm:t})},[t,n.pathname,r,i])}function Yr(e){let{presenter:t,selectedAgentId:n,selectedSession:r}=e;(0,K.useEffect)(()=>{!r?.agentId||n===r.agentId||t.chatSessionListManager.setSelectedAgentId(r.agentId)},[t,n,r?.agentId])}function Xr(e){let{agent:t,presenter:n,routeSessionKey:r}=e,i=t.snapshot.activeRun?.sessionId??t.visibleMessages.find(e=>e.sessionId.trim())?.sessionId??null;(0,K.useEffect)(()=>{r||!i||n.chatSessionListManager.materializeRootSessionRoute(i)},[i,n,r])}function Zr({view:e}){let[t]=(0,K.useState)(()=>new tt),n=Gr(t);return Kr(n),qr(n),Jr(n),Yr(n),Xr(n),Ar({view:e,routeSessionKey:n.routeSessionKey,selectedSessionKey:n.selectedSessionKey,setSelectedSessionKey:t.chatSessionListManager.setSelectedSessionKey,selectedSessionKeyRef:n.selectedSessionKeyRef,resetStreamState:t.chatStreamActionsManager.resetStreamState}),Br({presenter:t,isProviderStateResolved:n.isProviderStateResolved,defaultSessionType:n.defaultSessionType,canStopCurrentRun:n.canStopCurrentRun,stopDisabledReason:n.stopDisabledReason,lastSendError:n.lastSendError,isSending:n.isSending,modelOptions:n.modelOptions,sessionTypeOptions:n.sessionTypeOptions,selectedSessionType:n.selectedSessionType,canEditSessionType:n.canEditSessionType,sessionTypeUnavailable:n.sessionTypeUnavailable,skillRecords:n.skillRecords,isSkillsLoading:n.sessionSkillsQuery.isLoading,sessionTypeUnavailableMessage:n.sessionTypeUnavailableMessage,currentSessionTypeLabel:n.currentSessionTypeLabel,currentSessionTypeIcon:n.currentSessionTypeIcon,sessionKey:n.sessionKey,currentAgentId:n.currentAgentId,currentAgent:n.currentAgent,availableAgents:n.availableAgents,currentSessionDisplayName:n.currentSessionDisplayName,effectiveSessionProjectRoot:n.effectiveSessionProjectRoot,effectiveSessionProjectName:n.effectiveSessionProjectName,selectedSession:n.selectedSession,threadRef:n.threadRef,agent:n.agent,isAwaitingAssistantOutput:n.isAwaitingAssistantOutput,parentSession:n.parentSession,childSessionTabs:n.currentChildSessionTabs}),(0,q.jsx)(We,{presenter:t,children:(0,q.jsx)(jr,{view:e,confirmDialog:(0,q.jsx)(n.ConfirmDialog,{})})})}function Qr({view:e}){return(0,q.jsx)(Zr,{view:e})}export{Qr as ChatPage};
@@ -1 +0,0 @@
1
- import{d as e,i as t,m as n,n as r}from"./react-B2X_ph0a.js";import{At as i,Dt as a,Et as o,Nt as s,Ot as c,Tt as l,ft as u,jt as d,kt as f,mt as p,pt as m,wt as h}from"./api-DruAcori.js";import{t as g}from"./external-link-C3usm3se.js";import{J as _,K as v,Qt as y,X as b,Y as x,Zt as S,q as C,sn as w}from"./index-GVTiCf1s.js";var T=n(),E={checking:`desktopUpdatesStatusChecking`,"update-available":`desktopUpdatesStatusAvailable`,downloading:`desktopUpdatesStatusDownloading`,downloaded:`desktopUpdatesStatusDownloaded`,"up-to-date":`desktopUpdatesStatusUpToDate`,blocked:`desktopUpdatesStatusBlocked`,failed:`desktopUpdatesStatusFailed`};function D({status:t}){return(0,T.jsx)(`span`,{className:e(`inline-flex rounded-full px-3 py-1 text-xs font-medium ring-1`,L(t)),children:I(t)})}function O({label:e,value:t}){return(0,T.jsxs)(`div`,{className:`rounded-xl border border-gray-200 bg-gray-50/60 p-4`,children:[(0,T.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-[0.08em] text-gray-500`,children:e}),(0,T.jsx)(`p`,{className:`mt-2 text-base font-semibold text-gray-900`,children:t})]})}function k({snapshot:e}){if(e.status!==`downloading`)return null;let n=e.progress?.percent,r=n==null?t(`desktopUpdatesDownloadProgressUnknown`):t(`desktopUpdatesDownloadProgressPercent`).replace(`{percent}`,String(n)),i=N(e.progress?.downloadedBytes??0,e.progress?.totalBytes??null);return(0,T.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:r}),(0,T.jsx)(`p`,{className:`text-xs font-medium text-amber-700`,children:i})]}),(0,T.jsx)(`div`,{className:`mt-3 h-2 overflow-hidden rounded-full bg-amber-100`,children:(0,T.jsx)(`div`,{className:`h-full rounded-full bg-amber-500 transition-[width]`,style:{width:`${n??0}%`}})})]})}function A({label:e,help:t,checked:n,disabled:r,onCheckedChange:i}){return(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-4 rounded-xl border border-gray-200 p-4`,children:[(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(d,{children:e}),(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t})]}),(0,T.jsx)(u,{checked:n,disabled:r,onCheckedChange:i})]})}function j(e){return e?.trim()||`-`}function M(e){return e?r(e):`-`}function N(e,t){let n=P(e);return t&&t>0?`${n} / ${P(t)}`:n}function P(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=10||r===0?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function F(e){return t(e===`beta`?`desktopUpdatesChannelBeta`:`desktopUpdatesChannelStable`)}function I(e){return t(E[e]??`desktopUpdatesStatusIdle`)}function L(e){return e===`downloaded`?`bg-emerald-50 text-emerald-700 ring-emerald-100`:e===`update-available`||e===`downloading`||e===`checking`?`bg-amber-50 text-amber-700 ring-amber-100`:e===`failed`||e===`blocked`?`bg-red-50 text-red-700 ring-red-100`:`bg-gray-100 text-gray-700 ring-gray-200`}function R(){return(0,T.jsxs)(i,{className:`space-y-6`,children:[(0,T.jsx)(f,{title:t(`runtimeUpdatesPageTitle`),description:t(`runtimeUpdatesPageDescription`)}),(0,T.jsxs)(h,{children:[(0,T.jsxs)(a,{children:[(0,T.jsx)(c,{children:t(`runtimeUpdatesUnavailableTitle`)}),(0,T.jsx)(o,{children:t(`runtimeUpdatesUnavailableDescription`)})]}),(0,T.jsx)(l,{children:(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`runtimeUpdatesUnavailableHint`)})})]})]})}function z(){let{supported:n,initialized:r,busyAction:u,snapshot:E}=p();if(!r)return(0,T.jsx)(`div`,{className:`p-8 text-gray-400`,children:t(`loading`)});if(!n||!E)return(0,T.jsx)(R,{});let N=u===`checking`,P=u===`downloading`,I=u===`applying`,L=u===`saving-preferences`,z=u===`switching-channel`,B=E.status===`update-available`&&!P&&!I,V=E.status===`downloaded`&&!I,H=[[t(`runtimeUpdatesHostVersion`),j(E.hostVersion)],[t(`desktopUpdatesCurrentBundleVersion`),j(E.currentVersion)],[t(`desktopUpdatesAvailableVersion`),j(E.availableVersion)],[t(`desktopUpdatesLastCheckedAt`),M(E.lastCheckedAt)],[t(`desktopUpdatesCurrentChannel`),F(E.channel)]];return(0,T.jsxs)(i,{className:`space-y-6`,children:[(0,T.jsx)(f,{title:t(`runtimeUpdatesPageTitle`),description:t(`runtimeUpdatesPageDescription`),actions:(0,T.jsxs)(s,{variant:`outline`,onClick:()=>void m.checkForUpdates(),disabled:N||P||I,children:[(0,T.jsx)(y,{className:e(`mr-2 h-4 w-4`,N&&`animate-spin`)}),t(`desktopUpdatesCheckNow`)]})}),(0,T.jsxs)(h,{children:[(0,T.jsxs)(a,{children:[(0,T.jsx)(c,{children:t(`desktopUpdatesOverviewTitle`)}),(0,T.jsx)(o,{children:t(`desktopUpdatesOverviewDescription`)})]}),(0,T.jsxs)(l,{className:`space-y-5`,children:[(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,T.jsx)(`span`,{className:`text-sm font-medium text-gray-700`,children:t(`desktopUpdatesStatusLabel`)}),(0,T.jsx)(D,{status:E.status})]}),(0,T.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 xl:grid-cols-5`,children:H.map(([e,t])=>(0,T.jsx)(O,{label:e,value:t},e))}),E.channel===`beta`?(0,T.jsxs)(`div`,{className:`rounded-2xl border border-amber-200 bg-amber-50/70 p-4`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-amber-800`,children:t(`desktopUpdatesBetaBadgeTitle`)}),(0,T.jsx)(`p`,{className:`mt-1 text-sm text-amber-700`,children:t(`desktopUpdatesBetaBadgeDescription`)})]}):null,E.downloadedVersion?(0,T.jsxs)(`div`,{className:`rounded-2xl border border-emerald-200 bg-emerald-50/70 p-4`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-emerald-800`,children:t(`desktopUpdatesDownloadedBannerTitle`)}),(0,T.jsx)(`p`,{className:`mt-1 text-sm text-emerald-700`,children:t(`runtimeUpdatesDownloadedBannerDescription`).replace(`{version}`,E.downloadedVersion)})]}):null,(0,T.jsx)(k,{snapshot:E}),E.status===`blocked`?(0,T.jsxs)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4`,children:[(0,T.jsx)(`p`,{className:`text-sm font-semibold text-red-800`,children:t(`desktopUpdatesBlockedTitle`)}),(0,T.jsx)(`p`,{className:`mt-1 text-sm text-red-700`,children:E.errorMessage??t(`desktopUpdatesBlockedDescription`)}),E.recoveryCommand?(0,T.jsx)(`code`,{className:`mt-3 block rounded-lg bg-white/70 px-3 py-2 text-xs text-red-800`,children:E.recoveryCommand}):null]}):null,E.errorMessage&&E.status!==`blocked`?(0,T.jsx)(`div`,{className:`rounded-2xl border border-red-200 bg-red-50/70 p-4 text-sm text-red-700`,children:E.errorMessage}):null]})]}),(0,T.jsxs)(h,{children:[(0,T.jsxs)(a,{children:[(0,T.jsx)(c,{children:t(`desktopUpdatesPreferencesTitle`)}),(0,T.jsx)(o,{children:t(`desktopUpdatesPreferencesDescription`)})]}),(0,T.jsxs)(l,{className:`space-y-5`,children:[(0,T.jsx)(`div`,{className:`rounded-xl border border-gray-200 p-4`,children:(0,T.jsxs)(`div`,{className:`space-y-3`,children:[(0,T.jsxs)(`div`,{className:`space-y-1`,children:[(0,T.jsx)(d,{children:t(`desktopUpdatesReleaseChannel`)}),(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`desktopUpdatesReleaseChannelHelp`)})]}),(0,T.jsxs)(v,{value:E.channel,disabled:z||N||P||I,onValueChange:e=>void m.updateChannel(e),children:[(0,T.jsx)(x,{className:`w-full max-w-sm`,children:(0,T.jsx)(b,{placeholder:t(`desktopUpdatesReleaseChannel`)})}),(0,T.jsxs)(C,{children:[(0,T.jsx)(_,{value:`stable`,children:t(`desktopUpdatesChannelStable`)}),(0,T.jsx)(_,{value:`beta`,children:t(`desktopUpdatesChannelBeta`)})]})]}),(0,T.jsx)(`p`,{className:`text-sm text-gray-500`,children:t(`desktopUpdatesReleaseChannelDowngradeHint`)})]})}),(0,T.jsx)(A,{label:t(`desktopUpdatesAutomaticChecks`),help:t(`desktopUpdatesAutomaticChecksHelp`),checked:E.preferences.automaticChecks,disabled:L||z,onCheckedChange:e=>void m.updatePreferences({automaticChecks:e})}),(0,T.jsx)(A,{label:t(`desktopUpdatesAutoDownload`),help:t(`desktopUpdatesAutoDownloadHelp`),checked:E.preferences.autoDownload,disabled:L||z,onCheckedChange:e=>void m.updatePreferences({autoDownload:e})})]})]}),(0,T.jsxs)(h,{children:[(0,T.jsxs)(a,{children:[(0,T.jsx)(c,{children:t(`desktopUpdatesActionsTitle`)}),(0,T.jsx)(o,{children:t(`runtimeUpdatesActionsDescription`)})]}),(0,T.jsxs)(l,{className:`flex flex-wrap items-center gap-3`,children:[(0,T.jsxs)(s,{variant:`outline`,onClick:()=>void m.checkForUpdates(),disabled:N||P||I,children:[(0,T.jsx)(y,{className:e(`mr-2 h-4 w-4`,N&&`animate-spin`)}),t(`desktopUpdatesCheckNow`)]}),(0,T.jsxs)(s,{onClick:()=>void m.downloadUpdate(),disabled:!B,children:[(0,T.jsx)(w,{className:e(`mr-2 h-4 w-4`,P&&`animate-bounce`)}),t(`desktopUpdatesDownloadNow`)]}),(0,T.jsxs)(s,{variant:`secondary`,onClick:()=>void m.applyDownloadedUpdate(),disabled:!V,children:[(0,T.jsx)(S,{className:e(`mr-2 h-4 w-4`,I&&`animate-spin`)}),t(`runtimeUpdatesApplyNow`)]}),E.releaseNotesUrl?(0,T.jsxs)(s,{variant:`ghost`,onClick:()=>window.open(E.releaseNotesUrl??``,`_blank`,`noopener,noreferrer`),children:[(0,T.jsx)(g,{className:`mr-2 h-4 w-4`}),t(`desktopUpdatesReleaseNotes`)]}):null]})]})]})}export{z as DesktopUpdateConfig};
@@ -1,3 +0,0 @@
1
- import{d as e,h as t,i as n,m as r,v as i}from"./react-B2X_ph0a.js";import{t as a}from"./createLucideIcon-Br1EFMEr.js";import{n as o,t as s}from"./search-CdhgFNwf.js";import{t as c}from"./book-open-cPX0Za7Z.js";import{n as l,t as u}from"./wrench-qVIwShTF.js";import{t as d}from"./external-link-C3usm3se.js";import{t as f}from"./plus-BcIC8dG1.js";import{t as p}from"./x-Chb07O-Y.js";import{a as m,i as h,l as g,o as _,u as v}from"./doc-browser-route-registry.utils-x5ijvk0u.js";import{n as ee}from"./doc-browser-context-DB6TTHeE.js";var y=`modulepreload`,b=function(e){return`/`+e},x={},S=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=b(t,n),t in x)return;x[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:y,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},C=i(t(),1),w=`popstate`;function T(e={}){let{initialEntries:t=[`/`],initialIndex:n,v5Compat:r=!1}=e,i;i=t.map((e,t)=>u(e,typeof e==`string`?null:e.state,t===0?`default`:void 0));let a=c(n??i.length-1),o=`POP`,s=null;function c(e){return Math.min(Math.max(e,0),i.length-1)}function l(){return i[a]}function u(e,t=null,n){let r=k(i?l().pathname:`/`,e,t,n);return D(r.pathname.charAt(0)===`/`,`relative pathnames are not supported in memory history: ${JSON.stringify(e)}`),r}function d(e){return typeof e==`string`?e:A(e)}return{get index(){return a},get action(){return o},get location(){return l()},createHref:d,createURL(e){return new URL(d(e),`http://localhost`)},encodeLocation(e){let t=typeof e==`string`?j(e):e;return{pathname:t.pathname||``,search:t.search||``,hash:t.hash||``}},push(e,t){o=`PUSH`;let n=u(e,t);a+=1,i.splice(a,i.length,n),r&&s&&s({action:o,location:n,delta:1})},replace(e,t){o=`REPLACE`;let n=u(e,t);i[a]=n,r&&s&&s({action:o,location:n,delta:0})},go(e){o=`POP`;let t=c(a+e),n=i[t];a=t,s&&s({action:o,location:n,delta:e})},listen(e){return s=e,()=>{s=null}}}}function te(e={}){function t(e,t){let{pathname:n,search:r,hash:i}=e.location;return k(``,{pathname:n,search:r,hash:i},t.state&&t.state.usr||null,t.state&&t.state.key||`default`)}function n(e,t){return typeof t==`string`?t:A(t)}return M(t,n,null,e)}function E(e,t){if(e===!1||e==null)throw Error(t)}function D(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function ne(){return Math.random().toString(36).substring(2,10)}function O(e,t){return{usr:e.state,key:e.key,idx:t}}function k(e,t,n=null,r){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?j(t):t,state:n,key:t&&t.key||r||ne()}}function A({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function j(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function M(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=k(h.location,e,t);n&&n(r,e),l=u()+1;let d=O(r,l),f=h.createHref(r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=k(h.location,e,t);n&&n(r,e),l=u();let i=O(r,l),d=h.createHref(r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return re(e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(w,d),c=e,()=>{i.removeEventListener(w,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function re(e,t=!1){let n=`http://localhost`;typeof window<`u`&&(n=window.location.origin===`null`?window.location.href:window.location.origin),E(n,`No window.location.(origin|href) available to create URL`);let r=typeof e==`string`?e:A(e);return r=r.replace(/ $/,`%20`),!t&&r.startsWith(`//`)&&(r=n+r),new URL(r,n)}function N(e,t,n=`/`){return ie(e,t,n,!1)}function ie(e,t,n,r){let i=B((typeof t==`string`?j(t):t).pathname||`/`,n);if(i==null)return null;let a=ae(e);se(a);let o=null;for(let e=0;o==null&&e<a.length;++e){let t=he(i);o=pe(a[e],t,r)}return o}function P(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function ae(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;E(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=V([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(E(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),ae(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:R(l,e.index),routesMeta:u})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of oe(e.path))a(e,t,!0,n)}),t}function oe(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=oe(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function se(e){e.sort((e,t)=>e.score===t.score?fe(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var F=/^:[\w-]+$/,ce=3,I=2,le=1,ue=10,de=-2,L=e=>e===`*`;function R(e,t){let n=e.split(`/`),r=n.length;return n.some(L)&&(r+=de),t&&(r+=I),n.filter(e=>!L(e)).reduce((e,t)=>e+(F.test(t)?ce:t===``?le:ue),r)}function fe(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function pe(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u=z({path:s.relativePath,caseSensitive:s.caseSensitive,end:c},l),d=s.route;if(!u&&c&&n&&!r[r.length-1].route.index&&(u=z({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!u)return null;Object.assign(i,u.params),o.push({params:i,pathname:V([a,u.pathname]),pathnameBase:Ce(V([a,u.pathnameBase])),route:d}),u.pathnameBase!==`/`&&(a=V([a,u.pathnameBase]))}return o}function z(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=me(e.path,e.caseSensitive,e.end),i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function me(e,t=!1,n=!0){D(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:n!=null}),n?`/?([^\\/]+)?`:`/([^\\/]+)`)).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function he(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return D(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function B(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var ge=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function _e(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?j(e):e,a;return n?(n=n.replace(/\/\/+/g,`/`),a=n.startsWith(`/`)?ve(n.substring(1),`/`):ve(n,t)):a=t,{pathname:a,search:we(r),hash:Te(i)}}function ve(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ye(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function be(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function xe(e){let t=be(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Se(e,t,n,r=!1){let i;typeof e==`string`?i=j(e):(i={...e},E(!i.pathname||!i.pathname.includes(`?`),ye(`?`,`pathname`,`search`,i)),E(!i.pathname||!i.pathname.includes(`#`),ye(`#`,`pathname`,`hash`,i)),E(!i.search||!i.search.includes(`#`),ye(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=_e(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var V=e=>e.join(`/`).replace(/\/\/+/g,`/`),Ce=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),we=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Te=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Ee=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function De(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Oe(e){return e.map(e=>e.route.path).filter(Boolean).join(`/`).replace(/\/\/*/g,`/`)||`/`}var ke=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Ae(e,t){let n=e;if(typeof n!=`string`||!ge.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(ke)try{let e=new URL(window.location.href),r=n.startsWith(`//`)?new URL(e.protocol+n):new URL(n),a=B(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{D(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var je=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(je);var Me=[`GET`,...je];new Set(Me);var H=C.createContext(null);H.displayName=`DataRouter`;var U=C.createContext(null);U.displayName=`DataRouterState`;var Ne=C.createContext(!1),Pe=C.createContext({isTransitioning:!1});Pe.displayName=`ViewTransition`;var Fe=C.createContext(new Map);Fe.displayName=`Fetchers`;var Ie=C.createContext(null);Ie.displayName=`Await`;var W=C.createContext(null);W.displayName=`Navigation`;var G=C.createContext(null);G.displayName=`Location`;var K=C.createContext({outlet:null,matches:[],isDataRoute:!1});K.displayName=`Route`;var Le=C.createContext(null);Le.displayName=`RouteError`;var Re=`REACT_ROUTER_ERROR`,ze=`REDIRECT`,Be=`ROUTE_ERROR_RESPONSE`;function Ve(e){if(e.startsWith(`${Re}:${ze}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function He(e){if(e.startsWith(`${Re}:${Be}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Ee(t.status,t.statusText,t.data)}catch{}}function Ue(e,{relative:t}={}){E(q(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=C.useContext(W),{hash:i,pathname:a,search:o}=Y(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:V([n,a])),r.createHref({pathname:s,search:o,hash:i})}function q(){return C.useContext(G)!=null}function J(){return E(q(),`useLocation() may be used only in the context of a <Router> component.`),C.useContext(G).location}var We=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function Ge(e){C.useContext(W).static||C.useLayoutEffect(e)}function Ke(){let{isDataRoute:e}=C.useContext(K);return e?pt():qe()}function qe(){E(q(),`useNavigate() may be used only in the context of a <Router> component.`);let e=C.useContext(H),{basename:t,navigator:n}=C.useContext(W),{matches:r}=C.useContext(K),{pathname:i}=J(),a=JSON.stringify(xe(r)),o=C.useRef(!1);return Ge(()=>{o.current=!0}),C.useCallback((r,s={})=>{if(D(o.current,We),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Se(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:V([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}C.createContext(null);function Je(){let{matches:e}=C.useContext(K),t=e[e.length-1];return t?t.params:{}}function Y(e,{relative:t}={}){let{matches:n}=C.useContext(K),{pathname:r}=J(),i=JSON.stringify(xe(n));return C.useMemo(()=>Se(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function Ye(e,t){return Xe(e,t)}function Xe(e,t,n,r,i){E(q(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:a}=C.useContext(W),{matches:o}=C.useContext(K),s=o[o.length-1],c=s?s.params:{},l=s?s.pathname:`/`,u=s?s.pathnameBase:`/`,d=s&&s.route;{let e=d&&d.path||``;ht(l,!d||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
2
-
3
- Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let f=J(),p;if(t){let e=typeof t==`string`?j(t):t;E(u===`/`||e.pathname?.startsWith(u),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${e.pathname}" was given in the \`location\` prop.`),p=e}else p=f;let m=p.pathname||`/`,h=m;if(u!==`/`){let e=u.replace(/^\//,``).split(`/`);h=`/`+m.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let g=N(e,{pathname:h});D(d||g!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),D(g==null||g[g.length-1].route.element!==void 0||g[g.length-1].route.Component!==void 0||g[g.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let _=rt(g&&g.map(e=>Object.assign({},e,{params:Object.assign({},c,e.params),pathname:V([u,a.encodeLocation?a.encodeLocation(e.pathname.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?u:V([u,a.encodeLocation?a.encodeLocation(e.pathnameBase.replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),o,n,r,i);return t&&_?C.createElement(G.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,...p},navigationType:`POP`}},_):_}function Ze(){let e=ft(),t=De(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=C.createElement(C.Fragment,null,C.createElement(`p`,null,`💿 Hey developer 👋`),C.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,C.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,C.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),C.createElement(C.Fragment,null,C.createElement(`h2`,null,`Unexpected Application Error!`),C.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?C.createElement(`pre`,{style:i},n):null,o)}var Qe=C.createElement(Ze,null),$e=class extends C.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=He(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:C.createElement(K.Provider,{value:this.props.routeContext},C.createElement(Le.Provider,{value:e,children:this.props.component}));return this.context?C.createElement(tt,{error:e},t):t}};$e.contextType=Ne;var et=new WeakMap;function tt({children:e,error:t}){let{basename:n}=C.useContext(W);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=Ve(t.digest);if(e){let r=et.get(t);if(r)throw r;let i=Ae(e.location,n);if(ke&&!et.get(t))if(i.isExternal||e.reloadDocument)window.location.href=i.absoluteURL||i.to;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw et.set(t,n),n}return C.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${i.absoluteURL||i.to}`})}}return e}function nt({routeContext:e,match:t,children:n}){let r=C.useContext(H);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),C.createElement(K.Provider,{value:e},n)}function rt(e,t=[],n=null,r=null,i=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=n?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);E(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(`,`)}`),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(n)for(let e=0;e<a.length;e++){let t=a[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(c=e),t.route.id){let{loaderData:e,errors:r}=n,i=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!r||r[t.route.id]===void 0);if(t.route.lazy||i){s=!0,a=c>=0?a.slice(0,c+1):[a[0]];break}}}let l=n&&r?(e,t)=>{r(e,{location:n.location,params:n.matches?.[0]?.params??{},unstable_pattern:Oe(n.matches),errorInfo:t})}:void 0;return a.reduceRight((e,r,i)=>{let u,d=!1,f=null,p=null;n&&(u=o&&r.route.id?o[r.route.id]:void 0,f=r.route.errorElement||Qe,s&&(c<0&&i===0?(ht(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):c===i&&(d=!0,p=r.route.hydrateFallbackElement||null)));let m=t.concat(a.slice(0,i+1)),h=()=>{let t;return t=u?f:d?p:r.route.Component?C.createElement(r.route.Component,null):r.route.element?r.route.element:e,C.createElement(nt,{match:r,routeContext:{outlet:e,matches:m,isDataRoute:n!=null},children:t})};return n&&(r.route.ErrorBoundary||r.route.errorElement||i===0)?C.createElement($e,{location:n.location,revalidation:n.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function it(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function at(e){let t=C.useContext(H);return E(t,it(e)),t}function ot(e){let t=C.useContext(U);return E(t,it(e)),t}function st(e){let t=C.useContext(K);return E(t,it(e)),t}function ct(e){let t=st(e),n=t.matches[t.matches.length-1];return E(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function lt(){return ct(`useRouteId`)}function ut(){return ot(`useNavigation`).navigation}function dt(){let{matches:e,loaderData:t}=ot(`useMatches`);return C.useMemo(()=>e.map(e=>P(e,t)),[e,t])}function ft(){let e=C.useContext(Le),t=ot(`useRouteError`),n=ct(`useRouteError`);return e===void 0?t.errors?.[n]:e}function pt(){let{router:e}=at(`useNavigate`),t=ct(`useNavigate`),n=C.useRef(!1);return Ge(()=>{n.current=!0}),C.useCallback(async(r,i={})=>{D(n.current,We),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var mt={};function ht(e,t,n){!t&&!mt[e]&&(mt[e]=!0,D(!1,n))}C.useOptimistic,C.memo(gt);function gt({routes:e,future:t,state:n,onError:r}){return Xe(e,void 0,n,r,t)}function _t({basename:e,children:t,initialEntries:n,initialIndex:r,unstable_useTransitions:i}){let a=C.useRef();a.current??=T({initialEntries:n,initialIndex:r,v5Compat:!0});let o=a.current,[s,c]=C.useState({action:o.action,location:o.location}),l=C.useCallback(e=>{i===!1?c(e):C.startTransition(()=>c(e))},[i]);return C.useLayoutEffect(()=>o.listen(l),[o,l]),C.createElement(bt,{basename:e,children:t,location:s.location,navigationType:s.action,navigator:o,unstable_useTransitions:i})}function vt({to:e,replace:t,state:n,relative:r}){E(q(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=C.useContext(W);D(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=C.useContext(K),{pathname:o}=J(),s=Ke(),c=Se(e,xe(a),o,r===`path`),l=JSON.stringify(c);return C.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function yt(e){E(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function bt({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,unstable_useTransitions:o}){E(!q(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=C.useMemo(()=>({basename:s,navigator:i,static:a,unstable_useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=j(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`}=n,m=C.useMemo(()=>{let e=B(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p},navigationType:r}},[s,l,u,d,f,p,r]);return D(m!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),m==null?null:C.createElement(W.Provider,{value:c},C.createElement(G.Provider,{children:t,value:m}))}function xt({children:e,location:t}){return Ye(St(e),t)}C.Component;function St(e,t=[]){let n=[];return C.Children.forEach(e,(e,r)=>{if(!C.isValidElement(e))return;let i=[...t,r];if(e.type===C.Fragment){n.push.apply(n,St(e.props.children,i));return}E(e.type===yt,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),E(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=St(e.props.children,i)),n.push(a)}),n}var Ct=`get`,wt=`application/x-www-form-urlencoded`;function Tt(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Et(e){return Tt(e)&&e.tagName.toLowerCase()===`button`}function Dt(e){return Tt(e)&&e.tagName.toLowerCase()===`form`}function Ot(e){return Tt(e)&&e.tagName.toLowerCase()===`input`}function kt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function At(e,t){return e.button===0&&(!t||t===`_self`)&&!kt(e)}var jt=null;function Mt(){if(jt===null)try{new FormData(document.createElement(`form`),0),jt=!1}catch{jt=!0}return jt}var Nt=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Pt(e){return e!=null&&!Nt.has(e)?(D(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${wt}"`),null):e}function Ft(e,t){let n,r,i,a,o;if(Dt(e)){let o=e.getAttribute(`action`);r=o?B(o,t):null,n=e.getAttribute(`method`)||Ct,i=Pt(e.getAttribute(`enctype`))||wt,a=new FormData(e)}else if(Et(e)||Ot(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?B(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Ct,i=Pt(e.getAttribute(`formenctype`))||Pt(o.getAttribute(`enctype`))||wt,a=new FormData(o,e),!Mt()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Tt(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Ct,r=null,i=wt,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var It={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},Lt=/[&><\u2028\u2029]/g;function Rt(e){return e.replace(Lt,e=>It[e])}function zt(e,t){if(e===!1||e==null)throw Error(t)}function Bt(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n?i.pathname.endsWith(`/`)?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname===`/`?i.pathname=`_root.${r}`:t&&B(i.pathname,t)===`/`?i.pathname=`${t.replace(/\/$/,``)}/_root.${r}`:i.pathname=`${i.pathname.replace(/\/$/,``)}.${r}`,i}async function Vt(e,t){if(e.id in t)return t[e.id];try{let n=await S(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Ht(e){return e!=null&&typeof e.page==`string`}function Ut(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function Wt(e,t,n){return Yt((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Vt(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Ut).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Gt(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Kt(e,t,{includeHydrateFallback:n}={}){return qt(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function qt(e){return[...new Set(e)]}function Jt(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Yt(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Ht(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Jt(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Xt(){let e=C.useContext(H);return zt(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Zt(){let e=C.useContext(U);return zt(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Qt=C.createContext(void 0);Qt.displayName=`FrameworkContext`;function $t(){let e=C.useContext(Qt);return zt(e,`You must render this element inside a <HydratedRouter> element`),e}function en(e,t){let n=C.useContext(Qt),[r,i]=C.useState(!1),[a,o]=C.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=C.useRef(null);C.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),C.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:X(s,p),onBlur:X(c,m),onMouseEnter:X(l,p),onMouseLeave:X(u,m),onTouchStart:X(d,p)}]:[a,f,{}]:[!1,f,{}]}function X(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function tn({page:e,...t}){let{router:n}=Xt(),r=C.useMemo(()=>N(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?C.createElement(rn,{page:e,matches:r,...t}):null}function nn(e){let{manifest:t,routeModules:n}=$t(),[r,i]=C.useState([]);return C.useEffect(()=>{let r=!1;return Wt(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function rn({page:e,matches:t,...n}){let r=J(),{future:i,manifest:a,routeModules:o}=$t(),{basename:s}=Xt(),{loaderData:c,matches:l}=Zt(),u=C.useMemo(()=>Gt(e,t,l,a,r,`data`),[e,t,l,a,r]),d=C.useMemo(()=>Gt(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=C.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];!t||!t.hasLoader||(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=Bt(e,s,i.unstable_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.unstable_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=C.useMemo(()=>Kt(d,a),[d,a]),m=nn(d);return C.createElement(C.Fragment,null,f.map(e=>C.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>C.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>C.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function an(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}C.Component;var on=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{on&&(window.__reactRouterVersion=`7.13.0`)}catch{}function sn({basename:e,children:t,unstable_useTransitions:n,window:r}){let i=C.useRef();i.current??=te({window:r,v5Compat:!0});let a=i.current,[o,s]=C.useState({action:a.action,location:a.location}),c=C.useCallback(e=>{n===!1?s(e):C.startTransition(()=>s(e))},[n]);return C.useLayoutEffect(()=>a.listen(c),[a,c]),C.createElement(bt,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,unstable_useTransitions:n})}function cn({basename:e,children:t,history:n,unstable_useTransitions:r}){let[i,a]=C.useState({action:n.action,location:n.location}),o=C.useCallback(e=>{r===!1?a(e):C.startTransition(()=>a(e))},[r]);return C.useLayoutEffect(()=>n.listen(o),[n,o]),C.createElement(bt,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,unstable_useTransitions:r})}cn.displayName=`unstable_HistoryRouter`;var ln=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,un=C.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,state:o,target:s,to:c,preventScrollReset:l,viewTransition:u,unstable_defaultShouldRevalidate:d,...f},p){let{basename:m,unstable_useTransitions:h}=C.useContext(W),g=typeof c==`string`&&ln.test(c),_=Ae(c,m);c=_.to;let v=Ue(c,{relative:r}),[ee,y,b]=en(n,f),x=_n(c,{replace:a,state:o,target:s,preventScrollReset:l,relative:r,viewTransition:u,unstable_defaultShouldRevalidate:d,unstable_useTransitions:h});function S(t){e&&e(t),t.defaultPrevented||x(t)}let w=C.createElement(`a`,{...f,...b,href:_.absoluteURL||v,onClick:_.isExternal||i?e:S,ref:an(p,y),target:s,"data-discover":!g&&t===`render`?`true`:void 0});return ee&&!g?C.createElement(C.Fragment,null,w,C.createElement(tn,{page:v})):w});un.displayName=`Link`;var dn=C.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=Y(a,{relative:c.relative}),d=J(),f=C.useContext(U),{navigator:p,basename:m}=C.useContext(W),h=f!=null&&Dn(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=B(v,m)||v);let ee=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,y=_===g||!r&&_.startsWith(g)&&_.charAt(ee)===`/`,b=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),x={isActive:y,isPending:b,isTransitioning:h},S=y?e:void 0,w;w=typeof n==`function`?n(x):[n,y?`active`:null,b?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(x):i;return C.createElement(un,{...c,"aria-current":S,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(x):s)});dn.displayName=`NavLink`;var fn=C.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Ct,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f,...p},m)=>{let{unstable_useTransitions:h}=C.useContext(W),g=bn(),_=xn(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,ee=typeof s==`string`&&ln.test(s);return C.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,unstable_defaultShouldRevalidate:f});h&&n!==!1?C.startTransition(()=>p()):p()},...p,"data-discover":!ee&&e===`render`?`true`:void 0})});fn.displayName=`Form`;function pn({getKey:e,storageKey:t,...n}){let r=C.useContext(Qt),{basename:i}=C.useContext(W),a=J(),o=dt();Tn({getKey:e,storageKey:t});let s=C.useMemo(()=>{if(!r||!e)return null;let t=wn(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return C.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${Rt(JSON.stringify(t||Sn))}, ${Rt(JSON.stringify(s))})`}})}pn.displayName=`ScrollRestoration`;function mn(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function hn(e){let t=C.useContext(H);return E(t,mn(e)),t}function gn(e){let t=C.useContext(U);return E(t,mn(e)),t}function _n(e,{target:t,replace:n,state:r,preventScrollReset:i,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:s,unstable_useTransitions:c}={}){let l=Ke(),u=J(),d=Y(e,{relative:a});return C.useCallback(f=>{if(At(f,t)){f.preventDefault();let t=n===void 0?A(u)===A(d):n,p=()=>l(e,{replace:t,state:r,preventScrollReset:i,relative:a,viewTransition:o,unstable_defaultShouldRevalidate:s});c?C.startTransition(()=>p()):p()}},[u,l,d,n,r,t,e,i,a,o,s,c])}var vn=0,yn=()=>`__${String(++vn)}__`;function bn(){let{router:e}=hn(`useSubmit`),{basename:t}=C.useContext(W),n=lt(),r=e.fetch,i=e.navigate;return C.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Ft(e,t);a.navigate===!1?await r(a.fetcherKey||yn(),n,a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{unstable_defaultShouldRevalidate:a.unstable_defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function xn(e,{relative:t}={}){let{basename:n}=C.useContext(W),r=C.useContext(K);E(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...Y(e||`.`,{relative:t})},o=J();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:V([n,a.pathname])),A(a)}var Sn=`react-router-scroll-positions`,Cn={};function wn(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:B(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Tn({getKey:e,storageKey:t}={}){let{router:n}=hn(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=gn(`useScrollRestoration`),{basename:a}=C.useContext(W),o=J(),s=dt(),c=ut();C.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),En(C.useCallback(()=>{if(c.state===`idle`){let t=wn(o,s,a,e);Cn[t]=window.scrollY}try{sessionStorage.setItem(t||Sn,JSON.stringify(Cn))}catch(e){D(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(C.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Sn);e&&(Cn=JSON.parse(e))}catch{}},[t]),C.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Cn,()=>window.scrollY,e?(t,n)=>wn(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),C.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{D(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function En(e,t){let{capture:n}=t||{};C.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Dn(e,{relative:t}={}){let n=C.useContext(Pe);E(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=hn(`useViewTransitionState`),i=Y(e,{relative:t});if(!n.isTransitioning)return!1;let a=B(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=B(n.nextLocation.pathname,r)||n.nextLocation.pathname;return z(i.pathname,o)!=null||z(i.pathname,a)!=null}var On=a(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),kn=a(`BrainCircuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),An=a(`Grid3x3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),jn=a(`GripVertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),Mn=a(`Maximize2`,[[`polyline`,{points:`15 3 21 3 21 9`,key:`mznyad`}],[`polyline`,{points:`9 21 3 21 3 15`,key:`1avn1i`}],[`line`,{x1:`21`,x2:`14`,y1:`3`,y2:`10`,key:`ota7mn`}],[`line`,{x1:`3`,x2:`10`,y1:`21`,y2:`14`,key:`1atl0r`}]]),Nn=a(`PanelRightOpen`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}],[`path`,{d:`m10 15-3-3 3-3`,key:`1pgupc`}]]),Z=r(),Pn={apps:{accentClassName:`bg-emerald-50 text-emerald-700 border-emerald-100`,icon:(0,Z.jsx)(l,{className:`h-5 w-5`})},"service-apps":{accentClassName:`bg-sky-50 text-sky-700 border-sky-100`,icon:(0,Z.jsx)(An,{className:`h-5 w-5`})},docs:{accentClassName:`bg-amber-50 text-amber-700 border-amber-100`,icon:(0,Z.jsx)(c,{className:`h-5 w-5`})},"skill-marketplace":{accentClassName:`bg-rose-50 text-rose-700 border-rose-100`,icon:(0,Z.jsx)(kn,{className:`h-5 w-5`})},"mcp-marketplace":{accentClassName:`bg-indigo-50 text-indigo-700 border-indigo-100`,icon:(0,Z.jsx)(u,{className:`h-5 w-5`})}};function Fn(e){return Pn[e.id]??{accentClassName:`bg-gray-50 text-gray-700 border-gray-100`,icon:(0,Z.jsx)(l,{className:`h-5 w-5`})}}function In({open:t}){let n=Ke(),r=h.getHomeNavigationItems(),i=e=>{if(e.type===`app-route`){n(e.path);return}t(e.url,e.options)};return(0,Z.jsx)(`div`,{className:`h-full overflow-auto bg-[#fbfaf7] px-5 py-6`,children:(0,Z.jsx)(`div`,{className:`mx-auto w-full max-w-[640px]`,children:(0,Z.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(88px,1fr))] gap-x-3 gap-y-5`,children:r.map(t=>{let n=Fn(t);return(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>i(t.target),className:`group flex min-h-[82px] flex-col items-center gap-2 rounded-lg px-2 py-2 text-center transition-colors hover:bg-white/80`,children:[(0,Z.jsx)(`span`,{className:e(`flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl border shadow-[0_1px_2px_rgba(30,20,10,0.04)] transition-transform group-hover:scale-[1.03]`,n.accentClassName),children:n.icon}),(0,Z.jsx)(`span`,{className:`min-w-0 max-w-full`,children:(0,Z.jsx)(`span`,{className:`line-clamp-2 block text-xs font-medium leading-snug text-gray-800`,children:t.label})})]},t.id)})})})})}function Ln({isDocsTab:e,onSubmit:t,onUrlInputChange:r,urlInput:i}){return e?(0,Z.jsx)(`div`,{className:`flex items-center gap-2 px-3.5 py-2 bg-white border-b border-gray-100 shrink-0`,children:(0,Z.jsxs)(`form`,{onSubmit:t,className:`flex-1 relative`,children:[(0,Z.jsx)(s,{className:`w-3.5 h-3.5 absolute left-3 top-1/2 -translate-y-1/2 text-gray-400`}),(0,Z.jsx)(`input`,{type:`text`,value:i,onChange:e=>r(e.target.value),placeholder:n(`docBrowserSearchPlaceholder`),className:`w-full h-8 pl-8 pr-3 rounded-lg bg-gray-50 border border-gray-200 text-xs text-gray-700 focus:outline-none focus:ring-1 focus:ring-primary/30 focus:border-primary/40 transition-colors placeholder:text-gray-400`})]})}):null}function Rn({currentTab:e,currentUrl:t,customContent:n,iframeRef:r,iframeInstanceId:i,iframeSandbox:a,isDragging:o,isResizing:s}){return(0,Z.jsxs)(`div`,{className:`flex-1 relative overflow-hidden`,children:[n||(0,Z.jsx)(`iframe`,{ref:r,src:t,className:`absolute inset-0 w-full h-full border-0`,title:e?.title||`NextClaw Docs`,sandbox:a,allow:`clipboard-read; clipboard-write`},i),(s||o)&&(0,Z.jsx)(`div`,{className:`absolute inset-0 z-10`})]})}function zn({currentUrl:e,isDocsTab:t}){return!t||!g(e)?null:(0,Z.jsx)(`div`,{className:`flex items-center justify-between px-4 py-2 bg-gray-50 border-t border-gray-200 shrink-0`,children:(0,Z.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,"data-doc-external":!0,className:`flex items-center gap-1.5 text-xs text-primary hover:text-primary-hover font-medium transition-colors`,children:[n(`docBrowserOpenExternal`),(0,Z.jsx)(d,{className:`w-3 h-3`})]})})}function Bn({tabs:t,activeTabId:r,canGoBack:i,canGoForward:a,isDocked:s,isFullscreen:c,onGoBack:l,onGoForward:u,onOpenNewTab:d,onSetActiveTab:m,onCloseTab:h,onClose:g,onDragStart:_,onToggleMode:v}){return(0,Z.jsxs)(`div`,{"data-testid":`doc-browser-tab-strip`,className:e(`flex h-11 items-stretch gap-2 px-2.5 bg-background border-b border-[#f1e7d4] shrink-0 select-none`,c&&`h-[calc(env(safe-area-inset-top,0px)+2.75rem)] pt-[env(safe-area-inset-top,0px)]`),onPointerDown:!s&&!c?_:void 0,children:[(0,Z.jsx)(`div`,{className:`doc-browser-tab-scrollbar flex h-full min-w-0 flex-1 items-center gap-1.5 overflow-x-auto`,onPointerDown:e=>e.stopPropagation(),children:t.map(t=>(0,Z.jsxs)(`div`,{className:e(`inline-flex items-center gap-1 h-7 px-1.5 rounded-lg text-xs border max-w-[220px] shrink-0 transition-colors`,t.id===r?`bg-amber-50/80 border-amber-200 text-amber-900 shadow-[0_1px_2px_rgba(30,20,10,0.04)]`:`bg-[#f9f8f5] border-[#eee3d1] text-[#78644d] hover:bg-[#fff7ea] hover:text-[#2f2212]`),children:[(0,Z.jsx)(`button`,{type:`button`,onClick:()=>m(t.id),className:`truncate text-left px-1`,title:t.title,children:t.title||n(`docBrowserTabUntitled`)}),(0,Z.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),h(t.id)},className:`rounded p-0.5 hover:bg-black/10`,"aria-label":n(`docBrowserCloseTab`),children:(0,Z.jsx)(p,{className:`w-3 h-3`})})]},t.id))}),(0,Z.jsxs)(`div`,{className:`flex h-full items-center gap-1 shrink-0`,"data-testid":`doc-browser-tab-actions`,onPointerDown:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{type:`button`,onClick:l,disabled:!i,className:`rounded-md p-1.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 disabled:cursor-not-allowed disabled:text-gray-300 disabled:opacity-60 disabled:hover:bg-transparent disabled:hover:text-gray-300`,title:n(`docBrowserBack`),children:(0,Z.jsx)(o,{className:`w-3.5 h-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:u,disabled:!a,className:`rounded-md p-1.5 text-gray-500 transition-colors hover:bg-gray-100 hover:text-gray-700 disabled:cursor-not-allowed disabled:text-gray-300 disabled:opacity-60 disabled:hover:bg-transparent disabled:hover:text-gray-300`,title:n(`docBrowserForward`),children:(0,Z.jsx)(On,{className:`w-3.5 h-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:d,className:`hover:bg-gray-100 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors`,title:n(`docBrowserNewTab`),children:(0,Z.jsx)(f,{className:`w-3.5 h-3.5`})}),c?null:(0,Z.jsx)(`button`,{type:`button`,onClick:v,className:`hover:bg-gray-100 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors`,title:n(s?`docBrowserFloatMode`:`docBrowserDockMode`),children:s?(0,Z.jsx)(Mn,{className:`w-3.5 h-3.5`}):(0,Z.jsx)(Nn,{className:`w-3.5 h-3.5`})}),(0,Z.jsx)(`button`,{type:`button`,onClick:g,className:`hover:bg-gray-100 rounded-md p-1.5 text-gray-500 hover:text-gray-700 transition-colors`,title:n(`docBrowserClose`),children:(0,Z.jsx)(p,{className:`w-3.5 h-3.5`})})]})]})}function Vn({children:t,className:n,style:r,defaultWidth:i=420,minWidth:a=320,maxWidth:o=860,overlay:s=!1,...c}){let l=(0,C.useRef)(null),[u,d]=(0,C.useState)(!1),[f,p]=(0,C.useState)(i),m=e=>{if(s)return;e.preventDefault(),e.stopPropagation(),d(!0),l.current={startX:e.clientX,startWidth:f};let t=e=>{let t=l.current;if(!t)return;let n=t.startWidth+t.startX-e.clientX;p(Math.max(a,Math.min(o,n)))},n=()=>{d(!1),l.current=null,window.removeEventListener(`mousemove`,t),window.removeEventListener(`mouseup`,n)};window.addEventListener(`mousemove`,t),window.addEventListener(`mouseup`,n)};return(0,Z.jsxs)(`aside`,{...c,className:e(`relative flex h-full min-h-0 shrink-0 overflow-hidden bg-white`,s?`fixed inset-0 z-40`:`border-l border-gray-200`,n),style:s?r:{...r,width:f},children:[s?null:(0,Z.jsx)(`div`,{className:`absolute left-0 top-0 z-20 h-full w-1.5 cursor-ew-resize transition-colors hover:bg-primary/10`,"data-testid":`resizable-right-panel-handle`,onMouseDown:m}),(0,Z.jsx)(`div`,{className:`flex h-full min-h-0 w-full flex-col overflow-hidden`,children:t}),u?(0,Z.jsx)(`div`,{className:`absolute inset-0 z-10`}):null]})}var Q=40,Hn=360,Un=400;function $(e,t,n){return Math.min(n,Math.max(t,e))}function Wn(){return{x:Math.max(Q,window.innerWidth-520),y:80,w:480,h:600}}function Gn({customTabRenderers:t={},displayMode:n=`desktop`}){let{isOpen:r,mode:i,tabs:a,activeTabId:o,activeHistory:s,activeHistoryIndex:c,currentTab:l,open:u,openNewTab:d,close:f,toggleMode:p,goBack:h,goForward:g,navigate:y,syncUrl:b,setActiveTab:x,closeTab:S}=ee(),[w,T]=(0,C.useState)(``),[te,E]=(0,C.useState)(0),[D,ne]=(0,C.useState)(Wn),[O,k]=(0,C.useState)(null),A=(0,C.useRef)(null),j=l?.currentUrl??m,M=l?.navVersion??0,re=`${o}:${M}:${te}`,N=(0,C.useRef)(null),ie=(0,C.useRef)(M),P=l?.kind===`docs`,ae=l?.kind===_,oe=c>0,se=c<s.length-1,F=l?t[l.kind]:void 0;(0,C.useEffect)(()=>{if(!P){T(``);return}try{T(new URL(j).pathname)}catch{T(j)}},[j,o,P]),(0,C.useEffect)(()=>{if(!P){N.current=null;return}if(M!==ie.current){ie.current=M,N.current=v(j);return}if(A.current?.contentWindow)try{let e=new URL(j).pathname;N.current=v(j),A.current.contentWindow.postMessage({type:`docs-navigate`,path:e},`*`)}catch{}},[j,M,P]),(0,C.useEffect)(()=>{let e=e=>{if(P&&e.data?.type===`docs-route-change`&&typeof e.data.url==`string`){let t=v(e.data.url);if(N.current&&t!==N.current)return;N.current=null,b(e.data.url)}};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[j,b,P]),(0,C.useEffect)(()=>{if(!l||!F?.onIframeMessage)return;let e=e=>{F.onIframeMessage?.({event:e,iframe:A.current,iframeInstanceId:re,tab:l})};return window.addEventListener(`message`,e),()=>window.removeEventListener(`message`,e)},[l,F,re]);let ce=(0,C.useCallback)(e=>{e.preventDefault(),k({kind:`drag`,startX:e.clientX,startY:e.clientY,startRect:D})},[D]),I=(0,C.useCallback)(e=>t=>{t.preventDefault(),t.stopPropagation(),k({kind:`resize`,edge:e,startX:t.clientX,startY:t.clientY,startRect:D})},[D]);(0,C.useEffect)(()=>{if(!O)return;let e=e=>{let{startRect:t,startX:n,startY:r}=O,i=e.clientX-n,a=e.clientY-r;if(O.kind===`drag`){ne({...t,x:$(t.x+i,Q,window.innerWidth-Q-t.w),y:$(t.y+a,Q,window.innerHeight-Q-t.h)});return}if(O.edge===`left`||O.edge===`top`){let e=O.edge===`left`,n=e?t.x+t.w:t.y+t.h,r=$(e?t.x+i:t.y+a,Q,n-(e?Hn:Un));ne(e?{...t,x:r,w:n-r}:{...t,y:r,h:n-r});return}let o=$(t.x+t.w+i,t.x+Hn,window.innerWidth-Q),s=$(t.y+t.h+a,t.y+Un,window.innerHeight-Q);ne({...t,w:O.edge===`bottom`?t.w:o-t.x,h:O.edge===`right`?t.h:s-t.y})},t=()=>k(null);return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[O]);let le=(0,C.useCallback)(e=>{if(e.preventDefault(),!P)return;let t=w.trim();t&&(t.startsWith(`/`)?y(`${m}${t}`):t.startsWith(`http`)?y(t):y(`${m}/${t}`))},[w,y,P]),ue=(0,C.useCallback)(()=>{E(e=>e+1)},[]);if(!r)return null;let de=i===`docked`,L=n===`fullscreen`,R=l?{currentUrl:j,open:u,refreshIframe:ue,tab:l}:void 0,fe=R?F?.renderToolbar?.(R):null,pe=R?F?.renderContent?.(R)??(ae?(0,Z.jsx)(In,{open:u}):null):null,z=l?F?.getIframeSandbox?.(l)??`allow-same-origin allow-scripts allow-popups allow-forms`:`allow-same-origin allow-scripts allow-popups allow-forms`,me=(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Bn,{tabs:a,activeTabId:o,canGoBack:oe,canGoForward:se,isDocked:de,isFullscreen:L,onGoBack:h,onGoForward:g,onOpenNewTab:d,onSetActiveTab:x,onCloseTab:S,onClose:f,onDragStart:ce,onToggleMode:p}),(0,Z.jsx)(Ln,{isDocsTab:P,onSubmit:le,onUrlInputChange:T,urlInput:w}),fe,(0,Z.jsx)(Rn,{currentTab:l,currentUrl:j,customContent:pe,iframeRef:A,iframeInstanceId:re,iframeSandbox:z,isDragging:O?.kind===`drag`,isResizing:O?.kind===`resize`}),(0,Z.jsx)(zn,{currentUrl:j,isDocsTab:P})]});return de&&!L?(0,Z.jsx)(Vn,{"data-testid":`doc-browser-panel`,defaultWidth:420,minWidth:320,maxWidth:860,children:me}):(0,Z.jsxs)(`div`,{"data-testid":`doc-browser-panel`,className:e(`flex flex-col bg-white overflow-hidden relative`,L?`fixed inset-0 z-[9999] h-[100dvh] w-screen rounded-none border-0 shadow-2xl`:`rounded-2xl shadow-2xl border border-gray-200`),style:L?void 0:{position:`fixed`,left:D.x,top:D.y,width:D.w,height:D.h,zIndex:9999},children:[me,!de&&!L&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`absolute top-0 left-0 h-1.5 w-full cursor-ns-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-top`,onPointerDown:I(`top`)}),(0,Z.jsx)(`div`,{className:`absolute top-0 left-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-left`,onPointerDown:I(`left`)}),(0,Z.jsx)(`div`,{className:`absolute top-0 right-0 w-1.5 h-full cursor-ew-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-right`,onPointerDown:I(`right`)}),(0,Z.jsx)(`div`,{className:`absolute bottom-0 left-0 h-1.5 w-full cursor-ns-resize z-20 hover:bg-primary/10 transition-colors`,"data-testid":`doc-browser-resize-bottom`,onPointerDown:I(`bottom`)}),(0,Z.jsx)(`div`,{className:`absolute bottom-0 right-0 w-4 h-4 cursor-se-resize z-30 flex items-center justify-center text-gray-300 hover:text-gray-500 transition-colors`,"data-testid":`doc-browser-resize-bottom-right`,onPointerDown:I(`bottom-right`),children:(0,Z.jsx)(jn,{className:`w-3 h-3 rotate-[-45deg]`})})]})]})}export{un as a,vt as c,J as d,Ke as f,sn as i,yt as l,S as m,Vn as n,_t as o,Je as p,kn as r,dn as s,Gn as t,xt as u};