@engenty/wizards-runtime 0.19.0 → 0.19.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/apps/runtime/dist/engine/runner.js +20 -7
  2. package/apps/runtime/dist/prompts/architect.md +3 -3
  3. package/apps/runtime/dist/prompts/authoring.md +4 -3
  4. package/apps/runtime/dist/services/work-chats.js +14 -6
  5. package/apps/runtime/dist/sharing/state.js +7 -3
  6. package/apps/web/dist/assets/{AboutDialog-BxT7chz8.js → AboutDialog-BUWu36Mb.js} +1 -1
  7. package/apps/web/dist/assets/{BlockEditor-BX8ZxxIc.js → BlockEditor-1-EvUIta.js} +1 -1
  8. package/apps/web/dist/assets/{Bundle-Dkpi5E6W.js → Bundle-RNkjBwAL.js} +1 -1
  9. package/apps/web/dist/assets/{CapabilitiesPage-CfSb23wy.js → CapabilitiesPage-fgTP28Mn.js} +2 -2
  10. package/apps/web/dist/assets/{ChangelogDialog-j-vHLy-V.js → ChangelogDialog-C_ZZLRZT.js} +1 -1
  11. package/apps/web/dist/assets/{CodeEditor-CfM2A-yS.js → CodeEditor-BEJKIMd0.js} +1 -1
  12. package/apps/web/dist/assets/{ConnectorsSection-fRBZYfZu.js → ConnectorsSection-iLrduYak.js} +1 -1
  13. package/apps/web/dist/assets/EditorPage-CRZte0O1.js +3 -0
  14. package/apps/web/dist/assets/{FlowPreview-E0kuvM5n.js → FlowPreview-ptI86Ogs.js} +1 -1
  15. package/apps/web/dist/assets/{LangSwitch-DhQmCtyY.js → LangSwitch-BNa_H8AR.js} +1 -1
  16. package/apps/web/dist/assets/Marketplace-9aGWG2pJ.js +2 -0
  17. package/apps/web/dist/assets/{NewWizardChannels-BATgI9GR.js → NewWizardChannels-BFDm9vCT.js} +1 -1
  18. package/apps/web/dist/assets/{NewWizardPage-B5V5ScKh.js → NewWizardPage-ueGFlLDo.js} +1 -1
  19. package/apps/web/dist/assets/{OnboardingPage-DWpDqlCi.js → OnboardingPage-DtDd7k_O.js} +1 -1
  20. package/apps/web/dist/assets/{PreviewPane-Br2w92Wh.js → PreviewPane-CEltrf_-.js} +2 -2
  21. package/apps/web/dist/assets/ProtocolSection-Bb3c44Te.js +1 -0
  22. package/apps/web/dist/assets/{PublicRunner-Cjhfeqi3.js → PublicRunner-BaTg24s3.js} +1 -1
  23. package/apps/web/dist/assets/{ReadOnly-CkToYpY5.js → ReadOnly-YF0RkR7P.js} +1 -1
  24. package/apps/web/dist/assets/{Results-C9qxCpUQ.js → Results-DJRLiVo0.js} +1 -1
  25. package/apps/web/dist/assets/{RunDrawer-BRXH71U8.js → RunDrawer-CSpTNJp-.js} +1 -1
  26. package/apps/web/dist/assets/{SettingsPage-Dobd7tAA.js → SettingsPage--_ap3omw.js} +2 -2
  27. package/apps/web/dist/assets/{SetupPage-BkMjwBlV.js → SetupPage-ELKHbmnE.js} +1 -1
  28. package/apps/web/dist/assets/{SharePage-Boj1R928.js → SharePage-OiKEnmL1.js} +1 -1
  29. package/apps/web/dist/assets/{SkillEditor-DtVRUYqS.js → SkillEditor-C1_zwNOQ.js} +1 -1
  30. package/apps/web/dist/assets/{Skills-DK1Pv-Xh.js → Skills-_pLGtOjH.js} +1 -1
  31. package/apps/web/dist/assets/{SpacePage-CjgBRkkw.js → SpacePage-r4EbxEJe.js} +2 -2
  32. package/apps/web/dist/assets/{StudioHome-B5HcJJ4Q.js → StudioHome-CwvxI29m.js} +1 -1
  33. package/apps/web/dist/assets/{UpdateCheck-DFor0F9T.js → UpdateCheck-BpdsLIOc.js} +2 -2
  34. package/apps/web/dist/assets/{brand-Ij-I_Lms.js → brand-ByQY-UcL.js} +1 -1
  35. package/apps/web/dist/assets/changelog-Dt-V-BKp.js +1 -0
  36. package/apps/web/dist/assets/{code-editor-BVgSljQq.js → code-editor-B8zG80PA.js} +2 -2
  37. package/apps/web/dist/assets/{host-BELYIPMT.js → host-Ckjz94Ea.js} +6 -6
  38. package/apps/web/dist/assets/{i18n-DPqdH1PJ.js → i18n-ClCOlfx2.js} +1 -1
  39. package/apps/web/dist/assets/{index-wJZVaKLg.js → index-BHKh0A9F.js} +3 -3
  40. package/apps/web/dist/assets/index-D18zQ05f.css +1 -0
  41. package/apps/web/dist/assets/{read-aloud-pd-PWi_5.js → read-aloud-spC7eEBp.js} +1 -1
  42. package/apps/web/dist/assets/{runners-D9DHhaD9.js → runners-DNqzwMQ0.js} +1 -1
  43. package/apps/web/dist/assets/{session-Mt-n8MI0.js → session-Dd9duhPc.js} +1 -1
  44. package/apps/web/dist/assets/{theme-BQhQx_UL.js → theme-DumM6FI_.js} +1 -1
  45. package/apps/web/dist/assets/{ui-D4qQLcbs.js → ui-BjhZhw8x.js} +1 -1
  46. package/apps/web/dist/assets/{useMutation-CUZC19i3.js → useMutation-CoEdB_9_.js} +1 -1
  47. package/apps/web/dist/assets/{viewers-D-8HZrcq.js → viewers-BmcrgvXX.js} +2 -2
  48. package/apps/web/dist/index.html +13 -13
  49. package/apps/web/dist/mcp/flow.html +3 -3
  50. package/node_modules/@engenty/wizards-shared/dist/run.d.ts +2 -0
  51. package/node_modules/@engenty/wizards-shared/dist/run.js +2 -0
  52. package/node_modules/@engenty/wizards-shared/dist/transition.js +5 -1
  53. package/package.json +1 -1
  54. package/plugin/.claude-plugin/plugin.json +1 -1
  55. package/plugin/plugin.json +1 -1
  56. package/apps/web/dist/assets/EditorPage-CrFyN_Qn.js +0 -3
  57. package/apps/web/dist/assets/Marketplace-BdkNOARm.js +0 -2
  58. package/apps/web/dist/assets/ProtocolSection-DMCojdZu.js +0 -1
  59. package/apps/web/dist/assets/changelog-n9RARUzp.js +0 -1
  60. package/apps/web/dist/assets/index-CVZlO0z3.css +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./useMutation-CUZC19i3.js";import{$ as n,An as r,Wr as i,_r as a,ar as o,nn as s,or as ee,vn as c}from"./ui-D4qQLcbs.js";import{u as l}from"./marked.esm-BfGIZK7F.js";import{Cn as u,H as d,Jt as te,K as ne,Kt as re,Sn as ie,V as f,Yt as p,or as m,qt as h}from"./host-BELYIPMT.js";import{n as g,t as _}from"./jsx-runtime-C3cWAN_r.js";import{a as ae,c as oe,n as v}from"./brand-Ij-I_Lms.js";import{t as y}from"./logo-xL-sneZz.js";import{n as b,s as x}from"./i18n-DPqdH1PJ.js";import{h as se,u as ce,v as le}from"./session-Mt-n8MI0.js";import{r as ue}from"./LangSwitch-DhQmCtyY.js";var S=e(g(),1),C=e(_(),1),w=`oklch(50% 0.2 262)`,T=`oklch(32% 0.15 262)`,E=`oklch(90% 0.1 80)`,D=`var(--step-done)`,O=`var(--step-now)`,k=`color-mix(in oklab, var(--on) 38%, transparent)`,de={"--on":`white`,"--tile":`rgb(255 255 255 / 0.1)`,"--tile-hover":`rgb(255 255 255 / 0.15)`,"--tile-ring":`rgb(255 255 255 / 0.15)`,"--panel":`rgb(255 255 255 / 0.07)`,"--panel-ring":`rgb(255 255 255 / 0.12)`,"--pick":`white`,"--pick-ink":T,"--pick-mark":T,"--dot":E,"--step-done":`oklch(88% 0.17 150)`,"--step-now":`oklch(88% 0.14 80)`,"--ready-ink":`oklch(27% 0.09 150)`,"--ink-2":`oklch(96% 0.02 262)`,"--ink-3":`oklch(90% 0.035 262)`,"--ink-4":`oklch(82% 0.05 262)`,"--moss":`oklch(90% 0.14 150)`,"--rose":`oklch(89% 0.09 45)`},fe={"--on":`var(--ink)`,"--tile":`var(--card)`,"--tile-hover":`var(--paper-2)`,"--tile-ring":`var(--border-soft)`,"--panel":`var(--card)`,"--panel-ring":`var(--border-soft)`,"--pick":w,"--pick-ink":`white`,"--pick-mark":`white`,"--dot":w,"--step-done":`oklch(52% 0.15 150)`,"--step-now":`oklch(60% 0.15 65)`,"--ready-ink":`white`},A=`ease-[cubic-bezier(0.3,0.7,0.2,1)]`,pe=220,me={codex:`dome`,claude:`oval`,antigravity:`wedge`,cursor:`sprout`,own:`bean`,account:`drop`,apple:`pebble`};function he(e){if(e.available)return x(`models.optAppleNote`);switch(e.reason){case`off`:return x(`models.appleOff`);case`loading`:return x(`models.appleLoading`);default:return x(`models.appleDevice`)}}var j=`relative w-fit max-w-full transition-[left,translate] duration-700 ease-[cubic-bezier(0.3,0.7,0.2,1)] motion-reduce:transition-none`,M=`left-1/2 -translate-x-1/2 text-center`,N=`max-lg:left-1/2 max-lg:-translate-x-1/2 max-lg:text-center lg:left-0 lg:translate-x-0 lg:text-left`;function P(){window.matchMedia(`(max-width: 1023px)`).matches&&window.scrollTo({top:0})}var F=`wizards.setup.own`;function ge(){try{return sessionStorage.getItem(F)===`1`}catch{return!1}}function _e(e){try{e?sessionStorage.setItem(F,`1`):sessionStorage.removeItem(F)}catch{}}function ve(){return(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-2.5`,children:[(0,C.jsx)(y,{size:28}),(0,C.jsxs)(`span`,{className:`font-display font-semibold text-[1.0625rem] tracking-tight`,children:[`engenty`,(0,C.jsx)(`span`,{className:`mr-[0.09em] ml-[0.06em] text-(color:--dot)`,children:`.`}),(0,C.jsx)(`span`,{className:`font-normal text-(color:--on)/70`,children:`wizards`})]})]})}function I({selected:e,title:t,description:n,badge:r,note:i,onPick:a}){return(0,C.jsxs)(`button`,{type:`button`,onClick:a,"aria-pressed":e,className:c(`group relative flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left transition-[background-color,color,box-shadow] duration-300`,e?`bg-(color:--pick) text-(color:--pick-ink) shadow-elevated`:`bg-(color:--tile) ring-(color:--tile-ring) ring-1 hover:bg-(color:--tile-hover)`),children:[r?(0,C.jsx)(`span`,{className:`absolute -top-2.5 right-4 rounded-full px-2.5 py-[3px] font-semibold text-[0.6875rem] leading-none tracking-wide shadow-[0_2px_8px_oklch(0%_0_0/0.22)]`,style:{background:E,color:T},children:r}):null,(0,C.jsx)(`span`,{className:c(`flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors duration-300`,e?`border-transparent bg-(color:--pick-mark)`:`border-(color:--on)/40`),children:e?(0,C.jsx)(l,{className:`size-3.5 text-(color:--pick)`}):null}),(0,C.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`span`,{className:`block font-medium text-[0.9375rem]`,children:t}),(0,C.jsx)(`span`,{className:c(`mt-0.5 block truncate text-[0.8125rem]`,e?`opacity-70`:`text-(color:--on)/65`),children:n})]}),i?(0,C.jsx)(`span`,{className:c(`shrink-0 text-[0.75rem]`,e?`opacity-70`:`text-(color:--on)/65`),children:i}):null,(0,C.jsx)(o,{className:c(`size-4 shrink-0 transition`,e?`opacity-70`:`text-(color:--on)/40 group-hover:translate-x-0.5 group-hover:text-(color:--on)/80`)})]})}function ye({name:e,at:t,done:n}){let r=[x(`setup.stage.connect`),x(`setup.stage.test`),x(`setup.stage.done`)],i=n?r.length:t+1;return(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 font-medium text-[0.75rem] uppercase tracking-[0.14em]`,children:[(0,C.jsx)(`span`,{className:`text-(color:--on)/70`,children:e}),(0,C.jsx)(`ol`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:r.map((e,r)=>{let i=n||r<t;return(0,C.jsxs)(`li`,{"aria-current":!i&&r===t?`step`:void 0,className:`flex items-center gap-1 transition-colors duration-500`,style:{color:i?D:r===t?O:k},children:[i?(0,C.jsx)(l,{className:`size-3.5`,strokeWidth:3}):null,e]},e)})}),(0,C.jsx)(`span`,{"aria-hidden":`true`,className:`flex gap-1.5`,children:r.map((e,t)=>(0,C.jsx)(`span`,{className:`h-[3px] w-5 rounded-full transition-colors duration-500`,style:{background:t<i?n?D:O:`color-mix(in oklab, var(--on) 22%, transparent)`}},e))})]})}function be({href:e,children:t}){return(0,C.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`transition hover:text-(color:--on)`,onClick:t=>{t.preventDefault(),p(e)},children:t})}function xe({source:e,signedIn:t,onLocal:n}){let r=d(t),{link:i}=r;return(0,S.useEffect)(()=>{t&&n()},[t,n]),(0,C.jsxs)(`section`,{className:`mx-auto flex w-full max-w-[32rem] animate-rise flex-col items-center text-center`,children:[(0,C.jsx)(v,{kind:`drop`,size:132,fluffy:!0,coat:`fur`}),(0,C.jsxs)(`span`,{className:`mt-4 inline-flex items-center gap-1.5 rounded-full px-3 py-1 font-medium text-[0.75rem]`,style:{color:D,background:`color-mix(in oklab, var(--step-done) 20%, transparent)`},children:[(0,C.jsx)(l,{className:`size-3.5`,strokeWidth:3}),x(`setup.connected`,{name:e})]}),(0,C.jsx)(`h1`,{className:`mt-3 font-display font-semibold text-[1.75rem] leading-[1.08] tracking-[-0.02em]`,children:x(`setup.accountAsk`)}),(0,C.jsx)(`p`,{className:`mt-2.5 text-balance text-(color:--on)/75 text-[0.9375rem] leading-relaxed`,children:x(`setup.accountAskText`)}),(0,C.jsxs)(`div`,{className:`mt-7 flex w-full flex-col gap-4 rounded-2xl bg-(color:--panel) p-5 text-left ring-(color:--panel-ring) ring-1`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-3.5`,children:[(0,C.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-(color:--pick) text-(color:--pick-ink)`,children:(0,C.jsx)(m,{className:`size-4.5`})}),(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`p`,{className:`font-medium text-[0.9375rem]`,children:x(`setup.account`)}),(0,C.jsx)(`p`,{className:`text-(color:--on)/75 text-[0.8125rem] leading-snug`,children:x(`setup.accountText`)})]})]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,C.jsx)(s,{style:{background:`var(--pick)`,color:`var(--pick-ink)`},busy:i.isPending&&!i.variables?.signup,onClick:()=>i.mutate({}),children:x(`account.signIn`)}),(0,C.jsx)(s,{variant:`secondary`,busy:i.isPending&&!!i.variables?.signup,onClick:()=>i.mutate({signup:!0}),children:x(`account.create`)})]}),(0,C.jsx)(f,{...r})]}),(0,C.jsxs)(`button`,{type:`button`,onClick:n,className:`group mt-7 inline-flex items-center gap-1.5 font-medium text-[0.9375rem] underline decoration-(color:--on)/40 underline-offset-4 transition hover:decoration-(color:--on)`,children:[x(`setup.localContinue`),(0,C.jsx)(o,{className:`size-4 transition-transform group-hover:translate-x-0.5`})]}),(0,C.jsx)(`p`,{className:`mt-2 max-w-[44ch] text-balance text-(color:--on)/65 text-[0.8125rem] leading-snug`,children:x(`setup.localContinueNote`)})]})}function L(){let e=u(`site`),o=oe()!==`light`;ae(o?w:null);let p=se(),g=i(),_=a(),y=ie(),E=u(`account`),{space:O}=ce(),k=d(!!p.data?.account?.signedIn),[F,L]=(0,S.useState)(ge),[R,z]=(0,S.useState)(!1),[B,Se]=(0,S.useState)(!1),V=t({mutationFn:e=>n.put(`/api/studio/local/models`,e===`apple`?{bindings:{classifier:`apple:default`,low:`apple:default`}}:e===`own`?{source:`own`,bindings:{classifier:``,low:``}}:{source:e,bindings:le(p.data?.models?.bindings??{})}),onSuccess:async(e,t)=>{await g.invalidateQueries({queryKey:[`me`]}),L(!0),z(!1),P(),_e(t===`own`)}}),H=t({mutationFn:()=>Promise.all((p.data?.harnesses??[]).map(e=>n.post(`/api/studio/local/harness/${e.id}/detect`))),onSuccess:()=>g.invalidateQueries({queryKey:[`me`]})});if(!p.data?.models)return null;let U=p.data.models,W=e=>(e.version===null?2:0)+ +!e.app,G=[...p.data.harnesses].sort((e,t)=>W(e)-W(t)),Ce=G.filter(e=>e.version!==null),K=p.data.apple,q=U.bindings.low?.startsWith(`apple:`)?`apple`:F||p.data.setupDone||U.source!==`own`?U.source:null,J=p.data.harnesses.find(e=>e.id===q),we=U.source===`account`?x(`models.creditsName`):p.data.harnesses.find(e=>e.id===U.source)?.name??null,Y=p.data.setupDone,Te=Object.values(U.keys).some(Boolean),Ee=Y?2:J?J.auth===`none`?0:1:q===`apple`||q===`account`||Te?1:0,De=Y?x(`setup.h.done`):J?J.version===null?x(`setup.h.install`,{name:J.name}):J.auth===`none`?x(`setup.h.signIn`,{name:J.name}):x(`setup.h.test`):x(q===`apple`||q===`account`||Te?`setup.h.test`:`setup.h.keys`),X=e?y.data?.site:null,Z=q!==null&&!R,Q=V.isPending?V.variables??q:q,Oe=!!p.data.account?.signedIn,ke=J?.name??x(q===`apple`?`models.optApple`:q===`account`?`setup.creditsChoice`:`local.sourceOwn`),$=()=>_(`/`,{replace:!0});return(0,C.jsxs)(`div`,{className:`flex min-h-dvh flex-col px-6 text-(color:--on) sm:px-10`,style:o?de:fe,children:[(0,C.jsxs)(`header`,{className:`flex items-center justify-between pt-6 sm:pt-8`,children:[(0,C.jsx)(ve,{}),(0,C.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(ne,{tone:o?`ground`:`surface`}),(0,C.jsx)(ue,{tone:o?`ground`:`surface`,ink:T})]})]}),(0,C.jsxs)(`main`,{className:`relative mx-auto flex w-full max-w-6xl flex-1 flex-col pt-6 pb-10 lg:pt-[6vh]`,children:[B?(0,C.jsx)(xe,{source:ke,signedIn:Oe,onLocal:$}):null,(0,C.jsx)(`div`,{"aria-hidden":`true`,className:c(`absolute top-6 left-1/2 z-10 origin-top -translate-x-1/2 transition-[opacity,scale,left] duration-500 motion-reduce:transition-none lg:top-[calc(6vh+5.25rem)] lg:origin-center lg:translate-x-0`,A,q?`lg:pointer-events-none lg:left-[calc(50%-560px)] lg:scale-75 lg:opacity-0`:`lg:left-[calc(50%-508px)] lg:scale-100 lg:opacity-100`,Z?`max-lg:pointer-events-none max-lg:scale-[0.4] max-lg:opacity-0`:`max-lg:scale-[0.6] max-lg:opacity-100`),children:(0,C.jsx)(`div`,{className:`animate-rise`,children:(0,C.jsx)(v,{kind:`drop`,size:pe,fluffy:!0,coat:`fur`})})}),(0,C.jsx)(`div`,{"aria-hidden":`true`,className:c(`shrink-0 transition-[height] duration-500 motion-reduce:transition-none lg:h-0`,A,Z?`max-lg:h-0`:`max-lg:h-[148px]`)}),(0,C.jsxs)(`div`,{className:c(`flex flex-col gap-10 lg:flex-row lg:items-start lg:gap-14`,B?`hidden`:``),children:[(0,C.jsxs)(`section`,{className:c(`flex w-full shrink-0 animate-rise flex-col lg:w-[32rem] lg:transition-[margin] lg:duration-700 motion-reduce:transition-none`,A,q?`lg:ml-0`:`lg:ml-[calc(50%-16rem)]`,Z?`max-lg:hidden`:``),children:[(0,C.jsxs)(`div`,{className:`flex flex-col lg:min-h-[6.5rem]`,children:[(0,C.jsx)(`p`,{className:c(j,`font-medium text-(color:--on)/70 text-[0.75rem] uppercase tracking-[0.16em]`,q?N:M),children:x(`setup.title`)}),(0,C.jsx)(`h1`,{className:c(j,`mt-2 font-display font-semibold text-[1.625rem] leading-[1.08] tracking-[-0.02em] sm:text-[1.75rem]`,q?N:M),children:x(`setup.source`)}),(0,C.jsx)(`p`,{className:c(j,`mt-2.5 text-(color:--on)/75 text-[0.9375rem] leading-relaxed`,q?N:M),children:x(`setup.sub`)})]}),E?(0,C.jsxs)(`div`,{className:`mt-5 flex items-center gap-3.5 rounded-2xl bg-(color:--panel) px-4 py-3.5 ring-(color:--panel-ring) ring-1`,children:[(0,C.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-(color:--pick) font-semibold text-(color:--pick-ink) text-[0.9375rem]`,children:p.data.account?.signedIn?(p.data.account.name||p.data.account.email).slice(0,1).toUpperCase():(0,C.jsx)(m,{className:`size-4.5`})}),(0,C.jsx)(`div`,{className:`min-w-0 flex-1`,children:p.data.account?.signedIn?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`p`,{className:`font-medium text-[0.9375rem]`,children:x(`setup.accountLinked`,{name:p.data.account.name||p.data.account.email})}),(0,C.jsx)(`p`,{className:`text-(color:--on)/75 text-[0.8125rem]`,children:[p.data.account.organization,p.data.account.credits===null?null:x(`setup.accountCredits`,{credits:p.data.account.credits.toLocaleString(b)})].filter(Boolean).join(` · `)})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`p`,{className:`font-medium text-[0.9375rem]`,children:x(`setup.account`)}),(0,C.jsx)(`p`,{className:`text-(color:--on)/75 text-[0.8125rem] leading-snug`,children:x(`setup.accountText`)}),(0,C.jsx)(f,{...k})]})}),p.data.account?.signedIn?null:(0,C.jsx)(s,{variant:`secondary`,size:`sm`,busy:k.link.isPending,onClick:()=>k.link.mutate({}),children:x(`account.signIn`)})]}):null,p.data.account?.signedIn?(0,C.jsx)(`div`,{className:`mt-2.5`,children:(0,C.jsx)(I,{selected:Q===`account`,title:x(`setup.creditsChoice`),description:x(`setup.creditsDesc`),note:p.data.account.credits===null?void 0:x(`setup.accountCredits`,{credits:p.data.account.credits.toLocaleString(b)}),onPick:()=>V.mutate(`account`)})}):null,E?(0,C.jsxs)(`div`,{className:`mt-7`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,C.jsx)(`span`,{className:`h-px flex-1 bg-(color:--on)/25`}),(0,C.jsx)(`span`,{className:`font-medium text-(color:--on)/80 text-[0.75rem] uppercase tracking-[0.14em]`,children:x(`setup.localDivider`)}),(0,C.jsx)(`span`,{className:`h-px flex-1 bg-(color:--on)/25`})]}),(0,C.jsx)(`p`,{className:`mt-2 text-center text-(color:--on)/65 text-[0.8125rem] leading-snug`,children:x(`setup.localNote`)})]}):null,(0,C.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[G.map((e,t)=>(0,C.jsx)(I,{selected:Q===e.id,title:e.name,description:x(`harness.desc.${e.id}`),badge:t===0?x(`setup.recommended`):void 0,note:e.version===null?x(`harness.notInstalled`):e.auth===`subscription`?x(`harness.ready`):void 0,onPick:()=>V.mutate(e.id)},e.id)),K?.supported?(0,C.jsx)(I,{selected:Q===`apple`,title:x(`models.optApple`),description:x(`setup.appleDesc`),note:he(K),onPick:()=>V.mutate(`apple`)}):null,(0,C.jsx)(I,{selected:Q===`own`,title:x(`local.sourceOwn`),description:x(`setup.ownDesc`),onPick:()=>V.mutate(`own`)})]}),(0,C.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-center gap-x-2 gap-y-1 text-(color:--on)/60 text-[0.8125rem]`,children:[(0,C.jsx)(`span`,{children:Ce.length?null:x(`setup.noHarness`)}),(0,C.jsxs)(s,{variant:`ghost`,size:`sm`,busy:H.isPending,onClick:()=>H.mutate(),children:[(0,C.jsx)(r,{className:`size-3.5`}),` `,x(`local.recheck`)]})]})]}),q?(0,C.jsxs)(`section`,{className:c(`min-w-0 flex-1 animate-settle`,R?`max-lg:hidden`:``),children:[(0,C.jsxs)(`button`,{type:`button`,onClick:()=>{z(!0),P()},className:`-ml-1.5 mb-5 inline-flex items-center gap-1.5 rounded-full px-1.5 py-1 text-(color:--on)/80 text-[0.875rem] transition hover:text-(color:--on) lg:hidden`,children:[(0,C.jsx)(ee,{className:`size-4`}),` `,x(`run.back`)]}),(0,C.jsxs)(`div`,{className:`relative`,children:[(0,C.jsx)(`div`,{"aria-hidden":`true`,className:`absolute top-6 right-2 z-10`,children:(0,C.jsx)(v,{kind:me[q],size:120,fluffy:!0,coat:`fur`})}),(0,C.jsxs)(`div`,{className:`min-h-[6.5rem]`,children:[(0,C.jsx)(ye,{name:ke,at:Ee,done:Y}),(0,C.jsx)(`h2`,{className:`mt-2 animate-rise pr-32 font-display font-semibold text-[clamp(28px,3vw,40px)] leading-[1.06] tracking-[-0.03em]`,children:De},De)]}),(0,C.jsx)(`div`,{className:`mt-5 rounded-2xl bg-(color:--panel) p-5 ring-(color:--panel-ring) ring-1 sm:p-6`,children:J?(0,C.jsx)(re,{me:p.data,id:J.id,autoTest:!Y}):q===`apple`?(0,C.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,C.jsx)(`p`,{className:`text-[0.875rem] text-ink-2 leading-relaxed`,children:we?x(`setup.appleHintKeeps`,{way:we}):x(`setup.appleHint`)}),(0,C.jsx)(h,{auto:!Y&&K?.available===!0})]}):q===`account`?(0,C.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,C.jsx)(`p`,{className:`text-[0.875rem] text-ink-2 leading-relaxed`,children:x(`setup.creditsDesc`)}),(0,C.jsx)(h,{auto:!Y})]}):(0,C.jsx)(te,{models:U})}),(0,C.jsxs)(`div`,{className:`mt-9`,children:[Y?(0,C.jsxs)(`p`,{className:`mb-3 flex animate-rise items-center gap-2 font-medium text-[0.9375rem]`,style:{color:D},children:[(0,C.jsx)(l,{className:`size-4`,strokeWidth:3}),x(`setup.ready`)]}):null,(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,C.jsxs)(`button`,{type:`button`,disabled:!Y,onClick:()=>{E&&!Oe?(Se(!0),window.scrollTo({top:0})):$()},className:c(`group inline-flex h-12 items-center gap-2.5 rounded-full px-6 font-semibold text-[1rem] transition-[background-color,color,box-shadow,filter] duration-300`,Y?`shadow-[0_6px_24px_oklch(88%_0.17_150/0.35)] hover:brightness-105`:`cursor-not-allowed bg-(color:--on)/20 text-(color:--on)/65`),style:Y?{background:D,color:`var(--ready-ink)`}:void 0,children:[x(`setup.done`),(0,C.jsx)(`span`,{"aria-hidden":`true`,className:`transition-transform group-enabled:group-hover:translate-x-0.5`,children:`→`})]}),Y?null:(0,C.jsx)(`span`,{className:`text-(color:--on)/65 text-[0.8125rem]`,children:x(`setup.untilWorks`)})]})]})]})]},q):null]})]}),(0,C.jsxs)(`footer`,{className:`mx-auto flex w-full max-w-6xl items-center justify-between gap-4 pb-6 text-(color:--on)/55 text-[0.75rem] sm:pb-8`,children:[(0,C.jsxs)(`span`,{children:[`engenty ·`,` `,p.data.account?.signedIn?x(`setup.thisComputer`,{space:O?.name??``,organization:p.data.account.organization??p.data.account.name}):x(`setup.local`)]}),(0,C.jsxs)(`span`,{className:`flex items-center gap-5`,children:[X?(0,C.jsx)(be,{href:X,children:new URL(X).host}):null,(0,C.jsx)(`span`,{"aria-hidden":`true`,className:`size-[3px] bg-(color:--dot)`})]})]})]})}export{L as SetupPage};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./useMutation-CoEdB_9_.js";import{$ as n,An as r,Wr as i,_r as a,ar as o,nn as s,or as ee,vn as c}from"./ui-BjhZhw8x.js";import{u as l}from"./marked.esm-BfGIZK7F.js";import{Cn as u,H as d,Jt as te,K as ne,Kt as re,Sn as ie,V as f,Yt as p,or as m,qt as h}from"./host-Ckjz94Ea.js";import{n as g,t as _}from"./jsx-runtime-C3cWAN_r.js";import{a as ae,c as oe,n as v}from"./brand-ByQY-UcL.js";import{t as y}from"./logo-xL-sneZz.js";import{n as b,s as x}from"./i18n-ClCOlfx2.js";import{h as se,u as ce,v as le}from"./session-Dd9duhPc.js";import{r as ue}from"./LangSwitch-BNa_H8AR.js";var S=e(g(),1),C=e(_(),1),w=`oklch(50% 0.2 262)`,T=`oklch(32% 0.15 262)`,E=`oklch(90% 0.1 80)`,D=`var(--step-done)`,O=`var(--step-now)`,k=`color-mix(in oklab, var(--on) 38%, transparent)`,de={"--on":`white`,"--tile":`rgb(255 255 255 / 0.1)`,"--tile-hover":`rgb(255 255 255 / 0.15)`,"--tile-ring":`rgb(255 255 255 / 0.15)`,"--panel":`rgb(255 255 255 / 0.07)`,"--panel-ring":`rgb(255 255 255 / 0.12)`,"--pick":`white`,"--pick-ink":T,"--pick-mark":T,"--dot":E,"--step-done":`oklch(88% 0.17 150)`,"--step-now":`oklch(88% 0.14 80)`,"--ready-ink":`oklch(27% 0.09 150)`,"--ink-2":`oklch(96% 0.02 262)`,"--ink-3":`oklch(90% 0.035 262)`,"--ink-4":`oklch(82% 0.05 262)`,"--moss":`oklch(90% 0.14 150)`,"--rose":`oklch(89% 0.09 45)`},fe={"--on":`var(--ink)`,"--tile":`var(--card)`,"--tile-hover":`var(--paper-2)`,"--tile-ring":`var(--border-soft)`,"--panel":`var(--card)`,"--panel-ring":`var(--border-soft)`,"--pick":w,"--pick-ink":`white`,"--pick-mark":`white`,"--dot":w,"--step-done":`oklch(52% 0.15 150)`,"--step-now":`oklch(60% 0.15 65)`,"--ready-ink":`white`},A=`ease-[cubic-bezier(0.3,0.7,0.2,1)]`,pe=220,me={codex:`dome`,claude:`oval`,antigravity:`wedge`,cursor:`sprout`,own:`bean`,account:`drop`,apple:`pebble`};function he(e){if(e.available)return x(`models.optAppleNote`);switch(e.reason){case`off`:return x(`models.appleOff`);case`loading`:return x(`models.appleLoading`);default:return x(`models.appleDevice`)}}var j=`relative w-fit max-w-full transition-[left,translate] duration-700 ease-[cubic-bezier(0.3,0.7,0.2,1)] motion-reduce:transition-none`,M=`left-1/2 -translate-x-1/2 text-center`,N=`max-lg:left-1/2 max-lg:-translate-x-1/2 max-lg:text-center lg:left-0 lg:translate-x-0 lg:text-left`;function P(){window.matchMedia(`(max-width: 1023px)`).matches&&window.scrollTo({top:0})}var F=`wizards.setup.own`;function ge(){try{return sessionStorage.getItem(F)===`1`}catch{return!1}}function _e(e){try{e?sessionStorage.setItem(F,`1`):sessionStorage.removeItem(F)}catch{}}function ve(){return(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-2.5`,children:[(0,C.jsx)(y,{size:28}),(0,C.jsxs)(`span`,{className:`font-display font-semibold text-[1.0625rem] tracking-tight`,children:[`engenty`,(0,C.jsx)(`span`,{className:`mr-[0.09em] ml-[0.06em] text-(color:--dot)`,children:`.`}),(0,C.jsx)(`span`,{className:`font-normal text-(color:--on)/70`,children:`wizards`})]})]})}function I({selected:e,title:t,description:n,badge:r,note:i,onPick:a}){return(0,C.jsxs)(`button`,{type:`button`,onClick:a,"aria-pressed":e,className:c(`group relative flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left transition-[background-color,color,box-shadow] duration-300`,e?`bg-(color:--pick) text-(color:--pick-ink) shadow-elevated`:`bg-(color:--tile) ring-(color:--tile-ring) ring-1 hover:bg-(color:--tile-hover)`),children:[r?(0,C.jsx)(`span`,{className:`absolute -top-2.5 right-4 rounded-full px-2.5 py-[3px] font-semibold text-[0.6875rem] leading-none tracking-wide shadow-[0_2px_8px_oklch(0%_0_0/0.22)]`,style:{background:E,color:T},children:r}):null,(0,C.jsx)(`span`,{className:c(`flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors duration-300`,e?`border-transparent bg-(color:--pick-mark)`:`border-(color:--on)/40`),children:e?(0,C.jsx)(l,{className:`size-3.5 text-(color:--pick)`}):null}),(0,C.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`span`,{className:`block font-medium text-[0.9375rem]`,children:t}),(0,C.jsx)(`span`,{className:c(`mt-0.5 block truncate text-[0.8125rem]`,e?`opacity-70`:`text-(color:--on)/65`),children:n})]}),i?(0,C.jsx)(`span`,{className:c(`shrink-0 text-[0.75rem]`,e?`opacity-70`:`text-(color:--on)/65`),children:i}):null,(0,C.jsx)(o,{className:c(`size-4 shrink-0 transition`,e?`opacity-70`:`text-(color:--on)/40 group-hover:translate-x-0.5 group-hover:text-(color:--on)/80`)})]})}function ye({name:e,at:t,done:n}){let r=[x(`setup.stage.connect`),x(`setup.stage.test`),x(`setup.stage.done`)],i=n?r.length:t+1;return(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 font-medium text-[0.75rem] uppercase tracking-[0.14em]`,children:[(0,C.jsx)(`span`,{className:`text-(color:--on)/70`,children:e}),(0,C.jsx)(`ol`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:r.map((e,r)=>{let i=n||r<t;return(0,C.jsxs)(`li`,{"aria-current":!i&&r===t?`step`:void 0,className:`flex items-center gap-1 transition-colors duration-500`,style:{color:i?D:r===t?O:k},children:[i?(0,C.jsx)(l,{className:`size-3.5`,strokeWidth:3}):null,e]},e)})}),(0,C.jsx)(`span`,{"aria-hidden":`true`,className:`flex gap-1.5`,children:r.map((e,t)=>(0,C.jsx)(`span`,{className:`h-[3px] w-5 rounded-full transition-colors duration-500`,style:{background:t<i?n?D:O:`color-mix(in oklab, var(--on) 22%, transparent)`}},e))})]})}function be({href:e,children:t}){return(0,C.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`transition hover:text-(color:--on)`,onClick:t=>{t.preventDefault(),p(e)},children:t})}function xe({source:e,signedIn:t,onLocal:n}){let r=d(t),{link:i}=r;return(0,S.useEffect)(()=>{t&&n()},[t,n]),(0,C.jsxs)(`section`,{className:`mx-auto flex w-full max-w-[32rem] animate-rise flex-col items-center text-center`,children:[(0,C.jsx)(v,{kind:`drop`,size:132,fluffy:!0,coat:`fur`}),(0,C.jsxs)(`span`,{className:`mt-4 inline-flex items-center gap-1.5 rounded-full px-3 py-1 font-medium text-[0.75rem]`,style:{color:D,background:`color-mix(in oklab, var(--step-done) 20%, transparent)`},children:[(0,C.jsx)(l,{className:`size-3.5`,strokeWidth:3}),x(`setup.connected`,{name:e})]}),(0,C.jsx)(`h1`,{className:`mt-3 font-display font-semibold text-[1.75rem] leading-[1.08] tracking-[-0.02em]`,children:x(`setup.accountAsk`)}),(0,C.jsx)(`p`,{className:`mt-2.5 text-balance text-(color:--on)/75 text-[0.9375rem] leading-relaxed`,children:x(`setup.accountAskText`)}),(0,C.jsxs)(`div`,{className:`mt-7 flex w-full flex-col gap-4 rounded-2xl bg-(color:--panel) p-5 text-left ring-(color:--panel-ring) ring-1`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-3.5`,children:[(0,C.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-(color:--pick) text-(color:--pick-ink)`,children:(0,C.jsx)(m,{className:`size-4.5`})}),(0,C.jsxs)(`div`,{className:`min-w-0`,children:[(0,C.jsx)(`p`,{className:`font-medium text-[0.9375rem]`,children:x(`setup.account`)}),(0,C.jsx)(`p`,{className:`text-(color:--on)/75 text-[0.8125rem] leading-snug`,children:x(`setup.accountText`)})]})]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,C.jsx)(s,{style:{background:`var(--pick)`,color:`var(--pick-ink)`},busy:i.isPending&&!i.variables?.signup,onClick:()=>i.mutate({}),children:x(`account.signIn`)}),(0,C.jsx)(s,{variant:`secondary`,busy:i.isPending&&!!i.variables?.signup,onClick:()=>i.mutate({signup:!0}),children:x(`account.create`)})]}),(0,C.jsx)(f,{...r})]}),(0,C.jsxs)(`button`,{type:`button`,onClick:n,className:`group mt-7 inline-flex items-center gap-1.5 font-medium text-[0.9375rem] underline decoration-(color:--on)/40 underline-offset-4 transition hover:decoration-(color:--on)`,children:[x(`setup.localContinue`),(0,C.jsx)(o,{className:`size-4 transition-transform group-hover:translate-x-0.5`})]}),(0,C.jsx)(`p`,{className:`mt-2 max-w-[44ch] text-balance text-(color:--on)/65 text-[0.8125rem] leading-snug`,children:x(`setup.localContinueNote`)})]})}function L(){let e=u(`site`),o=oe()!==`light`;ae(o?w:null);let p=se(),g=i(),_=a(),y=ie(),E=u(`account`),{space:O}=ce(),k=d(!!p.data?.account?.signedIn),[F,L]=(0,S.useState)(ge),[R,z]=(0,S.useState)(!1),[B,Se]=(0,S.useState)(!1),V=t({mutationFn:e=>n.put(`/api/studio/local/models`,e===`apple`?{bindings:{classifier:`apple:default`,low:`apple:default`}}:e===`own`?{source:`own`,bindings:{classifier:``,low:``}}:{source:e,bindings:le(p.data?.models?.bindings??{})}),onSuccess:async(e,t)=>{await g.invalidateQueries({queryKey:[`me`]}),L(!0),z(!1),P(),_e(t===`own`)}}),H=t({mutationFn:()=>Promise.all((p.data?.harnesses??[]).map(e=>n.post(`/api/studio/local/harness/${e.id}/detect`))),onSuccess:()=>g.invalidateQueries({queryKey:[`me`]})});if(!p.data?.models)return null;let U=p.data.models,W=e=>(e.version===null?2:0)+ +!e.app,G=[...p.data.harnesses].sort((e,t)=>W(e)-W(t)),Ce=G.filter(e=>e.version!==null),K=p.data.apple,q=U.bindings.low?.startsWith(`apple:`)?`apple`:F||p.data.setupDone||U.source!==`own`?U.source:null,J=p.data.harnesses.find(e=>e.id===q),we=U.source===`account`?x(`models.creditsName`):p.data.harnesses.find(e=>e.id===U.source)?.name??null,Y=p.data.setupDone,Te=Object.values(U.keys).some(Boolean),Ee=Y?2:J?J.auth===`none`?0:1:q===`apple`||q===`account`||Te?1:0,De=Y?x(`setup.h.done`):J?J.version===null?x(`setup.h.install`,{name:J.name}):J.auth===`none`?x(`setup.h.signIn`,{name:J.name}):x(`setup.h.test`):x(q===`apple`||q===`account`||Te?`setup.h.test`:`setup.h.keys`),X=e?y.data?.site:null,Z=q!==null&&!R,Q=V.isPending?V.variables??q:q,Oe=!!p.data.account?.signedIn,ke=J?.name??x(q===`apple`?`models.optApple`:q===`account`?`setup.creditsChoice`:`local.sourceOwn`),$=()=>_(`/`,{replace:!0});return(0,C.jsxs)(`div`,{className:`flex min-h-dvh flex-col px-6 text-(color:--on) sm:px-10`,style:o?de:fe,children:[(0,C.jsxs)(`header`,{className:`flex items-center justify-between pt-6 sm:pt-8`,children:[(0,C.jsx)(ve,{}),(0,C.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,C.jsx)(ne,{tone:o?`ground`:`surface`}),(0,C.jsx)(ue,{tone:o?`ground`:`surface`,ink:T})]})]}),(0,C.jsxs)(`main`,{className:`relative mx-auto flex w-full max-w-6xl flex-1 flex-col pt-6 pb-10 lg:pt-[6vh]`,children:[B?(0,C.jsx)(xe,{source:ke,signedIn:Oe,onLocal:$}):null,(0,C.jsx)(`div`,{"aria-hidden":`true`,className:c(`absolute top-6 left-1/2 z-10 origin-top -translate-x-1/2 transition-[opacity,scale,left] duration-500 motion-reduce:transition-none lg:top-[calc(6vh+5.25rem)] lg:origin-center lg:translate-x-0`,A,q?`lg:pointer-events-none lg:left-[calc(50%-560px)] lg:scale-75 lg:opacity-0`:`lg:left-[calc(50%-508px)] lg:scale-100 lg:opacity-100`,Z?`max-lg:pointer-events-none max-lg:scale-[0.4] max-lg:opacity-0`:`max-lg:scale-[0.6] max-lg:opacity-100`),children:(0,C.jsx)(`div`,{className:`animate-rise`,children:(0,C.jsx)(v,{kind:`drop`,size:pe,fluffy:!0,coat:`fur`})})}),(0,C.jsx)(`div`,{"aria-hidden":`true`,className:c(`shrink-0 transition-[height] duration-500 motion-reduce:transition-none lg:h-0`,A,Z?`max-lg:h-0`:`max-lg:h-[148px]`)}),(0,C.jsxs)(`div`,{className:c(`flex flex-col gap-10 lg:flex-row lg:items-start lg:gap-14`,B?`hidden`:``),children:[(0,C.jsxs)(`section`,{className:c(`flex w-full shrink-0 animate-rise flex-col lg:w-[32rem] lg:transition-[margin] lg:duration-700 motion-reduce:transition-none`,A,q?`lg:ml-0`:`lg:ml-[calc(50%-16rem)]`,Z?`max-lg:hidden`:``),children:[(0,C.jsxs)(`div`,{className:`flex flex-col lg:min-h-[6.5rem]`,children:[(0,C.jsx)(`p`,{className:c(j,`font-medium text-(color:--on)/70 text-[0.75rem] uppercase tracking-[0.16em]`,q?N:M),children:x(`setup.title`)}),(0,C.jsx)(`h1`,{className:c(j,`mt-2 font-display font-semibold text-[1.625rem] leading-[1.08] tracking-[-0.02em] sm:text-[1.75rem]`,q?N:M),children:x(`setup.source`)}),(0,C.jsx)(`p`,{className:c(j,`mt-2.5 text-(color:--on)/75 text-[0.9375rem] leading-relaxed`,q?N:M),children:x(`setup.sub`)})]}),E?(0,C.jsxs)(`div`,{className:`mt-5 flex items-center gap-3.5 rounded-2xl bg-(color:--panel) px-4 py-3.5 ring-(color:--panel-ring) ring-1`,children:[(0,C.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-(color:--pick) font-semibold text-(color:--pick-ink) text-[0.9375rem]`,children:p.data.account?.signedIn?(p.data.account.name||p.data.account.email).slice(0,1).toUpperCase():(0,C.jsx)(m,{className:`size-4.5`})}),(0,C.jsx)(`div`,{className:`min-w-0 flex-1`,children:p.data.account?.signedIn?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`p`,{className:`font-medium text-[0.9375rem]`,children:x(`setup.accountLinked`,{name:p.data.account.name||p.data.account.email})}),(0,C.jsx)(`p`,{className:`text-(color:--on)/75 text-[0.8125rem]`,children:[p.data.account.organization,p.data.account.credits===null?null:x(`setup.accountCredits`,{credits:p.data.account.credits.toLocaleString(b)})].filter(Boolean).join(` · `)})]}):(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`p`,{className:`font-medium text-[0.9375rem]`,children:x(`setup.account`)}),(0,C.jsx)(`p`,{className:`text-(color:--on)/75 text-[0.8125rem] leading-snug`,children:x(`setup.accountText`)}),(0,C.jsx)(f,{...k})]})}),p.data.account?.signedIn?null:(0,C.jsx)(s,{variant:`secondary`,size:`sm`,busy:k.link.isPending,onClick:()=>k.link.mutate({}),children:x(`account.signIn`)})]}):null,p.data.account?.signedIn?(0,C.jsx)(`div`,{className:`mt-2.5`,children:(0,C.jsx)(I,{selected:Q===`account`,title:x(`setup.creditsChoice`),description:x(`setup.creditsDesc`),note:p.data.account.credits===null?void 0:x(`setup.accountCredits`,{credits:p.data.account.credits.toLocaleString(b)}),onPick:()=>V.mutate(`account`)})}):null,E?(0,C.jsxs)(`div`,{className:`mt-7`,children:[(0,C.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,C.jsx)(`span`,{className:`h-px flex-1 bg-(color:--on)/25`}),(0,C.jsx)(`span`,{className:`font-medium text-(color:--on)/80 text-[0.75rem] uppercase tracking-[0.14em]`,children:x(`setup.localDivider`)}),(0,C.jsx)(`span`,{className:`h-px flex-1 bg-(color:--on)/25`})]}),(0,C.jsx)(`p`,{className:`mt-2 text-center text-(color:--on)/65 text-[0.8125rem] leading-snug`,children:x(`setup.localNote`)})]}):null,(0,C.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[G.map((e,t)=>(0,C.jsx)(I,{selected:Q===e.id,title:e.name,description:x(`harness.desc.${e.id}`),badge:t===0?x(`setup.recommended`):void 0,note:e.version===null?x(`harness.notInstalled`):e.auth===`subscription`?x(`harness.ready`):void 0,onPick:()=>V.mutate(e.id)},e.id)),K?.supported?(0,C.jsx)(I,{selected:Q===`apple`,title:x(`models.optApple`),description:x(`setup.appleDesc`),note:he(K),onPick:()=>V.mutate(`apple`)}):null,(0,C.jsx)(I,{selected:Q===`own`,title:x(`local.sourceOwn`),description:x(`setup.ownDesc`),onPick:()=>V.mutate(`own`)})]}),(0,C.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-center gap-x-2 gap-y-1 text-(color:--on)/60 text-[0.8125rem]`,children:[(0,C.jsx)(`span`,{children:Ce.length?null:x(`setup.noHarness`)}),(0,C.jsxs)(s,{variant:`ghost`,size:`sm`,busy:H.isPending,onClick:()=>H.mutate(),children:[(0,C.jsx)(r,{className:`size-3.5`}),` `,x(`local.recheck`)]})]})]}),q?(0,C.jsxs)(`section`,{className:c(`min-w-0 flex-1 animate-settle`,R?`max-lg:hidden`:``),children:[(0,C.jsxs)(`button`,{type:`button`,onClick:()=>{z(!0),P()},className:`-ml-1.5 mb-5 inline-flex items-center gap-1.5 rounded-full px-1.5 py-1 text-(color:--on)/80 text-[0.875rem] transition hover:text-(color:--on) lg:hidden`,children:[(0,C.jsx)(ee,{className:`size-4`}),` `,x(`run.back`)]}),(0,C.jsxs)(`div`,{className:`relative`,children:[(0,C.jsx)(`div`,{"aria-hidden":`true`,className:`absolute top-6 right-2 z-10`,children:(0,C.jsx)(v,{kind:me[q],size:120,fluffy:!0,coat:`fur`})}),(0,C.jsxs)(`div`,{className:`min-h-[6.5rem]`,children:[(0,C.jsx)(ye,{name:ke,at:Ee,done:Y}),(0,C.jsx)(`h2`,{className:`mt-2 animate-rise pr-32 font-display font-semibold text-[clamp(28px,3vw,40px)] leading-[1.06] tracking-[-0.03em]`,children:De},De)]}),(0,C.jsx)(`div`,{className:`mt-5 rounded-2xl bg-(color:--panel) p-5 ring-(color:--panel-ring) ring-1 sm:p-6`,children:J?(0,C.jsx)(re,{me:p.data,id:J.id,autoTest:!Y}):q===`apple`?(0,C.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,C.jsx)(`p`,{className:`text-[0.875rem] text-ink-2 leading-relaxed`,children:we?x(`setup.appleHintKeeps`,{way:we}):x(`setup.appleHint`)}),(0,C.jsx)(h,{auto:!Y&&K?.available===!0})]}):q===`account`?(0,C.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,C.jsx)(`p`,{className:`text-[0.875rem] text-ink-2 leading-relaxed`,children:x(`setup.creditsDesc`)}),(0,C.jsx)(h,{auto:!Y})]}):(0,C.jsx)(te,{models:U})}),(0,C.jsxs)(`div`,{className:`mt-9`,children:[Y?(0,C.jsxs)(`p`,{className:`mb-3 flex animate-rise items-center gap-2 font-medium text-[0.9375rem]`,style:{color:D},children:[(0,C.jsx)(l,{className:`size-4`,strokeWidth:3}),x(`setup.ready`)]}):null,(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,C.jsxs)(`button`,{type:`button`,disabled:!Y,onClick:()=>{E&&!Oe?(Se(!0),window.scrollTo({top:0})):$()},className:c(`group inline-flex h-12 items-center gap-2.5 rounded-full px-6 font-semibold text-[1rem] transition-[background-color,color,box-shadow,filter] duration-300`,Y?`shadow-[0_6px_24px_oklch(88%_0.17_150/0.35)] hover:brightness-105`:`cursor-not-allowed bg-(color:--on)/20 text-(color:--on)/65`),style:Y?{background:D,color:`var(--ready-ink)`}:void 0,children:[x(`setup.done`),(0,C.jsx)(`span`,{"aria-hidden":`true`,className:`transition-transform group-enabled:group-hover:translate-x-0.5`,children:`→`})]}),Y?null:(0,C.jsx)(`span`,{className:`text-(color:--on)/65 text-[0.8125rem]`,children:x(`setup.untilWorks`)})]})]})]})]},q):null]})]}),(0,C.jsxs)(`footer`,{className:`mx-auto flex w-full max-w-6xl items-center justify-between gap-4 pb-6 text-(color:--on)/55 text-[0.75rem] sm:pb-8`,children:[(0,C.jsxs)(`span`,{children:[`engenty ·`,` `,p.data.account?.signedIn?x(`setup.thisComputer`,{space:O?.name??``,organization:p.data.account.organization??p.data.account.name}):x(`setup.local`)]}),(0,C.jsxs)(`span`,{className:`flex items-center gap-5`,children:[X?(0,C.jsx)(be,{href:X,children:new URL(X).host}):null,(0,C.jsx)(`span`,{"aria-hidden":`true`,className:`size-[3px] bg-(color:--dot)`})]})]})]})}export{L as SetupPage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,At as n,Et as r,Xt as i,ar as a,nn as o,ot as s,pn as c,rn as l,vr as u,yr as d}from"./ui-D4qQLcbs.js";import{n as f,s as p,v as m,y as h}from"./i18n-DPqdH1PJ.js";import{n as g,t as _}from"./jsx-runtime-C3cWAN_r.js";import{l as v,n as y,t as b}from"./brand-Ij-I_Lms.js";import{d as x,n as S}from"./theme-BQhQx_UL.js";import{BrandHeader as C}from"./PublicRunner-Cjhfeqi3.js";var w=e(g(),1),T=e(_(),1);function E(){let{token:e}=u(),g=d({queryKey:[`share`,e],queryFn:()=>t.get(`/api/shares/${e}`),retry:(e,t)=>i(t)&&e<3});if(S(g.data?.brand.theme),v(g.data?.wizard.avatar),(0,w.useEffect)(()=>{g.data&&(document.title=`${g.data.title} · ${g.data.wizard.title}`)},[g.data]),g.isLoading)return(0,T.jsx)(`div`,{className:`flex min-h-dvh items-center justify-center text-ink-4`,children:(0,T.jsx)(c,{})});let _=g.data;if(!_)return(0,T.jsxs)(`div`,{className:`flex min-h-dvh flex-col items-center justify-center gap-4 px-6 text-center`,children:[(0,T.jsx)(y,{kind:`pebble`,size:80}),(0,T.jsx)(`p`,{className:`max-w-sm text-ink-3`,children:p(i(g.error)?`common.offline`:`sharePage.gone`)}),i(g.error)?(0,T.jsx)(o,{variant:`secondary`,onClick:()=>void g.refetch(),children:p(`common.retry`)}):null]});let E=`/api/shares/${_.token}`,D=e=>new Intl.DateTimeFormat(f,{dateStyle:`long`}).format(new Date(e));return(0,T.jsxs)(`div`,{className:`wizard-page flex min-h-dvh flex-col`,children:[(0,T.jsx)(x,{effects:_.brand.theme.effects}),(0,T.jsx)(C,{brand:_.brand}),(0,T.jsxs)(`main`,{className:`mx-auto w-full max-w-3xl flex-1 animate-rise px-4 pt-6 pb-12 sm:px-6`,children:[(0,T.jsxs)(`div`,{className:`mb-8 flex flex-wrap items-center gap-4`,children:[(0,T.jsx)(y,{kind:_.wizard.avatar,costume:_.wizard.costume,size:64}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsx)(`p`,{className:`text-[0.8125rem] text-ink-4`,children:_.expiresAt?p(`sharePage.until`,{date:D(_.expiresAt)}):p(`sharePage.shared`,{date:D(_.createdAt)})}),(0,T.jsx)(`h1`,{className:`font-display font-semibold text-[1.75rem] leading-tight tracking-tight sm:text-[2rem]`,children:_.title}),_.message?(0,T.jsx)(`p`,{className:`mt-1 text-[0.9375rem] text-ink-3`,children:_.message}):null]})]}),(0,T.jsx)(`div`,{className:`flex flex-col gap-6`,children:_.shown.map(({step:e,output:t,formats:i,label:a,kept:o})=>o?(0,T.jsxs)(l,{className:`p-4 sm:p-5`,children:[(0,T.jsx)(`h2`,{className:`mb-2 font-display font-semibold text-[1.0625rem]`,children:a??e.title}),(0,T.jsx)(`p`,{className:`text-[0.9375rem] text-ink-3`,children:h(m(`resultKeptInSpace`),f)})]},e.id):(0,T.jsxs)(l,{className:`p-4 sm:p-5`,children:[(0,T.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,T.jsx)(`h2`,{className:`font-display font-semibold text-[1.0625rem]`,children:a??e.title}),(0,T.jsx)(r,{base:E,stepId:e.id,formats:i,title:a??e.title})]}),(0,T.jsx)(n,{base:E,step:e,output:t})]},e.id))}),_.wizardUrl?(0,T.jsxs)(`a`,{href:_.wizardUrl,className:`mt-10 flex items-center gap-4 rounded-2xl bg-card p-5 shadow-soft ring-1 ring-border-soft transition hover:shadow-elevated`,children:[(0,T.jsx)(y,{kind:_.wizard.avatar,costume:_.wizard.costume,size:44,interactive:!1}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsx)(`div`,{className:`font-display font-semibold text-[1rem]`,children:_.wizard.title}),_.wizard.description?(0,T.jsx)(`div`,{className:`truncate text-[0.875rem] text-ink-3`,children:_.wizard.description}):null]}),(0,T.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium text-[0.875rem] text-ember-strong`,children:[p(`sharePage.own`),` `,(0,T.jsx)(a,{className:`size-4`})]})]}):null]}),(0,T.jsx)(`footer`,{className:`safe-bottom pt-6 text-center text-[0.75rem] text-ink-4`,children:(0,T.jsx)(`a`,{href:`${s}/`,className:`inline-block py-3.5 hover:text-ink-2`,children:p(`run.madeWith`).replace(`engenty wizards`,b.name)})})]})}export{E as SharePage};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,At as n,Et as r,Xt as i,ar as a,nn as o,ot as s,pn as c,rn as l,vr as u,yr as d}from"./ui-BjhZhw8x.js";import{n as f,s as p,v as m,y as h}from"./i18n-ClCOlfx2.js";import{n as g,t as _}from"./jsx-runtime-C3cWAN_r.js";import{l as v,n as y,t as b}from"./brand-ByQY-UcL.js";import{d as x,n as S}from"./theme-DumM6FI_.js";import{BrandHeader as C}from"./PublicRunner-BaTg24s3.js";var w=e(g(),1),T=e(_(),1);function E(){let{token:e}=u(),g=d({queryKey:[`share`,e],queryFn:()=>t.get(`/api/shares/${e}`),retry:(e,t)=>i(t)&&e<3});if(S(g.data?.brand.theme),v(g.data?.wizard.avatar),(0,w.useEffect)(()=>{g.data&&(document.title=`${g.data.title} · ${g.data.wizard.title}`)},[g.data]),g.isLoading)return(0,T.jsx)(`div`,{className:`flex min-h-dvh items-center justify-center text-ink-4`,children:(0,T.jsx)(c,{})});let _=g.data;if(!_)return(0,T.jsxs)(`div`,{className:`flex min-h-dvh flex-col items-center justify-center gap-4 px-6 text-center`,children:[(0,T.jsx)(y,{kind:`pebble`,size:80}),(0,T.jsx)(`p`,{className:`max-w-sm text-ink-3`,children:p(i(g.error)?`common.offline`:`sharePage.gone`)}),i(g.error)?(0,T.jsx)(o,{variant:`secondary`,onClick:()=>void g.refetch(),children:p(`common.retry`)}):null]});let E=`/api/shares/${_.token}`,D=e=>new Intl.DateTimeFormat(f,{dateStyle:`long`}).format(new Date(e));return(0,T.jsxs)(`div`,{className:`wizard-page flex min-h-dvh flex-col`,children:[(0,T.jsx)(x,{effects:_.brand.theme.effects}),(0,T.jsx)(C,{brand:_.brand}),(0,T.jsxs)(`main`,{className:`mx-auto w-full max-w-3xl flex-1 animate-rise px-4 pt-6 pb-12 sm:px-6`,children:[(0,T.jsxs)(`div`,{className:`mb-8 flex flex-wrap items-center gap-4`,children:[(0,T.jsx)(y,{kind:_.wizard.avatar,costume:_.wizard.costume,size:64}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsx)(`p`,{className:`text-[0.8125rem] text-ink-4`,children:_.expiresAt?p(`sharePage.until`,{date:D(_.expiresAt)}):p(`sharePage.shared`,{date:D(_.createdAt)})}),(0,T.jsx)(`h1`,{className:`font-display font-semibold text-[1.75rem] leading-tight tracking-tight sm:text-[2rem]`,children:_.title}),_.message?(0,T.jsx)(`p`,{className:`mt-1 text-[0.9375rem] text-ink-3`,children:_.message}):null]})]}),(0,T.jsx)(`div`,{className:`flex flex-col gap-6`,children:_.shown.map(({step:e,output:t,formats:i,label:a,kept:o})=>o?(0,T.jsxs)(l,{className:`p-4 sm:p-5`,children:[(0,T.jsx)(`h2`,{className:`mb-2 font-display font-semibold text-[1.0625rem]`,children:a??e.title}),(0,T.jsx)(`p`,{className:`text-[0.9375rem] text-ink-3`,children:h(m(`resultKeptInSpace`),f)})]},e.id):(0,T.jsxs)(l,{className:`p-4 sm:p-5`,children:[(0,T.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,T.jsx)(`h2`,{className:`font-display font-semibold text-[1.0625rem]`,children:a??e.title}),(0,T.jsx)(r,{base:E,stepId:e.id,formats:i,title:a??e.title})]}),(0,T.jsx)(n,{base:E,step:e,output:t})]},e.id))}),_.wizardUrl?(0,T.jsxs)(`a`,{href:_.wizardUrl,className:`mt-10 flex items-center gap-4 rounded-2xl bg-card p-5 shadow-soft ring-1 ring-border-soft transition hover:shadow-elevated`,children:[(0,T.jsx)(y,{kind:_.wizard.avatar,costume:_.wizard.costume,size:44,interactive:!1}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsx)(`div`,{className:`font-display font-semibold text-[1rem]`,children:_.wizard.title}),_.wizard.description?(0,T.jsx)(`div`,{className:`truncate text-[0.875rem] text-ink-3`,children:_.wizard.description}):null]}),(0,T.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium text-[0.875rem] text-ember-strong`,children:[p(`sharePage.own`),` `,(0,T.jsx)(a,{className:`size-4`})]})]}):null]}),(0,T.jsx)(`footer`,{className:`safe-bottom pt-6 text-center text-[0.75rem] text-ink-4`,children:(0,T.jsx)(`a`,{href:`${s}/`,className:`inline-block py-3.5 hover:text-ink-2`,children:p(`run.madeWith`).replace(`engenty wizards`,b.name)})})]})}export{E as SharePage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,An as n,Jn as r,Wr as i,Z as a,a as o,an as s,cn as c,hn as l,kt as u,ln as d,lr as f,mt as ee,nn as p,pn as m,q as te,rn as h,sn as g,vn as _,y as ne,yr as v}from"./ui-D4qQLcbs.js";import{a as y,d as re,f as b,l as x,n as S,s as ie,t as C,u as ae}from"./Skills-DK1Pv-Xh.js";import{t as w}from"./useMutation-CUZC19i3.js";import{t as T}from"./code-xml-CdJeig44.js";import{d as E,i as oe,l as se,r as D,s as O}from"./marked.esm-BfGIZK7F.js";import{t as k}from"./eye-CG1LzvNI.js";import{n as A,t as ce}from"./scroll-text-DmK2IucJ.js";import{n as j,t as M}from"./jsx-runtime-C3cWAN_r.js";import{n as N,s as P}from"./i18n-DPqdH1PJ.js";import{d as le}from"./session-Mt-n8MI0.js";import{t as F}from"./code-editor-BVgSljQq.js";import{N as I,a as L,r as R,t as z}from"./dist-Bux-wzFO.js";import{c as ue,n as de,t as fe}from"./Bundle-Dkpi5E6W.js";var B={name:`file-archive`,size:24,node:[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]};B.node;var pe=E(B),V=e(j(),1),H=z.line({class:`cm-frontmatter`});function U(e){let t=new I,n=e.state.doc;if(n.lines>1&&n.line(1).text.trim()===`---`){for(let e=2;e<=Math.min(n.lines,80);e++)if(n.line(e).text.trim()===`---`){for(let r=1;r<=e;r++)t.add(n.line(r).from,n.line(r).from,H);break}}return t.finish()}function W(){return[L.fromClass(class{decorations;constructor(e){this.decorations=U(e)}update(e){e.docChanged&&(this.decorations=U(e.view))}},{decorations:e=>e.decorations}),R.theme({".cm-frontmatter, .cm-frontmatter *":{fontFamily:`var(--f-mono)`,fontSize:`0.8125rem !important`,fontWeight:`400 !important`,color:`var(--ink-3) !important`,textDecoration:`none !important`}})]}var G=e(M(),1),K=[`always`,`demand`,`off`],me=W();function q(e){return v({queryKey:a.skill(e),queryFn:()=>t.get(`/api/studio/skills/${e}`)})}function he({value:e,onChange:t,disabled:n}){return(0,G.jsx)(`fieldset`,{"aria-label":P(`skills.modeLabel`),className:`m-0 min-w-0 border-0 p-0 flex flex-col gap-2`,children:K.map(r=>{let i=r===e,a=S[r];return(0,G.jsxs)(`button`,{type:`button`,"aria-pressed":i,disabled:n,onClick:()=>!i&&t(r),className:_(`flex items-start gap-3 rounded-xl bg-card p-3 text-left ring-1 transition disabled:pointer-events-none`,i?`ring-ember shadow-[0_0_0_3px] shadow-ember-tint`:`ring-border-soft hover:ring-ink-4`,n&&!i&&`opacity-60`),children:[(0,G.jsx)(`span`,{className:_(`flex size-8 shrink-0 items-center justify-center rounded-lg`,i?`bg-ember-tint text-ember-strong`:`bg-paper-2 text-ink-3`),children:(0,G.jsx)(a,{className:`size-4`})}),(0,G.jsxs)(`span`,{className:`min-w-0`,children:[(0,G.jsx)(`span`,{className:`block font-medium text-[0.8125rem]`,children:P(`skills.mode.${r}`)}),(0,G.jsx)(`span`,{className:`block text-[0.75rem] text-ink-3 leading-snug`,children:P(`skills.modeHint.${r}`)})]})]},r)})})}function ge({skill:e}){let n=i(),r=w({mutationFn:n=>t.patch(`/api/studio/skills/${e.id}`,{runScripts:n}),onSuccess:async()=>{await n.invalidateQueries({queryKey:a.skill(e.id)}),await n.invalidateQueries({queryKey:a.skills(e.spaceId)})}}),o=e.source!==`own`&&!e.official;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(y,{title:P(`skills.scriptsTitle`)}),(0,G.jsxs)(h,{className:`flex flex-col gap-2 p-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`span`,{className:`flex-1 font-medium text-[0.8125rem]`,children:P(`skills.runScripts`)}),(0,G.jsx)(l,{checked:e.runScripts,label:P(`skills.runScripts`),disabled:e.readOnly||r.isPending,onChange:e=>r.mutate(e)})]}),(0,G.jsx)(`p`,{className:`text-[0.75rem] text-ink-3 leading-snug`,children:P(`skills.runScriptsHint`)}),o?(0,G.jsx)(`p`,{className:`rounded-lg bg-amber-tint px-3 py-2 text-[0.75rem] text-ink-2 leading-snug`,children:P(`skills.runScriptsWarn`)}):null,r.error?(0,G.jsx)(`p`,{className:`text-[0.75rem] text-rose`,children:r.error.message}):null]})]})}function J({code:e,onChange:t}){return(0,G.jsxs)(p,{variant:`secondary`,size:`sm`,"aria-pressed":e,onClick:()=>t(!e),children:[e?(0,G.jsx)(k,{className:`size-4`}):(0,G.jsx)(T,{className:`size-4`}),P(e?`skills.rendered`:`skills.code`)]})}var Y=e=>`${(e/1e3).toLocaleString(N,{maximumFractionDigits:1})} KB`,X=e=>Y(new TextEncoder().encode(e).length),Z=e=>/\.(md|markdown|mdx)$/i.test(e);function _e({file:e,readOnly:t,onChange:n,onDelete:r,onClose:i}){let[a,o]=(0,V.useState)(!1),c=e?Z(e.path):!1,l=a||!c;return(0,G.jsx)(s,{open:e!==null,onClose:i,wide:!0,height:`tall`,title:e?(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(O,{className:`size-4 shrink-0 text-ink-3`}),(0,G.jsx)(`span`,{className:`truncate font-mono text-[0.9375rem]`,children:e.path})]}):null,children:e?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`span`,{className:`flex-1 text-[0.75rem] text-ink-3`,children:X(e.text)}),c?(0,G.jsx)(J,{code:a,onChange:o}):null]}),(0,G.jsx)(h,{className:`overflow-hidden`,children:l?(0,G.jsx)(F,{value:e.text,onChange:n,readOnly:t,language:`markdown`,ariaLabel:e.path,className:`min-h-[50vh] [&_.cm-editor]:min-h-[50vh]`}):(0,G.jsx)(`div`,{className:`p-5`,children:(0,G.jsx)(u,{text:e.text})})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t?null:(0,G.jsxs)(p,{variant:`danger`,size:`sm`,onClick:r,children:[(0,G.jsx)(D,{className:`size-4`}),` `,P(`skills.deleteFile`)]}),(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsx)(p,{size:`sm`,onClick:i,children:P(`skills.done`)})]})]}):null})}function ve({open:e,taken:t,onClose:n,onMade:r}){let[i,a]=(0,V.useState)(``),o=i.trim().replace(/^\.?\//,``),l=b(o)&&o!==`SKILL.md`&&!t.includes(o);return(0,G.jsx)(s,{open:e,onClose:n,title:P(`skills.newFile`),children:(0,G.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),l&&(r(o),a(``))},children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(d,{children:P(`skills.filePath`)}),(0,G.jsx)(c,{"data-autofocus":!0,value:i,placeholder:P(`skills.filePathHint`),onChange:e=>a(e.target.value),className:`font-mono`})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(p,{variant:`ghost`,onClick:n,children:P(`common.cancel`)}),(0,G.jsx)(p,{type:`submit`,disabled:!l,children:P(`skills.create`)})]})]})})}function ye({items:e}){let[t,n]=(0,V.useState)(!1),r=(0,V.useRef)(null);return(0,V.useEffect)(()=>{if(!t)return;let e=e=>{r.current?.contains(e.target)||n(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[t]),(0,G.jsxs)(`div`,{className:`relative`,ref:r,children:[(0,G.jsx)(g,{label:P(`skills.more`),"aria-haspopup":`menu`,"aria-expanded":t,onClick:()=>n(e=>!e),className:`ring-1 ring-border`,children:(0,G.jsx)(A,{className:`size-4`})}),t?(0,G.jsx)(`div`,{role:`menu`,className:`absolute top-11 right-0 z-50 w-56 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:e.map(e=>(0,G.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{n(!1),e.onPick()},className:_(`w-full rounded-lg px-2.5 py-2 text-left text-[0.8125rem] transition hover:bg-accent`,e.danger&&`text-rose`),children:e.label},e.label))}):null]})}function be({skill:e}){let r=i(),[o,c]=(0,V.useState)(!1),l=v({queryKey:[`skill-update`,e.id,e.originHash],queryFn:()=>t.get(`/api/studio/skills/${e.id}/update`),staleTime:6e5,retry:!1}),d=w({mutationFn:n=>t.post(`/api/studio/skills/${e.id}/update`,{hash:n}),onSuccess:async()=>{c(!1),await r.invalidateQueries({queryKey:a.skill(e.id)}),await r.invalidateQueries({queryKey:a.skills(e.spaceId)})}}),f=l.data?.update;return!f||e.readOnly?null:(0,G.jsxs)(h,{className:`flex flex-wrap items-center gap-3 px-4 py-3`,children:[(0,G.jsx)(n,{className:`size-4 shrink-0 text-ember`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 text-[0.8125rem]`,children:P(`skills.updateAvailable`)}),(0,G.jsx)(p,{variant:`secondary`,size:`sm`,onClick:()=>c(!0),children:P(`skills.showChanges`)}),(0,G.jsx)(s,{open:o,onClose:()=>c(!1),wide:!0,height:`tall`,title:P(`skills.updateTitle`,{name:e.name}),children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(`p`,{className:`text-[0.875rem] text-ink-2`,children:f.description}),(0,G.jsx)(`div`,{className:`rounded-lg bg-paper-2 p-4`,children:(0,G.jsx)(u,{text:f.body})}),(0,G.jsx)(`ul`,{className:`flex flex-col gap-0.5 text-[0.8125rem]`,children:f.fileList.map(e=>(0,G.jsx)(`li`,{className:`font-mono`,children:e.path},e.path))}),(0,G.jsx)(C,{files:f.fileList,skipped:f.skipped}),d.error?(0,G.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:d.error.message}):null,(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(p,{busy:d.isPending,onClick:()=>d.mutate(f.hash),children:P(`skills.takeUpdate`)})})]})})]})}function Q({skillId:e,onGone:t,onOpen:n,filesFirst:r}){let i=q(e);return i.error?(0,G.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:i.error.message}):i.data?(0,G.jsx)($,{skill:i.data,onGone:t,onOpen:n,filesFirst:r},i.data.id):(0,G.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,G.jsx)(m,{className:`size-5`})})}function $({skill:e,onGone:n,onOpen:s,filesFirst:c}){let l=i(),d=e.source===`skills.sh`,g=!!e.bundle,_=e.readOnly||d||g,v=le(),b=ue(e.spaceId,v&&g).data?.find(t=>t.id===e.bundle?.id),[S,C]=(0,V.useState)({name:e.name,description:e.description,body:e.body,meta:e.meta,files:e.fileList}),[T,E]=(0,V.useState)(!1),[D,k]=(0,V.useState)(null),[A,j]=(0,V.useState)(!1),[M,I]=(0,V.useState)(null),[L,R]=(0,V.useState)(!1),z=te(S,async n=>{_||(await t.patch(`/api/studio/skills/${e.id}`,n),await l.invalidateQueries({queryKey:a.skills(e.spaceId)}))}),B=w({mutationFn:n=>t.patch(`/api/studio/skills/${e.id}`,{mode:n}),onSuccess:async()=>{await l.invalidateQueries({queryKey:a.skill(e.id)}),await l.invalidateQueries({queryKey:a.skills(e.spaceId)})}}),H=w({mutationFn:()=>t.del(`/api/studio/skills/${e.id}`),onSuccess:async()=>{await l.invalidateQueries({queryKey:a.skills(e.spaceId)}),n()}}),U=w({mutationFn:()=>t.post(`/api/studio/skills/${e.id}/copy`),onSuccess:async({id:t})=>{await l.invalidateQueries({queryKey:a.skills(e.spaceId)}),s(`k:${t}`)}}),W=S.files.find(e=>e.path===M)??null,K=D??re(S),q=e=>C(t=>({...t,...e})),Z=async()=>{await o(P(d?`skills.removeConfirm`:`skills.deleteConfirm`,{name:e.name}))&&H.mutate()},Q=z.error??B.error?.message??null,$=typeof e.meta.license==`string`?e.meta.license:null,xe=(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(y,{title:P(`skills.filesTitle`),children:_?null:(0,G.jsxs)(p,{variant:`secondary`,size:`sm`,onClick:()=>R(!0),children:[(0,G.jsx)(oe,{className:`size-4`}),` `,P(`skills.addFile`)]})}),S.files.length||e.blobList.length?(0,G.jsxs)(h,{className:`flex flex-col divide-y divide-border-soft overflow-hidden`,children:[S.files.map(e=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>I(e.path),className:`flex items-center gap-2.5 px-3 py-2.5 text-left transition hover:bg-accent`,children:[(0,G.jsx)(O,{className:`size-4 shrink-0 text-ink-3`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[0.8125rem]`,children:e.path}),(0,G.jsx)(`span`,{className:`shrink-0 text-[0.75rem] text-ink-3`,children:X(e.text)})]},e.path)),e.blobList.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5 px-3 py-2.5`,children:[(0,G.jsx)(pe,{className:`size-4 shrink-0 text-ink-3`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[0.8125rem]`,children:e.path}),(0,G.jsxs)(`span`,{className:`shrink-0 text-[0.75rem] text-ink-3`,children:[P(`skills.forScripts`),` · `,Y(e.bytes)]})]},e.path))]}):(0,G.jsx)(`p`,{className:`px-1 text-[0.8125rem] text-ink-3`,children:P(`skills.noFiles`)}),(0,G.jsx)(`p`,{className:`px-1 text-[0.75rem] text-ink-3`,children:P(`skills.filesHint`)}),e.blobList.length?(0,G.jsx)(`p`,{className:`px-1 text-[0.75rem] text-ink-3`,children:P(`skills.blobHint`)}):null]});return(0,G.jsxs)(`div`,{className:`flex flex-col gap-5 pb-20`,children:[(0,G.jsxs)(`header`,{className:`flex flex-wrap items-start gap-4`,children:[(0,G.jsx)(`span`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-ember-tint text-ember-strong`,children:(0,G.jsx)(ce,{className:`size-6`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[_?(0,G.jsx)(`h1`,{className:`font-medium font-mono text-2xl`,children:S.name}):(0,G.jsx)(ne,{fit:!0,value:S.name,label:P(`skills.name`),placeholder:P(`skills.namePlaceholder`),maxLength:x.name,onChange:e=>{k(null),q({name:e.toLowerCase().replace(/[^a-z0-9-]/g,`-`)})},className:`font-medium font-mono text-2xl`}),(0,G.jsx)(ie,{skill:e}),z.state===`saving`?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[0.75rem] text-ink-3`,children:[(0,G.jsx)(m,{className:`size-3`}),` `,P(`space.saving`)]}):z.state===`saved`?(0,G.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:P(`settings.saved`)}):null]}),_?(0,G.jsx)(`p`,{className:`mt-1 max-w-3xl text-[0.9375rem] text-ink-2 leading-relaxed`,children:S.description}):(0,G.jsx)(`textarea`,{value:S.description,"aria-label":P(`skills.description`),placeholder:P(`skills.descPlaceholder`),maxLength:x.description,rows:2,onChange:e=>{k(null),q({description:e.target.value})},className:`-mx-1 mt-1 block w-full max-w-3xl resize-none rounded-md bg-transparent px-1 py-0.5 text-[0.9375rem] text-ink-2 leading-relaxed outline-none transition placeholder:text-ink-4 hover:bg-paper-2 focus:bg-card focus:text-ink focus:ring-1 focus:ring-border`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-[0.75rem] text-ink-3`,children:P(`skills.descHint`)})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pt-1`,children:[(0,G.jsxs)(`a`,{href:ee(`/api/studio/skills/${e.id}/zip`),download:!0,className:`inline-flex h-8 items-center gap-2 rounded-full bg-card px-3 font-medium text-[0.8125rem] ring-1 ring-border transition hover:bg-accent`,children:[(0,G.jsx)(r,{className:`size-4`}),` `,P(`skills.download`)]}),e.readOnly||g?null:(0,G.jsx)(ye,{items:[...d?[]:[{label:P(`skills.copy`),onPick:()=>U.mutate()}],{label:P(d?`skills.remove`:`skills.delete`),danger:!0,onPick:Z}]})]})]}),d?(0,G.jsx)(be,{skill:e}):null,b?(0,G.jsx)(fe,{bundle:b,writable:!e.readOnly}):null,Q?(0,G.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:Q}):null,(0,G.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,G.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,G.jsxs)(y,{title:P(`skills.instructions`),children:[(0,G.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:P(`skills.chars`,{n:S.body.length.toLocaleString(N)})}),(0,G.jsx)(J,{code:T,onChange:E})]}),(0,G.jsx)(h,{className:`overflow-hidden`,children:T?(0,G.jsx)(F,{value:K,readOnly:_,onChange:e=>{k(e);try{let t=ae(e);j(!1),q({...t,files:S.files})}catch{j(!0)}},language:`markdown`,ariaLabel:`SKILL.md`,extensions:me,className:`min-h-[55vh] [&_.cm-editor]:min-h-[55vh] sm:[&_.cm-content]:py-5 sm:[&_.cm-line]:px-5`}):(0,G.jsx)(`div`,{className:`min-h-40 p-5 sm:px-8 sm:py-6`,children:S.body.trim()?(0,G.jsx)(u,{text:S.body}):(0,G.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:P(`skills.emptyBody`)})})}),T&&A?(0,G.jsx)(`p`,{className:`px-1 text-[0.8125rem] text-rose`,children:P(`skills.mdError`)}):null,d?(0,G.jsx)(`p`,{className:`px-1 text-[0.8125rem] text-ink-3`,children:P(`skills.readOnlyNote`)}):null,e.bundle?(0,G.jsx)(`p`,{className:`px-1 text-[0.8125rem] text-ink-3`,children:e.bundle.connectors.length?P(`skills.bundle.readOnlyNote`,{name:e.bundle.connectors.map(e=>e.name).join(`, `)}):P(`skills.bundle.readOnlyNotePlugin`,{name:e.bundle.name})}):null]}),(0,G.jsxs)(`aside`,{className:`flex flex-col gap-6`,children:[c?xe:null,(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(y,{title:P(`skills.when`)}),(0,G.jsx)(he,{value:e.mode,onChange:e=>B.mutate(e),disabled:e.readOnly||B.isPending})]}),(0,G.jsx)(ge,{skill:e}),d?(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(y,{title:P(`skills.origin`)}),(0,G.jsx)(h,{className:`p-4`,children:(0,G.jsxs)(`dl`,{className:`grid grid-cols-[6rem_minmax(0,1fr)] gap-y-2 text-[0.8125rem]`,children:[(0,G.jsx)(`dt`,{className:`text-ink-3`,children:P(`skills.source`)}),(0,G.jsx)(`dd`,{children:(0,G.jsx)(`a`,{href:`https://skills.sh/${e.origin}`,target:`_blank`,rel:`noreferrer`,className:`break-all underline hover:text-ink`,children:e.origin})}),$?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-ink-3`,children:P(`skills.license`)}),(0,G.jsx)(`dd`,{className:`break-words`,children:$})]}):null,e.originHash?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-ink-3`,children:P(`skills.version`)}),(0,G.jsx)(`dd`,{className:`font-mono text-[0.75rem]`,children:e.originHash.slice(0,12)})]}):null]})}),e.readOnly?null:(0,G.jsxs)(p,{variant:`secondary`,size:`sm`,className:`self-start`,busy:U.isPending,onClick:()=>U.mutate(),children:[(0,G.jsx)(se,{className:`size-4`}),` `,P(`skills.copy`)]})]}):null,e.bundle?(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(y,{title:P(`skills.origin`)}),(0,G.jsx)(h,{className:`p-4`,children:(0,G.jsxs)(`dl`,{className:`grid grid-cols-[6rem_minmax(0,1fr)] gap-y-2 text-[0.8125rem]`,children:[e.bundle.connectors.length?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-ink-3`,children:P(`skills.bundle.connector`)}),(0,G.jsx)(`dd`,{children:(0,G.jsx)(f,{to:`/capabilities/connectors`,className:`underline hover:text-ink`,children:e.bundle.connectors.map(e=>e.name).join(`, `)})})]}):null,(0,G.jsx)(`dt`,{className:`text-ink-3`,children:P(`skills.bundle.plugin`)}),(0,G.jsx)(`dd`,{className:`break-words`,children:e.bundle.name}),e.origin?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-ink-3`,children:P(`skills.bundle.folder`)}),(0,G.jsx)(`dd`,{className:`break-all font-mono text-[0.75rem]`,children:e.origin})]}):null,$?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-ink-3`,children:P(`skills.license`)}),(0,G.jsx)(`dd`,{className:`break-words`,children:$})]}):null]})}),e.readOnly?null:(0,G.jsxs)(p,{variant:`secondary`,size:`sm`,className:`self-start`,busy:U.isPending,onClick:()=>U.mutate(),children:[(0,G.jsx)(se,{className:`size-4`}),` `,P(`skills.copy`)]})]}):null,c?null:xe]})]}),b&&!b.connectors.length&&!e.readOnly?(0,G.jsx)(de,{bundle:b,onGone:n}):null,(0,G.jsx)(_e,{file:W,readOnly:_,onClose:()=>I(null),onChange:e=>q({files:S.files.map(t=>t.path===M?{...t,text:e}:t)}),onDelete:()=>{q({files:S.files.filter(e=>e.path!==M)}),I(null)}}),(0,G.jsx)(ve,{open:L,taken:S.files.map(e=>e.path),onClose:()=>R(!1),onMade:e=>{q({files:[...S.files,{path:e,text:``}].sort((e,t)=>e.path.localeCompare(t.path))}),R(!1),I(e)}})]})}export{Q as SkillEditor};
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,An as n,Jn as r,Wr as i,Z as a,a as o,an as s,cn as c,hn as l,kt as u,ln as d,lr as f,mt as ee,nn as p,pn as m,q as te,rn as h,sn as g,vn as _,y as ne,yr as v}from"./ui-BjhZhw8x.js";import{a as y,d as re,f as b,l as x,n as S,s as ie,t as C,u as ae}from"./Skills-_pLGtOjH.js";import{t as w}from"./useMutation-CoEdB_9_.js";import{t as T}from"./code-xml-CdJeig44.js";import{d as E,i as oe,l as se,r as D,s as O}from"./marked.esm-BfGIZK7F.js";import{t as k}from"./eye-CG1LzvNI.js";import{n as A,t as ce}from"./scroll-text-DmK2IucJ.js";import{n as j,t as M}from"./jsx-runtime-C3cWAN_r.js";import{n as N,s as P}from"./i18n-ClCOlfx2.js";import{d as le}from"./session-Dd9duhPc.js";import{t as F}from"./code-editor-B8zG80PA.js";import{N as I,a as L,r as R,t as z}from"./dist-Bux-wzFO.js";import{c as ue,n as de,t as fe}from"./Bundle-RNkjBwAL.js";var B={name:`file-archive`,size:24,node:[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]};B.node;var pe=E(B),V=e(j(),1),H=z.line({class:`cm-frontmatter`});function U(e){let t=new I,n=e.state.doc;if(n.lines>1&&n.line(1).text.trim()===`---`){for(let e=2;e<=Math.min(n.lines,80);e++)if(n.line(e).text.trim()===`---`){for(let r=1;r<=e;r++)t.add(n.line(r).from,n.line(r).from,H);break}}return t.finish()}function W(){return[L.fromClass(class{decorations;constructor(e){this.decorations=U(e)}update(e){e.docChanged&&(this.decorations=U(e.view))}},{decorations:e=>e.decorations}),R.theme({".cm-frontmatter, .cm-frontmatter *":{fontFamily:`var(--f-mono)`,fontSize:`0.8125rem !important`,fontWeight:`400 !important`,color:`var(--ink-3) !important`,textDecoration:`none !important`}})]}var G=e(M(),1),K=[`always`,`demand`,`off`],me=W();function q(e){return v({queryKey:a.skill(e),queryFn:()=>t.get(`/api/studio/skills/${e}`)})}function he({value:e,onChange:t,disabled:n}){return(0,G.jsx)(`fieldset`,{"aria-label":P(`skills.modeLabel`),className:`m-0 min-w-0 border-0 p-0 flex flex-col gap-2`,children:K.map(r=>{let i=r===e,a=S[r];return(0,G.jsxs)(`button`,{type:`button`,"aria-pressed":i,disabled:n,onClick:()=>!i&&t(r),className:_(`flex items-start gap-3 rounded-xl bg-card p-3 text-left ring-1 transition disabled:pointer-events-none`,i?`ring-ember shadow-[0_0_0_3px] shadow-ember-tint`:`ring-border-soft hover:ring-ink-4`,n&&!i&&`opacity-60`),children:[(0,G.jsx)(`span`,{className:_(`flex size-8 shrink-0 items-center justify-center rounded-lg`,i?`bg-ember-tint text-ember-strong`:`bg-paper-2 text-ink-3`),children:(0,G.jsx)(a,{className:`size-4`})}),(0,G.jsxs)(`span`,{className:`min-w-0`,children:[(0,G.jsx)(`span`,{className:`block font-medium text-[0.8125rem]`,children:P(`skills.mode.${r}`)}),(0,G.jsx)(`span`,{className:`block text-[0.75rem] text-ink-3 leading-snug`,children:P(`skills.modeHint.${r}`)})]})]},r)})})}function ge({skill:e}){let n=i(),r=w({mutationFn:n=>t.patch(`/api/studio/skills/${e.id}`,{runScripts:n}),onSuccess:async()=>{await n.invalidateQueries({queryKey:a.skill(e.id)}),await n.invalidateQueries({queryKey:a.skills(e.spaceId)})}}),o=e.source!==`own`&&!e.official;return(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(y,{title:P(`skills.scriptsTitle`)}),(0,G.jsxs)(h,{className:`flex flex-col gap-2 p-4`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`span`,{className:`flex-1 font-medium text-[0.8125rem]`,children:P(`skills.runScripts`)}),(0,G.jsx)(l,{checked:e.runScripts,label:P(`skills.runScripts`),disabled:e.readOnly||r.isPending,onChange:e=>r.mutate(e)})]}),(0,G.jsx)(`p`,{className:`text-[0.75rem] text-ink-3 leading-snug`,children:P(`skills.runScriptsHint`)}),o?(0,G.jsx)(`p`,{className:`rounded-lg bg-amber-tint px-3 py-2 text-[0.75rem] text-ink-2 leading-snug`,children:P(`skills.runScriptsWarn`)}):null,r.error?(0,G.jsx)(`p`,{className:`text-[0.75rem] text-rose`,children:r.error.message}):null]})]})}function J({code:e,onChange:t}){return(0,G.jsxs)(p,{variant:`secondary`,size:`sm`,"aria-pressed":e,onClick:()=>t(!e),children:[e?(0,G.jsx)(k,{className:`size-4`}):(0,G.jsx)(T,{className:`size-4`}),P(e?`skills.rendered`:`skills.code`)]})}var Y=e=>`${(e/1e3).toLocaleString(N,{maximumFractionDigits:1})} KB`,X=e=>Y(new TextEncoder().encode(e).length),Z=e=>/\.(md|markdown|mdx)$/i.test(e);function _e({file:e,readOnly:t,onChange:n,onDelete:r,onClose:i}){let[a,o]=(0,V.useState)(!1),c=e?Z(e.path):!1,l=a||!c;return(0,G.jsx)(s,{open:e!==null,onClose:i,wide:!0,height:`tall`,title:e?(0,G.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(O,{className:`size-4 shrink-0 text-ink-3`}),(0,G.jsx)(`span`,{className:`truncate font-mono text-[0.9375rem]`,children:e.path})]}):null,children:e?(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`span`,{className:`flex-1 text-[0.75rem] text-ink-3`,children:X(e.text)}),c?(0,G.jsx)(J,{code:a,onChange:o}):null]}),(0,G.jsx)(h,{className:`overflow-hidden`,children:l?(0,G.jsx)(F,{value:e.text,onChange:n,readOnly:t,language:`markdown`,ariaLabel:e.path,className:`min-h-[50vh] [&_.cm-editor]:min-h-[50vh]`}):(0,G.jsx)(`div`,{className:`p-5`,children:(0,G.jsx)(u,{text:e.text})})}),(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t?null:(0,G.jsxs)(p,{variant:`danger`,size:`sm`,onClick:r,children:[(0,G.jsx)(D,{className:`size-4`}),` `,P(`skills.deleteFile`)]}),(0,G.jsx)(`span`,{className:`flex-1`}),(0,G.jsx)(p,{size:`sm`,onClick:i,children:P(`skills.done`)})]})]}):null})}function ve({open:e,taken:t,onClose:n,onMade:r}){let[i,a]=(0,V.useState)(``),o=i.trim().replace(/^\.?\//,``),l=b(o)&&o!==`SKILL.md`&&!t.includes(o);return(0,G.jsx)(s,{open:e,onClose:n,title:P(`skills.newFile`),children:(0,G.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),l&&(r(o),a(``))},children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(d,{children:P(`skills.filePath`)}),(0,G.jsx)(c,{"data-autofocus":!0,value:i,placeholder:P(`skills.filePathHint`),onChange:e=>a(e.target.value),className:`font-mono`})]}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,G.jsx)(p,{variant:`ghost`,onClick:n,children:P(`common.cancel`)}),(0,G.jsx)(p,{type:`submit`,disabled:!l,children:P(`skills.create`)})]})]})})}function ye({items:e}){let[t,n]=(0,V.useState)(!1),r=(0,V.useRef)(null);return(0,V.useEffect)(()=>{if(!t)return;let e=e=>{r.current?.contains(e.target)||n(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[t]),(0,G.jsxs)(`div`,{className:`relative`,ref:r,children:[(0,G.jsx)(g,{label:P(`skills.more`),"aria-haspopup":`menu`,"aria-expanded":t,onClick:()=>n(e=>!e),className:`ring-1 ring-border`,children:(0,G.jsx)(A,{className:`size-4`})}),t?(0,G.jsx)(`div`,{role:`menu`,className:`absolute top-11 right-0 z-50 w-56 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:e.map(e=>(0,G.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{n(!1),e.onPick()},className:_(`w-full rounded-lg px-2.5 py-2 text-left text-[0.8125rem] transition hover:bg-accent`,e.danger&&`text-rose`),children:e.label},e.label))}):null]})}function be({skill:e}){let r=i(),[o,c]=(0,V.useState)(!1),l=v({queryKey:[`skill-update`,e.id,e.originHash],queryFn:()=>t.get(`/api/studio/skills/${e.id}/update`),staleTime:6e5,retry:!1}),d=w({mutationFn:n=>t.post(`/api/studio/skills/${e.id}/update`,{hash:n}),onSuccess:async()=>{c(!1),await r.invalidateQueries({queryKey:a.skill(e.id)}),await r.invalidateQueries({queryKey:a.skills(e.spaceId)})}}),f=l.data?.update;return!f||e.readOnly?null:(0,G.jsxs)(h,{className:`flex flex-wrap items-center gap-3 px-4 py-3`,children:[(0,G.jsx)(n,{className:`size-4 shrink-0 text-ember`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 text-[0.8125rem]`,children:P(`skills.updateAvailable`)}),(0,G.jsx)(p,{variant:`secondary`,size:`sm`,onClick:()=>c(!0),children:P(`skills.showChanges`)}),(0,G.jsx)(s,{open:o,onClose:()=>c(!1),wide:!0,height:`tall`,title:P(`skills.updateTitle`,{name:e.name}),children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsx)(`p`,{className:`text-[0.875rem] text-ink-2`,children:f.description}),(0,G.jsx)(`div`,{className:`rounded-lg bg-paper-2 p-4`,children:(0,G.jsx)(u,{text:f.body})}),(0,G.jsx)(`ul`,{className:`flex flex-col gap-0.5 text-[0.8125rem]`,children:f.fileList.map(e=>(0,G.jsx)(`li`,{className:`font-mono`,children:e.path},e.path))}),(0,G.jsx)(C,{files:f.fileList,skipped:f.skipped}),d.error?(0,G.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:d.error.message}):null,(0,G.jsx)(`div`,{className:`flex justify-end`,children:(0,G.jsx)(p,{busy:d.isPending,onClick:()=>d.mutate(f.hash),children:P(`skills.takeUpdate`)})})]})})]})}function Q({skillId:e,onGone:t,onOpen:n,filesFirst:r}){let i=q(e);return i.error?(0,G.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:i.error.message}):i.data?(0,G.jsx)($,{skill:i.data,onGone:t,onOpen:n,filesFirst:r},i.data.id):(0,G.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,G.jsx)(m,{className:`size-5`})})}function $({skill:e,onGone:n,onOpen:s,filesFirst:c}){let l=i(),d=e.source===`skills.sh`,g=!!e.bundle,_=e.readOnly||d||g,v=le(),b=ue(e.spaceId,v&&g).data?.find(t=>t.id===e.bundle?.id),[S,C]=(0,V.useState)({name:e.name,description:e.description,body:e.body,meta:e.meta,files:e.fileList}),[T,E]=(0,V.useState)(!1),[D,k]=(0,V.useState)(null),[A,j]=(0,V.useState)(!1),[M,I]=(0,V.useState)(null),[L,R]=(0,V.useState)(!1),z=te(S,async n=>{_||(await t.patch(`/api/studio/skills/${e.id}`,n),await l.invalidateQueries({queryKey:a.skills(e.spaceId)}))}),B=w({mutationFn:n=>t.patch(`/api/studio/skills/${e.id}`,{mode:n}),onSuccess:async()=>{await l.invalidateQueries({queryKey:a.skill(e.id)}),await l.invalidateQueries({queryKey:a.skills(e.spaceId)})}}),H=w({mutationFn:()=>t.del(`/api/studio/skills/${e.id}`),onSuccess:async()=>{await l.invalidateQueries({queryKey:a.skills(e.spaceId)}),n()}}),U=w({mutationFn:()=>t.post(`/api/studio/skills/${e.id}/copy`),onSuccess:async({id:t})=>{await l.invalidateQueries({queryKey:a.skills(e.spaceId)}),s(`k:${t}`)}}),W=S.files.find(e=>e.path===M)??null,K=D??re(S),q=e=>C(t=>({...t,...e})),Z=async()=>{await o(P(d?`skills.removeConfirm`:`skills.deleteConfirm`,{name:e.name}))&&H.mutate()},Q=z.error??B.error?.message??null,$=typeof e.meta.license==`string`?e.meta.license:null,xe=(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(y,{title:P(`skills.filesTitle`),children:_?null:(0,G.jsxs)(p,{variant:`secondary`,size:`sm`,onClick:()=>R(!0),children:[(0,G.jsx)(oe,{className:`size-4`}),` `,P(`skills.addFile`)]})}),S.files.length||e.blobList.length?(0,G.jsxs)(h,{className:`flex flex-col divide-y divide-border-soft overflow-hidden`,children:[S.files.map(e=>(0,G.jsxs)(`button`,{type:`button`,onClick:()=>I(e.path),className:`flex items-center gap-2.5 px-3 py-2.5 text-left transition hover:bg-accent`,children:[(0,G.jsx)(O,{className:`size-4 shrink-0 text-ink-3`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[0.8125rem]`,children:e.path}),(0,G.jsx)(`span`,{className:`shrink-0 text-[0.75rem] text-ink-3`,children:X(e.text)})]},e.path)),e.blobList.map(e=>(0,G.jsxs)(`div`,{className:`flex items-center gap-2.5 px-3 py-2.5`,children:[(0,G.jsx)(pe,{className:`size-4 shrink-0 text-ink-3`}),(0,G.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[0.8125rem]`,children:e.path}),(0,G.jsxs)(`span`,{className:`shrink-0 text-[0.75rem] text-ink-3`,children:[P(`skills.forScripts`),` · `,Y(e.bytes)]})]},e.path))]}):(0,G.jsx)(`p`,{className:`px-1 text-[0.8125rem] text-ink-3`,children:P(`skills.noFiles`)}),(0,G.jsx)(`p`,{className:`px-1 text-[0.75rem] text-ink-3`,children:P(`skills.filesHint`)}),e.blobList.length?(0,G.jsx)(`p`,{className:`px-1 text-[0.75rem] text-ink-3`,children:P(`skills.blobHint`)}):null]});return(0,G.jsxs)(`div`,{className:`flex flex-col gap-5 pb-20`,children:[(0,G.jsxs)(`header`,{className:`flex flex-wrap items-start gap-4`,children:[(0,G.jsx)(`span`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-ember-tint text-ember-strong`,children:(0,G.jsx)(ce,{className:`size-6`})}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[_?(0,G.jsx)(`h1`,{className:`font-medium font-mono text-2xl`,children:S.name}):(0,G.jsx)(ne,{fit:!0,value:S.name,label:P(`skills.name`),placeholder:P(`skills.namePlaceholder`),maxLength:x.name,onChange:e=>{k(null),q({name:e.toLowerCase().replace(/[^a-z0-9-]/g,`-`)})},className:`font-medium font-mono text-2xl`}),(0,G.jsx)(ie,{skill:e}),z.state===`saving`?(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[0.75rem] text-ink-3`,children:[(0,G.jsx)(m,{className:`size-3`}),` `,P(`space.saving`)]}):z.state===`saved`?(0,G.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:P(`settings.saved`)}):null]}),_?(0,G.jsx)(`p`,{className:`mt-1 max-w-3xl text-[0.9375rem] text-ink-2 leading-relaxed`,children:S.description}):(0,G.jsx)(`textarea`,{value:S.description,"aria-label":P(`skills.description`),placeholder:P(`skills.descPlaceholder`),maxLength:x.description,rows:2,onChange:e=>{k(null),q({description:e.target.value})},className:`-mx-1 mt-1 block w-full max-w-3xl resize-none rounded-md bg-transparent px-1 py-0.5 text-[0.9375rem] text-ink-2 leading-relaxed outline-none transition placeholder:text-ink-4 hover:bg-paper-2 focus:bg-card focus:text-ink focus:ring-1 focus:ring-border`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-[0.75rem] text-ink-3`,children:P(`skills.descHint`)})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pt-1`,children:[(0,G.jsxs)(`a`,{href:ee(`/api/studio/skills/${e.id}/zip`),download:!0,className:`inline-flex h-8 items-center gap-2 rounded-full bg-card px-3 font-medium text-[0.8125rem] ring-1 ring-border transition hover:bg-accent`,children:[(0,G.jsx)(r,{className:`size-4`}),` `,P(`skills.download`)]}),e.readOnly||g?null:(0,G.jsx)(ye,{items:[...d?[]:[{label:P(`skills.copy`),onPick:()=>U.mutate()}],{label:P(d?`skills.remove`:`skills.delete`),danger:!0,onPick:Z}]})]})]}),d?(0,G.jsx)(be,{skill:e}):null,b?(0,G.jsx)(fe,{bundle:b,writable:!e.readOnly}):null,Q?(0,G.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:Q}):null,(0,G.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,G.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,G.jsxs)(y,{title:P(`skills.instructions`),children:[(0,G.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:P(`skills.chars`,{n:S.body.length.toLocaleString(N)})}),(0,G.jsx)(J,{code:T,onChange:E})]}),(0,G.jsx)(h,{className:`overflow-hidden`,children:T?(0,G.jsx)(F,{value:K,readOnly:_,onChange:e=>{k(e);try{let t=ae(e);j(!1),q({...t,files:S.files})}catch{j(!0)}},language:`markdown`,ariaLabel:`SKILL.md`,extensions:me,className:`min-h-[55vh] [&_.cm-editor]:min-h-[55vh] sm:[&_.cm-content]:py-5 sm:[&_.cm-line]:px-5`}):(0,G.jsx)(`div`,{className:`min-h-40 p-5 sm:px-8 sm:py-6`,children:S.body.trim()?(0,G.jsx)(u,{text:S.body}):(0,G.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:P(`skills.emptyBody`)})})}),T&&A?(0,G.jsx)(`p`,{className:`px-1 text-[0.8125rem] text-rose`,children:P(`skills.mdError`)}):null,d?(0,G.jsx)(`p`,{className:`px-1 text-[0.8125rem] text-ink-3`,children:P(`skills.readOnlyNote`)}):null,e.bundle?(0,G.jsx)(`p`,{className:`px-1 text-[0.8125rem] text-ink-3`,children:e.bundle.connectors.length?P(`skills.bundle.readOnlyNote`,{name:e.bundle.connectors.map(e=>e.name).join(`, `)}):P(`skills.bundle.readOnlyNotePlugin`,{name:e.bundle.name})}):null]}),(0,G.jsxs)(`aside`,{className:`flex flex-col gap-6`,children:[c?xe:null,(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(y,{title:P(`skills.when`)}),(0,G.jsx)(he,{value:e.mode,onChange:e=>B.mutate(e),disabled:e.readOnly||B.isPending})]}),(0,G.jsx)(ge,{skill:e}),d?(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(y,{title:P(`skills.origin`)}),(0,G.jsx)(h,{className:`p-4`,children:(0,G.jsxs)(`dl`,{className:`grid grid-cols-[6rem_minmax(0,1fr)] gap-y-2 text-[0.8125rem]`,children:[(0,G.jsx)(`dt`,{className:`text-ink-3`,children:P(`skills.source`)}),(0,G.jsx)(`dd`,{children:(0,G.jsx)(`a`,{href:`https://skills.sh/${e.origin}`,target:`_blank`,rel:`noreferrer`,className:`break-all underline hover:text-ink`,children:e.origin})}),$?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-ink-3`,children:P(`skills.license`)}),(0,G.jsx)(`dd`,{className:`break-words`,children:$})]}):null,e.originHash?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-ink-3`,children:P(`skills.version`)}),(0,G.jsx)(`dd`,{className:`font-mono text-[0.75rem]`,children:e.originHash.slice(0,12)})]}):null]})}),e.readOnly?null:(0,G.jsxs)(p,{variant:`secondary`,size:`sm`,className:`self-start`,busy:U.isPending,onClick:()=>U.mutate(),children:[(0,G.jsx)(se,{className:`size-4`}),` `,P(`skills.copy`)]})]}):null,e.bundle?(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(y,{title:P(`skills.origin`)}),(0,G.jsx)(h,{className:`p-4`,children:(0,G.jsxs)(`dl`,{className:`grid grid-cols-[6rem_minmax(0,1fr)] gap-y-2 text-[0.8125rem]`,children:[e.bundle.connectors.length?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-ink-3`,children:P(`skills.bundle.connector`)}),(0,G.jsx)(`dd`,{children:(0,G.jsx)(f,{to:`/capabilities/connectors`,className:`underline hover:text-ink`,children:e.bundle.connectors.map(e=>e.name).join(`, `)})})]}):null,(0,G.jsx)(`dt`,{className:`text-ink-3`,children:P(`skills.bundle.plugin`)}),(0,G.jsx)(`dd`,{className:`break-words`,children:e.bundle.name}),e.origin?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-ink-3`,children:P(`skills.bundle.folder`)}),(0,G.jsx)(`dd`,{className:`break-all font-mono text-[0.75rem]`,children:e.origin})]}):null,$?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`dt`,{className:`text-ink-3`,children:P(`skills.license`)}),(0,G.jsx)(`dd`,{className:`break-words`,children:$})]}):null]})}),e.readOnly?null:(0,G.jsxs)(p,{variant:`secondary`,size:`sm`,className:`self-start`,busy:U.isPending,onClick:()=>U.mutate(),children:[(0,G.jsx)(se,{className:`size-4`}),` `,P(`skills.copy`)]})]}):null,c?null:xe]})]}),b&&!b.connectors.length&&!e.readOnly?(0,G.jsx)(de,{bundle:b,onGone:n}):null,(0,G.jsx)(_e,{file:W,readOnly:_,onClose:()=>I(null),onChange:e=>q({files:S.files.map(t=>t.path===M?{...t,text:e}:t)}),onDelete:()=>{q({files:S.files.filter(e=>e.path!==M)}),I(null)}}),(0,G.jsx)(ve,{open:L,taken:S.files.map(e=>e.path),onClose:()=>R(!1),onMade:e=>{q({files:[...S.files,{path:e,text:``}].sort((e,t)=>e.path.localeCompare(t.path))}),R(!1),I(e)}})]})}export{Q as SkillEditor};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,C as n,Mn as r,On as i,Tn as a,Wr as o,Z as s,an as c,cn as l,er as u,hn as d,in as f,kt as p,ln as m,nn as h,on as g,or as _,pn as v,rn as y,vn as b,yr as x}from"./ui-D4qQLcbs.js";import{t as S}from"./useMutation-CUZC19i3.js";import{d as C,i as w}from"./marked.esm-BfGIZK7F.js";import{t as T}from"./plug-CHvl1GhO.js";import{t as E}from"./upload-BZThm-R6.js";import{n as D,t as O}from"./jsx-runtime-C3cWAN_r.js";import{n as k,s as A}from"./i18n-DPqdH1PJ.js";var j={name:`badge-check`,size:24,node:[[`path`,{d:`M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z`,key:`3c2336`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`verified`]};j.node;var M=C(j),N={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};N.node;var P=C(N),F={name:`circle-off`,size:24,node:[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.35 2.69A10 10 0 0 1 21.3 15.65`,key:`1pfsoa`}],[`path`,{d:`M19.08 19.08A10 10 0 1 1 4.92 4.92`,key:`1ablyi`}]]};F.node;var ee=C(F),I={name:64,description:1024,skillMd:1e5,file:256e3,total:1e6,files:100,perSpace:100,always:5,alwaysChars:2e4,listed:50,blobFile:5e6,blobTotal:2e7,blobFiles:200};function L(e){return!e||e.length>200||e.startsWith(`/`)||e.includes(`\\`)?!1:e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&/^[\w.@+ -]+$/.test(e))}var te=/\.(py|sh|bash|zsh|js|mjs|cjs|ts|rb|php|go|rs)$/i;function R(e){return te.test(e)}var z=class extends Error{problem;constructor(e){super(`SKILL.md: ${e}`),this.problem=e}};function B(e){let t=e.trim();if(t.length>=2&&t.startsWith(`"`)&&t.endsWith(`"`))try{return JSON.parse(t)}catch{return t.slice(1,-1)}return t.length>=2&&t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1).replace(/''/g,`'`):t}function ne(e,t){let n=Math.min(...t.filter(e=>e.trim()).map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(Number.isFinite(n)?n:0)),i;return i=e.startsWith(`|`)?r.join(`
1
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$ as t,C as n,Mn as r,On as i,Tn as a,Wr as o,Z as s,an as c,cn as l,er as u,hn as d,in as f,kt as p,ln as m,nn as h,on as g,or as _,pn as v,rn as y,vn as b,yr as x}from"./ui-BjhZhw8x.js";import{t as S}from"./useMutation-CoEdB_9_.js";import{d as C,i as w}from"./marked.esm-BfGIZK7F.js";import{t as T}from"./plug-CHvl1GhO.js";import{t as E}from"./upload-BZThm-R6.js";import{n as D,t as O}from"./jsx-runtime-C3cWAN_r.js";import{n as k,s as A}from"./i18n-ClCOlfx2.js";var j={name:`badge-check`,size:24,node:[[`path`,{d:`M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z`,key:`3c2336`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`verified`]};j.node;var M=C(j),N={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};N.node;var P=C(N),F={name:`circle-off`,size:24,node:[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.35 2.69A10 10 0 0 1 21.3 15.65`,key:`1pfsoa`}],[`path`,{d:`M19.08 19.08A10 10 0 1 1 4.92 4.92`,key:`1ablyi`}]]};F.node;var ee=C(F),I={name:64,description:1024,skillMd:1e5,file:256e3,total:1e6,files:100,perSpace:100,always:5,alwaysChars:2e4,listed:50,blobFile:5e6,blobTotal:2e7,blobFiles:200};function L(e){return!e||e.length>200||e.startsWith(`/`)||e.includes(`\\`)?!1:e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`&&/^[\w.@+ -]+$/.test(e))}var te=/\.(py|sh|bash|zsh|js|mjs|cjs|ts|rb|php|go|rs)$/i;function R(e){return te.test(e)}var z=class extends Error{problem;constructor(e){super(`SKILL.md: ${e}`),this.problem=e}};function B(e){let t=e.trim();if(t.length>=2&&t.startsWith(`"`)&&t.endsWith(`"`))try{return JSON.parse(t)}catch{return t.slice(1,-1)}return t.length>=2&&t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1).replace(/''/g,`'`):t}function ne(e,t){let n=Math.min(...t.filter(e=>e.trim()).map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(Number.isFinite(n)?n:0)),i;return i=e.startsWith(`|`)?r.join(`
2
2
  `):r.join(`
3
3
  `).replace(/([^\n])\n(?!\n)/g,`$1 `).replace(/\n\n/g,`
4
4
  `),e.includes(`-`)?i.replace(/\s+$/,``):`${i.replace(/\n*$/,``)}\n`}function re(e){let t={},n=e.replace(/\r\n?/g,`