wizards 0.2.15 → 0.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/runtime/dist/engine/requirements.js +140 -12
- package/apps/runtime/dist/engine/runner.js +27 -4
- package/apps/runtime/dist/services/marketplace.js +33 -6
- package/apps/web/dist/assets/{Account-B_FCuidz.js → Account-BE_W101C.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-BKvNJIrA.js → ChangelogDialog-DjKQJAos.js} +1 -1
- package/apps/web/dist/assets/{ChatPanel-CPgh0skF.js → ChatPanel-BWrcDs4s.js} +1 -1
- package/apps/web/dist/assets/{CreditsDialog-CbFq_7-m.js → CreditsDialog-DUjR5xkl.js} +1 -1
- package/apps/web/dist/assets/{EditorPage-8liZwYCK.js → EditorPage-CrOqikP2.js} +1 -1
- package/apps/web/dist/assets/{FlowPreview-De3ZyIer.js → FlowPreview-DK4RZqTW.js} +1 -1
- package/apps/web/dist/assets/{Harness-3kuJaJoj.js → Harness-DcI94f1U.js} +1 -1
- package/apps/web/dist/assets/{HomePage-DWDT64vg.js → HomePage-BBNFgryu.js} +1 -1
- package/apps/web/dist/assets/{ImportWizard-CTGmBDI8.js → ImportWizard-BoYqovdl.js} +1 -1
- package/apps/web/dist/assets/{LocalRuntime-CVdU8RtD.js → LocalRuntime-BD8zGN8w.js} +1 -1
- package/apps/web/dist/assets/NewWizardPage-tKV2S4eK.js +2 -0
- package/apps/web/dist/assets/{ProjectPage-CDw2Jcxx.js → ProjectPage-voR0hvzy.js} +1 -1
- package/apps/web/dist/assets/{PublicRunner-BYnX2OmB.js → PublicRunner-CYZE_hSi.js} +1 -1
- package/apps/web/dist/assets/RunnerView-D_C7hn81.js +70 -0
- package/apps/web/dist/assets/{SettingsPage-Bj0TxbiM.js → SettingsPage-DguoPF_3.js} +1 -1
- package/apps/web/dist/assets/{SetupPage-DHQYO7zB.js → SetupPage-qxHvlf87.js} +1 -1
- package/apps/web/dist/assets/{SharePage-CY6bwfTI.js → SharePage-Cf3i7KB-.js} +1 -1
- package/apps/web/dist/assets/{api-RJbFM_oc.js → api-t9_w1XNe.js} +1 -1
- package/apps/web/dist/assets/changelog-kz0DmHY4.js +1 -0
- package/apps/web/dist/assets/{esm-CgnVZhIQ.js → esm-D0YVMTdo.js} +1 -1
- package/apps/web/dist/assets/{index-9maLuK9R.css → index-BPpKz65x.css} +1 -1
- package/apps/web/dist/assets/{index-LmRYEd-y.js → index-D5w3fW1p.js} +3 -3
- package/apps/web/dist/assets/{meta-CchZXdWH.js → meta-BJHYbMh7.js} +1 -1
- package/apps/web/dist/assets/{settings-menu-CrRWSrNL.js → settings-menu-BqqUAvIY.js} +1 -1
- package/apps/web/dist/assets/ui-BHXO_e0e.js +1 -0
- package/apps/web/dist/index.html +4 -4
- package/apps/web/dist/mcp/flow.html +5 -5
- package/node_modules/@engenty-wizards/shared/dist/definition.d.ts +1 -0
- package/node_modules/@engenty-wizards/shared/dist/definition.js +2 -2
- package/node_modules/@engenty-wizards/shared/dist/marketplace.d.ts +2 -0
- package/node_modules/@engenty-wizards/shared/dist/run.d.ts +9 -0
- package/package.json +1 -1
- package/apps/web/dist/assets/NewWizardPage-CqFlo0b-.js +0 -2
- package/apps/web/dist/assets/RunnerView-Civq59Tk.js +0 -70
- package/apps/web/dist/assets/changelog-BWtvjeKs.js +0 -1
- package/apps/web/dist/assets/ui-HV_XbHjw.js +0 -1
|
@@ -1418,6 +1418,7 @@ export declare function branchValues(values: Record<string, unknown>, outputs: R
|
|
|
1418
1418
|
}>): Record<string, unknown>;
|
|
1419
1419
|
/** The step after `step`, honouring its branch rules. `null` = the end. */
|
|
1420
1420
|
export declare function nextStepId(def: WizardDefinition, stepId: string, values: Record<string, unknown>): string | null;
|
|
1421
|
+
export declare function ruleMatches(rule: NextRule, values: Record<string, unknown>): boolean;
|
|
1421
1422
|
export interface ItemsTotals {
|
|
1422
1423
|
rows: Record<string, unknown>[];
|
|
1423
1424
|
net: number;
|
|
@@ -735,7 +735,7 @@ export function nextStepId(def, stepId, values) {
|
|
|
735
735
|
return null;
|
|
736
736
|
}
|
|
737
737
|
for (const rule of step.next ?? []) {
|
|
738
|
-
if (
|
|
738
|
+
if (ruleMatches(rule, values)) {
|
|
739
739
|
return rule.goto === "end" ? null : rule.goto;
|
|
740
740
|
}
|
|
741
741
|
}
|
|
@@ -744,7 +744,7 @@ export function nextStepId(def, stepId, values) {
|
|
|
744
744
|
function isEmptyValue(v) {
|
|
745
745
|
return v === undefined || v === null || v === "" || (Array.isArray(v) && v.length === 0);
|
|
746
746
|
}
|
|
747
|
-
function
|
|
747
|
+
export function ruleMatches(rule, values) {
|
|
748
748
|
const v = values[rule.when.field];
|
|
749
749
|
switch (rule.when.op) {
|
|
750
750
|
case "empty":
|
|
@@ -295,4 +295,6 @@ export interface MarketplaceEntry extends MarketplaceSummary {
|
|
|
295
295
|
starred: boolean;
|
|
296
296
|
/** What it needs that this runtime has no model for: a wizard made from it would not start. */
|
|
297
297
|
missing: Capability[];
|
|
298
|
+
/** What only some of its paths need and this runtime has no model for: it runs the other ways. */
|
|
299
|
+
optional: Capability[];
|
|
298
300
|
}
|
|
@@ -131,6 +131,8 @@ export interface RunView {
|
|
|
131
131
|
values: Record<string, unknown>;
|
|
132
132
|
/** What fields of the current page start with, from earlier steps (`prefill`). */
|
|
133
133
|
prefill: Record<string, unknown>;
|
|
134
|
+
/** Choices of the current page that lead to a step without a model here, by field id. */
|
|
135
|
+
closed: Record<string, ClosedChoice>;
|
|
134
136
|
outputs: Record<string, StepOutput>;
|
|
135
137
|
/** Steps whose outputs the current step shows, with their definitions. */
|
|
136
138
|
shown: {
|
|
@@ -209,6 +211,13 @@ export interface MissingModel {
|
|
|
209
211
|
/** A step that needs it lies on every path: the run cannot start. */
|
|
210
212
|
blocking: boolean;
|
|
211
213
|
}
|
|
214
|
+
/** A page's choice whose values lead to a step this runtime has no model for. */
|
|
215
|
+
export interface ClosedChoice {
|
|
216
|
+
/** The options (or a toggle's true / false) that lead there; empty = the field as a whole. */
|
|
217
|
+
values: (string | boolean)[];
|
|
218
|
+
/** What is missing on the way. */
|
|
219
|
+
classes: ModelClass[];
|
|
220
|
+
}
|
|
212
221
|
export interface RunEstimate {
|
|
213
222
|
available: boolean;
|
|
214
223
|
credits: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wizards",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16",
|
|
4
4
|
"description": "Make a wish. Get your wizard. It guides you step by step. Let AI do the work. Runs on your machine, on the AI subscription you already have.",
|
|
5
5
|
"license": "FSL-1.1-MIT",
|
|
6
6
|
"homepage": "https://engenty.ai",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowPreview-De3ZyIer.js","assets/jsx-runtime-D3jfb0Ew.js","assets/ui-HV_XbHjw.js","assets/esm-CgnVZhIQ.js","assets/index-LmRYEd-y.js","assets/api-RJbFM_oc.js","assets/preload-helper-CNEI7N0N.js","assets/createLucideIcon-q3MZMmnf.js","assets/engenty-Cm8yZLON.js","assets/index-9maLuK9R.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{A as r,F as i,I as a,K as o,M as s,N as c,O as l,d as u,g as d,j as f,n as p,nt as m,w as h}from"./api-RJbFM_oc.js";import{t as g}from"./preload-helper-CNEI7N0N.js";import{t as _}from"./createLucideIcon-q3MZMmnf.js";import{t as v}from"./arrow-right-6FyN3e7D.js";import{o as y,s as b,t as ee}from"./meta-CchZXdWH.js";import{t as x}from"./check-CUpby_J9.js";import{t as S}from"./chevron-down-DymW-2BP.js";import{n as C,r as w,t as T}from"./volume-2-Bp2tyaKE.js";import{n as te,r as E}from"./upload-DNRENWzQ.js";import{n as ne,t as re}from"./wand-sparkles-Clj3VRB5.js";import{t as D}from"./image-BShbErBm.js";import{n as ie,t as O}from"./video-9fDPRPCv.js";import{t as ae}from"./pen-line-NK46C_nG.js";import{n as k,t as oe}from"./table-2-BdDuBcF2.js";import{l as se,u as ce}from"./engenty-Cm8yZLON.js";import{_ as A,d as j,h as M,i as le,m as ue,n as de,r as fe,t as N,y as P}from"./ui-HV_XbHjw.js";import{A as pe,B as F,E as me,F as I,N as he,U as L,V as ge,j as _e,k as R,w as ve,z as ye}from"./index-LmRYEd-y.js";import{t as be}from"./ImportWizard-CTGmBDI8.js";var xe=class extends c{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:o,isRefetching:s,isError:c,isRefetchError:l}=r,u=n.fetchMeta?.fetchMore?.direction,d=c&&u===`forward`,f=o&&u===`forward`,p=c&&u===`backward`,m=o&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:i(t,n.data),hasPreviousPage:a(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:s&&!f&&!m}}};function Se(e,t){return s(e,xe,t)}var z={name:`audio-lines`,size:24,node:[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]};z.node;var Ce=_(z),B={name:`chart-column`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]],aliases:[`bar-chart-3`]};B.node;var V=_(B),we={name:`circle-dollar-sign`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`,key:`1h4pet`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}]]};we.node;var Te=_(we),Ee={name:`circle-euro`,size:24,node:[[`path`,{d:`M15 9.4a4 4 0 1 0 0 5.2`,key:`1makmb`}],[`path`,{d:`M7 12h5`,key:`gblrwe`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};Ee.node;var De=_(Ee),Oe={name:`mouse-pointer-click`,size:24,node:[[`path`,{d:`M14 4.1 12 6`,key:`ita8i4`}],[`path`,{d:`m5.1 8-2.9-.8`,key:`1go3kf`}],[`path`,{d:`m6 12-1.9 2`,key:`mnht97`}],[`path`,{d:`M7.2 2.2 8 5.1`,key:`1cfko1`}],[`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`,key:`s0h3yz`}]]};Oe.node;var ke=_(Oe),Ae={name:`scan-text`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 8h8`,key:`1jbsf9`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}],[`path`,{d:`M7 16h6`,key:`1vyc9m`}]]};Ae.node;var je=_(Ae),Me={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};Me.node;var Ne=_(Me),H=e(t(),1),U={text:{de:`Text`,en:`Text`},document:{de:`Dokument (PDF, Word)`,en:`Document (PDF, Word)`},table:{de:`Tabelle`,en:`Table`},image:{de:`Bild`,en:`Image`},video:{de:`Video`,en:`Video`},audio:{de:`Audio`,en:`Audio`},dashboard:{de:`Dashboard`,en:`Dashboard`}},Pe={any:{de:`Jede Branche`,en:`Any industry`},trades:{de:`Handwerk`,en:`Trades`},gastronomy:{de:`Gastronomie`,en:`Food service`},hospitality:{de:`Hotel & Tourismus`,en:`Hotels & tourism`},realEstate:{de:`Immobilien`,en:`Real estate`},retail:{de:`Handel`,en:`Retail`},health:{de:`Gesundheit`,en:`Health`},professional:{de:`Kanzlei & Beratung`,en:`Professional services`},agency:{de:`Agentur & Marketing`,en:`Agency & marketing`},events:{de:`Veranstaltungen`,en:`Events`},publicSector:{de:`Vereine & Öffentliches`,en:`Associations & public sector`}},Fe={marketing:{de:`Marketing & Social Media`,en:`Marketing & social media`},sales:{de:`Angebote & Verkauf`,en:`Offers & sales`},accounting:{de:`Buchhaltung & Belege`,en:`Accounting & receipts`},service:{de:`Kundenservice`,en:`Customer service`},research:{de:`Recherche & Analyse`,en:`Research & analysis`},hr:{de:`Personal & Bewerbungen`,en:`HR & applications`},operations:{de:`Planung & Abläufe`,en:`Planning & operations`},website:{de:`Helfer für die Website`,en:`Website helpers`}},W={text:{de:`Text schreiben`,en:`Writes text`},web:{de:`Websuche`,en:`Web search`},browser:{de:`Browser bedienen`,en:`Drives a browser`},documents:{de:`Dokumente & Fotos lesen`,en:`Reads documents & photos`},image:{de:`Bilder erzeugen`,en:`Makes images`},video:{de:`Videos erzeugen`,en:`Makes video`},speech:{de:`Sprachausgabe`,en:`Speech output`},listening:{de:`Sprachnotizen verstehen`,en:`Understands voice notes`},code:{de:`Code ausführen`,en:`Runs code`},connectors:{de:`Verbundene Konten & Systeme`,en:`Connected accounts & systems`}},Ie={low:{de:`günstig`,en:`low cost`},medium:{de:`mittel`,en:`medium cost`},high:{de:`teuer`,en:`high cost`}},G=e=>Object.keys(e);G(U),G(Pe),G(Fe),G(W);var K=e(n(),1),Le=(0,H.lazy)(()=>g(()=>import(`./FlowPreview-De3ZyIer.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),Re={useCase:``,industry:``,format:``,capability:``},q=(e,t)=>e[t]?.[A]??t;function ze(e){if(e<1)return 1;let t=10**Math.floor(Math.log10(e));return Math.round(e/t)*t}function Be(e){return e.credits?P(`market.credits`,{n:ze(e.credits.credits)}):Ie[e.costTier][A]}var Ve={text:pe,document:I,table:oe,image:D,video:O,audio:Ce,dashboard:V};function J({format:e,className:t}){let n=Ve[e],r=q(U,e);return(0,K.jsx)(`span`,{title:r,className:`inline-flex`,children:(0,K.jsx)(n,{className:t,"aria-label":r,role:`img`})})}var Y=[`low`,`medium`,`high`];function X({entry:e}){let t=Y.indexOf(e.costTier)+1,n=A===`de`?De:Te;return(0,K.jsxs)(`span`,{title:Be(e),className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex shrink-0`,children:Y.slice(0,t).map((e,t)=>(0,K.jsx)(`span`,{className:M(`rounded-full bg-(--coin-bg,var(--color-card))`,t>0&&`-ml-1.5`),children:(0,K.jsx)(n,{className:`size-4`})},e))}),Ie[e.costTier][A]]})}function He({entry:e,onOpen:t}){return(0,K.jsxs)(de,{role:`button`,tabIndex:0,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},className:M(`relative flex min-h-[124px] cursor-pointer flex-col gap-5 p-4 text-left transition sm:min-h-[136px] sm:p-5 hover:shadow-elevated focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,(!e.usable||e.missing.length>0)&&`opacity-60`),children:[(0,K.jsx)(`span`,{className:`-top-4 pointer-events-none absolute right-4`,children:(0,K.jsx)(u,{kind:e.avatar,size:68,interactive:!1})}),(0,K.jsxs)(`div`,{className:`min-w-0 pr-20`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 font-display font-semibold text-[0.9375rem]`,children:[e.title,e.starred?(0,K.jsx)(k,{className:`size-3.5 shrink-0 fill-amber text-amber`,"aria-label":P(`market.starred`)}):null]}),(0,K.jsx)(`div`,{className:`mt-0.5 text-[0.8125rem] text-ink-3 leading-snug`,children:e.pitch})]}),(0,K.jsx)(`div`,{className:`mt-auto flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[0.75rem] text-ink-3`,children:e.usable&&e.missing.length?(0,K.jsx)(fe,{tone:`warn`,children:P(`market.missing`,{list:Ue(e.missing)})}):e.usable?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(F,{className:`size-3.5`}),` `,P(`market.minutes`,{n:e.effort.minutes})]}),(0,K.jsx)(X,{entry:e}),(0,K.jsx)(`span`,{className:`ml-auto inline-flex items-center gap-1.5`,children:e.formats.map(e=>(0,K.jsx)(J,{format:e,className:`size-4`},e))})]}):(0,K.jsx)(fe,{tone:`warn`,children:P(`market.needsUpdate`)})})]})}function Z({title:e,children:t}){return(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`mb-1.5 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:e}),t]})}var Ue=e=>e.map(e=>q(W,e)).join(`, `),We={text:ae,web:C,browser:ke,documents:je,image:D,video:O,speech:T,listening:ie,code:Ne,connectors:_e};function Ge(e){switch(e.type){case`page`:return he;case`agent`:return b;case`generate`:return e.asset===`image`?D:e.asset===`video`?O:e.asset===`voice`?T:e.asset===`dashboard`?V:I;case`widget`:return e.video?w:ge;case`review`:return ne;case`result`:return y}return re}function Ke(e){let t=new Set;for(let[n,r]of e.entries())for(let i of r.branches??[]){let r=i.to===`end`?e.length:e.findIndex(e=>e.id===i.to);for(let i=n+1;i<r;i++)t.add(e[i].id)}return t}function qe(e){let t=Ke(e);return e.map(e=>({id:e.id,title:e.title,icon:Ge(e),tone:ee[e.type]??`bg-paper-2 text-ink-2`,optional:t.has(e.id),branches:e.branches}))}function Q({title:e,children:t}){return(0,K.jsx)(`span`,{title:e,className:`inline-flex items-center gap-2 border-border border-l px-4 first:border-l-0 first:pl-0`,children:t})}function $({icon:e,children:t,more:n}){return(0,K.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,K.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:e}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-[0.875rem] text-ink leading-snug`,children:t}),n?(0,K.jsx)(`div`,{className:`text-[0.75rem] text-ink-3 leading-snug`,children:n}):null]})]})}function Je({className:e,children:t}){let n=(0,H.useRef)(null),[r,i]=(0,H.useState)({above:!1,below:!1});(0,H.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{let t=e.scrollTop>1,n=e.scrollTop+e.clientHeight<e.scrollHeight-1;i(e=>e.above===t&&e.below===n?e:{above:t,below:n})};t(),e.addEventListener(`scroll`,t,{passive:!0});let r=new ResizeObserver(t);return r.observe(e),e.firstElementChild&&r.observe(e.firstElementChild),()=>{e.removeEventListener(`scroll`,t),r.disconnect()}},[]);let a=`linear-gradient(to bottom, ${r.above?`transparent`:`black`} 0, black 28px, black calc(100% - 44px), ${r.below?`transparent`:`black`} 100%)`;return(0,K.jsx)(`div`,{ref:n,className:e,style:{maskImage:a,WebkitMaskImage:a},children:(0,K.jsx)(`div`,{children:t})})}function Ye({id:e,fallback:t,onClose:n,onUse:r,busy:i}){let a=m(),o=l(),s=f({queryKey:[`marketplace-entry`,e,A],queryFn:()=>p.get(`/api/studio/marketplace/${encodeURIComponent(e)}?lang=${A}`),enabled:!!e,retry:!1}),c=s.data??t,h=L({mutationFn:t=>{let n=`/api/studio/marketplace/${encodeURIComponent(e)}/star`;return t?p.put(n):p.del(n)},onSuccess:()=>Promise.all([a.invalidateQueries({queryKey:[`marketplace`]}),a.invalidateQueries({queryKey:[`marketplace-entry`,e]})])}),g=d()===`dark`,_=se[ce[c?.avatar||`round`]],v=g?`var(--card)`:`color-mix(in oklch, ${_??`var(--ink-4)`} 14%, var(--paper-2))`;return(0,K.jsx)(le,{open:!!e,onClose:n,wide:!0,bare:!0,children:c?(0,K.jsxs)(`div`,{className:`relative flex max-h-[calc(100dvh-48px)] flex-col rounded-2xl bg-card shadow-overlay max-sm:h-dvh max-sm:max-h-none max-sm:rounded-none`,children:[(0,K.jsx)(`button`,{type:`button`,"aria-label":P(`common.close`),onClick:n,className:`sm:-top-3.5 sm:-right-3.5 absolute top-3 right-3 z-20 flex size-9 items-center justify-center rounded-full bg-card text-ink-2 shadow-elevated ring-1 ring-border-soft transition hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,children:(0,K.jsx)(R,{className:`size-4`})}),(0,K.jsxs)(`header`,{className:`relative shrink-0 border-border-soft border-b px-5 pt-5 pb-4 text-ink sm:rounded-t-2xl sm:px-7`,style:{background:v,"--coin-bg":v},children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 overflow-hidden sm:rounded-t-2xl`,children:(0,K.jsx)(`span`,{className:M(`-top-28 -right-10 absolute size-80 rounded-full bg-white blur-3xl`,g?`opacity-[0.14]`:`opacity-80`)})}),(0,K.jsx)(`div`,{className:`-bottom-5 absolute right-9 z-10 max-sm:hidden`,children:(0,K.jsx)(u,{kind:c.avatar,size:104})}),(0,K.jsxs)(`div`,{className:`relative sm:pr-36`,children:[(0,K.jsx)(`h2`,{className:`font-display font-semibold text-[1.375rem] leading-tight tracking-tight max-sm:pr-10`,children:c.title}),(0,K.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-2 leading-snug`,children:s.data?.description||c.pitch})]}),c.usable?(0,K.jsxs)(`div`,{className:`-mx-5 sm:-mx-7 relative mt-3.5 flex flex-wrap items-center gap-y-2 border-border-soft border-t px-5 pt-3 font-medium text-[0.875rem] sm:px-7 sm:pr-40`,children:[(0,K.jsxs)(Q,{title:P(`market.duration`),children:[(0,K.jsx)(F,{className:`size-4 text-ink-3`}),P(`market.minutes`,{n:c.effort.minutes})]}),(0,K.jsx)(Q,{title:P(`market.cost`),children:(0,K.jsx)(X,{entry:c})}),(0,K.jsx)(Q,{title:P(`market.result`),children:c.formats.map(e=>(0,K.jsx)(J,{format:e,className:`size-4`},e))})]}):null]}),c.usable?(0,K.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-x-7 gap-y-6 px-5 pt-6 max-sm:overflow-y-auto max-sm:pb-4 sm:grid-cols-[230px_minmax(0,1fr)] sm:grid-rows-[minmax(0,1fr)] sm:px-7`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-5 sm:min-h-0 sm:overflow-y-auto`,children:[(0,K.jsx)(Z,{title:P(`market.duration`),children:(0,K.jsx)($,{icon:(0,K.jsx)(F,{className:`size-4 text-moss`}),more:P(`market.durationHint`,{n:c.effort.fields}),children:P(`market.minutes`,{n:c.effort.minutes})})}),(0,K.jsx)(Z,{title:P(`market.cost`),children:(0,K.jsx)($,{icon:(0,K.jsx)(E,{className:`size-4 text-amber`}),more:c.credits?P(`market.creditsHint`):void 0,children:(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2`,children:[(0,K.jsx)(X,{entry:c}),c.credits?(0,K.jsx)(`span`,{className:`text-ink-2`,children:P(`market.creditsRange`,{n:ze(c.credits.credits)})}):null]})})}),(0,K.jsx)(Z,{title:P(`market.result`),children:(0,K.jsx)(`div`,{className:`flex flex-col gap-2`,children:(s.data?.results??[]).map(e=>(0,K.jsx)($,{icon:(0,K.jsx)(J,{format:e.kind,className:`size-4 text-ember-strong`}),more:e.formats.map(e=>e.toUpperCase()).join(` · `),children:e.title},e.title))})}),(0,K.jsx)(Z,{title:P(`market.needs`),children:(0,K.jsx)(`ul`,{className:`flex flex-col gap-2`,children:c.capabilities.map(e=>{let t=We[e],n=c.missing.includes(e);return(0,K.jsxs)(`li`,{className:M(`flex items-center gap-2.5 text-[0.875rem]`,n?`text-ink-3`:`text-ink-2`),children:[(0,K.jsx)(t,{className:M(`size-4 shrink-0`,n?`text-rose`:`text-cobalt`)}),q(W,e),n?(0,K.jsx)(`span`,{className:`text-[0.75rem] text-rose`,children:P(`market.unavailable`)}):null]},e)})})})]}),(0,K.jsxs)(`div`,{className:`flex flex-col sm:min-h-0`,children:[(0,K.jsx)(`div`,{className:`mb-1.5 shrink-0 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:P(`market.steps`)}),(0,K.jsx)(Je,{className:`-mr-2 overscroll-contain pt-1 pr-2 pl-1 sm:min-h-0 sm:flex-1 sm:overflow-y-auto`,children:s.isLoading?(0,K.jsx)(j,{className:`size-5 text-ink-3`}):(0,K.jsx)(H.Suspense,{fallback:(0,K.jsx)(j,{className:`size-5 text-ink-3`}),children:(0,K.jsx)(Le,{steps:qe(s.data?.outline??[])})})})]})]}):(0,K.jsx)(`div`,{className:`flex-1 px-5 pt-6 sm:px-7`,children:(0,K.jsx)(`p`,{className:`rounded-lg bg-amber-tint p-3 text-[0.875rem] text-ink-2`,children:P(`market.needsUpdateHint`)})}),(0,K.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 px-5 pt-4 pb-5 max-sm:border-border-soft max-sm:border-t sm:px-7 sm:pb-6`,children:[(0,K.jsxs)(N,{variant:`ghost`,className:`mr-auto`,title:P(`market.starHint`),"aria-pressed":c.starred,busy:h.isPending,onClick:()=>h.mutate(!c.starred),children:[(0,K.jsx)(k,{className:M(`size-4`,c.starred&&`fill-amber text-amber`)}),(0,K.jsx)(`span`,{className:`max-sm:sr-only`,children:P(c.starred?`market.starred`:`market.star`)})]}),(0,K.jsx)(N,{variant:`secondary`,onClick:n,children:P(`common.close`)}),c.usable&&c.missing.length?(0,K.jsx)(N,{variant:`secondary`,onClick:()=>o(`/settings/models`),children:P(`editor.models.settings`)}):null,r?(0,K.jsx)(N,{disabled:!c.usable||c.missing.length>0,title:c.missing.length?P(`market.missingHint`,{list:Ue(c.missing)}):void 0,busy:i,onClick:()=>r(c),children:P(`market.use`)}):null]})]}):(0,K.jsx)(`div`,{className:`flex min-h-48 flex-col items-center justify-center gap-3 rounded-2xl bg-card p-8 text-[0.875rem] text-ink-2 shadow-overlay`,children:s.isLoading?(0,K.jsx)(j,{className:`size-6 text-ink-3`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{children:P(`market.notFound`)}),(0,K.jsx)(N,{variant:`secondary`,onClick:n,children:P(`common.close`)})]})})})}function Xe({name:e,value:t,options:n,onChange:r}){let[i,a]=(0,H.useState)(!1),o=(0,H.useRef)(null);(0,H.useEffect)(()=>{if(!i)return;let e=e=>{o.current?.contains(e.target)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let s=n.find(e=>e.value===t);return(0,K.jsxs)(`div`,{ref:o,className:`relative`,children:[(0,K.jsxs)(`div`,{className:M(`flex h-8 items-center rounded-full text-[0.8125rem] transition`,s?`bg-ember-tint text-ink`:`text-ink-2 hover:bg-paper-2 hover:text-ink`,i&&!s&&`bg-paper-2 text-ink`),children:[(0,K.jsx)(`button`,{type:`button`,"aria-haspopup":`listbox`,"aria-expanded":i,onClick:()=>a(!i),className:M(`flex h-full items-center gap-1.5 rounded-full pl-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,s?`pr-1`:`pr-2.5`),children:s?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-ink-3`,children:e}),(0,K.jsx)(`span`,{className:`font-medium`,children:s.label})]}):(0,K.jsxs)(K.Fragment,{children:[e,(0,K.jsx)(S,{className:M(`size-3.5 transition`,i&&`rotate-180`)})]})}),s?(0,K.jsx)(`button`,{type:`button`,"aria-label":`${e}: ${P(`market.reset`)}`,onClick:()=>r(``),className:`mr-1 flex size-6 items-center justify-center rounded-full text-ink-3 hover:bg-card hover:text-ink`,children:(0,K.jsx)(R,{className:`size-3.5`})}):null]}),i?(0,K.jsx)(`div`,{role:`listbox`,"aria-label":e,className:`absolute top-full left-0 z-30 mt-1.5 max-h-80 min-w-60 overflow-y-auto rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:n.map(e=>(0,K.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e.value===t,disabled:!e.count||e.unavailable,onClick:()=>{r(e.value===t?``:e.value),a(!1)},className:M(`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-[0.875rem] transition coarse:py-2.5`,e.count&&!e.unavailable?`text-ink-2 hover:bg-paper-2 hover:text-ink`:`text-ink-4`,e.value===t&&`font-medium text-ink`),children:[e.icon,(0,K.jsx)(`span`,{className:`flex-1 whitespace-nowrap`,children:e.label}),e.value===t?(0,K.jsx)(x,{className:`size-4 text-ember`}):e.unavailable?(0,K.jsx)(`span`,{className:`whitespace-nowrap text-[0.75rem] text-ink-4`,children:P(`market.unavailable`)}):(0,K.jsx)(`span`,{className:`text-[0.75rem] text-ink-4 tabular-nums`,children:e.count})]},e.value))}):null]})}function Ze(e,t){let[n,r]=(0,H.useState)(e);return(0,H.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var Qe=60;function $e({onUse:e,busy:t,open:n}){let[r,i]=(0,H.useState)(``),[a,s]=(0,H.useState)(Re),[c,l]=(0,H.useState)(!1),[u,d]=(0,H.useState)(n??null),f=Ze(r.trim(),250),m=Se({queryKey:[`marketplace`,A,f,a,c],queryFn:({pageParam:e})=>{let t=new URLSearchParams({lang:A,limit:String(Qe),offset:String(e)});f&&t.set(`q`,f);for(let[e,n]of Object.entries(a))n&&t.set(e,n);return c&&t.set(`starred`,`1`),p.get(`/api/studio/marketplace?${t}`)},initialPageParam:0,getNextPageParam:(e,t)=>{let n=t.reduce((e,t)=>e+t.entries.length,0);return n<e.total?n:void 0},placeholderData:o}),h=m.data?.pages[0],g=m.data?.pages.flatMap(e=>e.entries)??[],_=h?.all??0,v=r.trim()!==f||m.isFetching&&!m.isFetchingNextPage,y=(e,t,n)=>Object.keys(t).filter(t=>h?.facets[e]?.[t]!==void 0).map(r=>({value:r,label:q(t,r),icon:n?.(r),count:(h?.facets[e])[r]??0,unavailable:e===`capability`&&b.has(r)})),b=new Set(h?.unavailable??[]),ee=y(`useCase`,Fe),x=[{key:`industry`,name:P(`market.industry`),options:y(`industry`,Pe)},{key:`format`,name:P(`market.format`),options:y(`format`,U,e=>(0,K.jsx)(J,{format:e,className:`size-4 text-ink-3`}))},{key:`capability`,name:P(`market.capability`),options:y(`capability`,W,e=>{let t=We[e];return(0,K.jsx)(t,{className:`size-4 text-ink-3`})})}],S=!!r.trim()||c||Object.values(a).some(Boolean),C=()=>{s(Re),i(``),l(!1)};if(m.isLoading)return(0,K.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,K.jsx)(j,{className:`size-6 text-ink-3`})});let w=h?.offline?(0,K.jsxs)(`p`,{className:`mt-4 flex items-center justify-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,K.jsx)(ye,{className:`size-4 shrink-0`}),P(`market.offline`)]}):null;if(!_&&!S)return w;let T=r?(0,K.jsx)(`button`,{type:`button`,"aria-label":P(`market.reset`),onClick:()=>i(``),className:`-mr-1.5 flex size-7 shrink-0 items-center justify-center rounded-full text-ink-3 hover:bg-paper-2 hover:text-ink`,children:(0,K.jsx)(R,{className:`size-4`})}):null,E=e=>M(`inline-flex h-7 shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-2.5 text-[0.78125rem] transition`,e?`bg-card font-medium text-ink shadow-soft ring-1 ring-border-soft`:`text-ink-3 hover:bg-card/60 hover:text-ink`);return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`label`,{className:`relative mx-auto flex h-10 max-w-md items-center gap-2.5 rounded-full bg-card px-4 shadow-soft ring-1 ring-border-soft transition focus-within:ring-2 focus-within:ring-focus sm:h-11`,children:[v?(0,K.jsx)(j,{className:`size-4 shrink-0 text-ink-3`}):(0,K.jsx)(te,{className:`size-4 shrink-0 text-ink-3`}),(0,K.jsx)(`input`,{type:`search`,value:r,onChange:e=>i(e.target.value),placeholder:P(`market.search`),"aria-label":P(`market.search`),className:`min-w-0 flex-1 bg-transparent text-[0.9375rem] outline-none placeholder:text-ink-4 [&::-webkit-search-cancel-button]:hidden`}),T]}),w,(0,K.jsxs)(`div`,{className:`max-sm:-mx-3 mt-4 flex gap-1 max-sm:overflow-x-auto max-sm:px-3 max-sm:[scrollbar-width:none] sm:flex-wrap sm:justify-center max-sm:[&::-webkit-scrollbar]:hidden`,children:[[{value:``,label:P(`market.all`)},...ee].map(e=>(0,K.jsx)(`button`,{type:`button`,"aria-pressed":!c&&a.useCase===e.value,onClick:()=>{l(!1),s({...a,useCase:e.value})},className:E(!c&&a.useCase===e.value),children:e.label},e.value)),(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":c,onClick:()=>l(!c),className:E(c),children:[(0,K.jsx)(k,{className:M(`size-3.5`,c&&`fill-amber text-amber`)}),P(`market.starred`)]})]}),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-1 gap-y-2 sm:mt-6`,children:[c?null:x.map(e=>(0,K.jsx)(Xe,{name:e.name,value:a[e.key],options:e.options,onChange:t=>s({...a,[e.key]:t})},e.key)),(0,K.jsxs)(`span`,{className:`ml-auto flex items-center gap-3 whitespace-nowrap pl-2 text-[0.8125rem] text-ink-3`,children:[S?(0,K.jsxs)(`button`,{type:`button`,onClick:C,className:`inline-flex items-center gap-1 text-ember-strong underline-offset-2 hover:underline`,children:[(0,K.jsx)(R,{className:`size-3.5 max-sm:size-4`}),(0,K.jsx)(`span`,{className:`max-sm:sr-only`,children:P(`market.resetShort`)})]}):null,S?(0,K.jsx)(`span`,{className:`tabular-nums sm:hidden`,children:P(`market.countOfShort`,{n:h?.total??0,all:_})}):null,(0,K.jsx)(`span`,{className:M(`tabular-nums`,S&&`max-sm:hidden`),children:S?P(`market.countOf`,{n:h?.total??0,all:_}):P(`market.count`,{n:_})})]})]}),g.length?(0,K.jsx)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:g.map(e=>(0,K.jsx)(He,{entry:e,onOpen:()=>d(e.id)},e.id))}):(0,K.jsxs)(`div`,{className:`py-10 text-center text-[0.875rem] text-ink-3`,children:[(0,K.jsx)(`p`,{children:P(c?`market.noneStarred`:`market.none`)}),(0,K.jsx)(N,{variant:`ghost`,className:`mt-2`,onClick:C,children:P(`market.reset`)})]}),m.hasNextPage?(0,K.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,K.jsx)(N,{variant:`secondary`,busy:m.isFetchingNextPage,onClick:()=>void m.fetchNextPage(),children:P(`market.more`)})}):null,(0,K.jsx)(Ye,{id:u,fallback:g.find(e=>e.id===u)??null,onClose:()=>d(null),onUse:e,busy:t})]})}var et={de:[`Stellenanzeige aus ein paar Stichworten, als PDF und LinkedIn-Post`,`Produktbeschreibung für den Onlineshop mit drei Bildvarianten`,`Wettbewerbsanalyse zu einer Firma mit Quellen`,`Lead aus einem Formular in unser CRM eintragen`],en:[`A job ad from a few keywords, as PDF and LinkedIn post`,`A shop product description with three image variants`,`A competitor analysis for a company, with sources`,`Put a lead from a form into our CRM`]};function tt(){let e=l(),t=m(),{project:n}=ve(),i=me(),[a,o]=(0,H.useState)(``),[s]=r(),c=L({mutationFn:e=>p.post(`/api/studio/wizards`,{projectId:n.id,starterId:e,lang:A}),onSuccess:async({id:n},r)=>{await t.invalidateQueries({queryKey:[`projects`]}),await t.invalidateQueries({queryKey:[`wizards`]}),e(r?`/edit/${n}`:`/edit/${n}?prompt=${encodeURIComponent(a.trim())}`)}}),d=()=>{a.trim()&&n&&c.mutate(void 0)};return!i||n?.readOnly?(0,K.jsx)(h,{to:`/`,replace:!0}):(0,K.jsxs)(`div`,{className:`animate-rise pt-4`,children:[(0,K.jsxs)(`div`,{className:`mx-auto max-w-2xl`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[(0,K.jsx)(u,{kind:`sprout`,size:150,fluffy:!0}),(0,K.jsx)(`h1`,{className:`mt-2 font-display font-semibold text-[2rem] leading-tight tracking-tight sm:text-[2.375rem]`,children:P(`new.title`)})]}),(0,K.jsxs)(`div`,{className:`mt-8 rounded-2xl bg-card p-2 shadow-elevated ring-1 ring-border-soft focus-within:ring-focus`,children:[(0,K.jsx)(ue,{autoFocus:!0,minRows:4,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&d()},placeholder:P(`new.placeholder`),className:`border-0 bg-transparent text-[1rem] shadow-none focus:ring-0`}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-2 pb-1`,children:[(0,K.jsx)(`span`,{className:`hidden text-[0.75rem] text-ink-4 sm:block`,children:P(`new.hint`)}),(0,K.jsxs)(N,{size:`md`,onClick:d,busy:c.isPending&&!c.variables,disabled:!a.trim(),children:[P(`new.build`),` `,(0,K.jsx)(v,{className:`size-4`})]})]})]}),(0,K.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:et[A].map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>o(e),className:`rounded-full bg-paper-2 px-3.5 py-1.5 text-[0.8125rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:e},e))})]}),(0,K.jsxs)(`section`,{className:`mx-auto max-w-5xl`,children:[(0,K.jsx)(`h2`,{className:`mt-16 mb-5 text-center font-medium text-[0.8125rem] text-ink-3 uppercase tracking-[0.08em]`,children:P(`new.orStarter`)}),(0,K.jsx)($e,{open:s.get(`starter`),busy:c.isPending&&!!c.variables,onUse:e=>n&&!c.isPending&&c.mutate(e.id)}),c.error?(0,K.jsx)(`p`,{className:`mt-3 text-center text-[0.875rem] text-rose`,children:c.error.message}):null]}),(0,K.jsx)(`div`,{className:`mt-8 flex justify-center`,children:(0,K.jsx)(be,{variant:`ghost`,label:P(`new.import`)})})]})}export{tt as NewWizardPage};
|