wizards 0.2.22 → 0.2.24

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 (33) hide show
  1. package/apps/web/dist/assets/{Account-DBtSpuEQ.js → Account-thPW7H4A.js} +1 -1
  2. package/apps/web/dist/assets/{ChangelogDialog-BlFyzslp.js → ChangelogDialog-mCszGL5_.js} +1 -1
  3. package/apps/web/dist/assets/{CreditsDialog-CMa3Igqt.js → CreditsDialog-Com2Y3g8.js} +1 -1
  4. package/apps/web/dist/assets/{EditorPage-D2v_Levn.js → EditorPage-Dwg-K4UI.js} +2 -2
  5. package/apps/web/dist/assets/{FlowPreview-DkdzInU8.js → FlowPreview-CRsxtwhV.js} +1 -1
  6. package/apps/web/dist/assets/{Harness-Dkn6KCJV.js → Harness-CfgVRYpr.js} +1 -1
  7. package/apps/web/dist/assets/{HomePage-Dd-y_p7u.js → HomePage-DYKF3C1U.js} +1 -1
  8. package/apps/web/dist/assets/{ImportWizard-C3OT94hv.js → ImportWizard-BTp7XTsF.js} +1 -1
  9. package/apps/web/dist/assets/{LocalRuntime-BkRQm0GM.js → LocalRuntime-CYhPXwAv.js} +1 -1
  10. package/apps/web/dist/assets/{NewWizardPage--DdPF3l9.js → NewWizardPage-BgnrGN8A.js} +2 -2
  11. package/apps/web/dist/assets/ProjectPage-Cfco8MIG.js +5 -0
  12. package/apps/web/dist/assets/{PublicRunner-BVPl_WNQ.js → PublicRunner-ClB2-2EF.js} +1 -1
  13. package/apps/web/dist/assets/RunDrawer-B50sCUSw.js +1 -0
  14. package/apps/web/dist/assets/{RunnerView-C6mpXHeH.js → RunnerView-CFCmOmJI.js} +2 -2
  15. package/apps/web/dist/assets/{SettingsPage-BhM74zXG.js → SettingsPage-qDqiZ7th.js} +1 -1
  16. package/apps/web/dist/assets/{SetupPage-yfG5gOaZ.js → SetupPage-BeBReYLP.js} +1 -1
  17. package/apps/web/dist/assets/{SharePage-C5Vy5zJy.js → SharePage-Cv8toByB.js} +1 -1
  18. package/apps/web/dist/assets/{api-C-JIx8M5.js → api-rJBQEu1G.js} +1 -1
  19. package/apps/web/dist/assets/changelog-BmS3l433.js +1 -0
  20. package/apps/web/dist/assets/{esm-BpXlr_Mv.js → esm-DFNBMDKB.js} +1 -1
  21. package/apps/web/dist/assets/index-BZs1IxAk.css +1 -0
  22. package/apps/web/dist/assets/{index-Bb5l3tTJ.js → index-CoTWrikR.js} +3 -3
  23. package/apps/web/dist/assets/{meta-C-2h0-O5.js → meta-DJta2rA3.js} +1 -1
  24. package/apps/web/dist/assets/{settings-menu-DK8T02Tt.js → settings-menu-bsLDpw56.js} +1 -1
  25. package/apps/web/dist/assets/ui-DJOZSSKo.js +1 -0
  26. package/apps/web/dist/index.html +4 -4
  27. package/apps/web/dist/mcp/flow.html +3 -3
  28. package/package.json +1 -1
  29. package/apps/web/dist/assets/ChatPanel-ofw0p02m.js +0 -1
  30. package/apps/web/dist/assets/ProjectPage-CsoEkwhy.js +0 -5
  31. package/apps/web/dist/assets/changelog-CyoGUe5a.js +0 -1
  32. package/apps/web/dist/assets/index-Bwyehu0k.css +0 -1
  33. package/apps/web/dist/assets/ui-Djd0WhVb.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wizards",
3
- "version": "0.2.22",
3
+ "version": "0.2.24",
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 +0,0 @@
1
- import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{c as r,d as i,i as a,n as o,nt as s}from"./api-C-JIx8M5.js";import{t as c}from"./createLucideIcon-q3MZMmnf.js";import{g as l,i as u,l as d,p as f,u as p}from"./RunnerView-C6mpXHeH.js";import{t as m}from"./chevron-down-DymW-2BP.js";import{t as h}from"./plus-Du-Jx8aI.js";import{n as g}from"./video-9fDPRPCv.js";import{f as _,g as v,o as y,x as b,y as x}from"./ui-Djd0WhVb.js";import{P as S,j as C}from"./index-Bb5l3tTJ.js";var w={name:`chevron-up`,size:24,node:[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]};w.node;var T=c(w),E=e(t(),1),D=!1;function O(){if(!(typeof window>`u`||D))return window.SpeechRecognition??window.webkitSpeechRecognition}var k=typeof navigator<`u`&&!!navigator.mediaDevices?.getUserMedia&&typeof MediaRecorder<`u`;function A(e,t){let n=e.trimEnd(),r=t.trim();return n&&r?`${n} ${r}`:n||r}function j(e,t){let[n,r]=(0,E.useState)(!1),[i,a]=(0,E.useState)(!1),[s,c]=(0,E.useState)(null),l=(0,E.useRef)(e);l.current=e;let u=(0,E.useRef)(t);u.current=t;let d=(0,E.useRef)(null);(0,E.useEffect)(()=>()=>d.current?.stop(),[]);let f=async()=>{let e=l.current,t;try{t=await navigator.mediaDevices.getUserMedia({audio:!0})}catch{c(`denied`);return}let n=[],i=new MediaRecorder(t);i.ondataavailable=e=>e.data.size&&n.push(e.data),i.onstop=async()=>{for(let e of t.getTracks())e.stop();d.current=null,r(!1);let s=(i.mimeType||`audio/webm`).split(`;`)[0],l=new File(n,`dictation`,{type:s});if(l.size){a(!0);try{let{text:t}=await o.upload(`/api/studio/transcribe`,l);t.trim()&&u.current(A(e,t))}catch(e){c(e.message)}finally{a(!1)}}},d.current={stop:()=>i.state!==`inactive`&&i.stop()},i.start(),r(!0)},p=e=>{let t=l.current,n=``,i=new e;i.continuous=!0,i.interimResults=!0,i.lang=x===`de`?`de-DE`:`en-US`,i.onresult=e=>{let r=``;for(let t=Math.max(0,e.resultIndex);t<e.results.length;t++){let i=e.results[t],a=i[0]?.transcript??``;i.isFinal?n=A(n,a):r+=a}u.current(A(t,A(n,r)))},i.onerror=e=>{if(e.error!==`aborted`&&e.error!==`no-speech`){if(e.error===`not-allowed`){c(`denied`);return}D=!0,k&&!n?(i.onend=null,d.current=null,f()):c(e.error)}},i.onend=()=>{d.current=null,r(!1)},d.current={stop:()=>i.stop()},i.start(),r(!0)};return{supported:!!O()||k,listening:n,processing:i,error:s,toggle:()=>{if(i)return;if(d.current){d.current.stop();return}c(null);let e=O();e?p(e):f()}}}var M=e(n(),1),N=/\.(png|jpe?g|gif|webp|avif|svg)$/i;function P(e){let t=e.filter(e=>e.type.startsWith(`image/`));return t.length?Object.fromEntries(t.map(e=>[e.name,URL.createObjectURL(e)])):void 0}function F(e){let t=e.match(/(?:^|\n\n)(?:Angehängt|Attached): ([^\n]+)$/);return t?{text:e.slice(0,t.index).trim(),names:t[1].split(`, `).filter(Boolean)}:{text:e,names:[]}}function I(e,t){if(e.name&&e.name!==`image.png`)return e;let n=e.type.split(`/`)[1]?.replace(`jpeg`,`jpg`)||`png`,r=new Date().toISOString().slice(0,19).replace(/[-:]/g,``).replace(`T`,`-`);return new File([e],`paste-${r}${t?`-${t+1}`:``}.${n}`,{type:e.type})}function L({url:e,label:t,children:n}){return(0,M.jsxs)(`div`,{className:`group relative`,title:t,children:[(0,M.jsx)(`img`,{src:e,alt:t,width:64,height:64,className:`size-16 rounded-lg bg-paper-2 object-cover ring-1 ring-border`}),n]})}function R({names:e,previews:t,fileUrl:n}){let r=e.filter(e=>t?.[e]||n&&N.test(e)),i=e.filter(e=>!r.includes(e));return(0,M.jsxs)(`div`,{className:`flex flex-col items-end gap-1.5`,children:[r.map(e=>{let r=t?.[e]??n?.(e)??``;return(0,M.jsx)(`a`,{href:r,target:`_blank`,rel:`noreferrer`,title:e,children:(0,M.jsx)(`img`,{src:r,alt:e,className:`max-h-60 w-auto max-w-full rounded-xl bg-paper-2 object-contain ring-1 ring-border`})},e)}),i.length?(0,M.jsx)(`div`,{className:`flex flex-wrap justify-end gap-1.5`,children:i.map(e=>(0,M.jsxs)(`span`,{className:`inline-flex max-w-full items-center gap-1.5 rounded-full bg-paper-2 px-2.5 py-1 text-[0.75rem] text-ink-2`,children:[(0,M.jsx)(f,{className:`size-3 shrink-0 text-ink-4`}),(0,M.jsx)(`span`,{className:`truncate`,children:e})]},e))}):null]})}function z(e,t){let n=s(),[i,o]=(0,E.useState)([]),[c,l]=(0,E.useState)(`idle`),[u,d]=(0,E.useState)(null),[f,p]=(0,E.useState)(null),[m,h]=(0,E.useState)(null),[g,_]=(0,E.useState)(null),v=(0,E.useRef)(null);return(0,E.useEffect)(()=>{if(e){if(v.current!==e.id){v.current=e.id,o(e.messages);return}c===`idle`&&o(t=>e.messages.length>=t.length?e.messages:t)}},[e,c]),{messages:i,phase:c,activity:f,thought:m,startedAt:g,error:u,send:async(i,s=[])=>{if(!e||!(i.trim()||s.length)||c!==`idle`)return!1;if(d(null),_(Date.now()),h(null),s.length){l(`thinking`);try{for(let t of s){let n=await fetch(r(`/api/studio/wizards/${e.id}/files/${encodeURIComponent(t.name)}`),{method:`PUT`,credentials:`include`,headers:{"content-type":t.type||`application/octet-stream`},body:t});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??n.statusText)}}}catch(t){return d(t.message),l(`idle`),_(null),await n.invalidateQueries({queryKey:[`wizard`,e.id]}),!1}let t=`${b(`editor.attached`)}: ${s.map(e=>e.name).join(`, `)}`;i=i.trim()?`${i}\n\n${t}`:t}let u=`p-${Date.now()}`;o(e=>[...e,{id:`u-${Date.now()}`,role:`user`,content:i,previews:P(s)},{id:u,role:`assistant`,content:``,pending:!0}]),l(`thinking`),p(null);let f=!1;try{await a(`/api/studio/wizards/${e.id}/chat`,{message:i},(e,n)=>{if(e===`text`){let e=JSON.parse(n);o(t=>t.map(t=>t.id===u?{...t,content:t.content+e}:t))}else if(e===`activity`)p(JSON.parse(n));else if(e===`thought`)h(JSON.parse(n));else if(e===`building`)l(`building`);else if(e===`done`){f=!0;let e=JSON.parse(n);o(t=>t.map(t=>t.id===u?{...t,content:e.reply,changed:e.changed,pending:!1}:t)),e.changed&&t(e.draft,e.revision)}else e===`error`&&(f=!0,d(JSON.parse(n).message))}),f||d(b(`editor.chatBroken`))}catch(e){d(e.message)}finally{p(null),h(null),_(null),o(e=>e.filter(e=>!(e.id===u&&!e.content)).map(e=>({...e,pending:!1}))),l(`idle`),await n.invalidateQueries({queryKey:[`wizard`,e.id]}),await n.invalidateQueries({queryKey:[`me`]})}return!0},fileUrl:t=>r(`/api/studio/wizards/${e?.id}/files/${encodeURIComponent(t)}`)}}function B(e){let[t,n]=(0,E.useState)(()=>Date.now());return(0,E.useEffect)(()=>{if(e===null)return;n(Date.now());let t=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(t)},[e]),e===null?null:Math.max(0,Math.floor((t-e)/1e3))}function V(e){return e<60?`${e} s`:`${Math.floor(e/60)}:${String(e%60).padStart(2,`0`)} min`}function H({chat:e,thought:t,className:n,spinner:r=`size-3.5`}){let i=B(e.startedAt);return(0,M.jsxs)(`div`,{className:v(`min-w-0`,n),children:[(0,M.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,M.jsx)(_,{className:v(`shrink-0`,r)}),(0,M.jsx)(`span`,{className:`min-w-0 truncate`,children:e.activity??(e.phase===`building`?b(`editor.building`):b(`editor.thinking`))}),i===null?null:(0,M.jsx)(`span`,{className:`shrink-0 text-ink-4 tabular-nums`,children:V(i)})]}),t&&e.thought?(0,M.jsx)(`p`,{className:`mt-0.5 truncate pl-5.5 text-[0.75rem] text-ink-4`,children:e.thought}):null]})}function U({message:e,fileUrl:t}){let{text:n,names:r}=F(e.content);return(0,M.jsxs)(`div`,{className:`ml-8 flex flex-col items-end gap-1.5 self-end`,children:[r.length?(0,M.jsx)(R,{names:r,previews:e.previews,fileUrl:t}):null,n?(0,M.jsx)(`div`,{className:`rounded-xl rounded-br-md bg-paper-2 px-4 py-2.5 text-[0.875rem] leading-relaxed`,children:(0,M.jsx)(`span`,{className:`whitespace-pre-wrap`,children:n})}):null]})}function W({chat:e,avatar:t,hello:n=b(`editor.chatHello`),placeholder:r=b(`editor.composer`),changedLabel:a=`Ablauf aktualisiert`,compact:o,intro:s,closed:c,card:x}){let[w,D]=(0,E.useState)(!1),[O,k]=(0,E.useState)(``),[A,N]=(0,E.useState)([]),P=(0,E.useRef)(null),F=(0,E.useRef)(null),R=(0,E.useRef)(null),z=j(O,k);(0,E.useEffect)(()=>{P.current?.scrollTo({top:P.current.scrollHeight,behavior:`smooth`})},[e.messages,e.phase]),(0,E.useEffect)(()=>{let e=F.current;if(!e)return;let t=()=>{e.style.height=`auto`,e.style.height=O?`${Math.min(e.scrollHeight,200)}px`:``};t();let n=e.clientWidth,r=new ResizeObserver(()=>{e.clientWidth!==n&&(n=e.clientWidth,t())});return r.observe(e),()=>r.disconnect()},[O]);let B=(O.trim()||A.length>0)&&e.phase===`idle`,V=e=>N(t=>[...t.filter(t=>!e.some(e=>e.name===t.name)),...e]),[W,G]=(0,E.useState)(new Map);(0,E.useEffect)(()=>{let e=new Map(A.filter(e=>e.type.startsWith(`image/`)).map(e=>[e,URL.createObjectURL(e)]));return G(e),()=>{for(let t of e.values())URL.revokeObjectURL(t)}},[A]);let K=async()=>{if(!B)return;z.listening&&z.toggle();let t={text:O,files:A};k(``),N([]),await e.send(t.text.trim(),t.files)||(k(t.text),N(t.files))},q=!o||w,J=e.messages.at(-1);return(0,M.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[o&&(J||e.error)?(0,M.jsxs)(`button`,{type:`button`,"aria-expanded":w,"aria-label":b(`editor.thread`),onClick:()=>D(e=>!e),className:`flex items-center gap-2 px-4 pt-2.5 pb-0.5 text-left text-[0.8125rem] text-ink-3 transition hover:text-ink`,children:[!(e.error||w)&&J?.pending?(0,M.jsx)(H,{chat:e,className:`flex-1`}):(0,M.jsx)(`span`,{className:v(`min-w-0 flex-1 truncate`,e.error&&`text-rose`),children:e.error??(w?b(`editor.thread`):J?.content)}),w?(0,M.jsx)(m,{className:`size-4 shrink-0`}):(0,M.jsx)(T,{className:`size-4 shrink-0`})]}):null,(0,M.jsxs)(`div`,{ref:P,className:v(`min-h-0 flex-1 overflow-y-auto px-5 py-5`,!q&&`hidden`),children:[e.messages.length===0&&!c?s??(0,M.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,M.jsx)(i,{kind:t,size:32,interactive:!1}),(0,M.jsx)(`p`,{className:`pt-1 text-[0.875rem] text-ink-2 leading-relaxed`,children:n})]}):null,(0,M.jsx)(`div`,{className:`flex flex-col gap-4`,children:e.messages.map(n=>n.role===`user`?(0,M.jsx)(U,{message:n,fileUrl:e.fileUrl},n.id):(0,M.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,M.jsx)(`div`,{className:`shrink-0`,children:(0,M.jsx)(i,{kind:t,size:28,interactive:!1})}),(0,M.jsxs)(`div`,{className:`min-w-0 pt-0.5 text-[0.875rem]`,children:[n.source===`mcp`?(0,M.jsxs)(`div`,{className:`mb-1 inline-flex items-center gap-1.5 text-[0.75rem] text-ink-3`,children:[(0,M.jsx)(S,{className:`size-3`}),` `,b(`editor.viaClient`,{client:n.client??`MCP`})]}):null,n.content?(0,M.jsx)(u,{text:n.content,className:`text-[0.875rem]`}):null,x&&n.cards?.length?(0,M.jsx)(`div`,{className:`mt-2 flex flex-col gap-2`,children:n.cards.map(e=>(0,M.jsx)(E.Fragment,{children:x(e)},e.id))}):null,n.pending?(0,M.jsx)(H,{chat:e,thought:!0,className:`mt-1 text-[0.8125rem] text-ink-3`}):null,n.changed?(0,M.jsxs)(`div`,{className:`mt-2 inline-flex items-center gap-1.5 rounded-full bg-ember-tint px-2.5 py-0.5 text-[0.75rem] text-ember-strong`,children:[(0,M.jsx)(p,{className:`size-3`}),` `,a]}):null]})]},n.id))}),e.error?(0,M.jsx)(`div`,{className:`mt-4 rounded-lg bg-rose-tint px-3 py-2 text-[0.8125rem] text-rose`,children:e.error}):null]}),c?(0,M.jsx)(`p`,{className:`m-3 rounded-xl bg-paper-2 px-4 py-3 text-[0.8125rem] text-ink-2 leading-relaxed`,children:c}):(0,M.jsxs)(`div`,{className:o?`p-2`:`p-3`,children:[(0,M.jsxs)(`div`,{className:`rounded-xl bg-card p-1.5 shadow-soft ring-1 ring-border focus-within:ring-focus`,children:[W.size?(0,M.jsx)(`div`,{className:`flex flex-wrap gap-2 px-1 pt-1 pb-1.5`,children:A.map((e,t)=>{let n=W.get(e);return n?(0,M.jsx)(L,{url:n,label:e.name,children:(0,M.jsx)(`button`,{type:`button`,"aria-label":b(`editor.detach`),onClick:()=>N(e=>e.filter((e,n)=>n!==t)),className:`-top-1.5 -right-1.5 absolute flex size-5 items-center justify-center rounded-full bg-ink text-paper opacity-0 shadow-soft transition focus-visible:opacity-100 group-hover:opacity-100`,children:(0,M.jsx)(C,{className:`size-3`})})},`${e.name}-${t}`):null})}):null,A.some(e=>!W.has(e))?(0,M.jsx)(`ul`,{className:`flex flex-wrap gap-1.5 px-1 pt-1 pb-1.5`,children:A.map((e,t)=>W.has(e)?null:(0,M.jsxs)(`li`,{className:`inline-flex max-w-full items-center gap-1.5 rounded-full bg-paper-2 py-1 pr-1 pl-2.5 text-[0.75rem] text-ink-2`,children:[(0,M.jsx)(f,{className:`size-3 shrink-0 text-ink-4`}),(0,M.jsx)(`span`,{className:`truncate`,children:e.name}),(0,M.jsx)(`button`,{type:`button`,"aria-label":b(`editor.detach`),onClick:()=>N(e=>e.filter((e,n)=>n!==t)),className:`inline-flex size-5 shrink-0 items-center justify-center rounded-full text-ink-3 hover:bg-paper-3 hover:text-ink`,children:(0,M.jsx)(C,{className:`size-3`})})]},`${e.name}-${t}`))}):null,(0,M.jsxs)(`div`,{className:`flex items-end gap-1`,children:[(0,M.jsx)(y,{label:b(`editor.attach`),onClick:()=>R.current?.click(),children:(0,M.jsx)(h,{className:`size-4`})}),(0,M.jsx)(`input`,{ref:R,type:`file`,multiple:!0,hidden:!0,onChange:e=>{let t=Array.from(e.target.files??[]);e.target.value=``,V(t)}}),(0,M.jsx)(`textarea`,{ref:F,rows:1,value:O,onChange:e=>k(e.target.value),onPaste:e=>{let t=Array.from(e.clipboardData.files);t.length&&(e.preventDefault(),V(t.map(I)))},onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),K())},placeholder:z.listening?b(`editor.listening`):r,className:`max-h-[200px] min-h-[40px] flex-1 resize-none bg-transparent px-1.5 py-2 text-[0.875rem] outline-none placeholder:truncate placeholder:text-ink-4`}),z.supported?(0,M.jsx)(y,{label:z.processing?b(`editor.transcribing`):z.listening?b(`editor.voiceStop`):b(`editor.voice`),"aria-pressed":z.listening,disabled:z.processing,onClick:z.toggle,className:v(z.listening&&`bg-rose-tint text-rose hover:bg-rose-tint hover:text-rose`),children:z.processing?(0,M.jsx)(_,{className:`size-4`}):z.listening?(0,M.jsx)(d,{className:`size-3.5 animate-pulse-dot fill-current`}):(0,M.jsx)(g,{className:`size-4`})}):null,(0,M.jsx)(`button`,{type:`button`,onClick:()=>void K(),disabled:!B,className:v(`inline-flex size-9 shrink-0 items-center justify-center rounded-full transition`,B?`bg-primary text-primary-foreground`:`bg-paper-2 text-ink-4`),"aria-label":`Send`,children:(0,M.jsx)(l,{className:`size-4`})})]})]}),z.error?(0,M.jsx)(`p`,{className:`mt-2 px-1 text-[0.75rem] text-rose`,children:z.error===`denied`?b(`editor.micDenied`):z.error}):null]})]})}export{z as i,H as n,P as r,W as t};
@@ -1,5 +0,0 @@
1
- import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{A as r,D as i,O as a,d as o,i as s,j as c,k as l,n as u,nt as d,t as f,w as p}from"./api-C-JIx8M5.js";import{t as m}from"./createLucideIcon-q3MZMmnf.js";import{f as h,g,h as _,i as v,m as y,p as b,t as x,u as S}from"./RunnerView-C6mpXHeH.js";import{t as ee}from"./refresh-cw-BNtHis1x.js";import{n as te}from"./HomePage-Dd-y_p7u.js";import{t as C}from"./check-CUpby_J9.js";import{t as w}from"./chevron-down-DymW-2BP.js";import{n as T}from"./lock-DZL2N67v.js";import{r as E,t as ne}from"./ChatPanel-ofw0p02m.js";import{n as re,t as ie}from"./upload-DNRENWzQ.js";import{t as D}from"./plus-Du-Jx8aI.js";import{t as ae}from"./external-link-MAL7vJYj.js";import{n as O,t as oe}from"./wand-sparkles-Clj3VRB5.js";import{a as se,c as k,d as A,f as ce,h as le,i as ue,l as de,m as j,o as fe,p as M,s as N,u as P}from"./Account-DBtSpuEQ.js";import{n as pe,t as F}from"./trash-0IafyhZB.js";import{n as I,t as L}from"./table-2-BdDuBcF2.js";import{a as me,c as R,d as z,f as B,g as V,h as he,i as H,m as U,n as W,o as G,p as ge,r as K,s as q,t as J,u as _e,x as Y,y as X}from"./ui-Djd0WhVb.js";import{E as ve,K as Z,N as ye,R as be,T as xe,_ as Se,b as Ce,g as we,i as Te,j as Ee,m as De,v as Oe,w as ke,y as Ae}from"./index-Bb5l3tTJ.js";import"./definition-BznNdlhf.js";import{a as je,c as Me,f as Ne,i as Pe,m as Fe,n as Ie,o as Le,p as Re,r as ze,s as Be,t as Ve,u as He}from"./settings-menu-DK8T02Tt.js";var Ue={name:`calendar`,size:24,node:[[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`rect`,{x:`3`,y:`3`,width:`18`,height:`18`,rx:`2`,key:`h1oib`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]};Ue.node;var We=m(Ue),Ge={name:`files`,size:24,node:[[`path`,{d:`M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8`,key:`14sh0y`}],[`path`,{d:`M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z`,key:`1970lx`}],[`path`,{d:`M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1`,key:`l4dndm`}]]};Ge.node;var Ke=m(Ge),qe={name:`hash`,size:24,node:[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]};qe.node;var Je=m(qe),Ye={name:`layers`,size:24,node:[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]],aliases:[`layers-3`]};Ye.node;var Xe=m(Ye),Ze={name:`messages-square`,size:24,node:[[`path`,{d:`M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z`,key:`1n2ejm`}],[`path`,{d:`M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1`,key:`1qfcsi`}]]};Ze.node;var Qe=m(Ze),$e={name:`music`,size:24,node:[[`path`,{d:`M9 18V5l12-2v13`,key:`1jmyc2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}]]};$e.node;var et=m($e),tt={name:`phone`,size:24,node:[[`path`,{d:`M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384`,key:`9njp5v`}]]};tt.node;var nt=m(tt),rt={name:`puzzle`,size:24,node:[[`path`,{d:`M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z`,key:`w46dr5`}]]};rt.node;var it=m(rt),at={name:`tags`,size:24,node:[[`path`,{d:`M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z`,key:`16rjxf`}],[`path`,{d:`M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193`,key:`178nd4`}],[`circle`,{cx:`10.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`12ikhr`}]]};at.node;var ot=m(at),st={name:`text-align-start`,size:24,node:[[`path`,{d:`M21 5H3`,key:`1fi0y6`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M17 19H3`,key:`z6ezky`}]],aliases:[`text`,`align-left`]};st.node;var ct=m(st),lt={name:`toggle-left`,size:24,node:[[`circle`,{cx:`9`,cy:`12`,r:`3`,key:`u3jwor`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]};lt.node;var ut=m(lt),Q=e(t(),1),$=e(n(),1),dt={choice:ot,date:We,number:Je,text:ye,boolean:ut},ft=e=>[`knowledge`,e];function pt(e){return e===1?Y(`know.item`):Y(`know.items`,{n:e})}function mt(e,t){if(e.type===`boolean`||typeof t==`boolean`)return Y(t?`know.yes`:`know.no`);if(e.type===`date`&&typeof t==`string`){let[e,n]=t.split(` `),r=new Date(`${e}T00:00:00`),i=Number.isNaN(r.getTime())?t:r.toLocaleDateString(X,{day:`2-digit`,month:`2-digit`,year:`numeric`});return n?`${i} ${n}`:i}return e.type===`number`&&typeof t==`number`?`${t.toLocaleString(X)}${e.unit?` ${e.unit}`:``}`:String(t)}function ht(e,t){return e.flatMap(e=>{let n=t.find(t=>t.categoryId===e.id);return n?e.type===`boolean`?n.values[0]===!0?[e.name]:[]:[n.values.map(t=>mt(e,t)).join(`, `)]:[]}).join(` · `)}function gt({trigger:e,open:t,onOpen:n,children:r}){let i=(0,Q.useRef)(null);return(0,Q.useEffect)(()=>{if(!t)return;let e=e=>{i.current?.contains(e.target)||n(!1)},r=e=>e.key===`Escape`&&n(!1);return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,r),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,r)}},[t,n]),(0,$.jsxs)(`div`,{ref:i,className:`relative inline-flex`,children:[e,t?(0,$.jsx)(`div`,{className:`absolute top-full left-0 z-30 mt-1.5 w-72 max-w-[calc(100vw-32px)] rounded-xl bg-card p-3 shadow-overlay ring-1 ring-border-soft`,children:r}):null]})}function _t({category:e,current:t,onSave:n}){let[r,i]=(0,Q.useState)(t[0]===void 0?``:String(t[0]));if(e.type===`choice`){let a=t.map(String);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[e.values.length?(0,$.jsx)(_e,{multi:!0,value:a,options:e.values.map(e=>e.value),onChange:t=>n(e.multiple?t:t.filter(e=>!a.includes(e)).slice(0,1))}):null,(0,$.jsxs)(`form`,{className:`flex gap-2`,onSubmit:t=>{t.preventDefault(),r.trim()&&n(e.multiple?[...a,r.trim()]:[r.trim()])},children:[(0,$.jsx)(q,{"data-autofocus":!0,value:a.includes(r)?``:r,placeholder:Y(`know.addValue`),onChange:e=>i(e.target.value),className:`h-9`}),(0,$.jsx)(G,{label:Y(`know.addValue`),type:`submit`,children:(0,$.jsx)(D,{className:`size-4`})})]})]})}return e.type===`boolean`?(0,$.jsx)(_e,{value:t[0]===!0?Y(`know.yes`):t[0]===!1?Y(`know.no`):``,options:[Y(`know.yes`),Y(`know.no`)],onChange:e=>n([e===Y(`know.yes`)])}):(0,$.jsxs)(`form`,{className:`flex gap-2`,onSubmit:t=>{t.preventDefault(),n(r.trim()?[e.type===`number`?Number(r.replace(`,`,`.`)):r.trim()]:[])},children:[(0,$.jsx)(q,{"data-autofocus":!0,type:e.type===`date`?`date`:e.type===`number`?`number`:`text`,step:`any`,value:e.type===`date`?r.slice(0,10):r,onChange:e=>i(e.target.value),className:`h-9`}),(0,$.jsx)(J,{type:`submit`,size:`sm`,children:`OK`})]})}function vt({projectId:e,itemKey:t,has:n,categories:r,readOnly:i}){let a=d(),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(n);(0,Q.useEffect)(()=>l(n),[n]);let f=Z({mutationFn:({categoryId:n,next:r})=>u.put(`/api/studio/projects/${e}/items/${t}/categories/${n}`,{values:r}),onSuccess:()=>a.invalidateQueries({queryKey:ft(e)})}),p=r.filter(e=>!(e.proposed||e.tableId)),m=(e,t)=>{l(n=>[...n.filter(t=>t.categoryId!==e.id),...t.length?[{categoryId:e.id,values:t,by:`person`}]:[]]),f.mutate({categoryId:e.id,next:t}),s(null)},h=p.filter(e=>c.some(t=>t.categoryId===e.id)),g=p.filter(e=>!c.some(t=>t.categoryId===e.id));return p.length?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[h.map(e=>{let t=c.find(t=>t.categoryId===e.id),n=dt[e.type],r=(0,$.jsxs)(`button`,{type:`button`,disabled:i,title:`${e.name} · ${Y(`know.by.${t.by}`)}`,onClick:()=>s(o===e.id?null:e.id),className:`inline-flex h-7 items-center gap-1.5 rounded-full bg-paper-2 px-2.5 text-[0.75rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink disabled:pointer-events-none`,children:[(0,$.jsx)(n,{className:`size-3.5 text-ink-3`}),(0,$.jsx)(`span`,{className:`text-ink-3`,children:e.name}),(0,$.jsx)(`span`,{className:`font-medium`,children:t.values.map(t=>mt(e,t)).join(`, `)})]},e.id);return i?(0,$.jsx)(`span`,{children:r},e.id):(0,$.jsxs)(gt,{trigger:r,open:o===e.id,onOpen:t=>s(t?e.id:null),children:[(0,$.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`font-medium text-[0.8125rem]`,children:e.name}),(0,$.jsx)(G,{label:Y(`know.remove`),onClick:()=>m(e,[]),className:`size-7`,children:(0,$.jsx)(Ee,{className:`size-3.5`})})]}),(0,$.jsx)(_t,{category:e,current:t.values,onSave:t=>m(e,t)})]},e.id)}),i||!g.length?null:(0,$.jsx)(gt,{open:o===`+`,onOpen:e=>s(e?`+`:null),trigger:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>s(o===`+`?null:`+`),className:`inline-flex h-7 items-center gap-1 rounded-full px-2 text-[0.75rem] text-ink-3 ring-1 ring-border-soft transition hover:text-ink hover:ring-border`,children:[(0,$.jsx)(D,{className:`size-3.5`}),` `,Y(`know.category`)]}),children:(0,$.jsx)(yt,{categories:g,onSave:m})})]}):null}function yt({categories:e,onSave:t}){let[n,r]=(0,Q.useState)(e[0]?.id??``),i=e.find(e=>e.id===n);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,$.jsx)(z,{value:n,onChange:r,options:e.map(e=>({value:e.id,label:e.name}))}),i?(0,$.jsx)(_t,{category:i,current:[],onSave:e=>t(i,e)},i.id):null]})}function bt({projectId:e,open:t,onClose:n,onMade:r}){let i=d(),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(`choice`),[l,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(!1),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(``),x=Z({mutationFn:()=>u.post(`/api/studio/projects/${e}/categories`,{name:a.trim(),type:s,unit:s===`number`&&l.trim()||null,multiple:s===`choice`&&p,ordered:s===`choice`&&h,hint:y.trim()||null,values:s===`choice`?_.split(`
2
- `).map(e=>e.trim()).filter(Boolean):void 0}),onSuccess:async({id:t})=>{await i.invalidateQueries({queryKey:ft(e)}),o(``),v(``),b(``),r(t)}});return(0,$.jsx)(H,{open:t,onClose:n,title:Y(`know.newCategory`),children:(0,$.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),a.trim()&&x.mutate()},children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(R,{children:Y(`know.name`)}),(0,$.jsx)(q,{"data-autofocus":!0,value:a,maxLength:80,onChange:e=>o(e.target.value)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(R,{children:Y(`know.type`)}),(0,$.jsx)(z,{value:s,onChange:e=>c(e),options:[`choice`,`date`,`number`,`text`,`boolean`].map(e=>({value:e,label:Y(`know.type.${e}`)}))})]}),s===`number`?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(R,{hint:Y(`know.unitHint`),children:Y(`know.unit`)}),(0,$.jsx)(q,{value:l,maxLength:20,onChange:e=>f(e.target.value)})]}):null,s===`choice`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(R,{hint:Y(`know.valuesHint`),children:Y(`know.values`)}),(0,$.jsx)(he,{minRows:3,value:_,onChange:e=>v(e.target.value)})]}),(0,$.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-[0.875rem]`,children:[Y(`know.multiple`),(0,$.jsx)(U,{checked:p,onChange:m})]}),(0,$.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-[0.875rem]`,children:[Y(`know.ordered`),(0,$.jsx)(U,{checked:h,onChange:g})]})]}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(R,{hint:Y(`know.hintFieldHint`),children:Y(`know.hintField`)}),(0,$.jsx)(q,{value:y,maxLength:120,onChange:e=>b(e.target.value)})]}),x.error?(0,$.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:x.error.message}):null,(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(J,{variant:`ghost`,onClick:n,children:Y(`common.cancel`)}),(0,$.jsx)(J,{type:`submit`,busy:x.isPending,disabled:!a.trim(),children:Y(`know.create`)})]})]})})}function xt({projectId:e,category:t,readOnly:n,onOpen:r,onGone:i}){let a=d(),o=()=>a.invalidateQueries({queryKey:ft(e)}),[s,c]=(0,Q.useState)(``),l=Z({mutationFn:e=>e(),onSuccess:o}),f=dt[t.type],p=new Map(t.values.map(e=>[e.id,e]));return(0,$.jsxs)(k,{title:t.name,hint:[Y(`know.type.${t.type}`),t.unit,t.hint].filter(Boolean).join(` · `),plain:!0,action:n?null:(0,$.jsx)(G,{label:Y(`know.deleteCategory`),className:`hover:text-rose`,onClick:()=>confirm(Y(`know.confirmCategory`,{name:t.name}))&&l.mutate(async()=>{await u.del(`/api/studio/categories/${t.id}`),i()}),children:(0,$.jsx)(F,{className:`size-4`})}),children:[t.proposed&&!n?(0,$.jsxs)(W,{className:`flex flex-wrap items-center gap-3 p-4`,children:[(0,$.jsx)(K,{tone:`ember`,children:Y(`know.proposed`)}),(0,$.jsx)(`span`,{className:`flex-1 text-[0.875rem] text-ink-2`,children:Y(`know.proposedHint`)}),(0,$.jsx)(J,{size:`sm`,onClick:()=>l.mutate(()=>u.patch(`/api/studio/categories/${t.id}`,{proposed:!1})),children:Y(`know.accept`)})]}):null,t.alike.map(([e,t])=>{let r=p.get(e),i=p.get(t);if(!(r&&i))return null;let[a,o]=r.count<i.count?[r,i]:[i,r];return(0,$.jsxs)(W,{className:`flex flex-wrap items-center gap-3 p-4`,children:[(0,$.jsx)(`span`,{className:`flex-1 text-[0.875rem] text-ink-2`,children:Y(`know.alike`,{a:a.value,b:o.value})}),n?null:(0,$.jsx)(J,{size:`sm`,variant:`secondary`,busy:l.isPending,onClick:()=>l.mutate(()=>u.post(`/api/studio/values/${a.id}/merge`,{into:o.id})),children:Y(`know.merge`)})]},`${e}:${t}`)}),(0,$.jsxs)(W,{className:`flex flex-col p-1.5`,children:[t.type===`choice`?t.values.length?t.values.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(`v:${e.id}`),className:`flex items-center gap-3 rounded-lg px-3 py-2.5 text-left transition hover:bg-accent`,children:[(0,$.jsx)(f,{className:`size-4 shrink-0 text-ink-3`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[0.875rem]`,children:e.value}),e.summary?(0,$.jsx)(K,{children:Y(`know.summary`)}):null,(0,$.jsx)(`span`,{className:`shrink-0 text-[0.75rem] text-ink-3 tabular-nums`,children:pt(e.count)})]},e.id)):(0,$.jsx)(me,{children:Y(`know.empty`)}):(0,$.jsxs)(`div`,{className:`flex items-center gap-3 px-3 py-2.5 text-[0.875rem]`,children:[(0,$.jsx)(f,{className:`size-4 shrink-0 text-ink-3`}),(0,$.jsx)(`span`,{className:`flex-1 text-ink-2`,children:t.range?Y(`know.range`,{min:mt(t,t.range.min),max:mt(t,t.range.max)}):Y(`know.unset`)}),(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:pt(t.count)})]}),t.type===`choice`&&!n?(0,$.jsxs)(`form`,{className:`flex gap-2 border-border-soft border-t p-2`,onSubmit:e=>{e.preventDefault();let n=s.trim();n&&(c(``),l.mutate(()=>u.post(`/api/studio/categories/${t.id}/values`,{value:n})))},children:[(0,$.jsx)(q,{value:s,placeholder:Y(`know.addValue`),onChange:e=>c(e.target.value),className:`h-9`}),(0,$.jsx)(G,{label:Y(`know.addValue`),type:`submit`,children:(0,$.jsx)(D,{className:`size-4`})})]}):null]}),l.error?(0,$.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:l.error.message}):null]})}function St(e){return c({queryKey:[`knowledge-value`,e],queryFn:()=>u.get(`/api/studio/values/${e}`),enabled:!!e})}function Ct({value:e,readOnly:t,children:n}){let r=d(),i=Z({mutationFn:()=>u.post(`/api/studio/values/${e.id}/summary`),onSuccess:()=>r.invalidateQueries({queryKey:[`knowledge-value`,e.id]})});return(0,$.jsxs)(`div`,{className:`flex flex-col gap-9`,children:[(0,$.jsx)(k,{title:Y(`know.summary`),hint:Y(`know.summaryHint`),plain:!0,action:t?null:(0,$.jsxs)(J,{variant:`secondary`,size:`sm`,busy:i.isPending,onClick:()=>i.mutate(),children:[e.summary?(0,$.jsx)(ee,{className:`size-4`}):null,e.summary?Y(`know.summaryAgain`):Y(`know.summaryWrite`)]}),children:(0,$.jsxs)(W,{className:`p-4 sm:p-5`,children:[i.isPending?(0,$.jsx)(`div`,{className:`flex h-24 items-center justify-center text-ink-3`,children:(0,$.jsx)(B,{})}):e.summary?(0,$.jsx)(v,{text:e.summary,className:`text-[0.875rem]`}):(0,$.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:Y(`know.summaryEmpty`)}),i.error?(0,$.jsx)(`p`,{className:`mt-3 text-[0.875rem] text-rose`,children:i.error.message}):null]})}),(0,$.jsx)(k,{title:Y(`know.toc`),plain:!0,children:n})]})}var wt={backgroundImage:`repeating-conic-gradient(#c9c9c9 0% 25%, #dedede 0% 50%)`,backgroundSize:`16px 16px`};function Tt({file:e,actions:t}){let[n,r]=(0,Q.useState)(e.description),i=(0,Q.useRef)(e.description),a=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{e.description!==i.current&&(r(t=>t===i.current?e.description:t),i.current=e.description)},[e.description]),(0,Q.useLayoutEffect)(()=>{let e=a.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`)},[n]);let o=e.status===`pending`&&!n;return t.readOnly?n?(0,$.jsx)(`p`,{className:`text-[0.8125rem] text-ink-2 leading-snug`,children:n}):null:(0,$.jsx)(`textarea`,{ref:a,rows:1,value:n,maxLength:600,placeholder:Y(o?`project.describing`:`project.description`),onChange:e=>r(e.target.value),onBlur:()=>{n.trim()!==e.description&&(i.current=n.trim(),t.describe(e.id,n.trim()))},className:`-mx-1 block w-[calc(100%+0.5rem)] resize-none overflow-hidden rounded-md bg-transparent px-1 py-0.5 text-[0.8125rem] text-ink-2 leading-snug outline-none transition placeholder:text-ink-4 hover:bg-paper-2 focus:bg-card focus:text-ink focus:ring-1 focus:ring-border`})}function Et(e,t){confirm(Y(`project.removeConfirm`,{name:e.name}))&&t.remove(e.id)}function Dt({projectId:e,file:t,small:n}){let r=P(e,t.id);return t.mime.startsWith(`image/`)?(0,$.jsx)(`img`,{src:r,alt:``,loading:`lazy`,className:V(`size-full`,t.kind===`logo`?`object-contain p-3`:`object-cover`)}):t.mime.startsWith(`video/`)?(0,$.jsx)(`video`,{src:`${r}#t=0.1`,preload:`metadata`,controls:!n,className:`size-full object-cover`}):(0,$.jsx)(`div`,{className:`flex size-full items-center justify-center text-ink-3`,children:t.mime.startsWith(`audio/`)?(0,$.jsx)(et,{className:n?`size-5`:`size-7`}):(0,$.jsx)(_,{className:n?`size-5`:`size-7`})})}function Ot({projectId:e,kind:t,files:n,actions:r,accept:i,addLabel:a,onPreview:o}){return(0,$.jsxs)(`div`,{className:`grid grid-cols-[repeat(auto-fill,minmax(184px,1fr))] gap-3`,children:[n.map((i,a)=>(0,$.jsxs)(`div`,{className:`group relative flex flex-col gap-1.5 rounded-lg bg-paper p-2 pb-2.5 ring-1 ring-border-soft`,children:[t===`logo`&&a===0?(0,$.jsx)(`span`,{className:`absolute -top-3 left-3 z-10 rounded-full ring-2 ring-card`,children:(0,$.jsx)(K,{tone:`ember`,children:Y(`project.logoMain`)})}):null,(0,$.jsxs)(`div`,{className:`relative h-28 overflow-hidden rounded-md bg-paper-2`,style:t===`logo`?wt:void 0,children:[o&&i.mime.startsWith(`image/`)?(0,$.jsx)(`button`,{type:`button`,"aria-label":`${Y(`project.preview`)}: ${i.name}`,onClick:()=>o(i),className:`block size-full cursor-zoom-in`,children:(0,$.jsx)(Dt,{projectId:e,file:i})}):(0,$.jsx)(Dt,{projectId:e,file:i}),(0,$.jsxs)(`div`,{className:`absolute top-1 right-1 flex gap-1 opacity-0 transition focus-within:opacity-100 group-hover:opacity-100 coarse:opacity-100`,children:[o?(0,$.jsx)(G,{label:Y(`project.preview`),onClick:()=>o(i),className:`size-8 bg-card shadow-soft`,children:(0,$.jsx)(O,{className:`size-4`})}):null,t===`logo`&&a>0&&!r.readOnly?(0,$.jsx)(G,{label:Y(`project.logoMakeMain`),onClick:()=>r.order(`logo`,[i.id,...n.filter(e=>e.id!==i.id).map(e=>e.id)]),className:`size-8 bg-card shadow-soft`,children:(0,$.jsx)(I,{className:`size-4`})}):null,r.readOnly?null:(0,$.jsx)(G,{label:Y(`project.remove`),onClick:()=>Et(i,r),className:`size-8 bg-card shadow-soft hover:text-rose`,children:(0,$.jsx)(F,{className:`size-4`})})]})]}),t===`asset`?(0,$.jsx)(`div`,{className:`truncate px-0.5 text-[0.75rem] text-ink-3`,title:i.name,children:i.name}):null,(0,$.jsx)(Tt,{file:i,actions:r})]},i.id)),a&&!r.readOnly?(0,$.jsxs)(se,{accept:i,multiple:!1,onFiles:e=>r.upload(t,e),className:`min-h-28 flex-col p-3`,children:[r.busy?(0,$.jsx)(B,{className:`size-5`}):(0,$.jsx)(D,{className:`size-5`}),a]}):null]})}function kt({projectId:e,data:t,readOnly:n}){let r=ce(e,n);return(0,$.jsxs)(k,{title:Y(`project.logos`),hint:Y(`project.logosHint`),children:[(0,$.jsx)(Ot,{projectId:e,kind:`logo`,files:t.files.filter(e=>e.kind===`logo`),actions:r,accept:`image/*`,addLabel:Y(`project.logoAdd`)}),r.error?(0,$.jsx)(`p`,{className:`mt-3 text-[0.875rem] text-rose`,children:r.error}):null]})}var At=e=>[(e.name.includes(`.`)?e.name.split(`.`).pop():e.mime.split(`/`).pop())?.toUpperCase().slice(0,5),de(e.size)].filter(Boolean).join(` · `);function jt({projectId:e,file:t,actions:n,onClose:r}){let i=P(e,t.id);return(0,$.jsxs)(H,{open:!0,onClose:r,wide:`page`,title:t.name,children:[(0,$.jsxs)(`div`,{className:`-mt-2 mb-4 flex items-center justify-between gap-3`,children:[(0,$.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3`,children:At(t)}),(0,$.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,"aria-label":Y(`project.openOriginal`),title:Y(`project.openOriginal`),className:`inline-flex size-9 items-center justify-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink`,children:(0,$.jsx)(ae,{className:`size-4`})})]}),t.mime.startsWith(`image/`)?(0,$.jsx)(`div`,{className:`overflow-hidden rounded-lg`,style:wt,children:(0,$.jsx)(`img`,{src:i,alt:``,className:`mx-auto max-h-[68dvh] object-contain`})}):t.mime.startsWith(`video/`)?(0,$.jsx)(`video`,{src:i,controls:!0,className:`max-h-[68dvh] w-full rounded-lg bg-black`}):(0,$.jsx)(`audio`,{src:i,controls:!0,className:`w-full`}),(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsx)(Tt,{file:t,actions:n})})]})}function Mt({projectId:e,file:t,actions:n,onPreview:r}){return(0,$.jsxs)(`li`,{className:`flex items-start gap-3 rounded-lg bg-paper p-2 ring-1 ring-border-soft`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":`${Y(`project.preview`)}: ${t.name}`,onClick:r,className:`size-14 shrink-0 cursor-zoom-in overflow-hidden rounded-md bg-paper-2`,children:(0,$.jsx)(Dt,{projectId:e,file:t,small:!0})}),(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1 py-0.5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-3`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:r,title:t.name,className:`min-w-0 truncate font-medium text-[0.875rem] hover:underline`,children:t.name}),(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:At(t)})]}),(0,$.jsx)(Tt,{file:t,actions:n})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start`,children:[(0,$.jsx)(G,{label:Y(`project.preview`),onClick:r,children:(0,$.jsx)(O,{className:`size-4`})}),n.readOnly?null:(0,$.jsx)(G,{label:Y(`project.remove`),onClick:()=>Et(t,n),className:`hover:text-rose`,children:(0,$.jsx)(F,{className:`size-4`})})]})]})}function Nt({projectId:e,data:t,readOnly:n}){let r=ce(e,n),[i,a]=M(`assets`,`cards`),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(null),u=t.files.filter(e=>e.kind===`asset`),d=u.find(e=>e.id===c),f=o.trim().toLowerCase(),p=f?u.filter(e=>`${e.name} ${e.description}`.toLowerCase().includes(f)):u;return(0,$.jsxs)(k,{title:Y(`project.assets`),hint:Y(`project.assetsHint`),children:[u.length?(0,$.jsx)(fe,{layout:i,onToggle:a,children:(0,$.jsx)(N,{value:o,onChange:s,placeholder:Y(`project.assetSearch`)})}):null,p.length?(0,$.jsx)(`div`,{className:`mb-3`,children:i===`cards`?(0,$.jsx)(Ot,{projectId:e,kind:`asset`,files:p,actions:r,onPreview:e=>l(e.id)}):(0,$.jsx)(`ul`,{className:`flex flex-col gap-2`,children:p.map(t=>(0,$.jsx)(Mt,{projectId:e,file:t,actions:r,onPreview:()=>l(t.id)},t.id))})}):null,n?u.length?null:(0,$.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:Y(`project.staysLocal`)}):(0,$.jsxs)(se,{accept:`image/*,video/*,audio/*`,onFiles:e=>r.upload(`asset`,e),className:`h-16 w-full`,children:[r.busy?(0,$.jsx)(B,{className:`size-4`}):(0,$.jsx)(ie,{className:`size-4`}),Y(`project.drop`),` `,(0,$.jsx)(`span`,{className:`underline`,children:Y(`project.assetAdd`)})]}),r.error?(0,$.jsx)(`p`,{className:`mt-3 text-[0.875rem] text-rose`,children:r.error}):null,d?(0,$.jsx)(jt,{projectId:e,file:d,actions:r,onClose:()=>l(null)}):null]})}function Pt(e){return c({queryKey:[`knowledge`,e],queryFn:()=>u.get(`/api/studio/projects/${e}/knowledge`),enabled:!!e,refetchInterval:e=>e.state.data?.items.some(e=>e.status===`pending`)?2e3:!1})}function Ft(e){return e.kind===`table`?e.format===`faq`?Qe:L:e.kind===`file`?b:e.children?Ke:be}function It({item:e,categories:t,onOpen:n}){let r=Ft(e),i=[ht(t,e.categories),e.children?e.children===1?Y(`know.oneSub`):Y(`know.sub`,{n:e.children}):``,e.rows===null?``:e.rows===1?Y(`know.row`):Y(`know.rows`,{n:e.rows}),e.originLabel??``].filter(Boolean).join(` · `);return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(e.key),disabled:e.status===`pending`,className:`flex items-start gap-3 rounded-lg px-3 py-2.5 text-left transition hover:bg-accent disabled:pointer-events-none`,children:[(0,$.jsx)(r,{className:`mt-0.5 size-4 shrink-0 text-ink-3`}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block truncate text-[0.875rem]`,children:e.title}),i?(0,$.jsx)(`span`,{className:`block truncate text-[0.75rem] text-ink-3`,children:i}):null]}),e.status===`pending`?(0,$.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1.5 text-[0.75rem] text-ink-3`,children:[(0,$.jsx)(B,{className:`size-3`}),` `,Y(`know.reading`)]}):e.review?(0,$.jsx)(K,{tone:`warn`,title:e.review,children:Y(`know.review`)}):null]})}function Lt({projectId:e,itemKey:t,has:n,originLabel:r,kept:i,review:a,file:o,readOnly:s,onReviewed:c}){let l=Pt(e),u=[r?Y(i?`know.kept`:`know.from`,{label:r}):``].filter(Boolean);return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 px-1`,children:[l.data?(0,$.jsx)(vt,{projectId:e,itemKey:t,has:n,categories:l.data.categories,readOnly:s}):null,u.length||o||a?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-[0.8125rem] text-ink-3`,children:[u.map(e=>(0,$.jsx)(`span`,{children:e},e)),o?(0,$.jsxs)(`a`,{href:P(e,o.id),target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 underline-offset-2 hover:text-ink hover:underline`,children:[(0,$.jsx)(b,{className:`size-3.5`}),` `,Y(`know.original`),`: `,o.name]}):null,a?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,$.jsx)(K,{tone:`warn`,children:Y(`know.review`)}),(0,$.jsx)(`span`,{children:a}),s?null:(0,$.jsx)(`button`,{type:`button`,onClick:c,className:`underline hover:text-ink`,children:Y(`know.reviewed`)})]}):null]}):null]})}function Rt(e){let t=e.filter(Number.isFinite).sort((e,t)=>e-t);if(new Set(t).size<=4)return[];let n=t[0],r=t.at(-1),i=e=>e.slice(0,-1).map((t,n)=>({lo:t,hi:e[n+1]})).filter(e=>t.some(t=>t>=e.lo&&t<e.hi));if(n>0&&r/n>=30){let e=Math.floor(Math.log10(n)),t=Math.floor(Math.log10(r))+1;for(let a of[[1,2,5],[1,3],[1]]){let o=[];for(let n=e;n<=t;n++)for(let e of a)o.push(e*10**n);let s=i(o.filter((e,t)=>e<=n||o[t-1]<=r));if(s.length<=7)return s}}let a=(r-n)/5,o=10**Math.floor(Math.log10(a)),s=([1,2,2.5,5,10].map(e=>e*o).find(e=>e>=a)??a)||1,c=[];for(let e=Math.floor(n/s)*s;e<=r;e+=s)c.push(e);return c.push(c.at(-1)+s),i(c)}function zt({projectId:e,category:t,categories:n,onOpen:r}){let i=c({queryKey:[`knowledge`,e,`category`,t.id],queryFn:()=>u.get(`/api/studio/categories/${t.id}/items`)});if(!i.data)return i.isLoading?(0,$.jsx)(B,{className:`mx-auto size-4 text-ink-3`}):null;let a=e=>e.categories.find(e=>e.categoryId===t.id)?.values[0],o=[...i.data.items].sort((e,t)=>{let n=a(e),r=a(t);return typeof n==`number`&&typeof r==`number`?n-r:String(r??``).localeCompare(String(n??``),X)}),s=t.type===`number`?Rt(o.map(a).filter(e=>typeof e==`number`)):[],l=new Intl.NumberFormat(X,{notation:`compact`,maximumFractionDigits:1}),d=t.unit?` ${t.unit}`:``,f=new Map;for(let e of o){let n=a(e),r=typeof n==`number`?s.find(e=>n>=e.lo&&n<e.hi):void 0,i=n===void 0?``:t.type===`date`?new Date(`${String(n).slice(0,7)}-01T00:00:00`).toLocaleDateString(X,{month:`long`,year:`numeric`}):r?Y(`know.range`,{min:`${l.format(r.lo)}${d}`,max:`${l.format(r.hi)}${d}`}):mt(t,n);f.set(i,[...f.get(i)??[],e])}return(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[[...f].map(([e,t])=>(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[e?(0,$.jsx)(`p`,{className:`px-1 font-medium text-[0.6875rem] text-ink-4 uppercase tracking-[0.12em]`,children:e}):null,(0,$.jsx)(W,{className:`flex flex-col p-1.5`,children:t.map(e=>(0,$.jsx)(It,{item:e,categories:n,onOpen:r},e.key))})]},e)),i.data.rows.map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>r(`t:${e.tableId}`),className:`px-1 text-left text-[0.8125rem] text-ink-3 hover:text-ink`,children:Y(`know.tocRows`,{n:e.count,table:e.title})},e.tableId))]})}function Bt(e,t,n){return Array.isArray(n)?t.some(e=>n.map(String).includes(String(e))):typeof n==`object`&&n?t.some(t=>{if(e.type===`number`&&typeof t==`number`)return(n.gte===void 0||t>=n.gte)&&(n.lte===void 0||t<=n.lte);if(e.type===`date`){let e=String(t).slice(0,10);return(!n.after||e>=n.after)&&(!n.before||e<=n.before)}return!n.contains||String(t).toLowerCase().includes(n.contains.toLowerCase())}):t.some(e=>e===n)}function Vt(e,t){if(Array.isArray(t))return t.map(String).join(`, `);if(typeof t==`boolean`)return Y(t?`know.yes`:`know.no`);if(typeof t==`object`&&t){let n=t.gte??t.after,r=t.lte??t.before;return t.contains?`${Y(`know.contains`)} ${t.contains}`:[n===void 0?``:`${Y(`know.minimum`)} ${mt(e,n)}`,r===void 0?``:`${Y(`know.maximum`)} ${mt(e,r)}`].filter(Boolean).join(` `)}return String(t)}function Ht({category:e,value:t,onChange:n}){let[r,i]=(0,Q.useState)(!1),a=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(!r)return;let e=e=>!a.current?.contains(e.target)&&i(!1);return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[r]);let o=dt[e.type],s=typeof t==`object`&&t&&!Array.isArray(t)?t:{},c=(t,r)=>{let i={...s,[t]:r===``?void 0:e.type===`number`?Number(r):r},a=Object.fromEntries(Object.entries(i).filter(([,e])=>e!==void 0));n(Object.keys(a).length?a:void 0)};return(0,$.jsxs)(`div`,{ref:a,className:`relative`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>i(!r),className:V(`inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[0.8125rem] transition`,t===void 0?`text-ink-2 ring-1 ring-border-soft hover:ring-border`:`bg-ember-tint text-ink ring-1 ring-ember/30`),children:[(0,$.jsx)(o,{className:`size-3.5 text-ink-3`}),e.name,t===void 0?null:(0,$.jsxs)(`span`,{className:`font-medium`,children:[`: `,Vt(e,t)]}),(0,$.jsx)(w,{className:`size-3.5 text-ink-3`})]}),r?(0,$.jsxs)(`div`,{className:`absolute top-full left-0 z-30 mt-1.5 w-72 max-w-[calc(100vw-32px)] rounded-xl bg-card p-3 shadow-overlay ring-1 ring-border-soft`,children:[e.type===`choice`?(0,$.jsx)(_e,{multi:!0,value:Array.isArray(t)?t.map(String):[],options:e.values.map(e=>e.value),onChange:e=>n(e.length?e:void 0)}):e.type===`boolean`?(0,$.jsx)(_e,{value:t===!0?Y(`know.yes`):t===!1?Y(`know.no`):``,options:[Y(`know.yes`),Y(`know.no`)],onChange:e=>n(e===Y(`know.yes`))}):e.type===`text`?(0,$.jsx)(q,{"data-autofocus":!0,value:s.contains??``,placeholder:Y(`know.contains`),onChange:e=>n(e.target.value?{contains:e.target.value}:void 0),className:`h-9`}):(0,$.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:(e.type===`number`?[`gte`,`lte`]:[`after`,`before`]).map((t,n)=>(0,$.jsxs)(`div`,{children:[(0,$.jsx)(R,{children:Y(n===0?`know.minimum`:`know.maximum`)}),(0,$.jsx)(q,{type:e.type===`number`?`number`:`date`,step:`any`,value:String(s[t]??``),placeholder:e.range?String(n===0?e.range.min:e.range.max):``,onChange:e=>c(t,e.target.value),className:`h-9`})]},t))}),t===void 0?null:(0,$.jsx)(`button`,{type:`button`,onClick:()=>{n(void 0),i(!1)},className:`mt-3 text-[0.8125rem] text-ink-3 underline hover:text-ink`,children:Y(`know.clear`)})]}):null]})}function Ut({found:e,onOpen:t}){return e.hits.length?(0,$.jsxs)(`div`,{className:`flex flex-col`,children:[(0,$.jsx)(`p`,{className:`px-3 pt-1 pb-2 text-[0.75rem] text-ink-3`,children:e.checked?Y(`know.searchStats`,{candidates:e.candidates,hits:e.hits.length}):Y(`know.searchUnchecked`,{hits:e.hits.length})}),e.hits.map(e=>{let n=e.open;return(0,$.jsxs)(`button`,{type:`button`,disabled:!n,onClick:()=>n&&t(n),className:`flex items-start gap-3 rounded-lg px-3 py-2.5 text-left transition hover:bg-accent disabled:pointer-events-none`,children:[(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`block truncate text-[0.875rem]`,children:[e.title,e.heading&&e.heading!==e.title?(0,$.jsxs)(`span`,{className:`text-ink-3`,children:[` › `,e.heading]}):null]}),(0,$.jsx)(`span`,{className:`line-clamp-2 text-[0.8125rem] text-ink-3`,children:e.text})]}),e.relevance===null?null:(0,$.jsx)(`span`,{className:`shrink-0 font-medium text-[0.75rem] text-moss tabular-nums`,children:e.relevance.toLocaleString(X,{minimumFractionDigits:2})})]},`${e.key}:${e.heading}`)})]}):(0,$.jsx)(`p`,{className:`px-3 py-4 text-[0.875rem] text-ink-3`,children:Y(`know.searchNone`)})}function Wt({kind:e,projectId:t,onClose:n,onMade:r}){let i=d(),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(!1),l=Z({mutationFn:()=>u.post(`/api/studio/projects/${t}/${e===`table`?`tables`:`pages`}`,{title:a.trim(),...e===`table`&&s?{format:`faq`}:{}}),onSuccess:async({id:n})=>{await i.invalidateQueries({queryKey:[`knowledge`,t]}),r(`${e===`table`?`t`:`p`}:${n}`),o(``),c(!1)}});return(0,$.jsx)(H,{open:e!==null,onClose:n,title:Y(e===`table`?`know.newTable`:`know.newPage`),children:(0,$.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),a.trim()&&l.mutate()},children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(R,{children:Y(`data.title`)}),(0,$.jsx)(q,{"data-autofocus":!0,value:a,maxLength:120,onChange:e=>o(e.target.value)})]}),e===`table`?(0,$.jsxs)(`label`,{className:`flex items-center justify-between gap-3 text-[0.875rem]`,children:[Y(`know.asFaq`),(0,$.jsx)(U,{checked:s,onChange:c})]}):null,l.error?(0,$.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:l.error.message}):null,(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(J,{variant:`ghost`,onClick:n,children:Y(`common.cancel`)}),(0,$.jsx)(J,{type:`submit`,busy:l.isPending,disabled:!a.trim(),children:Y(`know.create`)})]})]})})}function Gt({projectId:e,data:t,readOnly:n,onOpen:r}){let i=d(),a=ce(e,n),[o,s]=(0,Q.useState)({}),[c,l]=(0,Q.useState)(``),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(null),v=t.categories.filter(e=>!e.proposed&&e.count>0),y=t.categories.filter(e=>e.proposed),b=t.items.filter(e=>Object.entries(o).every(([n,r])=>{let i=t.categories.find(e=>e.name===n),a=e.categories.find(e=>e.categoryId===i?.id);return i&&a?Bt(i,a.values,r):!1})),x=async()=>{if(!c.trim()){p(null);return}h(!0);try{p(await u.post(`/api/studio/projects/${e}/search`,{query:c,...Object.keys(o).length?{where:o}:{}}))}catch{p({hits:[],candidates:0,checked:!1,filtered:null})}finally{h(!1)}},S=Z({mutationFn:({id:e,keep:t})=>t?u.patch(`/api/studio/categories/${e}`,{proposed:!1}):u.del(`/api/studio/categories/${e}`),onSuccess:()=>i.invalidateQueries({queryKey:[`knowledge`,e]})});return(0,$.jsxs)(k,{title:Y(`know.title`),hint:Y(`know.hint`),plain:!0,action:n?null:(0,$.jsxs)(`div`,{className:`flex flex-wrap justify-end gap-2`,children:[(0,$.jsxs)(J,{variant:`secondary`,size:`sm`,onClick:()=>_(`page`),children:[(0,$.jsx)(D,{className:`size-4`}),` `,Y(`know.page`)]}),(0,$.jsxs)(J,{variant:`secondary`,size:`sm`,onClick:()=>_(`table`),children:[(0,$.jsx)(D,{className:`size-4`}),` `,Y(`know.table`)]}),(0,$.jsxs)(J,{variant:`secondary`,size:`sm`,onClick:()=>_(`category`),children:[(0,$.jsx)(D,{className:`size-4`}),` `,Y(`know.category`)]})]}),children:[y.length&&!n?(0,$.jsx)(W,{className:`flex flex-col gap-2 p-4`,children:y.map(e=>{let t=dt[e.type];return(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[(0,$.jsx)(K,{tone:`ember`,children:Y(`know.proposed`)}),(0,$.jsx)(t,{className:`size-4 text-ink-3`}),(0,$.jsx)(`span`,{className:`font-medium text-[0.875rem]`,children:e.name}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[0.8125rem] text-ink-3`,children:[Y(`know.type.${e.type}`),e.hint].filter(Boolean).join(` · `)}),(0,$.jsx)(J,{size:`sm`,variant:`ghost`,onClick:()=>S.mutate({id:e.id,keep:!1}),children:Y(`know.dismiss`)}),(0,$.jsx)(J,{size:`sm`,onClick:()=>S.mutate({id:e.id,keep:!0}),children:Y(`know.accept`)})]},e.id)})}):null,t.items.length?(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,$.jsx)(N,{value:c,placeholder:Y(`know.search`),busy:m,onEnter:()=>void x(),onChange:e=>{l(e),e.trim()||p(null)}}),v.length?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[v.map(e=>(0,$.jsx)(Ht,{category:e,value:o[e.name],onChange:t=>{p(null),s(n=>{let r={...n};return t===void 0?delete r[e.name]:r[e.name]=t,r})}},e.id)),Object.keys(o).length?(0,$.jsx)(`button`,{type:`button`,onClick:()=>s({}),className:`px-2 text-[0.8125rem] text-ink-3 underline hover:text-ink`,children:Y(`know.clear`)}):null]}):null]}):null,(0,$.jsx)(W,{className:`flex flex-col p-1.5`,children:f?(0,$.jsx)(Ut,{found:f,onOpen:r}):b.length?b.map(e=>(0,$.jsx)(It,{item:e,categories:t.categories,onOpen:r},e.key)):(0,$.jsx)(me,{children:Y(`know.empty`)})}),n?null:(0,$.jsxs)(se,{accept:`.pdf,.docx,.doc,.xlsx,.csv,.tsv,.txt,.md,.json,.html,.eml,image/*`,onFiles:async t=>{await a.upload(`document`,t),await i.invalidateQueries({queryKey:[`knowledge`,e]})},className:`h-14 w-full`,children:[a.busy?(0,$.jsx)(B,{className:`size-4`}):(0,$.jsx)(ie,{className:`size-4`}),Y(`know.drop`),` `,(0,$.jsx)(`span`,{className:`underline`,children:Y(`know.pick`)})]}),a.error?(0,$.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:a.error}):null,t.items.length&&!(t.checked&&t.embeddings)?(0,$.jsx)(`p`,{className:`px-1 text-[0.8125rem] text-ink-3`,children:[t.embeddings?``:Y(`know.keywordsOnly`),t.checked?``:Y(`know.unchecked`)].filter(Boolean).join(` `)}):null,(0,$.jsx)(Wt,{kind:g===`page`||g===`table`?g:null,projectId:e,onClose:()=>_(null),onMade:e=>{_(null),r(e)}}),(0,$.jsx)(bt,{projectId:e,open:g===`category`,onClose:()=>_(null),onMade:e=>{_(null),r(`c:${e}`)}})]})}function Kt(e,t,n){return c({queryKey:[`project-file-text`,t.id,t.chars,n],queryFn:()=>u.get(`/api/studio/projects/${e}/files/${t.id}/text?limit=${n}`),enabled:t.status===`ready`,staleTime:6e4})}function qt(e){return((e.name.includes(`.`)?e.name.split(`.`).pop():``)||e.mime.split(`/`).pop()||``).toUpperCase().slice(0,5)}var Jt=e=>[qt(e),e.pages?Y(`project.pages`,{n:e.pages}):null,de(e.size)].filter(Boolean).join(` · `),Yt=2e5;function Xt({projectId:e,fileId:t,readOnly:n,onGone:r}){let i=d(),a=j(e),o=Pt(e),s=ce(e,n),c=a.data?.files.find(e=>e.id===t),l=c?c.mime===`application/pdf`||c.mime.startsWith(`image/`):!1,[u,f]=(0,Q.useState)(null);if(!c)return a.isLoading?(0,$.jsx)(B,{className:`mx-auto text-ink-3`}):null;let p=u??(l?`original`:`text`),m=o.data?.items.find(e=>e.key===`f:${c.id}`),h=P(e,c.id),g=(e,t)=>(0,$.jsx)(`button`,{type:`button`,"aria-pressed":p===e,onClick:()=>f(e),className:V(`rounded-full px-3 py-1 text-[0.8125rem] transition`,p===e?`bg-paper-2 font-medium text-ink`:`text-ink-3 hover:text-ink`),children:t});return(0,$.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 px-1`,children:[(0,$.jsx)(`h2`,{className:`min-w-0 flex-1 truncate font-display font-semibold text-lg`,children:c.name}),(0,$.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 max-sm:hidden`,children:Jt(c)}),(0,$.jsx)(`a`,{href:h,target:`_blank`,rel:`noreferrer`,"aria-label":Y(`project.openOriginal`),title:Y(`project.openOriginal`),className:`inline-flex size-9 items-center justify-center rounded-full text-ink-3 transition hover:bg-accent hover:text-ink`,children:(0,$.jsx)(ae,{className:`size-4`})}),n?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(G,{label:Y(`project.reindex`),onClick:async()=>{await s.reindex(c.id),await i.invalidateQueries({queryKey:[`knowledge`,e]})},children:(0,$.jsx)(ee,{className:`size-4`})}),(0,$.jsx)(G,{label:Y(`know.deleteFile`),className:`hover:text-rose`,onClick:async()=>{confirm(Y(`data.confirmDelete`,{title:c.name}))&&(await s.remove(c.id),await i.invalidateQueries({queryKey:[`knowledge`,e]}),r())},children:(0,$.jsx)(F,{className:`size-4`})})]})]}),(0,$.jsx)(Lt,{projectId:e,itemKey:`f:${c.id}`,has:m?.categories??[],originLabel:m?.originLabel??null,kept:!1,review:null,file:null,readOnly:n,onReviewed:()=>void 0}),(0,$.jsx)(`div`,{className:`px-1`,children:(0,$.jsx)(Tt,{file:c,actions:s})}),c.status===`failed`?(0,$.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:c.error}):null,(0,$.jsxs)(W,{className:`flex flex-col`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1 border-border-soft border-b px-2 py-1.5`,children:[l?g(`original`,Y(`project.original`)):null,g(`text`,Y(`project.readText`))]}),p===`original`?c.mime===`application/pdf`?(0,$.jsx)(`iframe`,{src:h,title:c.name,className:`h-[70dvh] w-full rounded-b-xl bg-paper-2`}):(0,$.jsx)(`img`,{src:h,alt:``,className:`mx-auto max-h-[70dvh] object-contain p-4`}):(0,$.jsx)(Zt,{projectId:e,file:c})]})]})}function Zt({projectId:e,file:t}){let n=Kt(e,t,Yt);return n.isLoading||t.status===`pending`?(0,$.jsx)(`div`,{className:`flex h-40 items-center justify-center text-ink-3`,children:(0,$.jsx)(B,{})}):n.data?.text?(0,$.jsxs)(`div`,{className:`overflow-x-auto p-4 sm:p-5`,children:[(0,$.jsx)(v,{text:n.data.text,className:`text-[0.875rem]`}),n.data.chars>n.data.text.length?(0,$.jsx)(`p`,{className:`mt-3 text-[0.8125rem] text-ink-3`,children:Y(`project.textCut`,{shown:n.data.text.length.toLocaleString(),total:n.data.chars.toLocaleString()})}):null]}):(0,$.jsx)(`p`,{className:`py-8 text-center text-[0.875rem] text-ink-3`,children:Y(`project.noText`)})}function Qt({page:e,onGone:t,onOpen:n}){let r=d(),[i,a]=(0,Q.useState)(e.title),[o,s]=(0,Q.useState)(e.markdown),[c,l]=(0,Q.useState)(e.markdown?`read`:`write`),f=e.knowledge,p=async()=>{await r.invalidateQueries({queryKey:[`space-data`,e.projectId]}),await r.invalidateQueries({queryKey:[`knowledge`,e.projectId]})},m=A({title:i.trim()||e.title,markdown:o},async t=>{await u.patch(`/api/studio/pages/${e.id}`,t),r.setQueryData([`space-page`,e.id],e=>e&&{...e,...t}),t.title!==e.title&&await p()}),h=Z({mutationFn:()=>u.del(`/api/studio/pages/${e.id}`),onSuccess:async()=>{await p(),t()}}),g=Z({mutationFn:()=>u.post(`/api/studio/projects/${e.projectId}/pages`,{title:Y(`know.addSub`),parentId:e.id}),onSuccess:async({id:e})=>{await p(),n?.(`p:${e}`)}}),_=Z({mutationFn:()=>u.patch(`/api/studio/pages/${e.id}`,{review:null}),onSuccess:()=>r.invalidateQueries({queryKey:[`space-page`,e.id]})}),y=async t=>{let r=t.target.closest(`a`)?.getAttribute(`href`);if(!(r?.startsWith(`pages/`)&&n))return;t.preventDefault();let i=await u.get(`/api/studio/projects/${e.projectId}/resolve?path=${encodeURIComponent(r)}`).catch(()=>null);i?.kind===`page`&&n(`p:${i.id}`)},b=e.readOnly,x=f?.file&&(f.file.mime===`application/pdf`||f.file.mime.startsWith(`image/`))?f.file:null,S=(e,t)=>(0,$.jsx)(`button`,{type:`button`,"aria-pressed":c===e,onClick:()=>l(e),className:V(`rounded-full px-3 py-1 text-[0.8125rem] transition`,c===e?`bg-paper-2 font-medium text-ink`:`text-ink-3 hover:text-ink`),children:t});return(0,$.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[f?.parents.length&&n?(0,$.jsx)(`nav`,{className:`-mb-1.5 flex flex-wrap items-center gap-1 px-1 text-[0.8125rem] text-ink-3`,children:f.parents.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>n(`p:${e.id}`),className:`hover:text-ink`,children:e.title}),(0,$.jsx)(T,{className:`size-3.5`})]},e.id))}):null,(0,$.jsxs)(`div`,{className:`flex items-center gap-2 px-1`,children:[(0,$.jsx)(`input`,{value:i,disabled:b,maxLength:200,onChange:e=>a(e.target.value),"aria-label":Y(`data.title`),className:`-ml-1 min-w-0 flex-1 rounded-md bg-transparent px-1 font-display font-semibold text-lg outline-none hover:bg-accent focus:bg-paper focus:ring-1 focus:ring-ring disabled:hover:bg-transparent`}),m.state===`saving`?(0,$.jsx)(B,{className:`size-3.5 text-ink-3`}):m.state===`saved`?(0,$.jsx)(C,{className:`size-4 text-moss`,"aria-label":Y(`settings.saved`)}):null,b?null:(0,$.jsx)(G,{label:Y(`data.deletePage`),onClick:()=>confirm(Y(`data.confirmDelete`,{title:e.title}))&&h.mutate(),className:`hover:text-rose`,children:(0,$.jsx)(F,{className:`size-4`})})]}),f?(0,$.jsx)(Lt,{projectId:e.projectId,itemKey:`p:${e.id}`,has:f.categories,originLabel:f.originLabel,kept:f.kept,review:f.review,file:x?null:f.file,readOnly:b,onReviewed:()=>_.mutate()}):null,(0,$.jsxs)(W,{className:`flex flex-col`,children:[b&&!x?null:(0,$.jsxs)(`div`,{className:`flex items-center gap-1 border-border-soft border-b px-2 py-1.5`,children:[b?null:S(`write`,Y(`data.write`)),S(`read`,Y(`data.preview`)),x?S(`original`,Y(`know.original`)):null,(0,$.jsx)(`span`,{className:`ml-auto truncate px-2 text-[0.75rem] text-ink-4 max-sm:hidden`,children:c===`original`&&x?x.name:Y(`data.markdownHint`)})]}),c===`original`&&x?x.mime===`application/pdf`?(0,$.jsx)(`iframe`,{src:P(e.projectId,x.id),title:x.name,className:`h-[70dvh] w-full rounded-b-xl bg-paper-2`}):(0,$.jsx)(`img`,{src:P(e.projectId,x.id),alt:``,className:`mx-auto max-h-[70dvh] object-contain p-4`}):c===`write`&&!b?(0,$.jsx)(`textarea`,{value:o,onChange:e=>s(e.target.value),"aria-label":e.title,placeholder:Y(`data.pageEmpty`),className:`field-sizing-content min-h-[50vh] w-full resize-none bg-transparent p-4 font-mono text-[0.8125rem] leading-relaxed outline-none placeholder:text-ink-4 sm:p-5`}):(0,$.jsx)(`div`,{className:`min-h-40 p-4 sm:p-5`,onClick:y,children:o.trim()?(0,$.jsx)(v,{text:o}):(0,$.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:Y(`data.pageEmpty`)})})]}),m.state===`error`&&m.error?(0,$.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:m.error}):null,f&&n&&(f.children.length||!b)?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-col gap-1.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-1`,children:[(0,$.jsx)(`p`,{className:`font-medium text-[0.6875rem] text-ink-4 uppercase tracking-[0.12em]`,children:f.children.length?Y(`know.subPages`):null}),b?null:(0,$.jsxs)(J,{variant:`ghost`,size:`sm`,busy:g.isPending,onClick:()=>g.mutate(),children:[(0,$.jsx)(D,{className:`size-4`}),` `,Y(`know.addSub`)]})]}),f.children.length?(0,$.jsx)(W,{className:`flex flex-col p-1.5`,children:f.children.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>n(`p:${e.id}`),className:`flex items-center gap-3 rounded-lg px-3 py-2 text-left transition hover:bg-accent`,children:[(0,$.jsx)(be,{className:`size-4 shrink-0 text-ink-3`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[0.875rem]`,children:e.title})]},e.id))}):null]}):null]})}function $t({pageId:e,onGone:t,onOpen:n}){let r=c({queryKey:[`space-page`,e],queryFn:()=>u.get(`/api/studio/pages/${e}`),refetchOnWindowFocus:!1});return r.data?(0,$.jsx)(Qt,{page:r.data,onGone:t,onOpen:n},r.data.id):r.isError?(0,$.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:r.error.message}):null}function en(e){return e.type.startsWith(`image/`)&&/logo/i.test(e.name)?`logo`:/^(image|video|audio)\//.test(e.type)?`asset`:`document`}function tn(e,t,n){let r=d(),[i,a]=(0,Q.useState)([]),[o,c]=(0,Q.useState)(`idle`),[l,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),_=(0,Q.useRef)(null),v=()=>(_.current??=(async()=>{await Promise.all([r.invalidateQueries({queryKey:[`projects`]}),r.invalidateQueries({queryKey:[`project-files`,e]}),r.invalidateQueries({queryKey:[`knowledge`,e]})]),n(),_.current=null})(),_.current);return{messages:i,phase:o,activity:p,startedAt:h,error:l,send:async(n,l=[])=>{if(!(n.trim()||l.length)||o!==`idle`)return!1;if(f(null),c(`thinking`),g(Date.now()),l.length){try{for(let t of l)await u.upload(`/api/studio/projects/${e}/files?kind=${en(t)}`,t)}catch(e){return f(e.message),c(`idle`),g(null),await v(),!1}await v();let t=`${Y(`editor.attached`)}: ${l.map(e=>e.name).join(`, `)}`;n=n.trim()?`${n}\n\n${t}`:t}let d=i.map(({role:e,content:t})=>({role:e,content:t})).slice(-12),p=`p-${Date.now()}`;a(e=>[...e,{id:`u-${Date.now()}`,role:`user`,content:n,previews:E(l)},{id:p,role:`assistant`,content:``,pending:!0}]),m(null);let h=!1;try{await s(`/api/studio/projects/${e}/assist`,{message:n,history:d,part:t},(e,t)=>{if(e===`text`){let e=JSON.parse(t);a(t=>t.map(t=>t.id===p?{...t,content:t.content+e}:t))}else if(e===`activity`)m(JSON.parse(t));else if(e===`card`){let e=JSON.parse(t);a(t=>t.map(t=>t.id===p?{...t,cards:[...t.cards??[],{...e,id:`${p}-${t.cards?.length??0}`}]}:t))}else if(e===`changed`)c(`building`),v();else if(e===`done`){h=!0;let e=JSON.parse(t);a(t=>t.map(t=>t.id===p?{...t,content:e.reply,changed:e.changed,pending:!1}:t))}else e===`error`&&(h=!0,f(JSON.parse(t).message))}),h||f(Y(`editor.chatBroken`))}catch(e){f(e.message)}finally{m(null),g(null),a(e=>e.filter(e=>!(e.id===p&&!e.content&&!e.cards?.length)).map(e=>({...e,pending:!1}))),c(`idle`),await _.current,await v(),await r.invalidateQueries({queryKey:[`me`]})}return!0}}}function nn({card:e,send:t}){let n=we().cards.find(t=>t.plugin===e.plugin&&t.tool===e.tool);return n?(0,$.jsx)(De,{of:n,children:(0,$.jsx)(n.component,{data:e.data,send:e=>void t(e)})}):null}function rn({part:e}){return(0,$.jsxs)(`div`,{className:`sm:pr-36`,children:[(0,$.jsx)(`h2`,{className:`font-display font-semibold text-[1.25rem] leading-tight tracking-tight`,children:Y(e===`knowledge`?`project.assistantTitleKnowledge`:`project.assistantTitle`)}),(0,$.jsx)(`p`,{className:`mt-1.5 max-w-2xl text-[0.9375rem] text-ink-2 leading-relaxed`,children:Y(e===`knowledge`?`project.assistantHelloKnowledge`:`project.assistantHello`)})]})}var an=72,on=720;function sn({projectId:e,part:t,docked:n=!1,onChanged:r}){let i=tn(e,t,r),a=(0,Q.useRef)(null),[s,c]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{let e=()=>{let e=a.current?.getBoundingClientRect();e&&c(t=>{if(!n&&e.bottom>=an)return null;let r=Math.min(e.width,on),i=e.left+(e.width-r)/2;return t&&t.left===i&&t.width===r?t:{left:i,width:r,height:t?.height??e.height}})};return e(),window.addEventListener(`scroll`,e,{passive:!0}),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e),window.removeEventListener(`resize`,e)}},[n]),(0,$.jsxs)(`div`,{ref:a,style:s&&!n?{minHeight:s.height}:void 0,className:n?`-mb-9 h-0`:void 0,children:[n?null:(0,$.jsxs)(`div`,{className:`mb-2 flex items-center gap-1.5 px-1 font-medium text-[0.75rem] text-ember-strong uppercase tracking-[0.07em]`,children:[(0,$.jsx)(S,{className:`size-3.5`}),` `,Y(`project.assistant`)]}),(0,$.jsxs)(`div`,{className:`relative`,children:[!s&&i.messages.length===0?(0,$.jsx)(`div`,{className:`absolute -top-14 right-10 z-10 max-sm:hidden`,children:(0,$.jsx)(o,{kind:`round`,size:104})}):null,(0,$.jsx)(`div`,{className:V(`flex flex-col overflow-hidden bg-card`,s?`fixed bottom-4 z-30 max-h-[70dvh] animate-dock rounded-2xl shadow-overlay ring-1 ring-border`:`max-h-[520px] rounded-xl bg-linear-to-br from-ember-tint via-card to-card shadow-soft ring-1 ring-ember-veil`),style:s?{left:s.left,width:s.width}:void 0,children:(0,$.jsx)(ne,{chat:i,avatar:`round`,compact:!!s,intro:(0,$.jsx)(rn,{part:t}),placeholder:Y(t===`knowledge`?`project.assistantComposerKnowledge`:`project.assistantComposer`),changedLabel:Y(`project.assistantChanged`),card:e=>(0,$.jsx)(nn,{card:e,send:i.send})})})]})]})}var cn=[`text`,`longtext`,`number`,`date`,`url`,`email`,`phone`,`boolean`],ln=/^(\d{4}-\d{2}-\d{2}|\d{1,2}\.\s?\d{1,2}\.\s?\d{4})$/,un=/^[+-]?\d{1,3}([.,\s']?\d{3})*([.,]\d+)?$/,dn=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,fn=/^(https?:\/\/|www\.)\S+$/i,pn=/^\+?[\d\s()/.-]{7,20}$/,mn=/^(ja|nein|yes|no|true|false)$/i;function hn(e){let t=e.trim();return t?t.includes(`
3
- `)||t.length>140?`longtext`:mn.test(t)?`boolean`:dn.test(t)?`email`:fn.test(t)?`url`:ln.test(t)?`date`:un.test(t)&&!/^(\+|0\d)/.test(t)?`number`:pn.test(t)&&t.replace(/\D/g,``).length>=7?`phone`:`text`:`text`}function gn(e,t=[]){let n=e.toLowerCase().replace(/ä/g,`ae`).replace(/ö/g,`oe`).replace(/ü/g,`ue`).replace(/ß/g,`ss`).normalize(`NFD`).replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).slice(0,40)||`fakt`,r=n;for(let e=2;t.includes(r);e++)r=`${n}_${e}`;return r}var _n=[{key:`adresse`,de:`Adresse`,en:`Address`},{key:`plz`,de:`PLZ`,en:`Postcode`},{key:`ort`,de:`Ort`,en:`City`},{key:`uid`,de:`UID`,en:`VAT id`},{key:`telefon`,de:`Telefon`,en:`Phone`},{key:`e_mail`,de:`E-Mail`,en:`Email`},{key:`website`,de:`Website`,en:`Website`},{key:`iban`,de:`IBAN`,en:`IBAN`}],vn={facts:100,colors:12,files:{logo:8,asset:100,document:2e3},bytes:{logo:5e6,asset:15e6,video:8e7,document:3e7}},yn=/^#[0-9a-fA-F]{6}$/;function bn({onAdd:e,onClose:t}){let[n,r]=(0,Q.useState)(`#e0531b`),[i,a]=(0,Q.useState)(``),o=yn.test(n);return(0,$.jsx)(H,{open:!0,onClose:t,title:Y(`project.colorAddTitle`),children:(0,$.jsxs)(`form`,{onSubmit:r=>{r.preventDefault(),o&&(e({name:i.trim(),value:n.toLowerCase()}),t())},className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(R,{children:Y(`project.colorValue`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(ge,{value:o?n:`#888888`,onChange:e=>r(e.target.value)}),(0,$.jsx)(q,{value:n,placeholder:`#e0531b`,spellCheck:!1,onChange:e=>r(e.target.value.trim()),className:`font-mono text-[0.875rem]`})]})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(R,{children:Y(`project.colorUseLabel`)}),(0,$.jsx)(q,{autoFocus:!0,value:i,maxLength:120,placeholder:Y(`project.colorName`),onChange:e=>a(e.target.value)}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:Y(`project.colorUse`)})]}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(J,{variant:`ghost`,onClick:t,children:Y(`common.cancel`)}),(0,$.jsx)(J,{type:`submit`,disabled:!o,children:Y(`project.add`)})]})]})})}function xn({colors:e,save:t,readOnly:n}){let r=(0,Q.useRef)(0),[i,a]=(0,Q.useState)(()=>e.map(e=>({...e,id:`c${r.current++}`}))),[o,s]=(0,Q.useState)(!1),c=A(i.filter(e=>yn.test(e.value)).map(({name:e,value:t})=>({name:e.trim(),value:t})),t),l=(e,t)=>a(n=>n.map(n=>n.id===e?{...n,...t}:n));return(0,$.jsxs)(k,{title:Y(`project.colors`),hint:Y(`project.colorsHint`),save:c,locked:n,children:[(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:i.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(ge,{value:yn.test(e.value)?e.value:`#888888`,onChange:t=>l(e.id,{value:t.target.value})}),(0,$.jsx)(q,{value:e.name,placeholder:Y(`project.colorName`),maxLength:120,onChange:t=>l(e.id,{name:t.target.value}),className:`min-w-0 flex-1`}),(0,$.jsx)(q,{value:e.value,placeholder:`#e0531b`,spellCheck:!1,onChange:t=>l(e.id,{value:t.target.value.trim()}),className:`w-28 font-mono text-[0.8125rem]`}),(0,$.jsxs)(`div`,{className:`flex w-24 shrink-0 items-center justify-end max-sm:w-auto`,children:[t===0?(0,$.jsx)(`span`,{className:`mr-1 max-sm:hidden`,children:(0,$.jsx)(K,{tone:`ember`,children:Y(`project.colorAccent`)})}):n?null:(0,$.jsx)(G,{label:Y(`project.colorFirst`),onClick:()=>a(t=>[e,...t.filter(t=>t.id!==e.id)]),children:(0,$.jsx)(g,{className:`size-4`})}),n?null:(0,$.jsx)(G,{label:Y(`project.remove`),onClick:()=>a(t=>t.filter(t=>t.id!==e.id)),className:`hover:text-rose`,children:(0,$.jsx)(F,{className:`size-4`})})]})]},e.id))}),i.length&&!n?(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:Y(`project.colorUse`)}):null,i.length<vn.colors&&!n?(0,$.jsxs)(J,{variant:`secondary`,size:`sm`,className:i.length?`mt-3`:void 0,onClick:()=>s(!0),children:[(0,$.jsx)(D,{className:`size-4`}),` `,Y(`project.colorAdd`)]}):null,o?(0,$.jsx)(bn,{onClose:()=>s(!1),onAdd:e=>a(t=>[...t,{...e,id:`c${r.current++}`}])}):null]})}var Sn=e=>/^(ja|yes|true)$/i.test(e.trim()),Cn={text:ye,longtext:ct,number:Je,date:We,url:pe,email:y,phone:nt,boolean:ut};function wn({type:e,detected:t,onChange:n}){let[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(!1),s=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if(!r)return;let e=e=>{s.current?.contains(e.target)||i(!1)},t=e=>e.key===`Escape`&&i(!1);return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[r]);let c=Cn[e??t],l=`${Y(`project.factType`)}: ${Y(`project.type.${e??t}`)}`,u=`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[0.875rem] text-ink-2 hover:bg-accent hover:text-ink`,d=e=>{n(e),i(!1)};return(0,$.jsxs)(`div`,{className:`relative`,ref:s,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":l,title:l,"aria-haspopup":`menu`,"aria-expanded":r,onClick:e=>{o(window.innerHeight-e.currentTarget.getBoundingClientRect().bottom<400),i(e=>!e)},className:V(`inline-flex size-11 items-center justify-center rounded-lg transition hover:bg-accent hover:text-ink`,r?`bg-accent text-ink`:e?`text-ink-2`:`text-ink-4`),children:(0,$.jsx)(c,{className:`size-4`})}),r?(0,$.jsxs)(`div`,{role:`menu`,className:V(`absolute right-0 z-50 w-56 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,a?`bottom-12`:`top-12`),children:[(0,$.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":!e,className:u,onClick:()=>d(void 0),children:[(0,$.jsx)(oe,{className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{className:`flex-1`,children:Y(`project.factAuto`)}),(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-4`,children:Y(`project.type.${t}`)}),(0,$.jsx)(C,{className:V(`size-4 shrink-0`,e&&`invisible`)})]}),(0,$.jsx)(`div`,{className:`mx-2 my-1 h-px bg-border-soft`}),cn.map(t=>{let n=Cn[t];return(0,$.jsxs)(`button`,{type:`button`,role:`menuitemradio`,"aria-checked":e===t,className:u,onClick:()=>d(t),children:[(0,$.jsx)(n,{className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{className:`flex-1`,children:Y(`project.type.${t}`)}),(0,$.jsx)(C,{className:V(`size-4 shrink-0`,e!==t&&`invisible`)})]},t)})]}):null]})}function Tn({facts:e,save:t,readOnly:n}){let r=(0,Q.useRef)(0),i=(0,Q.useRef)(null),[a,o]=(0,Q.useState)(()=>e.map(e=>({...e,id:`f${r.current++}`}))),s=A(a.filter(e=>e.key&&e.label.trim()).map(({key:e,label:t,value:n,type:r})=>({key:e,label:t.trim(),value:n,...r?{type:r}:{}})),t),c=(e,t)=>o(n=>n.map(n=>n.id===e?{...n,...t}:n)),l=(e,t,n=!1)=>{let a=`f${r.current++}`;i.current=`${a}:${t}`;let s={id:a,key:``,label:``,value:``,...e};o(e=>n?[s,...e]:[...e,s])},u=e=>t=>{t&&i.current===e&&(i.current=null,t.focus())},d=_n.filter(e=>!a.some(t=>t.key===e.key));return(0,$.jsxs)(k,{title:Y(`project.facts`),hint:Y(`project.factsHint`),save:s,locked:n,action:a.length<vn.facts&&!n?(0,$.jsxs)(J,{variant:`secondary`,size:`sm`,onClick:()=>l({},`label`,!0),children:[(0,$.jsx)(D,{className:`size-4`}),` `,Y(`project.factAdd`)]}):null,children:[(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>{let t=hn(e.value),r=e.type??t;return(0,$.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto_auto] items-start gap-x-1 gap-y-2 sm:grid-cols-[minmax(0,2fr)_minmax(0,3fr)_auto_auto]`,children:[(0,$.jsx)(q,{ref:u(`${e.id}:label`),value:e.label,placeholder:Y(`project.factLabel`),title:e.key?`{{facts.${e.key}}}`:void 0,onChange:t=>c(e.id,{label:t.target.value}),onBlur:()=>{!e.key&&e.label.trim()&&c(e.id,{key:gn(e.label,a.map(e=>e.key))})},className:`max-sm:col-span-3 max-sm:font-medium sm:mr-1`}),e.type===`boolean`?(0,$.jsxs)(`div`,{className:`flex h-11 items-center gap-3`,children:[(0,$.jsx)(U,{checked:Sn(e.value),label:e.label,onChange:t=>c(e.id,{value:Y(t?`project.yes`:`project.no`)})}),(0,$.jsx)(`span`,{className:`text-[0.875rem] text-ink-2`,children:Sn(e.value)?Y(`project.yes`):Y(`project.no`)})]}):(0,$.jsx)(he,{ref:u(`${e.id}:value`),rows:1,minRows:r===`longtext`?2:1,maxRows:10,value:e.value,placeholder:Y(`project.factValue`),onChange:t=>c(e.id,{value:t.target.value}),className:`min-h-11`}),(0,$.jsx)(wn,{type:e.type,detected:t,onChange:t=>c(e.id,{type:t})}),n?null:(0,$.jsx)(G,{label:Y(`project.remove`),onClick:()=>o(t=>t.filter(t=>t.id!==e.id)),className:`size-11 rounded-lg hover:text-rose`,children:(0,$.jsx)(F,{className:`size-4`})})]},e.id)})}),a.length<vn.facts&&!n?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 ${a.length?`mt-4`:``}`,children:[(0,$.jsxs)(J,{variant:`secondary`,size:`sm`,onClick:()=>l({},`label`),children:[(0,$.jsx)(D,{className:`size-4`}),` `,Y(`project.factAdd`)]}),d.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>l({key:e.key,label:X===`en`?e.en:e.de},`value`),className:`inline-flex h-8 items-center gap-1 rounded-full bg-paper-2 px-3 text-[0.8125rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:[(0,$.jsx)(D,{className:`size-3.5`}),` `,X===`en`?e.en:e.de]},e.key))]}):null]})}function En({project:e,save:t}){let[n,r]=(0,Q.useState)(e.brand.name??``),[i,a]=(0,Q.useState)(e.brand.about??``),o=A({name:n.trim(),about:i.trim()},e=>t({brand:e}));return(0,$.jsx)(k,{title:Y(`project.base`),hint:Y(`project.baseHint`),save:o,locked:e.readOnly,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(R,{children:Y(`project.title`)}),(0,$.jsx)(q,{value:n,maxLength:120,onChange:e=>r(e.target.value)}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:Y(`project.titleHint`)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(R,{children:Y(`project.about`)}),(0,$.jsx)(he,{minRows:4,value:i,onChange:e=>a(e.target.value)}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:Y(`project.aboutHint`)})]})]})})}function Dn({project:e,group:t,docked:n=!1,children:r}){let i=d(),a=j(e.id),[o,s]=(0,Q.useState)(0),c=async t=>{await u.patch(`/api/studio/projects/${e.id}`,t),await i.invalidateQueries({queryKey:[`projects`]})},l=Z({mutationFn:()=>u.del(`/api/studio/projects/${e.id}`),onSuccess:()=>i.invalidateQueries({queryKey:[`projects`]})}),f=ve(),p=xe(),m=a.data??{files:[],embeddings:!0},h=`${e.id}:${o}`,g=e.readOnly;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-9 pb-20`,children:[g?(0,$.jsx)(Re,{children:Fe(e)}):(0,$.jsx)(sn,{projectId:e.id,part:t,docked:n,onChanged:()=>s(e=>e+1)},e.id),t===`info`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ue,{id:`base`,children:(0,$.jsx)(En,{project:e,save:c},`base:${h}`)}),(0,$.jsx)(ue,{id:`logos`,children:(0,$.jsx)(kt,{projectId:e.id,data:m,readOnly:g})}),(0,$.jsx)(ue,{id:`colors`,children:(0,$.jsx)(xn,{colors:e.brand.colors??[],save:e=>c({brand:{colors:e}}),readOnly:g},`colors:${h}`)}),(0,$.jsx)(ue,{id:`assets`,children:(0,$.jsx)(Nt,{projectId:e.id,data:m,readOnly:g})}),(0,$.jsx)(ue,{id:`facts`,children:(0,$.jsx)(Tn,{facts:e.facts,save:e=>c({facts:e}),readOnly:g},`facts:${h}`)})]}):null,r,t===`info`&&f&&!g&&p?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(J,{variant:`danger`,busy:l.isPending,onClick:()=>confirm(`${Y(`settings.delete`)}?`)&&l.mutate(),children:Y(`settings.delete`)}),l.error?(0,$.jsx)(`p`,{className:`mt-2 text-[0.875rem] text-rose`,children:l.error.message}):null]}):null]})}var On={q:``,mode:``,days:0};function kn(e,t,n){let r=new URLSearchParams;t&&r.set(`wizard`,t),n.q.trim()&&r.set(`q`,n.q.trim()),n.mode&&r.set(`mode`,n.mode),n.days&&r.set(`days`,String(n.days));let i=r.toString();return c({queryKey:[`results`,e,i],queryFn:()=>u.get(`/api/studio/projects/${e}/results${i&&`?${i}`}`),enabled:!!e,placeholderData:e=>e,refetchInterval:15e3})}function An({filter:e,onFilter:t}){let[n,r]=(0,Q.useState)(e.q);return(0,Q.useEffect)(()=>{if(n===e.q)return;let r=setTimeout(()=>t({...e,q:n}),250);return()=>clearTimeout(r)},[n,e,t]),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-0 flex-1 basis-56`,children:[(0,$.jsx)(re,{className:`-translate-y-1/2 pointer-events-none absolute top-1/2 left-3 size-4 text-ink-3`}),(0,$.jsx)(q,{type:`search`,value:n,onChange:e=>r(e.target.value),placeholder:Y(`space.resultsSearch`),"aria-label":Y(`space.resultsSearch`),className:`w-full pl-9`})]}),(0,$.jsx)(z,{value:e.mode,onChange:n=>t({...e,mode:n}),options:[{value:``,label:Y(`space.resultsModeAll`)},{value:`live`,label:`Live`},{value:`test`,label:`Test`}],className:`w-32`}),(0,$.jsx)(z,{value:String(e.days),onChange:n=>t({...e,days:Number(n)}),options:[{value:`0`,label:Y(`space.resultsAnyTime`)},{value:`1`,label:Y(`space.resultsDay`)},{value:`7`,label:Y(`space.resultsDays`,{n:7})},{value:`30`,label:Y(`space.resultsDays`,{n:30})}],className:`w-44`})]})}function jn({data:e,wizardId:t,filter:n,onFilter:r}){let[i,a]=(0,Q.useState)(null),o=t=>e.wizards.find(e=>e.id===t)?.title??``,s=new Intl.DateTimeFormat(X,{dateStyle:`medium`,timeStyle:`short`});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(k,{title:t?o(t):Y(`space.resultsAll`),hint:Y(`space.resultsHint`),plain:!0,children:[(0,$.jsx)(An,{filter:n,onFilter:r}),e.runs.length?(0,$.jsx)(W,{className:`flex flex-col p-1.5`,children:e.runs.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>a(e),className:`flex items-center gap-3 rounded-lg px-3 py-2.5 text-left transition hover:bg-accent`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`truncate text-[0.875rem]`,children:t?s.format(new Date(e.doneAt)):o(e.wizardId)}),(0,$.jsxs)(`div`,{className:`truncate text-[0.75rem] text-ink-3`,children:[t?null:`${s.format(new Date(e.doneAt))} · `,Y(`space.resultCredits`,{n:e.credits})]})]}),e.assets?(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[0.75rem] text-ink-3 tabular-nums`,title:Y(`space.resultFiles`,{n:e.assets}),children:[(0,$.jsx)(b,{className:`size-3.5`}),e.assets]}):null,e.mode===`test`?(0,$.jsx)(K,{children:`Test`}):(0,$.jsxs)(K,{tone:`live`,children:[`Live v`,e.version]})]},e.id))}):(0,$.jsx)(W,{children:(0,$.jsx)(me,{children:n.q.trim()||n.mode||n.days?Y(`space.resultsNone`):Y(`space.resultsEmpty`)})})]}),i?(0,$.jsx)(`div`,{className:`fixed inset-0 z-50 flex justify-end bg-[oklch(20%_0.01_60/0.22)] backdrop-blur-[1px]`,onClick:()=>a(null),children:(0,$.jsxs)(`div`,{className:`flex h-full w-full max-w-[680px] animate-rise flex-col bg-background shadow-overlay`,onClick:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{className:`flex h-14 shrink-0 items-center gap-3 px-4`,children:[(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-[0.875rem]`,children:o(i.wizardId)}),i.mode===`test`?(0,$.jsx)(K,{children:`Test`}):(0,$.jsxs)(K,{tone:`live`,children:[`Live v`,i.version]}),(0,$.jsx)(G,{label:Y(`editor.close`),onClick:()=>a(null),children:(0,$.jsx)(Ee,{className:`size-5`})})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,$.jsx)(x,{runId:i.id,compact:!0},i.id)})]})}):null]})}function Mn(e){return c({queryKey:[`space-data`,e],queryFn:()=>u.get(`/api/studio/projects/${e}/data`),enabled:!!e})}function Nn(e){let t=t=>[...e.tables.filter(e=>e.wizardId===t).map(e=>({key:`t:${e.id}`,kind:`table`,title:e.title,rows:e.rows})),...e.pages.filter(e=>e.wizardId===t).map(e=>({key:`p:${e.id}`,kind:`page`,title:e.title}))];return[{key:`own`,label:Y(`data.own`),items:t(null)},...e.wizards.map(e=>({key:e.id,label:e.title,items:t(e.id)}))].filter(e=>e.items.length)}var Pn={table:L,page:be};function Fn({kind:e,projectId:t,data:n,onClose:r,onMade:i}){let a=d(),[o,s]=(0,Q.useState)(``),[c,l]=(0,Q.useState)(``),f=Z({mutationFn:()=>u.post(`/api/studio/projects/${t}/${e===`table`?`tables`:`pages`}`,{title:o.trim(),wizardId:c||null}),onSuccess:async({id:n})=>{await a.invalidateQueries({queryKey:[`space-data`,t]}),i(`${e===`table`?`t`:`p`}:${n}`),s(``),l(``)}});return(0,$.jsx)(H,{open:e!==null,onClose:r,title:Y(e===`table`?`data.newTable`:`data.newPage`),children:(0,$.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),o.trim()&&f.mutate()},children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(R,{children:Y(`data.title`)}),(0,$.jsx)(q,{"data-autofocus":!0,value:o,maxLength:120,onChange:e=>s(e.target.value)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(R,{children:Y(`data.owner`)}),(0,$.jsx)(z,{value:c,onChange:l,options:[{value:``,label:Y(`data.own`)},...n.wizards.map(e=>({value:e.id,label:e.title}))]})]}),f.error?(0,$.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:f.error.message}):null,(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(J,{variant:`ghost`,onClick:r,children:Y(`common.cancel`)}),(0,$.jsx)(J,{type:`submit`,busy:f.isPending,disabled:!o.trim(),children:Y(`data.create`)})]})]})})}function In({projectId:e,data:t,readOnly:n,onOpen:r}){let[i,a]=(0,Q.useState)(null),o=Nn(t),s=new Map([...t.tables.map(e=>[`t:${e.id}`,e.updatedAt]),...t.pages.map(e=>[`p:${e.id}`,e.updatedAt])]),c=new Intl.DateTimeFormat(X,{dateStyle:`medium`});return(0,$.jsxs)(k,{title:Y(`space.data`),hint:Y(`data.hint`),plain:!0,action:n?null:(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsxs)(J,{variant:`secondary`,size:`sm`,onClick:()=>a(`table`),children:[(0,$.jsx)(D,{className:`size-4`}),` `,Y(`data.table`)]}),(0,$.jsxs)(J,{variant:`secondary`,size:`sm`,onClick:()=>a(`page`),children:[(0,$.jsx)(D,{className:`size-4`}),` `,Y(`data.page`)]})]}),children:[o.length?(0,$.jsx)(`div`,{className:`flex flex-col gap-5`,children:o.map(e=>(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,$.jsx)(`p`,{className:`px-1 font-medium text-[0.6875rem] text-ink-4 uppercase tracking-[0.12em]`,children:e.label}),(0,$.jsx)(W,{className:`flex flex-col p-1.5`,children:e.items.map(e=>{let t=Pn[e.kind];return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>r(e.key),className:`flex items-center gap-3 rounded-lg px-3 py-2.5 text-left transition hover:bg-accent`,children:[(0,$.jsx)(t,{className:`size-4 shrink-0 text-ink-3`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[0.875rem]`,children:e.title}),(0,$.jsxs)(`span`,{className:`shrink-0 text-[0.75rem] text-ink-3 tabular-nums`,children:[e.kind===`table`?`${Y(`data.rows`,{n:e.rows??0})} · `:``,c.format(new Date(s.get(e.key)??Date.now()))]})]},e.key)})})]},e.key))}):(0,$.jsx)(W,{children:(0,$.jsx)(me,{children:Y(`data.empty`)})}),(0,$.jsx)(Fn,{kind:i,projectId:e,data:t,onClose:()=>a(null),onMade:e=>{a(null),r(e)}})]})}function Ln({project:e,save:t}){let[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(e.name),o=Z({mutationFn:()=>t({name:i.trim()}),onSuccess:()=>r(!1)});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(G,{label:Y(`project.rename`),onClick:()=>{a(e.name),r(!0)},children:(0,$.jsx)(h,{className:`size-4`})}),(0,$.jsx)(H,{open:n,onClose:()=>r(!1),title:Y(`project.rename`),children:(0,$.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),i.trim()&&o.mutate()},children:[(0,$.jsx)(q,{"data-autofocus":!0,value:i,maxLength:80,onChange:e=>a(e.target.value)}),o.error?(0,$.jsx)(`p`,{className:`mt-3 text-[0.875rem] text-rose`,children:o.error.message}):null,(0,$.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,$.jsx)(J,{variant:`ghost`,onClick:()=>r(!1),children:Y(`common.cancel`)}),(0,$.jsx)(J,{type:`submit`,busy:o.isPending,disabled:!i.trim(),children:Y(`settings.save`)})]})]})})]})}function Rn({project:e}){let t=d();return(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(te,{}),e.readOnly?null:(0,$.jsx)(Ln,{project:e,save:async n=>{await u.patch(`/api/studio/projects/${e.id}`,n),await t.invalidateQueries({queryKey:[`projects`]})}})]})}function zn(e,t){let n=e.normalize(`NFKD`).replace(/[̀-ͯ]/g,``).toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``).replace(/^[^a-z]+/,``).slice(0,48)||`column`,r=n,i=2;for(;t.includes(r);)r=`${n}_${i++}`;return r}var Bn={milliseconds:1,seconds:1e3,minutes:6e4,hours:36e5,days:864e5},Vn=[`text`,`number`,`date`,`duration`,`select`,`boolean`];function Hn(e,t){if(t==null)return``;if(e.type===`duration`&&typeof t==`number`)return String(t/Bn[e.format.inputUnit]);if(e.type===`date`&&e.format.kind===`datetime`&&typeof t==`string`){let e=new Date(t);return new Date(e.getTime()-e.getTimezoneOffset()*6e4).toISOString().slice(0,16)}return String(t)}function Un(e,t){return t.trim()===``?null:e.type===`date`&&e.format.kind===`datetime`?new Date(t).toISOString():t}var Wn=`w-full min-w-0 rounded-md bg-transparent px-2 py-1.5 text-[0.875rem] outline-none transition placeholder:text-ink-4 hover:bg-accent focus:bg-paper focus:ring-1 focus:ring-ring disabled:hover:bg-transparent`;function Gn({column:e,value:t,readOnly:n,invalid:r,onSave:i}){let a=Hn(e,t),[o,s]=(0,Q.useState)(a);(0,Q.useEffect)(()=>s(a),[a]);let c=(t=o)=>{t!==a&&i(Un(e,t))};if(e.type===`boolean`)return(0,$.jsx)(`div`,{className:`px-2 py-1.5`,children:(0,$.jsx)(`input`,{type:`checkbox`,checked:t===!0,disabled:n,onChange:e=>i(e.target.checked),"aria-label":e.name,className:`size-4 accent-[var(--ember)]`})});if(e.type===`select`&&e.format.multiple){let r=Array.isArray(t)?t:[],a=t=>e.format.options.find(e=>e.id===t)?.label??t;return(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 px-2 py-1`,children:[r.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-paper-2 py-0.5 pr-1 pl-2 text-[0.75rem]`,children:[a(e),n?null:(0,$.jsx)(`button`,{type:`button`,"aria-label":Y(`data.removeOption`),onClick:()=>i(r.filter(t=>t!==e)),className:`rounded-full text-ink-3 hover:text-ink`,children:(0,$.jsx)(Ee,{className:`size-3`})})]},e)),n?null:(0,$.jsxs)(`select`,{value:``,onChange:e=>e.target.value&&i([...r,e.target.value]),"aria-label":e.name,className:`h-7 rounded-md bg-transparent px-1 text-[0.75rem] text-ink-3 outline-none hover:bg-accent`,children:[(0,$.jsx)(`option`,{value:``,children:`+`}),e.format.options.filter(e=>!r.includes(e.id)).map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.label},e.id))]})]})}if(e.type===`select`)return(0,$.jsxs)(`select`,{value:typeof t==`string`?t:``,disabled:n,onChange:e=>i(e.target.value||null),"aria-label":e.name,className:Wn,children:[(0,$.jsx)(`option`,{value:``}),e.format.options.map(e=>(0,$.jsx)(`option`,{value:e.id,children:e.label},e.id))]});if(e.type===`text`&&e.format?.style&&e.format.style!==`single`)return(0,$.jsx)(`textarea`,{value:o,rows:1,disabled:n,onChange:e=>s(e.target.value),onBlur:()=>c(),"aria-label":e.name,className:V(Wn,`field-sizing-content max-h-40 resize-none`)});let l=e.type===`date`?{date:`date`,datetime:`datetime-local`,time:`time`}[e.format.kind]:`text`;return(0,$.jsx)(`input`,{type:l,inputMode:e.type===`number`||e.type===`duration`?`decimal`:void 0,value:o,disabled:n,onChange:t=>{s(t.target.value),e.type===`date`&&c(t.target.value)},onBlur:()=>e.type!==`date`&&c(),onKeyDown:e=>{e.key===`Enter`&&e.target.blur(),e.key===`Escape`&&s(a)},"aria-label":e.name,className:V(Wn,(e.type===`number`||e.type===`duration`)&&`text-right tabular-nums`,r&&`ring-1 ring-rose`)})}function Kn(e){return e.type===`number`&&e.format.style===`currency`?e.format.currency??null:e.type===`number`&&e.format.style===`percent`?`%`:e.type===`duration`?Y(`data.unit.${e.format.inputUnit}`):null}function qn(e){return{name:e?.name??``,type:e?.type??`text`,required:e?.required??!1,textStyle:e?.type===`text`&&(e.format?.style??`single`)!==`single`?`multiline`:`single`,numberStyle:e?.type===`number`?e.format.style:`decimal`,currency:e?.type===`number`?e.format.currency??`EUR`:`EUR`,dateKind:e?.type===`date`?e.format.kind:`date`,unit:e?.type===`duration`&&[`minutes`,`hours`,`days`].includes(e.format.inputUnit)?e.format.inputUnit:`minutes`,options:e?.type===`select`?e.format.options.map(e=>e.label).join(`
4
- `):``,multiple:e?.type===`select`&&!!e.format.multiple}}function Jn(e,t,n){let r={id:t,name:e.name.trim(),...e.required?{required:!0}:{}};switch(e.type){case`number`:return{...r,type:`number`,format:e.numberStyle===`currency`?{style:`currency`,currency:e.currency.trim().toUpperCase()}:{style:e.numberStyle}};case`date`:return{...r,type:`date`,format:{kind:e.dateKind}};case`duration`:return{...r,type:`duration`,format:{inputUnit:e.unit,display:`hms`}};case`select`:{let t=n?.type===`select`?n.format.options:[],i=[],a=e.options.split(`
5
- `).map(e=>e.trim()).filter(Boolean).map(e=>{let n=t.find(t=>t.label===e)?.id??zn(e,i);return i.push(n),{id:n,label:e}});return{...r,type:`select`,format:{allowCustom:!1,options:a,...e.multiple?{multiple:!0}:{}}}}case`boolean`:return{...r,type:`boolean`};default:return{...r,type:`text`,...e.textStyle===`multiline`?{format:{style:`multiline`}}:{}}}}function Yn({open:e,column:t,columns:n,onClose:r,onSave:i}){let[a,o]=(0,Q.useState)(()=>qn(t)),[s,c]=(0,Q.useState)(null),[l,u]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{e&&(o(qn(t)),c(null))},[e,t]);let d=e=>o(t=>({...t,...e})),f=async e=>{u(!0),c(null);try{await i(e),r()}catch(e){c(e.message)}finally{u(!1)}},p=()=>{let e=t?.id??zn(a.name,n.map(e=>e.id)),r=Jn(a,e,t);return f(t?n.map(e=>e.id===t.id?r:e):[...n,r])};return(0,$.jsx)(H,{open:e,onClose:r,title:t?t.name:Y(`data.newColumn`),children:(0,$.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),a.name.trim()&&p()},children:[(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(R,{children:Y(`data.columnName`)}),(0,$.jsx)(q,{"data-autofocus":!0,value:a.name,maxLength:128,onChange:e=>d({name:e.target.value})})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(R,{children:Y(`data.columnType`)}),(0,$.jsx)(z,{value:a.type,onChange:e=>d({type:e}),options:Vn.map(e=>({value:e,label:Y(`data.type.${e}`)}))})]})]}),a.type===`text`?(0,$.jsx)(z,{value:a.textStyle,onChange:e=>d({textStyle:e}),options:[{value:`single`,label:Y(`data.text.single`)},{value:`multiline`,label:Y(`data.text.multiline`)}]}):null,a.type===`number`?(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,$.jsx)(z,{value:a.numberStyle,onChange:e=>d({numberStyle:e}),options:[`integer`,`decimal`,`percent`,`currency`].map(e=>({value:e,label:Y(`data.number.${e}`)}))}),a.numberStyle===`currency`?(0,$.jsx)(q,{value:a.currency,maxLength:3,"aria-label":Y(`data.currency`),placeholder:`EUR`,onChange:e=>d({currency:e.target.value})}):null]}):null,a.type===`date`?(0,$.jsx)(z,{value:a.dateKind,onChange:e=>d({dateKind:e}),options:[`date`,`datetime`,`time`].map(e=>({value:e,label:Y(`data.date.${e}`)}))}):null,a.type===`duration`?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(R,{children:Y(`data.unit`)}),(0,$.jsx)(z,{value:a.unit,onChange:e=>d({unit:e}),options:[`minutes`,`hours`,`days`].map(e=>({value:e,label:Y(`data.unit.${e}`)}))})]}):null,a.type===`select`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(R,{children:Y(`data.options`)}),(0,$.jsx)(he,{minRows:3,value:a.options,onChange:e=>d({options:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`flex items-center gap-3 text-[0.875rem]`,children:[(0,$.jsx)(U,{checked:a.multiple,onChange:e=>d({multiple:e})}),Y(`data.multiple`)]})]}):null,(0,$.jsxs)(`label`,{className:`flex items-center gap-3 text-[0.875rem]`,children:[(0,$.jsx)(U,{checked:a.required,onChange:e=>d({required:e})}),Y(`data.required`)]}),s?(0,$.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:s}):null,(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t&&n.length>1?(0,$.jsx)(J,{variant:`ghost`,className:`text-rose`,disabled:l,onClick:()=>confirm(Y(`data.confirmDelete`,{title:t.name}))&&void f(n.filter(e=>e.id!==t.id)),children:Y(`data.deleteColumn`)}):null,(0,$.jsx)(`span`,{className:`flex-1`}),(0,$.jsx)(J,{variant:`ghost`,onClick:r,children:Y(`common.cancel`)}),(0,$.jsx)(J,{type:`submit`,busy:l,disabled:!a.name.trim(),children:Y(`settings.save`)})]})]})})}function Xn({tableId:e,onGone:t}){let n=d(),r=[`space-table`,e],i=c({queryKey:r,queryFn:()=>u.get(`/api/studio/tables/${e}`)}),[a,o]=(0,Q.useState)(null),[s,l]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(``);(0,Q.useEffect)(()=>g(i.data?.title??``),[i.data?.title]);let _=async()=>{await n.invalidateQueries({queryKey:[`space-data`,i.data?.projectId]}),await n.invalidateQueries({queryKey:[`knowledge`,i.data?.projectId]})},v=e=>n.setQueryData(r,t=>t&&{...t,rows:e(t.rows)}),y=e=>{l(e.message),i.refetch()},b=async t=>{await u.patch(`/api/studio/tables/${e}`,t),await i.refetch(),await _()},x=Z({mutationFn:({row:t,column:n,value:r})=>u.patch(`/api/studio/tables/${e}/rows/${t}`,{cells:{[n]:r}}),onSuccess:(e,{row:t,column:n})=>{l(null),m(e=>e===`${t}:${n}`?null:e),v(t=>t.map(t=>t.id===e.id?{...t,cells:e.cells}:t))},onError:(e,{row:t,column:n})=>{if(e instanceof f&&e.body?.column===n){let e=i.data?.columns.find(e=>e.id===n)?.name??n;m(`${t}:${n}`),l(Y(`data.badCell`,{column:e}));return}y(e)}}),S=Z({mutationFn:()=>u.post(`/api/studio/tables/${e}/rows`,{}),onSuccess:async e=>{v(t=>[...t,{...e,updatedAt:new Date().toISOString()}]),await _()},onError:y}),ee=Z({mutationFn:t=>u.post(`/api/studio/tables/${e}/rows/delete`,{ids:[t]}),onSuccess:async(e,t)=>{v(e=>e.filter(e=>e.id!==t)),await _()},onError:y}),te=Z({mutationFn:()=>u.del(`/api/studio/tables/${e}`),onSuccess:async()=>{await _(),t()}});if(!i.data)return i.isError?(0,$.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:i.error.message}):null;let{columns:C,rows:w,readOnly:T}=i.data,E=!!i.data.list;return(0,$.jsxs)(`section`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 px-1`,children:[(0,$.jsx)(`input`,{value:h,disabled:T,maxLength:120,onChange:e=>g(e.target.value),onBlur:()=>h.trim()&&h!==i.data?.title&&void b({title:h}).catch(y),onKeyDown:e=>e.key===`Enter`&&e.target.blur(),"aria-label":Y(`data.title`),className:`-ml-1 min-w-0 flex-1 rounded-md bg-transparent px-1 font-display font-semibold text-lg outline-none hover:bg-accent focus:bg-paper focus:ring-1 focus:ring-ring disabled:hover:bg-transparent`}),T?null:(0,$.jsx)(G,{label:Y(`data.deleteTable`),onClick:()=>confirm(Y(`data.confirmDelete`,{title:i.data.title}))&&te.mutate(),className:`hover:text-rose`,children:(0,$.jsx)(F,{className:`size-4`})})]}),E?(0,$.jsx)(`p`,{className:`-mt-1.5 px-1 text-[0.8125rem] text-ink-3`,children:Y(`data.fromList`)}):null,i.data.knowledge?(0,$.jsx)(Lt,{projectId:i.data.projectId,itemKey:`t:${i.data.id}`,has:i.data.knowledge.categories,originLabel:i.data.knowledge.originLabel,kept:i.data.knowledge.kept,review:i.data.knowledge.review,file:i.data.knowledge.file,readOnly:T,onReviewed:()=>void u.patch(`/api/studio/tables/${e}`,{review:null}).then(()=>i.refetch()).catch(y)}):null,(0,$.jsxs)(W,{className:`overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`overflow-x-auto`,children:(0,$.jsxs)(`table`,{className:`w-full border-collapse text-left`,children:[(0,$.jsx)(`thead`,{children:(0,$.jsxs)(`tr`,{className:`border-border-soft border-b`,children:[C.map(e=>(0,$.jsx)(`th`,{className:`min-w-36 border-border-soft border-l p-1 font-medium first:border-l-0`,children:(0,$.jsxs)(`button`,{type:`button`,disabled:T||E,onClick:()=>o(e),className:`flex w-full items-center gap-1 rounded-md px-2 py-1.5 text-left text-[0.8125rem] text-ink-2 transition hover:bg-accent hover:text-ink disabled:hover:bg-transparent`,children:[(0,$.jsx)(`span`,{className:`truncate`,children:e.name}),e.required?(0,$.jsx)(`span`,{className:`text-ember`,children:`*`}):null,Kn(e)?(0,$.jsx)(`span`,{className:`font-normal text-ink-4`,children:Kn(e)}):null]})},e.id)),(0,$.jsx)(`th`,{className:`w-10 p-1`,children:T||E?null:(0,$.jsx)(G,{label:Y(`data.newColumn`),onClick:()=>o(`new`),className:`size-8`,children:(0,$.jsx)(D,{className:`size-4`})})})]})}),(0,$.jsx)(`tbody`,{children:w.map(e=>(0,$.jsxs)(`tr`,{className:`group border-border-soft border-b last:border-b-0`,children:[C.map(t=>(0,$.jsx)(`td`,{className:`border-border-soft border-l p-1 align-top first:border-l-0`,children:(0,$.jsx)(Gn,{column:t,value:e.cells[t.id],readOnly:T,invalid:p===`${e.id}:${t.id}`,onSave:n=>x.mutate({row:e.id,column:t.id,value:n})})},t.id)),(0,$.jsx)(`td`,{className:`w-10 p-1 align-top`,children:T?null:(0,$.jsx)(G,{label:Y(`data.deleteRow`),onClick:()=>ee.mutate(e.id),className:`size-8 opacity-0 hover:text-rose focus:opacity-100 group-hover:opacity-100 coarse:opacity-100`,children:(0,$.jsx)(F,{className:`size-3.5`})})})]},e.id))})]})}),w.length?null:(0,$.jsx)(`p`,{className:`px-4 py-6 text-center text-[0.875rem] text-ink-3`,children:Y(`data.noRows`)}),T?null:(0,$.jsx)(`div`,{className:`border-border-soft border-t p-1.5`,children:(0,$.jsxs)(J,{variant:`ghost`,size:`sm`,busy:S.isPending,onClick:()=>S.mutate(),children:[(0,$.jsx)(D,{className:`size-4`}),` `,Y(`data.addRow`)]})})]}),s?(0,$.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:s}):null,(0,$.jsx)(Yn,{open:a!==null,column:a===`new`?null:a,columns:C,onClose:()=>o(null),onSave:e=>b({columns:e})})]})}function Zn(e){let t=e.join(` `),[n,r]=(0,Q.useState)(e[0]);return(0,Q.useEffect)(()=>{let e=t.split(` `),n=0,i=()=>{n=0;let t=window.scrollY>0&&window.innerHeight+window.scrollY>=document.documentElement.scrollHeight-4,i=Math.max(160,window.innerHeight/3),a=e[0];for(let t of e){let e=document.getElementById(t)?.getBoundingClientRect().top;e!==void 0&&e<=i&&(a=t)}r(t?e.at(-1):a)},a=()=>{n||=requestAnimationFrame(i)};return i(),window.addEventListener(`scroll`,a,{passive:!0}),window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(n),window.removeEventListener(`scroll`,a),window.removeEventListener(`resize`,a)}},[t]),n}function Qn(e,t){let n=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;document.getElementById(e)?.scrollIntoView({block:`start`,behavior:t&&!n?`smooth`:`auto`})}function $n({groups:e,current:t,onPick:n}){return e.map(e=>{let r=e.sections.map(e=>(0,$.jsx)(je,{icon:e.icon??it,label:e.label,selected:e.id===t,onPick:()=>n(e.id)},e.id));return e.label?(0,$.jsx)(Pe,{label:e.label,children:r},e.plugin):(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:r},`own`)})}function er(){let{group:e}=l(),[t,n]=r(),o=a(),s=i(),{hash:c}=s,{project:u,loading:d}=ke(),f=ve(),m=we(),h=He(),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(null),S=Oe(e)?e:void 0,ee=s.state?.parts===!0,te=Ce().map(e=>({...e,to:`/space/${e.id}`})),C=te.find(e=>e.id===S),w=t.get(`show`),T=S?w?2:1:0,E=h?Math.min(T,1):S&&b!==S&&!ee?1:0,ne=Ne(E),re=Ne(T),ie=(0,Q.useMemo)(()=>({slot:g,narrow:h,setDetail:y}),[g,h]),D=u?u.brand.name?.trim()||u.name:Y(`nav.project`),ae=S&&S!==`results`?Ae(S,m):[],O=S?Ae(S,m).filter(e=>e.plugin):[],se=Zn([...ae,...S===`results`?O:[]].flatMap(e=>e.sections.map(e=>e.id))),A=S===`results`&&w&&w!==`all`?w:null,[ce,de]=(0,Q.useState)(On),j=kn(S===`results`?u?.id:void 0,A,ce),fe=j.data?.wizards.find(e=>e.id===A)?.title,M=S===`data`&&w&&w!==`all`||S===`knowledge`&&w&&/^[ptfcvs]:/.test(w)?w:null,N=M?.startsWith(`s:`)?m.spaceSections.find(e=>e.id===M.slice(2)):void 0,P=S===`knowledge`&&M&&/^[ptf]:/.test(M)?M:null,pe=Mn(S===`data`?u?.id:void 0),F=Pt(S===`knowledge`?u?.id:void 0),I=St(M?.startsWith(`v:`)?M.slice(2):``),L=F.data?.categories.find(e=>e.id===(M?.startsWith(`c:`)?M.slice(2):I.data?.category.id)),R=S===`knowledge`?N?N.label():M?.startsWith(`v:`)?I.data&&`${I.data.category.name}: ${I.data.value}`:M?.startsWith(`c:`)?L?.name:F.data?.items.find(e=>e.key===M)?.title:pe.data?Nn(pe.data).flatMap(e=>e.items).find(e=>e.key===M)?.title:void 0;Te([{label:D,to:`/space`},...C?[{label:C.label,to:`/space/${C.id}`}]:[],...C&&(v??fe??R)?[{label:v??fe??R}]:[]]);let z=S===`results`||S===`data`||M?c.slice(1):w||c.slice(1),B=(0,Q.useRef)(``);if((0,Q.useEffect)(()=>{let e=`${S}#${z}`;z&&B.current!==e&&document.getElementById(z)&&(B.current=e,requestAnimationFrame(()=>Qn(z,!1)))},[S,z,u?.id,m.spaceSections]),!S){let t=c.slice(1),n=t?Se(t,m):null;if(n===`knowledge`&&m.spaceSections.some(e=>e.id===t))return(0,$.jsx)(p,{to:`/space/knowledge?show=s:${t}`,replace:!0});if(n)return(0,$.jsx)(p,{to:h?`/space/${n}?show=${t}`:{pathname:`/space/${n}`,hash:t},replace:!0});if(t&&m.status!==`ready`)return null;if(e!==void 0||!h)return(0,$.jsx)(p,{to:`/space/info`,replace:!0,state:{parts:!0}})}if(S===`knowledge`&&!w&&m.spaceSections.some(e=>e.id===c.slice(1)))return(0,$.jsx)(p,{to:`/space/knowledge?show=s:${c.slice(1)}`,replace:!0});let he=e=>{if(h){o({search:`?show=${e}`});return}B.current=`${S}#${e}`,Qn(e,!0),o({search:``,hash:e},{replace:!0})},H=e=>h?n({show:e}):n(e===`all`?{}:{show:e},{replace:!0}),U=e=>e.flatMap(e=>e.sections).map(e=>m.spaceSections.find(t=>t.id===e.id)).filter(e=>e!==void 0).map(e=>(0,$.jsx)(ue,{id:e.id,children:(0,$.jsx)(k,{title:e.label(),hint:e.hint?.(),plain:!0,children:(0,$.jsx)(De,{of:e,children:(0,$.jsx)(e.component,{})})})},e.serial)),W=h?void 0:se;return(0,$.jsx)(Le.Provider,{value:ie,children:(0,$.jsx)(`div`,{className:`animate-rise`,children:(0,$.jsxs)(`div`,{className:`grid gap-6 md:grid-cols-[13.5rem_minmax(0,1fr)] md:gap-8 lg:grid-cols-[15rem_minmax(0,1fr)] lg:gap-10`,children:[(0,$.jsxs)(`aside`,{className:V(`min-w-0 md:sticky md:top-20 md:self-start`,h&&T===2&&`hidden`,h&&re===`back`&&Me(`back`)),children:[(0,$.jsx)(Ie,{title:D,open:E===1?C??null:null,onBack:()=>h?o(`/space`):x(S??null)}),(0,$.jsx)(`div`,{className:V(Me(ne)),children:E===0?(0,$.jsx)(ze,{entries:te,current:h?void 0:C,onPick:()=>x(null)}):(0,$.jsx)(`div`,{ref:_})},E)]}),S?(0,$.jsxs)(`div`,{className:V(`min-w-0`,h&&T<2&&`hidden`,h&&re===`deeper`&&Me(`deeper`)),children:[h?(0,$.jsx)(`div`,{className:`mb-3`,children:(0,$.jsx)(Ve,{label:C?.label??D,onBack:()=>o(`/space/${S}`)})}):null,f&&u?(0,$.jsx)(`div`,{className:`mb-6`,children:(0,$.jsx)(Rn,{project:u})}):null,S===`results`?(0,$.jsxs)(Be,{children:[(0,$.jsxs)(`ul`,{className:`flex flex-col gap-0.5`,children:[(0,$.jsx)(je,{icon:Xe,label:Y(`space.resultsAll`),selected:!h&&!A,onPick:()=>H(`all`)}),j.data?.wizards.filter(e=>e.results||e.id===A).map(e=>(0,$.jsx)(je,{icon:oe,label:e.title,badge:e.results?(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:e.results}):null,selected:!h&&e.id===A,onPick:()=>H(e.id)},e.id))]}),(0,$.jsx)($n,{groups:O,current:W,onPick:he})]}):S===`data`?(0,$.jsxs)(Be,{children:[(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:(0,$.jsx)(je,{icon:le,label:Y(`data.all`),selected:!h&&!M,onPick:()=>H(`all`)})}),pe.data?Nn(pe.data).map(e=>(0,$.jsx)(Pe,{label:e.label,children:e.items.map(e=>(0,$.jsx)(je,{icon:Pn[e.kind],label:e.title,selected:!h&&e.key===M,onPick:()=>H(e.key)},e.key))},e.key)):null,(0,$.jsx)($n,{groups:O,current:W,onPick:he})]}):S===`knowledge`?(0,$.jsxs)(Be,{children:[(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:(0,$.jsx)(je,{icon:le,label:Y(`know.all`),selected:!(h||M),onPick:()=>H(`all`)})}),F.data?.categories.length?(0,$.jsx)(Pe,{label:Y(`know.categories`),children:F.data.categories.map(e=>(0,$.jsx)(je,{icon:dt[e.type],label:e.name,badge:(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:e.proposed?`·`:e.count}),selected:!h&&(M===`c:${e.id}`||I.data?.category.id===e.id),onPick:()=>H(`c:${e.id}`)},e.id))}):null,(0,$.jsx)($n,{groups:O,current:h?void 0:N?.id,onPick:e=>H(`s:${e}`)})]}):(0,$.jsx)(Be,{children:(0,$.jsx)($n,{groups:ae,current:W,onPick:he})}),u&&(S===`info`||S===`knowledge`)?(0,$.jsxs)(Dn,{project:u,group:S,docked:S===`knowledge`&&!!M&&!N,children:[S===`knowledge`?P?P.startsWith(`p:`)?(0,$.jsx)($t,{pageId:P.slice(2),onGone:()=>H(`all`),onOpen:H},P):P.startsWith(`t:`)?(0,$.jsx)(Xn,{tableId:P.slice(2),onGone:()=>H(`all`)},P):(0,$.jsx)(Xt,{projectId:u.id,fileId:P.slice(2),readOnly:u.readOnly,onGone:()=>H(`all`)},P):F.data?N?(0,$.jsx)(k,{title:N.label(),hint:N.hint?.(),plain:!0,children:(0,$.jsx)(De,{of:N,children:(0,$.jsx)(N.component,{})})},M):M?.startsWith(`c:`)?L?(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsx)(xt,{projectId:u.id,category:L,readOnly:u.readOnly,onOpen:H,onGone:()=>H(`all`)}),L.type===`choice`?null:(0,$.jsx)(zt,{projectId:u.id,category:L,categories:F.data.categories,onOpen:H})]},M):null:M?.startsWith(`v:`)?I.data?(0,$.jsx)(Ct,{value:I.data,readOnly:u.readOnly,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[I.data.items.length?(0,$.jsx)(`div`,{className:`flex flex-col rounded-xl bg-card p-1.5 shadow-soft ring-1 ring-border-soft`,children:I.data.items.map(e=>(0,$.jsx)(It,{item:e,categories:F.data.categories.filter(e=>e.id!==I.data?.category.id),onOpen:H},e.key))}):null,I.data.rows.map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>H(`t:${e.tableId}`),className:`px-1 text-left text-[0.8125rem] text-ink-3 hover:text-ink`,children:Y(`know.tocRows`,{n:e.count,table:e.title})},e.tableId))]})},M):null:(0,$.jsx)(ue,{id:`documents`,children:(0,$.jsx)(Gt,{projectId:u.id,data:F.data,readOnly:u.readOnly,onOpen:H})}):null:null,S===`info`?U(O):null]},u.id):null,u&&S===`data`?(0,$.jsx)(`div`,{className:`flex flex-col gap-9 pb-20`,children:M?.startsWith(`t:`)?(0,$.jsx)(Xn,{tableId:M.slice(2),onGone:()=>H(`all`)},M):M?.startsWith(`p:`)?(0,$.jsx)($t,{pageId:M.slice(2),onGone:()=>H(`all`)},M):(0,$.jsxs)($.Fragment,{children:[pe.data?(0,$.jsx)(In,{projectId:u.id,data:pe.data,readOnly:u.readOnly,onOpen:H}):null,U(O)]})}):null,u&&S===`results`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-9 pb-20`,children:[j.data?(0,$.jsx)(jn,{data:j.data,wizardId:A,filter:ce,onFilter:de}):null,j.isError?(0,$.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:j.error.message}):null,U(O)]}):null,u||d?null:(0,$.jsx)(me,{children:Y(`settings.noProject`)})]}):null]})})})}export{er as ProjectPage};
@@ -1 +0,0 @@
1
- var e=JSON.parse(`[{"version":"v0.2.22","timestamp":1791318736,"commits":[{"id":"cacabd1","message":"a model an own AI Gateway key may not use is found before a run starts, not after minutes of work: the check before a run (and the runtime's start, and the Models page) asks Vercel once per key and model with a call of a token or a word – a refusal of the free tier costs nothing, is asked again after five minutes so a top-up counts, and an allowed model is not asked again for a day; videos and images not made by a chat model cannot be asked that cheaply, there a refusal a run met counts; a step refused for the free tier says so and how to fix it (top up at Vercel, with the link, or pick another way under Einstellungen → Modelle) instead of Vercel's raw message, and web addresses in a run's error, the editor's missing-models notice and the Models page are links","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.2.21","timestamp":1791314990,"commits":[{"id":"23b5001","message":"a wizard can make a film with Claude Code: the new step type \\"film\\" lets the AI client installed on this computer write a motion-graphics film as code in a folder of its own – with HyperFrames' skills (fetched once from GitHub at a pinned version), the wizard's style kit (a .zip in its workspace, unpacked as the bar to reach), the space's brand (name, colours named by use, facts, logos) and the run's material (voice, script, pictures, uploads) – and the runtime renders the MP4 with HyperFrames (installed into the data folder on the first film); the client's shell runs in its sandbox, writing only inside the folder and without network, and reaches HyperFrames' render, snapshots and checks through a tool of the step limited to the folder; sounds come only from a catalog of CC0 effects (soundcn by Kenney, HyperFrames' own); a film runs only where Claude Code is the AI subscription, never on credits or in the cloud, the runner says so before a run starts and the marketplace shows it as a capability; a film that stops picks up the client's session on the next try, a failed final render goes back to the client to fix, and a review's note changes the film's code instead of making it again; the folder goes with the run's files","group":"Added","scope":null,"breaking":false}]},{"version":"v0.2.20","timestamp":1791314485,"commits":[{"id":"d6a5fca","message":"a team's plan reaches the runtime: the Manage-App names the plan, its feature switches and the people it allows, and a count of spaces may be unbounded (null); in a team the owner and the admins make and delete wizards, spaces and connectors while a member edits, tests and publishes the wizards there are – enforced in the services for studio, API and MCP alike (403 forbidden); the settings get a Team page with the plan, the places and who is in the team, managed at the Manage-App; own API keys in the cloud studio are a feature of the plan; and the Manage-App learns which plugins a runtime carries (GET /api/internal/plugins)","group":"Added","scope":null,"breaking":false}]},{"version":"v0.2.19","timestamp":1791313075,"commits":[{"id":"3243a25","message":"the gallery has three more categories (Bilder & Video, Anfragen & Termine, Beratung & Preise) so the category row fills two even rows","group":"Added","scope":null,"breaking":false}]},{"version":"v0.2.18","timestamp":1791312078,"commits":[{"id":"661b2c9","message":"Wissen in the space: what the space's wizards look things up in, as pages with sub-pages, tables and files sorted by typed Kategorien (choice, date, number, text, yes/no), filtered by them and searched by words and meaning, with a classifier that keeps only what answers the question; an upload is converted on arrival (a long document becomes a page with sub-pages, a sheet a table, the original stays beside it) and a model fills its Kategorien; every value of a Kategorie has its Übersicht and its entries, numbers in ranges; steps get project_search with a filter, project_list, page_read and table_read by path; the assistant docks at the bottom of an opened item and knows Wissen; plugins write into Wissen through server.spaceData (pages, tables, files, documents with their Kategorien), and what a person edits stays theirs","group":"Added","scope":null,"breaking":false}]},{"version":"v0.2.17","timestamp":1791310689,"commits":[{"id":"6a0e1ba","message":"a run's price follows one way through the wizard instead of adding up branches that exclude each other, and leaves out the steps that have no model here (the video ad: about 111 credits with clips, 11 without a video model, was 207 either way); what a step reports while it works shows in the language the person reads, the run's log keeps it in German; English wizards write amounts and today's date the English way (€2,400.00) instead of the German one","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.2.16","timestamp":1791307427,"commits":[{"id":"883404e","message":"a wizard that needs a model not set up here says so before anything is paid for: in the gallery, video, speech output or voice notes that only some answers need no longer block a template (\\"Works without: …\\"); on its pages, the choices that would lead to such a step are locked with the reason and the default moves to one that works, an optional voice note nothing here can listen to gives way to the reason, and the server refuses those answers","group":"Added","scope":null,"breaking":false}]},{"version":"v0.2.15","timestamp":1791294678,"commits":[{"id":"2c5ae49","message":"on phones and small tablets the editor's pane is a bottom sheet whose height is dragged at its handle, touch included; a tap on the handle folds it to its tabs and unfolds it to the height it had, a step tapped in the diagram or a tab unfolds it too, and the height is remembered per browser; the sheet and the diagram now fit the screen, so the chat's input is no longer cut off at the bottom","group":"Added","scope":null,"breaking":false},{"id":"cfe23fa","message":"a saved wizard whose link is gone (a new link, or the wizard deleted) shows as unavailable instead of offering Start into the runner's not-found page","group":"Fixed","scope":"mobile","breaking":false}]},{"version":"v0.2.14","timestamp":1791291788,"commits":[{"id":"ff63c86","message":"\\"What's new\\" in the banner about a newer release opens the changelog of that release in the studio instead of its page on GitHub; offline it shows the changelog this version came with","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.2.13","timestamp":1791289689,"commits":[{"id":"94297b8","message":"the space opens behind the folder in the top bar and has four parts in the settings' sliding menu: Info & Marke (Basis, Logos, Farben, Assets, Fakten), Wissen (Dokumente), Daten and Ergebnisse; Daten holds tables with typed columns, edited cell by cell, and Markdown pages, of the space or of one of its wizards; a wizard's list can be shared, one table for every run that the person running it never sees, and a step with the new Pages tool writes the wizard's pages; the space's own tables and pages go to the cloud with each published wizard and are read-only there, while what runs write stays where they ran; Ergebnisse lists the finished runs of all wizards or of one, the wizard with the latest result first, with search, live or test and the last days; a plugin's section of the space chooses its part; the studio is a step smaller on laptops and nearer the edge on phones; the run-log example no longer adds an icon to the top bar","group":"Added","scope":null,"breaking":false}]},{"version":"v0.2.12","timestamp":1791289473,"commits":[{"id":"3aaf939","message":"the documentation deploys like the cloud runtime: its image is built on GitHub's runners beside the checks of a release tag and pushed to GHCR, and the server only pulls it (deploy/Dockerfile.docs, built with --pull); the docs Dockerfile keeps its install cached across releases; a change of the docs image no longer redeploys the runtime","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.2.11","timestamp":1791287681,"commits":[{"id":"50041f3","message":"the cloud runtime deploys in minutes: its two images are built on GitHub's runners beside the checks of a release tag, with their layers cached in the registry, and pushed to GHCR; once both are green they become latest and the server pulls them instead of building for up to an hour; the runtime's Dockerfile keeps both dependency installs cached across releases (the root version blanked out, the production install in its own stage) and puts what changes every release last; IMAGE_TAG on the server pins a release","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.2.10","timestamp":1791286327,"commits":[{"id":"c5c99b0","message":"signing in from the studio returns to the studio page that asked for it, not to the host's root, which is the landing page since the studio moved to /studio","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.2.9","timestamp":1791284806,"commits":[{"id":"fff4ab3","message":"plugins add to the space: sections of the space page under the plugin's name in its menu, tools of the space assistant whose results the plugin draws as cards in its chat, a block and tools for every AI step of the space, texts in the space's search index that project_search finds beside its documents, events when a space is made, changed or deleted and when a file is read or removed, jobs that run on a schedule, public routes under an address of their own, and the runtime's web reader and document parser; the run-log example shows a space's last runs on the space page; the plugin docs describe the space","group":"Added","scope":null,"breaking":false}]},{"version":"v0.2.8","timestamp":1791284267,"commits":[{"id":"040a292","message":"Settings → Models says what the wizards can do (text, images, videos, voice, voice notes) and who does each: an AI subscription on this computer, an own API key (OpenAI, Anthropic, Google, fal.ai, ElevenLabs, Replicate, AI Gateway), a local model, or the credits, which step in where nothing of one's own is set up (a switch, on with a linked account) and may name a model of the gateway (credits:<model>: fal, ElevenLabs, Veo …); each provider's key is checked with the provider before it is kept, and a try makes a text, an image, a voice or a short clip to look at; in the cloud the page is the team's, its keys sealed per tenant and changed by its admins; voice notes run on transcription models (Scribe, Whisper) where one is bound, also on the credits; the settings show their name in the top bar's trail instead of a heading, and one container on the left slides one level down to the menu of Models and Integrate and back; on a phone the sections, a section's menu and the page take turns with a way back; Integrate puts the app's name, what it gets and its steps on one line","group":"Added","scope":null,"breaking":false}]},{"version":"v0.2.7","timestamp":1791281338,"commits":[{"id":"cc15aad","message":"the space is a page of its own: the top bar opens it beside the gear, and a menu at its left jumps to Basis, Logos, Farben, Assets, Dokumente and Fakten and marks the one in view (a picker on a phone); the studio, its assistant and the docs call a project a space (German „Space“), the address is /space and /settings/project leads there; the settings keep Konto, Connectors, Modelle and Einbinden, and the gear opens Konto; the assistant's input is one line until the text needs more, in its card and docked at the bottom","group":"Added","scope":null,"breaking":false}]},{"version":"v0.2.6","timestamp":1791280942,"commits":[{"id":"198e23c","message":"a wizard's link installs and bookmarks with the wizard's own icon: its engenty in its own colour on a pale ground of that colour with its name in small capitals below, drawn by the runtime for the manifest, the iPhone's home screen and phones that cut icons to their own shape; the page's favicon is the engenty alone, so a bookmark or tab shows it too; the name keeps the whole words that fit and never ends on a short word like \\"aus\\"; the studio's icon stands in where the runtime cannot draw; on a computer the start page offers a bookmark (⌘ D or Strg + D) instead of an install, phones keep \\"Zum Startbildschirm hinzufügen\\"","group":"Added","scope":null,"breaking":false}]},{"version":"v0.2.5","timestamp":1791272370,"commits":[{"id":"fc58644","message":"a local install says where each wizard runs and which link others can open: the cards and the editor's top bar show Live with a cloud when engenty.ai runs the version, Lokal when it runs only on this computer, Wird gesendet or Nicht in der Cloud when it did not arrive; a card's Link copies the cloud's address; the share dialog leads with that one link, says on top where the wizard runs and what the cloud lacks, folds website, QR code and the settings away, and creates a new link in the cloud too; the avatar and its menu show whether an account is connected, with its credits; Settings → Konto puts engenty.ai first and takes name and e-mail from the account; without an account the share dialog, a card's Link and the note about missing models say what an account would add","group":"Added","scope":null,"breaking":false}]},{"version":"v0.2.4","timestamp":1791242529,"commits":[{"id":"fbcfbc3","message":"a wizard a local install sends arrives whole or not at all, and the install sends again by itself: the cloud runtime keeps the files' bytes first and writes the project, the wizard, its workspace, the version and the logo in one transaction, so an object store that fails in the middle leaves nothing half done; the install plans another try after a minute, then twice as long each time up to an hour, when the cloud was out of reach or answered with an error of its own, and the share dialog says when; refusals stay with the person; a first sync that stops at an unreachable cloud marks the remaining wizards for the retry too; the public link is set on every sync; the runtime asks GitHub for a newer release once an hour instead of every six","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.2.3","timestamp":1791238483,"commits":[{"id":"38d161b","message":"the mobile app's data folder (apps/mobile/src/data) is in the repository: the ignore rule for the runtime's data folder hid every folder of that name, so main neither typechecked nor passed the mobile app's tests; the rule now names the runtime's two data folders","group":"Fixed","scope":null,"breaking":false},{"id":"251d6f4","message":"with an account signed in, what a local install publishes also runs in the cloud: the published version and its files go to the account's cloud runtime under the ids they have here, which shows the project without editing and makes the link; Settings → Konto signs in or creates an account with an invitation code and shows the credits and when they end; the share dialog says what a wizard lacks in the cloud; a team without building rights changes nothing on the server, and what visitors send is capped in size","group":"Added","scope":null,"breaking":false},{"id":"d80eb4e","message":"inside the mobile app the runner reads in the system's font, like the app's own screens; headings keep the brand's","group":"Added","scope":null,"breaking":false},{"id":"4604875","message":"the mobile app looks native: the system font, Liquid Glass (a blur before iOS 26) on the floating tab bar and the nav buttons, inset grouped lists with hairlines, Add as a form sheet with eight ID boxes, swipe to share or delete a result, files listed as the Files app does, settings rows with icon tiles","group":"Added","scope":null,"breaking":false},{"id":"d9edbe4","message":"the mobile app runs on Android: no iOS-only WebView prop that crashed the Run screen, plain http only for a runtime on this computer, result rows in the wizard's colour","group":"Fixed","scope":null,"breaking":false},{"id":"34a4588","message":"the mobile app (apps/mobile, Expo): wizards added by QR code, ID or link, runs in the runtime's runner with the app's scanner, share sheet, downloads, notifications and sign-in sheet, results kept on the phone and shared from there; engenty.ai's /w/ and /s/ links and engenty-wizards:// open in it","group":"Added","scope":null,"breaking":false},{"id":"2c19636","message":"a run tells the mobile app's device when it is done, failed or waits for the person: the app gives the run its device (POST /api/runs/:id/notify), the runtime asks the Manage-App to push (POST /v1/push in the contract); the app's own requests name the visitor in an x-wizards-visitor header, since iOS merges a Cookie header with its cookie store","group":"Added","scope":null,"breaking":false},{"id":"767e170","message":"the runner works inside the mobile app: ?app=1 drops the web's header, footer and install hint, and window.engentyApp takes over the scanner, share sheet, downloads, wake lock, notifications and account sign-in; a wizard gets an 8-character ID (GET /api/public/codes/:code) and the studio's share dialog shows it with a QR code to download as PNG or SVG; the runtime serves apple-app-site-association and assetlinks.json for the app","group":"Added","scope":null,"breaking":false},{"id":"d8f3712","message":"plan for the mobile app that runs wizards on iOS and Android","group":"Docs","scope":null,"breaking":false}]},{"version":"v0.2.2","timestamp":1791237386,"commits":[{"id":"a6c55de","message":"server.generate asks a model of the current tenant (a class, a prompt, optionally a zod schema for an object), on the models its studio is set up with and paid like any other call; without a model it throws with status 503 and the code no_model, which a route passes on","group":"Added","scope":"plugins","breaking":false},{"id":"e895e50","message":"the documentation deploys to engenty.ai/docs: an image of its own (apps/docs/Dockerfile, a standalone Next.js server on port 8896), and a release tag moves the branch deploy/docs when the site or its pages changed","group":"Deploy","scope":null,"breaking":false},{"id":"4d8b773","message":"a documentation site with a user guide and the developer docs for plugins, built like the engenty repo's: Next.js and Fumadocs in apps/docs, the pages in docs/content, in the app's light and dark colours; docs/plugins.md became its pages, and the product's build, image, package and credits leave the site out","group":"Docs","scope":null,"breaking":false}]},{"version":"v0.2.1","timestamp":1791223500,"commits":[{"id":"9c16b47","message":"the AI apps start the MCP server as the wizards command, after the rename from engenty-wizards","group":"Fixed","scope":null,"breaking":false},{"id":"f118703","message":"the wizards run in the person's own AI apps — connect writes the MCP server into Claude Desktop, Cursor, Codex and others, a run shows the wizard itself as an MCP App widget, and Settings → Einbinden adds an app with one click and tests it until it works","group":"Added","scope":null,"breaking":false}]},{"version":"v0.2.0","timestamp":1791223087,"commits":[{"id":"4404371","message":"a runtime takes plugins: tools for agent steps, routes with tables of their own, listeners on runs that end, and pages, top bar icons and settings sections in the studio; they load from modules/ and PLUGINS_DIR at start and again while it runs","group":"Added","scope":null,"breaking":false}]},{"version":"v0.1.11","timestamp":1791208594,"commits":[{"id":"85facbd","message":"the package is on npm as wizards, and the README's studio picture shows the branches with their conditions","group":"Docs","scope":null,"breaking":false},{"id":"6ca5cfc","message":"a branch that skips steps runs beside them in the editor, with its condition readable on the line; it ran behind the step with the condition hidden","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.1.10","timestamp":1791206923,"commits":[{"id":"8f35bf0","message":"the README shows the studio with a branched flow and a wizard in use, from its first page to the result","group":"Docs","scope":null,"breaking":false},{"id":"7abf9df","message":"the editor's review notes, tool names and branch labels follow the language; they were German in the English studio","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.1.9","timestamp":1791203125,"commits":[{"id":"5182fec","message":"the installer is engenty.ai/install.sh (was wizards.sh), and the command and the npm package are wizards (were engenty-wizards); the installer renames an install made under the old names","group":"Changed","scope":null,"breaking":false},{"id":"c6500f9","message":"the proxy sends the runtime /w/ and /s/ with the slash","group":"Docs","scope":null,"breaking":false}]},{"version":"v0.1.8","timestamp":1791196160,"commits":[{"id":"a965d36","message":"the marketplace's pages are written by the site at engenty.ai, at /wizards/<slug> and /de/wizards/<slug>","group":"Docs","scope":null,"breaking":false}]},{"version":"v0.1.7","timestamp":1791194770,"commits":[{"id":"66e9109","message":"a banner in the studio says when a newer release is out; the update installs from there, the runtime restarts into the new version and the page reloads","group":"Added","scope":null,"breaking":false},{"id":"5e27bf6","message":"the studio chat counts the seconds of a turn and says what the architect is doing and thinking; pasted pictures show in the thread and the architect sees them","group":"Added","scope":null,"breaking":false}]},{"version":"v0.1.6","timestamp":1791167380,"commits":[{"id":"481807b","message":"video models render at 720p, or 480p when a step asks; a larger clip is scaled down, and the price follows the resolution","group":"Added","scope":null,"breaking":false},{"id":"bb20f2b","message":"the settings say Codex makes images on the sign-in too; only video and audio still need a key","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.1.5","timestamp":1791151312,"commits":[{"id":"f4b7e43","message":"plan for a setup by capability","group":"Docs","scope":null,"breaking":false},{"id":"8ddaab7","message":"a wizard says which models it lacks before it runs, and only refuses to start when every path needs one; templates can be filtered by capability, and those this install cannot run are greyed out","group":"Added","scope":null,"breaking":false},{"id":"2689c74","message":"Codex makes images on the ChatGPT plan, and runs each model class on its own model (Luna, Sol, Astra); image, video and voice stay empty without a gateway key instead of naming models nothing can reach","group":"Added","scope":null,"breaking":false}]},{"version":"v0.1.4","timestamp":1791144283,"commits":[{"id":"071e6ca","message":"the changelog's groups read NEW, FIXED, DOCS in every language, like the entries they stand before","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.1.3","timestamp":1791142528,"commits":[{"id":"32d1698","message":"the publish job fetches the package artifact by name; with one artifact left it no longer lands in its own folder","group":"Fixed","scope":"release","breaking":false}]},{"version":"v0.1.2","timestamp":1791140122,"commits":[{"id":"4bc37b9","message":"a marketplace entry opens in the local studio at localhost:24368 instead of the Mac app's engenty-wizards:// link","group":"Added","scope":null,"breaking":false},{"id":"e09e748","message":"the Mac app is no longer built or offered; the studio offers to install itself as a Chrome app in a banner, starting at login on a Mac is a LaunchAgent that runs the command, and the setup, README and docs point there","group":"Added","scope":null,"breaking":false},{"id":"ab10b49","message":"engenty wizards starts at login — the Mac app opens in the menu bar without its window (\\"Open at Login\\" in its menus), on Linux a systemd user service; the setup asks, \`engenty-wizards autostart on|off\` switches it, and the Mac app's server takes port 24368 too","group":"Added","scope":null,"breaking":false},{"id":"239e338","message":"the setup page installs a missing AI client in its own terminal, and both setups suggest the client whose app is on the Mac — its subscription is most likely already paid for","group":"Added","scope":null,"breaking":false},{"id":"b479df7","message":"an inline terminal's stream sends its last lines and its end before it closes; a page that opens it afterwards gets them all","group":"Fixed","scope":null,"breaking":false}]},{"version":"v0.1.1","timestamp":1791138130,"commits":[{"id":"21f70df","message":"the German tagline on the sign-in page follows the new one","group":"Docs","scope":null,"breaking":false},{"id":"765ae7c","message":"the studio says when a newer release is out and, on an install made by wizards.sh, updates it from the footer","group":"Added","scope":null,"breaking":false},{"id":"825da6c","message":"the tagline is \\"Make a wish. Get your wizard.\\" In the README, the npm package description and the banner of wizards.sh.","group":"Docs","scope":null,"breaking":false},{"id":"05e2e5c","message":"the local runtime listens on 24368, AGENT on a phone keypad; the Docker image stays on 8891","group":"Added","scope":null,"breaking":false},{"id":"71bb778","message":"Ctrl-C stops engenty-wizards again — the login shell that reads the person's variables runs in a session of its own and no longer keeps the terminal","group":"Fixed","scope":null,"breaking":false},{"id":"ee20646","message":"wizards.sh opens with the tall engenty — one eye; it wakes up, looks around, hops and blinks","group":"Added","scope":null,"breaking":false},{"id":"81d4f21","message":"the studio moves to /studio; the root of a host is free for a landing page","group":"Added","scope":null,"breaking":false},{"id":"f6058fd","message":"the marketplace is an app of its own; the runtime searches it live and keeps its starters and the starred entries for offline use","group":"Added","scope":null,"breaking":false},{"id":"e6fdeab","message":"engenty-wizards://new?starter=<id> opens a marketplace template in the desktop app","group":"Added","scope":null,"breaking":false}]},{"version":"v0.1.0","timestamp":1791100948,"commits":[{"id":"71cc075","message":"install with wizards.sh; the local install and how its pieces share it","group":"Docs","scope":null,"breaking":false},{"id":"6ae641d","message":"the desktop app is a window on the local install and brings no runtime along","group":"Added","scope":null,"breaking":false},{"id":"9c9dbb8","message":"an installer, wizards.sh, that every runtime serves","group":"Added","scope":null,"breaking":false},{"id":"34d0a1a","message":"an engenty-wizards command for a local install in ~/.engenty/wizards","group":"Added","scope":null,"breaking":false},{"id":"4ac6329","message":"the search skips filler words with umlauts too","group":"Fixed","scope":null,"breaking":false},{"id":"3bda9a6","message":"the gallery's footer stays without version, changelog and open-source links","group":"Fixed","scope":null,"breaking":false},{"id":"9e65725","message":"a changelog and open-source credits in the studio's footer; pnpm release cuts a release from the commits","group":"Added","scope":null,"breaking":false},{"id":"45d2906","message":"an entry's search terms are scored one by one, not as one long text","group":"Fixed","scope":null,"breaking":false},{"id":"648819c","message":"marketplace entries carry the words people ask for, so a search by words finds them","group":"Added","scope":null,"breaking":false},{"id":"0838373","message":"one project unless the limit says more; an account page; previews and layouts in the project settings","group":"Added","scope":null,"breaking":false},{"id":"8da2aaf","message":"a project holds base infos, logos, colours, assets, documents and facts for all its wizards","group":"Added","scope":null,"breaking":false},{"id":"8679ae2","message":"the gallery has the studio's footer line","group":"Fixed","scope":null,"breaking":false},{"id":"d5086f3","message":"the gallery's field is narrower","group":"Fixed","scope":null,"breaking":false},{"id":"4a82b26","message":"the gallery invites to start a wizard from a template","group":"Other","scope":null,"breaking":false},{"id":"07d2def","message":"a template's header is the dialog's own colour under a spotlight; in the light a tinted grey","group":"Fixed","scope":null,"breaking":false},{"id":"d10be9f","message":"a template opens with its flow as a diagram; the gallery's field is narrower, its chips centred","group":"Added","scope":null,"breaking":false},{"id":"fbee998","message":"the gallery says what it is, compact and from the left; its search is a two-line field to write into","group":"Added","scope":null,"breaking":false},{"id":"478f271","message":"the gallery opens with one question and the search field; quieter filter chips","group":"Added","scope":null,"breaking":false},{"id":"15d7f94","message":"the marketplace search asks the model for the signed-in tenant; a sentence without a model keeps only close finds","group":"Fixed","scope":null,"breaking":false},{"id":"c254357","message":"a marketplace of wizards to start from, with a gallery, admin, translation and search","group":"Added","scope":null,"breaking":false},{"id":"4d6e270","message":"AI media is marked in its file and labelled with the EU icons (AI Act, Art. 50)","group":"Added","scope":null,"breaking":false},{"id":"f86f070","message":"two writers of the same blob no longer share a temporary file","group":"Fixed","scope":null,"breaking":false},{"id":"c6a06cc","message":"plan for definition versions and importing older packages","group":"Docs","scope":null,"breaking":false},{"id":"a37e826","message":"wizard packages carry their own extension, .wizard","group":"Added","scope":null,"breaking":false},{"id":"e104574","message":"wizards export as a package (.wizard.zip) and import into a project","group":"Added","scope":null,"breaking":false},{"id":"b389539","message":"the editor pane's resize handle is a short, thick pill","group":"Added","scope":null,"breaking":false},{"id":"670c3ce","message":"chat composer takes files (+) and dictation","group":"Added","scope":null,"breaking":false},{"id":"766f6fd","message":"editor side pane resizable; Steps tab steps with ← / →, header and strip spacing fixed","group":"Added","scope":null,"breaking":false},{"id":"8205c88","message":"the arrow on a live wizard's card opens it in a new tab","group":"Added","scope":null,"breaking":false},{"id":"2696a50","message":"the AI clients page says it is an MCP server and sets a client up step by step","group":"Added","scope":null,"breaking":false},{"id":"6004a7d","message":"settings in sub-pages with a nav on the left (a dropdown on phones); MCP servers under Connectors","group":"Added","scope":null,"breaking":false},{"id":"49054fa","message":"settings button in the top bar; the user menu closes on Einstellungen","group":"Added","scope":null,"breaking":false},{"id":"65c9867","message":"at most 5 projects per tenant","group":"Added","scope":null,"breaking":false},{"id":"7ecca24","message":"the project switcher switches the wizard list","group":"Fixed","scope":null,"breaking":false},{"id":"c037604","message":"light / dark in the user menu, in place of the top bar's toggle","group":"Added","scope":null,"breaking":false},{"id":"ef464ab","message":"upload limits and sorting, pictures while a step works, faster photo steps, a feedback box on reviews","group":"Added","scope":null,"breaking":false},{"id":"1cbc02f","message":"starters for receipts, video ad, property film, window offer, menu plan and ten website helpers","group":"Added","scope":null,"breaking":false},{"id":"8069115","message":"photos reach an installed AI client, and a photo without text is described","group":"Fixed","scope":null,"breaking":false},{"id":"013f7df","message":"embed a wizard in a website, inline or behind a button that opens it in a window","group":"Added","scope":null,"breaking":false},{"id":"78c2a2a","message":"the editor at /edit/<id>, signed-out visitors of the start page go to SIGNED_OUT_URL","group":"Fixed","scope":null,"breaking":false},{"id":"deb4942","message":"wizards at /w/<token>, the app at the root of https://engenty.ai","group":"Added","scope":null,"breaking":false},{"id":"b811b4c","message":"serve the app under a path (https://engenty.ai/w)","group":"Added","scope":null,"breaking":false},{"id":"4821fb1","message":"the hosted addresses (engenty.ai) as defaults, no private repo names in the public sources","group":"Fixed","scope":null,"breaking":false},{"id":"ca2207e","message":"the drop engenty as app icon, tray icon and favicon","group":"Added","scope":null,"breaking":false},{"id":"90fcbce","message":"a README for people who install it, developer notes in docs/development.md","group":"Docs","scope":null,"breaking":false},{"id":"4b0c54a","message":"a built runtime links to its own port, the sandbox falls back to agentOS","group":"Fixed","scope":null,"breaking":false},{"id":"7071edf","message":"no links to the clients' pages, a placeholder dot in the footer","group":"Fixed","scope":"setup","breaking":false},{"id":"14171bf","message":"installed AI clients as the model of a local runtime, first-start setup as a wizard","group":"Added","scope":null,"breaking":false},{"id":"ca3f3a7","message":"align vertical head turn with pointer gaze","group":"Fixed","scope":"engenty","breaking":false},{"id":"e1f04ff","message":"add furry and jelly renderers with an interactive builder","group":"Added","scope":"engenty","breaking":false},{"id":"99207af","message":"whole credits in the top bar, a footer line with the account's places","group":"Added","scope":null,"breaking":false},{"id":"e498ab1","message":"decision steps — yes/no and choice output fields, branches on step outputs","group":"Added","scope":null,"breaking":false},{"id":"e83a433","message":"pnpm workspace with apps/ and packages/","group":"Changed","scope":null,"breaking":false},{"id":"281e3a3","message":"desktop app — Tauri shell with the runtime as a Node sidecar","group":"Added","scope":null,"breaking":false},{"id":"9296521","message":"a database per tenant, model classes, sign-in at the Manage-App, phone inputs","group":"Added","scope":null,"breaking":false},{"id":"63b1693","message":"engenty's built-in connectors — Gmail, Drive, Calendar, Contacts, Outlook, OneDrive, Slack, GitHub, HubSpot, S3","group":"Added","scope":null,"breaking":false},{"id":"cd431c9","message":"connectors from the integrations registry, asked-first changes in connected accounts","group":"Added","scope":null,"breaking":false},{"id":"8dbe30d","message":"harden browser and file downloads, step navigation in the inspector, store and mailbox docs","group":"Added","scope":null,"breaking":false},{"id":"54370e8","message":"light/dark mode with engenty-coloured dark pages, jelly and fur coats, quiet focus rings","group":"Added","scope":null,"breaking":false},{"id":"371b033","message":"lists and connections kept between runs, mail and browser tools, camera and ask panel","group":"Added","scope":null,"breaking":false},{"id":"07df228","message":"setup per AI client and a self-served plugin with /wizard","group":"Added","scope":null,"breaking":false},{"id":"de27ae8","message":"interactive widgets with a workspace per wizard, shareable results","group":"Added","scope":null,"breaking":false},{"id":"12854e1","message":"live studio — MCP and other edits show up without a reload","group":"Added","scope":null,"breaking":false},{"id":"7f72420","message":"OAuth sign-in for MCP clients, connected apps in settings","group":"Added","scope":null,"breaking":false},{"id":"3014699","message":"MCP endpoint for authoring wizards with personal API keys","group":"Added","scope":null,"breaking":false},{"id":"985e612","message":"engenty wizards — prompt-built AI wizards with shareable links","group":"Added","scope":null,"breaking":false}]}]`);export{e as default};