tarsk 0.6.85 → 0.6.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2596 -1250
- package/dist/public/assets/{account-view-0Y8-BC99.js → account-view-CmZrZmJf.js} +1 -1
- package/dist/public/assets/{alert-dialog-Cf2bArEP.js → alert-dialog-CJ403H9_.js} +1 -1
- package/dist/public/assets/api-Cho1mlFq.js +2 -0
- package/dist/public/assets/{async-error-boundary-DjDqZUsh.js → async-error-boundary-BIrTHWz-.js} +1 -1
- package/dist/public/assets/{browser-tab-BMlFSd3G.js → browser-tab-BJOfxs_k.js} +2 -2
- package/dist/public/assets/{button-BvwSd5oT.js → button-Djzr1B_4.js} +1 -1
- package/dist/public/assets/{card-BQvbp3oN.js → card-B0sh3Qvx.js} +1 -1
- package/dist/public/assets/{chat-dock-context-DuJCw4sJ.js → chat-dock-context-C-oyjLpB.js} +1 -1
- package/dist/public/assets/{commit-dialog-C7HjZNiu.js → commit-dialog-Dpz9gCzR.js} +1 -1
- package/dist/public/assets/{commit-error-dialog-4ZKRthpk.js → commit-error-dialog-CaPz12sp.js} +1 -1
- package/dist/public/assets/{commit-method-fields-CT7UxiA5.js → commit-method-fields-Cp9zzEl4.js} +1 -1
- package/dist/public/assets/{conversation-history-view-BMfQxAZo.js → conversation-history-view-9kBUV0vM.js} +1 -1
- package/dist/public/assets/{create-project-dialog-DALmTfiX.js → create-project-dialog-DbrfdrCG.js} +2 -2
- package/dist/public/assets/{create-project-workspace-BsVL5md0.js → create-project-workspace-BXawjzKi.js} +2 -2
- package/dist/public/assets/{create-repo-dialog-epoRQwy-.js → create-repo-dialog-Bq8doRpR.js} +1 -1
- package/dist/public/assets/{delete-confirm-dialog-DYplAaw1.js → delete-confirm-dialog-Bcy-0viP.js} +1 -1
- package/dist/public/assets/{diff-view-zH5WmZmx.js → diff-view-DdhUoX_0.js} +1 -1
- package/dist/public/assets/{dist-T3Rfl3KQ.js → dist-67Q0Rzil.js} +1 -1
- package/dist/public/assets/{dist-COaJwOux.js → dist-BGhGR6wN.js} +1 -1
- package/dist/public/assets/{dist-CK_gsqZm.js → dist-BnsVdica.js} +1 -1
- package/dist/public/assets/{dist-CjfjtFqY.js → dist-CRbBwZ5Q.js} +1 -1
- package/dist/public/assets/{dist-D4L066Cn.js → dist-D3LcCYeO.js} +1 -1
- package/dist/public/assets/dist-DQEC_JS0.js +2 -0
- package/dist/public/assets/{dist-DxHDUXDv.js → dist-DkiU4lhK.js} +1 -1
- package/dist/public/assets/{dist-CcZPa1gi.js → dist-DwfbSihk.js} +1 -1
- package/dist/public/assets/{es2015-C5AR6Xgu.js → es2015-BDTYd1CN.js} +1 -1
- package/dist/public/assets/{explorer-monaco-editor-bFm3QJ-c.js → explorer-monaco-editor-xuJXC2xI.js} +1 -1
- package/dist/public/assets/{explorer-tab-view-DuwN2R4l.js → explorer-tab-view-DQBB5FyG.js} +2 -2
- package/dist/public/assets/{explorer-tree-BOmePXZu.js → explorer-tree-CY3lMVK7.js} +1 -1
- package/dist/public/assets/{explorer-view-7TKT07h_.js → explorer-view-rQCB_a3U.js} +3 -3
- package/dist/public/assets/{git-history-dialog-DWYho36A.js → git-history-dialog-4KNkUR0v.js} +1 -1
- package/dist/public/assets/{index-B1RuOyec.css → index-BPQfGy4n.css} +1 -1
- package/dist/public/assets/index-BlkYPP7B.js +113 -0
- package/dist/public/assets/{model-list-controls-fxMZD0mL.js → model-list-controls-CB81yfmg.js} +1 -1
- package/dist/public/assets/{onboarding-dialog-C1LKCH1z.js → onboarding-dialog-Cn4uHVaE.js} +1 -1
- package/dist/public/assets/{pill-tabs-CwuYHztp.js → pill-tabs-B9CkWUiW.js} +1 -1
- package/dist/public/assets/{progress-indicator-Bub-larq.js → progress-indicator-Dr2oM_0d.js} +1 -1
- package/dist/public/assets/{project-coding-view-B3RYNFx_.js → project-coding-view-DO5x6ijQ.js} +1 -1
- package/dist/public/assets/{project-danger-zone-view-CDLOltuo.js → project-danger-zone-view-Dn2Sek-x.js} +1 -1
- package/dist/public/assets/{project-env-vars-view-C1mVjLa-.js → project-env-vars-view-DmzuX_8z.js} +1 -1
- package/dist/public/assets/{project-model-aliases-view-Brgx0_x-.js → project-model-aliases-view-Btu6AABR.js} +1 -1
- package/dist/public/assets/project-settings-view-9ZbeSiSn.js +1 -0
- package/dist/public/assets/{project-tools-view-B2BWonsn.js → project-tools-view-BJFer5bm.js} +1 -1
- package/dist/public/assets/providers-list-view-CBvNXPMw.js +1 -0
- package/dist/public/assets/{pull-request-dialog-CiNuslCp.js → pull-request-dialog-f3w4LdrS.js} +1 -1
- package/dist/public/assets/{pull-with-changes-dialog-C34UMAcq.js → pull-with-changes-dialog-a8yG_wvB.js} +1 -1
- package/dist/public/assets/{push-before-pr-dialog-FoUo055j.js → push-before-pr-dialog-C8dK-r1y.js} +1 -1
- package/dist/public/assets/{scroll-area-qgDSyMlD.js → scroll-area-BTSuUr9o.js} +1 -1
- package/dist/public/assets/{settings-general-tabs-view-YvyL4wXy.js → settings-general-tabs-view-Cp2LBtQE.js} +2 -2
- package/dist/public/assets/{settings-general-view-MkCRhx2w.js → settings-general-view-CEtewYl1.js} +1 -1
- package/dist/public/assets/{settings-list-ur331vXO.js → settings-list-mil_4_AR.js} +1 -1
- package/dist/public/assets/{settings-logs-view-B-T372j8.js → settings-logs-view-CYBWy-aN.js} +3 -3
- package/dist/public/assets/{settings-mcp-servers-view-CCtQniUl.js → settings-mcp-servers-view-BgP_PRL-.js} +2 -2
- package/dist/public/assets/{settings-models-view-HtJlfsQ0.js → settings-models-view-CVujPn9N.js} +1 -1
- package/dist/public/assets/{settings-plugins-view-C0t1Lsqr.js → settings-plugins-view-DGpw6oP7.js} +2 -2
- package/dist/public/assets/{settings-providers-view-DKV-MltK.js → settings-providers-view-CrBsp3JT.js} +2 -2
- package/dist/public/assets/{settings-remote-machines-view-hrC3HhoE.js → settings-remote-machines-view--F2JyEob.js} +1 -1
- package/dist/public/assets/{settings-setup-view-iBGLRzYS.js → settings-setup-view-CrYnDkWP.js} +2 -2
- package/dist/public/assets/{settings-skills-view-DDHClBVo.js → settings-skills-view-Cky2XWQ3.js} +2 -2
- package/dist/public/assets/{settings-slack-view-NHh-36q_.js → settings-slack-view-CpWvaF6m.js} +1 -1
- package/dist/public/assets/{settings-slash-commands-view-BxBHz5ya.js → settings-slash-commands-view-BjM6ze37.js} +1 -1
- package/dist/public/assets/{settings-statistics-view-DrwjDQrK.js → settings-statistics-view-C-qsV5R3.js} +1 -1
- package/dist/public/assets/{settings-storage-view-ImCMtn2t.js → settings-storage-view-BWR6CZ3o.js} +1 -1
- package/dist/public/assets/{settings-subagents-view-DHHymb-n.js → settings-subagents-view-CCxLCJAB.js} +1 -1
- package/dist/public/assets/{settings-system-prompt-view-tzbE0lD7.js → settings-system-prompt-view-DoB9R-el.js} +1 -1
- package/dist/public/assets/{settings-tab-bar-gGaC6MfY.js → settings-tab-bar-BCv1dBl8.js} +1 -1
- package/dist/public/assets/{settings-view-Dpza57LM.js → settings-view-DBeTJ7yv.js} +2 -2
- package/dist/public/assets/{slug-utils-D7Y0Xtis.js → slug-utils-DQA1OvXq.js} +1 -1
- package/dist/public/assets/store-D151firE.js +8 -0
- package/dist/public/assets/{table-GKMBZepT.js → table-BXRLirbI.js} +1 -1
- package/dist/public/assets/{tasks-view-CPIBCDSQ.js → tasks-view-zG5dsHgF.js} +1 -1
- package/dist/public/assets/{terminal-panel-hERoQQC7.js → terminal-panel-DdCyImne.js} +1 -1
- package/dist/public/assets/{toggle-group-DpK_U8jx.js → toggle-group-D3YTdr2u.js} +1 -1
- package/dist/public/assets/{tooltip-CqktA8Zq.js → tooltip-CXREivps.js} +1 -1
- package/dist/public/assets/{use-account-settings-query-R4H9qmd3.js → use-account-settings-query-DVhIle0W.js} +1 -1
- package/dist/public/assets/{use-active-dock-panel-instance-hpa6hhuw.js → use-active-dock-panel-instance-DDpytbsn.js} +1 -1
- package/dist/public/assets/{use-git-check-D6llSExJ.js → use-git-check-D5_upppc.js} +1 -1
- package/dist/public/assets/{use-installed-ai-files-B4-NTX_g.js → use-installed-ai-files-CD4qXZcA.js} +1 -1
- package/dist/public/assets/{utils-BHAZna1O.js → utils-DfZXN5fy.js} +1 -1
- package/dist/public/assets/{web-BRXrtee5.js → web--nZYyGWI.js} +1 -1
- package/dist/public/assets/{web-Do-1UIKE.js → web-CBqrNztZ.js} +1 -1
- package/dist/public/assets/{web-DiVO7QnD.js → web-CNrJjhVi.js} +1 -1
- package/dist/public/assets/{web-DNlXzk7q.js → web-MHSO59is.js} +1 -1
- package/dist/public/index.html +22 -22
- package/package.json +1 -1
- package/dist/public/assets/api-DS1qgAo_.js +0 -2
- package/dist/public/assets/dist-PhNKneni.js +0 -2
- package/dist/public/assets/index-SP0wF0IN.js +0 -113
- package/dist/public/assets/project-settings-view-BeGFajVJ.js +0 -1
- package/dist/public/assets/providers-list-view-CtgtT08O.js +0 -1
- package/dist/public/assets/store-DdiKV6YO.js +0 -8
package/dist/public/assets/{settings-models-view-HtJlfsQ0.js → settings-models-view-CVujPn9N.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{ln as i}from"./dist-PhNKneni.js";import{$ as a,n as o}from"./store-DdiKV6YO.js";import{r as s,t as c}from"./utils-BHAZna1O.js";import{t as l}from"./button-BvwSd5oT.js";import{r as u}from"./tooltip-CqktA8Zq.js";import{G as d,H as f,It as p,R as m,V as h,z as g}from"./api-DS1qgAo_.js";import{t as _}from"./progress-indicator-Bub-larq.js";import{n as v}from"./suspense-resource-DzlMlIgR.js";import{At as y,Et as b,Ft as x,Ht as S,Qn as ee,Rt as te,Sr as ne,Xt as C,_t as w,jt as re,on as T,xr as ie,zt as ae}from"./index-SP0wF0IN.js";import{i as E,n as D,o as O,r as k,t as A}from"./table-GKMBZepT.js";import{n as j,t as oe}from"./toggle-group-DpK_U8jx.js";import{n as M,t as se}from"./commit-method-fields-CT7UxiA5.js";import{t as N}from"./async-error-boundary-DjDqZUsh.js";import{t as ce}from"./sorting-DqwxPMRN.js";import{c as P,o as le}from"./settings-list-ur331vXO.js";import{t as ue}from"./use-deferred-search-Dgxosq55.js";import{n as de,r as F,t as I}from"./model-list-controls-fxMZD0mL.js";var L=t(),R=e(n(),1);function z(e){let t=(0,L.c)(5),[n,r]=(0,R.useState)(e),i;t[0]===n?i=t[1]:(i=async function(e,t,i,a){if(n[e]?.has(t)){await a(e,t),r(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}});return}await i(e,t),r(n=>({...n,[e]:new Set([...n[e]||[],t])}))},t[0]=n,t[1]=i);let a=i,o;return t[2]!==n||t[3]!==a?(o={enabledByProvider:n,toggleModel:a},t[2]=n,t[3]=a,t[4]=o):o=t[4],o}function fe(){let e=(0,L.c)(5),t=o(),n;e[0]===t?n=e[1]:(n=function(e){C(),t({type:a.ConfigUpdated}),e(`Model preferences saved successfully`),setTimeout(()=>e(``),3e3)},e[0]=t,e[1]=n);let r=n,i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=function(e,t){e(t instanceof Error?t.message:`Failed to save model changes`)},e[2]=i):i=e[2];let s=i,c;return e[3]===r?c=e[4]:(c={markSaved:r,markFailed:s},e[3]=r,e[4]=c),c}function B(e){let t=(0,L.c)(8),n=o(),r;t[0]!==n||t[1]!==e?(r=function(){n({type:a.ConfigUpdated}),e(`Model preferences saved successfully`)},t[0]=n,t[1]=e,t[2]=r):r=t[2];let i=r,s;t[3]===e?s=t[4]:(s=function(t){e(t instanceof Error?t.message:`Failed to save model changes`)},t[3]=e,t[4]=s);let c=s,l;return t[5]!==c||t[6]!==i?(l={markSaved:i,markFailed:c},t[5]=c,t[6]=i,t[7]=l):l=t[7],l}function V(e){return`settings-models:coding:${e}`}function H(e){return`settings-models:image:${e}`}async function U(){let e=(await p()).filter(e=>e.apiKey),t=await d(`coding`),n={},r={};for(let i of e){let e=t[i.slug];n[i.slug]=e?.models??[],r[i.slug]=new Set(e?.enabledModelIds??[])}return{providers:e,allModels:n,enabledModelIds:r}}async function W(e){let t=e.filter(e=>e.name.toLowerCase()===`openrouter`),n=await d(`image`),r={},i={};for(let e of t){let t=n[e.slug];r[e.slug]=t?.models??[],i[e.slug]=new Set(t?.enabledModelIds??[])}return{allImageModels:r,enabledImageModelIds:i}}var G=r();function pe(e){let t=(0,L.c)(3),{label:n,large:r}=e,i=r!==void 0&&r?`lg`:`sm`,a;return t[0]!==n||t[1]!==i?(a=(0,G.jsx)(_,{centered:!0,containerClassName:`py-12`,label:n,size:i}),t[0]=n,t[1]=i,t[2]=a):a=t[2],a}var K=`table-fixed`,q=`h-9`,J=c(i.body,`py-1.5`),Y=`w-10 py-1.5`,X=`w-24 py-1.5 text-right`,Z=c(i.body,`w-20 py-1.5 text-right text-muted-foreground tabular-nums`),Q=c(i.body,`w-48 py-1.5 text-right text-muted-foreground whitespace-nowrap tabular-nums`),$=`h-9 w-24 bg-transparent py-2 text-right`,me=`h-9 w-20 bg-transparent py-2 text-right`,he=`h-9 w-48 bg-transparent py-2 text-right`;function ge(e){return!e||(e.prompt??0)===0&&(e.completion??0)===0?``:`$${s(e.prompt??0)} in | $${s(e.completion??0)} out`}function _e(e){return e==null||!Number.isFinite(e)||e<=0?``:e>=100?Math.round(e).toLocaleString():e.toFixed(1)}function ve(e){let t=(0,L.c)(9),{showIntelligence:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=c(`w-full caption-bottom`,K,i.body),t[0]=r):r=t[0];let a,o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,G.jsx)(E,{className:`h-9 w-10 bg-transparent py-2`}),o=(0,G.jsx)(E,{className:`h-9 bg-transparent py-2`,children:`Model`}),t[1]=a,t[2]=o):(a=t[1],o=t[2]);let s;t[3]===n?s=t[4]:(s=n?(0,G.jsx)(E,{className:$,children:`Intelligence`}):null,t[3]=n,t[4]=s);let l,u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,G.jsx)(E,{className:me,children:`TPS`}),u=(0,G.jsx)(E,{className:he,children:`Pricing`}),t[5]=l,t[6]=u):(l=t[5],u=t[6]);let d;return t[7]===s?d=t[8]:(d=(0,G.jsx)(`table`,{className:r,children:(0,G.jsx)(`thead`,{className:`[&_tr]:border-b [&_tr]:border-table-border`,children:(0,G.jsxs)(`tr`,{children:[a,o,s,l,u]})})}),t[7]=s,t[8]=d),d}function ye(e){let t=(0,L.c)(15),{models:n,enabledIds:r,checkboxIdPrefix:a,showIntelligence:o,getModelDisplayName:s,onToggleModel:l}=e,u;if(t[0]!==a||t[1]!==r||t[2]!==s||t[3]!==n||t[4]!==l||t[5]!==o){let e;t[7]!==a||t[8]!==r||t[9]!==s||t[10]!==l||t[11]!==o?(e=e=>{let t=`${a}${e.id}`,n=r.has(e.id);return(0,G.jsxs)(O,{className:q,children:[(0,G.jsx)(k,{className:Y,children:(0,G.jsx)(w,{id:t,value:n,onChange:()=>l(e.id),ariaLabel:`${s(e)} ${n?`enabled`:`disabled`}`})}),(0,G.jsx)(k,{className:J,children:(0,G.jsx)(`label`,{htmlFor:t,className:c(i.body,`cursor-pointer truncate peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),children:s(e)})}),o?(0,G.jsx)(k,{className:X,children:(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(F,{codingIndex:e.coding_index,modelName:s(e)})})}):null,(0,G.jsx)(k,{className:Z,children:_e(e.avgTPS)}),(0,G.jsx)(k,{className:Q,children:ge(e.pricing)})]},e.id)},t[7]=a,t[8]=r,t[9]=s,t[10]=l,t[11]=o,t[12]=e):e=t[12],u=n.map(e),t[0]=a,t[1]=r,t[2]=s,t[3]=n,t[4]=l,t[5]=o,t[6]=u}else u=t[6];let d;return t[13]===u?d=t[14]:(d=(0,G.jsx)(A,{className:K,children:(0,G.jsx)(D,{children:u})}),t[13]=u,t[14]=d),d}function be(e){let t=(0,L.c)(25),{providerName:n,providerSlug:r,action:a,tableHeader:o,children:s}=e,l;t[0]!==n||t[1]!==r?(l=(0,G.jsx)(b,{provider:{name:n,slug:r}}),t[0]=n,t[1]=r,t[2]=l):l=t[2];let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=c(i.pageTitle,`truncate`),t[3]=u):u=t[3];let d;t[4]===n?d=t[5]:(d=(0,G.jsx)(`h2`,{className:u,children:n}),t[4]=n,t[5]=d);let f;t[6]!==l||t[7]!==d?(f=(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[l,d]}),t[6]=l,t[7]=d,t[8]=f):f=t[8];let p;t[9]===a?p=t[10]:(p=a?(0,G.jsx)(`div`,{className:`electrobun-webkit-app-region-no-drag shrink-0`,children:a}):null,t[9]=a,t[10]=p);let m;t[11]!==f||t[12]!==p?(m=(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-divider px-6 py-4 electrobun-webkit-app-region-drag`,children:[f,p]}),t[11]=f,t[12]=p,t[13]=m):m=t[13];let h;t[14]===o?h=t[15]:(h=o?(0,G.jsx)(`div`,{className:`electrobun-webkit-app-region-no-drag px-6 pb-2 pt-4`,children:o}):null,t[14]=o,t[15]=h);let g=o?`pt-0`:`pt-6`,_;t[16]===g?_=t[17]:(_=c(`px-6 pb-6`,g),t[16]=g,t[17]=_);let v;t[18]!==s||t[19]!==_?(v=(0,G.jsx)(`div`,{className:_,children:s}),t[18]=s,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==m||t[23]!==h?(y=(0,G.jsxs)(S,{className:`shrink-0`,children:[m,h,v]}),t[21]=v,t[22]=m,t[23]=h,t[24]=y):y=t[24],y}function xe(e){let t=(0,L.c)(23),{provider:n,filteredAndSortedModels:r,enabledIds:i,globalSearchQuery:a,getModelDisplayName:o,selectAllId:s,checkboxIdPrefix:c,showIntelligence:l,noModelsMessage:d,onToggleAll:f,onToggleModel:p}=e;if(r.length===0&&a)return null;let m;t[0]!==i||t[1]!==r||t[2]!==f||t[3]!==s?(m=r.length>0?(0,G.jsx)(I,{id:s,checked:r.every(e=>i.has(e.id)),onChange:f}):null,t[0]=i,t[1]=r,t[2]=f,t[3]=s,t[4]=m):m=t[4];let h;t[5]!==r.length||t[6]!==l?(h=r.length>0?(0,G.jsx)(ve,{showIntelligence:l}):void 0,t[5]=r.length,t[6]=l,t[7]=h):h=t[7];let g;t[8]!==c||t[9]!==i||t[10]!==r||t[11]!==o||t[12]!==a||t[13]!==d||t[14]!==p||t[15]!==l?(g=r.length===0?(0,G.jsx)(P,{message:a?`No models matching your search.`:d}):(0,G.jsx)(u,{children:(0,G.jsx)(ye,{models:r,enabledIds:i,checkboxIdPrefix:c,showIntelligence:l,getModelDisplayName:o,onToggleModel:p})}),t[8]=c,t[9]=i,t[10]=r,t[11]=o,t[12]=a,t[13]=d,t[14]=p,t[15]=l,t[16]=g):g=t[16];let _;return t[17]!==n.name||t[18]!==n.slug||t[19]!==m||t[20]!==h||t[21]!==g?(_=(0,G.jsx)(be,{providerName:n.name,providerSlug:n.slug,action:m,tableHeader:h,children:g},n.slug),t[17]=n.name,t[18]=n.slug,t[19]=m,t[20]=h,t[21]=g,t[22]=_):_=t[22],_}function Se(e){let t=(0,L.c)(31),{providers:n,globalSearchQuery:r,modelSortBy:i,filterAndSortModels:a,getModelDisplayName:o,onSaveStatus:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=H(0),t[0]=c):c=t[0];let l;t[1]===n?l=t[2]:(l=()=>W(n),t[1]=n,t[2]=l);let u=ee(c,l),[d]=(0,R.useState)(u.allImageModels),f=z(u.enabledImageModelIds),p=B(s),g;t[3]!==p||t[4]!==f?(g=async function(e,t){try{await f.toggleModel(e,t,h,m),p.markSaved()}catch(e){let t=e;p.markFailed(t)}},t[3]=p,t[4]=f,t[5]=g):g=t[5];let _=g,v;t[6]!==d||t[7]!==_||t[8]!==f?(v=async function(e,t){let n=d[e];if(!n)return;let r=f.enabledByProvider[e];for(let i of n)r?.has(i.id)!==t&&await _(e,i.id)},t[6]=d,t[7]=_,t[8]=f,t[9]=v):v=t[9];let y=v,b;if(t[10]!==d||t[11]!==a||t[12]!==o||t[13]!==r||t[14]!==y||t[15]!==_||t[16]!==f||t[17]!==i||t[18]!==n){let e;t[20]!==d||t[21]!==a||t[22]!==o||t[23]!==r||t[24]!==y||t[25]!==_||t[26]!==f||t[27]!==i?(e=e=>{let t=d[e.slug]||[],n=f.enabledByProvider[e.slug]||new Set;return(0,G.jsx)(xe,{provider:e,filteredAndSortedModels:a(t,n,i),enabledIds:n,globalSearchQuery:r,getModelDisplayName:o,selectAllId:`select-all-image-${e.slug}`,checkboxIdPrefix:`image-`,showIntelligence:!1,noModelsMessage:`No image models available for this provider.`,onToggleAll:t=>void y(e.slug,t),onToggleModel:t=>void _(e.slug,t)},e.slug)},t[20]=d,t[21]=a,t[22]=o,t[23]=r,t[24]=y,t[25]=_,t[26]=f,t[27]=i,t[28]=e):e=t[28],b=n.filter(Ce).map(e),t[10]=d,t[11]=a,t[12]=o,t[13]=r,t[14]=y,t[15]=_,t[16]=f,t[17]=i,t[18]=n,t[19]=b}else b=t[19];let x;return t[29]===b?x=t[30]:(x=(0,G.jsx)(G.Fragment,{children:b}),t[29]=b,t[30]=x),x}function Ce(e){return e.name.toLowerCase()===`openrouter`}function we(e){let t=(0,L.c)(66),{loadVersion:n}=e,r;t[0]===n?r=t[1]:(r=V(n),t[0]=n,t[1]=r);let a=ee(r,De),o=a.providers,[s]=(0,R.useState)(a.allModels),l=z(a.enabledModelIds),u=fe(),[d,p]=(0,R.useState)(`coding`),{query:m,setQuery:h,deferredQuery:_}=ue(),[v,b]=(0,R.useState)(`alphabetical`),[C,w]=(0,R.useState)(``),T=Ee,E;t[2]!==u||t[3]!==l?(E=async function(e,t){try{await l.toggleModel(e,t,f,g),u.markSaved(w)}catch(e){let t=e;u.markFailed(w,t)}},t[2]=u,t[3]=l,t[4]=E):E=t[4];let D=E,O;t[5]!==s||t[6]!==l||t[7]!==D?(O=async function(e,t){let n=s[e];if(!n)return;let r=l.enabledByProvider[e];for(let i of n)r?.has(i.id)!==t&&await D(e,i.id)},t[5]=s,t[6]=l,t[7]=D,t[8]=O):O=t[8];let k=O,A;t[9]===_?A=t[10]:(A=(e,t,n)=>ce({models:e,query:_,sortBy:n,getDisplayName:T,getPriority:e=>+!t.has(e.id)}),t[9]=_,t[10]=A);let N=A;if(o.length===0){let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(te,{title:`No providers configured`,children:`Configure a provider with an API key to view available models.`}),t[11]=e):e=t[11],e}let P;t[12]===o?P=t[13]:(P=o.some(Te),t[12]=o,t[13]=P);let F=P,I;t[14]!==m||t[15]!==h?(I=(0,G.jsx)(re,{title:`Models`,description:`View and manage available models from your configured providers.`,action:(0,G.jsx)(le,{placeholder:`Search`,value:m,onChange:h,className:`mb-0 w-64`}),sticky:!1}),t[14]=m,t[15]=h,t[16]=I):I=t[16];let B;t[17]!==d||t[18]!==h||t[19]!==F?(B=F?(0,G.jsxs)(oe,{type:`single`,value:d,onValueChange:e=>{(e===`coding`||e===`image`)&&(p(e),h(``))},"aria-label":`Model type`,className:c(se,`shrink-0`),children:[(0,G.jsx)(j,{value:`coding`,"aria-label":`Coding`,className:c(i.body,M),children:`Coding`}),(0,G.jsx)(j,{value:`image`,"aria-label":`Image`,className:c(i.body,M),children:`Image`})]}):null,t[17]=d,t[18]=h,t[19]=F,t[20]=B):B=t[20];let H;t[21]===C?H=t[22]:(H=C?(0,G.jsx)(y,{variant:C.includes(`error`)||C.includes(`Failed`)?`error`:`success`,className:`mb-0 shrink-0`,children:C}):null,t[21]=C,t[22]=H);let U=d===`coding`,W=d===`coding`,K;t[23]!==v||t[24]!==W||t[25]!==U?(K=(0,G.jsx)(`div`,{className:`ml-auto shrink-0`,children:(0,G.jsx)(de,{sortBy:v,showCodingIndex:U,showIntelligenceByPrice:W,onSortByChange:b})}),t[23]=v,t[24]=W,t[25]=U,t[26]=K):K=t[26];let q;t[27]!==K||t[28]!==B||t[29]!==H?(q=(0,G.jsx)(ae,{className:`max-w-none pt-6`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[B,H,K]})}),t[27]=K,t[28]=B,t[29]=H,t[30]=q):q=t[30];let J;t[31]!==q||t[32]!==I?(J=(0,G.jsxs)(S,{className:`shrink-0`,children:[I,q]}),t[31]=q,t[32]=I,t[33]=J):J=t[33];let Y;if(t[34]!==s||t[35]!==l||t[36]!==N||t[37]!==m||t[38]!==k||t[39]!==D||t[40]!==v||t[41]!==o){let e;t[43]!==s||t[44]!==l||t[45]!==N||t[46]!==m||t[47]!==k||t[48]!==D||t[49]!==v?(e=e=>{let t=s[e.slug]||[],n=l.enabledByProvider[e.slug]||new Set;return(0,G.jsx)(xe,{provider:e,filteredAndSortedModels:N(t,n,v),enabledIds:n,globalSearchQuery:m,getModelDisplayName:T,selectAllId:`select-all-${e.slug}`,checkboxIdPrefix:``,showIntelligence:v===`coding-index`||v===`intelligence-by-price`,noModelsMessage:`No models available for this provider.`,onToggleAll:t=>void k(e.slug,t),onToggleModel:t=>void D(e.slug,t)},e.slug)},t[43]=s,t[44]=l,t[45]=N,t[46]=m,t[47]=k,t[48]=D,t[49]=v,t[50]=e):e=t[50],Y=o.map(e),t[34]=s,t[35]=l,t[36]=N,t[37]=m,t[38]=k,t[39]=D,t[40]=v,t[41]=o,t[42]=Y}else Y=t[42];let X;t[51]===Y?X=t[52]:(X=(0,G.jsx)(ne,{value:`coding`,className:`mt-0 flex flex-col gap-2.5`,children:Y}),t[51]=Y,t[52]=X);let Z;t[53]!==N||t[54]!==m||t[55]!==v||t[56]!==d||t[57]!==o?(Z=d===`image`?(0,G.jsx)(R.Suspense,{fallback:(0,G.jsx)(pe,{}),children:(0,G.jsx)(Se,{providers:o,globalSearchQuery:m,modelSortBy:v,filterAndSortModels:N,getModelDisplayName:T,onSaveStatus:e=>{w(e),e.includes(`Failed`)||setTimeout(()=>w(``),3e3)}})}):null,t[53]=N,t[54]=m,t[55]=v,t[56]=d,t[57]=o,t[58]=Z):Z=t[58];let Q;t[59]===Z?Q=t[60]:(Q=(0,G.jsx)(ne,{value:`image`,className:`mt-0 flex flex-col gap-2.5`,children:Z}),t[59]=Z,t[60]=Q);let $;return t[61]!==d||t[62]!==J||t[63]!==X||t[64]!==Q?($=(0,G.jsx)(x,{loading:!1,children:(0,G.jsxs)(ie,{value:d,className:`flex flex-col gap-2.5`,children:[J,X,Q]})}),t[61]=d,t[62]=J,t[63]=X,t[64]=Q,t[65]=$):$=t[65],$}function Te(e){return e.name.toLowerCase()===`openrouter`}function Ee(e){return T(e.id)}function De(){return U()}function Oe(){let e=(0,L.c)(8),[t,n]=(0,R.useState)(0),r;e[0]===t?r=e[1]:(r=function(){v(V(t)),n(Ae)},e[0]=t,e[1]=r);let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,G.jsx)(pe,{label:`Loading models...`,large:!0}),e[2]=a):a=e[2];let o;e[3]===t?o=e[4]:(o=(0,G.jsx)(R.Suspense,{fallback:a,children:(0,G.jsx)(we,{loadVersion:t},t)}),e[3]=t,e[4]=o);let s;return e[5]!==i||e[6]!==o?(s=(0,G.jsx)(`div`,{className:`h-full min-h-0`,children:(0,G.jsx)(N,{fallbackTitle:`Failed to load models`,onRetry:i,renderFallback:ke,children:o})}),e[5]=i,e[6]=o,e[7]=s):s=e[7],s}function ke(e,t){return(0,G.jsx)(te,{title:`Failed to load models`,action:(0,G.jsx)(l,{variant:`outline`,onClick:t,children:`Retry`}),children:e.message})}function Ae(e){return e+1}export{Oe as default};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{fn as i}from"./dist-DQEC_JS0.js";import{$ as a,n as o}from"./store-D151firE.js";import{r as s,t as c}from"./utils-DfZXN5fy.js";import{t as l}from"./button-Djzr1B_4.js";import{r as u}from"./tooltip-CXREivps.js";import{Ft as d,G as f,H as p,R as m,V as h,z as g}from"./api-Cho1mlFq.js";import{t as _}from"./progress-indicator-Dr2oM_0d.js";import{n as v}from"./suspense-resource-DzlMlIgR.js";import{At as y,Et as b,Ft as x,Ht as S,Qn as ee,Rt as te,Sr as ne,Xt as C,_t as w,jt as re,on as T,xr as ie,zt as ae}from"./index-BlkYPP7B.js";import{i as E,n as D,o as O,r as k,t as A}from"./table-BXRLirbI.js";import{n as j,t as oe}from"./toggle-group-D3YTdr2u.js";import{n as M,t as se}from"./commit-method-fields-Cp9zzEl4.js";import{t as N}from"./async-error-boundary-BIrTHWz-.js";import{t as ce}from"./sorting-DqwxPMRN.js";import{c as P,o as le}from"./settings-list-mil_4_AR.js";import{t as ue}from"./use-deferred-search-Dgxosq55.js";import{n as de,r as F,t as I}from"./model-list-controls-CB81yfmg.js";var L=t(),R=e(n(),1);function z(e){let t=(0,L.c)(5),[n,r]=(0,R.useState)(e),i;t[0]===n?i=t[1]:(i=async function(e,t,i,a){if(n[e]?.has(t)){await a(e,t),r(n=>{let r=new Set(n[e]??[]);return r.delete(t),{...n,[e]:r}});return}await i(e,t),r(n=>({...n,[e]:new Set([...n[e]||[],t])}))},t[0]=n,t[1]=i);let a=i,o;return t[2]!==n||t[3]!==a?(o={enabledByProvider:n,toggleModel:a},t[2]=n,t[3]=a,t[4]=o):o=t[4],o}function fe(){let e=(0,L.c)(5),t=o(),n;e[0]===t?n=e[1]:(n=function(e){C(),t({type:a.ConfigUpdated}),e(`Model preferences saved successfully`),setTimeout(()=>e(``),3e3)},e[0]=t,e[1]=n);let r=n,i;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=function(e,t){e(t instanceof Error?t.message:`Failed to save model changes`)},e[2]=i):i=e[2];let s=i,c;return e[3]===r?c=e[4]:(c={markSaved:r,markFailed:s},e[3]=r,e[4]=c),c}function B(e){let t=(0,L.c)(8),n=o(),r;t[0]!==n||t[1]!==e?(r=function(){n({type:a.ConfigUpdated}),e(`Model preferences saved successfully`)},t[0]=n,t[1]=e,t[2]=r):r=t[2];let i=r,s;t[3]===e?s=t[4]:(s=function(t){e(t instanceof Error?t.message:`Failed to save model changes`)},t[3]=e,t[4]=s);let c=s,l;return t[5]!==c||t[6]!==i?(l={markSaved:i,markFailed:c},t[5]=c,t[6]=i,t[7]=l):l=t[7],l}function V(e){return`settings-models:coding:${e}`}function H(e){return`settings-models:image:${e}`}async function U(){let e=(await d()).filter(e=>e.apiKey),t=await f(`coding`),n={},r={};for(let i of e){let e=t[i.slug];n[i.slug]=e?.models??[],r[i.slug]=new Set(e?.enabledModelIds??[])}return{providers:e,allModels:n,enabledModelIds:r}}async function W(e){let t=e.filter(e=>e.name.toLowerCase()===`openrouter`),n=await f(`image`),r={},i={};for(let e of t){let t=n[e.slug];r[e.slug]=t?.models??[],i[e.slug]=new Set(t?.enabledModelIds??[])}return{allImageModels:r,enabledImageModelIds:i}}var G=r();function pe(e){let t=(0,L.c)(3),{label:n,large:r}=e,i=r!==void 0&&r?`lg`:`sm`,a;return t[0]!==n||t[1]!==i?(a=(0,G.jsx)(_,{centered:!0,containerClassName:`py-12`,label:n,size:i}),t[0]=n,t[1]=i,t[2]=a):a=t[2],a}var K=`table-fixed`,q=`h-9`,J=c(i.body,`py-1.5`),Y=`w-10 py-1.5`,X=`w-24 py-1.5 text-right`,Z=c(i.body,`w-20 py-1.5 text-right text-muted-foreground tabular-nums`),Q=c(i.body,`w-48 py-1.5 text-right text-muted-foreground whitespace-nowrap tabular-nums`),$=`h-9 w-24 bg-transparent py-2 text-right`,me=`h-9 w-20 bg-transparent py-2 text-right`,he=`h-9 w-48 bg-transparent py-2 text-right`;function ge(e){return!e||(e.prompt??0)===0&&(e.completion??0)===0?``:`$${s(e.prompt??0)} in | $${s(e.completion??0)} out`}function _e(e){return e==null||!Number.isFinite(e)||e<=0?``:e>=100?Math.round(e).toLocaleString():e.toFixed(1)}function ve(e){let t=(0,L.c)(9),{showIntelligence:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=c(`w-full caption-bottom`,K,i.body),t[0]=r):r=t[0];let a,o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,G.jsx)(E,{className:`h-9 w-10 bg-transparent py-2`}),o=(0,G.jsx)(E,{className:`h-9 bg-transparent py-2`,children:`Model`}),t[1]=a,t[2]=o):(a=t[1],o=t[2]);let s;t[3]===n?s=t[4]:(s=n?(0,G.jsx)(E,{className:$,children:`Intelligence`}):null,t[3]=n,t[4]=s);let l,u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,G.jsx)(E,{className:me,children:`TPS`}),u=(0,G.jsx)(E,{className:he,children:`Pricing`}),t[5]=l,t[6]=u):(l=t[5],u=t[6]);let d;return t[7]===s?d=t[8]:(d=(0,G.jsx)(`table`,{className:r,children:(0,G.jsx)(`thead`,{className:`[&_tr]:border-b [&_tr]:border-table-border`,children:(0,G.jsxs)(`tr`,{children:[a,o,s,l,u]})})}),t[7]=s,t[8]=d),d}function ye(e){let t=(0,L.c)(15),{models:n,enabledIds:r,checkboxIdPrefix:a,showIntelligence:o,getModelDisplayName:s,onToggleModel:l}=e,u;if(t[0]!==a||t[1]!==r||t[2]!==s||t[3]!==n||t[4]!==l||t[5]!==o){let e;t[7]!==a||t[8]!==r||t[9]!==s||t[10]!==l||t[11]!==o?(e=e=>{let t=`${a}${e.id}`,n=r.has(e.id);return(0,G.jsxs)(O,{className:q,children:[(0,G.jsx)(k,{className:Y,children:(0,G.jsx)(w,{id:t,value:n,onChange:()=>l(e.id),ariaLabel:`${s(e)} ${n?`enabled`:`disabled`}`})}),(0,G.jsx)(k,{className:J,children:(0,G.jsx)(`label`,{htmlFor:t,className:c(i.body,`cursor-pointer truncate peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),children:s(e)})}),o?(0,G.jsx)(k,{className:X,children:(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(F,{codingIndex:e.coding_index,modelName:s(e)})})}):null,(0,G.jsx)(k,{className:Z,children:_e(e.avgTPS)}),(0,G.jsx)(k,{className:Q,children:ge(e.pricing)})]},e.id)},t[7]=a,t[8]=r,t[9]=s,t[10]=l,t[11]=o,t[12]=e):e=t[12],u=n.map(e),t[0]=a,t[1]=r,t[2]=s,t[3]=n,t[4]=l,t[5]=o,t[6]=u}else u=t[6];let d;return t[13]===u?d=t[14]:(d=(0,G.jsx)(A,{className:K,children:(0,G.jsx)(D,{children:u})}),t[13]=u,t[14]=d),d}function be(e){let t=(0,L.c)(25),{providerName:n,providerSlug:r,action:a,tableHeader:o,children:s}=e,l;t[0]!==n||t[1]!==r?(l=(0,G.jsx)(b,{provider:{name:n,slug:r}}),t[0]=n,t[1]=r,t[2]=l):l=t[2];let u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=c(i.pageTitle,`truncate`),t[3]=u):u=t[3];let d;t[4]===n?d=t[5]:(d=(0,G.jsx)(`h2`,{className:u,children:n}),t[4]=n,t[5]=d);let f;t[6]!==l||t[7]!==d?(f=(0,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[l,d]}),t[6]=l,t[7]=d,t[8]=f):f=t[8];let p;t[9]===a?p=t[10]:(p=a?(0,G.jsx)(`div`,{className:`electrobun-webkit-app-region-no-drag shrink-0`,children:a}):null,t[9]=a,t[10]=p);let m;t[11]!==f||t[12]!==p?(m=(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-divider px-6 py-4 electrobun-webkit-app-region-drag`,children:[f,p]}),t[11]=f,t[12]=p,t[13]=m):m=t[13];let h;t[14]===o?h=t[15]:(h=o?(0,G.jsx)(`div`,{className:`electrobun-webkit-app-region-no-drag px-6 pb-2 pt-4`,children:o}):null,t[14]=o,t[15]=h);let g=o?`pt-0`:`pt-6`,_;t[16]===g?_=t[17]:(_=c(`px-6 pb-6`,g),t[16]=g,t[17]=_);let v;t[18]!==s||t[19]!==_?(v=(0,G.jsx)(`div`,{className:_,children:s}),t[18]=s,t[19]=_,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==m||t[23]!==h?(y=(0,G.jsxs)(S,{className:`shrink-0`,children:[m,h,v]}),t[21]=v,t[22]=m,t[23]=h,t[24]=y):y=t[24],y}function xe(e){let t=(0,L.c)(23),{provider:n,filteredAndSortedModels:r,enabledIds:i,globalSearchQuery:a,getModelDisplayName:o,selectAllId:s,checkboxIdPrefix:c,showIntelligence:l,noModelsMessage:d,onToggleAll:f,onToggleModel:p}=e;if(r.length===0&&a)return null;let m;t[0]!==i||t[1]!==r||t[2]!==f||t[3]!==s?(m=r.length>0?(0,G.jsx)(I,{id:s,checked:r.every(e=>i.has(e.id)),onChange:f}):null,t[0]=i,t[1]=r,t[2]=f,t[3]=s,t[4]=m):m=t[4];let h;t[5]!==r.length||t[6]!==l?(h=r.length>0?(0,G.jsx)(ve,{showIntelligence:l}):void 0,t[5]=r.length,t[6]=l,t[7]=h):h=t[7];let g;t[8]!==c||t[9]!==i||t[10]!==r||t[11]!==o||t[12]!==a||t[13]!==d||t[14]!==p||t[15]!==l?(g=r.length===0?(0,G.jsx)(P,{message:a?`No models matching your search.`:d}):(0,G.jsx)(u,{children:(0,G.jsx)(ye,{models:r,enabledIds:i,checkboxIdPrefix:c,showIntelligence:l,getModelDisplayName:o,onToggleModel:p})}),t[8]=c,t[9]=i,t[10]=r,t[11]=o,t[12]=a,t[13]=d,t[14]=p,t[15]=l,t[16]=g):g=t[16];let _;return t[17]!==n.name||t[18]!==n.slug||t[19]!==m||t[20]!==h||t[21]!==g?(_=(0,G.jsx)(be,{providerName:n.name,providerSlug:n.slug,action:m,tableHeader:h,children:g},n.slug),t[17]=n.name,t[18]=n.slug,t[19]=m,t[20]=h,t[21]=g,t[22]=_):_=t[22],_}function Se(e){let t=(0,L.c)(31),{providers:n,globalSearchQuery:r,modelSortBy:i,filterAndSortModels:a,getModelDisplayName:o,onSaveStatus:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=H(0),t[0]=c):c=t[0];let l;t[1]===n?l=t[2]:(l=()=>W(n),t[1]=n,t[2]=l);let u=ee(c,l),[d]=(0,R.useState)(u.allImageModels),f=z(u.enabledImageModelIds),p=B(s),g;t[3]!==p||t[4]!==f?(g=async function(e,t){try{await f.toggleModel(e,t,h,m),p.markSaved()}catch(e){let t=e;p.markFailed(t)}},t[3]=p,t[4]=f,t[5]=g):g=t[5];let _=g,v;t[6]!==d||t[7]!==_||t[8]!==f?(v=async function(e,t){let n=d[e];if(!n)return;let r=f.enabledByProvider[e];for(let i of n)r?.has(i.id)!==t&&await _(e,i.id)},t[6]=d,t[7]=_,t[8]=f,t[9]=v):v=t[9];let y=v,b;if(t[10]!==d||t[11]!==a||t[12]!==o||t[13]!==r||t[14]!==y||t[15]!==_||t[16]!==f||t[17]!==i||t[18]!==n){let e;t[20]!==d||t[21]!==a||t[22]!==o||t[23]!==r||t[24]!==y||t[25]!==_||t[26]!==f||t[27]!==i?(e=e=>{let t=d[e.slug]||[],n=f.enabledByProvider[e.slug]||new Set;return(0,G.jsx)(xe,{provider:e,filteredAndSortedModels:a(t,n,i),enabledIds:n,globalSearchQuery:r,getModelDisplayName:o,selectAllId:`select-all-image-${e.slug}`,checkboxIdPrefix:`image-`,showIntelligence:!1,noModelsMessage:`No image models available for this provider.`,onToggleAll:t=>void y(e.slug,t),onToggleModel:t=>void _(e.slug,t)},e.slug)},t[20]=d,t[21]=a,t[22]=o,t[23]=r,t[24]=y,t[25]=_,t[26]=f,t[27]=i,t[28]=e):e=t[28],b=n.filter(Ce).map(e),t[10]=d,t[11]=a,t[12]=o,t[13]=r,t[14]=y,t[15]=_,t[16]=f,t[17]=i,t[18]=n,t[19]=b}else b=t[19];let x;return t[29]===b?x=t[30]:(x=(0,G.jsx)(G.Fragment,{children:b}),t[29]=b,t[30]=x),x}function Ce(e){return e.name.toLowerCase()===`openrouter`}function we(e){let t=(0,L.c)(66),{loadVersion:n}=e,r;t[0]===n?r=t[1]:(r=V(n),t[0]=n,t[1]=r);let a=ee(r,De),o=a.providers,[s]=(0,R.useState)(a.allModels),l=z(a.enabledModelIds),u=fe(),[d,f]=(0,R.useState)(`coding`),{query:m,setQuery:h,deferredQuery:_}=ue(),[v,b]=(0,R.useState)(`alphabetical`),[C,w]=(0,R.useState)(``),T=Ee,E;t[2]!==u||t[3]!==l?(E=async function(e,t){try{await l.toggleModel(e,t,p,g),u.markSaved(w)}catch(e){let t=e;u.markFailed(w,t)}},t[2]=u,t[3]=l,t[4]=E):E=t[4];let D=E,O;t[5]!==s||t[6]!==l||t[7]!==D?(O=async function(e,t){let n=s[e];if(!n)return;let r=l.enabledByProvider[e];for(let i of n)r?.has(i.id)!==t&&await D(e,i.id)},t[5]=s,t[6]=l,t[7]=D,t[8]=O):O=t[8];let k=O,A;t[9]===_?A=t[10]:(A=(e,t,n)=>ce({models:e,query:_,sortBy:n,getDisplayName:T,getPriority:e=>+!t.has(e.id)}),t[9]=_,t[10]=A);let N=A;if(o.length===0){let e;return t[11]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(te,{title:`No providers configured`,children:`Configure a provider with an API key to view available models.`}),t[11]=e):e=t[11],e}let P;t[12]===o?P=t[13]:(P=o.some(Te),t[12]=o,t[13]=P);let F=P,I;t[14]!==m||t[15]!==h?(I=(0,G.jsx)(re,{title:`Models`,description:`View and manage available models from your configured providers.`,action:(0,G.jsx)(le,{placeholder:`Search`,value:m,onChange:h,className:`mb-0 w-64`}),sticky:!1}),t[14]=m,t[15]=h,t[16]=I):I=t[16];let B;t[17]!==d||t[18]!==h||t[19]!==F?(B=F?(0,G.jsxs)(oe,{type:`single`,value:d,onValueChange:e=>{(e===`coding`||e===`image`)&&(f(e),h(``))},"aria-label":`Model type`,className:c(se,`shrink-0`),children:[(0,G.jsx)(j,{value:`coding`,"aria-label":`Coding`,className:c(i.body,M),children:`Coding`}),(0,G.jsx)(j,{value:`image`,"aria-label":`Image`,className:c(i.body,M),children:`Image`})]}):null,t[17]=d,t[18]=h,t[19]=F,t[20]=B):B=t[20];let H;t[21]===C?H=t[22]:(H=C?(0,G.jsx)(y,{variant:C.includes(`error`)||C.includes(`Failed`)?`error`:`success`,className:`mb-0 shrink-0`,children:C}):null,t[21]=C,t[22]=H);let U=d===`coding`,W=d===`coding`,K;t[23]!==v||t[24]!==W||t[25]!==U?(K=(0,G.jsx)(`div`,{className:`ml-auto shrink-0`,children:(0,G.jsx)(de,{sortBy:v,showCodingIndex:U,showIntelligenceByPrice:W,onSortByChange:b})}),t[23]=v,t[24]=W,t[25]=U,t[26]=K):K=t[26];let q;t[27]!==K||t[28]!==B||t[29]!==H?(q=(0,G.jsx)(ae,{className:`max-w-none pt-6`,children:(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[B,H,K]})}),t[27]=K,t[28]=B,t[29]=H,t[30]=q):q=t[30];let J;t[31]!==q||t[32]!==I?(J=(0,G.jsxs)(S,{className:`shrink-0`,children:[I,q]}),t[31]=q,t[32]=I,t[33]=J):J=t[33];let Y;if(t[34]!==s||t[35]!==l||t[36]!==N||t[37]!==m||t[38]!==k||t[39]!==D||t[40]!==v||t[41]!==o){let e;t[43]!==s||t[44]!==l||t[45]!==N||t[46]!==m||t[47]!==k||t[48]!==D||t[49]!==v?(e=e=>{let t=s[e.slug]||[],n=l.enabledByProvider[e.slug]||new Set;return(0,G.jsx)(xe,{provider:e,filteredAndSortedModels:N(t,n,v),enabledIds:n,globalSearchQuery:m,getModelDisplayName:T,selectAllId:`select-all-${e.slug}`,checkboxIdPrefix:``,showIntelligence:v===`coding-index`||v===`intelligence-by-price`,noModelsMessage:`No models available for this provider.`,onToggleAll:t=>void k(e.slug,t),onToggleModel:t=>void D(e.slug,t)},e.slug)},t[43]=s,t[44]=l,t[45]=N,t[46]=m,t[47]=k,t[48]=D,t[49]=v,t[50]=e):e=t[50],Y=o.map(e),t[34]=s,t[35]=l,t[36]=N,t[37]=m,t[38]=k,t[39]=D,t[40]=v,t[41]=o,t[42]=Y}else Y=t[42];let X;t[51]===Y?X=t[52]:(X=(0,G.jsx)(ne,{value:`coding`,className:`mt-0 flex flex-col gap-2.5`,children:Y}),t[51]=Y,t[52]=X);let Z;t[53]!==N||t[54]!==m||t[55]!==v||t[56]!==d||t[57]!==o?(Z=d===`image`?(0,G.jsx)(R.Suspense,{fallback:(0,G.jsx)(pe,{}),children:(0,G.jsx)(Se,{providers:o,globalSearchQuery:m,modelSortBy:v,filterAndSortModels:N,getModelDisplayName:T,onSaveStatus:e=>{w(e),e.includes(`Failed`)||setTimeout(()=>w(``),3e3)}})}):null,t[53]=N,t[54]=m,t[55]=v,t[56]=d,t[57]=o,t[58]=Z):Z=t[58];let Q;t[59]===Z?Q=t[60]:(Q=(0,G.jsx)(ne,{value:`image`,className:`mt-0 flex flex-col gap-2.5`,children:Z}),t[59]=Z,t[60]=Q);let $;return t[61]!==d||t[62]!==J||t[63]!==X||t[64]!==Q?($=(0,G.jsx)(x,{loading:!1,children:(0,G.jsxs)(ie,{value:d,className:`flex flex-col gap-2.5`,children:[J,X,Q]})}),t[61]=d,t[62]=J,t[63]=X,t[64]=Q,t[65]=$):$=t[65],$}function Te(e){return e.name.toLowerCase()===`openrouter`}function Ee(e){return T(e.id)}function De(){return U()}function Oe(){let e=(0,L.c)(8),[t,n]=(0,R.useState)(0),r;e[0]===t?r=e[1]:(r=function(){v(V(t)),n(Ae)},e[0]=t,e[1]=r);let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,G.jsx)(pe,{label:`Loading models...`,large:!0}),e[2]=a):a=e[2];let o;e[3]===t?o=e[4]:(o=(0,G.jsx)(R.Suspense,{fallback:a,children:(0,G.jsx)(we,{loadVersion:t},t)}),e[3]=t,e[4]=o);let s;return e[5]!==i||e[6]!==o?(s=(0,G.jsx)(`div`,{className:`h-full min-h-0`,children:(0,G.jsx)(N,{fallbackTitle:`Failed to load models`,onRetry:i,renderFallback:ke,children:o})}),e[5]=i,e[6]=o,e[7]=s):s=e[7],s}function ke(e,t){return(0,G.jsx)(te,{title:`Failed to load models`,action:(0,G.jsx)(l,{variant:`outline`,onClick:t,children:`Retry`}),children:e.message})}function Ae(e){return e+1}export{Oe as default};
|
package/dist/public/assets/{settings-plugins-view-C0t1Lsqr.js → settings-plugins-view-DGpw6oP7.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/settings-skills-view-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,r,t as i}from"./react-vendor-Ee0-5T4I.js";import{o as a,s as o}from"./chunk-QFMPRPBF-COsSkB7x.js";import{
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/settings-skills-view-Cky2XWQ3.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-BlkYPP7B.js","assets/react-vendor-Ee0-5T4I.js","assets/progress-indicator-Dr2oM_0d.js","assets/utils-DfZXN5fy.js","assets/dist-DQEC_JS0.js","assets/alert-dialog-CJ403H9_.js","assets/button-Djzr1B_4.js","assets/use-browser-overlay-block-DyprQSIG.js","assets/browser-overlay-block-CiDtkfup.js","assets/dist-67Q0Rzil.js","assets/dist-DwfbSihk.js","assets/es2015-BDTYd1CN.js","assets/scroll-area-BTSuUr9o.js","assets/dist-OixawqbU.js","assets/tooltip-CXREivps.js","assets/dist-BGhGR6wN.js","assets/use-toast-xpb5jNtN.js","assets/chat-dock-context-C-oyjLpB.js","assets/api-Cho1mlFq.js","assets/store-D151firE.js","assets/explorer-tab-context-BxUVwWQQ.js","assets/main-tab-context-CNgxXqnH.js","assets/terminal-output-activity-B1bjjsl7.js","assets/use-account-settings-query-DVhIle0W.js","assets/query-keys-BX4RxqwI.js","assets/useBaseQuery-C4OJ4Bcm.js","assets/useQuery-CxnaBfkX.js","assets/create-project-workspace-BXawjzKi.js","assets/suspense-resource-DzlMlIgR.js","assets/dist-D3LcCYeO.js","assets/dist-BnsVdica.js","assets/dist-DkiU4lhK.js","assets/dist-CRbBwZ5Q.js","assets/dist-CSssbxDI.js","assets/lucide-react-BFzs_X2U.js","assets/chunk-QFMPRPBF-COsSkB7x.js","assets/index-BPQfGy4n.css","assets/delete-confirm-dialog-Bcy-0viP.js","assets/slug-utils-DQA1OvXq.js","assets/settings-list-mil_4_AR.js","assets/card-B0sh3Qvx.js","assets/use-deferred-search-Dgxosq55.js","assets/use-installed-ai-files-CD4qXZcA.js","assets/use-settings-page-loading-CpaBd260.js","assets/settings-mcp-servers-view-BgP_PRL-.js","assets/settings-system-prompt-view-DoB9R-el.js","assets/project-tools-view-BJFer5bm.js","assets/settings-slash-commands-view-BjM6ze37.js","assets/settings-subagents-view-CCxLCJAB.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,r,t as i}from"./react-vendor-Ee0-5T4I.js";import{o as a,s as o}from"./chunk-QFMPRPBF-COsSkB7x.js";import{It as s,Lt as c}from"./dist-DQEC_JS0.js";import{t as l}from"./progress-indicator-Dr2oM_0d.js";import{t as u}from"./settings-tab-bar-BCv1dBl8.js";var d=t(),f=e(n(),1),p=i(),m=(0,f.lazy)(function(){return r(()=>import(`./settings-skills-view-Cky2XWQ3.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45]))}),h=(0,f.lazy)(function(){return r(()=>import(`./settings-mcp-servers-view-BgP_PRL-.js`),__vite__mapDeps([46,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,41,42,45]))}),g=(0,f.lazy)(function(){return r(()=>import(`./settings-system-prompt-view-DoB9R-el.js`),__vite__mapDeps([47,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,45]))}),_=(0,f.lazy)(function(){return r(()=>import(`./project-tools-view-BJFer5bm.js`),__vite__mapDeps([48,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,45]))}),v=(0,f.lazy)(function(){return r(()=>import(`./settings-slash-commands-view-BjM6ze37.js`),__vite__mapDeps([49,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,45]))}),y=(0,f.lazy)(function(){return r(()=>import(`./settings-subagents-view-CCxLCJAB.js`),__vite__mapDeps([50,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,44,45]))});function b(e){let t=(0,d.c)(35),{projectId:n,fallbackTab:r,onProjectUpdated:i}=e,b=r===void 0?`skills`:r,x=a(),S=o(),C;t[0]!==b||t[1]!==x?(C=b===`skills`?c(x.pathname)??b:b,t[0]=b,t[1]=x,t[2]=C):C=t[2];let w=C,T;t[3]!==S||t[4]!==n?(T=function(e){if(n){S(`/settings/project/${n}/plugins/${e}`);return}S(`/settings/plugins/${e}`)},t[3]=S,t[4]=n,t[5]=T):T=t[5];let E=T,D;t[6]!==w||t[7]!==E?(D=(0,p.jsx)(u,{value:w,onValueChange:E,options:s}),t[6]=w,t[7]=E,t[8]=D):D=t[8];let O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,p.jsx)(l,{centered:!0,label:`Loading plugin settings...`}),t[9]=O):O=t[9];let k;t[10]!==w||t[11]!==x?(k=w===`skills`&&(0,p.jsx)(m,{},x.key),t[10]=w,t[11]=x,t[12]=k):k=t[12];let A;t[13]===w?A=t[14]:(A=w===`mcp-servers`&&(0,p.jsx)(h,{}),t[13]=w,t[14]=A);let j;t[15]===w?j=t[16]:(j=w===`system-prompt`&&(0,p.jsx)(g,{}),t[15]=w,t[16]=j);let M;t[17]!==w||t[18]!==i||t[19]!==n?(M=w===`tools`&&(0,p.jsx)(_,{projectId:n,onProjectUpdated:i}),t[17]=w,t[18]=i,t[19]=n,t[20]=M):M=t[20];let N;t[21]===w?N=t[22]:(N=w===`slash-commands`&&(0,p.jsx)(v,{}),t[21]=w,t[22]=N);let P;t[23]===w?P=t[24]:(P=w===`subagents`&&(0,p.jsx)(y,{}),t[23]=w,t[24]=P);let F;t[25]!==N||t[26]!==P||t[27]!==k||t[28]!==A||t[29]!==j||t[30]!==M?(F=(0,p.jsx)(`div`,{className:`min-h-0 flex-1`,role:`region`,"aria-label":`Plugin settings`,children:(0,p.jsxs)(f.Suspense,{fallback:O,children:[k,A,j,M,N,P]})}),t[25]=N,t[26]=P,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=F):F=t[31];let I;return t[32]!==F||t[33]!==D?(I=(0,p.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[D,F]}),t[32]=F,t[33]=D,t[34]=I):I=t[34],I}export{b as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/providers-list-view-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,r,t as i}from"./react-vendor-Ee0-5T4I.js";import{o as a,s as o}from"./chunk-QFMPRPBF-COsSkB7x.js";import{
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/providers-list-view-CBvNXPMw.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-BlkYPP7B.js","assets/react-vendor-Ee0-5T4I.js","assets/progress-indicator-Dr2oM_0d.js","assets/utils-DfZXN5fy.js","assets/dist-DQEC_JS0.js","assets/alert-dialog-CJ403H9_.js","assets/button-Djzr1B_4.js","assets/use-browser-overlay-block-DyprQSIG.js","assets/browser-overlay-block-CiDtkfup.js","assets/dist-67Q0Rzil.js","assets/dist-DwfbSihk.js","assets/es2015-BDTYd1CN.js","assets/scroll-area-BTSuUr9o.js","assets/dist-OixawqbU.js","assets/tooltip-CXREivps.js","assets/dist-BGhGR6wN.js","assets/use-toast-xpb5jNtN.js","assets/chat-dock-context-C-oyjLpB.js","assets/api-Cho1mlFq.js","assets/store-D151firE.js","assets/explorer-tab-context-BxUVwWQQ.js","assets/main-tab-context-CNgxXqnH.js","assets/terminal-output-activity-B1bjjsl7.js","assets/use-account-settings-query-DVhIle0W.js","assets/query-keys-BX4RxqwI.js","assets/useBaseQuery-C4OJ4Bcm.js","assets/useQuery-CxnaBfkX.js","assets/create-project-workspace-BXawjzKi.js","assets/suspense-resource-DzlMlIgR.js","assets/dist-D3LcCYeO.js","assets/dist-BnsVdica.js","assets/dist-DkiU4lhK.js","assets/dist-CRbBwZ5Q.js","assets/dist-CSssbxDI.js","assets/lucide-react-BFzs_X2U.js","assets/chunk-QFMPRPBF-COsSkB7x.js","assets/index-BPQfGy4n.css","assets/model-list-controls-CB81yfmg.js","assets/sorting-DqwxPMRN.js","assets/async-error-boundary-BIrTHWz-.js","assets/card-B0sh3Qvx.js","assets/settings-list-mil_4_AR.js","assets/use-deferred-search-Dgxosq55.js","assets/pending-changes-Bn-0ak1d.js","assets/settings-models-view-CVujPn9N.js","assets/commit-method-fields-Cp9zzEl4.js","assets/toggle-group-D3YTdr2u.js","assets/table-BXRLirbI.js","assets/project-model-aliases-view-Btu6AABR.js","assets/use-settings-page-loading-CpaBd260.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,r,t as i}from"./react-vendor-Ee0-5T4I.js";import{o as a,s as o}from"./chunk-QFMPRPBF-COsSkB7x.js";import{Ht as s,Vt as c}from"./dist-DQEC_JS0.js";import{t as l}from"./progress-indicator-Dr2oM_0d.js";import{t as u}from"./settings-tab-bar-BCv1dBl8.js";var d=t(),f=e(n(),1),p=i(),m=(0,f.lazy)(function(){return r(()=>import(`./providers-list-view-CBvNXPMw.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45]))}),h=(0,f.lazy)(function(){return r(()=>import(`./settings-models-view-CVujPn9N.js`),__vite__mapDeps([46,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,47,48,39,40,41,42,43,49,44]))}),g=(0,f.lazy)(function(){return r(()=>import(`./project-model-aliases-view-Btu6AABR.js`),__vite__mapDeps([50,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,49,51]))});function _(e){let t=(0,d.c)(22),{fallbackTab:n}=e,r=n===void 0?`providers`:n,i=a(),_=o(),v;t[0]!==r||t[1]!==i?(v=r===`providers`?s(i.pathname)??r:r,t[0]=r,t[1]=i,t[2]=v):v=t[2];let y=v,b;t[3]===_?b=t[4]:(b=function(e){_(`/settings/${e}`)},t[3]=_,t[4]=b);let x=b,S;t[5]!==y||t[6]!==x?(S=(0,p.jsx)(u,{value:y,onValueChange:x,options:c}),t[5]=y,t[6]=x,t[7]=S):S=t[7];let C;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,p.jsx)(l,{centered:!0,label:`Loading provider settings...`}),t[8]=C):C=t[8];let w;t[9]===y?w=t[10]:(w=y===`providers`&&(0,p.jsx)(m,{}),t[9]=y,t[10]=w);let T;t[11]===y?T=t[12]:(T=y===`models`&&(0,p.jsx)(h,{}),t[11]=y,t[12]=T);let E;t[13]===y?E=t[14]:(E=y===`model-aliases`&&(0,p.jsx)(g,{}),t[13]=y,t[14]=E);let D;t[15]!==w||t[16]!==T||t[17]!==E?(D=(0,p.jsx)(`div`,{className:`min-h-0 flex-1`,role:`region`,"aria-label":`Provider settings`,children:(0,p.jsxs)(f.Suspense,{fallback:C,children:[w,T,E]})}),t[15]=w,t[16]=T,t[17]=E,t[18]=D):D=t[18];let O;return t[19]!==S||t[20]!==D?(O=(0,p.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[S,D]}),t[19]=S,t[20]=D,t[21]=O):O=t[21],O}export{_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{a as i,i as a,l as o,n as s,o as c,t as l}from"./use-account-settings-query-R4H9qmd3.js";import{r as u}from"./query-keys-BX4RxqwI.js";import{C as d,ln as f,ot as p,v as m,y as h}from"./dist-PhNKneni.js";import{t as g}from"./utils-BHAZna1O.js";import{V as _,W as v,on as y,pt as b,r as x,tt as S,xn as C}from"./lucide-react-BFzs_X2U.js";import{t as w}from"./button-BvwSd5oT.js";import{i as T,n as E,t as D}from"./tooltip-CqktA8Zq.js";import{Bi as O,N as k,ai as A,an as ee,fr as j,n as M,rn as N,sa as P}from"./api-DS1qgAo_.js";import{a as F,c as I,i as L,n as R,o as z,r as B,s as V,t as H}from"./alert-dialog-Cf2bArEP.js";import{t as U}from"./use-toast-xpb5jNtN.js";import{Br as te,Ft as W,H as G,Hr as K,Ht as ne,Ir as q,Lr as J,Lt as re,Ot as ie,Rr as Y,Ur as ae,Vr as X,_r as oe,_t as se,gr as ce,jt as le,nr as ue,rr as de,s as fe,tr as pe,vr as me,yr as he,zr as ge,zt as _e}from"./index-SP0wF0IN.js";import{t as ve}from"./use-settings-page-loading-CpaBd260.js";var Z=t(),Q=e(n(),1),ye=p(`app.use-local-machine-name.hook`);function be(){let e=(0,Z.c)(12),{data:t,isLoading:n}=a(),r=i(),o=t?.machineName??``,[s,c]=(0,Q.useState)(``),l,u;e[0]===o?(l=e[1],u=e[2]):(l=function(){o&&c(o)},u=[o],e[0]=o,e[1]=l,e[2]=u),(0,Q.useEffect)(l,u);let d;e[3]!==s||e[4]!==o||e[5]!==r?(d=async function(){let e=s.trim();if(!e||e===o){c(o);return}try{c((await r.mutateAsync({machineName:e})).machineName)}catch(e){let t=e;throw ye.error(`Failed to update machine name:`,t),c(o),t}},e[3]=s,e[4]=o,e[5]=r,e[6]=d):d=e[6];let f=d,p;return e[7]!==s||e[8]!==n||e[9]!==f||e[10]!==r.isPending?(p={draftMachineName:s,isLoading:n,isSaving:r.isPending,setDraftMachineName:c,saveDraftMachineName:f},e[7]=s,e[8]=n,e[9]=f,e[10]=r.isPending,e[11]=p):p=e[11],p}var xe=p(`app.use-remote-machines.hook`);function Se(e){return[...e].sort(function(e,t){let n=e.machineName.localeCompare(t.machineName,void 0,{sensitivity:`base`});return n===0?e.publicUrl.localeCompare(t.publicUrl):n})}function Ce(e){let t={};for(let n of e)t[n.id]=n.machineName;return t}function we(){let[e,t]=(0,Q.useState)([]),[n,r]=(0,Q.useState)({}),[i,a]=(0,Q.useState)(!0),[o,s]=(0,Q.useState)(()=>new Set);(0,Q.useEffect)(()=>{let e=!1;async function n(){try{let n=await N();e||(t(n.remoteMachines),r(Ce(n.remoteMachines)))}catch(e){xe.error(`Failed to load remote machines:`,e)}finally{e||a(!1)}}return n(),()=>{e=!0}},[]);async function c(e){let n=(await M(e)).remoteMachine;return t(e=>Se([...e,n])),r(e=>({...e,[n.id]:n.machineName})),n}async function l(e){await k(e),t(t=>t.filter(t=>t.id!==e)),r(t=>{let n={...t};return delete n[e],n})}function u(e,t){r(n=>({...n,[e]:t}))}async function d(r){let i=e.find(e=>e.id===r),a=(n[r]??``).trim();if(i){if(!a||a===i.machineName){u(r,i.machineName);return}s(e=>new Set(e).add(r));try{let e=await j(r,a);t(t=>Se(t.map(t=>t.id===r?e.remoteMachine:t))),u(r,e.remoteMachine.machineName)}catch(e){throw xe.error(`Failed to update remote machine name:`,e),u(r,i.machineName),e}finally{s(e=>{let t=new Set(e);return t.delete(r),t})}}}function f(e){return o.has(e)}return{addMachine:c,draftNames:n,isLoading:i,isSavingId:f,remoteMachines:e,removeMachine:l,saveDraftName:d,setDraftName:u}}var Te=p(`app.use-server-bind-mode.hook`),Ee=`local`,De=`tarsk-server-bind-mode-changed`;function Oe(e){P(e)}function ke(){if(typeof window>`u`)return!1;try{return sessionStorage.getItem(De)===`true`}catch{return!1}}function Ae(e){if(!(typeof window>`u`))try{e?sessionStorage.setItem(De,`true`):sessionStorage.removeItem(De)}catch{}}function je(e){let t=(0,Z.c)(4),[n,r]=(0,Q.useState)(null),i,a;return t[0]!==n||t[1]!==e?(i=function(){e===void 0||n!==null||r(e)},a=[n,e],t[0]=n,t[1]=e,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Q.useEffect)(i,a),n}function Me(e,t){let n=(0,Z.c)(4),r,i;n[0]!==t||n[1]!==e?(r=function(){e===void 0||t===void 0||Oe({networkAddresses:t,serverBindMode:e})},i=[t,e],n[0]=t,n[1]=e,n[2]=r,n[3]=i):(r=n[2],i=n[3]),(0,Q.useEffect)(r,i)}function Ne(e,t){let{serverBindMode:n=Ee}=t??{},{serverBindMode:r=n}=e??{};return r}function Pe(e,t){let{networkAddresses:n=[]}=t??{},{networkAddresses:r=n}=e??{};return r}function Fe(e){let{tunnelUrl:t=null,tunnelStatus:n=`off`,tunnelError:r=null}=e??{};return{tunnelUrl:t,tunnelStatus:n,tunnelError:r}}function Ie(e,t,n,r){return{serverBindMode:Ne(e,t),networkAddresses:Pe(e,t),...Fe(e),isLoading:n||r&&t===null}}function Le(e){let t=(0,Z.c)(8),n=(0,Q.useSyncExternalStore)(ue,pe,Re),r=de(),i=r&&n,a,o;t[0]!==r||t[1]!==e?(a=function(){if(r)return G(function(t){t===`tunnel`&&s(e).catch(function(){})})},o=[r,e],t[0]=r,t[1]=e,t[2]=a,t[3]=o):(a=t[2],o=t[3]),(0,Q.useEffect)(a,o);let c,u;return t[4]!==e||t[5]!==i?(c=function(){if(i)return fe(function(t){if(!d(t.status))return;let n=t.status;e.getQueryData(l())?e.setQueryData(l(),function(e){return e&&{...e,tunnelError:t.error,tunnelStatus:n,tunnelUrl:t.url}}):s(e).catch(function(){})})},u=[e,i],t[4]=e,t[5]=i,t[6]=c,t[7]=u):(c=t[6],u=t[7]),(0,Q.useEffect)(c,u),i}function Re(){return!1}function ze(e,t,n,r){let i=(0,Z.c)(6),a,o;i[0]!==t||i[1]!==e||i[2]!==r||i[3]!==n?(a=function(){if(t||!n||r)return;let i=0,a=!1,o=setInterval(function(){if(i+=1,i>20){clearInterval(o);return}s(e).catch(function(){}).finally(function(){a&&clearInterval(o)})},2e3);return function(){a=!0,clearInterval(o)}},o=[t,e,r,n],i[0]=t,i[1]=e,i[2]=r,i[3]=n,i[4]=a,i[5]=o):(a=i[4],o=i[5]),(0,Q.useEffect)(a,o)}function Be(){let e=(0,Z.c)(17),t=u(),{isLoading:n}=c(),{data:r,isLoading:o}=a(),s=i(),[l,d]=(0,Q.useState)(ke),f;e[0]!==n||e[1]!==r||e[2]!==o?(f=Ie(r,O(),n,o),e[0]=n,e[1]=r,e[2]=o,e[3]=f):f=e[3];let p=f,m=r?.serverBindMode,h=je(m);Me(m,r?.networkAddresses);let g;e[4]===s?g=e[5]:(g=async function(e){try{let t=await s.mutateAsync({serverBindMode:e});Oe({networkAddresses:t.networkAddresses,serverBindMode:t.serverBindMode}),d(!0),Ae(!0)}catch(e){let t=e;throw Te.error(`Failed to update server bind mode:`,t),U({title:`Could not update network access`,description:t instanceof Error?t.message:`Could not update network access.`,variant:`destructive`}),t}},e[4]=s,e[5]=g);let _=g,v=h!==null&&p.serverBindMode!==h,y=v||l,b=p.serverBindMode===`network`&&(p.tunnelStatus===`starting`||p.tunnelStatus===`off`&&!y),x=Le(t);ze(t,p.isLoading,b,x);let S;return e[6]!==v||e[7]!==y||e[8]!==_||e[9]!==s.isPending||e[10]!==p.isLoading||e[11]!==p.networkAddresses||e[12]!==p.serverBindMode||e[13]!==p.tunnelError||e[14]!==p.tunnelStatus||e[15]!==p.tunnelUrl?(S={defaultServerBindMode:Ee,hasServerBindModeChanged:v,isLoading:p.isLoading,isSaving:s.isPending,needsRestart:y,networkAddresses:p.networkAddresses,serverBindMode:p.serverBindMode,tunnelError:p.tunnelError,tunnelStatus:p.tunnelStatus,tunnelUrl:p.tunnelUrl,updateServerBindMode:_},e[6]=v,e[7]=y,e[8]=_,e[9]=s.isPending,e[10]=p.isLoading,e[11]=p.networkAddresses,e[12]=p.serverBindMode,e[13]=p.tunnelError,e[14]=p.tunnelStatus,e[15]=p.tunnelUrl,e[16]=S):S=e[16],S}var $=r();function Ve({open:e,onOpenChange:t,onSave:n}){let[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1);function l(){i(``),o(null),c(!1)}function u(e){e||l(),t(e)}async function d(){let e=r.trim();if(!e){o(`Enter a Tarsk public address.`);return}c(!0),o(null);try{await n(e),u(!1)}catch(e){o(e instanceof Error?e.message:`Could not add that Remote Machine.`)}finally{c(!1)}}return(0,$.jsx)(Y,{open:e,onOpenChange:u,children:(0,$.jsxs)(ge,{className:`sm:max-w-md`,children:[(0,$.jsxs)(K,{children:[(0,$.jsx)(ae,{children:`Add Machine`}),(0,$.jsxs)(te,{children:[`Enter the public id or full address for another Tarsk on `,h,`.`,` `,m]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(q,{htmlFor:`remote-machine-address`,children:`Public address`}),(0,$.jsx)(J,{id:`remote-machine-address`,value:r,onChange:e=>{i(e.target.value),o(null)},placeholder:`rsawt2ud3n`,disabled:s,"aria-invalid":a!=null,className:`font-mono`}),a?(0,$.jsx)(`p`,{className:f.bodyMuted,children:a}):null]}),(0,$.jsxs)(X,{children:[(0,$.jsx)(w,{type:`button`,variant:`outline`,onClick:()=>u(!1),disabled:s,children:`Cancel`}),(0,$.jsx)(w,{type:`button`,onClick:()=>{d()},disabled:s,children:s?(0,$.jsx)(b,{className:`h-4 w-4 animate-spin`}):`Save`})]})]})})}var He=Object.defineProperty,Ue=Object.getOwnPropertySymbols,We=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable,Ke=(e,t,n)=>t in e?He(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qe=(e,t)=>{for(var n in t||={})We.call(t,n)&&Ke(e,n,t[n]);if(Ue)for(var n of Ue(t))Ge.call(t,n)&&Ke(e,n,t[n]);return e},Je=(e,t)=>{var n={};for(var r in e)We.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ue)for(var r of Ue(e))t.indexOf(r)<0&&Ge.call(e,r)&&(n[r]=e[r]);return n},Ye;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(Ye||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(Ye||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(Ye||={});var Xe=Ye,Ze={L:Xe.QrCode.Ecc.LOW,M:Xe.QrCode.Ecc.MEDIUM,Q:Xe.QrCode.Ecc.QUARTILE,H:Xe.QrCode.Ecc.HIGH},Qe=128,$e=`L`,et=`#FFFFFF`,tt=`#000000`,nt=!1,rt=1,it=4,at=0,ot=.1;function st(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function ct(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function lt(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*ot),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function ut(e,t){return t==null?e?it:at:Math.max(Math.floor(t),0)}function dt({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=Q.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...Xe.QrSegment.makeSegments(t)),e),[]);return Xe.QrCode.encodeSegments(r,Ze[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=Q.useMemo(()=>{let e=c.getModules(),t=ut(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:lt(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var ft=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),pt=Q.forwardRef(function(e,t){let n=e,{value:r,size:i=Qe,level:a=$e,bgColor:o=et,fgColor:s=tt,includeMargin:c=nt,minVersion:l=rt,boostLevel:u,marginSize:d,imageSettings:f}=n,p=Je(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=Je(p,[`style`]),g=f?.src,_=Q.useRef(null),v=Q.useRef(null),y=Q.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=Q.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=dt({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});Q.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=C,r=v.current,a=T!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&T.excavation!=null&&(n=ct(C,T.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/w*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,w,w),t.fillStyle=s,ft?t.fill(new Path2D(st(n,S))):C.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+S,n+S,1,1)})}),T&&(t.globalAlpha=T.opacity),a&&t.drawImage(r,T.x+S,T.y+S,T.w,T.h)}}),Q.useEffect(()=>{x(!1)},[g]);let E=qe({height:i,width:i},m),D=null;return g!=null&&(D=Q.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),Q.createElement(Q.Fragment,null,Q.createElement(`canvas`,qe({style:E,height:i,width:i,ref:y,role:`img`},h)),D)});pt.displayName=`QRCodeCanvas`;var mt=Q.forwardRef(function(e,t){let n=e,{value:r,size:i=Qe,level:a=$e,bgColor:o=et,fgColor:s=tt,includeMargin:c=nt,minVersion:l=rt,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=Je(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=dt({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),y=g,b=null;p!=null&&v!=null&&(v.excavation!=null&&(y=ct(g,v.excavation)),b=Q.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let x=st(y,h);return Q.createElement(`svg`,qe({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&Q.createElement(`title`,null,d),Q.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),Q.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});mt.displayName=`QRCodeSVG`;function ht(e){let t=(0,Z.c)(8),{inputId:n,value:r,disabled:i,onChange:a,onBlur:o}=e,s=n===void 0?`machine-name`:n,c;t[0]===a?c=t[1]:(c=e=>{a(e.target.value)},t[0]=a,t[1]=c);let l;return t[2]!==i||t[3]!==s||t[4]!==o||t[5]!==c||t[6]!==r?(l=(0,$.jsx)(ie,{title:`Machine name`,controlLayout:`row-end`,className:`mt-3`,action:(0,$.jsx)(J,{id:s,value:r,onChange:c,onBlur:o,disabled:i,"aria-label":`Machine name`,className:`w-64 font-mono`})}),t[2]=i,t[3]=s,t[4]=o,t[5]=c,t[6]=r,t[7]=l):l=t[7],l}function gt(e){let t=(0,Z.c)(15),{copied:n,label:r,onCopy:i}=e,a;t[0]===i?a=t[1]:(a=function(){i()},t[0]=i,t[1]=a);let o=a,s;t[2]===n?s=t[3]:(s=n?(0,$.jsx)(C,{className:`h-3.5 w-3.5 text-green-500`}):(0,$.jsx)(y,{className:`h-3.5 w-3.5`}),t[2]=n,t[3]=s);let c;t[4]===r?c=t[5]:(c=(0,$.jsx)(`span`,{className:`sr-only`,children:r}),t[4]=r,t[5]=c);let l;t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,$.jsx)(T,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,onClick:o,className:`inline-flex h-7 w-7 align-middle items-center justify-center rounded-md border border-border bg-background/90 text-foreground shadow-sm transition-colors hover:bg-background`,children:[s,c]})}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u=n?`Copied!`:`Copy to clipboard`,d;t[10]===u?d=t[11]:(d=(0,$.jsx)(E,{children:u}),t[10]=u,t[11]=d);let f;return t[12]!==l||t[13]!==d?(f=(0,$.jsxs)(D,{children:[l,d]}),t[12]=l,t[13]=d,t[14]=f):f=t[14],f}function _t(e){let t=(0,Z.c)(18),{email:n,url:r,copied:i,onCopy:a}=e,o=n??`your account`,s;t[0]===o?s=t[1]:(s=(0,$.jsxs)(`p`,{className:f.bodyMuted,children:[`You can access this machine by signing in as `,o,` to:`]}),t[0]=o,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,$.jsx)(`span`,{className:`${f.mono} break-all`,children:r}),t[2]=r,t[3]=c);let l;t[4]!==i||t[5]!==a?(l=(0,$.jsx)(gt,{copied:i,label:`Copy public address`,onCopy:a}),t[4]=i,t[5]=a,t[6]=l):l=t[6];let u;t[7]!==c||t[8]!==l?(u=(0,$.jsxs)(`p`,{className:f.bodyMuted,children:[c,` `,l,` in a browser or in the Tarsk mobile app by scanning this QR Code`]}),t[7]=c,t[8]=l,t[9]=u):u=t[9];let d;t[10]!==s||t[11]!==u?(d=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12];let p;t[13]===r?p=t[14]:(p=(0,$.jsx)(`div`,{className:`w-fit rounded-lg bg-background p-3`,children:(0,$.jsx)(mt,{value:r,size:128,bgColor:`hsl(var(--background))`,fgColor:`hsl(var(--foreground))`,level:`M`})}),t[13]=r,t[14]=p);let m;return t[15]!==d||t[16]!==p?(m=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[d,p]}),t[15]=d,t[16]=p,t[17]=m):m=t[17],m}function vt(e){let t=(0,Z.c)(14),{accountEmail:n,bindMode:r,tunnelUrl:i,tunnelStatus:a,tunnelError:o,copiedTunnelUrl:s,onCopyTunnelUrl:c}=e,l=r===`network`,u=l&&!i&&a===`starting`,d=l&&a===`error`&&!!o,p;t[0]!==n||t[1]!==s||t[2]!==c||t[3]!==i?(p=i?(0,$.jsx)(_t,{email:n,url:i,copied:s,onCopy:c}):null,t[0]=n,t[1]=s,t[2]=c,t[3]=i,t[4]=p):p=t[4];let m;t[5]===u?m=t[6]:(m=u?(0,$.jsx)(`p`,{className:f.bodyMuted,children:`Starting a public address…`}):null,t[5]=u,t[6]=m);let h;t[7]!==d||t[8]!==o?(h=d?(0,$.jsx)(`p`,{className:f.bodyMuted,children:o}):null,t[7]=d,t[8]=o,t[9]=h):h=t[9];let g;return t[10]!==p||t[11]!==m||t[12]!==h?(g=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2`,children:[p,m,h]}),t[10]=p,t[11]=m,t[12]=h,t[13]=g):g=t[13],g}function yt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`p`,{className:`${f.bodyMuted} mt-3`,children:`Log in before turning this on.`}),e[0]=t):t=e[0],t}function bt(e){let t=(0,Z.c)(2),{bindMode:n,tunnelUrl:r}=e,i=n===`network`&&!r?` The public address appears after restart.`:``,a;return t[0]===i?a=t[1]:(a=(0,$.jsxs)(`p`,{className:`${f.bodyMuted} mt-3`,children:[`You will need to restart for this setting to take effect.`,i]}),t[0]=i,t[1]=a),a}function xt(e){let t=(0,Z.c)(25),{accountEmail:n,bindMode:r,signedIn:i,isLoading:a,isSaving:o,needsRestart:s,tunnelUrl:c,tunnelStatus:l,tunnelError:u,copiedTunnelUrl:d,localMachineName:f,isLocalMachineNameLoading:p,isLocalMachineNameSaving:m,onCopyTunnelUrl:h,onLocalMachineNameChange:g,onLocalMachineNameBlur:_}=e,v=!!(c||l===`starting`||u),y=!i&&r!==`network`,b;t[0]!==n||t[1]!==r||t[2]!==d||t[3]!==h||t[4]!==v||t[5]!==u||t[6]!==l||t[7]!==c?(b=v?(0,$.jsx)(vt,{accountEmail:n,bindMode:r,tunnelUrl:c,tunnelStatus:l,tunnelError:u,copiedTunnelUrl:d,onCopyTunnelUrl:h}):null,t[0]=n,t[1]=r,t[2]=d,t[3]=h,t[4]=v,t[5]=u,t[6]=l,t[7]=c,t[8]=b):b=t[8];let x;t[9]===y?x=t[10]:(x=y?(0,$.jsx)(yt,{}):null,t[9]=y,t[10]=x);let S;t[11]!==r||t[12]!==s||t[13]!==c?(S=s?(0,$.jsx)(bt,{bindMode:r,tunnelUrl:c}):null,t[11]=r,t[12]=s,t[13]=c,t[14]=S):S=t[14];let C=a||o||p||m,w;t[15]!==f||t[16]!==_||t[17]!==g||t[18]!==C?(w=(0,$.jsx)(ht,{inputId:`local-machine-name`,value:f,disabled:C,onChange:g,onBlur:_}),t[15]=f,t[16]=_,t[17]=g,t[18]=C,t[19]=w):w=t[19];let T;return t[20]!==b||t[21]!==x||t[22]!==S||t[23]!==w?(T=(0,$.jsxs)($.Fragment,{children:[b,x,S,w]}),t[20]=b,t[21]=x,t[22]=S,t[23]=w,t[24]=T):T=t[24],T}function St(e,t,n){switch(e){case`success`:return{title:`Signed in`,description:`This computer is now authorized to clone from ${n}.`};case`code`:return{title:`Check your email`,description:`We sent a 6-digit code to ${t}.`};default:return{title:`Sign in to Remote Machine`,description:`Sign in to ${n} to authorize remote cloning. Saving a bookmark does not grant access.`}}}function Ct(e){return e.step===`email`?e.busy?`Sending…`:`Next`:e.busy?`Verifying…`:`Sign in`}function wt({form:e}){if(e.step===`email`)return(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(q,{htmlFor:`remote-machine-email`,children:`Email`}),(0,$.jsx)(J,{id:`remote-machine-email`,type:`email`,autoComplete:`email`,required:!0,value:e.email,disabled:e.busy,onChange:function(t){e.setEmail(t.target.value)}})]});function t(t){t.preventDefault(),e.codeInputRef.current?.focus()}function n(e){return e.replace(/\\D/g,``)}function r(t){e.busy||e.setCode(t)}return(0,$.jsx)(`div`,{className:`flex justify-center py-2`,onMouseDown:t,children:(0,$.jsx)(ce,{ref:e.codeInputRef,maxLength:6,pattern:he,pasteTransformer:n,value:e.code,"aria-label":`Verification code`,"aria-invalid":!!e.error,onChange:r,children:(0,$.jsxs)(oe,{children:[(0,$.jsx)(me,{index:0}),(0,$.jsx)(me,{index:1}),(0,$.jsx)(me,{index:2}),(0,$.jsx)(me,{index:3}),(0,$.jsx)(me,{index:4}),(0,$.jsx)(me,{index:5})]})})})}function Tt(e){let t=(0,Z.c)(22),{form:n}=e,r;t[0]!==n.busy||t[1]!==n.code||t[2]!==n.email||t[3]!==n.step?(r=n.busy||(n.step===`email`?!n.email.trim():n.code.length!==6),t[0]=n.busy,t[1]=n.code,t[2]=n.email,t[3]=n.step,t[4]=r):r=t[4];let i=r,a;t[5]!==n.busy||t[6]!==n.onClose?(a=(0,$.jsx)(w,{type:`button`,variant:`outline`,disabled:n.busy,onClick:n.onClose,children:`Cancel`}),t[5]=n.busy,t[6]=n.onClose,t[7]=a):a=t[7];let o;t[8]!==n.busy||t[9]!==n.onBack||t[10]!==n.step?(o=n.step===`code`&&(0,$.jsx)(w,{type:`button`,variant:`ghost`,disabled:n.busy,onClick:n.onBack,children:`Back`}),t[8]=n.busy,t[9]=n.onBack,t[10]=n.step,t[11]=o):o=t[11];let s=n.busy,c;t[12]===n?c=t[13]:(c=Ct(n),t[12]=n,t[13]=c);let l;t[14]!==n.busy||t[15]!==i||t[16]!==c?(l=(0,$.jsx)(w,{type:`submit`,disabled:i,"aria-busy":s,children:c}),t[14]=n.busy,t[15]=i,t[16]=c,t[17]=l):l=t[17];let u;return t[18]!==a||t[19]!==o||t[20]!==l?(u=(0,$.jsxs)(X,{children:[a,o,l]}),t[18]=a,t[19]=o,t[20]=l,t[21]=u):u=t[21],u}function Et(e){let t=(0,Z.c)(11),{form:n}=e,r;t[0]===n?r=t[1]:(r=(0,$.jsx)(wt,{form:n}),t[0]=n,t[1]=r);let i;t[2]===n.error?i=t[3]:(i=n.error?(0,$.jsx)(`p`,{className:g(f.body,`text-destructive`),role:`alert`,children:n.error.message}):null,t[2]=n.error,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,$.jsx)(Tt,{form:n}),t[4]=n,t[5]=a);let o;return t[6]!==n.onSubmit||t[7]!==r||t[8]!==i||t[9]!==a?(o=(0,$.jsxs)(`form`,{onSubmit:n.onSubmit,className:`grid gap-4 py-2`,children:[r,i,a]}),t[6]=n.onSubmit,t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}function Dt(e){let t=(0,Z.c)(63),{machine:n,onClose:r}=e,[i,a]=(0,Q.useState)(`email`),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(``),d=(0,Q.useRef)(null),p=`api/account/remote-machines/${encodeURIComponent(n.id)}`,m;t[0]===p?m=t[1]:(m=async function(e){if(!(await A(`${p}/request-code`,{email:e})).success)throw Error(`Could not send the verification code. Try again.`)},t[0]=p,t[1]=m);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=function(e,t){c(t),u(``),a(`code`)},t[2]=h):h=t[2];let _;t[3]===m?_=t[4]:(_={mutationFn:m,onSuccess:h},t[3]=m,t[4]=_);let v=o(_),y;t[5]!==l||t[6]!==s||t[7]!==p?(y=async function(){if(!(await A(`${p}/verify`,{email:s,code:l})).success)throw Error(`That code didn't work. Try again.`)},t[5]=l,t[6]=s,t[7]=p,t[8]=y):y=t[8];let b,x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(){u(``),a(`success`)},x=function(){u(``)},t[9]=b,t[10]=x):(b=t[9],x=t[10]);let S;t[11]===y?S=t[12]:(S={mutationFn:y,onSuccess:b,onError:x},t[11]=y,t[12]=S);let C=o(S),T=v.isPending||C.isPending,E=i===`email`?v.error:C.error,D,O;t[13]===i?(D=t[14],O=t[15]):(D=function(){if(i!==`code`)return;d.current?.focus();let e=requestAnimationFrame(function(){d.current?.focus()});return function(){cancelAnimationFrame(e)}},O=[i],t[13]=i,t[14]=D,t[15]=O),(0,Q.useEffect)(D,O);let k;t[16]!==T||t[17]!==l||t[18]!==s||t[19]!==v||t[20]!==i||t[21]!==C?(k=function(e){if(e.preventDefault(),!T)if(i===`email`){let e=s.trim().toLowerCase();e&&v.mutate(e)}else i===`code`&&l.length===6&&C.mutate()},t[16]=T,t[17]=l,t[18]=s,t[19]=v,t[20]=i,t[21]=C,t[22]=k):k=t[22];let ee=k,j;t[23]!==v||t[24]!==C?(j=function(){a(`email`),u(``),v.reset(),C.reset()},t[23]=v,t[24]=C,t[25]=j):j=t[25];let M=j,N=i===`code`?`code`:`email`,P;t[26]!==M||t[27]!==T||t[28]!==l||t[29]!==s||t[30]!==E||t[31]!==ee||t[32]!==r||t[33]!==N?(P={step:N,email:s,code:l,busy:T,error:E,codeInputRef:d,setEmail:c,setCode:u,onSubmit:ee,onClose:r,onBack:M},t[26]=M,t[27]=T,t[28]=l,t[29]=s,t[30]=E,t[31]=ee,t[32]=r,t[33]=N,t[34]=P):P=t[34];let F=P,I;t[35]!==s||t[36]!==n.machineName||t[37]!==i?(I=St(i,s,n.machineName),t[35]=s,t[36]=n.machineName,t[37]=i,t[38]=I):I=t[38];let L=I,R;t[39]!==T||t[40]!==r?(R=function(e){!e&&!T&&r()},t[39]=T,t[40]=r,t[41]=R):R=t[41];let z;t[42]===L.title?z=t[43]:(z=(0,$.jsx)(ae,{children:L.title}),t[42]=L.title,t[43]=z);let B;t[44]===L.description?B=t[45]:(B=(0,$.jsx)(te,{children:L.description}),t[44]=L.description,t[45]=B);let V;t[46]!==z||t[47]!==B?(V=(0,$.jsxs)(K,{children:[z,B]}),t[46]=z,t[47]=B,t[48]=V):V=t[48];let H;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(H=g(f.compact,`break-all font-mono text-muted-foreground`),t[49]=H):H=t[49];let U;t[50]===n.publicUrl?U=t[51]:(U=(0,$.jsx)(`p`,{className:H,children:n.publicUrl}),t[50]=n.publicUrl,t[51]=U);let W;t[52]!==F||t[53]!==r||t[54]!==i?(W=i===`success`?(0,$.jsx)(X,{children:(0,$.jsx)(w,{onClick:r,children:`Done`})}):(0,$.jsx)(Et,{form:F}),t[52]=F,t[53]=r,t[54]=i,t[55]=W):W=t[55];let G;t[56]!==V||t[57]!==U||t[58]!==W?(G=(0,$.jsxs)(ge,{className:`max-w-md`,children:[V,U,W]}),t[56]=V,t[57]=U,t[58]=W,t[59]=G):G=t[59];let ne;return t[60]!==R||t[61]!==G?(ne=(0,$.jsx)(Y,{open:!0,onOpenChange:R,children:G}),t[60]=R,t[61]=G,t[62]=ne):ne=t[62],ne}function Ot(e){let t=(0,Z.c)(13),{label:n,disabled:r,onClick:i,className:a,children:o}=e,s;t[0]===a?s=t[1]:(s=g(`shrink-0`,a),t[0]=a,t[1]=s);let c;t[2]!==o||t[3]!==r||t[4]!==n||t[5]!==i||t[6]!==s?(c=(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(w,{type:`button`,variant:`ghost`,size:`icon-sm`,className:s,onClick:i,disabled:r,"aria-label":n,children:o})}),t[2]=o,t[3]=r,t[4]=n,t[5]=i,t[6]=s,t[7]=c):c=t[7];let l;t[8]===n?l=t[9]:(l=(0,$.jsx)(E,{children:n}),t[8]=n,t[9]=l);let u;return t[10]!==c||t[11]!==l?(u=(0,$.jsxs)(D,{children:[c,l]}),t[10]=c,t[11]=l,t[12]=u):u=t[12],u}function kt(e){let t=(0,Z.c)(41),{machine:n,draftName:r,disabled:i,onDraftNameChange:a,onDraftNameBlur:o,onRemove:s,onSignIn:c}=e,[l,u]=(0,Q.useState)(!1),d=(0,Q.useRef)(null),p,m;t[0]===l?(p=t[1],m=t[2]):(p=()=>{l&&(d.current?.focus(),d.current?.select())},m=[l],t[0]=l,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h;t[3]===o?h=t[4]:(h=function(){o(),u(!1)},t[3]=o,t[4]=h);let _=h,y;t[5]!==n.machineName||t[6]!==a?(y=function(){a(n.machineName),u(!1)},t[5]=n.machineName,t[6]=a,t[7]=y):y=t[7];let b=y,C;t[8]===n.publicUrl?C=t[9]:(C=function(e){e.preventDefault(),ee(n.publicUrl)},t[8]=n.publicUrl,t[9]=C);let O=C,k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(S,{className:`h-10 w-10 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),t[10]=k):k=t[10];let A;t[11]!==b||t[12]!==i||t[13]!==r||t[14]!==_||t[15]!==n.id||t[16]!==n.machineName||t[17]!==a||t[18]!==l?(A=(0,$.jsx)(`div`,{className:`flex min-w-0 items-center gap-1`,children:l?(0,$.jsx)(J,{ref:d,id:`remote-machine-name-${n.id}`,value:r,onChange:e=>{a(e.target.value)},onBlur:_,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.currentTarget.blur()),e.key===`Escape`&&(e.preventDefault(),b())},disabled:i,"aria-label":`Machine name`,className:`h-8 max-w-md`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:g(f.label,`min-w-0 truncate`),children:n.machineName}),(0,$.jsx)(Ot,{label:`Rename`,disabled:i,className:`pointer-events-none opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100`,onClick:()=>{u(!0)},children:(0,$.jsx)(v,{className:`h-4 w-4`})})]})}),t[11]=b,t[12]=i,t[13]=r,t[14]=_,t[15]=n.id,t[16]=n.machineName,t[17]=a,t[18]=l,t[19]=A):A=t[19];let j=n.publicUrl,M;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(M=g(f.compact,`mt-1 block truncate font-mono text-muted-foreground hover:underline`),t[20]=M):M=t[20];let N;t[21]!==n.publicUrl||t[22]!==O?(N=(0,$.jsx)(`a`,{href:j,onClick:O,className:M,children:n.publicUrl}),t[21]=n.publicUrl,t[22]=O,t[23]=N):N=t[23];let P;t[24]!==N||t[25]!==A?(P=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[A,N]}),t[24]=N,t[25]=A,t[26]=P):P=t[26];let F;t[27]!==i||t[28]!==c?(F=(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(w,{type:`button`,variant:`outline`,disabled:i,onClick:c,children:`Sign in`})}),t[27]=i,t[28]=c,t[29]=F):F=t[29];let I;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(E,{children:`Authorize cloning from this Remote Machine`}),t[30]=I):I=t[30];let L;t[31]===F?L=t[32]:(L=(0,$.jsxs)(D,{children:[F,I]}),t[31]=F,t[32]=L);let R;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(x,{className:`h-4 w-4`}),t[33]=R):R=t[33];let z;t[34]!==i||t[35]!==s?(z=(0,$.jsx)(Ot,{label:`Remove`,disabled:i,onClick:s,children:R}),t[34]=i,t[35]=s,t[36]=z):z=t[36];let B;return t[37]!==P||t[38]!==L||t[39]!==z?(B=(0,$.jsxs)(`div`,{className:`group flex items-center gap-4 rounded-lg border border-border/60 bg-background/40 p-4`,children:[k,P,L,z]}),t[37]=P,t[38]=L,t[39]=z,t[40]=B):B=t[40],B}function At({remoteMachines:e,draftNames:t,isLoading:n,isSavingId:r,onDraftNameChange:i,onDraftNameBlur:a,onRemoveMachine:o}){let[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,p]=(0,Q.useState)(null),[h,_]=(0,Q.useState)(!1);async function v(){if(l){_(!0),p(null);try{await o(l.id),u(null)}catch(e){p(e instanceof Error?e.message:`Could not remove that Remote Machine.`)}finally{_(!1)}}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:f.bodyMuted,children:m}),n?(0,$.jsx)(`p`,{className:f.bodyMuted,children:`Loading Remote Machines…`}):e.length===0?(0,$.jsx)(`p`,{className:f.bodyMuted,children:`No Remote Machines yet.`}):(0,$.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.map(e=>{let o=r(e.id);return(0,$.jsx)(kt,{machine:e,draftName:t[e.id]??e.machineName,disabled:n||o||h,onDraftNameChange:t=>{i(e.id,t)},onDraftNameBlur:()=>{a(e.id)},onSignIn:function(){c(e)},onRemove:()=>{p(null),u(e)}},e.id)})}),s?(0,$.jsx)(Dt,{machine:s,onClose:function(){c(null)}},s.id):null,(0,$.jsx)(H,{open:l!=null,onOpenChange:e=>{!e&&!h&&(u(null),p(null))},children:(0,$.jsxs)(L,{children:[(0,$.jsxs)(V,{children:[(0,$.jsx)(I,{children:`Remove Remote Machine?`}),(0,$.jsx)(F,{children:l?`Remove ${l.machineName} from this list? This only deletes the bookmark on this computer.`:null})]}),d?(0,$.jsx)(`p`,{className:g(f.bodyMuted,`text-destructive`),children:d}):null,(0,$.jsxs)(z,{children:[(0,$.jsx)(B,{disabled:h,children:`Cancel`}),(0,$.jsx)(R,{disabled:h,onClick:e=>{e.preventDefault(),v()},children:`Remove`})]})]})})]})}function jt(){let e=(0,Z.c)(65),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(!1),{session:a,isLoading:o}=c(),{isLoading:s,isSaving:l,needsRestart:u,serverBindMode:d,tunnelError:f,tunnelStatus:p,tunnelUrl:m,updateServerBindMode:h}=Be(),{draftMachineName:g,isLoading:v,isSaving:y,setDraftMachineName:b,saveDraftMachineName:x}=be(),{addMachine:S,draftNames:C,isLoading:O,isSavingId:k,remoteMachines:A,removeMachine:ee,saveDraftName:j,setDraftName:M}=we(),N;e[0]!==v||e[1]!==O||e[2]!==s?(N=[s,v,O],e[0]=v,e[1]=O,e[2]=s,e[3]=N):N=e[3];let P=ve(`remote-machines`,N),F;e[4]===m?F=e[5]:(F=async function(){if(m)try{await navigator.clipboard.writeText(m),i(!0),U({title:`Copied`,description:`Public address copied to clipboard.`}),window.setTimeout(function(){i(!1)},1500)}catch(e){let t=e;U({title:`Copy failed`,description:t instanceof Error?t.message:`Could not copy the address.`,variant:`destructive`})}},e[4]=m,e[5]=F);let I=F,L=!o&&a!==null,R=d===`network`,z;e[6]===h?z=e[7]:(z=e=>{h(e?`network`:`local`)},e[6]=h,e[7]=z);let B=s||l,V=!L,H;e[8]!==R||e[9]!==z||e[10]!==B||e[11]!==V?(H=(0,$.jsx)(le,{title:`Mobile & Network Access`,className:`[&>div:first-child]:py-2`,sticky:!1,action:(0,$.jsx)(se,{value:R,onChange:z,disabled:B,disableOn:V,ariaLabel:`Mobile & Network Access`})}),e[8]=R,e[9]=z,e[10]=B,e[11]=V,e[12]=H):H=e[12];let te=a?.email??null,G;e[13]===x?G=e[14]:(G=()=>{x()},e[13]=x,e[14]=G);let K;e[15]!==r||e[16]!==g||e[17]!==I||e[18]!==v||e[19]!==y||e[20]!==s||e[21]!==l||e[22]!==u||e[23]!==d||e[24]!==b||e[25]!==L||e[26]!==te||e[27]!==G||e[28]!==f||e[29]!==p||e[30]!==m?(K=(0,$.jsx)(_e,{className:`max-w-none pt-0`,children:(0,$.jsx)(re,{children:(0,$.jsx)(xt,{accountEmail:te,bindMode:d,signedIn:L,isLoading:s,isSaving:l,needsRestart:u,tunnelUrl:m,tunnelStatus:p,tunnelError:f,copiedTunnelUrl:r,localMachineName:g,isLocalMachineNameLoading:v,isLocalMachineNameSaving:y,onCopyTunnelUrl:I,onLocalMachineNameChange:b,onLocalMachineNameBlur:G})})}),e[15]=r,e[16]=g,e[17]=I,e[18]=v,e[19]=y,e[20]=s,e[21]=l,e[22]=u,e[23]=d,e[24]=b,e[25]=L,e[26]=te,e[27]=G,e[28]=f,e[29]=p,e[30]=m,e[31]=K):K=e[31];let q;e[32]!==H||e[33]!==K?(q=(0,$.jsxs)(ne,{className:`shrink-0`,children:[H,K]}),e[32]=H,e[33]=K,e[34]=q):q=e[34];let J;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>n(!0),e[35]=J):J=e[35];let ie;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(_,{className:`h-4 w-4`}),e[36]=ie):ie=e[36];let Y;e[37]===O?Y=e[38]:(Y=(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(w,{type:`button`,variant:`outline`,size:`icon`,className:`shrink-0`,onClick:J,disabled:O,"aria-label":`Add Machine`,children:ie})}),e[37]=O,e[38]=Y);let ae;e[39]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(E,{children:`Add Machine`}),e[39]=ae):ae=e[39];let X;e[40]===Y?X=e[41]:(X=(0,$.jsx)(le,{title:`Remote Machines`,className:`[&>div:first-child]:py-2`,sticky:!1,action:(0,$.jsxs)(D,{children:[Y,ae]})}),e[40]=Y,e[41]=X);let oe;e[42]!==C||e[43]!==O||e[44]!==k||e[45]!==A||e[46]!==ee||e[47]!==j||e[48]!==M?(oe=(0,$.jsx)(_e,{className:`max-w-none pt-0`,children:(0,$.jsx)(re,{children:(0,$.jsx)(At,{remoteMachines:A,draftNames:C,isLoading:O,isSavingId:k,onDraftNameChange:M,onDraftNameBlur:j,onRemoveMachine:ee})})}),e[42]=C,e[43]=O,e[44]=k,e[45]=A,e[46]=ee,e[47]=j,e[48]=M,e[49]=oe):oe=e[49];let ce;e[50]!==X||e[51]!==oe?(ce=(0,$.jsxs)(ne,{className:`shrink-0 pt-6`,children:[X,oe]}),e[50]=X,e[51]=oe,e[52]=ce):ce=e[52];let ue;e[53]!==q||e[54]!==ce?(ue=(0,$.jsxs)(`div`,{className:`divide-y divide-table-border [&>*]:rounded-none`,children:[q,ce]}),e[53]=q,e[54]=ce,e[55]=ue):ue=e[55];let de;e[56]===S?de=e[57]:(de=async function(e){await S(e)},e[56]=S,e[57]=de);let fe;e[58]!==t||e[59]!==de?(fe=(0,$.jsx)(Ve,{open:t,onOpenChange:n,onSave:de}),e[58]=t,e[59]=de,e[60]=fe):fe=e[60];let pe;return e[61]!==P||e[62]!==ue||e[63]!==fe?(pe=(0,$.jsxs)(W,{loading:P,children:[ue,fe]}),e[61]=P,e[62]=ue,e[63]=fe,e[64]=pe):pe=e[64],pe}export{jt as default};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{a as i,i as a,l as o,n as s,o as c,t as l}from"./use-account-settings-query-DVhIle0W.js";import{r as u}from"./query-keys-BX4RxqwI.js";import{b as d,fn as f,st as p,w as m,y as h}from"./dist-DQEC_JS0.js";import{t as g}from"./utils-DfZXN5fy.js";import{V as _,W as v,on as y,pt as b,r as x,tt as S,xn as C}from"./lucide-react-BFzs_X2U.js";import{t as w}from"./button-Djzr1B_4.js";import{i as T,n as E,t as D}from"./tooltip-CXREivps.js";import{Bi as O,N as k,ai as A,fr as j,in as M,n as N,nn as P,sa as F}from"./api-Cho1mlFq.js";import{a as I,c as L,i as R,n as z,o as B,r as V,s as H,t as U}from"./alert-dialog-CJ403H9_.js";import{t as W}from"./use-toast-xpb5jNtN.js";import{Br as ee,Ft as te,H as G,Hr as K,Ht as ne,Ir as q,Lr as J,Lt as re,Ot as ie,Rr as Y,Ur as ae,Vr as X,_r as oe,_t as se,gr as ce,jt as le,nr as ue,rr as de,s as fe,tr as pe,vr as me,yr as he,zr as ge,zt as _e}from"./index-BlkYPP7B.js";import{t as ve}from"./use-settings-page-loading-CpaBd260.js";var Z=t(),Q=e(n(),1),ye=p(`app.use-local-machine-name.hook`);function be(){let e=(0,Z.c)(12),{data:t,isLoading:n}=a(),r=i(),o=t?.machineName??``,[s,c]=(0,Q.useState)(``),l,u;e[0]===o?(l=e[1],u=e[2]):(l=function(){o&&c(o)},u=[o],e[0]=o,e[1]=l,e[2]=u),(0,Q.useEffect)(l,u);let d;e[3]!==s||e[4]!==o||e[5]!==r?(d=async function(){let e=s.trim();if(!e||e===o){c(o);return}try{c((await r.mutateAsync({machineName:e})).machineName)}catch(e){let t=e;throw ye.error(`Failed to update machine name:`,t),c(o),t}},e[3]=s,e[4]=o,e[5]=r,e[6]=d):d=e[6];let f=d,p;return e[7]!==s||e[8]!==n||e[9]!==f||e[10]!==r.isPending?(p={draftMachineName:s,isLoading:n,isSaving:r.isPending,setDraftMachineName:c,saveDraftMachineName:f},e[7]=s,e[8]=n,e[9]=f,e[10]=r.isPending,e[11]=p):p=e[11],p}var xe=p(`app.use-remote-machines.hook`);function Se(e){return[...e].sort(function(e,t){let n=e.machineName.localeCompare(t.machineName,void 0,{sensitivity:`base`});return n===0?e.publicUrl.localeCompare(t.publicUrl):n})}function Ce(e){let t={};for(let n of e)t[n.id]=n.machineName;return t}function we(){let[e,t]=(0,Q.useState)([]),[n,r]=(0,Q.useState)({}),[i,a]=(0,Q.useState)(!0),[o,s]=(0,Q.useState)(()=>new Set);(0,Q.useEffect)(()=>{let e=!1;async function n(){try{let n=await P();e||(t(n.remoteMachines),r(Ce(n.remoteMachines)))}catch(e){xe.error(`Failed to load remote machines:`,e)}finally{e||a(!1)}}return n(),()=>{e=!0}},[]);async function c(e){let n=(await N(e)).remoteMachine;return t(e=>Se([...e,n])),r(e=>({...e,[n.id]:n.machineName})),n}async function l(e){await k(e),t(t=>t.filter(t=>t.id!==e)),r(t=>{let n={...t};return delete n[e],n})}function u(e,t){r(n=>({...n,[e]:t}))}async function d(r){let i=e.find(e=>e.id===r),a=(n[r]??``).trim();if(i){if(!a||a===i.machineName){u(r,i.machineName);return}s(e=>new Set(e).add(r));try{let e=await j(r,a);t(t=>Se(t.map(t=>t.id===r?e.remoteMachine:t))),u(r,e.remoteMachine.machineName)}catch(e){throw xe.error(`Failed to update remote machine name:`,e),u(r,i.machineName),e}finally{s(e=>{let t=new Set(e);return t.delete(r),t})}}}function f(e){return o.has(e)}return{addMachine:c,draftNames:n,isLoading:i,isSavingId:f,remoteMachines:e,removeMachine:l,saveDraftName:d,setDraftName:u}}var Te=p(`app.use-server-bind-mode.hook`),Ee=`local`,De=`tarsk-server-bind-mode-changed`;function Oe(e){F(e)}function ke(){if(typeof window>`u`)return!1;try{return sessionStorage.getItem(De)===`true`}catch{return!1}}function Ae(e){if(!(typeof window>`u`))try{e?sessionStorage.setItem(De,`true`):sessionStorage.removeItem(De)}catch{}}function je(e){let t=(0,Z.c)(4),[n,r]=(0,Q.useState)(null),i,a;return t[0]!==n||t[1]!==e?(i=function(){e===void 0||n!==null||r(e)},a=[n,e],t[0]=n,t[1]=e,t[2]=i,t[3]=a):(i=t[2],a=t[3]),(0,Q.useEffect)(i,a),n}function Me(e,t){let n=(0,Z.c)(4),r,i;n[0]!==t||n[1]!==e?(r=function(){e===void 0||t===void 0||Oe({networkAddresses:t,serverBindMode:e})},i=[t,e],n[0]=t,n[1]=e,n[2]=r,n[3]=i):(r=n[2],i=n[3]),(0,Q.useEffect)(r,i)}function Ne(e,t){let{serverBindMode:n=Ee}=t??{},{serverBindMode:r=n}=e??{};return r}function Pe(e,t){let{networkAddresses:n=[]}=t??{},{networkAddresses:r=n}=e??{};return r}function Fe(e){let{tunnelUrl:t=null,tunnelStatus:n=`off`,tunnelError:r=null}=e??{};return{tunnelUrl:t,tunnelStatus:n,tunnelError:r}}function Ie(e,t,n,r){return{serverBindMode:Ne(e,t),networkAddresses:Pe(e,t),...Fe(e),isLoading:n||r&&t===null}}function Le(e){let t=(0,Z.c)(8),n=(0,Q.useSyncExternalStore)(ue,pe,Re),r=de(),i=r&&n,a,o;t[0]!==r||t[1]!==e?(a=function(){if(r)return G(function(t){t===`tunnel`&&s(e).catch(function(){})})},o=[r,e],t[0]=r,t[1]=e,t[2]=a,t[3]=o):(a=t[2],o=t[3]),(0,Q.useEffect)(a,o);let c,u;return t[4]!==e||t[5]!==i?(c=function(){if(i)return fe(function(t){if(!m(t.status))return;let n=t.status;e.getQueryData(l())?e.setQueryData(l(),function(e){return e&&{...e,tunnelError:t.error,tunnelStatus:n,tunnelUrl:t.url}}):s(e).catch(function(){})})},u=[e,i],t[4]=e,t[5]=i,t[6]=c,t[7]=u):(c=t[6],u=t[7]),(0,Q.useEffect)(c,u),i}function Re(){return!1}function ze(e,t,n,r){let i=(0,Z.c)(6),a,o;i[0]!==t||i[1]!==e||i[2]!==r||i[3]!==n?(a=function(){if(t||!n||r)return;let i=0,a=!1,o=setInterval(function(){if(i+=1,i>20){clearInterval(o);return}s(e).catch(function(){}).finally(function(){a&&clearInterval(o)})},2e3);return function(){a=!0,clearInterval(o)}},o=[t,e,r,n],i[0]=t,i[1]=e,i[2]=r,i[3]=n,i[4]=a,i[5]=o):(a=i[4],o=i[5]),(0,Q.useEffect)(a,o)}function Be(){let e=(0,Z.c)(17),t=u(),{isLoading:n}=c(),{data:r,isLoading:o}=a(),s=i(),[l,d]=(0,Q.useState)(ke),f;e[0]!==n||e[1]!==r||e[2]!==o?(f=Ie(r,O(),n,o),e[0]=n,e[1]=r,e[2]=o,e[3]=f):f=e[3];let p=f,m=r?.serverBindMode,h=je(m);Me(m,r?.networkAddresses);let g;e[4]===s?g=e[5]:(g=async function(e){try{let t=await s.mutateAsync({serverBindMode:e});Oe({networkAddresses:t.networkAddresses,serverBindMode:t.serverBindMode}),d(!0),Ae(!0)}catch(e){let t=e;throw Te.error(`Failed to update server bind mode:`,t),W({title:`Could not update network access`,description:t instanceof Error?t.message:`Could not update network access.`,variant:`destructive`}),t}},e[4]=s,e[5]=g);let _=g,v=h!==null&&p.serverBindMode!==h,y=v||l,b=p.serverBindMode===`network`&&(p.tunnelStatus===`starting`||p.tunnelStatus===`off`&&!y),x=Le(t);ze(t,p.isLoading,b,x);let S;return e[6]!==v||e[7]!==y||e[8]!==_||e[9]!==s.isPending||e[10]!==p.isLoading||e[11]!==p.networkAddresses||e[12]!==p.serverBindMode||e[13]!==p.tunnelError||e[14]!==p.tunnelStatus||e[15]!==p.tunnelUrl?(S={defaultServerBindMode:Ee,hasServerBindModeChanged:v,isLoading:p.isLoading,isSaving:s.isPending,needsRestart:y,networkAddresses:p.networkAddresses,serverBindMode:p.serverBindMode,tunnelError:p.tunnelError,tunnelStatus:p.tunnelStatus,tunnelUrl:p.tunnelUrl,updateServerBindMode:_},e[6]=v,e[7]=y,e[8]=_,e[9]=s.isPending,e[10]=p.isLoading,e[11]=p.networkAddresses,e[12]=p.serverBindMode,e[13]=p.tunnelError,e[14]=p.tunnelStatus,e[15]=p.tunnelUrl,e[16]=S):S=e[16],S}var $=r();function Ve({open:e,onOpenChange:t,onSave:n}){let[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1);function l(){i(``),o(null),c(!1)}function u(e){e||l(),t(e)}async function p(){let e=r.trim();if(!e){o(`Enter a Tarsk public address.`);return}c(!0),o(null);try{await n(e),u(!1)}catch(e){o(e instanceof Error?e.message:`Could not add that Remote Machine.`)}finally{c(!1)}}return(0,$.jsx)(Y,{open:e,onOpenChange:u,children:(0,$.jsxs)(ge,{className:`sm:max-w-md`,children:[(0,$.jsxs)(K,{children:[(0,$.jsx)(ae,{children:`Add Machine`}),(0,$.jsxs)(ee,{children:[`Enter the public id or full address for another Tarsk on `,d,`.`,` `,h]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(q,{htmlFor:`remote-machine-address`,children:`Public address`}),(0,$.jsx)(J,{id:`remote-machine-address`,value:r,onChange:e=>{i(e.target.value),o(null)},placeholder:`rsawt2ud3n`,disabled:s,"aria-invalid":a!=null,className:`font-mono`}),a?(0,$.jsx)(`p`,{className:f.bodyMuted,children:a}):null]}),(0,$.jsxs)(X,{children:[(0,$.jsx)(w,{type:`button`,variant:`outline`,onClick:()=>u(!1),disabled:s,children:`Cancel`}),(0,$.jsx)(w,{type:`button`,onClick:()=>{p()},disabled:s,children:s?(0,$.jsx)(b,{className:`h-4 w-4 animate-spin`}):`Save`})]})]})})}var He=Object.defineProperty,Ue=Object.getOwnPropertySymbols,We=Object.prototype.hasOwnProperty,Ge=Object.prototype.propertyIsEnumerable,Ke=(e,t,n)=>t in e?He(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qe=(e,t)=>{for(var n in t||={})We.call(t,n)&&Ke(e,n,t[n]);if(Ue)for(var n of Ue(t))Ge.call(t,n)&&Ke(e,n,t[n]);return e},Je=(e,t)=>{var n={};for(var r in e)We.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ue)for(var r of Ue(e))t.indexOf(r)<0&&Ge.call(e,r)&&(n[r]=e[r]);return n},Ye;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(Ye||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(Ye||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(Ye||={});var Xe=Ye,Ze={L:Xe.QrCode.Ecc.LOW,M:Xe.QrCode.Ecc.MEDIUM,Q:Xe.QrCode.Ecc.QUARTILE,H:Xe.QrCode.Ecc.HIGH},Qe=128,$e=`L`,et=`#FFFFFF`,tt=`#000000`,nt=!1,rt=1,it=4,at=0,ot=.1;function st(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function ct(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function lt(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*ot),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function ut(e,t){return t==null?e?it:at:Math.max(Math.floor(t),0)}function dt({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=Q.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...Xe.QrSegment.makeSegments(t)),e),[]);return Xe.QrCode.encodeSegments(r,Ze[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=Q.useMemo(()=>{let e=c.getModules(),t=ut(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:lt(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var ft=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),pt=Q.forwardRef(function(e,t){let n=e,{value:r,size:i=Qe,level:a=$e,bgColor:o=et,fgColor:s=tt,includeMargin:c=nt,minVersion:l=rt,boostLevel:u,marginSize:d,imageSettings:f}=n,p=Je(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=Je(p,[`style`]),g=f?.src,_=Q.useRef(null),v=Q.useRef(null),y=Q.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=Q.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=dt({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});Q.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=C,r=v.current,a=T!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&T.excavation!=null&&(n=ct(C,T.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/w*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,w,w),t.fillStyle=s,ft?t.fill(new Path2D(st(n,S))):C.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+S,n+S,1,1)})}),T&&(t.globalAlpha=T.opacity),a&&t.drawImage(r,T.x+S,T.y+S,T.w,T.h)}}),Q.useEffect(()=>{x(!1)},[g]);let E=qe({height:i,width:i},m),D=null;return g!=null&&(D=Q.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),Q.createElement(Q.Fragment,null,Q.createElement(`canvas`,qe({style:E,height:i,width:i,ref:y,role:`img`},h)),D)});pt.displayName=`QRCodeCanvas`;var mt=Q.forwardRef(function(e,t){let n=e,{value:r,size:i=Qe,level:a=$e,bgColor:o=et,fgColor:s=tt,includeMargin:c=nt,minVersion:l=rt,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=Je(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=dt({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),y=g,b=null;p!=null&&v!=null&&(v.excavation!=null&&(y=ct(g,v.excavation)),b=Q.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let x=st(y,h);return Q.createElement(`svg`,qe({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&Q.createElement(`title`,null,d),Q.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),Q.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});mt.displayName=`QRCodeSVG`;function ht(e){let t=(0,Z.c)(8),{inputId:n,value:r,disabled:i,onChange:a,onBlur:o}=e,s=n===void 0?`machine-name`:n,c;t[0]===a?c=t[1]:(c=e=>{a(e.target.value)},t[0]=a,t[1]=c);let l;return t[2]!==i||t[3]!==s||t[4]!==o||t[5]!==c||t[6]!==r?(l=(0,$.jsx)(ie,{title:`Machine name`,controlLayout:`row-end`,className:`mt-3`,action:(0,$.jsx)(J,{id:s,value:r,onChange:c,onBlur:o,disabled:i,"aria-label":`Machine name`,className:`w-64 font-mono`})}),t[2]=i,t[3]=s,t[4]=o,t[5]=c,t[6]=r,t[7]=l):l=t[7],l}function gt(e){let t=(0,Z.c)(15),{copied:n,label:r,onCopy:i}=e,a;t[0]===i?a=t[1]:(a=function(){i()},t[0]=i,t[1]=a);let o=a,s;t[2]===n?s=t[3]:(s=n?(0,$.jsx)(C,{className:`h-3.5 w-3.5 text-green-500`}):(0,$.jsx)(y,{className:`h-3.5 w-3.5`}),t[2]=n,t[3]=s);let c;t[4]===r?c=t[5]:(c=(0,$.jsx)(`span`,{className:`sr-only`,children:r}),t[4]=r,t[5]=c);let l;t[6]!==o||t[7]!==s||t[8]!==c?(l=(0,$.jsx)(T,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,onClick:o,className:`inline-flex h-7 w-7 align-middle items-center justify-center rounded-md border border-border bg-background/90 text-foreground shadow-sm transition-colors hover:bg-background`,children:[s,c]})}),t[6]=o,t[7]=s,t[8]=c,t[9]=l):l=t[9];let u=n?`Copied!`:`Copy to clipboard`,d;t[10]===u?d=t[11]:(d=(0,$.jsx)(E,{children:u}),t[10]=u,t[11]=d);let f;return t[12]!==l||t[13]!==d?(f=(0,$.jsxs)(D,{children:[l,d]}),t[12]=l,t[13]=d,t[14]=f):f=t[14],f}function _t(e){let t=(0,Z.c)(18),{email:n,url:r,copied:i,onCopy:a}=e,o=n??`your account`,s;t[0]===o?s=t[1]:(s=(0,$.jsxs)(`p`,{className:f.bodyMuted,children:[`You can access this machine by signing in as `,o,` to:`]}),t[0]=o,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,$.jsx)(`span`,{className:`${f.mono} break-all`,children:r}),t[2]=r,t[3]=c);let l;t[4]!==i||t[5]!==a?(l=(0,$.jsx)(gt,{copied:i,label:`Copy public address`,onCopy:a}),t[4]=i,t[5]=a,t[6]=l):l=t[6];let u;t[7]!==c||t[8]!==l?(u=(0,$.jsxs)(`p`,{className:f.bodyMuted,children:[c,` `,l,` in a browser or in the Tarsk mobile app by scanning this QR Code`]}),t[7]=c,t[8]=l,t[9]=u):u=t[9];let d;t[10]!==s||t[11]!==u?(d=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12];let p;t[13]===r?p=t[14]:(p=(0,$.jsx)(`div`,{className:`w-fit rounded-lg bg-background p-3`,children:(0,$.jsx)(mt,{value:r,size:128,bgColor:`hsl(var(--background))`,fgColor:`hsl(var(--foreground))`,level:`M`})}),t[13]=r,t[14]=p);let m;return t[15]!==d||t[16]!==p?(m=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[d,p]}),t[15]=d,t[16]=p,t[17]=m):m=t[17],m}function vt(e){let t=(0,Z.c)(14),{accountEmail:n,bindMode:r,tunnelUrl:i,tunnelStatus:a,tunnelError:o,copiedTunnelUrl:s,onCopyTunnelUrl:c}=e,l=r===`network`,u=l&&!i&&a===`starting`,d=l&&a===`error`&&!!o,p;t[0]!==n||t[1]!==s||t[2]!==c||t[3]!==i?(p=i?(0,$.jsx)(_t,{email:n,url:i,copied:s,onCopy:c}):null,t[0]=n,t[1]=s,t[2]=c,t[3]=i,t[4]=p):p=t[4];let m;t[5]===u?m=t[6]:(m=u?(0,$.jsx)(`p`,{className:f.bodyMuted,children:`Starting a public address…`}):null,t[5]=u,t[6]=m);let h;t[7]!==d||t[8]!==o?(h=d?(0,$.jsx)(`p`,{className:f.bodyMuted,children:o}):null,t[7]=d,t[8]=o,t[9]=h):h=t[9];let g;return t[10]!==p||t[11]!==m||t[12]!==h?(g=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2`,children:[p,m,h]}),t[10]=p,t[11]=m,t[12]=h,t[13]=g):g=t[13],g}function yt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`p`,{className:`${f.bodyMuted} mt-3`,children:`Log in before turning this on.`}),e[0]=t):t=e[0],t}function bt(e){let t=(0,Z.c)(2),{bindMode:n,tunnelUrl:r}=e,i=n===`network`&&!r?` The public address appears after restart.`:``,a;return t[0]===i?a=t[1]:(a=(0,$.jsxs)(`p`,{className:`${f.bodyMuted} mt-3`,children:[`You will need to restart for this setting to take effect.`,i]}),t[0]=i,t[1]=a),a}function xt(e){let t=(0,Z.c)(25),{accountEmail:n,bindMode:r,signedIn:i,isLoading:a,isSaving:o,needsRestart:s,tunnelUrl:c,tunnelStatus:l,tunnelError:u,copiedTunnelUrl:d,localMachineName:f,isLocalMachineNameLoading:p,isLocalMachineNameSaving:m,onCopyTunnelUrl:h,onLocalMachineNameChange:g,onLocalMachineNameBlur:_}=e,v=!!(c||l===`starting`||u),y=!i&&r!==`network`,b;t[0]!==n||t[1]!==r||t[2]!==d||t[3]!==h||t[4]!==v||t[5]!==u||t[6]!==l||t[7]!==c?(b=v?(0,$.jsx)(vt,{accountEmail:n,bindMode:r,tunnelUrl:c,tunnelStatus:l,tunnelError:u,copiedTunnelUrl:d,onCopyTunnelUrl:h}):null,t[0]=n,t[1]=r,t[2]=d,t[3]=h,t[4]=v,t[5]=u,t[6]=l,t[7]=c,t[8]=b):b=t[8];let x;t[9]===y?x=t[10]:(x=y?(0,$.jsx)(yt,{}):null,t[9]=y,t[10]=x);let S;t[11]!==r||t[12]!==s||t[13]!==c?(S=s?(0,$.jsx)(bt,{bindMode:r,tunnelUrl:c}):null,t[11]=r,t[12]=s,t[13]=c,t[14]=S):S=t[14];let C=a||o||p||m,w;t[15]!==f||t[16]!==_||t[17]!==g||t[18]!==C?(w=(0,$.jsx)(ht,{inputId:`local-machine-name`,value:f,disabled:C,onChange:g,onBlur:_}),t[15]=f,t[16]=_,t[17]=g,t[18]=C,t[19]=w):w=t[19];let T;return t[20]!==b||t[21]!==x||t[22]!==S||t[23]!==w?(T=(0,$.jsxs)($.Fragment,{children:[b,x,S,w]}),t[20]=b,t[21]=x,t[22]=S,t[23]=w,t[24]=T):T=t[24],T}function St(e,t,n){switch(e){case`success`:return{title:`Signed in`,description:`This computer is now authorized to clone from ${n}.`};case`code`:return{title:`Check your email`,description:`We sent a 6-digit code to ${t}.`};default:return{title:`Sign in to Remote Machine`,description:`Sign in to ${n} to authorize remote cloning. Saving a bookmark does not grant access.`}}}function Ct(e){return e.step===`email`?e.busy?`Sending…`:`Next`:e.busy?`Verifying…`:`Sign in`}function wt({form:e}){if(e.step===`email`)return(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(q,{htmlFor:`remote-machine-email`,children:`Email`}),(0,$.jsx)(J,{id:`remote-machine-email`,type:`email`,autoComplete:`email`,required:!0,value:e.email,disabled:e.busy,onChange:function(t){e.setEmail(t.target.value)}})]});function t(t){t.preventDefault(),e.codeInputRef.current?.focus()}function n(e){return e.replace(/\\D/g,``)}function r(t){e.busy||e.setCode(t)}return(0,$.jsx)(`div`,{className:`flex justify-center py-2`,onMouseDown:t,children:(0,$.jsx)(ce,{ref:e.codeInputRef,maxLength:6,pattern:he,pasteTransformer:n,value:e.code,"aria-label":`Verification code`,"aria-invalid":!!e.error,onChange:r,children:(0,$.jsxs)(oe,{children:[(0,$.jsx)(me,{index:0}),(0,$.jsx)(me,{index:1}),(0,$.jsx)(me,{index:2}),(0,$.jsx)(me,{index:3}),(0,$.jsx)(me,{index:4}),(0,$.jsx)(me,{index:5})]})})})}function Tt(e){let t=(0,Z.c)(22),{form:n}=e,r;t[0]!==n.busy||t[1]!==n.code||t[2]!==n.email||t[3]!==n.step?(r=n.busy||(n.step===`email`?!n.email.trim():n.code.length!==6),t[0]=n.busy,t[1]=n.code,t[2]=n.email,t[3]=n.step,t[4]=r):r=t[4];let i=r,a;t[5]!==n.busy||t[6]!==n.onClose?(a=(0,$.jsx)(w,{type:`button`,variant:`outline`,disabled:n.busy,onClick:n.onClose,children:`Cancel`}),t[5]=n.busy,t[6]=n.onClose,t[7]=a):a=t[7];let o;t[8]!==n.busy||t[9]!==n.onBack||t[10]!==n.step?(o=n.step===`code`&&(0,$.jsx)(w,{type:`button`,variant:`ghost`,disabled:n.busy,onClick:n.onBack,children:`Back`}),t[8]=n.busy,t[9]=n.onBack,t[10]=n.step,t[11]=o):o=t[11];let s=n.busy,c;t[12]===n?c=t[13]:(c=Ct(n),t[12]=n,t[13]=c);let l;t[14]!==n.busy||t[15]!==i||t[16]!==c?(l=(0,$.jsx)(w,{type:`submit`,disabled:i,"aria-busy":s,children:c}),t[14]=n.busy,t[15]=i,t[16]=c,t[17]=l):l=t[17];let u;return t[18]!==a||t[19]!==o||t[20]!==l?(u=(0,$.jsxs)(X,{children:[a,o,l]}),t[18]=a,t[19]=o,t[20]=l,t[21]=u):u=t[21],u}function Et(e){let t=(0,Z.c)(11),{form:n}=e,r;t[0]===n?r=t[1]:(r=(0,$.jsx)(wt,{form:n}),t[0]=n,t[1]=r);let i;t[2]===n.error?i=t[3]:(i=n.error?(0,$.jsx)(`p`,{className:g(f.body,`text-destructive`),role:`alert`,children:n.error.message}):null,t[2]=n.error,t[3]=i);let a;t[4]===n?a=t[5]:(a=(0,$.jsx)(Tt,{form:n}),t[4]=n,t[5]=a);let o;return t[6]!==n.onSubmit||t[7]!==r||t[8]!==i||t[9]!==a?(o=(0,$.jsxs)(`form`,{onSubmit:n.onSubmit,className:`grid gap-4 py-2`,children:[r,i,a]}),t[6]=n.onSubmit,t[7]=r,t[8]=i,t[9]=a,t[10]=o):o=t[10],o}function Dt(e){let t=(0,Z.c)(63),{machine:n,onClose:r}=e,[i,a]=(0,Q.useState)(`email`),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(``),d=(0,Q.useRef)(null),p=`api/account/remote-machines/${encodeURIComponent(n.id)}`,m;t[0]===p?m=t[1]:(m=async function(e){if(!(await A(`${p}/request-code`,{email:e})).success)throw Error(`Could not send the verification code. Try again.`)},t[0]=p,t[1]=m);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h=function(e,t){c(t),u(``),a(`code`)},t[2]=h):h=t[2];let _;t[3]===m?_=t[4]:(_={mutationFn:m,onSuccess:h},t[3]=m,t[4]=_);let v=o(_),y;t[5]!==l||t[6]!==s||t[7]!==p?(y=async function(){if(!(await A(`${p}/verify`,{email:s,code:l})).success)throw Error(`That code didn't work. Try again.`)},t[5]=l,t[6]=s,t[7]=p,t[8]=y):y=t[8];let b,x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(){u(``),a(`success`)},x=function(){u(``)},t[9]=b,t[10]=x):(b=t[9],x=t[10]);let S;t[11]===y?S=t[12]:(S={mutationFn:y,onSuccess:b,onError:x},t[11]=y,t[12]=S);let C=o(S),T=v.isPending||C.isPending,E=i===`email`?v.error:C.error,D,O;t[13]===i?(D=t[14],O=t[15]):(D=function(){if(i!==`code`)return;d.current?.focus();let e=requestAnimationFrame(function(){d.current?.focus()});return function(){cancelAnimationFrame(e)}},O=[i],t[13]=i,t[14]=D,t[15]=O),(0,Q.useEffect)(D,O);let k;t[16]!==T||t[17]!==l||t[18]!==s||t[19]!==v||t[20]!==i||t[21]!==C?(k=function(e){if(e.preventDefault(),!T)if(i===`email`){let e=s.trim().toLowerCase();e&&v.mutate(e)}else i===`code`&&l.length===6&&C.mutate()},t[16]=T,t[17]=l,t[18]=s,t[19]=v,t[20]=i,t[21]=C,t[22]=k):k=t[22];let j=k,M;t[23]!==v||t[24]!==C?(M=function(){a(`email`),u(``),v.reset(),C.reset()},t[23]=v,t[24]=C,t[25]=M):M=t[25];let N=M,P=i===`code`?`code`:`email`,F;t[26]!==N||t[27]!==T||t[28]!==l||t[29]!==s||t[30]!==E||t[31]!==j||t[32]!==r||t[33]!==P?(F={step:P,email:s,code:l,busy:T,error:E,codeInputRef:d,setEmail:c,setCode:u,onSubmit:j,onClose:r,onBack:N},t[26]=N,t[27]=T,t[28]=l,t[29]=s,t[30]=E,t[31]=j,t[32]=r,t[33]=P,t[34]=F):F=t[34];let I=F,L;t[35]!==s||t[36]!==n.machineName||t[37]!==i?(L=St(i,s,n.machineName),t[35]=s,t[36]=n.machineName,t[37]=i,t[38]=L):L=t[38];let R=L,z;t[39]!==T||t[40]!==r?(z=function(e){!e&&!T&&r()},t[39]=T,t[40]=r,t[41]=z):z=t[41];let B;t[42]===R.title?B=t[43]:(B=(0,$.jsx)(ae,{children:R.title}),t[42]=R.title,t[43]=B);let V;t[44]===R.description?V=t[45]:(V=(0,$.jsx)(ee,{children:R.description}),t[44]=R.description,t[45]=V);let H;t[46]!==B||t[47]!==V?(H=(0,$.jsxs)(K,{children:[B,V]}),t[46]=B,t[47]=V,t[48]=H):H=t[48];let U;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(U=g(f.compact,`break-all font-mono text-muted-foreground`),t[49]=U):U=t[49];let W;t[50]===n.publicUrl?W=t[51]:(W=(0,$.jsx)(`p`,{className:U,children:n.publicUrl}),t[50]=n.publicUrl,t[51]=W);let te;t[52]!==I||t[53]!==r||t[54]!==i?(te=i===`success`?(0,$.jsx)(X,{children:(0,$.jsx)(w,{onClick:r,children:`Done`})}):(0,$.jsx)(Et,{form:I}),t[52]=I,t[53]=r,t[54]=i,t[55]=te):te=t[55];let G;t[56]!==H||t[57]!==W||t[58]!==te?(G=(0,$.jsxs)(ge,{className:`max-w-md`,children:[H,W,te]}),t[56]=H,t[57]=W,t[58]=te,t[59]=G):G=t[59];let ne;return t[60]!==z||t[61]!==G?(ne=(0,$.jsx)(Y,{open:!0,onOpenChange:z,children:G}),t[60]=z,t[61]=G,t[62]=ne):ne=t[62],ne}function Ot(e){let t=(0,Z.c)(13),{label:n,disabled:r,onClick:i,className:a,children:o}=e,s;t[0]===a?s=t[1]:(s=g(`shrink-0`,a),t[0]=a,t[1]=s);let c;t[2]!==o||t[3]!==r||t[4]!==n||t[5]!==i||t[6]!==s?(c=(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(w,{type:`button`,variant:`ghost`,size:`icon-sm`,className:s,onClick:i,disabled:r,"aria-label":n,children:o})}),t[2]=o,t[3]=r,t[4]=n,t[5]=i,t[6]=s,t[7]=c):c=t[7];let l;t[8]===n?l=t[9]:(l=(0,$.jsx)(E,{children:n}),t[8]=n,t[9]=l);let u;return t[10]!==c||t[11]!==l?(u=(0,$.jsxs)(D,{children:[c,l]}),t[10]=c,t[11]=l,t[12]=u):u=t[12],u}function kt(e){let t=(0,Z.c)(41),{machine:n,draftName:r,disabled:i,onDraftNameChange:a,onDraftNameBlur:o,onRemove:s,onSignIn:c}=e,[l,u]=(0,Q.useState)(!1),d=(0,Q.useRef)(null),p,m;t[0]===l?(p=t[1],m=t[2]):(p=()=>{l&&(d.current?.focus(),d.current?.select())},m=[l],t[0]=l,t[1]=p,t[2]=m),(0,Q.useEffect)(p,m);let h;t[3]===o?h=t[4]:(h=function(){o(),u(!1)},t[3]=o,t[4]=h);let _=h,y;t[5]!==n.machineName||t[6]!==a?(y=function(){a(n.machineName),u(!1)},t[5]=n.machineName,t[6]=a,t[7]=y):y=t[7];let b=y,C;t[8]===n.publicUrl?C=t[9]:(C=function(e){e.preventDefault(),M(n.publicUrl)},t[8]=n.publicUrl,t[9]=C);let O=C,k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(S,{className:`h-10 w-10 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),t[10]=k):k=t[10];let A;t[11]!==b||t[12]!==i||t[13]!==r||t[14]!==_||t[15]!==n.id||t[16]!==n.machineName||t[17]!==a||t[18]!==l?(A=(0,$.jsx)(`div`,{className:`flex min-w-0 items-center gap-1`,children:l?(0,$.jsx)(J,{ref:d,id:`remote-machine-name-${n.id}`,value:r,onChange:e=>{a(e.target.value)},onBlur:_,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),e.currentTarget.blur()),e.key===`Escape`&&(e.preventDefault(),b())},disabled:i,"aria-label":`Machine name`,className:`h-8 max-w-md`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:g(f.label,`min-w-0 truncate`),children:n.machineName}),(0,$.jsx)(Ot,{label:`Rename`,disabled:i,className:`pointer-events-none opacity-0 transition-opacity group-hover:pointer-events-auto group-hover:opacity-100 focus-visible:pointer-events-auto focus-visible:opacity-100`,onClick:()=>{u(!0)},children:(0,$.jsx)(v,{className:`h-4 w-4`})})]})}),t[11]=b,t[12]=i,t[13]=r,t[14]=_,t[15]=n.id,t[16]=n.machineName,t[17]=a,t[18]=l,t[19]=A):A=t[19];let j=n.publicUrl,N;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(N=g(f.compact,`mt-1 block truncate font-mono text-muted-foreground hover:underline`),t[20]=N):N=t[20];let P;t[21]!==n.publicUrl||t[22]!==O?(P=(0,$.jsx)(`a`,{href:j,onClick:O,className:N,children:n.publicUrl}),t[21]=n.publicUrl,t[22]=O,t[23]=P):P=t[23];let F;t[24]!==P||t[25]!==A?(F=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[A,P]}),t[24]=P,t[25]=A,t[26]=F):F=t[26];let I;t[27]!==i||t[28]!==c?(I=(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(w,{type:`button`,variant:`outline`,disabled:i,onClick:c,children:`Sign in`})}),t[27]=i,t[28]=c,t[29]=I):I=t[29];let L;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(E,{children:`Authorize cloning from this Remote Machine`}),t[30]=L):L=t[30];let R;t[31]===I?R=t[32]:(R=(0,$.jsxs)(D,{children:[I,L]}),t[31]=I,t[32]=R);let z;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(x,{className:`h-4 w-4`}),t[33]=z):z=t[33];let B;t[34]!==i||t[35]!==s?(B=(0,$.jsx)(Ot,{label:`Remove`,disabled:i,onClick:s,children:z}),t[34]=i,t[35]=s,t[36]=B):B=t[36];let V;return t[37]!==F||t[38]!==R||t[39]!==B?(V=(0,$.jsxs)(`div`,{className:`group flex items-center gap-4 rounded-lg border border-border/60 bg-background/40 p-4`,children:[k,F,R,B]}),t[37]=F,t[38]=R,t[39]=B,t[40]=V):V=t[40],V}function At({remoteMachines:e,draftNames:t,isLoading:n,isSavingId:r,onDraftNameChange:i,onDraftNameBlur:a,onRemoveMachine:o}){let[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(null),[d,p]=(0,Q.useState)(null),[m,_]=(0,Q.useState)(!1);async function v(){if(l){_(!0),p(null);try{await o(l.id),u(null)}catch(e){p(e instanceof Error?e.message:`Could not remove that Remote Machine.`)}finally{_(!1)}}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:f.bodyMuted,children:h}),n?(0,$.jsx)(`p`,{className:f.bodyMuted,children:`Loading Remote Machines…`}):e.length===0?(0,$.jsx)(`p`,{className:f.bodyMuted,children:`No Remote Machines yet.`}):(0,$.jsx)(`div`,{className:`flex flex-col gap-3`,children:e.map(e=>{let o=r(e.id);return(0,$.jsx)(kt,{machine:e,draftName:t[e.id]??e.machineName,disabled:n||o||m,onDraftNameChange:t=>{i(e.id,t)},onDraftNameBlur:()=>{a(e.id)},onSignIn:function(){c(e)},onRemove:()=>{p(null),u(e)}},e.id)})}),s?(0,$.jsx)(Dt,{machine:s,onClose:function(){c(null)}},s.id):null,(0,$.jsx)(U,{open:l!=null,onOpenChange:e=>{!e&&!m&&(u(null),p(null))},children:(0,$.jsxs)(R,{children:[(0,$.jsxs)(H,{children:[(0,$.jsx)(L,{children:`Remove Remote Machine?`}),(0,$.jsx)(I,{children:l?`Remove ${l.machineName} from this list? This only deletes the bookmark on this computer.`:null})]}),d?(0,$.jsx)(`p`,{className:g(f.bodyMuted,`text-destructive`),children:d}):null,(0,$.jsxs)(B,{children:[(0,$.jsx)(V,{disabled:m,children:`Cancel`}),(0,$.jsx)(z,{disabled:m,onClick:e=>{e.preventDefault(),v()},children:`Remove`})]})]})})]})}function jt(){let e=(0,Z.c)(65),[t,n]=(0,Q.useState)(!1),[r,i]=(0,Q.useState)(!1),{session:a,isLoading:o}=c(),{isLoading:s,isSaving:l,needsRestart:u,serverBindMode:d,tunnelError:f,tunnelStatus:p,tunnelUrl:m,updateServerBindMode:h}=Be(),{draftMachineName:g,isLoading:v,isSaving:y,setDraftMachineName:b,saveDraftMachineName:x}=be(),{addMachine:S,draftNames:C,isLoading:O,isSavingId:k,remoteMachines:A,removeMachine:j,saveDraftName:M,setDraftName:N}=we(),P;e[0]!==v||e[1]!==O||e[2]!==s?(P=[s,v,O],e[0]=v,e[1]=O,e[2]=s,e[3]=P):P=e[3];let F=ve(`remote-machines`,P),I;e[4]===m?I=e[5]:(I=async function(){if(m)try{await navigator.clipboard.writeText(m),i(!0),W({title:`Copied`,description:`Public address copied to clipboard.`}),window.setTimeout(function(){i(!1)},1500)}catch(e){let t=e;W({title:`Copy failed`,description:t instanceof Error?t.message:`Could not copy the address.`,variant:`destructive`})}},e[4]=m,e[5]=I);let L=I,R=!o&&a!==null,z=d===`network`,B;e[6]===h?B=e[7]:(B=e=>{h(e?`network`:`local`)},e[6]=h,e[7]=B);let V=s||l,H=!R,U;e[8]!==z||e[9]!==B||e[10]!==V||e[11]!==H?(U=(0,$.jsx)(le,{title:`Mobile & Network Access`,className:`[&>div:first-child]:py-2`,sticky:!1,action:(0,$.jsx)(se,{value:z,onChange:B,disabled:V,disableOn:H,ariaLabel:`Mobile & Network Access`})}),e[8]=z,e[9]=B,e[10]=V,e[11]=H,e[12]=U):U=e[12];let ee=a?.email??null,G;e[13]===x?G=e[14]:(G=()=>{x()},e[13]=x,e[14]=G);let K;e[15]!==r||e[16]!==g||e[17]!==L||e[18]!==v||e[19]!==y||e[20]!==s||e[21]!==l||e[22]!==u||e[23]!==d||e[24]!==b||e[25]!==R||e[26]!==ee||e[27]!==G||e[28]!==f||e[29]!==p||e[30]!==m?(K=(0,$.jsx)(_e,{className:`max-w-none pt-0`,children:(0,$.jsx)(re,{children:(0,$.jsx)(xt,{accountEmail:ee,bindMode:d,signedIn:R,isLoading:s,isSaving:l,needsRestart:u,tunnelUrl:m,tunnelStatus:p,tunnelError:f,copiedTunnelUrl:r,localMachineName:g,isLocalMachineNameLoading:v,isLocalMachineNameSaving:y,onCopyTunnelUrl:L,onLocalMachineNameChange:b,onLocalMachineNameBlur:G})})}),e[15]=r,e[16]=g,e[17]=L,e[18]=v,e[19]=y,e[20]=s,e[21]=l,e[22]=u,e[23]=d,e[24]=b,e[25]=R,e[26]=ee,e[27]=G,e[28]=f,e[29]=p,e[30]=m,e[31]=K):K=e[31];let q;e[32]!==U||e[33]!==K?(q=(0,$.jsxs)(ne,{className:`shrink-0`,children:[U,K]}),e[32]=U,e[33]=K,e[34]=q):q=e[34];let J;e[35]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>n(!0),e[35]=J):J=e[35];let ie;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,$.jsx)(_,{className:`h-4 w-4`}),e[36]=ie):ie=e[36];let Y;e[37]===O?Y=e[38]:(Y=(0,$.jsx)(T,{asChild:!0,children:(0,$.jsx)(w,{type:`button`,variant:`outline`,size:`icon`,className:`shrink-0`,onClick:J,disabled:O,"aria-label":`Add Machine`,children:ie})}),e[37]=O,e[38]=Y);let ae;e[39]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,$.jsx)(E,{children:`Add Machine`}),e[39]=ae):ae=e[39];let X;e[40]===Y?X=e[41]:(X=(0,$.jsx)(le,{title:`Remote Machines`,className:`[&>div:first-child]:py-2`,sticky:!1,action:(0,$.jsxs)(D,{children:[Y,ae]})}),e[40]=Y,e[41]=X);let oe;e[42]!==C||e[43]!==O||e[44]!==k||e[45]!==A||e[46]!==j||e[47]!==M||e[48]!==N?(oe=(0,$.jsx)(_e,{className:`max-w-none pt-0`,children:(0,$.jsx)(re,{children:(0,$.jsx)(At,{remoteMachines:A,draftNames:C,isLoading:O,isSavingId:k,onDraftNameChange:N,onDraftNameBlur:M,onRemoveMachine:j})})}),e[42]=C,e[43]=O,e[44]=k,e[45]=A,e[46]=j,e[47]=M,e[48]=N,e[49]=oe):oe=e[49];let ce;e[50]!==X||e[51]!==oe?(ce=(0,$.jsxs)(ne,{className:`shrink-0 pt-6`,children:[X,oe]}),e[50]=X,e[51]=oe,e[52]=ce):ce=e[52];let ue;e[53]!==q||e[54]!==ce?(ue=(0,$.jsxs)(`div`,{className:`divide-y divide-table-border [&>*]:rounded-none`,children:[q,ce]}),e[53]=q,e[54]=ce,e[55]=ue):ue=e[55];let de;e[56]===S?de=e[57]:(de=async function(e){await S(e)},e[56]=S,e[57]=de);let fe;e[58]!==t||e[59]!==de?(fe=(0,$.jsx)(Ve,{open:t,onOpenChange:n,onSave:de}),e[58]=t,e[59]=de,e[60]=fe):fe=e[60];let pe;return e[61]!==F||e[62]!==ue||e[63]!==fe?(pe=(0,$.jsxs)(te,{loading:F,children:[ue,fe]}),e[61]=F,e[62]=ue,e[63]=fe,e[64]=pe):pe=e[64],pe}export{jt as default};
|
package/dist/public/assets/{settings-setup-view-iBGLRzYS.js → settings-setup-view-CrYnDkWP.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-coding-view-
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,r,t as i}from"./react-vendor-Ee0-5T4I.js";import{o as a,s as o}from"./chunk-QFMPRPBF-COsSkB7x.js";import{
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/project-coding-view-DO5x6ijQ.js","assets/rolldown-runtime-aKtaBQYM.js","assets/index-BlkYPP7B.js","assets/react-vendor-Ee0-5T4I.js","assets/progress-indicator-Dr2oM_0d.js","assets/utils-DfZXN5fy.js","assets/dist-DQEC_JS0.js","assets/alert-dialog-CJ403H9_.js","assets/button-Djzr1B_4.js","assets/use-browser-overlay-block-DyprQSIG.js","assets/browser-overlay-block-CiDtkfup.js","assets/dist-67Q0Rzil.js","assets/dist-DwfbSihk.js","assets/es2015-BDTYd1CN.js","assets/scroll-area-BTSuUr9o.js","assets/dist-OixawqbU.js","assets/tooltip-CXREivps.js","assets/dist-BGhGR6wN.js","assets/use-toast-xpb5jNtN.js","assets/chat-dock-context-C-oyjLpB.js","assets/api-Cho1mlFq.js","assets/store-D151firE.js","assets/explorer-tab-context-BxUVwWQQ.js","assets/main-tab-context-CNgxXqnH.js","assets/terminal-output-activity-B1bjjsl7.js","assets/use-account-settings-query-DVhIle0W.js","assets/query-keys-BX4RxqwI.js","assets/useBaseQuery-C4OJ4Bcm.js","assets/useQuery-CxnaBfkX.js","assets/create-project-workspace-BXawjzKi.js","assets/suspense-resource-DzlMlIgR.js","assets/dist-D3LcCYeO.js","assets/dist-BnsVdica.js","assets/dist-DkiU4lhK.js","assets/dist-CRbBwZ5Q.js","assets/dist-CSssbxDI.js","assets/lucide-react-BFzs_X2U.js","assets/chunk-QFMPRPBF-COsSkB7x.js","assets/index-BPQfGy4n.css","assets/commit-method-fields-Cp9zzEl4.js","assets/toggle-group-D3YTdr2u.js","assets/use-settings-page-loading-CpaBd260.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,r,t as i}from"./react-vendor-Ee0-5T4I.js";import{o as a,s as o}from"./chunk-QFMPRPBF-COsSkB7x.js";import{Ft as s,Pt as c}from"./dist-DQEC_JS0.js";import{$ as l,n as u,r as d}from"./store-D151firE.js";import{t as f}from"./progress-indicator-Dr2oM_0d.js";import{Ht as p,U as m,jt as h,zt as g}from"./index-BlkYPP7B.js";import{t as _}from"./settings-tab-bar-BCv1dBl8.js";var v=e(n(),1),y=t(),b=i();function x(e){let t=(0,y.c)(9),{projectId:n}=e,r=u(),i;t[0]===n?i=t[1]:(i=function(e){return e.projects.find(e=>e.projectId===n)?.commands??[]},t[0]=n,t[1]=i);let a=d(i),o;t[2]===r?o=t[3]:(o=function(){r({type:l.ConfigUpdated})},t[2]=r,t[3]=o);let s=o,c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,b.jsx)(h,{title:`Project Commands`,description:`Create and manage reusable commands for this project.`}),t[4]=c):c=t[4];let f;return t[5]!==a||t[6]!==s||t[7]!==n?(f=(0,b.jsx)(p,{className:`shrink-0`,children:(0,b.jsxs)(g,{children:[c,(0,b.jsx)(m,{embedded:!0,open:!0,projectId:n,commands:a,onRefresh:s})]})}),t[5]=a,t[6]=s,t[7]=n,t[8]=f):f=t[8],f}var S=(0,v.lazy)(function(){return r(()=>import(`./project-coding-view-DO5x6ijQ.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41]))});function C(e){let t=(0,y.c)(22),{projectId:n,onProjectUpdated:r}=e,i=a(),l=o(),u;t[0]===i.pathname?u=t[1]:(u=s(i.pathname)??`setup`,t[0]=i.pathname,t[1]=u);let d=u,p;t[2]!==l||t[3]!==n?(p=function(e){l(e===`setup`?`/settings/project/${n}/coding`:`/settings/project/${n}/coding/${e}`)},t[2]=l,t[3]=n,t[4]=p):p=t[4];let m=p,h;t[5]!==d||t[6]!==m?(h=(0,b.jsx)(_,{value:d,onValueChange:m,options:c}),t[5]=d,t[6]=m,t[7]=h):h=t[7];let g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,b.jsx)(f,{centered:!0,label:`Loading project setup...`}),t[8]=g):g=t[8];let C;t[9]!==d||t[10]!==r||t[11]!==n?(C=d===`setup`&&(0,b.jsx)(S,{projectId:n,onProjectUpdated:r}),t[9]=d,t[10]=r,t[11]=n,t[12]=C):C=t[12];let w;t[13]!==d||t[14]!==n?(w=d===`commands`&&(0,b.jsx)(x,{projectId:n}),t[13]=d,t[14]=n,t[15]=w):w=t[15];let T;t[16]!==C||t[17]!==w?(T=(0,b.jsx)(`div`,{className:`min-h-0 flex-1`,role:`region`,"aria-label":`Project setup`,children:(0,b.jsxs)(v.Suspense,{fallback:g,children:[C,w]})}),t[16]=C,t[17]=w,t[18]=T):T=t[18];let E;return t[19]!==h||t[20]!==T?(E=(0,b.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[h,T]}),t[19]=h,t[20]=T,t[21]=E):E=t[21],E}export{C as default};
|
package/dist/public/assets/{settings-skills-view-DDHClBVo.js → settings-skills-view-Cky2XWQ3.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{
|
|
2
|
-
`)}function ot(e,t,n){return it(e,t).filter(e=>!n.has(rt(e.id)))}function st(e){return e.endsWith(`.md`)||e.endsWith(`.mdx`)}function ct(e){return e.includes(`SKILL.md`)?`SKILL.md`:e[0]??`SKILL.md`}function lt(e,t){let n=e?.sourceId??t;if(!(!n||n==="default"))return n}function ut(e,t,n){let[r,i]=(0,X.useState)([]),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(null),h=lt(t,n),g=!!h;return(0,X.useEffect)(()=>{if(!e||!t)return;let r=t,a=lt(r,n),s=!1;async function l(){u(!0),m(null),i([]),o(null),c(``);try{if(a){let e=await te(a,r.id);if(s)return;i(e.files),o(ct(e.files))}else{if(s)return;i([`SKILL.md`]),o(`SKILL.md`),c(at(r))}}catch(e){if(s)return;m(e instanceof Error?e.message:`Failed to load skill files`)}finally{s||u(!1)}}return l(),()=>{s=!0}},[e,t,n]),(0,X.useEffect)(()=>{if(!e||!t||!a||!g||!h)return;let n=t,r=a,i=!1;async function o(){f(!0),m(null);try{let e=await re(h,n.id,r);if(i)return;c(e.content)}catch(e){if(i)return;m(e instanceof Error?e.message:`Failed to load file`),c(``)}finally{i||f(!1)}}return o(),()=>{i=!0}},[e,t,a,g,h]),{files:r,selectedFile:a,setSelectedFile:o,fileContent:s,loadingFiles:l,contentLoading:l||g&&d,loadError:p,isCatalogSkill:g,effectiveSourceId:h}}function dt({open:e,onOpenChange:t,skill:n,catalogSourceId:r,onInstall:i}){let[a,s]=(0,X.useState)(!1),{files:c,selectedFile:d,setSelectedFile:f,fileContent:p,loadingFiles:m,contentLoading:h,loadError:g,effectiveSourceId:_}=ut(e,n,r),v=(0,X.useCallback)(async()=>{if(!n)return;let e=_?{...n,sourceId:_}:n;s(!0);try{await i(e),t(!1)}finally{s(!1)}},[n,_,i,t]),y=d?st(d):!1,b=(0,X.useMemo)(()=>c.map(e=>(0,Z.jsxs)(Le,{selected:e===d,onClick:()=>f(e),className:`gap-2 cursor-pointer`,children:[(0,Z.jsx)(u,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:l(o.caption,`truncate`),children:e})]},e)),[c,d]);return(0,Z.jsx)(U,{open:e,onOpenChange:t,children:(0,Z.jsxs)(J,{className:`flex max-h-[90vh] max-w-5xl flex-col gap-0 overflow-hidden p-0`,children:[(0,Z.jsxs)(B,{className:`border-b border-border px-6 py-4`,children:[(0,Z.jsx)(W,{children:n?.name??`Review skill`}),n?.description?(0,Z.jsx)(z,{children:n.description}):null]}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,Z.jsxs)(`div`,{className:`flex max-h-40 shrink-0 flex-col border-b border-border sm:max-h-none sm:w-56 sm:border-b-0 sm:border-r`,children:[(0,Z.jsx)(`div`,{className:l(o.labelMuted,`px-3 py-2`),children:`Files`}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-1 pb-2`,children:m?(0,Z.jsx)(L,{centered:!0,containerClassName:`py-8`,label:`Loading files...`}):c.length===0?(0,Z.jsx)(`p`,{className:l(o.caption,`px-3 py-2 text-muted-foreground`),children:`No files found.`}):b})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-4`,children:g?(0,Z.jsx)(`p`,{className:l(o.body,`text-destructive`),children:g}):h?(0,Z.jsx)(L,{centered:!0,containerClassName:`py-12`,label:`Loading preview...`}):y?(0,Z.jsx)(De,{content:p,enableMermaid:!1}):(0,Z.jsx)(`pre`,{className:l(o.caption,`overflow-x-auto whitespace-pre-wrap font-mono`),children:p})})]}),(0,Z.jsxs)(G,{className:`border-t border-border px-6 py-4 sm:justify-between`,children:[(0,Z.jsx)(x,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Z.jsx)(x,{type:`button`,onClick:()=>void v(),disabled:a||!n,children:a?`Installing...`:`Install`})]})]})})}function ft({open:e,onOpenChange:t,editingSource:n,onSourceAdded:r,onSourceUpdated:i,onSourceDeleted:a}){let[s,c]=(0,X.useState)(``),[u,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(null),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(!1),[v,b]=(0,X.useState)(!1),S=n!=null;function C(){c(``),d(``),p(null),h(!1),_(!1),b(!1)}function w(e){e||C(),t(e)}(0,X.useEffect)(()=>{if(e){if(n){c(n.title),d(n.url),p(null);return}c(``),d(``),p(null)}},[e,n]);async function T(){let e=s.trim(),t=u.trim();if(!e||!t){p(`Title and URL are required.`);return}h(!0),p(null);try{if(S&&n){let r=await A(n.id,e,t);i?.(r.source)}else r((await k(e,t)).source);w(!1)}catch(e){p(e instanceof Error?e.message:`Failed to verify skill source`)}finally{h(!1)}}async function E(){if(n){_(!0),p(null);try{await ie(n.id),a?.(n.id),b(!1),w(!1)}catch(e){p(e instanceof Error?e.message:`Failed to delete skill source`),b(!1)}finally{_(!1)}}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(U,{open:e,onOpenChange:w,children:(0,Z.jsxs)(J,{className:`sm:max-w-lg`,children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(W,{children:S?`Edit Skill Source`:`Add Skill Source`}),(0,Z.jsx)(z,{children:S?`Update the title or GitHub skills folder URL for this custom source.`:`Add a GitHub skills folder URL. The source is verified by loading at least one skill from the repository.`})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 py-2`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Z.jsx)(V,{htmlFor:`skill-source-title`,children:`Title`}),(0,Z.jsx)(H,{id:`skill-source-title`,placeholder:`e.g. My Team Skills`,value:s,onChange:e=>c(e.target.value),disabled:m||g,autoFocus:!0})]}),(0,Z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Z.jsx)(V,{htmlFor:`skill-source-url`,children:`URL`}),(0,Z.jsx)(H,{id:`skill-source-url`,placeholder:`https://github.com/org/repo or .../tree/main/skills`,value:u,onChange:e=>d(e.target.value),disabled:m||g})]}),f?(0,Z.jsx)(`p`,{className:l(o.caption,`text-destructive`),children:f}):null]}),(0,Z.jsxs)(G,{className:`flex-col-reverse gap-2 sm:flex-row sm:justify-between`,children:[S?(0,Z.jsx)(x,{type:`button`,variant:`destructive`,onClick:()=>b(!0),disabled:m||g,children:`Delete`}):(0,Z.jsx)(`div`,{className:`hidden sm:block`}),(0,Z.jsxs)(`div`,{className:`flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row`,children:[(0,Z.jsx)(x,{variant:`outline`,onClick:()=>w(!1),disabled:m||g,children:`Cancel`}),(0,Z.jsx)(x,{onClick:()=>void T(),disabled:m||g||!s.trim()||!u.trim(),children:m?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(y,{className:`mr-2 h-4 w-4 animate-spin`}),`Verifying...`]}):S?`Save Changes`:`Add Source`})]})]})]})}),(0,Z.jsx)(ve,{open:v,onOpenChange:b,children:(0,Z.jsxs)(pe,{children:[(0,Z.jsxs)(_e,{children:[(0,Z.jsx)(fe,{children:`Delete Skill Source`}),(0,Z.jsxs)(de,{children:[`Are you sure you want to delete "`,n?.title,`"? This removes the source from your list but does not uninstall skills you already added.`]})]}),(0,Z.jsxs)(he,{children:[(0,Z.jsx)(ge,{disabled:g,children:`Cancel`}),(0,Z.jsx)(me,{onClick:()=>void E(),disabled:g,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:g?`Deleting...`:`Delete`})]})]})})]})}function pt(e){let t=e.trim();if(!t)return null;if(/^https?:\/\//i.test(t))try{return new URL(t),t}catch{return null}if(t.startsWith(`tarsk://`))try{let e=new URL(`https://tarsk.invalid/${t.slice(8)}`);if(e.pathname===`/skill-install`&&e.searchParams.get(`url`))return e.searchParams.get(`url`)}catch{return null}return null}function mt(e){let t=(0,Y.c)(40),{open:n,onOpenChange:r,onSubmit:i}=e,[a,s]=(0,X.useState)(``),[c,u]=(0,X.useState)(null),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=function(){s(``),u(null)},t[0]=d):d=t[0];let f=d,p;t[1]===r?p=t[2]:(p=function(e){e||f(),r(e)},t[1]=r,t[2]=p);let m=p,h,g;t[3]===n?(h=t[4],g=t[5]):(h=()=>{n&&f()},g=[n],t[3]=n,t[4]=h,t[5]=g),(0,X.useEffect)(h,g);let _;t[6]!==m||t[7]!==i||t[8]!==a?(_=function(){let e=pt(a);if(!e){u(`Enter a valid http(s) URL for the plugin archive or paste a tarsk:// install link.`);return}i(e),m(!1)},t[6]=m,t[7]=i,t[8]=a,t[9]=_):_=t[9];let v=_,y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(B,{children:[(0,Z.jsx)(W,{children:`Add Skill via URL`}),(0,Z.jsx)(z,{children:`Paste the URL of a plugin archive. Its skills and MCP servers are installed into this project.`})]}),t[10]=y):y=t[10];let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(V,{htmlFor:`add-skill-url`,children:`URL`}),t[11]=b):b=t[11];let S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>s(e.target.value),t[12]=S):S=t[12];let C;t[13]===v?C=t[14]:(C=e=>{e.key===`Enter`&&(e.preventDefault(),v())},t[13]=v,t[14]=C);let w;t[15]!==C||t[16]!==a?(w=(0,Z.jsx)(H,{id:`add-skill-url`,placeholder:`https://example.com/my-plugin.zip`,value:a,onChange:S,autoFocus:!0,onKeyDown:C}),t[15]=C,t[16]=a,t[17]=w):w=t[17];let T;t[18]===c?T=t[19]:(T=c?(0,Z.jsx)(`p`,{className:l(o.caption,`text-destructive`),children:c}):null,t[18]=c,t[19]=T);let E;t[20]!==w||t[21]!==T?(E=(0,Z.jsx)(`div`,{className:`grid gap-4 py-2`,children:(0,Z.jsxs)(`div`,{className:`grid gap-2`,children:[b,w,T]})}),t[20]=w,t[21]=T,t[22]=E):E=t[22];let D;t[23]===m?D=t[24]:(D=(0,Z.jsx)(x,{variant:`outline`,onClick:()=>m(!1),children:`Cancel`}),t[23]=m,t[24]=D);let O;t[25]===a?O=t[26]:(O=a.trim(),t[25]=a,t[26]=O);let k=!O,A;t[27]!==v||t[28]!==k?(A=(0,Z.jsx)(x,{onClick:v,disabled:k,children:`Continue`}),t[27]=v,t[28]=k,t[29]=A):A=t[29];let j;t[30]!==D||t[31]!==A?(j=(0,Z.jsxs)(G,{children:[D,A]}),t[30]=D,t[31]=A,t[32]=j):j=t[32];let M;t[33]!==E||t[34]!==j?(M=(0,Z.jsxs)(J,{className:`sm:max-w-lg`,children:[y,E,j]}),t[33]=E,t[34]=j,t[35]=M):M=t[35];let N;return t[36]!==m||t[37]!==n||t[38]!==M?(N=(0,Z.jsx)(U,{open:n,onOpenChange:m,children:M}),t[36]=m,t[37]=n,t[38]=M,t[39]=N):N=t[39],N}function ht(e){let t=(0,Y.c)(7),{items:n,onPreview:r}=e,i;if(t[0]!==n||t[1]!==r){let e;t[3]===r?e=t[4]:(e=e=>{let t=Ye(e.name);return(0,Z.jsxs)(`div`,{className:`group flex min-h-13 items-center gap-3 px-3 py-2`,role:`button`,tabIndex:0,onClick:()=>r(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),r(e))},children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:l(o.label,`truncate`),children:t}),(0,Z.jsx)(`p`,{className:l(o.caption,`truncate`),children:e.description})]}),(0,Z.jsx)(w,{delayDuration:300,children:(0,Z.jsxs)(T,{children:[(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsx)(x,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`shrink-0 opacity-0 pointer-events-none can-hover:group-hover:opacity-100 can-hover:group-hover:pointer-events-auto`,"aria-label":`Install ${t}`,onClick:t=>{t.stopPropagation(),r(e)},children:(0,Z.jsx)(b,{className:`h-4 w-4`})})}),(0,Z.jsx)(C,{children:`Install skill`})]})})]},e.id)},t[3]=r,t[4]=e),i=n.map(e),t[0]=n,t[1]=r,t[2]=i}else i=t[2];let a;return t[5]===i?a=t[6]:(a=(0,Z.jsx)(`div`,{className:`divide-y divide-table-border`,children:i}),t[5]=i,t[6]=a),a}function gt(e){let t=(0,Y.c)(11),{searchQuery:n,isLoadingCatalog:r,isDefaultSource:i,availablePopular:a,availableCatalog:o,onPreviewPopular:s,onPreviewCatalog:c}=e;if(r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(L,{centered:!0,containerClassName:`py-12`,label:`Loading skills...`}),t[0]=e):e=t[0],e}if(i){if(a.length===0){let e;return t[1]===n?e=t[2]:(e=(0,Z.jsx)(He,{searchQuery:n,emptyLabel:`No available skills found.`}),t[1]=n,t[2]=e),e}let e;return t[3]!==a||t[4]!==s?(e=(0,Z.jsx)(ht,{items:a,onPreview:s}),t[3]=a,t[4]=s,t[5]=e):e=t[5],e}if(o.length===0){let e;return t[6]===n?e=t[7]:(e=(0,Z.jsx)(He,{searchQuery:n,emptyLabel:`No available skills found.`}),t[6]=n,t[7]=e),e}let l;return t[8]!==o||t[9]!==c?(l=(0,Z.jsx)(ht,{items:o,onPreview:c}),t[8]=o,t[9]=c,t[10]=l):l=t[10],l}function _t(e){return e?{ariaLabel:`Edit skill source`,tooltip:`Edit this custom skill source`,icon:h}:{ariaLabel:`Add skill source`,tooltip:`Add a custom skill source`,icon:m}}function vt(e){let t=(0,Y.c)(42),{availableSearch:n,onSearchChange:r,selectedSourceId:i,onSourceChange:a,sources:o,selectedCustomSource:s,availableCatalogLoading:c,isDefaultSource:l,availablePopular:u,availableCatalog:d,onPreviewPopular:f,onPreviewCatalog:p,onAddSource:m}=e,h;t[0]===s?h=t[1]:(h=_t(s),t[0]=s,t[1]=h);let g=h,_=g.icon,v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(w,{children:(0,Z.jsxs)(T,{children:[(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsx)(`span`,{className:`cursor-help`,children:`Available Skills`})}),(0,Z.jsx)(C,{children:`Browse and install skills from the catalog.`})]})}),t[2]=v):v=t[2];let y;t[3]!==n||t[4]!==r?(y=(0,Z.jsx)(Ue,{placeholder:`Search`,value:n,onChange:r,className:`mb-0 w-64`}),t[3]=n,t[4]=r,t[5]=y):y=t[5];let b;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Re,{className:`w-40`,"aria-label":`Skill source`,children:(0,Z.jsx)(Ee,{placeholder:`Default`})}),t[6]=b):b=t[6];let E;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(we,{value:`default`,children:`Default`}),t[7]=E):E=t[7];let D;t[8]===o?D=t[9]:(D=o.map(yt),t[8]=o,t[9]=D);let O;t[10]===D?O=t[11]:(O=(0,Z.jsxs)(Pe,{children:[E,D]}),t[10]=D,t[11]=O);let k;t[12]!==a||t[13]!==i||t[14]!==O?(k=(0,Z.jsxs)(je,{value:i,onValueChange:a,children:[b,O]}),t[12]=a,t[13]=i,t[14]=O,t[15]=k):k=t[15];let A;t[16]===_?A=t[17]:(A=(0,Z.jsx)(_,{className:`h-4 w-4`}),t[16]=_,t[17]=A);let j;t[18]!==m||t[19]!==g.ariaLabel||t[20]!==A?(j=(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsx)(x,{type:`button`,variant:`outline`,size:`icon`,className:`shrink-0`,onClick:m,"aria-label":g.ariaLabel,children:A})}),t[18]=m,t[19]=g.ariaLabel,t[20]=A,t[21]=j):j=t[21];let M;t[22]===g.tooltip?M=t[23]:(M=(0,Z.jsx)(C,{children:g.tooltip}),t[22]=g.tooltip,t[23]=M);let N;t[24]!==j||t[25]!==M?(N=(0,Z.jsx)(w,{children:(0,Z.jsxs)(T,{children:[j,M]})}),t[24]=j,t[25]=M,t[26]=N):N=t[26];let P;t[27]!==N||t[28]!==y||t[29]!==k?(P=(0,Z.jsx)(K,{title:v,action:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,k,N]}),sticky:!1}),t[27]=N,t[28]=y,t[29]=k,t[30]=P):P=t[30];let F;t[31]!==d||t[32]!==c||t[33]!==u||t[34]!==n||t[35]!==l||t[36]!==p||t[37]!==f?(F=(0,Z.jsx)(ze,{className:`pt-6`,children:(0,Z.jsx)(gt,{searchQuery:n,isLoadingCatalog:c,isDefaultSource:l,availablePopular:u,availableCatalog:d,onPreviewPopular:f,onPreviewCatalog:p})}),t[31]=d,t[32]=c,t[33]=u,t[34]=n,t[35]=l,t[36]=p,t[37]=f,t[38]=F):F=t[38];let I;return t[39]!==P||t[40]!==F?(I=(0,Z.jsxs)(Te,{className:`shrink-0`,children:[P,F]}),t[39]=P,t[40]=F,t[41]=I):I=t[41],I}function yt(e){return(0,Z.jsx)(we,{value:e.id,children:e.title},e.id)}var bt=`https://tarsk.io/skills/list/`;function xt(e){let t=(0,Y.c)(20),{onSelectMode:n,manualDisabled:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Se,{asChild:!0,children:(0,Z.jsxs)(x,{className:`gap-1`,children:[`Add Skill`,(0,Z.jsx)(v,{className:`h-4 w-4 opacity-70`})]})}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=l(o.body,`gap-2`),t[1]=a):a=t[1];let s;t[2]===n?s=t[3]:(s=()=>n(`manual`),t[2]=n,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(d,{className:`h-4 w-4 shrink-0`}),t[4]=c):c=t[4];let u;t[5]!==r||t[6]!==s?(u=(0,Z.jsxs)(q,{className:a,disabled:r,onSelect:s,children:[c,`Manually Enter`]}),t[5]=r,t[6]=s,t[7]=u):u=t[7];let p;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=l(o.body,`gap-2`),t[8]=p):p=t[8];let m;t[9]===n?m=t[10]:(m=()=>n(`url`),t[9]=n,t[10]=m);let h;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(g,{className:`h-4 w-4 shrink-0`}),t[11]=h):h=t[11];let _;t[12]===m?_=t[13]:(_=(0,Z.jsxs)(q,{className:p,onSelect:m,children:[h,`Via URL`]}),t[12]=m,t[13]=_);let y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(Ie,{}),t[14]=y):y=t[14];let b;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=l(o.body,`gap-2`),t[15]=b):b=t[15];let S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsxs)(q,{className:b,onSelect:St,children:[(0,Z.jsx)(f,{className:`h-4 w-4 shrink-0`}),`Marketplace`]}),t[16]=S):S=t[16];let C;return t[17]!==u||t[18]!==_?(C=(0,Z.jsxs)(xe,{children:[i,(0,Z.jsxs)(Oe,{align:`end`,className:`w-44`,children:[u,_,y,S]})]}),t[17]=u,t[18]=_,t[19]=C):C=t[19],C}function St(){ne(bt)}var Ct=`This skill uses no additional context as it is manually invoked`;function wt(e){return e.builtIn?`text-muted-foreground/50`:e.disableModelInvocation?`text-brand`:`text-foreground`}function Tt(e){return e.disableModelInvocation?Ct:`≈${i(e.description)} tokens of context`}function Et(e){let t=(0,Y.c)(22),n,r,i,a,o,s;if(t[0]!==e){let{onClick:c,ariaLabel:u,...d}=e,f=(0,Z.jsx)(p,{className:l(`h-4 w-4 shrink-0`,wt(d)),"aria-hidden":`true`});i=w,s=300,r=T,t[7]!==u||t[8]!==f||t[9]!==c?(o=(0,Z.jsx)(S,{asChild:!0,children:c?(0,Z.jsx)(`button`,{type:`button`,"aria-label":u,className:`shrink-0 cursor-pointer rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:e=>{e.stopPropagation(),c()},onKeyDown:Dt,children:f}):f}),t[7]=u,t[8]=f,t[9]=c,t[10]=o):o=t[10],n=C,a=Tt(d),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6];let c;t[11]!==n||t[12]!==a?(c=(0,Z.jsx)(n,{children:a}),t[11]=n,t[12]=a,t[13]=c):c=t[13];let u;t[14]!==r||t[15]!==o||t[16]!==c?(u=(0,Z.jsxs)(r,{children:[o,c]}),t[14]=r,t[15]=o,t[16]=c,t[17]=u):u=t[17];let d;return t[18]!==i||t[19]!==s||t[20]!==u?(d=(0,Z.jsx)(i,{delayDuration:s,children:u}),t[18]=i,t[19]=s,t[20]=u,t[21]=d):d=t[21],d}function Dt(e){(e.key===`Enter`||e.key===` `)&&e.stopPropagation()}function Ot(e){let t=[];for(let n of e){if(n.path===`.agents/skills`&&n.type===`folder`&&n.children)for(let e of n.children)e.type===`folder`&&t.push(e);n.children&&n.children.length>0&&t.push(...Ot(n.children))}return t}function kt(e){return`${e.disableModelInvocation?`Enable`:`Disable`} model invocation for ${e.name}`}function At(e){return e?{title:`MCP server installed`,description:`Its MCP servers were added to this project.`}:{title:`Plugin installed`,description:`Its skills and MCP servers were added to this project.`}}function jt(e){return e?.disableModelInvocation?{title:`Enable model invocation?`,description:`"${e.name}" will be offered to the model automatically again, so its description counts towards the context window.`,actionLabel:`Enable`,nextDisableModelInvocation:!1}:{title:`Disable model invocation?`,description:`"${e?.name}" will no longer be offered to the model automatically, so its description stops counting towards the context window. Invoke it manually with /${e?.name}.`,actionLabel:`Disable`,nextDisableModelInvocation:!0}}function Mt(e){let t=(0,Y.c)(24),{skills:n,threadId:r,onOpenSkill:i,onDelete:a,onAddManual:s,onAddUrl:c,onChangeModelInvocation:u}=e,d=!r,f;t[0]!==s||t[1]!==c?(f=e=>{e===`manual`?s():c()},t[0]=s,t[1]=c,t[2]=f):f=t[2];let p;t[3]!==d||t[4]!==f?(p=(0,Z.jsx)(K,{title:`Installed Skills`,description:`Reusable instruction sets that guide agent behavior in this project.`,action:(0,Z.jsx)(xt,{manualDisabled:d,onSelectMode:f}),sticky:!1}),t[3]=d,t[4]=f,t[5]=p):p=t[5];let m;t[6]===r?m=t[7]:(m=!r&&(0,Z.jsx)(ye,{children:`Select a thread to add or install skills.`}),t[6]=r,t[7]=m);let h;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(h={icon:_,title:`No skills installed`,description:`Add skills to extend agent capabilities with reusable instructions.`},t[8]=h):h=t[8];let g;t[9]===u?g=t[10]:(g=e=>(0,Z.jsxs)(`span`,{className:l(o.body,`flex min-w-0 items-center gap-2 text-left`),children:[(0,Z.jsx)(Et,{description:e.description,disableModelInvocation:e.disableModelInvocation,builtIn:e.virtual,onClick:e.virtual?void 0:()=>u(e),ariaLabel:kt(e)}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.name})]}),t[9]=u,t[10]=g);let v;t[11]===i?v=t[12]:(v=e=>i(e.path),t[11]=i,t[12]=v);let y;t[13]!==a||t[14]!==n||t[15]!==g||t[16]!==v?(y=(0,Z.jsx)(We,{showHeader:!1,compact:!0,loading:!1,items:n,emptyState:h,getKey:Ft,renderContent:g,onItemClick:v,itemClickLabel:Pt,onDelete:a,deleteAriaLabel:Nt,deleteTooltip:`Remove this skill from the project`}),t[13]=a,t[14]=n,t[15]=g,t[16]=v,t[17]=y):y=t[17];let b;t[18]!==m||t[19]!==y?(b=(0,Z.jsxs)(ze,{className:`pt-6`,children:[m,y]}),t[18]=m,t[19]=y,t[20]=b):b=t[20];let x;return t[21]!==p||t[22]!==b?(x=(0,Z.jsxs)(Te,{className:`shrink-0`,children:[p,b]}),t[21]=p,t[22]=b,t[23]=x):x=t[23],x}function Nt(e){return`Delete ${e.name}`}function Pt(e){return`Open ${e.name} in Files`}function Ft(e){return e.id}function It(e){let t=(0,Y.c)(24),{open:n,onOpenChange:r,skill:i,onConfirm:a}=e,o;t[0]===i?o=t[1]:(o=jt(i),t[0]=i,t[1]=o);let s=o,c;t[2]===s.title?c=t[3]:(c=(0,Z.jsx)(fe,{children:s.title}),t[2]=s.title,t[3]=c);let l;t[4]===s.description?l=t[5]:(l=(0,Z.jsx)(de,{children:s.description}),t[4]=s.description,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Z.jsxs)(_e,{children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(ge,{children:`Cancel`}),t[9]=d):d=t[9];let f;t[10]!==s.nextDisableModelInvocation||t[11]!==a||t[12]!==i?(f=()=>{i&&a(i,s.nextDisableModelInvocation)},t[10]=s.nextDisableModelInvocation,t[11]=a,t[12]=i,t[13]=f):f=t[13];let p;t[14]!==s.actionLabel||t[15]!==f?(p=(0,Z.jsxs)(he,{children:[d,(0,Z.jsx)(me,{onClick:f,children:s.actionLabel})]}),t[14]=s.actionLabel,t[15]=f,t[16]=p):p=t[16];let m;t[17]!==u||t[18]!==p?(m=(0,Z.jsxs)(pe,{children:[u,p]}),t[17]=u,t[18]=p,t[19]=m):m=t[19];let h;return t[20]!==r||t[21]!==n||t[22]!==m?(h=(0,Z.jsx)(ve,{open:n,onOpenChange:r,children:m}),t[20]=r,t[21]=n,t[22]=m,t[23]=h):h=t[23],h}function Lt(){let e=(0,Y.c)(10),[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(null),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(!1),h;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=function(e){f(e),m(!0)},e[0]=h):h=e[0];let g=h,_;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(e){e||u(null)},e[1]=_):_=e[1];let v=_,y;return e[2]!==d||e[3]!==s||e[4]!==l||e[5]!==t||e[6]!==a||e[7]!==p||e[8]!==r?(y={showAddDialog:t,setShowAddDialog:n,showUrlDialog:r,setShowUrlDialog:i,showAddSourceDialog:a,setShowAddSourceDialog:o,pluginImportUrl:s,setPluginImportUrl:c,previewSkill:l,setPreviewSkill:u,invocationSkill:d,showInvocationDialog:p,setShowInvocationDialog:m,openInvocationDialog:g,handlePreviewDialogOpenChange:v},e[2]=d,e[3]=s,e[4]=l,e[5]=t,e[6]=a,e[7]=p,e[8]=r,e[9]=y):y=e[9],y}var Q=`skills:popular`;function Rt(e){return e.map(e=>`${e.id}~${e.name}~${e.description}`).join(`|`)}function zt(){let e=(0,Y.c)(5),[t,n]=(0,X.useState)(Ht),[r,i]=(0,X.useState)(Vt),a,o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{le().then(e=>{Xe(Q,e),n(t=>Rt(t)===Rt(e)?t:e)}).catch(Bt).finally(()=>i(!1))},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,X.useEffect)(a,o);let s;return e[2]!==r||e[3]!==t?(s={popularSkills:t,loadingPopularSkills:r},e[2]=r,e[3]=t,e[4]=s):s=e[4],s}function Bt(){}function Vt(){return!Ze(Q)}function Ht(){return Qe(Q)??[]}var $=new Map;function Ut(e){let t=$.get(e);if(t)return t;let n=ce(e).finally(()=>{$.delete(e)});return $.set(e,n),n}function Wt(e,t){return t.map(t=>({...t,sourceId:t.sourceId??e}))}function Gt(){let e=(0,Y.c)(18),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,X.useState)(t),[i,a]=(0,X.useState)(ue),o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],e[1]=o):o=e[1];let[s,c]=(0,X.useState)(o),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(!1),p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=async()=>{try{r(await F())}catch{r([])}},e[2]=p):p=e[2];let m=p,h,g;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{(async function(){let e=N();if(e.length>0)try{await D(e),P()}catch{}await m()})()},g=[m],e[3]=h,e[4]=g):(h=e[3],g=e[4]),(0,X.useEffect)(h,g);let _;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{a(e),oe(e)},e[5]=_):_=e[5];let v=_,y;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{r(t=>[...t.filter(t=>t.id!==e.id),e].sort(qt)),v(e.id)},e[6]=y):y=e[6];let b=y,x;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{r(t=>t.map(t=>t.id===e.id?e:t).sort(Kt)),E(e.id)},e[7]=x):x=e[7];let S=x,C;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{r(t=>t.filter(t=>t.id!==e)),E(e),a(t=>t===e?(oe(`default`),`default`):t)},e[8]=C):C=e[8];let w=C,T,O;e[9]===i?(T=e[10],O=e[11]):(O=()=>{if(i==="default"){c([]),u(!1),f(!1);return}let e=M(i);e?.skills?(c(Wt(i,e.skills)),u(!1)):(c([]),u(!0));let t=!1;return f(!!e?.skills),Ut(i).then(e=>{if(t)return;let n=Wt(i,e);c(n),ae(i,{fetchedAt:Date.now(),skills:n})}).catch(n=>{t||(e?.skills||c([]),R({title:`Error`,description:n instanceof Error?n.message:`Failed to load skill catalog`,variant:`destructive`}))}).finally(()=>{t||(u(!1),f(!1))}),()=>{t=!0}},T=[i],e[9]=i,e[10]=T,e[11]=O),(0,X.useEffect)(O,T);let k;return e[12]!==s||e[13]!==l||e[14]!==d||e[15]!==i||e[16]!==n?(k={sources:n,selectedSourceId:i,setSelectedSourceId:v,addSource:b,updateSource:S,removeSource:w,reloadSources:m,catalogSkills:s,isLoadingCatalog:l,isRefreshingCatalog:d},e[12]=s,e[13]=l,e[14]=d,e[15]=i,e[16]=n,e[17]=k):k=e[17],k}function Kt(e,t){return e.title.localeCompare(t.title)}function qt(e,t){return e.title.localeCompare(t.title)}function Jt(e){let t=(0,Y.c)(26),{popularSkills:n,loadingPopularSkills:r}=zt(),{sources:i,selectedSourceId:o,setSelectedSourceId:s,addSource:c,updateSource:l,removeSource:u,catalogSkills:d,isLoadingCatalog:f}=Gt(),{query:p,setQuery:m,deferredQuery:h}=Ge(),g=o==="default",_;t[0]!==o||t[1]!==i?(_=a(o)?i.find(e=>e.id===o)??null:null,t[0]=o,t[1]=i,t[2]=_):_=t[2];let v=_,y=!g&&f&&d.length===0,b;t[3]!==h||t[4]!==e||t[5]!==n?(b=ot(n,h,e),t[3]=h,t[4]=e,t[5]=n,t[6]=b):b=t[6];let x=b,S;t[7]!==d||t[8]!==h||t[9]!==e?(S=ot(d,h,e),t[7]=d,t[8]=h,t[9]=e,t[10]=S):S=t[10];let C=S,w;return t[11]!==c||t[12]!==C||t[13]!==y||t[14]!==x||t[15]!==p||t[16]!==g||t[17]!==r||t[18]!==u||t[19]!==v||t[20]!==o||t[21]!==m||t[22]!==s||t[23]!==i||t[24]!==l?(w={availableSearch:p,setAvailableSearch:m,availablePopular:x,availableCatalog:C,availableCatalogLoading:y,isDefaultSource:g,selectedCustomSource:v,sources:i,selectedSourceId:o,setSelectedSourceId:s,addSource:c,updateSource:l,removeSource:u,loadingPopularSkills:r},t[11]=c,t[12]=C,t[13]=y,t[14]=x,t[15]=p,t[16]=g,t[17]=r,t[18]=u,t[19]=v,t[20]=o,t[21]=m,t[22]=s,t[23]=i,t[24]=l,t[25]=w):w=t[25],w}async function Yt(e,t){let n=rt(t.id);if(!e.threadId||e.installedFilePaths.has(n))return;let r=t.sourceId??(e.selectedSourceId==="default"?void 0:e.selectedSourceId);try{r?await se(e.threadId,r,t.id,nt(t.id)):await j(e.threadId,n,at(t)),e.setInstalledFilePaths(e=>new Set(e).add(n)),e.triggerExplorerRefresh(),e.reloadSkills(),R({title:`Skill installed`,description:t.name})}catch(e){throw R({title:`Error`,description:e instanceof Error?e.message:`Failed to install skill`,variant:`destructive`}),e}}async function Xt(e,t,n){if(e.projectId)try{try{await ee(e.projectId,t.name,n)}catch{if(!e.threadId)throw Error(`No thread selected to update this skill`);await I(e.threadId,t.name,n)}e.triggerExplorerRefresh(),await e.reloadSkills(),R({title:n?`Model invocation disabled`:`Model invocation enabled`,description:n?`${t.name} is now invoked manually with /${t.name}.`:`${t.name} is offered to the model again.`})}catch(e){R({title:`Error`,description:e instanceof Error?e.message:`Failed to update skill`,variant:`destructive`})}}function Zt(){let e=(0,Y.c)(34),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={findItems:Ot,installedPathSuffix:`/SKILL.md`,explorerPathSuffix:`/SKILL.md`,sortByName:!0,removedToastTitle:`Skill removed`},e[0]=t):t=e[0];let n=$e(t),r=s(Qt),i=r.find(e=>e.projectId===n.selectedProjectId)??null,a=Lt(),o=Jt(n.installedFilePaths),l;e[1]!==o.loadingPopularSkills||e[2]!==n.loading?(l=[n.loading,o.loadingPopularSkills],e[1]=o.loadingPopularSkills,e[2]=n.loading,e[3]=l):l=e[3];let u=Ve(n.selectedProjectId?`${n.selectedProjectId}:${n.selectedThreadId??``}`:null,l),d;e[4]!==o.selectedSourceId||e[5]!==n.installedFilePaths||e[6]!==n.loadItems||e[7]!==n.selectedThreadId||e[8]!==n.setInstalledFilePaths||e[9]!==n.triggerExplorerRefresh?(d=function(e){return Yt({threadId:n.selectedThreadId,selectedSourceId:o.selectedSourceId,installedFilePaths:n.installedFilePaths,setInstalledFilePaths:n.setInstalledFilePaths,triggerExplorerRefresh:n.triggerExplorerRefresh,reloadSkills:n.loadItems},e)},e[4]=o.selectedSourceId,e[5]=n.installedFilePaths,e[6]=n.loadItems,e[7]=n.selectedThreadId,e[8]=n.setInstalledFilePaths,e[9]=n.triggerExplorerRefresh,e[10]=d):d=e[10];let f=d,p;e[11]!==n.loadItems||e[12]!==n.selectedProjectId||e[13]!==n.selectedThreadId||e[14]!==n.triggerExplorerRefresh?(p=function(e,t){return Xt({projectId:n.selectedProjectId,threadId:n.selectedThreadId,triggerExplorerRefresh:n.triggerExplorerRefresh,reloadSkills:n.loadItems},e,t)},e[11]=n.loadItems,e[12]=n.selectedProjectId,e[13]=n.selectedThreadId,e[14]=n.triggerExplorerRefresh,e[15]=p):p=e[15];let m=p,h;e[16]===n?h=e[17]:(h=function(e){e||n.setDeleteConfirm(null)},e[16]=n,e[17]=h);let g=h,_;e[18]===n?_=e[19]:(_=function(){n.deleteConfirm&&n.handleDelete(n.deleteConfirm)},e[18]=n,e[19]=_);let v=_,y;e[20]===n?y=e[21]:(y=function(e){n.loadItems(),n.triggerExplorerRefresh(),R(At(e))},e[20]=n,e[21]=y);let b=y,x=i?c(i):null,S;return e[22]!==o||e[23]!==a||e[24]!==m||e[25]!==v||e[26]!==g||e[27]!==f||e[28]!==b||e[29]!==n||e[30]!==u||e[31]!==r||e[32]!==x?(S={installed:n,projects:r,selectedProjectName:x,dialogs:a,available:o,pageLoading:u,handleInstallPreviewSkill:f,handleConfirmModelInvocation:m,handleDeleteDialogOpenChange:g,handleDeleteConfirm:v,handlePluginInstalled:b},e[22]=o,e[23]=a,e[24]=m,e[25]=v,e[26]=g,e[27]=f,e[28]=b,e[29]=n,e[30]=u,e[31]=r,e[32]=x,e[33]=S):S=e[33],S}function Qt(e){return e.projects}function $t(){let e=(0,Y.c)(101),t=Zt(),{installed:n,dialogs:r,available:i}=t;if(!n.selectedProjectId){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Ae,{children:`Select a project to manage skills.`}),e[0]=t):t=e[0],t}let a,o;e[1]===r?(a=e[2],o=e[3]):(a=()=>r.setShowAddDialog(!0),o=()=>r.setShowUrlDialog(!0),e[1]=r,e[2]=a,e[3]=o);let s;e[4]!==r.openInvocationDialog||e[5]!==n.handleOpenInExplorer||e[6]!==n.items||e[7]!==n.selectedThreadId||e[8]!==n.setDeleteConfirm||e[9]!==a||e[10]!==o?(s=(0,Z.jsx)(Mt,{skills:n.items,threadId:n.selectedThreadId,onOpenSkill:n.handleOpenInExplorer,onDelete:n.setDeleteConfirm,onAddManual:a,onAddUrl:o,onChangeModelInvocation:r.openInvocationDialog}),e[4]=r.openInvocationDialog,e[5]=n.handleOpenInExplorer,e[6]=n.items,e[7]=n.selectedThreadId,e[8]=n.setDeleteConfirm,e[9]=a,e[10]=o,e[11]=s):s=e[11];let c;e[12]===r?c=e[13]:(c=e=>r.setPreviewSkill(e),e[12]=r,e[13]=c);let l;e[14]!==i.selectedSourceId||e[15]!==r?(l=e=>r.setPreviewSkill({...e,sourceId:e.sourceId??i.selectedSourceId}),e[14]=i.selectedSourceId,e[15]=r,e[16]=l):l=e[16];let u;e[17]===r?u=e[18]:(u=()=>r.setShowAddSourceDialog(!0),e[17]=r,e[18]=u);let d;e[19]!==i.availableCatalog||e[20]!==i.availableCatalogLoading||e[21]!==i.availablePopular||e[22]!==i.availableSearch||e[23]!==i.isDefaultSource||e[24]!==i.selectedCustomSource||e[25]!==i.selectedSourceId||e[26]!==i.setAvailableSearch||e[27]!==i.setSelectedSourceId||e[28]!==i.sources||e[29]!==c||e[30]!==l||e[31]!==u?(d=(0,Z.jsx)(vt,{availableSearch:i.availableSearch,onSearchChange:i.setAvailableSearch,selectedSourceId:i.selectedSourceId,onSourceChange:i.setSelectedSourceId,sources:i.sources,selectedCustomSource:i.selectedCustomSource,availableCatalogLoading:i.availableCatalogLoading,isDefaultSource:i.isDefaultSource,availablePopular:i.availablePopular,availableCatalog:i.availableCatalog,onPreviewPopular:c,onPreviewCatalog:l,onAddSource:u}),e[19]=i.availableCatalog,e[20]=i.availableCatalogLoading,e[21]=i.availablePopular,e[22]=i.availableSearch,e[23]=i.isDefaultSource,e[24]=i.selectedCustomSource,e[25]=i.selectedSourceId,e[26]=i.setAvailableSearch,e[27]=i.setSelectedSourceId,e[28]=i.sources,e[29]=c,e[30]=l,e[31]=u,e[32]=d):d=e[32];let f;e[33]!==t.pageLoading||e[34]!==s||e[35]!==d?(f=(0,Z.jsxs)(Ce,{loading:t.pageLoading,children:[s,d]}),e[33]=t.pageLoading,e[34]=s,e[35]=d,e[36]=f):f=e[36];let p=r.previewSkill!==null,m=i.isDefaultSource?void 0:i.selectedSourceId,h;e[37]!==r.handlePreviewDialogOpenChange||e[38]!==r.previewSkill||e[39]!==t.handleInstallPreviewSkill||e[40]!==p||e[41]!==m?(h=(0,Z.jsx)(dt,{open:p,onOpenChange:r.handlePreviewDialogOpenChange,skill:r.previewSkill,catalogSourceId:m,onInstall:t.handleInstallPreviewSkill}),e[37]=r.handlePreviewDialogOpenChange,e[38]=r.previewSkill,e[39]=t.handleInstallPreviewSkill,e[40]=p,e[41]=m,e[42]=h):h=e[42];let g;e[43]!==r.invocationSkill||e[44]!==r.setShowInvocationDialog||e[45]!==r.showInvocationDialog||e[46]!==t.handleConfirmModelInvocation?(g=(0,Z.jsx)(It,{open:r.showInvocationDialog,onOpenChange:r.setShowInvocationDialog,skill:r.invocationSkill,onConfirm:t.handleConfirmModelInvocation}),e[43]=r.invocationSkill,e[44]=r.setShowInvocationDialog,e[45]=r.showInvocationDialog,e[46]=t.handleConfirmModelInvocation,e[47]=g):g=e[47];let _,v,y;e[48]===i?(_=e[49],v=e[50],y=e[51]):(_=e=>{i.addSource(e),R({title:`Skill source added`,description:`${e.title} is now available in the source list.`})},v=e=>{i.updateSource(e),R({title:`Skill source updated`,description:`${e.title} has been saved.`})},y=e=>{i.removeSource(e),R({title:`Skill source removed`,description:`The custom source has been deleted.`})},e[48]=i,e[49]=_,e[50]=v,e[51]=y);let b;e[52]!==i.selectedCustomSource||e[53]!==r.setShowAddSourceDialog||e[54]!==r.showAddSourceDialog||e[55]!==_||e[56]!==v||e[57]!==y?(b=(0,Z.jsx)(ft,{open:r.showAddSourceDialog,onOpenChange:r.setShowAddSourceDialog,editingSource:i.selectedCustomSource,onSourceAdded:_,onSourceUpdated:v,onSourceDeleted:y}),e[52]=i.selectedCustomSource,e[53]=r.setShowAddSourceDialog,e[54]=r.showAddSourceDialog,e[55]=_,e[56]=v,e[57]=y,e[58]=b):b=e[58];let x;e[59]!==r||e[60]!==n?(x=()=>{r.setShowAddDialog(!1),n.loadItems(),n.triggerExplorerRefresh()},e[59]=r,e[60]=n,e[61]=x):x=e[61];let S;e[62]!==n.selectedThreadId||e[63]!==x?(S=(0,Z.jsx)(J,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,Z.jsx)(et,{threadId:n.selectedThreadId,onSkillCreated:x})}),e[62]=n.selectedThreadId,e[63]=x,e[64]=S):S=e[64];let C;e[65]!==r.setShowAddDialog||e[66]!==r.showAddDialog||e[67]!==S?(C=(0,Z.jsx)(U,{open:r.showAddDialog,onOpenChange:r.setShowAddDialog,children:S}),e[65]=r.setShowAddDialog,e[66]=r.showAddDialog,e[67]=S,e[68]=C):C=e[68];let w;e[69]===r?w=e[70]:(w=e=>r.setPluginImportUrl(e),e[69]=r,e[70]=w);let T;e[71]!==r.setShowUrlDialog||e[72]!==r.showUrlDialog||e[73]!==w?(T=(0,Z.jsx)(mt,{open:r.showUrlDialog,onOpenChange:r.setShowUrlDialog,onSubmit:w}),e[71]=r.setShowUrlDialog,e[72]=r.showUrlDialog,e[73]=w,e[74]=T):T=e[74];let E;e[75]===r?E=e[76]:(E=()=>r.setPluginImportUrl(null),e[75]=r,e[76]=E);let D;e[77]===t?D=e[78]:(D=e=>{let{mcpOnly:n}=e;t.handlePluginInstalled(n)},e[77]=t,e[78]=D);let O;e[79]!==r.pluginImportUrl||e[80]!==n.selectedProjectId||e[81]!==t.projects||e[82]!==t.selectedProjectName||e[83]!==E||e[84]!==D?(O=(0,Z.jsx)(Fe,{url:r.pluginImportUrl,projectId:n.selectedProjectId,projectName:t.selectedProjectName,projects:t.projects,onSelectProject:en,onClose:E,onInstalled:D}),e[79]=r.pluginImportUrl,e[80]=n.selectedProjectId,e[81]=t.projects,e[82]=t.selectedProjectName,e[83]=E,e[84]=D,e[85]=O):O=e[85];let k=n.deleteConfirm!==null,A=`Are you sure you want to delete the skill "${n.deleteConfirm?.name}"? This action cannot be undone.`,j;e[86]!==n.deleting||e[87]!==t.handleDeleteConfirm||e[88]!==t.handleDeleteDialogOpenChange||e[89]!==k||e[90]!==A?(j=(0,Z.jsx)(Be,{open:k,onOpenChange:t.handleDeleteDialogOpenChange,title:`Delete Skill`,description:A,onConfirm:t.handleDeleteConfirm,confirming:n.deleting}),e[86]=n.deleting,e[87]=t.handleDeleteConfirm,e[88]=t.handleDeleteDialogOpenChange,e[89]=k,e[90]=A,e[91]=j):j=e[91];let M;return e[92]!==h||e[93]!==g||e[94]!==b||e[95]!==C||e[96]!==T||e[97]!==O||e[98]!==j||e[99]!==f?(M=(0,Z.jsxs)(Z.Fragment,{children:[f,h,g,b,C,T,O,j]}),e[92]=h,e[93]=g,e[94]=b,e[95]=C,e[96]=T,e[97]=O,e[98]=j,e[99]=f,e[100]=M):M=e[100],M}function en(){}export{$t as SettingsSkillsView,$t as default};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{Bn as i,fn as a,lt as o}from"./dist-DQEC_JS0.js";import{r as s}from"./store-D151firE.js";import{d as c,t as l}from"./utils-DfZXN5fy.js";import{Ft as u,G as d,Qt as f,R as p,V as m,W as h,_t as g,a as _,bn as v,pt as y,tn as b}from"./lucide-react-BFzs_X2U.js";import{t as x}from"./button-Djzr1B_4.js";import{i as S,n as C,r as w,t as T}from"./tooltip-CXREivps.js";import{Ci as E,Cr as D,D as O,Dr as k,Er as A,Hi as j,Mi as M,Pn as N,Si as P,Sr as F,Un as I,Vn as ee,_r as te,gr as ne,hr as re,in as ie,la as ae,oa as oe,wr as se,xr as ce,yr as le,zi as ue}from"./api-Cho1mlFq.js";import{t as L}from"./progress-indicator-Dr2oM_0d.js";import{a as de,c as fe,i as pe,n as me,o as he,r as ge,s as _e,t as ve}from"./alert-dialog-CJ403H9_.js";import{t as R}from"./use-toast-xpb5jNtN.js";import{At as ye,Br as z,Dt as be,Er as xe,Fr as Se,Ft as Ce,Gt as we,Hr as B,Ht as Te,Ir as V,Jt as Ee,Kn as De,Lr as H,Or as Oe,Ot as ke,Rr as U,Rt as Ae,Ur as W,Ut as je,Vr as G,Vt as Me,W as Ne,Wt as Pe,a as Fe,jr as Ie,jt as K,kr as q,mr as Le,qt as Re,zr as J,zt as ze}from"./index-BlkYPP7B.js";import{t as Be}from"./delete-confirm-dialog-Bcy-0viP.js";import{t as Ve}from"./use-settings-page-loading-CpaBd260.js";import{a as He,o as Ue,r as We}from"./settings-list-mil_4_AR.js";import{t as Ge}from"./use-deferred-search-Dgxosq55.js";import{i as Ke,n as qe,r as Je,t as Ye}from"./slug-utils-DQA1OvXq.js";import{i as Xe,n as Ze,r as Qe,t as $e}from"./use-installed-ai-files-CD4qXZcA.js";var Y=t(),X=e(n(),1),Z=r();function et({threadId:e,onSkillCreated:t}){let[n,r]=(0,X.useState)(``),[i,o]=(0,X.useState)(``),[s,c]=(0,X.useState)(!1),u=Je(n),d=qe(u),f=async()=>{if(!(!d||!i.trim()||!e)){c(!0);try{let n=await O(e,u,i.trim());R({title:`Skill created`,description:`Skill '${u}' was created successfully.`}),r(``),o(``),t?.(n.path,`SKILL.md`)}catch(e){R({title:`Error`,description:e instanceof Error?e.message:`Failed to create skill`,variant:`destructive`})}finally{c(!1)}}};return e?(0,Z.jsx)(Me,{children:(0,Z.jsxs)(be,{children:[(0,Z.jsx)(K,{title:`Add Skill`,description:`Saved as SKILL.md in .agents/skills.`,sticky:!0,className:`pr-10`}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(ke,{title:`Skill Name`,controlLayout:`stack`,className:`pt-6`,children:[(0,Z.jsx)(H,{id:`skillName`,value:n,onChange:e=>r(e.target.value),placeholder:`e.g. Code Review`,disabled:s}),n?(0,Z.jsxs)(`p`,{className:l(a.caption,`mt-2`),children:[`Folder name: `,(0,Z.jsx)(`span`,{className:`font-mono`,children:u||`...`})]}):null]}),(0,Z.jsx)(ke,{title:`Description`,controlLayout:`stack`,className:`pt-6`,children:(0,Z.jsx)(Ne,{id:`skillDescription`,value:i,onChange:e=>o(e.target.value),placeholder:`Describe when Tarsk should apply this skill`,className:`resize-none min-h-[120px]`,disabled:s})}),(0,Z.jsx)(Ke,{onContinue:()=>void f(),disabled:!d||!i.trim(),creating:s})]})]})}):(0,Z.jsx)(Ae,{title:`No thread selected`,children:`Please select a thread to add a skill.`})}var tt=`.agents/skills`;function nt(e){return`${tt}/${e}`}function rt(e){return`${nt(e)}/SKILL.md`}function it(e,t){let n=t.trim();if(!n)return e;let r=n.toLowerCase();return e.filter(e=>e.name.toLowerCase().includes(r)||e.description.toLowerCase().includes(r))}function at(e){let t=[`---`,`name: ${e.id}`,`description: ${e.description}`];return e.allowedTools&&t.push(`allowed-tools: ${e.allowedTools}`),e.license&&t.push(`license: ${e.license}`),t.push(`---`,``,e.instructions??``),t.join(`
|
|
2
|
+
`)}function ot(e,t,n){return it(e,t).filter(e=>!n.has(rt(e.id)))}function st(e){return e.endsWith(`.md`)||e.endsWith(`.mdx`)}function ct(e){return e.includes(`SKILL.md`)?`SKILL.md`:e[0]??`SKILL.md`}function lt(e,t){let n=e?.sourceId??t;if(!(!n||n==="default"))return n}function ut(e,t,n){let[r,i]=(0,X.useState)([]),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(null),h=lt(t,n),g=!!h;return(0,X.useEffect)(()=>{if(!e||!t)return;let r=t,a=lt(r,n),s=!1;async function l(){u(!0),m(null),i([]),o(null),c(``);try{if(a){let e=await te(a,r.id);if(s)return;i(e.files),o(ct(e.files))}else{if(s)return;i([`SKILL.md`]),o(`SKILL.md`),c(at(r))}}catch(e){if(s)return;m(e instanceof Error?e.message:`Failed to load skill files`)}finally{s||u(!1)}}return l(),()=>{s=!0}},[e,t,n]),(0,X.useEffect)(()=>{if(!e||!t||!a||!g||!h)return;let n=t,r=a,i=!1;async function o(){f(!0),m(null);try{let e=await ne(h,n.id,r);if(i)return;c(e.content)}catch(e){if(i)return;m(e instanceof Error?e.message:`Failed to load file`),c(``)}finally{i||f(!1)}}return o(),()=>{i=!0}},[e,t,a,g,h]),{files:r,selectedFile:a,setSelectedFile:o,fileContent:s,loadingFiles:l,contentLoading:l||g&&d,loadError:p,isCatalogSkill:g,effectiveSourceId:h}}function dt({open:e,onOpenChange:t,skill:n,catalogSourceId:r,onInstall:i}){let[o,s]=(0,X.useState)(!1),{files:c,selectedFile:d,setSelectedFile:f,fileContent:p,loadingFiles:m,contentLoading:h,loadError:g,effectiveSourceId:_}=ut(e,n,r),v=(0,X.useCallback)(async()=>{if(!n)return;let e=_?{...n,sourceId:_}:n;s(!0);try{await i(e),t(!1)}finally{s(!1)}},[n,_,i,t]),y=d?st(d):!1,b=(0,X.useMemo)(()=>c.map(e=>(0,Z.jsxs)(Le,{selected:e===d,onClick:()=>f(e),className:`gap-2 cursor-pointer`,children:[(0,Z.jsx)(u,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,Z.jsx)(`span`,{className:l(a.caption,`truncate`),children:e})]},e)),[c,d]);return(0,Z.jsx)(U,{open:e,onOpenChange:t,children:(0,Z.jsxs)(J,{className:`flex max-h-[90vh] max-w-5xl flex-col gap-0 overflow-hidden p-0`,children:[(0,Z.jsxs)(B,{className:`border-b border-border px-6 py-4`,children:[(0,Z.jsx)(W,{children:n?.name??`Review skill`}),n?.description?(0,Z.jsx)(z,{children:n.description}):null]}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row`,children:[(0,Z.jsxs)(`div`,{className:`flex max-h-40 shrink-0 flex-col border-b border-border sm:max-h-none sm:w-56 sm:border-b-0 sm:border-r`,children:[(0,Z.jsx)(`div`,{className:l(a.labelMuted,`px-3 py-2`),children:`Files`}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-1 pb-2`,children:m?(0,Z.jsx)(L,{centered:!0,containerClassName:`py-8`,label:`Loading files...`}):c.length===0?(0,Z.jsx)(`p`,{className:l(a.caption,`px-3 py-2 text-muted-foreground`),children:`No files found.`}):b})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-4`,children:g?(0,Z.jsx)(`p`,{className:l(a.body,`text-destructive`),children:g}):h?(0,Z.jsx)(L,{centered:!0,containerClassName:`py-12`,label:`Loading preview...`}):y?(0,Z.jsx)(De,{content:p,enableMermaid:!1}):(0,Z.jsx)(`pre`,{className:l(a.caption,`overflow-x-auto whitespace-pre-wrap font-mono`),children:p})})]}),(0,Z.jsxs)(G,{className:`border-t border-border px-6 py-4 sm:justify-between`,children:[(0,Z.jsx)(x,{type:`button`,variant:`outline`,onClick:()=>t(!1),children:`Cancel`}),(0,Z.jsx)(x,{type:`button`,onClick:()=>void v(),disabled:o||!n,children:o?`Installing...`:`Install`})]})]})})}function ft({open:e,onOpenChange:t,editingSource:n,onSourceAdded:r,onSourceUpdated:i,onSourceDeleted:o}){let[s,c]=(0,X.useState)(``),[u,d]=(0,X.useState)(``),[f,p]=(0,X.useState)(null),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(!1),[v,b]=(0,X.useState)(!1),S=n!=null;function C(){c(``),d(``),p(null),h(!1),_(!1),b(!1)}function w(e){e||C(),t(e)}(0,X.useEffect)(()=>{if(e){if(n){c(n.title),d(n.url),p(null);return}c(``),d(``),p(null)}},[e,n]);async function T(){let e=s.trim(),t=u.trim();if(!e||!t){p(`Title and URL are required.`);return}h(!0),p(null);try{if(S&&n){let r=await A(n.id,e,t);i?.(r.source)}else r((await k(e,t)).source);w(!1)}catch(e){p(e instanceof Error?e.message:`Failed to verify skill source`)}finally{h(!1)}}async function E(){if(n){_(!0),p(null);try{await re(n.id),o?.(n.id),b(!1),w(!1)}catch(e){p(e instanceof Error?e.message:`Failed to delete skill source`),b(!1)}finally{_(!1)}}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(U,{open:e,onOpenChange:w,children:(0,Z.jsxs)(J,{className:`sm:max-w-lg`,children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(W,{children:S?`Edit Skill Source`:`Add Skill Source`}),(0,Z.jsx)(z,{children:S?`Update the title or GitHub skills folder URL for this custom source.`:`Add a GitHub skills folder URL. The source is verified by loading at least one skill from the repository.`})]}),(0,Z.jsxs)(`div`,{className:`grid gap-4 py-2`,children:[(0,Z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Z.jsx)(V,{htmlFor:`skill-source-title`,children:`Title`}),(0,Z.jsx)(H,{id:`skill-source-title`,placeholder:`e.g. My Team Skills`,value:s,onChange:e=>c(e.target.value),disabled:m||g,autoFocus:!0})]}),(0,Z.jsxs)(`div`,{className:`grid gap-2`,children:[(0,Z.jsx)(V,{htmlFor:`skill-source-url`,children:`URL`}),(0,Z.jsx)(H,{id:`skill-source-url`,placeholder:`https://github.com/org/repo or .../tree/main/skills`,value:u,onChange:e=>d(e.target.value),disabled:m||g})]}),f?(0,Z.jsx)(`p`,{className:l(a.caption,`text-destructive`),children:f}):null]}),(0,Z.jsxs)(G,{className:`flex-col-reverse gap-2 sm:flex-row sm:justify-between`,children:[S?(0,Z.jsx)(x,{type:`button`,variant:`destructive`,onClick:()=>b(!0),disabled:m||g,children:`Delete`}):(0,Z.jsx)(`div`,{className:`hidden sm:block`}),(0,Z.jsxs)(`div`,{className:`flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row`,children:[(0,Z.jsx)(x,{variant:`outline`,onClick:()=>w(!1),disabled:m||g,children:`Cancel`}),(0,Z.jsx)(x,{onClick:()=>void T(),disabled:m||g||!s.trim()||!u.trim(),children:m?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(y,{className:`mr-2 h-4 w-4 animate-spin`}),`Verifying...`]}):S?`Save Changes`:`Add Source`})]})]})]})}),(0,Z.jsx)(ve,{open:v,onOpenChange:b,children:(0,Z.jsxs)(pe,{children:[(0,Z.jsxs)(_e,{children:[(0,Z.jsx)(fe,{children:`Delete Skill Source`}),(0,Z.jsxs)(de,{children:[`Are you sure you want to delete "`,n?.title,`"? This removes the source from your list but does not uninstall skills you already added.`]})]}),(0,Z.jsxs)(he,{children:[(0,Z.jsx)(ge,{disabled:g,children:`Cancel`}),(0,Z.jsx)(me,{onClick:()=>void E(),disabled:g,className:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,children:g?`Deleting...`:`Delete`})]})]})})]})}function pt(e){let t=e.trim();if(!t)return null;if(/^https?:\/\//i.test(t))try{return new URL(t),t}catch{return null}if(t.startsWith(`tarsk://`))try{let e=new URL(`https://tarsk.invalid/${t.slice(8)}`);if(e.pathname===`/skill-install`&&e.searchParams.get(`url`))return e.searchParams.get(`url`)}catch{return null}return null}function mt(e){let t=(0,Y.c)(40),{open:n,onOpenChange:r,onSubmit:i}=e,[o,s]=(0,X.useState)(``),[c,u]=(0,X.useState)(null),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=function(){s(``),u(null)},t[0]=d):d=t[0];let f=d,p;t[1]===r?p=t[2]:(p=function(e){e||f(),r(e)},t[1]=r,t[2]=p);let m=p,h,g;t[3]===n?(h=t[4],g=t[5]):(h=()=>{n&&f()},g=[n],t[3]=n,t[4]=h,t[5]=g),(0,X.useEffect)(h,g);let _;t[6]!==m||t[7]!==i||t[8]!==o?(_=function(){let e=pt(o);if(!e){u(`Enter a valid http(s) URL for the plugin archive or paste a tarsk:// install link.`);return}i(e),m(!1)},t[6]=m,t[7]=i,t[8]=o,t[9]=_):_=t[9];let v=_,y;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsxs)(B,{children:[(0,Z.jsx)(W,{children:`Add Skill via URL`}),(0,Z.jsx)(z,{children:`Paste the URL of a plugin archive. Its skills and MCP servers are installed into this project.`})]}),t[10]=y):y=t[10];let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(V,{htmlFor:`add-skill-url`,children:`URL`}),t[11]=b):b=t[11];let S;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>s(e.target.value),t[12]=S):S=t[12];let C;t[13]===v?C=t[14]:(C=e=>{e.key===`Enter`&&(e.preventDefault(),v())},t[13]=v,t[14]=C);let w;t[15]!==C||t[16]!==o?(w=(0,Z.jsx)(H,{id:`add-skill-url`,placeholder:`https://example.com/my-plugin.zip`,value:o,onChange:S,autoFocus:!0,onKeyDown:C}),t[15]=C,t[16]=o,t[17]=w):w=t[17];let T;t[18]===c?T=t[19]:(T=c?(0,Z.jsx)(`p`,{className:l(a.caption,`text-destructive`),children:c}):null,t[18]=c,t[19]=T);let E;t[20]!==w||t[21]!==T?(E=(0,Z.jsx)(`div`,{className:`grid gap-4 py-2`,children:(0,Z.jsxs)(`div`,{className:`grid gap-2`,children:[b,w,T]})}),t[20]=w,t[21]=T,t[22]=E):E=t[22];let D;t[23]===m?D=t[24]:(D=(0,Z.jsx)(x,{variant:`outline`,onClick:()=>m(!1),children:`Cancel`}),t[23]=m,t[24]=D);let O;t[25]===o?O=t[26]:(O=o.trim(),t[25]=o,t[26]=O);let k=!O,A;t[27]!==v||t[28]!==k?(A=(0,Z.jsx)(x,{onClick:v,disabled:k,children:`Continue`}),t[27]=v,t[28]=k,t[29]=A):A=t[29];let j;t[30]!==D||t[31]!==A?(j=(0,Z.jsxs)(G,{children:[D,A]}),t[30]=D,t[31]=A,t[32]=j):j=t[32];let M;t[33]!==E||t[34]!==j?(M=(0,Z.jsxs)(J,{className:`sm:max-w-lg`,children:[y,E,j]}),t[33]=E,t[34]=j,t[35]=M):M=t[35];let N;return t[36]!==m||t[37]!==n||t[38]!==M?(N=(0,Z.jsx)(U,{open:n,onOpenChange:m,children:M}),t[36]=m,t[37]=n,t[38]=M,t[39]=N):N=t[39],N}function ht(e){let t=(0,Y.c)(7),{items:n,onPreview:r}=e,i;if(t[0]!==n||t[1]!==r){let e;t[3]===r?e=t[4]:(e=e=>{let t=Ye(e.name);return(0,Z.jsxs)(`div`,{className:`group flex min-h-13 items-center gap-3 px-3 py-2`,role:`button`,tabIndex:0,onClick:()=>r(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),r(e))},children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:l(a.label,`truncate`),children:t}),(0,Z.jsx)(`p`,{className:l(a.caption,`truncate`),children:e.description})]}),(0,Z.jsx)(w,{delayDuration:300,children:(0,Z.jsxs)(T,{children:[(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsx)(x,{type:`button`,variant:`ghost`,size:`icon-sm`,className:`shrink-0 opacity-0 pointer-events-none can-hover:group-hover:opacity-100 can-hover:group-hover:pointer-events-auto`,"aria-label":`Install ${t}`,onClick:t=>{t.stopPropagation(),r(e)},children:(0,Z.jsx)(b,{className:`h-4 w-4`})})}),(0,Z.jsx)(C,{children:`Install skill`})]})})]},e.id)},t[3]=r,t[4]=e),i=n.map(e),t[0]=n,t[1]=r,t[2]=i}else i=t[2];let o;return t[5]===i?o=t[6]:(o=(0,Z.jsx)(`div`,{className:`divide-y divide-table-border`,children:i}),t[5]=i,t[6]=o),o}function gt(e){let t=(0,Y.c)(11),{searchQuery:n,isLoadingCatalog:r,isDefaultSource:i,availablePopular:a,availableCatalog:o,onPreviewPopular:s,onPreviewCatalog:c}=e;if(r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsx)(L,{centered:!0,containerClassName:`py-12`,label:`Loading skills...`}),t[0]=e):e=t[0],e}if(i){if(a.length===0){let e;return t[1]===n?e=t[2]:(e=(0,Z.jsx)(He,{searchQuery:n,emptyLabel:`No available skills found.`}),t[1]=n,t[2]=e),e}let e;return t[3]!==a||t[4]!==s?(e=(0,Z.jsx)(ht,{items:a,onPreview:s}),t[3]=a,t[4]=s,t[5]=e):e=t[5],e}if(o.length===0){let e;return t[6]===n?e=t[7]:(e=(0,Z.jsx)(He,{searchQuery:n,emptyLabel:`No available skills found.`}),t[6]=n,t[7]=e),e}let l;return t[8]!==o||t[9]!==c?(l=(0,Z.jsx)(ht,{items:o,onPreview:c}),t[8]=o,t[9]=c,t[10]=l):l=t[10],l}function _t(e){return e?{ariaLabel:`Edit skill source`,tooltip:`Edit this custom skill source`,icon:h}:{ariaLabel:`Add skill source`,tooltip:`Add a custom skill source`,icon:m}}function vt(e){let t=(0,Y.c)(42),{availableSearch:n,onSearchChange:r,selectedSourceId:i,onSourceChange:a,sources:o,selectedCustomSource:s,availableCatalogLoading:c,isDefaultSource:l,availablePopular:u,availableCatalog:d,onPreviewPopular:f,onPreviewCatalog:p,onAddSource:m}=e,h;t[0]===s?h=t[1]:(h=_t(s),t[0]=s,t[1]=h);let g=h,_=g.icon,v;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(w,{children:(0,Z.jsxs)(T,{children:[(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsx)(`span`,{className:`cursor-help`,children:`Available Skills`})}),(0,Z.jsx)(C,{children:`Browse and install skills from the catalog.`})]})}),t[2]=v):v=t[2];let y;t[3]!==n||t[4]!==r?(y=(0,Z.jsx)(Ue,{placeholder:`Search`,value:n,onChange:r,className:`mb-0 w-64`}),t[3]=n,t[4]=r,t[5]=y):y=t[5];let b;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(Re,{className:`w-40`,"aria-label":`Skill source`,children:(0,Z.jsx)(Ee,{placeholder:`Default`})}),t[6]=b):b=t[6];let E;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(we,{value:`default`,children:`Default`}),t[7]=E):E=t[7];let D;t[8]===o?D=t[9]:(D=o.map(yt),t[8]=o,t[9]=D);let O;t[10]===D?O=t[11]:(O=(0,Z.jsxs)(Pe,{children:[E,D]}),t[10]=D,t[11]=O);let k;t[12]!==a||t[13]!==i||t[14]!==O?(k=(0,Z.jsxs)(je,{value:i,onValueChange:a,children:[b,O]}),t[12]=a,t[13]=i,t[14]=O,t[15]=k):k=t[15];let A;t[16]===_?A=t[17]:(A=(0,Z.jsx)(_,{className:`h-4 w-4`}),t[16]=_,t[17]=A);let j;t[18]!==m||t[19]!==g.ariaLabel||t[20]!==A?(j=(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsx)(x,{type:`button`,variant:`outline`,size:`icon`,className:`shrink-0`,onClick:m,"aria-label":g.ariaLabel,children:A})}),t[18]=m,t[19]=g.ariaLabel,t[20]=A,t[21]=j):j=t[21];let M;t[22]===g.tooltip?M=t[23]:(M=(0,Z.jsx)(C,{children:g.tooltip}),t[22]=g.tooltip,t[23]=M);let N;t[24]!==j||t[25]!==M?(N=(0,Z.jsx)(w,{children:(0,Z.jsxs)(T,{children:[j,M]})}),t[24]=j,t[25]=M,t[26]=N):N=t[26];let P;t[27]!==N||t[28]!==y||t[29]!==k?(P=(0,Z.jsx)(K,{title:v,action:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,k,N]}),sticky:!1}),t[27]=N,t[28]=y,t[29]=k,t[30]=P):P=t[30];let F;t[31]!==d||t[32]!==c||t[33]!==u||t[34]!==n||t[35]!==l||t[36]!==p||t[37]!==f?(F=(0,Z.jsx)(ze,{className:`pt-6`,children:(0,Z.jsx)(gt,{searchQuery:n,isLoadingCatalog:c,isDefaultSource:l,availablePopular:u,availableCatalog:d,onPreviewPopular:f,onPreviewCatalog:p})}),t[31]=d,t[32]=c,t[33]=u,t[34]=n,t[35]=l,t[36]=p,t[37]=f,t[38]=F):F=t[38];let I;return t[39]!==P||t[40]!==F?(I=(0,Z.jsxs)(Te,{className:`shrink-0`,children:[P,F]}),t[39]=P,t[40]=F,t[41]=I):I=t[41],I}function yt(e){return(0,Z.jsx)(we,{value:e.id,children:e.title},e.id)}var bt=`https://tarsk.io/skills/list/`;function xt(e){let t=(0,Y.c)(20),{onSelectMode:n,manualDisabled:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Z.jsx)(Se,{asChild:!0,children:(0,Z.jsxs)(x,{className:`gap-1`,children:[`Add Skill`,(0,Z.jsx)(v,{className:`h-4 w-4 opacity-70`})]})}),t[0]=i):i=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=l(a.body,`gap-2`),t[1]=o):o=t[1];let s;t[2]===n?s=t[3]:(s=()=>n(`manual`),t[2]=n,t[3]=s);let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Z.jsx)(d,{className:`h-4 w-4 shrink-0`}),t[4]=c):c=t[4];let u;t[5]!==r||t[6]!==s?(u=(0,Z.jsxs)(q,{className:o,disabled:r,onSelect:s,children:[c,`Manually Enter`]}),t[5]=r,t[6]=s,t[7]=u):u=t[7];let p;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(p=l(a.body,`gap-2`),t[8]=p):p=t[8];let m;t[9]===n?m=t[10]:(m=()=>n(`url`),t[9]=n,t[10]=m);let h;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Z.jsx)(g,{className:`h-4 w-4 shrink-0`}),t[11]=h):h=t[11];let _;t[12]===m?_=t[13]:(_=(0,Z.jsxs)(q,{className:p,onSelect:m,children:[h,`Via URL`]}),t[12]=m,t[13]=_);let y;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(Ie,{}),t[14]=y):y=t[14];let b;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(b=l(a.body,`gap-2`),t[15]=b):b=t[15];let S;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Z.jsxs)(q,{className:b,onSelect:St,children:[(0,Z.jsx)(f,{className:`h-4 w-4 shrink-0`}),`Marketplace`]}),t[16]=S):S=t[16];let C;return t[17]!==u||t[18]!==_?(C=(0,Z.jsxs)(xe,{children:[i,(0,Z.jsxs)(Oe,{align:`end`,className:`w-44`,children:[u,_,y,S]})]}),t[17]=u,t[18]=_,t[19]=C):C=t[19],C}function St(){ie(bt)}var Ct=`This skill uses no additional context as it is manually invoked`;function wt(e){return e.builtIn?`text-muted-foreground/50`:e.disableModelInvocation?`text-brand`:`text-foreground`}function Tt(e){return e.disableModelInvocation?Ct:`≈${i(e.description)} tokens of context`}function Et(e){let t=(0,Y.c)(22),n,r,i,a,o,s;if(t[0]!==e){let{onClick:c,ariaLabel:u,...d}=e,f=(0,Z.jsx)(p,{className:l(`h-4 w-4 shrink-0`,wt(d)),"aria-hidden":`true`});i=w,s=300,r=T,t[7]!==u||t[8]!==f||t[9]!==c?(o=(0,Z.jsx)(S,{asChild:!0,children:c?(0,Z.jsx)(`button`,{type:`button`,"aria-label":u,className:`shrink-0 cursor-pointer rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:e=>{e.stopPropagation(),c()},onKeyDown:Dt,children:f}):f}),t[7]=u,t[8]=f,t[9]=c,t[10]=o):o=t[10],n=C,a=Tt(d),t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s}else n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6];let c;t[11]!==n||t[12]!==a?(c=(0,Z.jsx)(n,{children:a}),t[11]=n,t[12]=a,t[13]=c):c=t[13];let u;t[14]!==r||t[15]!==o||t[16]!==c?(u=(0,Z.jsxs)(r,{children:[o,c]}),t[14]=r,t[15]=o,t[16]=c,t[17]=u):u=t[17];let d;return t[18]!==i||t[19]!==s||t[20]!==u?(d=(0,Z.jsx)(i,{delayDuration:s,children:u}),t[18]=i,t[19]=s,t[20]=u,t[21]=d):d=t[21],d}function Dt(e){(e.key===`Enter`||e.key===` `)&&e.stopPropagation()}function Ot(e){let t=[];for(let n of e){if(n.path===`.agents/skills`&&n.type===`folder`&&n.children)for(let e of n.children)e.type===`folder`&&t.push(e);n.children&&n.children.length>0&&t.push(...Ot(n.children))}return t}function kt(e){return`${e.disableModelInvocation?`Enable`:`Disable`} model invocation for ${e.name}`}function At(e){return e?{title:`MCP server installed`,description:`Its MCP servers were added to this project.`}:{title:`Plugin installed`,description:`Its skills and MCP servers were added to this project.`}}function jt(e){return e?.disableModelInvocation?{title:`Enable model invocation?`,description:`"${e.name}" will be offered to the model automatically again, so its description counts towards the context window.`,actionLabel:`Enable`,nextDisableModelInvocation:!1}:{title:`Disable model invocation?`,description:`"${e?.name}" will no longer be offered to the model automatically, so its description stops counting towards the context window. Invoke it manually with /${e?.name}.`,actionLabel:`Disable`,nextDisableModelInvocation:!0}}function Mt(e){let t=(0,Y.c)(24),{skills:n,threadId:r,onOpenSkill:i,onDelete:o,onAddManual:s,onAddUrl:c,onChangeModelInvocation:u}=e,d=!r,f;t[0]!==s||t[1]!==c?(f=e=>{e===`manual`?s():c()},t[0]=s,t[1]=c,t[2]=f):f=t[2];let p;t[3]!==d||t[4]!==f?(p=(0,Z.jsx)(K,{title:`Installed Skills`,description:`Reusable instruction sets that guide agent behavior in this project.`,action:(0,Z.jsx)(xt,{manualDisabled:d,onSelectMode:f}),sticky:!1}),t[3]=d,t[4]=f,t[5]=p):p=t[5];let m;t[6]===r?m=t[7]:(m=!r&&(0,Z.jsx)(ye,{children:`Select a thread to add or install skills.`}),t[6]=r,t[7]=m);let h;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(h={icon:_,title:`No skills installed`,description:`Add skills to extend agent capabilities with reusable instructions.`},t[8]=h):h=t[8];let g;t[9]===u?g=t[10]:(g=e=>(0,Z.jsxs)(`span`,{className:l(a.body,`flex min-w-0 items-center gap-2 text-left`),children:[(0,Z.jsx)(Et,{description:e.description,disableModelInvocation:e.disableModelInvocation,builtIn:e.virtual,onClick:e.virtual?void 0:()=>u(e),ariaLabel:kt(e)}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.name})]}),t[9]=u,t[10]=g);let v;t[11]===i?v=t[12]:(v=e=>i(e.path),t[11]=i,t[12]=v);let y;t[13]!==o||t[14]!==n||t[15]!==g||t[16]!==v?(y=(0,Z.jsx)(We,{showHeader:!1,compact:!0,loading:!1,items:n,emptyState:h,getKey:Ft,renderContent:g,onItemClick:v,itemClickLabel:Pt,onDelete:o,deleteAriaLabel:Nt,deleteTooltip:`Remove this skill from the project`}),t[13]=o,t[14]=n,t[15]=g,t[16]=v,t[17]=y):y=t[17];let b;t[18]!==m||t[19]!==y?(b=(0,Z.jsxs)(ze,{className:`pt-6`,children:[m,y]}),t[18]=m,t[19]=y,t[20]=b):b=t[20];let x;return t[21]!==p||t[22]!==b?(x=(0,Z.jsxs)(Te,{className:`shrink-0`,children:[p,b]}),t[21]=p,t[22]=b,t[23]=x):x=t[23],x}function Nt(e){return`Delete ${e.name}`}function Pt(e){return`Open ${e.name} in Files`}function Ft(e){return e.id}function It(e){let t=(0,Y.c)(24),{open:n,onOpenChange:r,skill:i,onConfirm:a}=e,o;t[0]===i?o=t[1]:(o=jt(i),t[0]=i,t[1]=o);let s=o,c;t[2]===s.title?c=t[3]:(c=(0,Z.jsx)(fe,{children:s.title}),t[2]=s.title,t[3]=c);let l;t[4]===s.description?l=t[5]:(l=(0,Z.jsx)(de,{children:s.description}),t[4]=s.description,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,Z.jsxs)(_e,{children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(ge,{children:`Cancel`}),t[9]=d):d=t[9];let f;t[10]!==s.nextDisableModelInvocation||t[11]!==a||t[12]!==i?(f=()=>{i&&a(i,s.nextDisableModelInvocation)},t[10]=s.nextDisableModelInvocation,t[11]=a,t[12]=i,t[13]=f):f=t[13];let p;t[14]!==s.actionLabel||t[15]!==f?(p=(0,Z.jsxs)(he,{children:[d,(0,Z.jsx)(me,{onClick:f,children:s.actionLabel})]}),t[14]=s.actionLabel,t[15]=f,t[16]=p):p=t[16];let m;t[17]!==u||t[18]!==p?(m=(0,Z.jsxs)(pe,{children:[u,p]}),t[17]=u,t[18]=p,t[19]=m):m=t[19];let h;return t[20]!==r||t[21]!==n||t[22]!==m?(h=(0,Z.jsx)(ve,{open:n,onOpenChange:r,children:m}),t[20]=r,t[21]=n,t[22]=m,t[23]=h):h=t[23],h}function Lt(){let e=(0,Y.c)(10),[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(!1),[s,c]=(0,X.useState)(null),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(null),[p,m]=(0,X.useState)(!1),h;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(h=function(e){f(e),m(!0)},e[0]=h):h=e[0];let g=h,_;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(_=function(e){e||u(null)},e[1]=_):_=e[1];let v=_,y;return e[2]!==d||e[3]!==s||e[4]!==l||e[5]!==t||e[6]!==a||e[7]!==p||e[8]!==r?(y={showAddDialog:t,setShowAddDialog:n,showUrlDialog:r,setShowUrlDialog:i,showAddSourceDialog:a,setShowAddSourceDialog:o,pluginImportUrl:s,setPluginImportUrl:c,previewSkill:l,setPreviewSkill:u,invocationSkill:d,showInvocationDialog:p,setShowInvocationDialog:m,openInvocationDialog:g,handlePreviewDialogOpenChange:v},e[2]=d,e[3]=s,e[4]=l,e[5]=t,e[6]=a,e[7]=p,e[8]=r,e[9]=y):y=e[9],y}var Q=`skills:popular`;function Rt(e){return e.map(e=>`${e.id}~${e.name}~${e.description}`).join(`|`)}function zt(){let e=(0,Y.c)(5),[t,n]=(0,X.useState)(Ht),[r,i]=(0,X.useState)(Vt),a,o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{le().then(e=>{Xe(Q,e),n(t=>Rt(t)===Rt(e)?t:e)}).catch(Bt).finally(()=>i(!1))},o=[],e[0]=a,e[1]=o):(a=e[0],o=e[1]),(0,X.useEffect)(a,o);let s;return e[2]!==r||e[3]!==t?(s={popularSkills:t,loadingPopularSkills:r},e[2]=r,e[3]=t,e[4]=s):s=e[4],s}function Bt(){}function Vt(){return!Ze(Q)}function Ht(){return Qe(Q)??[]}var $=new Map;function Ut(e){let t=$.get(e);if(t)return t;let n=ce(e).finally(()=>{$.delete(e)});return $.set(e,n),n}function Wt(e,t){return t.map(t=>({...t,sourceId:t.sourceId??e}))}function Gt(){let e=(0,Y.c)(18),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0];let[n,r]=(0,X.useState)(t),[i,a]=(0,X.useState)(ue),o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=[],e[1]=o):o=e[1];let[s,c]=(0,X.useState)(o),[l,u]=(0,X.useState)(!1),[d,f]=(0,X.useState)(!1),p;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(p=async()=>{try{r(await F())}catch{r([])}},e[2]=p):p=e[2];let m=p,h,g;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(h=()=>{(async function(){let e=M();if(e.length>0)try{await D(e),P()}catch{}await m()})()},g=[m],e[3]=h,e[4]=g):(h=e[3],g=e[4]),(0,X.useEffect)(h,g);let _;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>{a(e),oe(e)},e[5]=_):_=e[5];let v=_,y;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>{r(t=>[...t.filter(t=>t.id!==e.id),e].sort(qt)),v(e.id)},e[6]=y):y=e[6];let b=y,x;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(x=e=>{r(t=>t.map(t=>t.id===e.id?e:t).sort(Kt)),E(e.id)},e[7]=x):x=e[7];let S=x,C;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>{r(t=>t.filter(t=>t.id!==e)),E(e),a(t=>t===e?(oe(`default`),`default`):t)},e[8]=C):C=e[8];let w=C,T,O;e[9]===i?(T=e[10],O=e[11]):(O=()=>{if(i==="default"){c([]),u(!1),f(!1);return}let e=j(i);e?.skills?(c(Wt(i,e.skills)),u(!1)):(c([]),u(!0));let t=!1;return f(!!e?.skills),Ut(i).then(e=>{if(t)return;let n=Wt(i,e);c(n),ae(i,{fetchedAt:Date.now(),skills:n})}).catch(n=>{t||(e?.skills||c([]),R({title:`Error`,description:n instanceof Error?n.message:`Failed to load skill catalog`,variant:`destructive`}))}).finally(()=>{t||(u(!1),f(!1))}),()=>{t=!0}},T=[i],e[9]=i,e[10]=T,e[11]=O),(0,X.useEffect)(O,T);let k;return e[12]!==s||e[13]!==l||e[14]!==d||e[15]!==i||e[16]!==n?(k={sources:n,selectedSourceId:i,setSelectedSourceId:v,addSource:b,updateSource:S,removeSource:w,reloadSources:m,catalogSkills:s,isLoadingCatalog:l,isRefreshingCatalog:d},e[12]=s,e[13]=l,e[14]=d,e[15]=i,e[16]=n,e[17]=k):k=e[17],k}function Kt(e,t){return e.title.localeCompare(t.title)}function qt(e,t){return e.title.localeCompare(t.title)}function Jt(e){let t=(0,Y.c)(26),{popularSkills:n,loadingPopularSkills:r}=zt(),{sources:i,selectedSourceId:a,setSelectedSourceId:s,addSource:c,updateSource:l,removeSource:u,catalogSkills:d,isLoadingCatalog:f}=Gt(),{query:p,setQuery:m,deferredQuery:h}=Ge(),g=a==="default",_;t[0]!==a||t[1]!==i?(_=o(a)?i.find(e=>e.id===a)??null:null,t[0]=a,t[1]=i,t[2]=_):_=t[2];let v=_,y=!g&&f&&d.length===0,b;t[3]!==h||t[4]!==e||t[5]!==n?(b=ot(n,h,e),t[3]=h,t[4]=e,t[5]=n,t[6]=b):b=t[6];let x=b,S;t[7]!==d||t[8]!==h||t[9]!==e?(S=ot(d,h,e),t[7]=d,t[8]=h,t[9]=e,t[10]=S):S=t[10];let C=S,w;return t[11]!==c||t[12]!==C||t[13]!==y||t[14]!==x||t[15]!==p||t[16]!==g||t[17]!==r||t[18]!==u||t[19]!==v||t[20]!==a||t[21]!==m||t[22]!==s||t[23]!==i||t[24]!==l?(w={availableSearch:p,setAvailableSearch:m,availablePopular:x,availableCatalog:C,availableCatalogLoading:y,isDefaultSource:g,selectedCustomSource:v,sources:i,selectedSourceId:a,setSelectedSourceId:s,addSource:c,updateSource:l,removeSource:u,loadingPopularSkills:r},t[11]=c,t[12]=C,t[13]=y,t[14]=x,t[15]=p,t[16]=g,t[17]=r,t[18]=u,t[19]=v,t[20]=a,t[21]=m,t[22]=s,t[23]=i,t[24]=l,t[25]=w):w=t[25],w}async function Yt(e,t){let n=rt(t.id);if(!e.threadId||e.installedFilePaths.has(n))return;let r=t.sourceId??(e.selectedSourceId==="default"?void 0:e.selectedSourceId);try{r?await se(e.threadId,r,t.id,nt(t.id)):await N(e.threadId,n,at(t)),e.setInstalledFilePaths(e=>new Set(e).add(n)),e.triggerExplorerRefresh(),e.reloadSkills(),R({title:`Skill installed`,description:t.name})}catch(e){throw R({title:`Error`,description:e instanceof Error?e.message:`Failed to install skill`,variant:`destructive`}),e}}async function Xt(e,t,n){if(e.projectId)try{try{await ee(e.projectId,t.name,n)}catch{if(!e.threadId)throw Error(`No thread selected to update this skill`);await I(e.threadId,t.name,n)}e.triggerExplorerRefresh(),await e.reloadSkills(),R({title:n?`Model invocation disabled`:`Model invocation enabled`,description:n?`${t.name} is now invoked manually with /${t.name}.`:`${t.name} is offered to the model again.`})}catch(e){R({title:`Error`,description:e instanceof Error?e.message:`Failed to update skill`,variant:`destructive`})}}function Zt(){let e=(0,Y.c)(34),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={findItems:Ot,installedPathSuffix:`/SKILL.md`,explorerPathSuffix:`/SKILL.md`,sortByName:!0,removedToastTitle:`Skill removed`},e[0]=t):t=e[0];let n=$e(t),r=s(Qt),i=r.find(e=>e.projectId===n.selectedProjectId)??null,a=Lt(),o=Jt(n.installedFilePaths),l;e[1]!==o.loadingPopularSkills||e[2]!==n.loading?(l=[n.loading,o.loadingPopularSkills],e[1]=o.loadingPopularSkills,e[2]=n.loading,e[3]=l):l=e[3];let u=Ve(n.selectedProjectId?`${n.selectedProjectId}:${n.selectedThreadId??``}`:null,l),d;e[4]!==o.selectedSourceId||e[5]!==n.installedFilePaths||e[6]!==n.loadItems||e[7]!==n.selectedThreadId||e[8]!==n.setInstalledFilePaths||e[9]!==n.triggerExplorerRefresh?(d=function(e){return Yt({threadId:n.selectedThreadId,selectedSourceId:o.selectedSourceId,installedFilePaths:n.installedFilePaths,setInstalledFilePaths:n.setInstalledFilePaths,triggerExplorerRefresh:n.triggerExplorerRefresh,reloadSkills:n.loadItems},e)},e[4]=o.selectedSourceId,e[5]=n.installedFilePaths,e[6]=n.loadItems,e[7]=n.selectedThreadId,e[8]=n.setInstalledFilePaths,e[9]=n.triggerExplorerRefresh,e[10]=d):d=e[10];let f=d,p;e[11]!==n.loadItems||e[12]!==n.selectedProjectId||e[13]!==n.selectedThreadId||e[14]!==n.triggerExplorerRefresh?(p=function(e,t){return Xt({projectId:n.selectedProjectId,threadId:n.selectedThreadId,triggerExplorerRefresh:n.triggerExplorerRefresh,reloadSkills:n.loadItems},e,t)},e[11]=n.loadItems,e[12]=n.selectedProjectId,e[13]=n.selectedThreadId,e[14]=n.triggerExplorerRefresh,e[15]=p):p=e[15];let m=p,h;e[16]===n?h=e[17]:(h=function(e){e||n.setDeleteConfirm(null)},e[16]=n,e[17]=h);let g=h,_;e[18]===n?_=e[19]:(_=function(){n.deleteConfirm&&n.handleDelete(n.deleteConfirm)},e[18]=n,e[19]=_);let v=_,y;e[20]===n?y=e[21]:(y=function(e){n.loadItems(),n.triggerExplorerRefresh(),R(At(e))},e[20]=n,e[21]=y);let b=y,x=i?c(i):null,S;return e[22]!==o||e[23]!==a||e[24]!==m||e[25]!==v||e[26]!==g||e[27]!==f||e[28]!==b||e[29]!==n||e[30]!==u||e[31]!==r||e[32]!==x?(S={installed:n,projects:r,selectedProjectName:x,dialogs:a,available:o,pageLoading:u,handleInstallPreviewSkill:f,handleConfirmModelInvocation:m,handleDeleteDialogOpenChange:g,handleDeleteConfirm:v,handlePluginInstalled:b},e[22]=o,e[23]=a,e[24]=m,e[25]=v,e[26]=g,e[27]=f,e[28]=b,e[29]=n,e[30]=u,e[31]=r,e[32]=x,e[33]=S):S=e[33],S}function Qt(e){return e.projects}function $t(){let e=(0,Y.c)(101),t=Zt(),{installed:n,dialogs:r,available:i}=t;if(!n.selectedProjectId){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(Ae,{children:`Select a project to manage skills.`}),e[0]=t):t=e[0],t}let a,o;e[1]===r?(a=e[2],o=e[3]):(a=()=>r.setShowAddDialog(!0),o=()=>r.setShowUrlDialog(!0),e[1]=r,e[2]=a,e[3]=o);let s;e[4]!==r.openInvocationDialog||e[5]!==n.handleOpenInExplorer||e[6]!==n.items||e[7]!==n.selectedThreadId||e[8]!==n.setDeleteConfirm||e[9]!==a||e[10]!==o?(s=(0,Z.jsx)(Mt,{skills:n.items,threadId:n.selectedThreadId,onOpenSkill:n.handleOpenInExplorer,onDelete:n.setDeleteConfirm,onAddManual:a,onAddUrl:o,onChangeModelInvocation:r.openInvocationDialog}),e[4]=r.openInvocationDialog,e[5]=n.handleOpenInExplorer,e[6]=n.items,e[7]=n.selectedThreadId,e[8]=n.setDeleteConfirm,e[9]=a,e[10]=o,e[11]=s):s=e[11];let c;e[12]===r?c=e[13]:(c=e=>r.setPreviewSkill(e),e[12]=r,e[13]=c);let l;e[14]!==i.selectedSourceId||e[15]!==r?(l=e=>r.setPreviewSkill({...e,sourceId:e.sourceId??i.selectedSourceId}),e[14]=i.selectedSourceId,e[15]=r,e[16]=l):l=e[16];let u;e[17]===r?u=e[18]:(u=()=>r.setShowAddSourceDialog(!0),e[17]=r,e[18]=u);let d;e[19]!==i.availableCatalog||e[20]!==i.availableCatalogLoading||e[21]!==i.availablePopular||e[22]!==i.availableSearch||e[23]!==i.isDefaultSource||e[24]!==i.selectedCustomSource||e[25]!==i.selectedSourceId||e[26]!==i.setAvailableSearch||e[27]!==i.setSelectedSourceId||e[28]!==i.sources||e[29]!==c||e[30]!==l||e[31]!==u?(d=(0,Z.jsx)(vt,{availableSearch:i.availableSearch,onSearchChange:i.setAvailableSearch,selectedSourceId:i.selectedSourceId,onSourceChange:i.setSelectedSourceId,sources:i.sources,selectedCustomSource:i.selectedCustomSource,availableCatalogLoading:i.availableCatalogLoading,isDefaultSource:i.isDefaultSource,availablePopular:i.availablePopular,availableCatalog:i.availableCatalog,onPreviewPopular:c,onPreviewCatalog:l,onAddSource:u}),e[19]=i.availableCatalog,e[20]=i.availableCatalogLoading,e[21]=i.availablePopular,e[22]=i.availableSearch,e[23]=i.isDefaultSource,e[24]=i.selectedCustomSource,e[25]=i.selectedSourceId,e[26]=i.setAvailableSearch,e[27]=i.setSelectedSourceId,e[28]=i.sources,e[29]=c,e[30]=l,e[31]=u,e[32]=d):d=e[32];let f;e[33]!==t.pageLoading||e[34]!==s||e[35]!==d?(f=(0,Z.jsxs)(Ce,{loading:t.pageLoading,children:[s,d]}),e[33]=t.pageLoading,e[34]=s,e[35]=d,e[36]=f):f=e[36];let p=r.previewSkill!==null,m=i.isDefaultSource?void 0:i.selectedSourceId,h;e[37]!==r.handlePreviewDialogOpenChange||e[38]!==r.previewSkill||e[39]!==t.handleInstallPreviewSkill||e[40]!==p||e[41]!==m?(h=(0,Z.jsx)(dt,{open:p,onOpenChange:r.handlePreviewDialogOpenChange,skill:r.previewSkill,catalogSourceId:m,onInstall:t.handleInstallPreviewSkill}),e[37]=r.handlePreviewDialogOpenChange,e[38]=r.previewSkill,e[39]=t.handleInstallPreviewSkill,e[40]=p,e[41]=m,e[42]=h):h=e[42];let g;e[43]!==r.invocationSkill||e[44]!==r.setShowInvocationDialog||e[45]!==r.showInvocationDialog||e[46]!==t.handleConfirmModelInvocation?(g=(0,Z.jsx)(It,{open:r.showInvocationDialog,onOpenChange:r.setShowInvocationDialog,skill:r.invocationSkill,onConfirm:t.handleConfirmModelInvocation}),e[43]=r.invocationSkill,e[44]=r.setShowInvocationDialog,e[45]=r.showInvocationDialog,e[46]=t.handleConfirmModelInvocation,e[47]=g):g=e[47];let _,v,y;e[48]===i?(_=e[49],v=e[50],y=e[51]):(_=e=>{i.addSource(e),R({title:`Skill source added`,description:`${e.title} is now available in the source list.`})},v=e=>{i.updateSource(e),R({title:`Skill source updated`,description:`${e.title} has been saved.`})},y=e=>{i.removeSource(e),R({title:`Skill source removed`,description:`The custom source has been deleted.`})},e[48]=i,e[49]=_,e[50]=v,e[51]=y);let b;e[52]!==i.selectedCustomSource||e[53]!==r.setShowAddSourceDialog||e[54]!==r.showAddSourceDialog||e[55]!==_||e[56]!==v||e[57]!==y?(b=(0,Z.jsx)(ft,{open:r.showAddSourceDialog,onOpenChange:r.setShowAddSourceDialog,editingSource:i.selectedCustomSource,onSourceAdded:_,onSourceUpdated:v,onSourceDeleted:y}),e[52]=i.selectedCustomSource,e[53]=r.setShowAddSourceDialog,e[54]=r.showAddSourceDialog,e[55]=_,e[56]=v,e[57]=y,e[58]=b):b=e[58];let x;e[59]!==r||e[60]!==n?(x=()=>{r.setShowAddDialog(!1),n.loadItems(),n.triggerExplorerRefresh()},e[59]=r,e[60]=n,e[61]=x):x=e[61];let S;e[62]!==n.selectedThreadId||e[63]!==x?(S=(0,Z.jsx)(J,{className:`max-w-2xl max-h-[90vh] overflow-y-auto p-0`,children:(0,Z.jsx)(et,{threadId:n.selectedThreadId,onSkillCreated:x})}),e[62]=n.selectedThreadId,e[63]=x,e[64]=S):S=e[64];let C;e[65]!==r.setShowAddDialog||e[66]!==r.showAddDialog||e[67]!==S?(C=(0,Z.jsx)(U,{open:r.showAddDialog,onOpenChange:r.setShowAddDialog,children:S}),e[65]=r.setShowAddDialog,e[66]=r.showAddDialog,e[67]=S,e[68]=C):C=e[68];let w;e[69]===r?w=e[70]:(w=e=>r.setPluginImportUrl(e),e[69]=r,e[70]=w);let T;e[71]!==r.setShowUrlDialog||e[72]!==r.showUrlDialog||e[73]!==w?(T=(0,Z.jsx)(mt,{open:r.showUrlDialog,onOpenChange:r.setShowUrlDialog,onSubmit:w}),e[71]=r.setShowUrlDialog,e[72]=r.showUrlDialog,e[73]=w,e[74]=T):T=e[74];let E;e[75]===r?E=e[76]:(E=()=>r.setPluginImportUrl(null),e[75]=r,e[76]=E);let D;e[77]===t?D=e[78]:(D=e=>{let{mcpOnly:n}=e;t.handlePluginInstalled(n)},e[77]=t,e[78]=D);let O;e[79]!==r.pluginImportUrl||e[80]!==n.selectedProjectId||e[81]!==t.projects||e[82]!==t.selectedProjectName||e[83]!==E||e[84]!==D?(O=(0,Z.jsx)(Fe,{url:r.pluginImportUrl,projectId:n.selectedProjectId,projectName:t.selectedProjectName,projects:t.projects,onSelectProject:en,onClose:E,onInstalled:D}),e[79]=r.pluginImportUrl,e[80]=n.selectedProjectId,e[81]=t.projects,e[82]=t.selectedProjectName,e[83]=E,e[84]=D,e[85]=O):O=e[85];let k=n.deleteConfirm!==null,A=`Are you sure you want to delete the skill "${n.deleteConfirm?.name}"? This action cannot be undone.`,j;e[86]!==n.deleting||e[87]!==t.handleDeleteConfirm||e[88]!==t.handleDeleteDialogOpenChange||e[89]!==k||e[90]!==A?(j=(0,Z.jsx)(Be,{open:k,onOpenChange:t.handleDeleteDialogOpenChange,title:`Delete Skill`,description:A,onConfirm:t.handleDeleteConfirm,confirming:n.deleting}),e[86]=n.deleting,e[87]=t.handleDeleteConfirm,e[88]=t.handleDeleteDialogOpenChange,e[89]=k,e[90]=A,e[91]=j):j=e[91];let M;return e[92]!==h||e[93]!==g||e[94]!==b||e[95]!==C||e[96]!==T||e[97]!==O||e[98]!==j||e[99]!==f?(M=(0,Z.jsxs)(Z.Fragment,{children:[f,h,g,b,C,T,O,j]}),e[92]=h,e[93]=g,e[94]=b,e[95]=C,e[96]=T,e[97]=O,e[98]=j,e[99]=f,e[100]=M):M=e[100],M}function en(){}export{$t as SettingsSkillsView,$t as default};
|