wizards 0.2.43 → 0.2.44

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 (53) hide show
  1. package/apps/web/dist/assets/{ChangelogDialog-8qS5utcR.js → ChangelogDialog-C1_ZvuwE.js} +1 -1
  2. package/apps/web/dist/assets/{ChatView-Bx1KVCEf.js → ChatView-DLG771z6.js} +1 -1
  3. package/apps/web/dist/assets/{CreditsDialog-BCuDsatt.js → CreditsDialog-Ce7Czhxq.js} +1 -1
  4. package/apps/web/dist/assets/EditorPage-CXx32-a7.js +3 -0
  5. package/apps/web/dist/assets/{FlowPreview-COgjib4H.js → FlowPreview-DgZiepFR.js} +1 -1
  6. package/apps/web/dist/assets/{Harness-BaxjV1Ng.js → Harness-ffZUxkbb.js} +1 -1
  7. package/apps/web/dist/assets/{HomePage-BlD0wZB0.js → HomePage-B3RVPuUu.js} +1 -1
  8. package/apps/web/dist/assets/{ImportWizard-BZDtNJg1.js → ImportWizard-CHlCjPEo.js} +1 -1
  9. package/apps/web/dist/assets/{NewWizardPage-Ci_x__p9.js → NewWizardPage-BQW7PoZq.js} +2 -2
  10. package/apps/web/dist/assets/{ProjectPage-NwFut2Z-.js → ProjectPage-D-_A4iZz.js} +2 -2
  11. package/apps/web/dist/assets/{PublicRunner-rHdvK18v.js → PublicRunner-sbya6PXg.js} +1 -1
  12. package/apps/web/dist/assets/{RunDrawer-Dp-JowDX.js → RunDrawer-BgLxai9C.js} +3 -3
  13. package/apps/web/dist/assets/{RunnerView-DSlReODC.js → RunnerView-BVm9fL62.js} +1 -1
  14. package/apps/web/dist/assets/SettingsPage-Ce6k9xDs.js +1 -0
  15. package/apps/web/dist/assets/SetupPage-CLymFxat.js +1 -0
  16. package/apps/web/dist/assets/{SharePage-DdJ-qD-B.js → SharePage-1Ni5ejt6.js} +1 -1
  17. package/apps/web/dist/assets/{ThemeSwitch-BkodFy16.js → ThemeSwitch-DN42WOTx.js} +1 -1
  18. package/apps/web/dist/assets/arrow-right-BgKM1Npq.js +1 -0
  19. package/apps/web/dist/assets/changelog-CH4sN8Dm.js +1 -0
  20. package/apps/web/dist/assets/{circle-alert-Gn4D6etf.js → circle-alert-D_6s0Xgw.js} +1 -1
  21. package/apps/web/dist/assets/{copy-C3D7PBYL.js → copy-BAtcCufT.js} +1 -1
  22. package/apps/web/dist/assets/definition-CfFlylCM.js +56 -0
  23. package/apps/web/dist/assets/{external-link-M3mEgZA-.js → external-link-DitV3n6l.js} +1 -1
  24. package/apps/web/dist/assets/{globe-BnaeE83w.js → globe-CoQ1BSyl.js} +1 -1
  25. package/apps/web/dist/assets/{image-BuasG4Jr.js → image-B1a1ax-P.js} +1 -1
  26. package/apps/web/dist/assets/index-B8VsYgck.js +78 -0
  27. package/apps/web/dist/assets/index-mB3Du8ho.css +1 -0
  28. package/apps/web/dist/assets/{lock-CrB_z7n3.js → lock-DSPinlFN.js} +1 -1
  29. package/apps/web/dist/assets/{meta-CT4LmQ7g.js → meta-Bpe6vzmM.js} +1 -1
  30. package/apps/web/dist/assets/{mouse-pointer-click-BurvPVO8.js → mouse-pointer-click-SHJL7g1i.js} +1 -1
  31. package/apps/web/dist/assets/{pen-line-BA6l84zC.js → pen-line-DgSzJ60H.js} +1 -1
  32. package/apps/web/dist/assets/{refresh-cw-DEKCEuIO.js → refresh-cw-CWRkEENy.js} +1 -1
  33. package/apps/web/dist/assets/{session-DCcgTTmG.js → session-C24kIPr-.js} +1 -1
  34. package/apps/web/dist/assets/{settings-menu-C9fE9M0f.js → settings-menu-e8OMChHm.js} +1 -1
  35. package/apps/web/dist/assets/{star-BwhVXiJM.js → star-ClV5w6K4.js} +1 -1
  36. package/apps/web/dist/assets/{trash-WwlTeE_V.js → trash-t3O7FdUR.js} +1 -1
  37. package/apps/web/dist/assets/{type-kpWj7Zf1.js → type-BbMmv2qL.js} +1 -1
  38. package/apps/web/dist/assets/ui-C4b__6Oo.js +9 -0
  39. package/apps/web/dist/assets/{video-U-idAC66.js → video-D04-GeyG.js} +1 -1
  40. package/apps/web/dist/assets/{volume-2-BwidpioC.js → volume-2-FUU7z0rq.js} +1 -1
  41. package/apps/web/dist/assets/{wand-sparkles-DaINku4r.js → wand-sparkles-BsD2e8V6.js} +1 -1
  42. package/apps/web/dist/index.html +12 -12
  43. package/apps/web/dist/mcp/flow.html +2 -2
  44. package/package.json +1 -1
  45. package/apps/web/dist/assets/EditorPage-_Sbj-mSD.js +0 -3
  46. package/apps/web/dist/assets/SettingsPage-2Bw-D3hC.js +0 -1
  47. package/apps/web/dist/assets/SetupPage-DHESCsTb.js +0 -1
  48. package/apps/web/dist/assets/arrow-right-pf8p4FIz.js +0 -1
  49. package/apps/web/dist/assets/changelog-cmQb-lZW.js +0 -1
  50. package/apps/web/dist/assets/definition-AlI4g-wR.js +0 -56
  51. package/apps/web/dist/assets/index-BdrX1tJ4.js +0 -78
  52. package/apps/web/dist/assets/index-D6vcOCCh.css +0 -1
  53. package/apps/web/dist/assets/ui-Wxaw_APn.js +0 -9
@@ -1,4 +1,4 @@
1
- import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{ut as r}from"./definition-AlI4g-wR.js";import{m as i}from"./session-DCcgTTmG.js";import{M as a,O as o,S as s,U as c,g as l,t as u}from"./ui-Wxaw_APn.js";import{t as d}from"./refresh-cw-DEKCEuIO.js";import{r as f}from"./ThemeSwitch-BkodFy16.js";var p=e(t(),1),m=2,h=1,g=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(m,Math.floor(u/e.css.cell.width)),rows:Math.max(h,Math.floor(l/e.css.cell.height))}}},_=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=te.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function ee(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var te=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!ee(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),n.isWrapped&&o.indexOf(` `)===-1););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},ne=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function re(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var ie=class{constructor(e=re,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||ne;this._linkProvider=this._terminal.registerLinkProvider(new _(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}},ae=Object.defineProperty,oe=Object.getOwnPropertyDescriptor,se=(e,t)=>{for(var n in t)ae(e,n,{get:t[n],enumerable:!0})},v=(e,t,n,r)=>{for(var i=r>1?void 0:r?oe(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ae(t,n,i),i},y=(e,t)=>(n,r)=>t(n,r,e),ce=`Terminal input`,b={get:()=>ce,set:e=>ce=e},le=`Too much output to announce, navigate to rows manually to read`,ue={get:()=>le,set:e=>le=e};function de(e){return e.replace(/\r?\n/g,`\r`)}function x(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function fe(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function pe(e,t,n,r){e.stopPropagation(),e.clipboardData&&me(e.clipboardData.getData(`text/plain`),t,n,r)}function me(e,t,n,r){e=de(e),e=x(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function he(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function ge(e,t,n,r,i){he(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function S(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function _e(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var ve=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},ye=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},be=``,xe=` `,Se=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Ce}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Ce=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},C=class e extends Se{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Ce,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?S(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},we=`di$target`,Te=`di$dependencies`,Ee=new Map;function De(e){return e[Te]||[]}function w(e){if(Ee.has(e))return Ee.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Oe(t,e,r)};return t._id=e,Ee.set(e,t),t}function Oe(e,t,n){t[we]===t?t[Te].push({id:e,index:n}):(t[Te]=[{id:e,index:n}],t[we]=t)}var T=w(`BufferService`),ke=w(`CoreMouseService`),Ae=w(`CoreService`),je=w(`CharsetService`),Me=w(`InstantiationService`),Ne=w(`LogService`),E=w(`OptionsService`),Pe=w(`OscLinkService`),Fe=w(`UnicodeService`),Ie=w(`DecorationService`),Le=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new C,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Re(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Le=v([y(0,T),y(1,E),y(2,Pe)],Le);function Re(e,t){if(confirm(`Do you want to navigate to ${t}?
1
+ import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{dt as r}from"./definition-CfFlylCM.js";import{m as i}from"./session-C24kIPr-.js";import{M as a,O as o,S as s,U as c,g as l,t as u}from"./ui-C4b__6Oo.js";import{t as d}from"./refresh-cw-CWRkEENy.js";import{r as f}from"./ThemeSwitch-DN42WOTx.js";var p=e(t(),1),m=2,h=1,g=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(m,Math.floor(u/e.css.cell.width)),rows:Math.max(h,Math.floor(l/e.css.cell.height))}}},_=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=te.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function ee(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var te=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!ee(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),n.isWrapped&&o.indexOf(` `)===-1););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},ne=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function re(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var ie=class{constructor(e=re,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||ne;this._linkProvider=this._terminal.registerLinkProvider(new _(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}},ae=Object.defineProperty,oe=Object.getOwnPropertyDescriptor,se=(e,t)=>{for(var n in t)ae(e,n,{get:t[n],enumerable:!0})},v=(e,t,n,r)=>{for(var i=r>1?void 0:r?oe(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&ae(t,n,i),i},y=(e,t)=>(n,r)=>t(n,r,e),ce=`Terminal input`,b={get:()=>ce,set:e=>ce=e},le=`Too much output to announce, navigate to rows manually to read`,ue={get:()=>le,set:e=>le=e};function de(e){return e.replace(/\r?\n/g,`\r`)}function x(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function fe(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function pe(e,t,n,r){e.stopPropagation(),e.clipboardData&&me(e.clipboardData.getData(`text/plain`),t,n,r)}function me(e,t,n,r){e=de(e),e=x(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function he(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function ge(e,t,n,r,i){he(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function S(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function _e(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var ve=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},ye=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},be=``,xe=` `,Se=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Ce}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Ce=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},C=class e extends Se{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Ce,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?S(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},we=`di$target`,Te=`di$dependencies`,Ee=new Map;function De(e){return e[Te]||[]}function w(e){if(Ee.has(e))return Ee.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);Oe(t,e,r)};return t._id=e,Ee.set(e,t),t}function Oe(e,t,n){t[we]===t?t[Te].push({id:e,index:n}):(t[Te]=[{id:e,index:n}],t[we]=t)}var T=w(`BufferService`),ke=w(`CoreMouseService`),Ae=w(`CoreService`),je=w(`CharsetService`),Me=w(`InstantiationService`),Ne=w(`LogService`),E=w(`OptionsService`),Pe=w(`OscLinkService`),Fe=w(`UnicodeService`),Ie=w(`DecorationService`),Le=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new C,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(c!==-1||n.hasContent(t)){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):Re(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};Le=v([y(0,T),y(1,E),y(2,Pe)],Le);function Re(e,t){if(confirm(`Do you want to navigate to ${t}?
2
2
 
3
3
  WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var ze=w(`CharSizeService`),Be=w(`CoreBrowserService`),Ve=w(`MouseService`),He=w(`RenderService`),Ue=w(`SelectionService`),We=w(`CharacterJoinerService`),Ge=w(`ThemeService`),Ke=w(`LinkProviderService`),qe=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?$e.isErrorNoTelemetry(e)?new $e(e.message+`
4
4
 
@@ -1 +1 @@
1
- import{a as e,i as t,n,t as r}from"./jsx-runtime-D3jfb0Ew.js";import{O as i,ut as a,z as o}from"./definition-AlI4g-wR.js";import{d as s,f as c,m as l,s as u,t as d,u as ee}from"./session-DCcgTTmG.js";import{A as f,I as te,K as p,M as m,O as h,R as ne,S as g,T as _,U as v,X as re,a as ie,c as y,d as ae,et as b,f as x,g as S,h as oe,i as se,n as ce,o as le,r as C,s as w,t as T,z as ue}from"./ui-Wxaw_APn.js";import{a as de,i as fe,o as pe,r as me,t as he}from"./ImportWizard-BZDtNJg1.js";import{t as E}from"./copy-C3D7PBYL.js";import{t as D}from"./external-link-M3mEgZA-.js";import{t as ge}from"./video-U-idAC66.js";import{a as O,i as _e,r as k,t as ve}from"./ThemeSwitch-BkodFy16.js";var A={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};A.node;var ye=p(A),j={name:`cloud`,size:24,node:[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]};j.node;var M=p(j),N={name:`hard-drive`,size:24,node:[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]};N.node;var be=p(N),P={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};P.node;var F=p(P),I={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};I.node;var L=p(I),R={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};R.node;var xe=p(R),z={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};z.node;var B=p(z),V={name:`message-circle-more`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]};V.node;var Se=p(V),H={name:`message-circle`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]};H.node;var Ce=p(H),we={name:`message-square-text`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]};we.node;var Te=p(we),Ee={name:`phone-call`,size:24,node:[[`path`,{d:`M13 2a9 9 0 0 1 9 9`,key:`1itnx2`}],[`path`,{d:`M13 6a5 5 0 0 1 5 5`,key:`11nki7`}],[`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`}]]};Ee.node;var De=p(Ee),Oe={name:`rows-3`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]],aliases:[`panels-top-bottom`]};Oe.node;var ke=p(Oe),U=e(n(),1),Ae=e=>[`project-files`,e];function je(e){return o({queryKey:Ae(e),queryFn:()=>g.get(`/api/studio/projects/${e}/files`),refetchInterval:e=>e.state.data?.files.some(e=>e.status===`pending`)?2e3:!1})}function Me(e,t){return h(`/api/studio/projects/${e}/files/${t}/content`)}function Ne(e,t=!1){let n=a(),[r,i]=(0,U.useState)(!1),[o,s]=(0,U.useState)(null),c=()=>n.invalidateQueries({queryKey:Ae(e)}),l=async e=>{s(null);try{await e()}catch(e){s(e.message)}finally{await c()}};return{busy:r,error:o,readOnly:t,upload:async(t,n)=>{i(!0),await l(async()=>{for(let r of n)await g.upload(`/api/studio/projects/${e}/files?kind=${t}`,r),await c()}),i(!1)},describe:(t,n)=>l(()=>g.patch(`/api/studio/projects/${e}/files/${t}`,{description:n})),remove:t=>l(()=>g.del(`/api/studio/projects/${e}/files/${t}`)),reindex:t=>l(()=>g.post(`/api/studio/projects/${e}/files/${t}/reindex`)),order:(t,n)=>l(()=>g.put(`/api/studio/projects/${e}/files/order`,{kind:t,ids:n}))}}function Pe(e,t){let n=`wz.layout.${e}`,[r,i]=(0,U.useState)(()=>{try{let e=localStorage.getItem(n);return e===`list`||e===`cards`?e:t}catch{return t}});return[r,()=>i(e=>{let t=e===`list`?`cards`:`list`;try{localStorage.setItem(n,t)}catch{}return t})]}function Fe(e,t,n=700){let[r,i]=(0,U.useState)(`idle`),[a,o]=(0,U.useState)(null),s=JSON.stringify(e),c=(0,U.useRef)(s),l=(0,U.useRef)({value:e,json:s,save:t});l.current={value:e,json:s,save:t};let u=(0,U.useRef)(Promise.resolve()),d=(0,U.useCallback)(()=>{let e=l.current;e.json!==c.current&&(c.current=e.json,i(`saving`),u.current=u.current.then(async()=>{try{await e.save(e.value),o(null),i(`saved`)}catch(e){c.current=``,o(e.message),i(`error`)}}))},[]);return(0,U.useEffect)(()=>{if(s===c.current)return;let e=setTimeout(d,n);return()=>clearTimeout(e)},[s,n,d]),(0,U.useEffect)(()=>d,[d]),{state:r,error:a}}function Ie(e){return e<1e6?`${Math.max(1,Math.round(e/1e3))} KB`:`${(e/1e6).toFixed(1)} MB`}var W=e(r(),1);function Le({id:e,children:t}){return(0,W.jsx)(`div`,{id:e,className:`scroll-mt-6 max-md:scroll-mt-20`,children:t})}function G({title:e,hint:t,save:n,action:r,locked:i,plain:a,children:o}){return(0,W.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-1`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(`h2`,{className:`font-display font-semibold text-lg leading-tight`,children:e}),n?.state===`saving`?(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[0.75rem] text-ink-3`,children:[(0,W.jsx)(x,{className:`size-3`}),` `,m(`project.saving`)]}):n?.state===`saved`?(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[0.75rem] text-moss`,children:[(0,W.jsx)(v,{className:`size-3.5`}),` `,m(`settings.saved`)]}):null]}),t?(0,W.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-3 leading-snug`,children:t}):null]}),r?(0,W.jsx)(`div`,{className:`shrink-0`,children:r}):null]}),a?o:(0,W.jsxs)(ce,{className:`p-3.5 sm:p-5`,children:[i?(0,W.jsx)(`fieldset`,{disabled:!0,className:`min-w-0`,children:o}):o,n?.state===`error`&&n.error?(0,W.jsx)(`p`,{className:`mt-4 text-[0.875rem] text-rose`,children:n.error}):null]})]})}function Re({children:e,layout:t,onToggle:n}){return(0,W.jsxs)(`div`,{className:`mb-3 flex items-start gap-2`,children:[(0,W.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,W.jsx)(`div`,{className:`w-56 max-w-full transition-[width] duration-200 focus-within:w-full has-[input:not(:placeholder-shown)]:w-full`,children:e})}),(0,W.jsx)(le,{label:m(t===`list`?`project.viewCards`:`project.viewList`),onClick:n,children:t===`list`?(0,W.jsx)(L,{className:`size-4`}):(0,W.jsx)(xe,{className:`size-4`})})]})}function ze({value:e,onChange:t,onEnter:n,placeholder:r,busy:i}){return(0,W.jsxs)(`div`,{className:`relative`,children:[(0,W.jsx)(me,{className:`-translate-y-1/2 pointer-events-none absolute top-1/2 left-3 size-4 text-ink-4`}),(0,W.jsx)(`input`,{type:`search`,value:e,placeholder:r,onChange:e=>t(e.target.value),onKeyDown:e=>e.key===`Enter`&&n?.(),className:`h-9 w-full rounded-lg border border-input bg-card pr-3 pl-9 text-[0.875rem] text-ink outline-none transition placeholder:text-ink-4 focus:border-focus focus:ring-4 focus:ring-focus-glow`}),i?(0,W.jsx)(x,{className:`-translate-y-1/2 absolute top-1/2 right-3 size-4 text-ink-3`}):null]})}function Be({onFiles:e,accept:t,multiple:n=!0,className:r,children:i}){return(0,W.jsxs)(`label`,{onDragOver:e=>{e.preventDefault(),e.currentTarget.dataset.over=`1`},onDragLeave:e=>{delete e.currentTarget.dataset.over},onDrop:t=>{t.preventDefault(),delete t.currentTarget.dataset.over;let r=Array.from(t.dataTransfer.files);r.length&&e(n?r:r.slice(0,1))},className:S(`flex cursor-pointer items-center justify-center gap-2 rounded-lg border border-input border-dashed text-[0.875rem] text-ink-3 transition focus-within:border-focus focus-within:ring-4 focus-within:ring-focus-glow hover:border-ink-4 hover:text-ink data-[over]:border-focus data-[over]:bg-paper-2 data-[over]:text-ink`,r),children:[i,(0,W.jsx)(`input`,{className:`sr-only`,type:`file`,accept:t,multiple:n,onChange:t=>{let n=Array.from(t.target.files??[]);t.target.value=``,n.length&&e(n)}})]})}function K(e){try{return new URL(e).host}catch{return e}}var q=e=>`${window.location.origin}${_}/w/${e.shareToken}`;function Ve(e,t,n){if(!e.published)return{kind:`draft`};if(t.mode===`managed`)return{kind:`live`,url:q(e),runs:e.publishedVersion??0,notes:0,cloud:!1};if(!t.account||n===null)return{kind:`here`};if(n===void 0)return{kind:`unknown`};let{copy:r,error:i}=n,a=r?.publishedVersion??null,o=r&&a!==null?r.shareUrl:null;return i?.again?{kind:`sending`,url:o,runs:a,again:i.again}:i?{kind:`missing`,url:o,runs:a,why:i.message}:!r||r.version<(e.publishedVersion??0)?{kind:`missing`,url:o,runs:a,why:m(`cloud.notSent`)}:!r.runnable||!o||a===null?{kind:`missing`,url:o,runs:a,why:`${m(`cloud.notRunnable`,{v:r.version})} ${a===null?m(`cloud.nothingRuns`):m(`cloud.keepsRunning`,{v:a})}`}:{kind:`live`,url:o,runs:a,notes:r.problems.filter(e=>!e.blocking).length,cloud:!0}}function He(e){return e.kind===`live`||e.kind===`sending`||e.kind===`missing`?e.url:null}function Ue({where:e,me:t,version:n}){let r=K(t.account?.cloudUrl??``),i=`size-3.5`;switch(e.kind){case`draft`:return null;case`unknown`:return(0,W.jsx)(C,{tone:`live`,children:m(`home.live`)});case`here`:return(0,W.jsx)(C,{icon:(0,W.jsx)(F,{className:i}),title:m(`where.hereHint`),children:n?m(`where.hereVersion`,{v:n}):m(`where.here`)});case`live`:{let t=n?m(`editor.published`,{v:e.runs}):m(`home.live`),a=e.notes===1?m(`where.note`):e.notes>1?m(`where.notes`,{n:e.notes}):null;return(0,W.jsx)(C,{tone:`live`,icon:e.cloud?(0,W.jsx)(M,{className:i}):void 0,title:e.cloud?m(`where.liveHint`,{host:r}):void 0,children:a?`${t} · ${a}`:t})}case`sending`:return(0,W.jsx)(C,{tone:`warn`,icon:(0,W.jsx)(ue,{className:i}),title:m(`cloud.again`,{when:new Intl.DateTimeFormat(f,{timeStyle:`short`}).format(new Date(e.again))}),children:m(`where.sending`)});case`missing`:return(0,W.jsx)(C,{tone:`warn`,icon:(0,W.jsx)(pe,{className:i}),title:e.why,children:e.runs===null?m(`where.missing`):m(`editor.published`,{v:e.runs})})}}var We=`mt-1.5 text-[0.8125rem] text-ink-3`;function J(e){let t=a(),[n,r]=(0,U.useState)(!1),i=l({mutationFn:e=>g.post(`/api/studio/account/link`,e),onSuccess:({url:e})=>{k(e),r(!0)}});return(0,U.useEffect)(()=>{if(!n)return;let e=setInterval(()=>void t.invalidateQueries({queryKey:[`me`]}),2e3),i=setTimeout(()=>r(!1),3e5);return()=>{clearInterval(e),clearTimeout(i)}},[n,t]),(0,U.useEffect)(()=>{e&&r(!1)},[e]),{link:i,waiting:n}}function Y({link:e,waiting:t}){return e.isError?(0,W.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:m(`local.accountFailed`)}):t?(0,W.jsxs)(`p`,{className:`flex items-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,W.jsx)(x,{className:`size-3.5`}),` `,m(`local.accountWaiting`)]}):null}function Ge(){let e=J(!1),{link:t}=e,[n,r]=(0,U.useState)(``);return(0,W.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-4 py-5 first:pt-0 last:pb-0`,children:[(0,W.jsx)(`div`,{className:`flex size-11 shrink-0 items-center justify-center rounded-full bg-paper-2 text-ink-2`,children:(0,W.jsx)(be,{className:`size-5`})}),(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`div`,{className:`font-medium text-[0.9375rem]`,children:m(`account.local`)}),(0,W.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-3 leading-relaxed`,children:m(`account.localText`)})]})]}),O.account?(0,W.jsxs)(`div`,{className:`flex flex-col gap-4 py-5 last:pb-0`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`font-medium text-[0.9375rem]`,children:m(`account.with`)}),(0,W.jsxs)(`ul`,{className:`mt-2 flex flex-col gap-2 text-[0.875rem] text-ink-2 leading-snug`,children:[(0,W.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,W.jsx)(de,{className:`mt-0.5 size-4 shrink-0 text-amber`}),m(`account.withCredits`)]}),(0,W.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,W.jsx)(M,{className:`mt-0.5 size-4 shrink-0 text-cobalt`}),m(`account.withCloud`)]})]})]}),(0,W.jsx)(`div`,{children:(0,W.jsx)(T,{busy:t.isPending&&!t.variables?.signup,onClick:()=>t.mutate({}),children:m(`account.signIn`)})})]}):null,O.account?(0,W.jsxs)(`form`,{className:`flex flex-col gap-3 py-5 last:pb-0`,onSubmit:e=>{e.preventDefault(),t.mutate({signup:!0,code:n.trim()||void 0})},children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`font-medium text-[0.9375rem]`,children:m(`account.new`)}),(0,W.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-3 leading-relaxed`,children:m(`account.newHint`)})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(w,{value:n,maxLength:64,autoComplete:`off`,spellCheck:!1,placeholder:m(`account.code`),"aria-label":m(`account.code`),onChange:e=>r(e.target.value),className:`w-56 font-mono text-[0.875rem]`}),(0,W.jsx)(T,{type:`submit`,variant:`secondary`,className:`h-11`,busy:t.isPending&&!!t.variables?.signup,children:m(`account.create`)})]}),(0,W.jsx)(Y,{...e})]}):null]})}var Ke={start:`account.kind.start`,monthly:`account.kind.monthly`,gift:`account.kind.gift`};function qe({account:e}){let t=a(),n=J(e.signedIn),r=l({mutationFn:()=>g.del(`/api/studio/account`),onSuccess:()=>t.invalidateQueries({queryKey:[`me`]})}),i=new Intl.DateTimeFormat(f,{dateStyle:`medium`});return(0,W.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 py-5 first:pt-0`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`truncate font-medium text-[0.9375rem]`,children:e.name||e.email}),e.signedIn?(0,W.jsx)(C,{tone:`live`,children:m(`account.linked`)}):null]}),(0,W.jsx)(`div`,{className:`truncate text-[0.875rem] text-ink-3`,children:e.email})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsxs)(T,{variant:`secondary`,onClick:()=>k(e.url),children:[m(`setup.openAccount`),` `,(0,W.jsx)(D,{className:`size-4`})]}),(0,W.jsxs)(T,{variant:`ghost`,busy:r.isPending,onClick:()=>r.mutate(),children:[(0,W.jsx)(B,{className:`size-4`}),` `,m(`nav.logout`)]})]})]}),e.signedIn?null:(0,W.jsxs)(`div`,{className:`flex flex-col gap-3 py-5`,children:[(0,W.jsx)(`p`,{className:`text-[0.875rem] text-ink-2`,children:m(`local.accountExpired`)}),(0,W.jsx)(`div`,{children:(0,W.jsx)(T,{busy:n.link.isPending,onClick:()=>n.link.mutate({}),children:m(`account.signInAgain`)})}),(0,W.jsx)(Y,{...n})]}),e.credits===null?null:(0,W.jsxs)(`div`,{className:`py-5`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:m(`account.credits`)}),(0,W.jsx)(`div`,{className:`font-display font-semibold text-[1.375rem] tabular-nums leading-tight`,children:m(`nav.credits`,{n:Math.floor(e.credits).toLocaleString()})})]}),(0,W.jsxs)(T,{variant:`secondary`,onClick:()=>k(`${e.url}/billing`),children:[m(`account.topUp`),` `,(0,W.jsx)(D,{className:`size-4`})]})]}),e.expiring.length?(0,W.jsx)(`ul`,{className:`mt-3 flex flex-col gap-1 text-[0.8125rem] text-ink-3 tabular-nums`,children:e.expiring.map(e=>(0,W.jsxs)(`li`,{children:[m(`account.expires`,{n:Math.floor(e.credits).toLocaleString(),date:i.format(new Date(e.expiresAt))}),Ke[e.kind]?(0,W.jsxs)(`span`,{className:`text-ink-4`,children:[` · `,m(Ke[e.kind])]}):null]},`${e.kind}:${e.expiresAt}`))}):null]}),(0,W.jsxs)(`div`,{className:`flex items-start gap-2.5 py-5 text-[0.875rem] text-ink-2 leading-snug last:pb-0`,children:[(0,W.jsx)(M,{className:`mt-0.5 size-4 shrink-0 text-cobalt`}),(0,W.jsx)(`p`,{children:m(`account.cloud`,{host:K(e.cloudUrl)})})]})]})}function Je({me:e,fromAccount:t}){let n=a(),[r,i]=(0,U.useState)(e.profile),o=e=>i(t=>({...t,...e})),s=Fe(r,async e=>{await g.put(`/api/studio/profile`,e),await n.invalidateQueries({queryKey:[`me`]})});return(0,W.jsx)(G,{title:m(`account.profile`),hint:m(`account.hint`),save:s,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-6 sm:flex-row sm:gap-8`,children:[(0,W.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-2 sm:w-32`,children:[(0,W.jsx)(`div`,{className:`flex size-20 items-center justify-center overflow-hidden rounded-full bg-ember-tint font-semibold text-[1.75rem] text-ember-strong ring-1 ring-border-soft`,children:e.user.image?(0,W.jsx)(`img`,{src:e.user.image,alt:``,className:`size-full object-cover`}):d(r.name)||`?`}),(0,W.jsx)(`p`,{className:`text-center text-[0.75rem] text-ink-3 leading-snug`,children:m(`account.initials`)})]}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(y,{children:m(`account.name`)}),(0,W.jsx)(w,{value:r.name,maxLength:80,disabled:t,onChange:e=>o({name:e.target.value})}),(0,W.jsx)(`p`,{className:We,children:m(t?`account.fromAccount`:`account.nameHint`)})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(y,{children:m(`account.about`)}),(0,W.jsx)(oe,{minRows:3,maxLength:2e3,value:r.about,onChange:e=>o({about:e.target.value})}),(0,W.jsx)(`p`,{className:We,children:m(`account.aboutHint`)})]}),(0,W.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(y,{children:m(`account.email`)}),(0,W.jsx)(w,{type:`email`,value:r.email,maxLength:200,disabled:t,onChange:e=>o({email:e.target.value})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(y,{children:m(`account.phone`)}),(0,W.jsx)(w,{type:`tel`,value:r.phone,maxLength:40,onChange:e=>o({phone:e.target.value})})]})]})]})]})})}function Ye({me:e}){let t=e.mode===`managed`,n=t||!!e.account;return(0,W.jsxs)(`div`,{className:`flex flex-col gap-9`,children:[(0,W.jsx)(G,{title:m(`account.connection`),hint:m(`account.connectionHint`),children:t?(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`truncate font-medium text-[0.9375rem]`,children:e.user.name}),(0,W.jsx)(C,{tone:`live`,children:m(`account.linked`)})]}),(0,W.jsx)(`div`,{className:`truncate text-[0.875rem] text-ink-3`,children:e.user.email})]}),e.manageUrl?(0,W.jsxs)(T,{variant:`secondary`,onClick:()=>k(`${e.manageUrl}/account`),children:[m(`setup.openAccount`),` `,(0,W.jsx)(D,{className:`size-4`})]}):null]}):e.account?(0,W.jsx)(qe,{account:e.account}):(0,W.jsx)(Ge,{})}),(0,W.jsx)(Je,{me:e,fromAccount:n},n?`account`:`own`),(0,W.jsx)(G,{title:m(`account.look`),hint:m(`account.lookHint`),children:(0,W.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pb-4`,children:[(0,W.jsx)(`span`,{className:`font-medium text-[0.875rem]`,children:m(`nav.language`)}),(0,W.jsx)(_e,{tone:`surface`})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pt-4`,children:[(0,W.jsx)(`span`,{className:`font-medium text-[0.875rem]`,children:m(`nav.theme`)}),(0,W.jsx)(ve,{})]})]})})]})}var Xe={steps:ke,chat:Ce,talk:ne,whatsapp:Se,sms:Te,call:De,video:ge},Ze=e=>Xe[e]??fe,X=[`steps`,`chat`];function Qe(){return o({queryKey:[`runners`],queryFn:()=>g.get(`/api/studio/runners`),staleTime:6e4})}function Z(e,t){let n=new Set(t.map(e=>e.id)),r=(e.runners?.enabled??X).filter(e=>n.has(e)),i=e.runners?.default??`steps`;return[...r].sort((e,t)=>e===i?-1:+(t===i))}function $e({w:e,runners:t}){let n=Z(e,t),r=e.runners?.default??`steps`;return(0,W.jsx)(`span`,{className:`inline-flex items-center gap-1.5`,children:n.map(e=>{let n=Ze(e),i=t.find(t=>t.id===e)?.label[f]??e;return(0,W.jsx)(n,{"aria-label":i,className:S(`size-3.5`,e===r?`text-ink-2`:`text-ink-4`),children:(0,W.jsx)(`title`,{children:i})},e)})})}function et({wizards:e,runners:t,value:n,onChange:r}){let i=new Map;for(let n of e)for(let e of Z(n,t))i.set(e,(i.get(e)??0)+1);if(!([...i.keys()].some(e=>!X.includes(e))||t.some(e=>!X.includes(e.id)&&!e.problem)))return null;let a=e=>S(`inline-flex h-8 items-center gap-1.5 rounded-full px-3 font-medium text-[0.8125rem] transition`,e?`bg-paper-2 text-ink`:`text-ink-3 hover:text-ink`);return(0,W.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-1`,children:[(0,W.jsx)(`button`,{type:`button`,className:a(n===null),onClick:()=>r(null),children:m(`home.allChannels`)}),t.filter(e=>i.has(e.id)).map(e=>{let t=Ze(e.id);return(0,W.jsxs)(`button`,{type:`button`,"aria-pressed":n===e.id,className:a(n===e.id),onClick:()=>r(n===e.id?null:e.id),children:[(0,W.jsx)(t,{className:`size-3.5`}),e.label[f],(0,W.jsx)(`span`,{className:`text-[0.75rem] text-ink-4`,children:i.get(e.id)})]},e.id)})]})}var tt=t({HomePage:()=>st,NewSpaceDialog:()=>Q,ProjectSwitcher:()=>nt});function Q({open:e,onClose:t}){let{select:n}=u(),r=a(),[i,o]=(0,U.useState)(``),s=l({mutationFn:()=>g.post(`/api/studio/projects`,{name:i}),onSuccess:async({id:e})=>{await r.invalidateQueries({queryKey:[`projects`]}),n(e),o(``),t()}});return(0,W.jsx)(se,{open:e,onClose:t,title:m(`home.newProject`),children:(0,W.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),i.trim()&&s.mutate()},children:[(0,W.jsx)(w,{autoFocus:!0,placeholder:m(`home.projectName`),value:i,onChange:e=>o(e.target.value)}),(0,W.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,W.jsx)(T,{variant:`ghost`,onClick:t,children:m(`common.cancel`)}),(0,W.jsx)(T,{type:`submit`,busy:s.isPending,disabled:!i.trim(),children:m(`home.newProject`)})]})]})})}function nt(){let{project:e,projects:t,select:n}=u(),r=c().data?.limits.projects??1,i=s(),[a,o]=(0,U.useState)(!1);return!e||r!==null&&r<=1?null:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(ae,{className:`w-56`,value:e.id,onChange:e=>e===`__new`?o(!0):n(e),options:[...t.map(e=>({value:e.id,label:e.name})),...i?[r===null||t.length<r?{value:`__new`,label:`+ ${m(`home.newProject`)}`}:{value:`__new`,label:m(`home.projectLimit`,{n:r}),disabled:!0}]:[]]}),(0,W.jsx)(Q,{open:a,onClose:()=>o(!1)})]})}function rt({url:e}){let[t,n]=(0,U.useState)(!1);return(0,W.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},className:`inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[0.8125rem] text-ink-3 hover:bg-accent hover:text-ink`,children:[t?(0,W.jsx)(v,{className:`size-3.5`}):(0,W.jsx)(E,{className:`size-3.5`}),m(t?`share.copied`:`share.link`)]})}function it(){let e=b(),t=J(!1),[n,r]=(0,U.useState)(!1),i=(0,U.useRef)(null);return(0,U.useEffect)(()=>{if(!n)return;let e=e=>{i.current?.contains(e.target)||r(!1)},t=e=>{e.key===`Escape`&&r(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[n]),(0,W.jsxs)(`div`,{className:`relative`,ref:i,onClick:e=>e.stopPropagation(),children:[(0,W.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>r(e=>!e),className:`inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[0.8125rem] text-ink-3 hover:bg-accent hover:text-ink`,children:[(0,W.jsx)(E,{className:`size-3.5`}),` `,m(`share.link`)]}),n?(0,W.jsxs)(`div`,{className:`absolute right-0 bottom-10 z-20 flex w-72 animate-rise flex-col gap-3 rounded-xl bg-card p-3.5 shadow-overlay ring-1 ring-border-soft`,children:[(0,W.jsx)(`p`,{className:`text-[0.8125rem] text-ink-2 leading-relaxed`,children:m(`teaser.link`)}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(T,{size:`sm`,busy:t.link.isPending,onClick:()=>t.link.mutate({}),children:m(`account.signIn`)}),(0,W.jsx)(T,{size:`sm`,variant:`secondary`,onClick:()=>e(`/settings/account`),children:m(`account.create`)})]}),(0,W.jsx)(Y,{...t})]}):null]})}function at({w:e,me:t,runners:n}){let r=b(),a=Ve(e,t,e.cloud),o=He(a),s=o??(e.published?q(e):null);return(0,W.jsxs)(`div`,{className:`relative pt-6`,children:[(0,W.jsx)(`div`,{className:`pointer-events-none absolute top-0 left-4 z-10`,children:(0,W.jsx)(i,{kind:e.avatar,size:52})}),(0,W.jsxs)(ce,{className:`relative flex h-full cursor-pointer flex-col px-5 pt-10 pb-3 transition hover:shadow-elevated`,onClick:()=>r(`/edit/${e.id}`),children:[(0,W.jsx)(`div`,{className:`absolute top-3 right-3`,children:e.published?(0,W.jsx)(Ue,{where:a,me:t}):(0,W.jsx)(C,{children:m(`home.draft`)})}),(0,W.jsx)(`h3`,{className:`font-display font-semibold text-[1.0625rem] leading-snug`,children:e.title}),(0,W.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[0.875rem] text-ink-3`,children:e.description}),(0,W.jsxs)(`div`,{className:`mt-auto flex min-h-8 items-center justify-between pt-3`,children:[(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-2.5 text-[0.75rem] text-ink-4`,children:[m(`home.steps`,{n:e.stepCount}),(0,W.jsx)($e,{w:e,runners:n})]}),(0,W.jsxs)(`div`,{className:`flex items-center`,children:[o?(0,W.jsx)(rt,{url:o}):a.kind===`here`&&O.account?(0,W.jsx)(it,{}):null,s?(0,W.jsx)(le,{label:m(o?`share.open`:`share.openHere`),className:`ml-1 size-8`,onClick:e=>{e.stopPropagation(),k(s)},children:(0,W.jsx)(ye,{className:`size-4`})}):null]})]})]})]})}var $=`curl -fsSL https://engenty.ai/install.sh | bash`;function ot(){let[e,t]=(0,U.useState)(!1),n=[m(`home.local.install`),m(`home.local.signIn`),m(`home.local.publish`)];return(0,W.jsxs)(`div`,{className:`mx-auto flex max-w-xl animate-rise flex-col items-center pt-4 text-center`,children:[(0,W.jsx)(i,{kind:`round`,size:120}),(0,W.jsx)(`h1`,{className:`mt-2 font-display font-semibold text-[1.75rem] leading-tight tracking-tight`,children:m(`home.local.title`)}),(0,W.jsx)(`p`,{className:`mt-3 text-[0.9375rem] text-ink-2 leading-relaxed`,children:m(`home.local.text`)}),(0,W.jsx)(`ol`,{className:`mt-8 flex w-full flex-col gap-4 text-left`,children:n.map((n,r)=>(0,W.jsxs)(`li`,{className:`flex gap-3`,children:[(0,W.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-full bg-paper-2 font-medium text-[0.8125rem] text-ink-2`,children:r+1}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,W.jsx)(`p`,{className:`text-[0.9375rem] leading-snug`,children:n}),r===0?(0,W.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 rounded-lg bg-paper-2 py-1.5 pr-1.5 pl-3`,children:[(0,W.jsx)(`code`,{className:`min-w-0 flex-1 select-all overflow-x-auto whitespace-nowrap font-mono text-[0.8125rem] text-ink-2`,children:$}),(0,W.jsxs)(T,{variant:`secondary`,size:`sm`,onClick:()=>{navigator.clipboard.writeText($),t(!0),setTimeout(()=>t(!1),1500)},children:[e?(0,W.jsx)(v,{className:`size-3.5`}):(0,W.jsx)(E,{className:`size-3.5`}),m(e?`share.copied`:`share.copy`)]})]}):null]})]},n))})]})}function st(){let e=b(),{project:t,projects:n,loading:r}=u(),i=c().data,a=ee(),l=s(),d=o({queryKey:[`wizards`,t?.id,!!i?.account],queryFn:()=>g.get(`/api/studio/projects/${t.id}/wizards`),enabled:!!t}),p=Qe().data??[],[h,ne]=(0,U.useState)(null),_=(d.data??[]).filter(e=>!h||Z(e,p).includes(h)),v=n.reduce((e,t)=>e+t.wizardCount,0),y=l&&!t?.readOnly;return!r&&y&&n.length&&v===0?(0,W.jsx)(re,{to:`/new`,replace:!0}):!r&&!a&&n.length===0?(0,W.jsx)(ot,{}):(0,W.jsxs)(`div`,{className:`animate-rise`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4`,children:[(0,W.jsx)(`h1`,{className:`font-display font-semibold text-[1.75rem] tracking-tight`,children:m(`home.title`)}),y?(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(he,{}),(0,W.jsxs)(T,{onClick:()=>e(`/new`),children:[(0,W.jsx)(te,{className:`size-4`}),` `,m(`home.new`)]})]}):null]}),t?.origin===`local`?(0,W.jsxs)(`p`,{className:`mt-2 text-[0.875rem] text-ink-3`,children:[m(`home.fromLocal`),` `,t.syncedAt?m(`home.syncedAt`,{when:new Intl.DateTimeFormat(f,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(t.syncedAt))}):null]}):null,d.data&&d.data.length===0?(0,W.jsx)(ie,{children:m(`home.empty`)}):null,d.data?.length?(0,W.jsx)(et,{wizards:d.data,runners:p,value:h,onChange:ne}):null,(0,W.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i?_.map(e=>(0,W.jsx)(at,{w:e,me:i,runners:p},e.id)):null})]})}export{Ce as C,M as D,F as E,je as S,L as T,Ie as _,Y as a,Ne as b,K as c,Ve as d,Le as f,G as g,ze as h,Ye as i,q as l,Re as m,Q as n,J as o,Be as p,nt as r,Ue as s,tt as t,He as u,Me as v,B as w,Pe as x,Fe as y};
1
+ import{a as e,i as t,n,t as r}from"./jsx-runtime-D3jfb0Ew.js";import{B as i,O as a,dt as o}from"./definition-CfFlylCM.js";import{d as s,f as c,m as l,s as u,t as d,u as ee}from"./session-C24kIPr-.js";import{A as f,I as te,K as p,M as m,O as h,R as ne,S as g,T as _,U as v,X as re,a as ie,c as y,d as ae,et as b,f as x,g as S,h as oe,i as se,n as ce,o as le,r as C,s as w,t as T,z as ue}from"./ui-C4b__6Oo.js";import{a as de,i as fe,o as pe,r as me,t as he}from"./ImportWizard-CHlCjPEo.js";import{t as E}from"./copy-BAtcCufT.js";import{t as D}from"./external-link-DitV3n6l.js";import{t as ge}from"./video-D04-GeyG.js";import{a as O,i as _e,r as k,t as ve}from"./ThemeSwitch-DN42WOTx.js";var A={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};A.node;var ye=p(A),j={name:`cloud`,size:24,node:[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]};j.node;var M=p(j),N={name:`hard-drive`,size:24,node:[[`path`,{d:`M10 16h.01`,key:`1bzywj`}],[`path`,{d:`M2.212 11.577a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`18tbho`}],[`path`,{d:`M21.946 12.013H2.054`,key:`zqlbp7`}],[`path`,{d:`M6 16h.01`,key:`1pmjb7`}]]};N.node;var be=p(N),P={name:`laptop`,size:24,node:[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]};P.node;var F=p(P),I={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};I.node;var L=p(I),R={name:`list`,size:24,node:[[`path`,{d:`M3 5h.01`,key:`18ugdj`}],[`path`,{d:`M3 12h.01`,key:`nlz23k`}],[`path`,{d:`M3 19h.01`,key:`noohij`}],[`path`,{d:`M8 5h13`,key:`1pao27`}],[`path`,{d:`M8 12h13`,key:`1za7za`}],[`path`,{d:`M8 19h13`,key:`m83p4d`}]]};R.node;var xe=p(R),z={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};z.node;var B=p(z),V={name:`message-circle-more`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}]]};V.node;var Se=p(V),H={name:`message-circle`,size:24,node:[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]};H.node;var Ce=p(H),we={name:`message-square-text`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]};we.node;var Te=p(we),Ee={name:`phone-call`,size:24,node:[[`path`,{d:`M13 2a9 9 0 0 1 9 9`,key:`1itnx2`}],[`path`,{d:`M13 6a5 5 0 0 1 5 5`,key:`11nki7`}],[`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`}]]};Ee.node;var De=p(Ee),Oe={name:`rows-3`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]],aliases:[`panels-top-bottom`]};Oe.node;var ke=p(Oe),U=e(n(),1),Ae=e=>[`project-files`,e];function je(e){return i({queryKey:Ae(e),queryFn:()=>g.get(`/api/studio/projects/${e}/files`),refetchInterval:e=>e.state.data?.files.some(e=>e.status===`pending`)?2e3:!1})}function Me(e,t){return h(`/api/studio/projects/${e}/files/${t}/content`)}function Ne(e,t=!1){let n=o(),[r,i]=(0,U.useState)(!1),[a,s]=(0,U.useState)(null),c=()=>n.invalidateQueries({queryKey:Ae(e)}),l=async e=>{s(null);try{await e()}catch(e){s(e.message)}finally{await c()}};return{busy:r,error:a,readOnly:t,upload:async(t,n)=>{i(!0),await l(async()=>{for(let r of n)await g.upload(`/api/studio/projects/${e}/files?kind=${t}`,r),await c()}),i(!1)},describe:(t,n)=>l(()=>g.patch(`/api/studio/projects/${e}/files/${t}`,{description:n})),remove:t=>l(()=>g.del(`/api/studio/projects/${e}/files/${t}`)),reindex:t=>l(()=>g.post(`/api/studio/projects/${e}/files/${t}/reindex`)),order:(t,n)=>l(()=>g.put(`/api/studio/projects/${e}/files/order`,{kind:t,ids:n}))}}function Pe(e,t){let n=`wz.layout.${e}`,[r,i]=(0,U.useState)(()=>{try{let e=localStorage.getItem(n);return e===`list`||e===`cards`?e:t}catch{return t}});return[r,()=>i(e=>{let t=e===`list`?`cards`:`list`;try{localStorage.setItem(n,t)}catch{}return t})]}function Fe(e,t,n=700){let[r,i]=(0,U.useState)(`idle`),[a,o]=(0,U.useState)(null),s=JSON.stringify(e),c=(0,U.useRef)(s),l=(0,U.useRef)({value:e,json:s,save:t});l.current={value:e,json:s,save:t};let u=(0,U.useRef)(Promise.resolve()),d=(0,U.useCallback)(()=>{let e=l.current;e.json!==c.current&&(c.current=e.json,i(`saving`),u.current=u.current.then(async()=>{try{await e.save(e.value),o(null),i(`saved`)}catch(e){c.current=``,o(e.message),i(`error`)}}))},[]);return(0,U.useEffect)(()=>{if(s===c.current)return;let e=setTimeout(d,n);return()=>clearTimeout(e)},[s,n,d]),(0,U.useEffect)(()=>d,[d]),{state:r,error:a}}function Ie(e){return e<1e6?`${Math.max(1,Math.round(e/1e3))} KB`:`${(e/1e6).toFixed(1)} MB`}var W=e(r(),1);function Le({id:e,children:t}){return(0,W.jsx)(`div`,{id:e,className:`scroll-mt-6 max-md:scroll-mt-20`,children:t})}function G({title:e,hint:t,save:n,action:r,locked:i,plain:a,children:o}){return(0,W.jsxs)(`section`,{className:`flex flex-col gap-2.5`,children:[(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-1`,children:[(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(`h2`,{className:`font-display font-semibold text-lg leading-tight`,children:e}),n?.state===`saving`?(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[0.75rem] text-ink-3`,children:[(0,W.jsx)(x,{className:`size-3`}),` `,m(`project.saving`)]}):n?.state===`saved`?(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-[0.75rem] text-moss`,children:[(0,W.jsx)(v,{className:`size-3.5`}),` `,m(`settings.saved`)]}):null]}),t?(0,W.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-3 leading-snug`,children:t}):null]}),r?(0,W.jsx)(`div`,{className:`shrink-0`,children:r}):null]}),a?o:(0,W.jsxs)(ce,{className:`p-3.5 sm:p-5`,children:[i?(0,W.jsx)(`fieldset`,{disabled:!0,className:`min-w-0`,children:o}):o,n?.state===`error`&&n.error?(0,W.jsx)(`p`,{className:`mt-4 text-[0.875rem] text-rose`,children:n.error}):null]})]})}function Re({children:e,layout:t,onToggle:n}){return(0,W.jsxs)(`div`,{className:`mb-3 flex items-start gap-2`,children:[(0,W.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,W.jsx)(`div`,{className:`w-56 max-w-full transition-[width] duration-200 focus-within:w-full has-[input:not(:placeholder-shown)]:w-full`,children:e})}),(0,W.jsx)(le,{label:m(t===`list`?`project.viewCards`:`project.viewList`),onClick:n,children:t===`list`?(0,W.jsx)(L,{className:`size-4`}):(0,W.jsx)(xe,{className:`size-4`})})]})}function ze({value:e,onChange:t,onEnter:n,placeholder:r,busy:i}){return(0,W.jsxs)(`div`,{className:`relative`,children:[(0,W.jsx)(me,{className:`-translate-y-1/2 pointer-events-none absolute top-1/2 left-3 size-4 text-ink-4`}),(0,W.jsx)(`input`,{type:`search`,value:e,placeholder:r,onChange:e=>t(e.target.value),onKeyDown:e=>e.key===`Enter`&&n?.(),className:`h-9 w-full rounded-lg border border-input bg-card pr-3 pl-9 text-[0.875rem] text-ink outline-none transition placeholder:text-ink-4 focus:border-focus focus:ring-4 focus:ring-focus-glow`}),i?(0,W.jsx)(x,{className:`-translate-y-1/2 absolute top-1/2 right-3 size-4 text-ink-3`}):null]})}function Be({onFiles:e,accept:t,multiple:n=!0,className:r,children:i}){return(0,W.jsxs)(`label`,{onDragOver:e=>{e.preventDefault(),e.currentTarget.dataset.over=`1`},onDragLeave:e=>{delete e.currentTarget.dataset.over},onDrop:t=>{t.preventDefault(),delete t.currentTarget.dataset.over;let r=Array.from(t.dataTransfer.files);r.length&&e(n?r:r.slice(0,1))},className:S(`flex cursor-pointer items-center justify-center gap-2 rounded-lg border border-input border-dashed text-[0.875rem] text-ink-3 transition focus-within:border-focus focus-within:ring-4 focus-within:ring-focus-glow hover:border-ink-4 hover:text-ink data-[over]:border-focus data-[over]:bg-paper-2 data-[over]:text-ink`,r),children:[i,(0,W.jsx)(`input`,{className:`sr-only`,type:`file`,accept:t,multiple:n,onChange:t=>{let n=Array.from(t.target.files??[]);t.target.value=``,n.length&&e(n)}})]})}function K(e){try{return new URL(e).host}catch{return e}}var q=e=>`${window.location.origin}${_}/w/${e.shareToken}`;function Ve(e,t,n){if(!e.published)return{kind:`draft`};if(t.mode===`managed`)return{kind:`live`,url:q(e),runs:e.publishedVersion??0,notes:0,cloud:!1};if(!t.account||n===null)return{kind:`here`};if(n===void 0)return{kind:`unknown`};let{copy:r,error:i}=n,a=r?.publishedVersion??null,o=r&&a!==null?r.shareUrl:null;return i?.again?{kind:`sending`,url:o,runs:a,again:i.again}:i?{kind:`missing`,url:o,runs:a,why:i.message}:!r||r.version<(e.publishedVersion??0)?{kind:`missing`,url:o,runs:a,why:m(`cloud.notSent`)}:!r.runnable||!o||a===null?{kind:`missing`,url:o,runs:a,why:`${m(`cloud.notRunnable`,{v:r.version})} ${a===null?m(`cloud.nothingRuns`):m(`cloud.keepsRunning`,{v:a})}`}:{kind:`live`,url:o,runs:a,notes:r.problems.filter(e=>!e.blocking).length,cloud:!0}}function He(e){return e.kind===`live`||e.kind===`sending`||e.kind===`missing`?e.url:null}function Ue({where:e,me:t,version:n}){let r=K(t.account?.cloudUrl??``),i=`size-3.5`;switch(e.kind){case`draft`:return null;case`unknown`:return(0,W.jsx)(C,{tone:`live`,children:m(`home.live`)});case`here`:return(0,W.jsx)(C,{icon:(0,W.jsx)(F,{className:i}),title:m(`where.hereHint`),children:n?m(`where.hereVersion`,{v:n}):m(`where.here`)});case`live`:{let t=n?m(`editor.published`,{v:e.runs}):m(`home.live`),a=e.notes===1?m(`where.note`):e.notes>1?m(`where.notes`,{n:e.notes}):null;return(0,W.jsx)(C,{tone:`live`,icon:e.cloud?(0,W.jsx)(M,{className:i}):void 0,title:e.cloud?m(`where.liveHint`,{host:r}):void 0,children:a?`${t} · ${a}`:t})}case`sending`:return(0,W.jsx)(C,{tone:`warn`,icon:(0,W.jsx)(ue,{className:i}),title:m(`cloud.again`,{when:new Intl.DateTimeFormat(f,{timeStyle:`short`}).format(new Date(e.again))}),children:m(`where.sending`)});case`missing`:return(0,W.jsx)(C,{tone:`warn`,icon:(0,W.jsx)(pe,{className:i}),title:e.why,children:e.runs===null?m(`where.missing`):m(`editor.published`,{v:e.runs})})}}var We=`mt-1.5 text-[0.8125rem] text-ink-3`;function J(e){let t=o(),[n,r]=(0,U.useState)(!1),i=l({mutationFn:e=>g.post(`/api/studio/account/link`,e),onSuccess:({url:e})=>{k(e),r(!0)}});return(0,U.useEffect)(()=>{if(!n)return;let e=setInterval(()=>void t.invalidateQueries({queryKey:[`me`]}),2e3),i=setTimeout(()=>r(!1),3e5);return()=>{clearInterval(e),clearTimeout(i)}},[n,t]),(0,U.useEffect)(()=>{e&&r(!1)},[e]),{link:i,waiting:n}}function Y({link:e,waiting:t}){return e.isError?(0,W.jsx)(`p`,{className:`text-[0.8125rem] text-rose`,children:m(`local.accountFailed`)}):t?(0,W.jsxs)(`p`,{className:`flex items-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,W.jsx)(x,{className:`size-3.5`}),` `,m(`local.accountWaiting`)]}):null}function Ge(){let e=J(!1),{link:t}=e,[n,r]=(0,U.useState)(``);return(0,W.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-4 py-5 first:pt-0 last:pb-0`,children:[(0,W.jsx)(`div`,{className:`flex size-11 shrink-0 items-center justify-center rounded-full bg-paper-2 text-ink-2`,children:(0,W.jsx)(be,{className:`size-5`})}),(0,W.jsxs)(`div`,{className:`min-w-0`,children:[(0,W.jsx)(`div`,{className:`font-medium text-[0.9375rem]`,children:m(`account.local`)}),(0,W.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-3 leading-relaxed`,children:m(`account.localText`)})]})]}),O.account?(0,W.jsxs)(`div`,{className:`flex flex-col gap-4 py-5 last:pb-0`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`font-medium text-[0.9375rem]`,children:m(`account.with`)}),(0,W.jsxs)(`ul`,{className:`mt-2 flex flex-col gap-2 text-[0.875rem] text-ink-2 leading-snug`,children:[(0,W.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,W.jsx)(de,{className:`mt-0.5 size-4 shrink-0 text-amber`}),m(`account.withCredits`)]}),(0,W.jsxs)(`li`,{className:`flex items-start gap-2.5`,children:[(0,W.jsx)(M,{className:`mt-0.5 size-4 shrink-0 text-cobalt`}),m(`account.withCloud`)]})]})]}),(0,W.jsx)(`div`,{children:(0,W.jsx)(T,{busy:t.isPending&&!t.variables?.signup,onClick:()=>t.mutate({}),children:m(`account.signIn`)})})]}):null,O.account?(0,W.jsxs)(`form`,{className:`flex flex-col gap-3 py-5 last:pb-0`,onSubmit:e=>{e.preventDefault(),t.mutate({signup:!0,code:n.trim()||void 0})},children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`font-medium text-[0.9375rem]`,children:m(`account.new`)}),(0,W.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-3 leading-relaxed`,children:m(`account.newHint`)})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(w,{value:n,maxLength:64,autoComplete:`off`,spellCheck:!1,placeholder:m(`account.code`),"aria-label":m(`account.code`),onChange:e=>r(e.target.value),className:`w-56 font-mono text-[0.875rem]`}),(0,W.jsx)(T,{type:`submit`,variant:`secondary`,className:`h-11`,busy:t.isPending&&!!t.variables?.signup,children:m(`account.create`)})]}),(0,W.jsx)(Y,{...e})]}):null]})}var Ke={start:`account.kind.start`,monthly:`account.kind.monthly`,gift:`account.kind.gift`};function qe({account:e}){let t=o(),n=J(e.signedIn),r=l({mutationFn:()=>g.del(`/api/studio/account`),onSuccess:()=>t.invalidateQueries({queryKey:[`me`]})}),i=new Intl.DateTimeFormat(f,{dateStyle:`medium`});return(0,W.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3 py-5 first:pt-0`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`truncate font-medium text-[0.9375rem]`,children:e.name||e.email}),e.signedIn?(0,W.jsx)(C,{tone:`live`,children:m(`account.linked`)}):null]}),(0,W.jsx)(`div`,{className:`truncate text-[0.875rem] text-ink-3`,children:e.email})]}),(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsxs)(T,{variant:`secondary`,onClick:()=>k(e.url),children:[m(`setup.openAccount`),` `,(0,W.jsx)(D,{className:`size-4`})]}),(0,W.jsxs)(T,{variant:`ghost`,busy:r.isPending,onClick:()=>r.mutate(),children:[(0,W.jsx)(B,{className:`size-4`}),` `,m(`nav.logout`)]})]})]}),e.signedIn?null:(0,W.jsxs)(`div`,{className:`flex flex-col gap-3 py-5`,children:[(0,W.jsx)(`p`,{className:`text-[0.875rem] text-ink-2`,children:m(`local.accountExpired`)}),(0,W.jsx)(`div`,{children:(0,W.jsx)(T,{busy:n.link.isPending,onClick:()=>n.link.mutate({}),children:m(`account.signInAgain`)})}),(0,W.jsx)(Y,{...n})]}),e.credits===null?null:(0,W.jsxs)(`div`,{className:`py-5`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`text-[0.8125rem] text-ink-3`,children:m(`account.credits`)}),(0,W.jsx)(`div`,{className:`font-display font-semibold text-[1.375rem] tabular-nums leading-tight`,children:m(`nav.credits`,{n:Math.floor(e.credits).toLocaleString()})})]}),(0,W.jsxs)(T,{variant:`secondary`,onClick:()=>k(`${e.url}/billing`),children:[m(`account.topUp`),` `,(0,W.jsx)(D,{className:`size-4`})]})]}),e.expiring.length?(0,W.jsx)(`ul`,{className:`mt-3 flex flex-col gap-1 text-[0.8125rem] text-ink-3 tabular-nums`,children:e.expiring.map(e=>(0,W.jsxs)(`li`,{children:[m(`account.expires`,{n:Math.floor(e.credits).toLocaleString(),date:i.format(new Date(e.expiresAt))}),Ke[e.kind]?(0,W.jsxs)(`span`,{className:`text-ink-4`,children:[` · `,m(Ke[e.kind])]}):null]},`${e.kind}:${e.expiresAt}`))}):null]}),(0,W.jsxs)(`div`,{className:`flex items-start gap-2.5 py-5 text-[0.875rem] text-ink-2 leading-snug last:pb-0`,children:[(0,W.jsx)(M,{className:`mt-0.5 size-4 shrink-0 text-cobalt`}),(0,W.jsx)(`p`,{children:m(`account.cloud`,{host:K(e.cloudUrl)})})]})]})}function Je({me:e,fromAccount:t}){let n=o(),[r,i]=(0,U.useState)(e.profile),a=e=>i(t=>({...t,...e})),s=Fe(r,async e=>{await g.put(`/api/studio/profile`,e),await n.invalidateQueries({queryKey:[`me`]})});return(0,W.jsx)(G,{title:m(`account.profile`),hint:m(`account.hint`),save:s,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-6 sm:flex-row sm:gap-8`,children:[(0,W.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-2 sm:w-32`,children:[(0,W.jsx)(`div`,{className:`flex size-20 items-center justify-center overflow-hidden rounded-full bg-ember-tint font-semibold text-[1.75rem] text-ember-strong ring-1 ring-border-soft`,children:e.user.image?(0,W.jsx)(`img`,{src:e.user.image,alt:``,className:`size-full object-cover`}):d(r.name)||`?`}),(0,W.jsx)(`p`,{className:`text-center text-[0.75rem] text-ink-3 leading-snug`,children:m(`account.initials`)})]}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-5`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(y,{children:m(`account.name`)}),(0,W.jsx)(w,{value:r.name,maxLength:80,disabled:t,onChange:e=>a({name:e.target.value})}),(0,W.jsx)(`p`,{className:We,children:m(t?`account.fromAccount`:`account.nameHint`)})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(y,{children:m(`account.about`)}),(0,W.jsx)(oe,{minRows:3,maxLength:2e3,value:r.about,onChange:e=>a({about:e.target.value})}),(0,W.jsx)(`p`,{className:We,children:m(`account.aboutHint`)})]}),(0,W.jsxs)(`div`,{className:`grid gap-5 sm:grid-cols-2`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(y,{children:m(`account.email`)}),(0,W.jsx)(w,{type:`email`,value:r.email,maxLength:200,disabled:t,onChange:e=>a({email:e.target.value})})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(y,{children:m(`account.phone`)}),(0,W.jsx)(w,{type:`tel`,value:r.phone,maxLength:40,onChange:e=>a({phone:e.target.value})})]})]})]})]})})}function Ye({me:e}){let t=e.mode===`managed`,n=t||!!e.account;return(0,W.jsxs)(`div`,{className:`flex flex-col gap-9`,children:[(0,W.jsx)(G,{title:m(`account.connection`),hint:m(`account.connectionHint`),children:t?(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`truncate font-medium text-[0.9375rem]`,children:e.user.name}),(0,W.jsx)(C,{tone:`live`,children:m(`account.linked`)})]}),(0,W.jsx)(`div`,{className:`truncate text-[0.875rem] text-ink-3`,children:e.user.email})]}),e.manageUrl?(0,W.jsxs)(T,{variant:`secondary`,onClick:()=>k(`${e.manageUrl}/account`),children:[m(`setup.openAccount`),` `,(0,W.jsx)(D,{className:`size-4`})]}):null]}):e.account?(0,W.jsx)(qe,{account:e.account}):(0,W.jsx)(Ge,{})}),(0,W.jsx)(Je,{me:e,fromAccount:n},n?`account`:`own`),(0,W.jsx)(G,{title:m(`account.look`),hint:m(`account.lookHint`),children:(0,W.jsxs)(`div`,{className:`flex flex-col divide-y divide-border-soft`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pb-4`,children:[(0,W.jsx)(`span`,{className:`font-medium text-[0.875rem]`,children:m(`nav.language`)}),(0,W.jsx)(_e,{tone:`surface`})]}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-4 pt-4`,children:[(0,W.jsx)(`span`,{className:`font-medium text-[0.875rem]`,children:m(`nav.theme`)}),(0,W.jsx)(ve,{})]})]})})]})}var Xe={steps:ke,chat:Ce,talk:ne,whatsapp:Se,sms:Te,call:De,video:ge},Ze=e=>Xe[e]??fe,X=[`steps`,`chat`];function Qe(){return i({queryKey:[`runners`],queryFn:()=>g.get(`/api/studio/runners`),staleTime:6e4})}function Z(e,t){let n=new Set(t.map(e=>e.id)),r=(e.runners?.enabled??X).filter(e=>n.has(e)),i=e.runners?.default??`steps`;return[...r].sort((e,t)=>e===i?-1:+(t===i))}function $e({w:e,runners:t}){let n=Z(e,t),r=e.runners?.default??`steps`;return(0,W.jsx)(`span`,{className:`inline-flex items-center gap-1.5`,children:n.map(e=>{let n=Ze(e),i=t.find(t=>t.id===e)?.label[f]??e;return(0,W.jsx)(n,{"aria-label":i,className:S(`size-3.5`,e===r?`text-ink-2`:`text-ink-4`),children:(0,W.jsx)(`title`,{children:i})},e)})})}function et({wizards:e,runners:t,value:n,onChange:r}){let i=new Map;for(let n of e)for(let e of Z(n,t))i.set(e,(i.get(e)??0)+1);if(!([...i.keys()].some(e=>!X.includes(e))||t.some(e=>!X.includes(e.id)&&!e.problem)))return null;let a=e=>S(`inline-flex h-8 items-center gap-1.5 rounded-full px-3 font-medium text-[0.8125rem] transition`,e?`bg-paper-2 text-ink`:`text-ink-3 hover:text-ink`);return(0,W.jsxs)(`div`,{className:`mt-5 flex flex-wrap items-center gap-1`,children:[(0,W.jsx)(`button`,{type:`button`,className:a(n===null),onClick:()=>r(null),children:m(`home.allChannels`)}),t.filter(e=>i.has(e.id)).map(e=>{let t=Ze(e.id);return(0,W.jsxs)(`button`,{type:`button`,"aria-pressed":n===e.id,className:a(n===e.id),onClick:()=>r(n===e.id?null:e.id),children:[(0,W.jsx)(t,{className:`size-3.5`}),e.label[f],(0,W.jsx)(`span`,{className:`text-[0.75rem] text-ink-4`,children:i.get(e.id)})]},e.id)})]})}var tt=t({HomePage:()=>st,NewSpaceDialog:()=>Q,ProjectSwitcher:()=>nt});function Q({open:e,onClose:t}){let{select:n}=u(),r=o(),[i,a]=(0,U.useState)(``),s=l({mutationFn:()=>g.post(`/api/studio/projects`,{name:i}),onSuccess:async({id:e})=>{await r.invalidateQueries({queryKey:[`projects`]}),n(e),a(``),t()}});return(0,W.jsx)(se,{open:e,onClose:t,title:m(`home.newProject`),children:(0,W.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),i.trim()&&s.mutate()},children:[(0,W.jsx)(w,{autoFocus:!0,placeholder:m(`home.projectName`),value:i,onChange:e=>a(e.target.value)}),(0,W.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,W.jsx)(T,{variant:`ghost`,onClick:t,children:m(`common.cancel`)}),(0,W.jsx)(T,{type:`submit`,busy:s.isPending,disabled:!i.trim(),children:m(`home.newProject`)})]})]})})}function nt(){let{project:e,projects:t,select:n}=u(),r=c().data?.limits.projects??1,i=s(),[a,o]=(0,U.useState)(!1);return!e||r!==null&&r<=1?null:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(ae,{className:`w-56`,value:e.id,onChange:e=>e===`__new`?o(!0):n(e),options:[...t.map(e=>({value:e.id,label:e.name})),...i?[r===null||t.length<r?{value:`__new`,label:`+ ${m(`home.newProject`)}`}:{value:`__new`,label:m(`home.projectLimit`,{n:r}),disabled:!0}]:[]]}),(0,W.jsx)(Q,{open:a,onClose:()=>o(!1)})]})}function rt({url:e}){let[t,n]=(0,U.useState)(!1);return(0,W.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)},className:`inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[0.8125rem] text-ink-3 hover:bg-accent hover:text-ink`,children:[t?(0,W.jsx)(v,{className:`size-3.5`}):(0,W.jsx)(E,{className:`size-3.5`}),m(t?`share.copied`:`share.link`)]})}function it(){let e=b(),t=J(!1),[n,r]=(0,U.useState)(!1),i=(0,U.useRef)(null);return(0,U.useEffect)(()=>{if(!n)return;let e=e=>{i.current?.contains(e.target)||r(!1)},t=e=>{e.key===`Escape`&&r(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[n]),(0,W.jsxs)(`div`,{className:`relative`,ref:i,onClick:e=>e.stopPropagation(),children:[(0,W.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>r(e=>!e),className:`inline-flex h-8 items-center gap-1.5 rounded-full px-3 text-[0.8125rem] text-ink-3 hover:bg-accent hover:text-ink`,children:[(0,W.jsx)(E,{className:`size-3.5`}),` `,m(`share.link`)]}),n?(0,W.jsxs)(`div`,{className:`absolute right-0 bottom-10 z-20 flex w-72 animate-rise flex-col gap-3 rounded-xl bg-card p-3.5 shadow-overlay ring-1 ring-border-soft`,children:[(0,W.jsx)(`p`,{className:`text-[0.8125rem] text-ink-2 leading-relaxed`,children:m(`teaser.link`)}),(0,W.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,W.jsx)(T,{size:`sm`,busy:t.link.isPending,onClick:()=>t.link.mutate({}),children:m(`account.signIn`)}),(0,W.jsx)(T,{size:`sm`,variant:`secondary`,onClick:()=>e(`/settings/account`),children:m(`account.create`)})]}),(0,W.jsx)(Y,{...t})]}):null]})}function at({w:e,me:t,runners:n}){let r=b(),i=Ve(e,t,e.cloud),o=He(i),s=o??(e.published?q(e):null);return(0,W.jsxs)(`div`,{className:`relative pt-6`,children:[(0,W.jsx)(`div`,{className:`pointer-events-none absolute top-0 left-4 z-10`,children:(0,W.jsx)(a,{kind:e.avatar,size:52})}),(0,W.jsxs)(ce,{className:`relative flex h-full cursor-pointer flex-col px-5 pt-10 pb-3 transition hover:shadow-elevated`,onClick:()=>r(`/edit/${e.id}`),children:[(0,W.jsx)(`div`,{className:`absolute top-3 right-3`,children:e.published?(0,W.jsx)(Ue,{where:i,me:t}):(0,W.jsx)(C,{children:m(`home.draft`)})}),(0,W.jsx)(`h3`,{className:`font-display font-semibold text-[1.0625rem] leading-snug`,children:e.title}),(0,W.jsx)(`p`,{className:`mt-1 line-clamp-2 text-[0.875rem] text-ink-3`,children:e.description}),(0,W.jsxs)(`div`,{className:`mt-auto flex min-h-8 items-center justify-between pt-3`,children:[(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-2.5 text-[0.75rem] text-ink-4`,children:[m(`home.steps`,{n:e.stepCount}),(0,W.jsx)($e,{w:e,runners:n})]}),(0,W.jsxs)(`div`,{className:`flex items-center`,children:[o?(0,W.jsx)(rt,{url:o}):i.kind===`here`&&O.account?(0,W.jsx)(it,{}):null,s?(0,W.jsx)(le,{label:m(o?`share.open`:`share.openHere`),className:`ml-1 size-8`,onClick:e=>{e.stopPropagation(),k(s)},children:(0,W.jsx)(ye,{className:`size-4`})}):null]})]})]})]})}var $=`curl -fsSL https://engenty.ai/install.sh | bash`;function ot(){let[e,t]=(0,U.useState)(!1),n=[m(`home.local.install`),m(`home.local.signIn`),m(`home.local.publish`)];return(0,W.jsxs)(`div`,{className:`mx-auto flex max-w-xl animate-rise flex-col items-center pt-4 text-center`,children:[(0,W.jsx)(a,{kind:`round`,size:120}),(0,W.jsx)(`h1`,{className:`mt-2 font-display font-semibold text-[1.75rem] leading-tight tracking-tight`,children:m(`home.local.title`)}),(0,W.jsx)(`p`,{className:`mt-3 text-[0.9375rem] text-ink-2 leading-relaxed`,children:m(`home.local.text`)}),(0,W.jsx)(`ol`,{className:`mt-8 flex w-full flex-col gap-4 text-left`,children:n.map((n,r)=>(0,W.jsxs)(`li`,{className:`flex gap-3`,children:[(0,W.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-full bg-paper-2 font-medium text-[0.8125rem] text-ink-2`,children:r+1}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1 pt-0.5`,children:[(0,W.jsx)(`p`,{className:`text-[0.9375rem] leading-snug`,children:n}),r===0?(0,W.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 rounded-lg bg-paper-2 py-1.5 pr-1.5 pl-3`,children:[(0,W.jsx)(`code`,{className:`min-w-0 flex-1 select-all overflow-x-auto whitespace-nowrap font-mono text-[0.8125rem] text-ink-2`,children:$}),(0,W.jsxs)(T,{variant:`secondary`,size:`sm`,onClick:()=>{navigator.clipboard.writeText($),t(!0),setTimeout(()=>t(!1),1500)},children:[e?(0,W.jsx)(v,{className:`size-3.5`}):(0,W.jsx)(E,{className:`size-3.5`}),m(e?`share.copied`:`share.copy`)]})]}):null]})]},n))})]})}function st(){let e=b(),{project:t,projects:n,loading:r}=u(),a=c().data,o=ee(),l=s(),d=i({queryKey:[`wizards`,t?.id,!!a?.account],queryFn:()=>g.get(`/api/studio/projects/${t.id}/wizards`),enabled:!!t}),p=Qe().data??[],[h,ne]=(0,U.useState)(null),_=(d.data??[]).filter(e=>!h||Z(e,p).includes(h)),v=n.reduce((e,t)=>e+t.wizardCount,0),y=l&&!t?.readOnly;return!r&&y&&n.length&&v===0?(0,W.jsx)(re,{to:`/new`,replace:!0}):!r&&!o&&n.length===0?(0,W.jsx)(ot,{}):(0,W.jsxs)(`div`,{className:`animate-rise`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4`,children:[(0,W.jsx)(`h1`,{className:`font-display font-semibold text-[1.75rem] tracking-tight`,children:m(`home.title`)}),y?(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(he,{}),(0,W.jsxs)(T,{onClick:()=>e(`/new`),children:[(0,W.jsx)(te,{className:`size-4`}),` `,m(`home.new`)]})]}):null]}),t?.origin===`local`?(0,W.jsxs)(`p`,{className:`mt-2 text-[0.875rem] text-ink-3`,children:[m(`home.fromLocal`),` `,t.syncedAt?m(`home.syncedAt`,{when:new Intl.DateTimeFormat(f,{dateStyle:`medium`,timeStyle:`short`}).format(new Date(t.syncedAt))}):null]}):null,d.data&&d.data.length===0?(0,W.jsx)(ie,{children:m(`home.empty`)}):null,d.data?.length?(0,W.jsx)(et,{wizards:d.data,runners:p,value:h,onChange:ne}):null,(0,W.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:a?_.map(e=>(0,W.jsx)(at,{w:e,me:a,runners:p},e.id)):null})]})}export{Ce as C,M as D,F as E,je as S,L as T,Ie as _,Y as a,Ne as b,K as c,Ve as d,Le as f,G as g,ze as h,Ye as i,q as l,Re as m,Q as n,J as o,Be as p,nt as r,Ue as s,tt as t,He as u,Me as v,B as w,Pe as x,Fe as y};
@@ -1 +1 @@
1
- import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{ut as r}from"./definition-AlI4g-wR.js";import{d as i,m as a,s as o}from"./session-DCcgTTmG.js";import{K as s,M as c,S as l,et as u,i as d,t as f,x as p}from"./ui-Wxaw_APn.js";var m={name:`cloud-off`,size:24,node:[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};m.node;var h=s(m),g={name:`coins`,size:24,node:[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]};g.node;var _=s(g),v={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`}]]};v.node;var y=s(v),b={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};b.node;var x=s(b),S={name:`upload`,size:24,node:[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]};S.node;var C=s(S),w=e(t(),1),T=e(n(),1);function E({variant:e=`secondary`,label:t=c(`home.import`)}){let n=u(),s=r(),{project:m}=o(),h=i(),g=(0,w.useRef)(null),_=a({mutationFn:e=>l.upload(`/api/studio/projects/${m.id}/wizards/import`,e),onSuccess:async({id:e})=>{await s.invalidateQueries({queryKey:[`projects`]}),await s.invalidateQueries({queryKey:[`wizards`]}),n(`/edit/${e}`)}}),v=_.error instanceof p?_.error.body?.issues??[]:[];return!h||m?.readOnly?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(f,{variant:e,busy:_.isPending,disabled:!m,onClick:()=>g.current?.click(),children:[(0,T.jsx)(C,{className:`size-4`}),` `,t]}),(0,T.jsx)(`input`,{ref:g,hidden:!0,type:`file`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&_.mutate(t)}}),(0,T.jsxs)(d,{open:_.isError,onClose:_.reset,title:c(`import.failed`),children:[(0,T.jsx)(`p`,{className:`text-[0.875rem] text-ink-2`,children:_.error?.message}),v.length?(0,T.jsx)(`ul`,{className:`mt-3 flex list-disc flex-col gap-1 pl-5 text-[0.8125rem] text-ink-2`,children:v.slice(0,8).map(e=>(0,T.jsx)(`li`,{children:e.message},e.message))}):null,(0,T.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,T.jsx)(f,{variant:`secondary`,onClick:_.reset,children:c(`common.close`)})})]})]})}export{_ as a,y as i,C as n,h as o,x as r,E as t};
1
+ import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{dt as r}from"./definition-CfFlylCM.js";import{d as i,m as a,s as o}from"./session-C24kIPr-.js";import{K as s,M as c,S as l,et as u,i as d,t as f,x as p}from"./ui-C4b__6Oo.js";var m={name:`cloud-off`,size:24,node:[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};m.node;var h=s(m),g={name:`coins`,size:24,node:[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]};g.node;var _=s(g),v={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`}]]};v.node;var y=s(v),b={name:`search`,size:24,node:[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]};b.node;var x=s(b),S={name:`upload`,size:24,node:[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]};S.node;var C=s(S),w=e(t(),1),T=e(n(),1);function E({variant:e=`secondary`,label:t=c(`home.import`)}){let n=u(),s=r(),{project:m}=o(),h=i(),g=(0,w.useRef)(null),_=a({mutationFn:e=>l.upload(`/api/studio/projects/${m.id}/wizards/import`,e),onSuccess:async({id:e})=>{await s.invalidateQueries({queryKey:[`projects`]}),await s.invalidateQueries({queryKey:[`wizards`]}),n(`/edit/${e}`)}}),v=_.error instanceof p?_.error.body?.issues??[]:[];return!h||m?.readOnly?null:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(f,{variant:e,busy:_.isPending,disabled:!m,onClick:()=>g.current?.click(),children:[(0,T.jsx)(C,{className:`size-4`}),` `,t]}),(0,T.jsx)(`input`,{ref:g,hidden:!0,type:`file`,onChange:e=>{let t=e.target.files?.[0];e.target.value=``,t&&_.mutate(t)}}),(0,T.jsxs)(d,{open:_.isError,onClose:_.reset,title:c(`import.failed`),children:[(0,T.jsx)(`p`,{className:`text-[0.875rem] text-ink-2`,children:_.error?.message}),v.length?(0,T.jsx)(`ul`,{className:`mt-3 flex list-disc flex-col gap-1 pl-5 text-[0.8125rem] text-ink-2`,children:v.slice(0,8).map(e=>(0,T.jsx)(`li`,{children:e.message},e.message))}):null,(0,T.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,T.jsx)(f,{variant:`secondary`,onClick:_.reset,children:c(`common.close`)})})]})]})}export{_ as a,y as i,C as n,h as o,x as r,E as t};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowPreview-COgjib4H.js","assets/jsx-runtime-D3jfb0Ew.js","assets/ui-Wxaw_APn.js","assets/preload-helper-CNEI7N0N.js","assets/esm-rJY59Ixx.js","assets/react-dom-DenslgJm.js"])))=>i.map(i=>d[i]);
2
- import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{B as r,O as i,P as a,U as o,V as s,W as c,et as l,ut as u,z as d}from"./definition-AlI4g-wR.js";import{d as f,m as p,s as m}from"./session-DCcgTTmG.js";import{t as h}from"./preload-helper-CNEI7N0N.js";import{A as g,H as _,K as v,M as y,P as b,R as x,S,U as ee,X as te,et as C,f as w,g as T,h as E,i as D,n as O,nt as k,r as A,t as j,z as M}from"./ui-Wxaw_APn.js";import{i as N,n as ne,r as re,t as ie}from"./type-kpWj7Zf1.js";import{t as ae}from"./arrow-right-pf8p4FIz.js";import{c as oe,s as se,t as ce}from"./meta-CT4LmQ7g.js";import{n as P,t as F}from"./image-BuasG4Jr.js";import{a as le,i as ue,o as de,r as fe,t as pe}from"./ImportWizard-BZDtNJg1.js";import{n as me,r as he,t as ge}from"./wand-sparkles-DaINku4r.js";import{t as _e}from"./globe-BnaeE83w.js";import{t as ve}from"./mouse-pointer-click-BurvPVO8.js";import{t as ye}from"./pen-line-BA6l84zC.js";import{t as I}from"./star-BwhVXiJM.js";import{t as L}from"./video-U-idAC66.js";import{t as R}from"./volume-2-BwidpioC.js";import{l as be,u as xe}from"./engenty-Cm8yZLON.js";import{z as Se}from"./index-BdrX1tJ4.js";var Ce=class extends s{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:i,isRefetching:a,isError:s,isRefetchError:l}=r,u=n.fetchMeta?.fetchMore?.direction,d=s&&u===`forward`,f=i&&u===`forward`,p=s&&u===`backward`,m=i&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:o(t,n.data),hasPreviousPage:c(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!p,isRefetching:a&&!f&&!m}}};function we(e,t){return r(e,Ce,t)}var Te={name:`audio-lines`,size:24,node:[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]};Te.node;var Ee=v(Te),De={name:`chart-column`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]],aliases:[`bar-chart-3`]};De.node;var Oe=v(De),ke={name:`circle-dollar-sign`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`,key:`1h4pet`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}]]};ke.node;var Ae=v(ke),je={name:`circle-euro`,size:24,node:[[`path`,{d:`M15 9.4a4 4 0 1 0 0 5.2`,key:`1makmb`}],[`path`,{d:`M7 12h5`,key:`gblrwe`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};je.node;var Me=v(je),Ne={name:`scan-text`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 8h8`,key:`1jbsf9`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}],[`path`,{d:`M7 16h6`,key:`1vyc9m`}]]};Ne.node;var Pe=v(Ne),Fe={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};Fe.node;var Ie=v(Fe),z=e(t(),1),B={text:{de:`Text`,en:`Text`},document:{de:`Dokument (PDF, Word)`,en:`Document (PDF, Word)`},table:{de:`Tabelle`,en:`Table`},image:{de:`Bild`,en:`Image`},video:{de:`Video`,en:`Video`},audio:{de:`Audio`,en:`Audio`},dashboard:{de:`Dashboard`,en:`Dashboard`}},V={any:{de:`Jede Branche`,en:`Any industry`},trades:{de:`Handwerk`,en:`Trades`},gastronomy:{de:`Gastronomie`,en:`Food service`},hospitality:{de:`Hotel & Tourismus`,en:`Hotels & tourism`},realEstate:{de:`Immobilien`,en:`Real estate`},retail:{de:`Handel`,en:`Retail`},health:{de:`Gesundheit`,en:`Health`},professional:{de:`Kanzlei & Beratung`,en:`Professional services`},agency:{de:`Agentur & Marketing`,en:`Agency & marketing`},events:{de:`Veranstaltungen`,en:`Events`},publicSector:{de:`Vereine & Öffentliches`,en:`Associations & public sector`}},H={marketing:{de:`Marketing & Social Media`,en:`Marketing & social media`},sales:{de:`Angebote & Verkauf`,en:`Offers & sales`},accounting:{de:`Buchhaltung & Belege`,en:`Accounting & receipts`},service:{de:`Kundenservice`,en:`Customer service`},research:{de:`Recherche & Analyse`,en:`Research & analysis`},hr:{de:`Personal & Bewerbungen`,en:`HR & applications`},operations:{de:`Planung & Abläufe`,en:`Planning & operations`},website:{de:`Helfer für die Website`,en:`Website helpers`},visuals:{de:`Bilder & Video`,en:`Images & video`},inquiries:{de:`Anfragen & Termine`,en:`Inquiries & bookings`},advice:{de:`Beratung & Preise`,en:`Advice & pricing`}},U={text:{de:`Text schreiben`,en:`Writes text`},web:{de:`Websuche`,en:`Web search`},browser:{de:`Browser bedienen`,en:`Drives a browser`},documents:{de:`Dokumente & Fotos lesen`,en:`Reads documents & photos`},image:{de:`Bilder erzeugen`,en:`Makes images`},video:{de:`Videos erzeugen`,en:`Makes video`},speech:{de:`Sprachausgabe`,en:`Speech output`},listening:{de:`Sprachnotizen verstehen`,en:`Understands voice notes`},code:{de:`Code ausführen`,en:`Runs code`},connectors:{de:`Verbundene Konten & Systeme`,en:`Connected accounts & systems`},film:{de:`Filme mit Claude Code (auf deinem Abo)`,en:`Films with Claude Code (on your subscription)`}},W={low:{de:`günstig`,en:`low cost`},medium:{de:`mittel`,en:`medium cost`},high:{de:`teuer`,en:`high cost`}},Le={free:{de:`Kostenlos`,en:`Free`},pro:{de:`Pro`,en:`Pro`}},G=e=>Object.keys(e);G(B),G(V),G(H),G(U),G(Le);var K=e(n(),1),Re=(0,z.lazy)(()=>h(()=>import(`./FlowPreview-COgjib4H.js`),__vite__mapDeps([0,1,2,3,4,5]))),ze={useCase:``,industry:``,format:``,capability:``,plan:``},q=(e,t)=>e[t]?.[g]??t;function Be(e){if(e<1)return 1;let t=10**Math.floor(Math.log10(e));return Math.round(e/t)*t}function Ve(e){return e.credits?y(`market.credits`,{n:Be(e.credits.credits)}):W[e.costTier][g]}var He={text:ie,document:Se,table:me,image:F,video:L,audio:Ee,dashboard:Oe};function J({format:e,className:t}){let n=He[e],r=q(B,e);return(0,K.jsx)(`span`,{title:r,className:`inline-flex`,children:(0,K.jsx)(n,{className:t,"aria-label":r,role:`img`})})}var Ue=[`low`,`medium`,`high`];function Y({entry:e}){let t=Ue.indexOf(e.costTier)+1,n=g===`de`?Me:Ae;return(0,K.jsxs)(`span`,{title:Ve(e),className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex shrink-0`,children:Ue.slice(0,t).map((e,t)=>(0,K.jsx)(`span`,{className:T(`rounded-full bg-(--coin-bg,var(--color-card))`,t>0&&`-ml-1.5`),children:(0,K.jsx)(n,{className:`size-4`})},e))}),W[e.costTier][g]]})}function We(){return(0,K.jsx)(A,{tone:`ember`,title:y(`market.proHint`),children:y(`market.pro`)})}function Ge({plugin:e}){return(0,K.jsx)(A,{icon:(0,K.jsx)(ue,{className:`size-3.5`}),title:y(`market.fromPlugin`,{name:e.name}),children:e.name})}function Ke({entry:e,onOpen:t}){return(0,K.jsxs)(O,{role:`button`,tabIndex:0,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},className:T(`relative flex min-h-[124px] cursor-pointer flex-col gap-5 p-4 text-left transition sm:min-h-[136px] sm:p-5 hover:shadow-elevated focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,(!e.usable||e.missing.length>0||!!e.needs?.length)&&`opacity-60`),children:[(0,K.jsx)(`span`,{className:`-top-4 pointer-events-none absolute right-4`,children:(0,K.jsx)(i,{kind:e.avatar,size:68})}),(0,K.jsxs)(`div`,{className:`min-w-0 pr-20`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 font-display font-semibold text-[0.9375rem]`,children:[e.title,e.plan===`pro`?(0,K.jsx)(We,{}):null,e.starred?(0,K.jsx)(I,{className:`size-3.5 shrink-0 fill-amber text-amber`,"aria-label":y(`market.starred`)}):null]}),(0,K.jsx)(`div`,{className:`mt-0.5 text-[0.8125rem] text-ink-3 leading-snug`,children:e.pitch})]}),(0,K.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[0.75rem] text-ink-3`,children:[e.plugin?(0,K.jsx)(Ge,{plugin:e.plugin}):null,e.needs?.length?(0,K.jsx)(A,{tone:`warn`,children:y(`market.needsPro`,{list:e.needs.join(`, `)})}):e.usable&&e.missing.length?(0,K.jsx)(A,{tone:`warn`,children:y(`market.missing`,{list:Z(e.missing)})}):e.usable?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(M,{className:`size-3.5`}),` `,y(`market.minutes`,{n:e.effort.minutes})]}),(0,K.jsx)(Y,{entry:e}),e.optional?.length?(0,K.jsx)(A,{title:y(`market.optionalHint`,{list:Z(e.optional)}),children:y(`market.without`,{list:Z(e.optional)})}):null,(0,K.jsx)(`span`,{className:`ml-auto inline-flex items-center gap-1.5`,children:e.formats.map(e=>(0,K.jsx)(J,{format:e,className:`size-4`},e))})]}):(0,K.jsx)(A,{tone:`warn`,children:y(`market.needsUpdate`)})]})]})}function X({title:e,children:t}){return(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`mb-1.5 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:e}),t]})}var Z=e=>e.map(e=>q(U,e)).join(`, `),qe={text:ye,web:_e,browser:ve,documents:Pe,image:F,video:L,speech:R,listening:x,code:Ie,connectors:ne,film:P};function Je(e){switch(e.type){case`page`:return re;case`agent`:return oe;case`generate`:return e.asset===`image`?F:e.asset===`video`?L:e.asset===`voice`?R:e.asset===`dashboard`?Oe:Se;case`widget`:return e.video?P:N;case`surface`:return N;case`film`:return P;case`review`:return he;case`result`:return se}return ge}function Ye(e){let t=new Set;for(let[n,r]of e.entries())for(let i of r.branches??[]){let r=i.to===`end`?e.length:e.findIndex(e=>e.id===i.to);for(let i=n+1;i<r;i++)t.add(e[i].id)}return t}function Xe(e){let t=Ye(e);return e.map(e=>({id:e.id,title:e.title,icon:Je(e),tone:ce[e.type]??`bg-paper-2 text-ink-2`,optional:t.has(e.id),branches:e.branches}))}function Q({title:e,children:t}){return(0,K.jsx)(`span`,{title:e,className:`inline-flex items-center gap-2 border-border border-l px-4 first:border-l-0 first:pl-0`,children:t})}function $({icon:e,children:t,more:n}){return(0,K.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,K.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:e}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-[0.875rem] text-ink leading-snug`,children:t}),n?(0,K.jsx)(`div`,{className:`text-[0.75rem] text-ink-3 leading-snug`,children:n}):null]})]})}function Ze({className:e,children:t}){let n=(0,z.useRef)(null),[r,i]=(0,z.useState)({above:!1,below:!1});(0,z.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{let t=e.scrollTop>1,n=e.scrollTop+e.clientHeight<e.scrollHeight-1;i(e=>e.above===t&&e.below===n?e:{above:t,below:n})};t(),e.addEventListener(`scroll`,t,{passive:!0});let r=new ResizeObserver(t);return r.observe(e),e.firstElementChild&&r.observe(e.firstElementChild),()=>{e.removeEventListener(`scroll`,t),r.disconnect()}},[]);let a=`linear-gradient(to bottom, ${r.above?`transparent`:`black`} 0, black 28px, black calc(100% - 44px), ${r.below?`transparent`:`black`} 100%)`;return(0,K.jsx)(`div`,{ref:n,className:e,style:{maskImage:a,WebkitMaskImage:a},children:(0,K.jsx)(`div`,{children:t})})}function Qe({id:e,fallback:t,onClose:n,onUse:r,busy:o}){let s=u(),c=C(),l=d({queryKey:[`marketplace-entry`,e,g],queryFn:()=>S.get(`/api/studio/marketplace/${encodeURIComponent(e)}?lang=${g}`),enabled:!!e,retry:!1}),f=l.data??t,m=p({mutationFn:t=>{let n=`/api/studio/marketplace/${encodeURIComponent(e)}/star`;return t?S.put(n):S.del(n)},onSuccess:()=>Promise.all([s.invalidateQueries({queryKey:[`marketplace`]}),s.invalidateQueries({queryKey:[`marketplace-entry`,e]})])}),h=a()===`dark`,_=be[xe[f?.avatar||`round`]],v=h?`var(--card)`:`color-mix(in oklch, ${_??`var(--ink-4)`} 14%, var(--paper-2))`;return(0,K.jsx)(D,{open:!!e,onClose:n,wide:!0,bare:!0,children:f?(0,K.jsxs)(`div`,{className:`relative flex max-h-[calc(100dvh-48px)] flex-col rounded-2xl bg-card shadow-overlay max-sm:h-dvh max-sm:max-h-none max-sm:rounded-none`,children:[(0,K.jsx)(`button`,{type:`button`,"aria-label":y(`common.close`),onClick:n,className:`sm:-top-3.5 sm:-right-3.5 absolute top-3 right-3 z-20 flex size-9 items-center justify-center rounded-full bg-card text-ink-2 shadow-elevated ring-1 ring-border-soft transition hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,children:(0,K.jsx)(b,{className:`size-4`})}),(0,K.jsxs)(`header`,{className:`relative shrink-0 border-border-soft border-b px-5 pt-5 pb-4 text-ink sm:rounded-t-2xl sm:px-7`,style:{background:v,"--coin-bg":v},children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 overflow-hidden sm:rounded-t-2xl`,children:(0,K.jsx)(`span`,{className:T(`-top-28 -right-10 absolute size-80 rounded-full bg-white blur-3xl`,h?`opacity-[0.14]`:`opacity-80`)})}),(0,K.jsx)(`div`,{className:`-bottom-5 absolute right-9 z-10 max-sm:hidden`,children:(0,K.jsx)(i,{kind:f.avatar,size:104})}),(0,K.jsxs)(`div`,{className:`relative sm:pr-36`,children:[(0,K.jsx)(`h2`,{className:`font-display font-semibold text-[1.375rem] leading-tight tracking-tight max-sm:pr-10`,children:f.title}),(0,K.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-2 leading-snug`,children:l.data?.description||f.pitch})]}),f.usable?(0,K.jsxs)(`div`,{className:`-mx-5 sm:-mx-7 relative mt-3.5 flex flex-wrap items-center gap-y-2 border-border-soft border-t px-5 pt-3 font-medium text-[0.875rem] sm:px-7 sm:pr-40`,children:[(0,K.jsxs)(Q,{title:y(`market.duration`),children:[(0,K.jsx)(M,{className:`size-4 text-ink-3`}),y(`market.minutes`,{n:f.effort.minutes})]}),(0,K.jsx)(Q,{title:y(`market.cost`),children:(0,K.jsx)(Y,{entry:f})}),(0,K.jsx)(Q,{title:y(`market.result`),children:f.formats.map(e=>(0,K.jsx)(J,{format:e,className:`size-4`},e))})]}):null]}),f.usable?(0,K.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-x-7 gap-y-6 px-5 pt-6 max-sm:overflow-y-auto max-sm:pb-4 sm:grid-cols-[230px_minmax(0,1fr)] sm:grid-rows-[minmax(0,1fr)] sm:px-7`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-5 sm:min-h-0 sm:overflow-y-auto`,children:[(0,K.jsx)(X,{title:y(`market.duration`),children:(0,K.jsx)($,{icon:(0,K.jsx)(M,{className:`size-4 text-moss`}),more:y(`market.durationHint`,{n:f.effort.fields}),children:y(`market.minutes`,{n:f.effort.minutes})})}),(0,K.jsx)(X,{title:y(`market.cost`),children:(0,K.jsx)($,{icon:(0,K.jsx)(le,{className:`size-4 text-amber`}),more:f.credits?y(`market.creditsHint`):void 0,children:(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2`,children:[(0,K.jsx)(Y,{entry:f}),f.credits?(0,K.jsx)(`span`,{className:`text-ink-2`,children:y(`market.creditsRange`,{n:Be(f.credits.credits)})}):null]})})}),(0,K.jsx)(X,{title:y(`market.result`),children:(0,K.jsx)(`div`,{className:`flex flex-col gap-2`,children:(l.data?.results??[]).map(e=>(0,K.jsx)($,{icon:(0,K.jsx)(J,{format:e.kind,className:`size-4 text-ember-strong`}),more:e.formats.map(e=>e.toUpperCase()).join(` · `),children:e.title},e.title))})}),(0,K.jsx)(X,{title:y(`market.needs`),children:(0,K.jsx)(`ul`,{className:`flex flex-col gap-2`,children:f.capabilities.map(e=>{let t=qe[e],n=f.missing.includes(e),r=f.optional?.includes(e);return(0,K.jsxs)(`li`,{className:T(`flex items-center gap-2.5 text-[0.875rem]`,n?`text-ink-3`:`text-ink-2`),children:[(0,K.jsx)(t,{className:T(`size-4 shrink-0`,n?`text-rose`:r?`text-amber`:`text-cobalt`)}),q(U,e),n?(0,K.jsx)(`span`,{className:`text-[0.75rem] text-rose`,children:y(`market.unavailable`)}):r?(0,K.jsx)(`span`,{className:`text-[0.75rem] text-amber`,children:y(`market.optional`)}):null]},e)})})})]}),(0,K.jsxs)(`div`,{className:`flex flex-col sm:min-h-0`,children:[(0,K.jsx)(`div`,{className:`mb-1.5 shrink-0 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:y(`market.steps`)}),(0,K.jsx)(Ze,{className:`-mr-2 overscroll-contain pt-1 pr-2 pl-1 sm:min-h-0 sm:flex-1 sm:overflow-y-auto`,children:l.isLoading?(0,K.jsx)(w,{className:`size-5 text-ink-3`}):(0,K.jsx)(z.Suspense,{fallback:(0,K.jsx)(w,{className:`size-5 text-ink-3`}),children:(0,K.jsx)(Re,{steps:Xe(l.data?.outline??[])})})})]})]}):(0,K.jsx)(`div`,{className:`flex-1 px-5 pt-6 sm:px-7`,children:(0,K.jsx)(`p`,{className:`rounded-lg bg-amber-tint p-3 text-[0.875rem] text-ink-2`,children:y(`market.needsUpdateHint`)})}),(0,K.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 px-5 pt-4 pb-5 max-sm:border-border-soft max-sm:border-t sm:px-7 sm:pb-6`,children:[f.plugin?(0,K.jsx)(`span`,{className:`mr-auto flex items-center`,children:(0,K.jsx)(Ge,{plugin:f.plugin})}):(0,K.jsxs)(j,{variant:`ghost`,className:`mr-auto`,title:y(`market.starHint`),"aria-pressed":f.starred,busy:m.isPending,onClick:()=>m.mutate(!f.starred),children:[(0,K.jsx)(I,{className:T(`size-4`,f.starred&&`fill-amber text-amber`)}),(0,K.jsx)(`span`,{className:`max-sm:sr-only`,children:y(f.starred?`market.starred`:`market.star`)})]}),(0,K.jsx)(j,{variant:`secondary`,onClick:n,children:y(`common.close`)}),f.usable&&f.missing.length?(0,K.jsx)(j,{variant:`secondary`,onClick:()=>c(`/settings/models`),children:y(`editor.models.settings`)}):null,r?(0,K.jsx)(j,{disabled:!f.usable||f.missing.length>0||!!f.needs?.length,title:f.needs?.length?y(`market.needsProHint`,{list:f.needs.join(`, `)}):f.missing.length?y(`market.missingHint`,{list:Z(f.missing)}):f.optional?.length?y(`market.optionalHint`,{list:Z(f.optional)}):void 0,busy:o,onClick:()=>r(f),children:y(`market.use`)}):null]})]}):(0,K.jsx)(`div`,{className:`flex min-h-48 flex-col items-center justify-center gap-3 rounded-2xl bg-card p-8 text-[0.875rem] text-ink-2 shadow-overlay`,children:l.isLoading?(0,K.jsx)(w,{className:`size-6 text-ink-3`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{children:y(`market.notFound`)}),(0,K.jsx)(j,{variant:`secondary`,onClick:n,children:y(`common.close`)})]})})})}function $e({name:e,value:t,options:n,onChange:r}){let[i,a]=(0,z.useState)(!1),o=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!i)return;let e=e=>{o.current?.contains(e.target)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let s=n.find(e=>e.value===t);return(0,K.jsxs)(`div`,{ref:o,className:`relative`,children:[(0,K.jsxs)(`div`,{className:T(`flex h-8 items-center rounded-full text-[0.8125rem] transition`,s?`bg-ember-tint text-ink`:`text-ink-2 hover:bg-paper-2 hover:text-ink`,i&&!s&&`bg-paper-2 text-ink`),children:[(0,K.jsx)(`button`,{type:`button`,"aria-haspopup":`listbox`,"aria-expanded":i,onClick:()=>a(!i),className:T(`flex h-full items-center gap-1.5 rounded-full pl-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,s?`pr-1`:`pr-2.5`),children:s?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-ink-3`,children:e}),(0,K.jsx)(`span`,{className:`font-medium`,children:s.label})]}):(0,K.jsxs)(K.Fragment,{children:[e,(0,K.jsx)(_,{className:T(`size-3.5 transition`,i&&`rotate-180`)})]})}),s?(0,K.jsx)(`button`,{type:`button`,"aria-label":`${e}: ${y(`market.reset`)}`,onClick:()=>r(``),className:`mr-1 flex size-6 items-center justify-center rounded-full text-ink-3 hover:bg-card hover:text-ink`,children:(0,K.jsx)(b,{className:`size-3.5`})}):null]}),i?(0,K.jsx)(`div`,{role:`listbox`,"aria-label":e,className:`absolute top-full left-0 z-30 mt-1.5 max-h-80 min-w-60 overflow-y-auto rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:n.map(e=>(0,K.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e.value===t,disabled:!e.count||e.unavailable,onClick:()=>{r(e.value===t?``:e.value),a(!1)},className:T(`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-[0.875rem] transition coarse:py-2.5`,e.count&&!e.unavailable?`text-ink-2 hover:bg-paper-2 hover:text-ink`:`text-ink-4`,e.value===t&&`font-medium text-ink`),children:[e.icon,(0,K.jsx)(`span`,{className:`flex-1 whitespace-nowrap`,children:e.label}),e.value===t?(0,K.jsx)(ee,{className:`size-4 text-ember`}):e.unavailable?(0,K.jsx)(`span`,{className:`whitespace-nowrap text-[0.75rem] text-ink-4`,children:y(`market.unavailable`)}):(0,K.jsx)(`span`,{className:`text-[0.75rem] text-ink-4 tabular-nums`,children:e.count})]},e.value))}):null]})}function et(e,t){let[n,r]=(0,z.useState)(e);return(0,z.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var tt=60;function nt({onUse:e,busy:t,open:n}){let[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(ze),[s,c]=(0,z.useState)(!1),[u,d]=(0,z.useState)(n??null),f=et(r.trim(),250),p=we({queryKey:[`marketplace`,g,f,a,s],queryFn:({pageParam:e})=>{let t=new URLSearchParams({lang:g,limit:String(tt),offset:String(e)});f&&t.set(`q`,f);for(let[e,n]of Object.entries(a))n&&t.set(e,n);return s&&t.set(`starred`,`1`),S.get(`/api/studio/marketplace?${t}`)},initialPageParam:0,getNextPageParam:(e,t)=>{let n=t.reduce((e,t)=>e+t.entries.length,0);return n<e.total?n:void 0},placeholderData:l}),m=p.data?.pages[0],h=p.data?.pages.flatMap(e=>e.entries)??[],_=m?.all??0,v=r.trim()!==f||p.isFetching&&!p.isFetchingNextPage,x=(e,t,n)=>Object.keys(t).filter(t=>m?.facets[e]?.[t]!==void 0).map(r=>({value:r,label:q(t,r),icon:n?.(r),count:(m?.facets[e])[r]??0,unavailable:e===`capability`&&ee.has(r)})),ee=new Set(m?.unavailable??[]),te=x(`useCase`,H),C=[{key:`industry`,name:y(`market.industry`),options:x(`industry`,V)},{key:`format`,name:y(`market.format`),options:x(`format`,B,e=>(0,K.jsx)(J,{format:e,className:`size-4 text-ink-3`}))},{key:`plan`,name:y(`market.plan`),options:x(`plan`,Le)},{key:`capability`,name:y(`market.capability`),options:x(`capability`,U,e=>{let t=qe[e];return(0,K.jsx)(t,{className:`size-4 text-ink-3`})})}],E=!!r.trim()||s||Object.values(a).some(Boolean),D=()=>{o(ze),i(``),c(!1)};if(p.isLoading)return(0,K.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,K.jsx)(w,{className:`size-6 text-ink-3`})});let O=m?.offline?(0,K.jsxs)(`p`,{className:`mt-4 flex items-center justify-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,K.jsx)(de,{className:`size-4 shrink-0`}),y(`market.offline`)]}):null;if(!_&&!E)return O;let k=r?(0,K.jsx)(`button`,{type:`button`,"aria-label":y(`market.reset`),onClick:()=>i(``),className:`-mr-1.5 flex size-7 shrink-0 items-center justify-center rounded-full text-ink-3 hover:bg-paper-2 hover:text-ink`,children:(0,K.jsx)(b,{className:`size-4`})}):null,A=e=>T(`inline-flex h-7 shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-2.5 text-[0.78125rem] transition`,e?`bg-card font-medium text-ink shadow-soft ring-1 ring-border-soft`:`text-ink-3 hover:bg-card/60 hover:text-ink`);return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`label`,{className:`relative mx-auto flex h-10 max-w-md items-center gap-2.5 rounded-full bg-card px-4 shadow-soft ring-1 ring-border-soft transition focus-within:ring-2 focus-within:ring-focus sm:h-11`,children:[v?(0,K.jsx)(w,{className:`size-4 shrink-0 text-ink-3`}):(0,K.jsx)(fe,{className:`size-4 shrink-0 text-ink-3`}),(0,K.jsx)(`input`,{type:`search`,value:r,onChange:e=>i(e.target.value),placeholder:y(`market.search`),"aria-label":y(`market.search`),className:`min-w-0 flex-1 bg-transparent text-[0.9375rem] outline-none placeholder:text-ink-4 [&::-webkit-search-cancel-button]:hidden`}),k]}),O,(0,K.jsxs)(`div`,{className:`max-sm:-mx-3 mt-4 flex gap-1 max-sm:overflow-x-auto max-sm:px-3 max-sm:[scrollbar-width:none] sm:flex-wrap sm:justify-center max-sm:[&::-webkit-scrollbar]:hidden`,children:[[{value:``,label:y(`market.all`)},...te].map(e=>(0,K.jsx)(`button`,{type:`button`,"aria-pressed":!s&&a.useCase===e.value,onClick:()=>{c(!1),o({...a,useCase:e.value})},className:A(!s&&a.useCase===e.value),children:e.label},e.value)),(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":s,onClick:()=>c(!s),className:A(s),children:[(0,K.jsx)(I,{className:T(`size-3.5`,s&&`fill-amber text-amber`)}),y(`market.starred`)]})]}),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-1 gap-y-2 sm:mt-6`,children:[s?null:C.map(e=>(0,K.jsx)($e,{name:e.name,value:a[e.key],options:e.options,onChange:t=>o({...a,[e.key]:t})},e.key)),(0,K.jsxs)(`span`,{className:`ml-auto flex items-center gap-3 whitespace-nowrap pl-2 text-[0.8125rem] text-ink-3`,children:[E?(0,K.jsxs)(`button`,{type:`button`,onClick:D,className:`inline-flex items-center gap-1 text-ember-strong underline-offset-2 hover:underline`,children:[(0,K.jsx)(b,{className:`size-3.5 max-sm:size-4`}),(0,K.jsx)(`span`,{className:`max-sm:sr-only`,children:y(`market.resetShort`)})]}):null,E?(0,K.jsx)(`span`,{className:`tabular-nums sm:hidden`,children:y(`market.countOfShort`,{n:m?.total??0,all:_})}):null,(0,K.jsx)(`span`,{className:T(`tabular-nums`,E&&`max-sm:hidden`),children:E?y(`market.countOf`,{n:m?.total??0,all:_}):y(`market.count`,{n:_})})]})]}),h.length?(0,K.jsx)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:h.map(e=>(0,K.jsx)(Ke,{entry:e,onOpen:()=>d(e.id)},e.id))}):(0,K.jsxs)(`div`,{className:`py-10 text-center text-[0.875rem] text-ink-3`,children:[(0,K.jsx)(`p`,{children:y(s?`market.noneStarred`:`market.none`)}),(0,K.jsx)(j,{variant:`ghost`,className:`mt-2`,onClick:D,children:y(`market.reset`)})]}),p.hasNextPage?(0,K.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,K.jsx)(j,{variant:`secondary`,busy:p.isFetchingNextPage,onClick:()=>void p.fetchNextPage(),children:y(`market.more`)})}):null,(0,K.jsx)(Qe,{id:u,fallback:h.find(e=>e.id===u)??null,onClose:()=>d(null),onUse:e,busy:t})]})}var rt={de:[`Stellenanzeige aus ein paar Stichworten, als PDF und LinkedIn-Post`,`Produktbeschreibung für den Onlineshop mit drei Bildvarianten`,`Wettbewerbsanalyse zu einer Firma mit Quellen`,`Lead aus einem Formular in unser CRM eintragen`],en:[`A job ad from a few keywords, as PDF and LinkedIn post`,`A shop product description with three image variants`,`A competitor analysis for a company, with sources`,`Put a lead from a form into our CRM`]};function it(){let e=C(),t=u(),{project:n}=m(),r=f(),[a,o]=(0,z.useState)(``),[s]=k(),c=p({mutationFn:e=>S.post(`/api/studio/wizards`,{projectId:n.id,starterId:e,lang:g}),onSuccess:async({id:n},r)=>{await t.invalidateQueries({queryKey:[`projects`]}),await t.invalidateQueries({queryKey:[`wizards`]}),e(r?`/edit/${n}`:`/edit/${n}?prompt=${encodeURIComponent(a.trim())}`)}}),l=()=>{a.trim()&&n&&c.mutate(void 0)};return!r||n?.readOnly?(0,K.jsx)(te,{to:`/`,replace:!0}):(0,K.jsxs)(`div`,{className:`animate-rise pt-4`,children:[(0,K.jsxs)(`div`,{className:`mx-auto max-w-2xl`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[(0,K.jsx)(i,{kind:`sprout`,size:150,fluffy:!0}),(0,K.jsx)(`h1`,{className:`mt-2 font-display font-semibold text-[2rem] leading-tight tracking-tight sm:text-[2.375rem]`,children:y(`new.title`)})]}),(0,K.jsxs)(`div`,{className:`mt-8 rounded-2xl bg-card p-2 shadow-elevated ring-1 ring-border-soft focus-within:ring-focus`,children:[(0,K.jsx)(E,{autoFocus:!0,minRows:4,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&l()},placeholder:y(`new.placeholder`),className:`border-0 bg-transparent text-[1rem] shadow-none focus:ring-0`}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-2 pb-1`,children:[(0,K.jsx)(`span`,{className:`hidden text-[0.75rem] text-ink-4 sm:block`,children:y(`new.hint`)}),(0,K.jsxs)(j,{size:`md`,onClick:l,busy:c.isPending&&!c.variables,disabled:!a.trim(),children:[y(`new.build`),` `,(0,K.jsx)(ae,{className:`size-4`})]})]})]}),(0,K.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:rt[g].map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>o(e),className:`rounded-full bg-paper-2 px-3.5 py-1.5 text-[0.8125rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:e},e))})]}),(0,K.jsxs)(`section`,{className:`mx-auto max-w-5xl`,children:[(0,K.jsx)(`h2`,{className:`mt-16 mb-5 text-center font-medium text-[0.8125rem] text-ink-3 uppercase tracking-[0.08em]`,children:y(`new.orStarter`)}),(0,K.jsx)(nt,{open:s.get(`starter`),busy:c.isPending&&!!c.variables,onUse:e=>n&&!c.isPending&&c.mutate(e.id)}),c.error?(0,K.jsx)(`p`,{className:`mt-3 text-center text-[0.875rem] text-rose`,children:c.error.message}):null]}),(0,K.jsx)(`div`,{className:`mt-8 flex justify-center`,children:(0,K.jsx)(pe,{variant:`ghost`,label:y(`new.import`)})})]})}export{it as NewWizardPage};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FlowPreview-DgZiepFR.js","assets/jsx-runtime-D3jfb0Ew.js","assets/ui-C4b__6Oo.js","assets/preload-helper-CNEI7N0N.js","assets/esm-rJY59Ixx.js","assets/react-dom-DenslgJm.js"])))=>i.map(i=>d[i]);
2
+ import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{B as r,G as i,H as a,O as o,P as s,V as c,W as l,dt as u,tt as d}from"./definition-CfFlylCM.js";import{d as f,m as p,s as m}from"./session-C24kIPr-.js";import{t as h}from"./preload-helper-CNEI7N0N.js";import{A as g,H as _,K as v,M as y,P as b,R as x,S,U as ee,X as te,et as C,f as w,g as T,h as E,i as D,n as O,nt as k,r as A,t as j,z as M}from"./ui-C4b__6Oo.js";import{i as N,n as ne,r as re,t as ie}from"./type-BbMmv2qL.js";import{t as ae}from"./arrow-right-BgKM1Npq.js";import{c as oe,s as se,t as ce}from"./meta-Bpe6vzmM.js";import{n as P,t as F}from"./image-B1a1ax-P.js";import{a as le,i as ue,o as de,r as fe,t as pe}from"./ImportWizard-CHlCjPEo.js";import{n as me,r as he,t as ge}from"./wand-sparkles-BsD2e8V6.js";import{t as _e}from"./globe-CoQ1BSyl.js";import{t as ve}from"./mouse-pointer-click-SHJL7g1i.js";import{t as ye}from"./pen-line-DgSzJ60H.js";import{t as I}from"./star-ClV5w6K4.js";import{t as L}from"./video-D04-GeyG.js";import{t as R}from"./volume-2-FUU7z0rq.js";import{l as be,u as xe}from"./engenty-Cm8yZLON.js";import{B as Se}from"./index-B8VsYgck.js";var Ce=class extends a{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type=`infinite`,super.setOptions(e)}getOptimisticResult(e){return e._type=`infinite`,super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`forward`}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:`backward`}}})}createResult(e,t){let{state:n}=e,r=super.createResult(e,t),{isFetching:a,isRefetching:o,isError:s,isRefetchError:c}=r,u=n.fetchMeta?.fetchMore?.direction,d=s&&u===`forward`,f=a&&u===`forward`,p=s&&u===`backward`,m=a&&u===`backward`;return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:l(t,n.data),hasPreviousPage:i(t,n.data),isFetchNextPageError:d,isFetchingNextPage:f,isFetchPreviousPageError:p,isFetchingPreviousPage:m,isRefetchError:c&&!d&&!p,isRefetching:o&&!f&&!m}}};function we(e,t){return c(e,Ce,t)}var Te={name:`audio-lines`,size:24,node:[[`path`,{d:`M2 10v3`,key:`1fnikh`}],[`path`,{d:`M6 6v11`,key:`11sgs0`}],[`path`,{d:`M10 3v18`,key:`yhl04a`}],[`path`,{d:`M14 8v7`,key:`3a1oy3`}],[`path`,{d:`M18 5v13`,key:`123xd1`}],[`path`,{d:`M22 10v3`,key:`154ddg`}]]};Te.node;var Ee=v(Te),De={name:`chart-column`,size:24,node:[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]],aliases:[`bar-chart-3`]};De.node;var Oe=v(De),ke={name:`circle-dollar-sign`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`,key:`1h4pet`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}]]};ke.node;var Ae=v(ke),je={name:`circle-euro`,size:24,node:[[`path`,{d:`M15 9.4a4 4 0 1 0 0 5.2`,key:`1makmb`}],[`path`,{d:`M7 12h5`,key:`gblrwe`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]};je.node;var Me=v(je),Ne={name:`scan-text`,size:24,node:[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 8h8`,key:`1jbsf9`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}],[`path`,{d:`M7 16h6`,key:`1vyc9m`}]]};Ne.node;var Pe=v(Ne),Fe={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};Fe.node;var Ie=v(Fe),z=e(t(),1),B={text:{de:`Text`,en:`Text`},document:{de:`Dokument (PDF, Word)`,en:`Document (PDF, Word)`},table:{de:`Tabelle`,en:`Table`},image:{de:`Bild`,en:`Image`},video:{de:`Video`,en:`Video`},audio:{de:`Audio`,en:`Audio`},dashboard:{de:`Dashboard`,en:`Dashboard`}},V={any:{de:`Jede Branche`,en:`Any industry`},trades:{de:`Handwerk`,en:`Trades`},gastronomy:{de:`Gastronomie`,en:`Food service`},hospitality:{de:`Hotel & Tourismus`,en:`Hotels & tourism`},realEstate:{de:`Immobilien`,en:`Real estate`},retail:{de:`Handel`,en:`Retail`},health:{de:`Gesundheit`,en:`Health`},professional:{de:`Kanzlei & Beratung`,en:`Professional services`},agency:{de:`Agentur & Marketing`,en:`Agency & marketing`},events:{de:`Veranstaltungen`,en:`Events`},publicSector:{de:`Vereine & Öffentliches`,en:`Associations & public sector`}},H={marketing:{de:`Marketing & Social Media`,en:`Marketing & social media`},sales:{de:`Angebote & Verkauf`,en:`Offers & sales`},accounting:{de:`Buchhaltung & Belege`,en:`Accounting & receipts`},service:{de:`Kundenservice`,en:`Customer service`},research:{de:`Recherche & Analyse`,en:`Research & analysis`},hr:{de:`Personal & Bewerbungen`,en:`HR & applications`},operations:{de:`Planung & Abläufe`,en:`Planning & operations`},website:{de:`Helfer für die Website`,en:`Website helpers`},visuals:{de:`Bilder & Video`,en:`Images & video`},inquiries:{de:`Anfragen & Termine`,en:`Inquiries & bookings`},advice:{de:`Beratung & Preise`,en:`Advice & pricing`}},U={text:{de:`Text schreiben`,en:`Writes text`},web:{de:`Websuche`,en:`Web search`},browser:{de:`Browser bedienen`,en:`Drives a browser`},documents:{de:`Dokumente & Fotos lesen`,en:`Reads documents & photos`},image:{de:`Bilder erzeugen`,en:`Makes images`},video:{de:`Videos erzeugen`,en:`Makes video`},speech:{de:`Sprachausgabe`,en:`Speech output`},listening:{de:`Sprachnotizen verstehen`,en:`Understands voice notes`},code:{de:`Code ausführen`,en:`Runs code`},connectors:{de:`Verbundene Konten & Systeme`,en:`Connected accounts & systems`},film:{de:`Filme mit Claude Code (auf deinem Abo)`,en:`Films with Claude Code (on your subscription)`}},W={low:{de:`günstig`,en:`low cost`},medium:{de:`mittel`,en:`medium cost`},high:{de:`teuer`,en:`high cost`}},Le={free:{de:`Kostenlos`,en:`Free`},pro:{de:`Pro`,en:`Pro`}},G=e=>Object.keys(e);G(B),G(V),G(H),G(U),G(Le);var K=e(n(),1),Re=(0,z.lazy)(()=>h(()=>import(`./FlowPreview-DgZiepFR.js`),__vite__mapDeps([0,1,2,3,4,5]))),ze={useCase:``,industry:``,format:``,capability:``,plan:``},q=(e,t)=>e[t]?.[g]??t;function Be(e){if(e<1)return 1;let t=10**Math.floor(Math.log10(e));return Math.round(e/t)*t}function Ve(e){return e.credits?y(`market.credits`,{n:Be(e.credits.credits)}):W[e.costTier][g]}var He={text:ie,document:Se,table:me,image:F,video:L,audio:Ee,dashboard:Oe};function J({format:e,className:t}){let n=He[e],r=q(B,e);return(0,K.jsx)(`span`,{title:r,className:`inline-flex`,children:(0,K.jsx)(n,{className:t,"aria-label":r,role:`img`})})}var Ue=[`low`,`medium`,`high`];function Y({entry:e}){let t=Ue.indexOf(e.costTier)+1,n=g===`de`?Me:Ae;return(0,K.jsxs)(`span`,{title:Ve(e),className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex shrink-0`,children:Ue.slice(0,t).map((e,t)=>(0,K.jsx)(`span`,{className:T(`rounded-full bg-(--coin-bg,var(--color-card))`,t>0&&`-ml-1.5`),children:(0,K.jsx)(n,{className:`size-4`})},e))}),W[e.costTier][g]]})}function We(){return(0,K.jsx)(A,{tone:`ember`,title:y(`market.proHint`),children:y(`market.pro`)})}function Ge({plugin:e}){return(0,K.jsx)(A,{icon:(0,K.jsx)(ue,{className:`size-3.5`}),title:y(`market.fromPlugin`,{name:e.name}),children:e.name})}function Ke({entry:e,onOpen:t}){return(0,K.jsxs)(O,{role:`button`,tabIndex:0,onClick:t,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),t())},className:T(`relative flex min-h-[124px] cursor-pointer flex-col gap-5 p-4 text-left transition sm:min-h-[136px] sm:p-5 hover:shadow-elevated focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,(!e.usable||e.missing.length>0||!!e.needs?.length)&&`opacity-60`),children:[(0,K.jsx)(`span`,{className:`-top-4 pointer-events-none absolute right-4`,children:(0,K.jsx)(o,{kind:e.avatar,size:68})}),(0,K.jsxs)(`div`,{className:`min-w-0 pr-20`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 font-display font-semibold text-[0.9375rem]`,children:[e.title,e.plan===`pro`?(0,K.jsx)(We,{}):null,e.starred?(0,K.jsx)(I,{className:`size-3.5 shrink-0 fill-amber text-amber`,"aria-label":y(`market.starred`)}):null]}),(0,K.jsx)(`div`,{className:`mt-0.5 text-[0.8125rem] text-ink-3 leading-snug`,children:e.pitch})]}),(0,K.jsxs)(`div`,{className:`mt-auto flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[0.75rem] text-ink-3`,children:[e.plugin?(0,K.jsx)(Ge,{plugin:e.plugin}):null,e.needs?.length?(0,K.jsx)(A,{tone:`warn`,children:y(`market.needsPro`,{list:e.needs.join(`, `)})}):e.usable&&e.missing.length?(0,K.jsx)(A,{tone:`warn`,children:y(`market.missing`,{list:Z(e.missing)})}):e.usable?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,K.jsx)(M,{className:`size-3.5`}),` `,y(`market.minutes`,{n:e.effort.minutes})]}),(0,K.jsx)(Y,{entry:e}),e.optional?.length?(0,K.jsx)(A,{title:y(`market.optionalHint`,{list:Z(e.optional)}),children:y(`market.without`,{list:Z(e.optional)})}):null,(0,K.jsx)(`span`,{className:`ml-auto inline-flex items-center gap-1.5`,children:e.formats.map(e=>(0,K.jsx)(J,{format:e,className:`size-4`},e))})]}):(0,K.jsx)(A,{tone:`warn`,children:y(`market.needsUpdate`)})]})]})}function X({title:e,children:t}){return(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`mb-1.5 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:e}),t]})}var Z=e=>e.map(e=>q(U,e)).join(`, `),qe={text:ye,web:_e,browser:ve,documents:Pe,image:F,video:L,speech:R,listening:x,code:Ie,connectors:ne,film:P};function Je(e){switch(e.type){case`page`:return re;case`agent`:return oe;case`generate`:return e.asset===`image`?F:e.asset===`video`?L:e.asset===`voice`?R:e.asset===`dashboard`?Oe:Se;case`widget`:return e.video?P:N;case`surface`:return N;case`film`:return P;case`review`:return he;case`result`:return se}return ge}function Ye(e){let t=new Set;for(let[n,r]of e.entries())for(let i of r.branches??[]){let r=i.to===`end`?e.length:e.findIndex(e=>e.id===i.to);for(let i=n+1;i<r;i++)t.add(e[i].id)}return t}function Xe(e){let t=Ye(e);return e.map(e=>({id:e.id,title:e.title,icon:Je(e),tone:ce[e.type]??`bg-paper-2 text-ink-2`,optional:t.has(e.id),branches:e.branches}))}function Q({title:e,children:t}){return(0,K.jsx)(`span`,{title:e,className:`inline-flex items-center gap-2 border-border border-l px-4 first:border-l-0 first:pl-0`,children:t})}function $({icon:e,children:t,more:n}){return(0,K.jsxs)(`div`,{className:`flex gap-2.5`,children:[(0,K.jsx)(`span`,{className:`mt-0.5 shrink-0`,children:e}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`text-[0.875rem] text-ink leading-snug`,children:t}),n?(0,K.jsx)(`div`,{className:`text-[0.75rem] text-ink-3 leading-snug`,children:n}):null]})]})}function Ze({className:e,children:t}){let n=(0,z.useRef)(null),[r,i]=(0,z.useState)({above:!1,below:!1});(0,z.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{let t=e.scrollTop>1,n=e.scrollTop+e.clientHeight<e.scrollHeight-1;i(e=>e.above===t&&e.below===n?e:{above:t,below:n})};t(),e.addEventListener(`scroll`,t,{passive:!0});let r=new ResizeObserver(t);return r.observe(e),e.firstElementChild&&r.observe(e.firstElementChild),()=>{e.removeEventListener(`scroll`,t),r.disconnect()}},[]);let a=`linear-gradient(to bottom, ${r.above?`transparent`:`black`} 0, black 28px, black calc(100% - 44px), ${r.below?`transparent`:`black`} 100%)`;return(0,K.jsx)(`div`,{ref:n,className:e,style:{maskImage:a,WebkitMaskImage:a},children:(0,K.jsx)(`div`,{children:t})})}function Qe({id:e,fallback:t,onClose:n,onUse:i,busy:a}){let c=u(),l=C(),d=r({queryKey:[`marketplace-entry`,e,g],queryFn:()=>S.get(`/api/studio/marketplace/${encodeURIComponent(e)}?lang=${g}`),enabled:!!e,retry:!1}),f=d.data??t,m=p({mutationFn:t=>{let n=`/api/studio/marketplace/${encodeURIComponent(e)}/star`;return t?S.put(n):S.del(n)},onSuccess:()=>Promise.all([c.invalidateQueries({queryKey:[`marketplace`]}),c.invalidateQueries({queryKey:[`marketplace-entry`,e]})])}),h=s()===`dark`,_=be[xe[f?.avatar||`round`]],v=h?`var(--card)`:`color-mix(in oklch, ${_??`var(--ink-4)`} 14%, var(--paper-2))`;return(0,K.jsx)(D,{open:!!e,onClose:n,wide:!0,bare:!0,children:f?(0,K.jsxs)(`div`,{className:`relative flex max-h-[calc(100dvh-48px)] flex-col rounded-2xl bg-card shadow-overlay max-sm:h-dvh max-sm:max-h-none max-sm:rounded-none`,children:[(0,K.jsx)(`button`,{type:`button`,"aria-label":y(`common.close`),onClick:n,className:`sm:-top-3.5 sm:-right-3.5 absolute top-3 right-3 z-20 flex size-9 items-center justify-center rounded-full bg-card text-ink-2 shadow-elevated ring-1 ring-border-soft transition hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,children:(0,K.jsx)(b,{className:`size-4`})}),(0,K.jsxs)(`header`,{className:`relative shrink-0 border-border-soft border-b px-5 pt-5 pb-4 text-ink sm:rounded-t-2xl sm:px-7`,style:{background:v,"--coin-bg":v},children:[(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 overflow-hidden sm:rounded-t-2xl`,children:(0,K.jsx)(`span`,{className:T(`-top-28 -right-10 absolute size-80 rounded-full bg-white blur-3xl`,h?`opacity-[0.14]`:`opacity-80`)})}),(0,K.jsx)(`div`,{className:`-bottom-5 absolute right-9 z-10 max-sm:hidden`,children:(0,K.jsx)(o,{kind:f.avatar,size:104})}),(0,K.jsxs)(`div`,{className:`relative sm:pr-36`,children:[(0,K.jsx)(`h2`,{className:`font-display font-semibold text-[1.375rem] leading-tight tracking-tight max-sm:pr-10`,children:f.title}),(0,K.jsx)(`p`,{className:`mt-1 text-[0.875rem] text-ink-2 leading-snug`,children:d.data?.description||f.pitch})]}),f.usable?(0,K.jsxs)(`div`,{className:`-mx-5 sm:-mx-7 relative mt-3.5 flex flex-wrap items-center gap-y-2 border-border-soft border-t px-5 pt-3 font-medium text-[0.875rem] sm:px-7 sm:pr-40`,children:[(0,K.jsxs)(Q,{title:y(`market.duration`),children:[(0,K.jsx)(M,{className:`size-4 text-ink-3`}),y(`market.minutes`,{n:f.effort.minutes})]}),(0,K.jsx)(Q,{title:y(`market.cost`),children:(0,K.jsx)(Y,{entry:f})}),(0,K.jsx)(Q,{title:y(`market.result`),children:f.formats.map(e=>(0,K.jsx)(J,{format:e,className:`size-4`},e))})]}):null]}),f.usable?(0,K.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-x-7 gap-y-6 px-5 pt-6 max-sm:overflow-y-auto max-sm:pb-4 sm:grid-cols-[230px_minmax(0,1fr)] sm:grid-rows-[minmax(0,1fr)] sm:px-7`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-5 sm:min-h-0 sm:overflow-y-auto`,children:[(0,K.jsx)(X,{title:y(`market.duration`),children:(0,K.jsx)($,{icon:(0,K.jsx)(M,{className:`size-4 text-moss`}),more:y(`market.durationHint`,{n:f.effort.fields}),children:y(`market.minutes`,{n:f.effort.minutes})})}),(0,K.jsx)(X,{title:y(`market.cost`),children:(0,K.jsx)($,{icon:(0,K.jsx)(le,{className:`size-4 text-amber`}),more:f.credits?y(`market.creditsHint`):void 0,children:(0,K.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2`,children:[(0,K.jsx)(Y,{entry:f}),f.credits?(0,K.jsx)(`span`,{className:`text-ink-2`,children:y(`market.creditsRange`,{n:Be(f.credits.credits)})}):null]})})}),(0,K.jsx)(X,{title:y(`market.result`),children:(0,K.jsx)(`div`,{className:`flex flex-col gap-2`,children:(d.data?.results??[]).map(e=>(0,K.jsx)($,{icon:(0,K.jsx)(J,{format:e.kind,className:`size-4 text-ember-strong`}),more:e.formats.map(e=>e.toUpperCase()).join(` · `),children:e.title},e.title))})}),(0,K.jsx)(X,{title:y(`market.needs`),children:(0,K.jsx)(`ul`,{className:`flex flex-col gap-2`,children:f.capabilities.map(e=>{let t=qe[e],n=f.missing.includes(e),r=f.optional?.includes(e);return(0,K.jsxs)(`li`,{className:T(`flex items-center gap-2.5 text-[0.875rem]`,n?`text-ink-3`:`text-ink-2`),children:[(0,K.jsx)(t,{className:T(`size-4 shrink-0`,n?`text-rose`:r?`text-amber`:`text-cobalt`)}),q(U,e),n?(0,K.jsx)(`span`,{className:`text-[0.75rem] text-rose`,children:y(`market.unavailable`)}):r?(0,K.jsx)(`span`,{className:`text-[0.75rem] text-amber`,children:y(`market.optional`)}):null]},e)})})})]}),(0,K.jsxs)(`div`,{className:`flex flex-col sm:min-h-0`,children:[(0,K.jsx)(`div`,{className:`mb-1.5 shrink-0 font-medium text-[0.75rem] text-ink-3 uppercase tracking-[0.06em]`,children:y(`market.steps`)}),(0,K.jsx)(Ze,{className:`-mr-2 overscroll-contain pt-1 pr-2 pl-1 sm:min-h-0 sm:flex-1 sm:overflow-y-auto`,children:d.isLoading?(0,K.jsx)(w,{className:`size-5 text-ink-3`}):(0,K.jsx)(z.Suspense,{fallback:(0,K.jsx)(w,{className:`size-5 text-ink-3`}),children:(0,K.jsx)(Re,{steps:Xe(d.data?.outline??[])})})})]})]}):(0,K.jsx)(`div`,{className:`flex-1 px-5 pt-6 sm:px-7`,children:(0,K.jsx)(`p`,{className:`rounded-lg bg-amber-tint p-3 text-[0.875rem] text-ink-2`,children:y(`market.needsUpdateHint`)})}),(0,K.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 px-5 pt-4 pb-5 max-sm:border-border-soft max-sm:border-t sm:px-7 sm:pb-6`,children:[f.plugin?(0,K.jsx)(`span`,{className:`mr-auto flex items-center`,children:(0,K.jsx)(Ge,{plugin:f.plugin})}):(0,K.jsxs)(j,{variant:`ghost`,className:`mr-auto`,title:y(`market.starHint`),"aria-pressed":f.starred,busy:m.isPending,onClick:()=>m.mutate(!f.starred),children:[(0,K.jsx)(I,{className:T(`size-4`,f.starred&&`fill-amber text-amber`)}),(0,K.jsx)(`span`,{className:`max-sm:sr-only`,children:y(f.starred?`market.starred`:`market.star`)})]}),(0,K.jsx)(j,{variant:`secondary`,onClick:n,children:y(`common.close`)}),f.usable&&f.missing.length?(0,K.jsx)(j,{variant:`secondary`,onClick:()=>l(`/settings/models`),children:y(`editor.models.settings`)}):null,i?(0,K.jsx)(j,{disabled:!f.usable||f.missing.length>0||!!f.needs?.length,title:f.needs?.length?y(`market.needsProHint`,{list:f.needs.join(`, `)}):f.missing.length?y(`market.missingHint`,{list:Z(f.missing)}):f.optional?.length?y(`market.optionalHint`,{list:Z(f.optional)}):void 0,busy:a,onClick:()=>i(f),children:y(`market.use`)}):null]})]}):(0,K.jsx)(`div`,{className:`flex min-h-48 flex-col items-center justify-center gap-3 rounded-2xl bg-card p-8 text-[0.875rem] text-ink-2 shadow-overlay`,children:d.isLoading?(0,K.jsx)(w,{className:`size-6 text-ink-3`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{children:y(`market.notFound`)}),(0,K.jsx)(j,{variant:`secondary`,onClick:n,children:y(`common.close`)})]})})})}function $e({name:e,value:t,options:n,onChange:r}){let[i,a]=(0,z.useState)(!1),o=(0,z.useRef)(null);(0,z.useEffect)(()=>{if(!i)return;let e=e=>{o.current?.contains(e.target)||a(!1)},t=e=>{e.key===`Escape`&&a(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[i]);let s=n.find(e=>e.value===t);return(0,K.jsxs)(`div`,{ref:o,className:`relative`,children:[(0,K.jsxs)(`div`,{className:T(`flex h-8 items-center rounded-full text-[0.8125rem] transition`,s?`bg-ember-tint text-ink`:`text-ink-2 hover:bg-paper-2 hover:text-ink`,i&&!s&&`bg-paper-2 text-ink`),children:[(0,K.jsx)(`button`,{type:`button`,"aria-haspopup":`listbox`,"aria-expanded":i,onClick:()=>a(!i),className:T(`flex h-full items-center gap-1.5 rounded-full pl-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus`,s?`pr-1`:`pr-2.5`),children:s?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-ink-3`,children:e}),(0,K.jsx)(`span`,{className:`font-medium`,children:s.label})]}):(0,K.jsxs)(K.Fragment,{children:[e,(0,K.jsx)(_,{className:T(`size-3.5 transition`,i&&`rotate-180`)})]})}),s?(0,K.jsx)(`button`,{type:`button`,"aria-label":`${e}: ${y(`market.reset`)}`,onClick:()=>r(``),className:`mr-1 flex size-6 items-center justify-center rounded-full text-ink-3 hover:bg-card hover:text-ink`,children:(0,K.jsx)(b,{className:`size-3.5`})}):null]}),i?(0,K.jsx)(`div`,{role:`listbox`,"aria-label":e,className:`absolute top-full left-0 z-30 mt-1.5 max-h-80 min-w-60 overflow-y-auto rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:n.map(e=>(0,K.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":e.value===t,disabled:!e.count||e.unavailable,onClick:()=>{r(e.value===t?``:e.value),a(!1)},className:T(`flex w-full items-center gap-2.5 rounded-lg px-2.5 py-2 text-left text-[0.875rem] transition coarse:py-2.5`,e.count&&!e.unavailable?`text-ink-2 hover:bg-paper-2 hover:text-ink`:`text-ink-4`,e.value===t&&`font-medium text-ink`),children:[e.icon,(0,K.jsx)(`span`,{className:`flex-1 whitespace-nowrap`,children:e.label}),e.value===t?(0,K.jsx)(ee,{className:`size-4 text-ember`}):e.unavailable?(0,K.jsx)(`span`,{className:`whitespace-nowrap text-[0.75rem] text-ink-4`,children:y(`market.unavailable`)}):(0,K.jsx)(`span`,{className:`text-[0.75rem] text-ink-4 tabular-nums`,children:e.count})]},e.value))}):null]})}function et(e,t){let[n,r]=(0,z.useState)(e);return(0,z.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var tt=60;function nt({onUse:e,busy:t,open:n}){let[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(ze),[s,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(n??null),f=et(r.trim(),250),p=we({queryKey:[`marketplace`,g,f,a,s],queryFn:({pageParam:e})=>{let t=new URLSearchParams({lang:g,limit:String(tt),offset:String(e)});f&&t.set(`q`,f);for(let[e,n]of Object.entries(a))n&&t.set(e,n);return s&&t.set(`starred`,`1`),S.get(`/api/studio/marketplace?${t}`)},initialPageParam:0,getNextPageParam:(e,t)=>{let n=t.reduce((e,t)=>e+t.entries.length,0);return n<e.total?n:void 0},placeholderData:d}),m=p.data?.pages[0],h=p.data?.pages.flatMap(e=>e.entries)??[],_=m?.all??0,v=r.trim()!==f||p.isFetching&&!p.isFetchingNextPage,x=(e,t,n)=>Object.keys(t).filter(t=>m?.facets[e]?.[t]!==void 0).map(r=>({value:r,label:q(t,r),icon:n?.(r),count:(m?.facets[e])[r]??0,unavailable:e===`capability`&&ee.has(r)})),ee=new Set(m?.unavailable??[]),te=x(`useCase`,H),C=[{key:`industry`,name:y(`market.industry`),options:x(`industry`,V)},{key:`format`,name:y(`market.format`),options:x(`format`,B,e=>(0,K.jsx)(J,{format:e,className:`size-4 text-ink-3`}))},{key:`plan`,name:y(`market.plan`),options:x(`plan`,Le)},{key:`capability`,name:y(`market.capability`),options:x(`capability`,U,e=>{let t=qe[e];return(0,K.jsx)(t,{className:`size-4 text-ink-3`})})}],E=!!r.trim()||s||Object.values(a).some(Boolean),D=()=>{o(ze),i(``),c(!1)};if(p.isLoading)return(0,K.jsx)(`div`,{className:`flex justify-center py-10`,children:(0,K.jsx)(w,{className:`size-6 text-ink-3`})});let O=m?.offline?(0,K.jsxs)(`p`,{className:`mt-4 flex items-center justify-center gap-2 text-[0.8125rem] text-ink-3`,children:[(0,K.jsx)(de,{className:`size-4 shrink-0`}),y(`market.offline`)]}):null;if(!_&&!E)return O;let k=r?(0,K.jsx)(`button`,{type:`button`,"aria-label":y(`market.reset`),onClick:()=>i(``),className:`-mr-1.5 flex size-7 shrink-0 items-center justify-center rounded-full text-ink-3 hover:bg-paper-2 hover:text-ink`,children:(0,K.jsx)(b,{className:`size-4`})}):null,A=e=>T(`inline-flex h-7 shrink-0 items-center gap-1 whitespace-nowrap rounded-full px-2.5 text-[0.78125rem] transition`,e?`bg-card font-medium text-ink shadow-soft ring-1 ring-border-soft`:`text-ink-3 hover:bg-card/60 hover:text-ink`);return(0,K.jsxs)(`div`,{children:[(0,K.jsxs)(`label`,{className:`relative mx-auto flex h-10 max-w-md items-center gap-2.5 rounded-full bg-card px-4 shadow-soft ring-1 ring-border-soft transition focus-within:ring-2 focus-within:ring-focus sm:h-11`,children:[v?(0,K.jsx)(w,{className:`size-4 shrink-0 text-ink-3`}):(0,K.jsx)(fe,{className:`size-4 shrink-0 text-ink-3`}),(0,K.jsx)(`input`,{type:`search`,value:r,onChange:e=>i(e.target.value),placeholder:y(`market.search`),"aria-label":y(`market.search`),className:`min-w-0 flex-1 bg-transparent text-[0.9375rem] outline-none placeholder:text-ink-4 [&::-webkit-search-cancel-button]:hidden`}),k]}),O,(0,K.jsxs)(`div`,{className:`max-sm:-mx-3 mt-4 flex gap-1 max-sm:overflow-x-auto max-sm:px-3 max-sm:[scrollbar-width:none] sm:flex-wrap sm:justify-center max-sm:[&::-webkit-scrollbar]:hidden`,children:[[{value:``,label:y(`market.all`)},...te].map(e=>(0,K.jsx)(`button`,{type:`button`,"aria-pressed":!s&&a.useCase===e.value,onClick:()=>{c(!1),o({...a,useCase:e.value})},className:A(!s&&a.useCase===e.value),children:e.label},e.value)),(0,K.jsxs)(`button`,{type:`button`,"aria-pressed":s,onClick:()=>c(!s),className:A(s),children:[(0,K.jsx)(I,{className:T(`size-3.5`,s&&`fill-amber text-amber`)}),y(`market.starred`)]})]}),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-1 gap-y-2 sm:mt-6`,children:[s?null:C.map(e=>(0,K.jsx)($e,{name:e.name,value:a[e.key],options:e.options,onChange:t=>o({...a,[e.key]:t})},e.key)),(0,K.jsxs)(`span`,{className:`ml-auto flex items-center gap-3 whitespace-nowrap pl-2 text-[0.8125rem] text-ink-3`,children:[E?(0,K.jsxs)(`button`,{type:`button`,onClick:D,className:`inline-flex items-center gap-1 text-ember-strong underline-offset-2 hover:underline`,children:[(0,K.jsx)(b,{className:`size-3.5 max-sm:size-4`}),(0,K.jsx)(`span`,{className:`max-sm:sr-only`,children:y(`market.resetShort`)})]}):null,E?(0,K.jsx)(`span`,{className:`tabular-nums sm:hidden`,children:y(`market.countOfShort`,{n:m?.total??0,all:_})}):null,(0,K.jsx)(`span`,{className:T(`tabular-nums`,E&&`max-sm:hidden`),children:E?y(`market.countOf`,{n:m?.total??0,all:_}):y(`market.count`,{n:_})})]})]}),h.length?(0,K.jsx)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:h.map(e=>(0,K.jsx)(Ke,{entry:e,onOpen:()=>u(e.id)},e.id))}):(0,K.jsxs)(`div`,{className:`py-10 text-center text-[0.875rem] text-ink-3`,children:[(0,K.jsx)(`p`,{children:y(s?`market.noneStarred`:`market.none`)}),(0,K.jsx)(j,{variant:`ghost`,className:`mt-2`,onClick:D,children:y(`market.reset`)})]}),p.hasNextPage?(0,K.jsx)(`div`,{className:`mt-6 flex justify-center`,children:(0,K.jsx)(j,{variant:`secondary`,busy:p.isFetchingNextPage,onClick:()=>void p.fetchNextPage(),children:y(`market.more`)})}):null,(0,K.jsx)(Qe,{id:l,fallback:h.find(e=>e.id===l)??null,onClose:()=>u(null),onUse:e,busy:t})]})}var rt={de:[`Stellenanzeige aus ein paar Stichworten, als PDF und LinkedIn-Post`,`Produktbeschreibung für den Onlineshop mit drei Bildvarianten`,`Wettbewerbsanalyse zu einer Firma mit Quellen`,`Lead aus einem Formular in unser CRM eintragen`],en:[`A job ad from a few keywords, as PDF and LinkedIn post`,`A shop product description with three image variants`,`A competitor analysis for a company, with sources`,`Put a lead from a form into our CRM`]};function it(){let e=C(),t=u(),{project:n}=m(),r=f(),[i,a]=(0,z.useState)(``),[s]=k(),c=p({mutationFn:e=>S.post(`/api/studio/wizards`,{projectId:n.id,starterId:e,lang:g}),onSuccess:async({id:n},r)=>{await t.invalidateQueries({queryKey:[`projects`]}),await t.invalidateQueries({queryKey:[`wizards`]}),e(r?`/edit/${n}`:`/edit/${n}?prompt=${encodeURIComponent(i.trim())}`)}}),l=()=>{i.trim()&&n&&c.mutate(void 0)};return!r||n?.readOnly?(0,K.jsx)(te,{to:`/`,replace:!0}):(0,K.jsxs)(`div`,{className:`animate-rise pt-4`,children:[(0,K.jsxs)(`div`,{className:`mx-auto max-w-2xl`,children:[(0,K.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[(0,K.jsx)(o,{kind:`sprout`,size:150,fluffy:!0}),(0,K.jsx)(`h1`,{className:`mt-2 font-display font-semibold text-[2rem] leading-tight tracking-tight sm:text-[2.375rem]`,children:y(`new.title`)})]}),(0,K.jsxs)(`div`,{className:`mt-8 rounded-2xl bg-card p-2 shadow-elevated ring-1 ring-border-soft focus-within:ring-focus`,children:[(0,K.jsx)(E,{autoFocus:!0,minRows:4,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&l()},placeholder:y(`new.placeholder`),className:`border-0 bg-transparent text-[1rem] shadow-none focus:ring-0`}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-2 pb-1`,children:[(0,K.jsx)(`span`,{className:`hidden text-[0.75rem] text-ink-4 sm:block`,children:y(`new.hint`)}),(0,K.jsxs)(j,{size:`md`,onClick:l,busy:c.isPending&&!c.variables,disabled:!i.trim(),children:[y(`new.build`),` `,(0,K.jsx)(ae,{className:`size-4`})]})]})]}),(0,K.jsx)(`div`,{className:`mt-4 flex flex-wrap justify-center gap-2`,children:rt[g].map(e=>(0,K.jsx)(`button`,{type:`button`,onClick:()=>a(e),className:`rounded-full bg-paper-2 px-3.5 py-1.5 text-[0.8125rem] text-ink-2 transition hover:bg-paper-3 hover:text-ink`,children:e},e))})]}),(0,K.jsxs)(`section`,{className:`mx-auto max-w-5xl`,children:[(0,K.jsx)(`h2`,{className:`mt-16 mb-5 text-center font-medium text-[0.8125rem] text-ink-3 uppercase tracking-[0.08em]`,children:y(`new.orStarter`)}),(0,K.jsx)(nt,{open:s.get(`starter`),busy:c.isPending&&!!c.variables,onUse:e=>n&&!c.isPending&&c.mutate(e.id)}),c.error?(0,K.jsx)(`p`,{className:`mt-3 text-center text-[0.875rem] text-rose`,children:c.error.message}):null]}),(0,K.jsx)(`div`,{className:`mt-8 flex justify-center`,children:(0,K.jsx)(pe,{variant:`ghost`,label:y(`new.import`)})})]})}export{it as NewWizardPage};
@@ -1,2 +1,2 @@
1
- import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{ut as r,z as i}from"./definition-AlI4g-wR.js";import{c as a,l as o,m as s,s as c}from"./session-DCcgTTmG.js";import{$ as l,A as u,I as d,K as f,L as p,M as m,S as h,U as g,W as _,X as v,a as y,c as b,d as ee,et as te,f as x,g as S,h as C,i as w,m as ne,n as T,nt as re,o as E,p as D,r as O,s as k,t as A,tt as ie}from"./ui-Wxaw_APn.js";import{t as ae}from"./type-kpWj7Zf1.js";import{_ as oe,b as se,t as j,v as ce,y as M}from"./RunnerView-DSlReODC.js";import{S as le,T as ue,_ as de,b as N,f as P,g as F,h as fe,m as I,p as L,r as R,v as z,x as B,y as V}from"./HomePage-BlD0wZB0.js";import{_ as pe,a as me,b as H,c as he,d as ge,f as _e,g as ve,h as ye,i as be,l as xe,m as Se,n as U,o as Ce,p as we,s as Te,u as Ee,v as De,x as W,y as G}from"./RunDrawer-Dp-JowDX.js";import{i as K,n as q,r as J}from"./ImportWizard-BZDtNJg1.js";import{t as Oe}from"./external-link-M3mEgZA-.js";import{r as ke,t as Ae}from"./wand-sparkles-DaINku4r.js";import{n as je,t as Y}from"./trash-WwlTeE_V.js";import{t as Me}from"./refresh-cw-DEKCEuIO.js";import{t as Ne}from"./star-BwhVXiJM.js";import{N as Pe,P as Fe,a as Ie,c as Le,i as Re,m as ze,o as Be,r as Ve,s as He,t as Ue}from"./index-BdrX1tJ4.js";import{a as X,c as We,f as Ge,i as Ke,m as qe,n as Je,o as Ye,p as Xe,r as Ze,s as Z,t as Qe,u as $e}from"./settings-menu-C9fE9M0f.js";var et={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`]};et.node;var tt=f(et),nt={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`}]]};nt.node;var rt=f(nt),it={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`]};it.node;var at=f(it),Q=e(t(),1),$=e(n(),1),ot={backgroundImage:`repeating-conic-gradient(#c9c9c9 0% 25%, #dedede 0% 50%)`,backgroundSize:`16px 16px`};function st({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:m(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 ct(e,t){confirm(m(`project.removeConfirm`,{name:e.name}))&&t.remove(e.id)}function lt({projectId:e,file:t,small:n}){let r=z(e,t.id);return t.mime.startsWith(`image/`)?(0,$.jsx)(`img`,{src:r,alt:``,loading:`lazy`,className:S(`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)(rt,{className:n?`size-5`:`size-7`}):(0,$.jsx)(se,{className:n?`size-5`:`size-7`})})}function ut({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)(O,{tone:`ember`,children:m(`project.logoMain`)})}):null,(0,$.jsxs)(`div`,{className:`relative h-28 overflow-hidden rounded-md bg-paper-2`,style:t===`logo`?ot:void 0,children:[o&&i.mime.startsWith(`image/`)?(0,$.jsx)(`button`,{type:`button`,"aria-label":`${m(`project.preview`)}: ${i.name}`,onClick:()=>o(i),className:`block size-full cursor-zoom-in`,children:(0,$.jsx)(lt,{projectId:e,file:i})}):(0,$.jsx)(lt,{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)(E,{label:m(`project.preview`),onClick:()=>o(i),className:`size-8 bg-card shadow-soft`,children:(0,$.jsx)(ke,{className:`size-4`})}):null,t===`logo`&&a>0&&!r.readOnly?(0,$.jsx)(E,{label:m(`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)(Ne,{className:`size-4`})}):null,r.readOnly?null:(0,$.jsx)(E,{label:m(`project.remove`),onClick:()=>ct(i,r),className:`size-8 bg-card shadow-soft hover:text-rose`,children:(0,$.jsx)(Y,{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)(st,{file:i,actions:r})]},i.id)),a&&!r.readOnly?(0,$.jsxs)(L,{accept:i,multiple:!1,onFiles:e=>r.upload(t,e),className:`min-h-28 flex-col p-3`,children:[r.busy?(0,$.jsx)(x,{className:`size-5`}):(0,$.jsx)(d,{className:`size-5`}),a]}):null]})}function dt({projectId:e,data:t,readOnly:n}){let r=N(e,n);return(0,$.jsxs)(F,{title:m(`project.logos`),hint:m(`project.logosHint`),children:[(0,$.jsx)(ut,{projectId:e,kind:`logo`,files:t.files.filter(e=>e.kind===`logo`),actions:r,accept:`image/*`,addLabel:m(`project.logoAdd`)}),r.error?(0,$.jsx)(`p`,{className:`mt-3 text-[0.875rem] text-rose`,children:r.error}):null]})}var ft=e=>[(e.name.includes(`.`)?e.name.split(`.`).pop():e.mime.split(`/`).pop())?.toUpperCase().slice(0,5),de(e.size)].filter(Boolean).join(` · `);function pt({projectId:e,file:t,actions:n,onClose:r}){let i=z(e,t.id);return(0,$.jsxs)(w,{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:ft(t)}),(0,$.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,"aria-label":m(`project.openOriginal`),title:m(`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)(Oe,{className:`size-4`})})]}),t.mime.startsWith(`image/`)?(0,$.jsx)(`div`,{className:`overflow-hidden rounded-lg`,style:ot,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)(st,{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":`${m(`project.preview`)}: ${t.name}`,onClick:r,className:`size-14 shrink-0 cursor-zoom-in overflow-hidden rounded-md bg-paper-2`,children:(0,$.jsx)(lt,{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:ft(t)})]}),(0,$.jsx)(st,{file:t,actions:n})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start`,children:[(0,$.jsx)(E,{label:m(`project.preview`),onClick:r,children:(0,$.jsx)(ke,{className:`size-4`})}),n.readOnly?null:(0,$.jsx)(E,{label:m(`project.remove`),onClick:()=>ct(t,n),className:`hover:text-rose`,children:(0,$.jsx)(Y,{className:`size-4`})})]})]})}function ht({projectId:e,data:t,readOnly:n}){let r=N(e,n),[i,a]=B(`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)(F,{title:m(`project.assets`),hint:m(`project.assetsHint`),children:[u.length?(0,$.jsx)(I,{layout:i,onToggle:a,children:(0,$.jsx)(fe,{value:o,onChange:s,placeholder:m(`project.assetSearch`)})}):null,p.length?(0,$.jsx)(`div`,{className:`mb-3`,children:i===`cards`?(0,$.jsx)(ut,{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:m(`project.staysLocal`)}):(0,$.jsxs)(L,{accept:`image/*,video/*,audio/*`,onFiles:e=>r.upload(`asset`,e),className:`h-16 w-full`,children:[r.busy?(0,$.jsx)(x,{className:`size-4`}):(0,$.jsx)(q,{className:`size-4`}),m(`project.drop`),` `,(0,$.jsx)(`span`,{className:`underline`,children:m(`project.assetAdd`)})]}),r.error?(0,$.jsx)(`p`,{className:`mt-3 text-[0.875rem] text-rose`,children:r.error}):null,d?(0,$.jsx)(pt,{projectId:e,file:d,actions:r,onClose:()=>l(null)}):null]})}function gt(e,t,n){return i({queryKey:[`project-file-text`,t.id,t.chars,n],queryFn:()=>h.get(`/api/studio/projects/${e}/files/${t.id}/text?limit=${n}`),enabled:t.status===`ready`,staleTime:6e4})}function _t(e){return((e.name.includes(`.`)?e.name.split(`.`).pop():``)||e.mime.split(`/`).pop()||``).toUpperCase().slice(0,5)}var vt=e=>[_t(e),e.pages?m(`project.pages`,{n:e.pages}):null,de(e.size)].filter(Boolean).join(` · `),yt=2e5;function bt({projectId:e,fileId:t,readOnly:n,onGone:i}){let a=r(),o=le(e),s=Se(e),c=N(e,n),l=o.data?.files.find(e=>e.id===t),u=l?l.mime===`application/pdf`||l.mime.startsWith(`image/`):!1,[d,f]=(0,Q.useState)(null);if(!l)return o.isLoading?(0,$.jsx)(x,{className:`mx-auto text-ink-3`}):null;let p=d??(u?`original`:`text`),h=s.data?.items.find(e=>e.key===`f:${l.id}`),g=z(e,l.id),_=(e,t)=>(0,$.jsx)(`button`,{type:`button`,"aria-pressed":p===e,onClick:()=>f(e),className:S(`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:l.name}),(0,$.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 max-sm:hidden`,children:vt(l)}),(0,$.jsx)(`a`,{href:g,target:`_blank`,rel:`noreferrer`,"aria-label":m(`project.openOriginal`),title:m(`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)(Oe,{className:`size-4`})}),n?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(E,{label:m(`project.reindex`),onClick:async()=>{await c.reindex(l.id),await a.invalidateQueries({queryKey:[`knowledge`,e]})},children:(0,$.jsx)(Me,{className:`size-4`})}),(0,$.jsx)(E,{label:m(`know.deleteFile`),className:`hover:text-rose`,onClick:async()=>{confirm(m(`data.confirmDelete`,{title:l.name}))&&(await c.remove(l.id),await a.invalidateQueries({queryKey:[`knowledge`,e]}),i())},children:(0,$.jsx)(Y,{className:`size-4`})})]})]}),(0,$.jsx)(_e,{projectId:e,itemKey:`f:${l.id}`,has:h?.categories??[],originLabel:h?.originLabel??null,kept:!1,review:null,file:null,readOnly:n,onReviewed:()=>void 0}),(0,$.jsx)(`div`,{className:`px-1`,children:(0,$.jsx)(st,{file:l,actions:c})}),l.status===`failed`?(0,$.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:l.error}):null,(0,$.jsxs)(T,{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:[u?_(`original`,m(`project.original`)):null,_(`text`,m(`project.readText`))]}),p===`original`?l.mime===`application/pdf`?(0,$.jsx)(`iframe`,{src:g,title:l.name,className:`h-[70dvh] w-full rounded-b-xl bg-paper-2`}):(0,$.jsx)(`img`,{src:g,alt:``,className:`mx-auto max-h-[70dvh] object-contain p-4`}):(0,$.jsx)(xt,{projectId:e,file:l})]})]})}function xt({projectId:e,file:t}){let n=gt(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)(x,{})}):n.data?.text?(0,$.jsxs)(`div`,{className:`overflow-x-auto p-4 sm:p-5`,children:[(0,$.jsx)(ze,{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:m(`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:m(`project.noText`)})}var St=[`text`,`longtext`,`number`,`date`,`url`,`email`,`phone`,`boolean`],Ct=/^(\d{4}-\d{2}-\d{2}|\d{1,2}\.\s?\d{1,2}\.\s?\d{4})$/,wt=/^[+-]?\d{1,3}([.,\s']?\d{3})*([.,]\d+)?$/,Tt=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,Et=/^(https?:\/\/|www\.)\S+$/i,Dt=/^\+?[\d\s()/.-]{7,20}$/,Ot=/^(ja|nein|yes|no|true|false)$/i;function kt(e){let t=e.trim();return t?t.includes(`
2
- `)||t.length>140?`longtext`:Ot.test(t)?`boolean`:Tt.test(t)?`email`:Et.test(t)?`url`:Ct.test(t)?`date`:wt.test(t)&&!/^(\+|0\d)/.test(t)?`number`:Dt.test(t)&&t.replace(/\D/g,``).length>=7?`phone`:`text`:`text`}function At(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 jt=[{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`}],Mt={facts:100,colors:12,files:{logo:8,asset:100,document:2e3},bytes:{logo:5e6,asset:15e6,video:8e7,document:3e7}},Nt=/^#[0-9a-fA-F]{6}$/;function Pt({onAdd:e,onClose:t}){let[n,r]=(0,Q.useState)(`#e0531b`),[i,a]=(0,Q.useState)(``),o=Nt.test(n);return(0,$.jsx)(w,{open:!0,onClose:t,title:m(`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)(b,{children:m(`project.colorValue`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(D,{value:o?n:`#888888`,onChange:e=>r(e.target.value)}),(0,$.jsx)(k,{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)(b,{children:m(`project.colorUseLabel`)}),(0,$.jsx)(k,{autoFocus:!0,value:i,maxLength:120,placeholder:m(`project.colorName`),onChange:e=>a(e.target.value)}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:m(`project.colorUse`)})]}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(A,{variant:`ghost`,onClick:t,children:m(`common.cancel`)}),(0,$.jsx)(A,{type:`submit`,disabled:!o,children:m(`project.add`)})]})]})})}function Ft({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=V(i.filter(e=>Nt.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)(F,{title:m(`project.colors`),hint:m(`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)(D,{value:Nt.test(e.value)?e.value:`#888888`,onChange:t=>l(e.id,{value:t.target.value})}),(0,$.jsx)(k,{value:e.name,placeholder:m(`project.colorName`),maxLength:120,onChange:t=>l(e.id,{name:t.target.value}),className:`min-w-0 flex-1`}),(0,$.jsx)(k,{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)(O,{tone:`ember`,children:m(`project.colorAccent`)})}):n?null:(0,$.jsx)(E,{label:m(`project.colorFirst`),onClick:()=>a(t=>[e,...t.filter(t=>t.id!==e.id)]),children:(0,$.jsx)(_,{className:`size-4`})}),n?null:(0,$.jsx)(E,{label:m(`project.remove`),onClick:()=>a(t=>t.filter(t=>t.id!==e.id)),className:`hover:text-rose`,children:(0,$.jsx)(Y,{className:`size-4`})})]})]},e.id))}),i.length&&!n?(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:m(`project.colorUse`)}):null,i.length<Mt.colors&&!n?(0,$.jsxs)(A,{variant:`secondary`,size:`sm`,className:i.length?`mt-3`:void 0,onClick:()=>s(!0),children:[(0,$.jsx)(d,{className:`size-4`}),` `,m(`project.colorAdd`)]}):null,o?(0,$.jsx)(Pt,{onClose:()=>s(!1),onAdd:e=>a(t=>[...t,{...e,id:`c${r.current++}`}])}):null]})}var It=e=>/^(ja|yes|true)$/i.test(e.trim()),Lt={text:ae,longtext:at,number:H,date:W,url:je,email:M,phone:oe,boolean:G};function Rt({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=Lt[e??t],l=`${m(`project.factType`)}: ${m(`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:S(`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:S(`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)(Ae,{className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{className:`flex-1`,children:m(`project.factAuto`)}),(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-4`,children:m(`project.type.${t}`)}),(0,$.jsx)(g,{className:S(`size-4 shrink-0`,e&&`invisible`)})]}),(0,$.jsx)(`div`,{className:`mx-2 my-1 h-px bg-border-soft`}),St.map(t=>{let n=Lt[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:m(`project.type.${t}`)}),(0,$.jsx)(g,{className:S(`size-4 shrink-0`,e!==t&&`invisible`)})]},t)})]}):null]})}function zt({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=V(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])},f=e=>t=>{t&&i.current===e&&(i.current=null,t.focus())},p=jt.filter(e=>!a.some(t=>t.key===e.key));return(0,$.jsxs)(F,{title:m(`project.facts`),hint:m(`project.factsHint`),save:s,locked:n,action:a.length<Mt.facts&&!n?(0,$.jsxs)(A,{variant:`secondary`,size:`sm`,onClick:()=>l({},`label`,!0),children:[(0,$.jsx)(d,{className:`size-4`}),` `,m(`project.factAdd`)]}):null,children:[(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>{let t=kt(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)(k,{ref:f(`${e.id}:label`),value:e.label,placeholder:m(`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:At(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)(ne,{checked:It(e.value),label:e.label,onChange:t=>c(e.id,{value:m(t?`project.yes`:`project.no`)})}),(0,$.jsx)(`span`,{className:`text-[0.875rem] text-ink-2`,children:It(e.value)?m(`project.yes`):m(`project.no`)})]}):(0,$.jsx)(C,{ref:f(`${e.id}:value`),rows:1,minRows:r===`longtext`?2:1,maxRows:10,value:e.value,placeholder:m(`project.factValue`),onChange:t=>c(e.id,{value:t.target.value}),className:`min-h-11`}),(0,$.jsx)(Rt,{type:e.type,detected:t,onChange:t=>c(e.id,{type:t})}),n?null:(0,$.jsx)(E,{label:m(`project.remove`),onClick:()=>o(t=>t.filter(t=>t.id!==e.id)),className:`size-11 rounded-lg hover:text-rose`,children:(0,$.jsx)(Y,{className:`size-4`})})]},e.id)})}),a.length<Mt.facts&&!n?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 ${a.length?`mt-4`:``}`,children:[(0,$.jsxs)(A,{variant:`secondary`,size:`sm`,onClick:()=>l({},`label`),children:[(0,$.jsx)(d,{className:`size-4`}),` `,m(`project.factAdd`)]}),p.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>l({key:e.key,label:u===`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`}),` `,u===`en`?e.en:e.de]},e.key))]}):null]})}function Bt({project:e,save:t}){let[n,r]=(0,Q.useState)(e.brand.name??``),[i,a]=(0,Q.useState)(e.brand.about??``),o=V({name:n.trim(),about:i.trim()},e=>t({brand:e}));return(0,$.jsx)(F,{title:m(`project.base`),hint:m(`project.baseHint`),save:o,locked:e.readOnly,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(b,{children:m(`project.title`)}),(0,$.jsx)(k,{value:n,maxLength:120,onChange:e=>r(e.target.value)}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:m(`project.titleHint`)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(b,{children:m(`project.about`)}),(0,$.jsx)(C,{minRows:4,value:i,onChange:e=>a(e.target.value)}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:m(`project.aboutHint`)})]})]})})}function Vt({project:e,group:t,docked:n=!1,children:i}){let c=r(),l=le(e.id),[u,d]=(0,Q.useState)(0),f=async t=>{await h.patch(`/api/studio/projects/${e.id}`,t),await c.invalidateQueries({queryKey:[`projects`]})},p=s({mutationFn:()=>h.del(`/api/studio/projects/${e.id}`),onSuccess:()=>c.invalidateQueries({queryKey:[`projects`]})}),g=o(),_=a(),v=l.data??{files:[],embeddings:!0},y=`${e.id}:${u}`,b=e.readOnly;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-9 pb-32`,children:[b?(0,$.jsx)(Xe,{children:qe(e)}):(0,$.jsx)(Le,{projectId:e.id,part:t,docked:n,onChanged:()=>d(e=>e+1)},e.id),t===`info`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(P,{id:`base`,children:(0,$.jsx)(Bt,{project:e,save:f},`base:${y}`)}),(0,$.jsx)(P,{id:`logos`,children:(0,$.jsx)(dt,{projectId:e.id,data:v,readOnly:b})}),(0,$.jsx)(P,{id:`colors`,children:(0,$.jsx)(Ft,{colors:e.brand.colors??[],save:e=>f({brand:{colors:e}}),readOnly:b},`colors:${y}`)}),(0,$.jsx)(P,{id:`assets`,children:(0,$.jsx)(ht,{projectId:e.id,data:v,readOnly:b})}),(0,$.jsx)(P,{id:`facts`,children:(0,$.jsx)(zt,{facts:e.facts,save:e=>f({facts:e}),readOnly:b},`facts:${y}`)})]}):null,i,t===`info`&&g&&!b&&_?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(A,{variant:`danger`,busy:p.isPending,onClick:()=>confirm(`${m(`settings.delete`)}?`)&&p.mutate(),children:m(`settings.delete`)}),p.error?(0,$.jsx)(`p`,{className:`mt-2 text-[0.875rem] text-rose`,children:p.error.message}):null]}):null]})}var Ht={q:``,mode:``,days:0};function Ut(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 a=r.toString();return i({queryKey:[`results`,e,a],queryFn:()=>h.get(`/api/studio/projects/${e}/results${a&&`?${a}`}`),enabled:!!e,placeholderData:e=>e,refetchInterval:15e3})}function Wt({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)(J,{className:`-translate-y-1/2 pointer-events-none absolute top-1/2 left-3 size-4 text-ink-3`}),(0,$.jsx)(k,{type:`search`,value:n,onChange:e=>r(e.target.value),placeholder:m(`space.resultsSearch`),"aria-label":m(`space.resultsSearch`),className:`w-full pl-9`})]}),(0,$.jsx)(ee,{value:e.mode,onChange:n=>t({...e,mode:n}),options:[{value:``,label:m(`space.resultsModeAll`)},{value:`live`,label:`Live`},{value:`test`,label:`Test`}],className:`w-32`}),(0,$.jsx)(ee,{value:String(e.days),onChange:n=>t({...e,days:Number(n)}),options:[{value:`0`,label:m(`space.resultsAnyTime`)},{value:`1`,label:m(`space.resultsDay`)},{value:`7`,label:m(`space.resultsDays`,{n:7})},{value:`30`,label:m(`space.resultsDays`,{n:30})}],className:`w-44`})]})}function Gt({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(u,{dateStyle:`medium`,timeStyle:`short`});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(F,{title:t?o(t):m(`space.resultsAll`),hint:m(`space.resultsHint`),plain:!0,children:[(0,$.jsx)(Wt,{filter:n,onFilter:r}),e.runs.length?(0,$.jsx)(T,{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))} · `,m(`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:m(`space.resultFiles`,{n:e.assets}),children:[(0,$.jsx)(p,{className:`size-3.5`}),e.assets]}):null,e.mode===`test`?(0,$.jsx)(O,{children:`Test`}):(0,$.jsxs)(O,{tone:`live`,children:[`Live v`,e.version]})]},e.id))}):(0,$.jsx)(T,{children:(0,$.jsx)(y,{children:n.q.trim()||n.mode||n.days?m(`space.resultsNone`):m(`space.resultsEmpty`)})})]}),i?(0,$.jsx)(U,{header:(0,$.jsxs)($.Fragment,{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)(O,{children:`Test`}):(0,$.jsxs)(O,{tone:`live`,children:[`Live v`,i.version]})]}),onClose:()=>a(null),children:(0,$.jsx)(j,{runId:i.id,compact:!0},i.id)}):null]})}function Kt({project:e,save:t}){let[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(e.name),o=s({mutationFn:()=>t({name:i.trim()}),onSuccess:()=>r(!1)});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(E,{label:m(`project.rename`),onClick:()=>{a(e.name),r(!0)},children:(0,$.jsx)(ce,{className:`size-4`})}),(0,$.jsx)(w,{open:n,onClose:()=>r(!1),title:m(`project.rename`),children:(0,$.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),i.trim()&&o.mutate()},children:[(0,$.jsx)(k,{"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)(A,{variant:`ghost`,onClick:()=>r(!1),children:m(`common.cancel`)}),(0,$.jsx)(A,{type:`submit`,busy:o.isPending,disabled:!i.trim(),children:m(`settings.save`)})]})]})})]})}function qt({project:e}){let t=r();return(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(R,{}),e.readOnly?null:(0,$.jsx)(Kt,{project:e,save:async n=>{await h.patch(`/api/studio/projects/${e.id}`,n),await t.invalidateQueries({queryKey:[`projects`]})}})]})}function Jt(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=Pe(),i=t.scrollTop>0&&t.clientHeight+t.scrollTop>=t.scrollHeight-4,a=(t===document.documentElement?0:t.getBoundingClientRect().top)+Math.max(120,t.clientHeight/3),o=e[0];for(let t of e){let e=document.getElementById(t)?.getBoundingClientRect().top;e!==void 0&&e<=a&&(o=t)}r(i?e.at(-1):o)},a=()=>{n||=requestAnimationFrame(i)};return i(),window.addEventListener(`scroll`,a,{passive:!0,capture:!0}),window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(n),window.removeEventListener(`scroll`,a,{capture:!0}),window.removeEventListener(`resize`,a)}},[t]),n}function Yt(e,t){let n=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;document.getElementById(e)?.scrollIntoView({block:`start`,behavior:t&&!n?`smooth`:`auto`})}function Xt({groups:e,current:t,onPick:n}){return e.map(e=>{let r=e.sections.map(e=>(0,$.jsx)(X,{icon:e.icon??K,label:e.label,selected:e.id===t,onPick:()=>n(e.id)},e.id));return e.label?(0,$.jsx)(Ke,{label:e.label,children:r},e.plugin):(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:r},`own`)})}function Zt(){let{group:e}=ie(),[t,n]=re(),r=te(),i=l(),{hash:a}=i,{project:s,loading:u}=c(),d=o(),f=Ve(),p=$e(),[h,g]=(0,Q.useState)(null),[_,b]=(0,Q.useState)(null),[ee,x]=(0,Q.useState)(null),C=Ie(e)?e:void 0,w=i.state?.parts===!0,ne=He().map(e=>({...e,to:`/space/${e.id}`})),T=ne.find(e=>e.id===C),E=t.get(`show`),D=C?E?2:1:0,O=p?Math.min(D,1):C&&ee!==C&&!w?1:0,k=Ge(O),A=Ge(D),ae=(0,Q.useMemo)(()=>({slot:h,narrow:p,setDetail:b}),[h,p]),oe=s?s.brand.name?.trim()||s.name:m(`nav.project`),se=C&&C!==`results`?Be(C,f):[],j=C?Be(C,f).filter(e=>e.plugin):[],ce=Jt([...se,...C===`results`?j:[]].flatMap(e=>e.sections.map(e=>e.id))),M=C===`results`&&E&&E!==`all`?E:null,[le,de]=(0,Q.useState)(Ht),N=Ut(C===`results`?s?.id:void 0,M,le),fe=N.data?.wizards.find(e=>e.id===M)?.title,I=C===`data`&&E&&E!==`all`||C===`knowledge`&&E&&/^[ptfcvs]:/.test(E)?E:null,L=I?.startsWith(`s:`)?f.spaceSections.find(e=>e.id===I.slice(2)):void 0,R=C===`knowledge`&&I&&/^[ptf]:/.test(I)?I:null,z=he(C===`data`?s?.id:void 0),B=Se(C===`knowledge`?s?.id:void 0),V=De(I?.startsWith(`v:`)?I.slice(2):``),H=B.data?.categories.find(e=>e.id===(I?.startsWith(`c:`)?I.slice(2):V.data?.category.id)),_e=C===`knowledge`?L?L.label():I?.startsWith(`v:`)?V.data&&`${V.data.category.name}: ${V.data.value}`:I?.startsWith(`c:`)?H?.name:B.data?.items.find(e=>e.key===I)?.title:z.data?Te(z.data).flatMap(e=>e.items).find(e=>e.key===I)?.title:void 0;Fe([{label:m(`nav.project`),to:`/space`},...T?[{label:T.label,to:`/space/${T.id}`}]:[],...T&&(_??fe??_e)?[{label:_??fe??_e}]:[]]);let U=C===`results`||C===`data`||I?a.slice(1):E||a.slice(1),W=(0,Q.useRef)(``);if((0,Q.useEffect)(()=>{let e=`${C}#${U}`;U&&W.current!==e&&document.getElementById(U)&&(W.current=e,requestAnimationFrame(()=>Yt(U,!1)))},[C,U,s?.id,f.spaceSections]),!C){let t=a.slice(1),n=t?Re(t,f):null;if(n===`knowledge`&&f.spaceSections.some(e=>e.id===t))return(0,$.jsx)(v,{to:`/space/knowledge?show=s:${t}`,replace:!0});if(n)return(0,$.jsx)(v,{to:p?`/space/${n}?show=${t}`:{pathname:`/space/${n}`,hash:t},replace:!0});if(t&&f.status!==`ready`)return null;if(e!==void 0||!p)return(0,$.jsx)(v,{to:`/space/info`,replace:!0,state:{parts:!0}})}if(C===`knowledge`&&!E&&f.spaceSections.some(e=>e.id===a.slice(1)))return(0,$.jsx)(v,{to:`/space/knowledge?show=s:${a.slice(1)}`,replace:!0});let G=e=>{if(p){r({search:`?show=${e}`});return}W.current=`${C}#${e}`,Yt(e,!0),r({search:``,hash:e},{replace:!0})},K=e=>p?n({show:e}):n(e===`all`?{}:{show:e},{replace:!0}),q=e=>e.flatMap(e=>e.sections).map(e=>f.spaceSections.find(t=>t.id===e.id)).filter(e=>e!==void 0).map(e=>(0,$.jsx)(P,{id:e.id,children:(0,$.jsx)(F,{title:e.label(),hint:e.hint?.(),plain:!0,children:(0,$.jsx)(Ue,{of:e,children:(0,$.jsx)(e.component,{})})})},e.serial)),J=p?void 0:ce;return(0,$.jsx)(Ye.Provider,{value:ae,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:S(`min-w-0 md:sticky md:top-6 md:self-start`,p&&D===2&&`hidden`,p&&A===`back`&&We(`back`)),children:[(0,$.jsx)(Je,{title:oe,open:O===1?T??null:null,onBack:()=>p?r(`/space`):x(C??null)}),(0,$.jsx)(`div`,{className:S(We(k)),children:O===0?(0,$.jsx)(Ze,{entries:ne,current:p?void 0:T,onPick:()=>x(null)}):(0,$.jsx)(`div`,{ref:g})},O)]}),C?(0,$.jsxs)(`div`,{className:S(`min-w-0`,p&&D<2&&`hidden`,p&&A===`deeper`&&We(`deeper`)),children:[p?(0,$.jsx)(`div`,{className:`mb-3`,children:(0,$.jsx)(Qe,{label:T?.label??oe,onBack:()=>r(`/space/${C}`)})}):null,d&&s?(0,$.jsx)(`div`,{className:`mb-6`,children:(0,$.jsx)(qt,{project:s})}):null,C===`results`?(0,$.jsxs)(Z,{children:[(0,$.jsxs)(`ul`,{className:`flex flex-col gap-0.5`,children:[(0,$.jsx)(X,{icon:tt,label:m(`space.resultsAll`),selected:!p&&!M,onPick:()=>K(`all`)}),N.data?.wizards.filter(e=>e.results||e.id===M).map(e=>(0,$.jsx)(X,{icon:Ae,label:e.title,badge:e.results?(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:e.results}):null,selected:!p&&e.id===M,onPick:()=>K(e.id)},e.id))]}),(0,$.jsx)(Xt,{groups:j,current:J,onPick:G})]}):C===`data`?(0,$.jsxs)(Z,{children:[(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:(0,$.jsx)(X,{icon:ue,label:m(`data.all`),selected:!p&&!I,onPick:()=>K(`all`)})}),z.data?Te(z.data).map(e=>(0,$.jsx)(Ke,{label:e.label,children:e.items.map(e=>(0,$.jsx)(X,{icon:me[e.kind],label:e.title,selected:!p&&e.key===I,onPick:()=>K(e.key)},e.key))},e.key)):null,(0,$.jsx)(Xt,{groups:j,current:J,onPick:G})]}):C===`knowledge`?(0,$.jsxs)(Z,{children:[(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:(0,$.jsx)(X,{icon:ue,label:m(`know.all`),selected:!(p||I),onPick:()=>K(`all`)})}),B.data?.categories.length?(0,$.jsx)(Ke,{label:m(`know.categories`),children:B.data.categories.map(e=>(0,$.jsx)(X,{icon:ye[e.type],label:e.name,badge:(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:e.proposed?`·`:e.count}),selected:!p&&(I===`c:${e.id}`||V.data?.category.id===e.id),onPick:()=>K(`c:${e.id}`)},e.id))}):null,(0,$.jsx)(Xt,{groups:j,current:p?void 0:L?.id,onPick:e=>K(`s:${e}`)})]}):(0,$.jsx)(Z,{children:(0,$.jsx)(Xt,{groups:se,current:J,onPick:G})}),s&&(C===`info`||C===`knowledge`)?(0,$.jsxs)(Vt,{project:s,group:C,docked:C===`knowledge`&&!!I&&!L,children:[C===`knowledge`?R?R.startsWith(`p:`)?(0,$.jsx)(xe,{pageId:R.slice(2),onGone:()=>K(`all`),onOpen:K},R):R.startsWith(`t:`)?(0,$.jsx)(be,{tableId:R.slice(2),onGone:()=>K(`all`)},R):(0,$.jsx)(bt,{projectId:s.id,fileId:R.slice(2),readOnly:s.readOnly,onGone:()=>K(`all`)},R):B.data?L?(0,$.jsx)(F,{title:L.label(),hint:L.hint?.(),plain:!0,children:(0,$.jsx)(Ue,{of:L,children:(0,$.jsx)(L.component,{})})},I):I?.startsWith(`c:`)?H?(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsx)(ve,{projectId:s.id,category:H,readOnly:s.readOnly,onOpen:K,onGone:()=>K(`all`)}),H.type===`choice`?null:(0,$.jsx)(Ee,{projectId:s.id,category:H,categories:B.data.categories,onOpen:K})]},I):null:I?.startsWith(`v:`)?V.data?(0,$.jsx)(pe,{value:V.data,readOnly:s.readOnly,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[V.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:V.data.items.map(e=>(0,$.jsx)(ge,{item:e,categories:B.data.categories.filter(e=>e.id!==V.data?.category.id),onOpen:K},e.key))}):null,V.data.rows.map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>K(`t:${e.tableId}`),className:`px-1 text-left text-[0.8125rem] text-ink-3 hover:text-ink`,children:m(`know.tocRows`,{n:e.count,table:e.title})},e.tableId))]})},I):null:(0,$.jsx)(P,{id:`documents`,children:(0,$.jsx)(we,{projectId:s.id,data:B.data,readOnly:s.readOnly,onOpen:K})}):null:null,C===`info`?q(j):null]},s.id):null,s&&C===`data`?(0,$.jsx)(`div`,{className:`flex flex-col gap-9 pb-20`,children:I?.startsWith(`t:`)?(0,$.jsx)(be,{tableId:I.slice(2),onGone:()=>K(`all`)},I):I?.startsWith(`p:`)?(0,$.jsx)(xe,{pageId:I.slice(2),onGone:()=>K(`all`)},I):(0,$.jsxs)($.Fragment,{children:[z.data?(0,$.jsx)(Ce,{projectId:s.id,data:z.data,readOnly:s.readOnly,onOpen:K}):null,q(j)]})}):null,s&&C===`results`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-9 pb-20`,children:[N.data?(0,$.jsx)(Gt,{data:N.data,wizardId:M,filter:le,onFilter:de}):null,N.isError?(0,$.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:N.error.message}):null,q(j)]}):null,s||u?null:(0,$.jsx)(y,{children:m(`settings.noProject`)})]}):null]})})})}export{Zt as ProjectPage};
1
+ import{a as e,n as t,t as n}from"./jsx-runtime-D3jfb0Ew.js";import{B as r,dt as i}from"./definition-CfFlylCM.js";import{c as a,l as o,m as s,s as c}from"./session-C24kIPr-.js";import{$ as l,A as u,I as d,K as f,L as p,M as m,S as h,U as g,W as _,X as v,a as y,c as b,d as ee,et as te,f as x,g as S,h as C,i as w,m as ne,n as T,nt as re,o as E,p as D,r as O,s as k,t as A,tt as ie}from"./ui-C4b__6Oo.js";import{t as ae}from"./type-BbMmv2qL.js";import{_ as oe,b as se,t as j,v as ce,y as M}from"./RunnerView-BVm9fL62.js";import{S as le,T as ue,_ as de,b as N,f as P,g as F,h as fe,m as I,p as L,r as R,v as z,x as B,y as V}from"./HomePage-B3RVPuUu.js";import{_ as pe,a as me,b as H,c as he,d as ge,f as _e,g as ve,h as ye,i as be,l as xe,m as Se,n as U,o as Ce,p as we,s as Te,u as Ee,v as De,x as W,y as G}from"./RunDrawer-BgLxai9C.js";import{i as K,n as q,r as J}from"./ImportWizard-CHlCjPEo.js";import{t as Oe}from"./external-link-DitV3n6l.js";import{r as ke,t as Ae}from"./wand-sparkles-BsD2e8V6.js";import{n as je,t as Y}from"./trash-t3O7FdUR.js";import{t as Me}from"./refresh-cw-CWRkEENy.js";import{t as Ne}from"./star-ClV5w6K4.js";import{N as Pe,P as Fe,a as Ie,c as Le,i as Re,m as ze,o as Be,r as Ve,s as He,t as Ue}from"./index-B8VsYgck.js";import{a as X,c as We,f as Ge,i as Ke,m as qe,n as Je,o as Ye,p as Xe,r as Ze,s as Z,t as Qe,u as $e}from"./settings-menu-e8OMChHm.js";var et={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`]};et.node;var tt=f(et),nt={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`}]]};nt.node;var rt=f(nt),it={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`]};it.node;var at=f(it),Q=e(t(),1),$=e(n(),1),ot={backgroundImage:`repeating-conic-gradient(#c9c9c9 0% 25%, #dedede 0% 50%)`,backgroundSize:`16px 16px`};function st({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:m(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 ct(e,t){confirm(m(`project.removeConfirm`,{name:e.name}))&&t.remove(e.id)}function lt({projectId:e,file:t,small:n}){let r=z(e,t.id);return t.mime.startsWith(`image/`)?(0,$.jsx)(`img`,{src:r,alt:``,loading:`lazy`,className:S(`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)(rt,{className:n?`size-5`:`size-7`}):(0,$.jsx)(se,{className:n?`size-5`:`size-7`})})}function ut({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)(O,{tone:`ember`,children:m(`project.logoMain`)})}):null,(0,$.jsxs)(`div`,{className:`relative h-28 overflow-hidden rounded-md bg-paper-2`,style:t===`logo`?ot:void 0,children:[o&&i.mime.startsWith(`image/`)?(0,$.jsx)(`button`,{type:`button`,"aria-label":`${m(`project.preview`)}: ${i.name}`,onClick:()=>o(i),className:`block size-full cursor-zoom-in`,children:(0,$.jsx)(lt,{projectId:e,file:i})}):(0,$.jsx)(lt,{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)(E,{label:m(`project.preview`),onClick:()=>o(i),className:`size-8 bg-card shadow-soft`,children:(0,$.jsx)(ke,{className:`size-4`})}):null,t===`logo`&&a>0&&!r.readOnly?(0,$.jsx)(E,{label:m(`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)(Ne,{className:`size-4`})}):null,r.readOnly?null:(0,$.jsx)(E,{label:m(`project.remove`),onClick:()=>ct(i,r),className:`size-8 bg-card shadow-soft hover:text-rose`,children:(0,$.jsx)(Y,{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)(st,{file:i,actions:r})]},i.id)),a&&!r.readOnly?(0,$.jsxs)(L,{accept:i,multiple:!1,onFiles:e=>r.upload(t,e),className:`min-h-28 flex-col p-3`,children:[r.busy?(0,$.jsx)(x,{className:`size-5`}):(0,$.jsx)(d,{className:`size-5`}),a]}):null]})}function dt({projectId:e,data:t,readOnly:n}){let r=N(e,n);return(0,$.jsxs)(F,{title:m(`project.logos`),hint:m(`project.logosHint`),children:[(0,$.jsx)(ut,{projectId:e,kind:`logo`,files:t.files.filter(e=>e.kind===`logo`),actions:r,accept:`image/*`,addLabel:m(`project.logoAdd`)}),r.error?(0,$.jsx)(`p`,{className:`mt-3 text-[0.875rem] text-rose`,children:r.error}):null]})}var ft=e=>[(e.name.includes(`.`)?e.name.split(`.`).pop():e.mime.split(`/`).pop())?.toUpperCase().slice(0,5),de(e.size)].filter(Boolean).join(` · `);function pt({projectId:e,file:t,actions:n,onClose:r}){let i=z(e,t.id);return(0,$.jsxs)(w,{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:ft(t)}),(0,$.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer`,"aria-label":m(`project.openOriginal`),title:m(`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)(Oe,{className:`size-4`})})]}),t.mime.startsWith(`image/`)?(0,$.jsx)(`div`,{className:`overflow-hidden rounded-lg`,style:ot,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)(st,{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":`${m(`project.preview`)}: ${t.name}`,onClick:r,className:`size-14 shrink-0 cursor-zoom-in overflow-hidden rounded-md bg-paper-2`,children:(0,$.jsx)(lt,{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:ft(t)})]}),(0,$.jsx)(st,{file:t,actions:n})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start`,children:[(0,$.jsx)(E,{label:m(`project.preview`),onClick:r,children:(0,$.jsx)(ke,{className:`size-4`})}),n.readOnly?null:(0,$.jsx)(E,{label:m(`project.remove`),onClick:()=>ct(t,n),className:`hover:text-rose`,children:(0,$.jsx)(Y,{className:`size-4`})})]})]})}function ht({projectId:e,data:t,readOnly:n}){let r=N(e,n),[i,a]=B(`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)(F,{title:m(`project.assets`),hint:m(`project.assetsHint`),children:[u.length?(0,$.jsx)(I,{layout:i,onToggle:a,children:(0,$.jsx)(fe,{value:o,onChange:s,placeholder:m(`project.assetSearch`)})}):null,p.length?(0,$.jsx)(`div`,{className:`mb-3`,children:i===`cards`?(0,$.jsx)(ut,{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:m(`project.staysLocal`)}):(0,$.jsxs)(L,{accept:`image/*,video/*,audio/*`,onFiles:e=>r.upload(`asset`,e),className:`h-16 w-full`,children:[r.busy?(0,$.jsx)(x,{className:`size-4`}):(0,$.jsx)(q,{className:`size-4`}),m(`project.drop`),` `,(0,$.jsx)(`span`,{className:`underline`,children:m(`project.assetAdd`)})]}),r.error?(0,$.jsx)(`p`,{className:`mt-3 text-[0.875rem] text-rose`,children:r.error}):null,d?(0,$.jsx)(pt,{projectId:e,file:d,actions:r,onClose:()=>l(null)}):null]})}function gt(e,t,n){return r({queryKey:[`project-file-text`,t.id,t.chars,n],queryFn:()=>h.get(`/api/studio/projects/${e}/files/${t.id}/text?limit=${n}`),enabled:t.status===`ready`,staleTime:6e4})}function _t(e){return((e.name.includes(`.`)?e.name.split(`.`).pop():``)||e.mime.split(`/`).pop()||``).toUpperCase().slice(0,5)}var vt=e=>[_t(e),e.pages?m(`project.pages`,{n:e.pages}):null,de(e.size)].filter(Boolean).join(` · `),yt=2e5;function bt({projectId:e,fileId:t,readOnly:n,onGone:r}){let a=i(),o=le(e),s=Se(e),c=N(e,n),l=o.data?.files.find(e=>e.id===t),u=l?l.mime===`application/pdf`||l.mime.startsWith(`image/`):!1,[d,f]=(0,Q.useState)(null);if(!l)return o.isLoading?(0,$.jsx)(x,{className:`mx-auto text-ink-3`}):null;let p=d??(u?`original`:`text`),h=s.data?.items.find(e=>e.key===`f:${l.id}`),g=z(e,l.id),_=(e,t)=>(0,$.jsx)(`button`,{type:`button`,"aria-pressed":p===e,onClick:()=>f(e),className:S(`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:l.name}),(0,$.jsx)(`span`,{className:`text-[0.8125rem] text-ink-3 max-sm:hidden`,children:vt(l)}),(0,$.jsx)(`a`,{href:g,target:`_blank`,rel:`noreferrer`,"aria-label":m(`project.openOriginal`),title:m(`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)(Oe,{className:`size-4`})}),n?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(E,{label:m(`project.reindex`),onClick:async()=>{await c.reindex(l.id),await a.invalidateQueries({queryKey:[`knowledge`,e]})},children:(0,$.jsx)(Me,{className:`size-4`})}),(0,$.jsx)(E,{label:m(`know.deleteFile`),className:`hover:text-rose`,onClick:async()=>{confirm(m(`data.confirmDelete`,{title:l.name}))&&(await c.remove(l.id),await a.invalidateQueries({queryKey:[`knowledge`,e]}),r())},children:(0,$.jsx)(Y,{className:`size-4`})})]})]}),(0,$.jsx)(_e,{projectId:e,itemKey:`f:${l.id}`,has:h?.categories??[],originLabel:h?.originLabel??null,kept:!1,review:null,file:null,readOnly:n,onReviewed:()=>void 0}),(0,$.jsx)(`div`,{className:`px-1`,children:(0,$.jsx)(st,{file:l,actions:c})}),l.status===`failed`?(0,$.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:l.error}):null,(0,$.jsxs)(T,{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:[u?_(`original`,m(`project.original`)):null,_(`text`,m(`project.readText`))]}),p===`original`?l.mime===`application/pdf`?(0,$.jsx)(`iframe`,{src:g,title:l.name,className:`h-[70dvh] w-full rounded-b-xl bg-paper-2`}):(0,$.jsx)(`img`,{src:g,alt:``,className:`mx-auto max-h-[70dvh] object-contain p-4`}):(0,$.jsx)(xt,{projectId:e,file:l})]})]})}function xt({projectId:e,file:t}){let n=gt(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)(x,{})}):n.data?.text?(0,$.jsxs)(`div`,{className:`overflow-x-auto p-4 sm:p-5`,children:[(0,$.jsx)(ze,{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:m(`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:m(`project.noText`)})}var St=[`text`,`longtext`,`number`,`date`,`url`,`email`,`phone`,`boolean`],Ct=/^(\d{4}-\d{2}-\d{2}|\d{1,2}\.\s?\d{1,2}\.\s?\d{4})$/,wt=/^[+-]?\d{1,3}([.,\s']?\d{3})*([.,]\d+)?$/,Tt=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,Et=/^(https?:\/\/|www\.)\S+$/i,Dt=/^\+?[\d\s()/.-]{7,20}$/,Ot=/^(ja|nein|yes|no|true|false)$/i;function kt(e){let t=e.trim();return t?t.includes(`
2
+ `)||t.length>140?`longtext`:Ot.test(t)?`boolean`:Tt.test(t)?`email`:Et.test(t)?`url`:Ct.test(t)?`date`:wt.test(t)&&!/^(\+|0\d)/.test(t)?`number`:Dt.test(t)&&t.replace(/\D/g,``).length>=7?`phone`:`text`:`text`}function At(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 jt=[{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`}],Mt={facts:100,colors:12,files:{logo:8,asset:100,document:2e3},bytes:{logo:5e6,asset:15e6,video:8e7,document:3e7}},Nt=/^#[0-9a-fA-F]{6}$/;function Pt({onAdd:e,onClose:t}){let[n,r]=(0,Q.useState)(`#e0531b`),[i,a]=(0,Q.useState)(``),o=Nt.test(n);return(0,$.jsx)(w,{open:!0,onClose:t,title:m(`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)(b,{children:m(`project.colorValue`)}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(D,{value:o?n:`#888888`,onChange:e=>r(e.target.value)}),(0,$.jsx)(k,{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)(b,{children:m(`project.colorUseLabel`)}),(0,$.jsx)(k,{autoFocus:!0,value:i,maxLength:120,placeholder:m(`project.colorName`),onChange:e=>a(e.target.value)}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:m(`project.colorUse`)})]}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(A,{variant:`ghost`,onClick:t,children:m(`common.cancel`)}),(0,$.jsx)(A,{type:`submit`,disabled:!o,children:m(`project.add`)})]})]})})}function Ft({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=V(i.filter(e=>Nt.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)(F,{title:m(`project.colors`),hint:m(`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)(D,{value:Nt.test(e.value)?e.value:`#888888`,onChange:t=>l(e.id,{value:t.target.value})}),(0,$.jsx)(k,{value:e.name,placeholder:m(`project.colorName`),maxLength:120,onChange:t=>l(e.id,{name:t.target.value}),className:`min-w-0 flex-1`}),(0,$.jsx)(k,{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)(O,{tone:`ember`,children:m(`project.colorAccent`)})}):n?null:(0,$.jsx)(E,{label:m(`project.colorFirst`),onClick:()=>a(t=>[e,...t.filter(t=>t.id!==e.id)]),children:(0,$.jsx)(_,{className:`size-4`})}),n?null:(0,$.jsx)(E,{label:m(`project.remove`),onClick:()=>a(t=>t.filter(t=>t.id!==e.id)),className:`hover:text-rose`,children:(0,$.jsx)(Y,{className:`size-4`})})]})]},e.id))}),i.length&&!n?(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:m(`project.colorUse`)}):null,i.length<Mt.colors&&!n?(0,$.jsxs)(A,{variant:`secondary`,size:`sm`,className:i.length?`mt-3`:void 0,onClick:()=>s(!0),children:[(0,$.jsx)(d,{className:`size-4`}),` `,m(`project.colorAdd`)]}):null,o?(0,$.jsx)(Pt,{onClose:()=>s(!1),onAdd:e=>a(t=>[...t,{...e,id:`c${r.current++}`}])}):null]})}var It=e=>/^(ja|yes|true)$/i.test(e.trim()),Lt={text:ae,longtext:at,number:H,date:W,url:je,email:M,phone:oe,boolean:G};function Rt({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=Lt[e??t],l=`${m(`project.factType`)}: ${m(`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:S(`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:S(`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)(Ae,{className:`size-4 shrink-0`}),(0,$.jsx)(`span`,{className:`flex-1`,children:m(`project.factAuto`)}),(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-4`,children:m(`project.type.${t}`)}),(0,$.jsx)(g,{className:S(`size-4 shrink-0`,e&&`invisible`)})]}),(0,$.jsx)(`div`,{className:`mx-2 my-1 h-px bg-border-soft`}),St.map(t=>{let n=Lt[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:m(`project.type.${t}`)}),(0,$.jsx)(g,{className:S(`size-4 shrink-0`,e!==t&&`invisible`)})]},t)})]}):null]})}function zt({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=V(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])},f=e=>t=>{t&&i.current===e&&(i.current=null,t.focus())},p=jt.filter(e=>!a.some(t=>t.key===e.key));return(0,$.jsxs)(F,{title:m(`project.facts`),hint:m(`project.factsHint`),save:s,locked:n,action:a.length<Mt.facts&&!n?(0,$.jsxs)(A,{variant:`secondary`,size:`sm`,onClick:()=>l({},`label`,!0),children:[(0,$.jsx)(d,{className:`size-4`}),` `,m(`project.factAdd`)]}):null,children:[(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:a.map(e=>{let t=kt(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)(k,{ref:f(`${e.id}:label`),value:e.label,placeholder:m(`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:At(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)(ne,{checked:It(e.value),label:e.label,onChange:t=>c(e.id,{value:m(t?`project.yes`:`project.no`)})}),(0,$.jsx)(`span`,{className:`text-[0.875rem] text-ink-2`,children:It(e.value)?m(`project.yes`):m(`project.no`)})]}):(0,$.jsx)(C,{ref:f(`${e.id}:value`),rows:1,minRows:r===`longtext`?2:1,maxRows:10,value:e.value,placeholder:m(`project.factValue`),onChange:t=>c(e.id,{value:t.target.value}),className:`min-h-11`}),(0,$.jsx)(Rt,{type:e.type,detected:t,onChange:t=>c(e.id,{type:t})}),n?null:(0,$.jsx)(E,{label:m(`project.remove`),onClick:()=>o(t=>t.filter(t=>t.id!==e.id)),className:`size-11 rounded-lg hover:text-rose`,children:(0,$.jsx)(Y,{className:`size-4`})})]},e.id)})}),a.length<Mt.facts&&!n?(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 ${a.length?`mt-4`:``}`,children:[(0,$.jsxs)(A,{variant:`secondary`,size:`sm`,onClick:()=>l({},`label`),children:[(0,$.jsx)(d,{className:`size-4`}),` `,m(`project.factAdd`)]}),p.map(e=>(0,$.jsxs)(`button`,{type:`button`,onClick:()=>l({key:e.key,label:u===`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`}),` `,u===`en`?e.en:e.de]},e.key))]}):null]})}function Bt({project:e,save:t}){let[n,r]=(0,Q.useState)(e.brand.name??``),[i,a]=(0,Q.useState)(e.brand.about??``),o=V({name:n.trim(),about:i.trim()},e=>t({brand:e}));return(0,$.jsx)(F,{title:m(`project.base`),hint:m(`project.baseHint`),save:o,locked:e.readOnly,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(b,{children:m(`project.title`)}),(0,$.jsx)(k,{value:n,maxLength:120,onChange:e=>r(e.target.value)}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:m(`project.titleHint`)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(b,{children:m(`project.about`)}),(0,$.jsx)(C,{minRows:4,value:i,onChange:e=>a(e.target.value)}),(0,$.jsx)(`p`,{className:`mt-1.5 text-[0.8125rem] text-ink-3`,children:m(`project.aboutHint`)})]})]})})}function Vt({project:e,group:t,docked:n=!1,children:r}){let c=i(),l=le(e.id),[u,d]=(0,Q.useState)(0),f=async t=>{await h.patch(`/api/studio/projects/${e.id}`,t),await c.invalidateQueries({queryKey:[`projects`]})},p=s({mutationFn:()=>h.del(`/api/studio/projects/${e.id}`),onSuccess:()=>c.invalidateQueries({queryKey:[`projects`]})}),g=o(),_=a(),v=l.data??{files:[],embeddings:!0},y=`${e.id}:${u}`,b=e.readOnly;return(0,$.jsxs)(`div`,{className:`flex flex-col gap-9 pb-32`,children:[b?(0,$.jsx)(Xe,{children:qe(e)}):(0,$.jsx)(Le,{projectId:e.id,part:t,docked:n,onChanged:()=>d(e=>e+1)},e.id),t===`info`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(P,{id:`base`,children:(0,$.jsx)(Bt,{project:e,save:f},`base:${y}`)}),(0,$.jsx)(P,{id:`logos`,children:(0,$.jsx)(dt,{projectId:e.id,data:v,readOnly:b})}),(0,$.jsx)(P,{id:`colors`,children:(0,$.jsx)(Ft,{colors:e.brand.colors??[],save:e=>f({brand:{colors:e}}),readOnly:b},`colors:${y}`)}),(0,$.jsx)(P,{id:`assets`,children:(0,$.jsx)(ht,{projectId:e.id,data:v,readOnly:b})}),(0,$.jsx)(P,{id:`facts`,children:(0,$.jsx)(zt,{facts:e.facts,save:e=>f({facts:e}),readOnly:b},`facts:${y}`)})]}):null,r,t===`info`&&g&&!b&&_?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(A,{variant:`danger`,busy:p.isPending,onClick:()=>confirm(`${m(`settings.delete`)}?`)&&p.mutate(),children:m(`settings.delete`)}),p.error?(0,$.jsx)(`p`,{className:`mt-2 text-[0.875rem] text-rose`,children:p.error.message}):null]}):null]})}var Ht={q:``,mode:``,days:0};function Ut(e,t,n){let i=new URLSearchParams;t&&i.set(`wizard`,t),n.q.trim()&&i.set(`q`,n.q.trim()),n.mode&&i.set(`mode`,n.mode),n.days&&i.set(`days`,String(n.days));let a=i.toString();return r({queryKey:[`results`,e,a],queryFn:()=>h.get(`/api/studio/projects/${e}/results${a&&`?${a}`}`),enabled:!!e,placeholderData:e=>e,refetchInterval:15e3})}function Wt({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)(J,{className:`-translate-y-1/2 pointer-events-none absolute top-1/2 left-3 size-4 text-ink-3`}),(0,$.jsx)(k,{type:`search`,value:n,onChange:e=>r(e.target.value),placeholder:m(`space.resultsSearch`),"aria-label":m(`space.resultsSearch`),className:`w-full pl-9`})]}),(0,$.jsx)(ee,{value:e.mode,onChange:n=>t({...e,mode:n}),options:[{value:``,label:m(`space.resultsModeAll`)},{value:`live`,label:`Live`},{value:`test`,label:`Test`}],className:`w-32`}),(0,$.jsx)(ee,{value:String(e.days),onChange:n=>t({...e,days:Number(n)}),options:[{value:`0`,label:m(`space.resultsAnyTime`)},{value:`1`,label:m(`space.resultsDay`)},{value:`7`,label:m(`space.resultsDays`,{n:7})},{value:`30`,label:m(`space.resultsDays`,{n:30})}],className:`w-44`})]})}function Gt({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(u,{dateStyle:`medium`,timeStyle:`short`});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(F,{title:t?o(t):m(`space.resultsAll`),hint:m(`space.resultsHint`),plain:!0,children:[(0,$.jsx)(Wt,{filter:n,onFilter:r}),e.runs.length?(0,$.jsx)(T,{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))} · `,m(`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:m(`space.resultFiles`,{n:e.assets}),children:[(0,$.jsx)(p,{className:`size-3.5`}),e.assets]}):null,e.mode===`test`?(0,$.jsx)(O,{children:`Test`}):(0,$.jsxs)(O,{tone:`live`,children:[`Live v`,e.version]})]},e.id))}):(0,$.jsx)(T,{children:(0,$.jsx)(y,{children:n.q.trim()||n.mode||n.days?m(`space.resultsNone`):m(`space.resultsEmpty`)})})]}),i?(0,$.jsx)(U,{header:(0,$.jsxs)($.Fragment,{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)(O,{children:`Test`}):(0,$.jsxs)(O,{tone:`live`,children:[`Live v`,i.version]})]}),onClose:()=>a(null),children:(0,$.jsx)(j,{runId:i.id,compact:!0},i.id)}):null]})}function Kt({project:e,save:t}){let[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(e.name),o=s({mutationFn:()=>t({name:i.trim()}),onSuccess:()=>r(!1)});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(E,{label:m(`project.rename`),onClick:()=>{a(e.name),r(!0)},children:(0,$.jsx)(ce,{className:`size-4`})}),(0,$.jsx)(w,{open:n,onClose:()=>r(!1),title:m(`project.rename`),children:(0,$.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),i.trim()&&o.mutate()},children:[(0,$.jsx)(k,{"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)(A,{variant:`ghost`,onClick:()=>r(!1),children:m(`common.cancel`)}),(0,$.jsx)(A,{type:`submit`,busy:o.isPending,disabled:!i.trim(),children:m(`settings.save`)})]})]})})]})}function qt({project:e}){let t=i();return(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(R,{}),e.readOnly?null:(0,$.jsx)(Kt,{project:e,save:async n=>{await h.patch(`/api/studio/projects/${e.id}`,n),await t.invalidateQueries({queryKey:[`projects`]})}})]})}function Jt(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=Pe(),i=t.scrollTop>0&&t.clientHeight+t.scrollTop>=t.scrollHeight-4,a=(t===document.documentElement?0:t.getBoundingClientRect().top)+Math.max(120,t.clientHeight/3),o=e[0];for(let t of e){let e=document.getElementById(t)?.getBoundingClientRect().top;e!==void 0&&e<=a&&(o=t)}r(i?e.at(-1):o)},a=()=>{n||=requestAnimationFrame(i)};return i(),window.addEventListener(`scroll`,a,{passive:!0,capture:!0}),window.addEventListener(`resize`,a),()=>{cancelAnimationFrame(n),window.removeEventListener(`scroll`,a,{capture:!0}),window.removeEventListener(`resize`,a)}},[t]),n}function Yt(e,t){let n=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;document.getElementById(e)?.scrollIntoView({block:`start`,behavior:t&&!n?`smooth`:`auto`})}function Xt({groups:e,current:t,onPick:n}){return e.map(e=>{let r=e.sections.map(e=>(0,$.jsx)(X,{icon:e.icon??K,label:e.label,selected:e.id===t,onPick:()=>n(e.id)},e.id));return e.label?(0,$.jsx)(Ke,{label:e.label,children:r},e.plugin):(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:r},`own`)})}function Zt(){let{group:e}=ie(),[t,n]=re(),r=te(),i=l(),{hash:a}=i,{project:s,loading:u}=c(),d=o(),f=Ve(),p=$e(),[h,g]=(0,Q.useState)(null),[_,b]=(0,Q.useState)(null),[ee,x]=(0,Q.useState)(null),C=Ie(e)?e:void 0,w=i.state?.parts===!0,ne=He().map(e=>({...e,to:`/space/${e.id}`})),T=ne.find(e=>e.id===C),E=t.get(`show`),D=C?E?2:1:0,O=p?Math.min(D,1):C&&ee!==C&&!w?1:0,k=Ge(O),A=Ge(D),ae=(0,Q.useMemo)(()=>({slot:h,narrow:p,setDetail:b}),[h,p]),oe=s?s.brand.name?.trim()||s.name:m(`nav.project`),se=C&&C!==`results`?Be(C,f):[],j=C?Be(C,f).filter(e=>e.plugin):[],ce=Jt([...se,...C===`results`?j:[]].flatMap(e=>e.sections.map(e=>e.id))),M=C===`results`&&E&&E!==`all`?E:null,[le,de]=(0,Q.useState)(Ht),N=Ut(C===`results`?s?.id:void 0,M,le),fe=N.data?.wizards.find(e=>e.id===M)?.title,I=C===`data`&&E&&E!==`all`||C===`knowledge`&&E&&/^[ptfcvs]:/.test(E)?E:null,L=I?.startsWith(`s:`)?f.spaceSections.find(e=>e.id===I.slice(2)):void 0,R=C===`knowledge`&&I&&/^[ptf]:/.test(I)?I:null,z=he(C===`data`?s?.id:void 0),B=Se(C===`knowledge`?s?.id:void 0),V=De(I?.startsWith(`v:`)?I.slice(2):``),H=B.data?.categories.find(e=>e.id===(I?.startsWith(`c:`)?I.slice(2):V.data?.category.id)),_e=C===`knowledge`?L?L.label():I?.startsWith(`v:`)?V.data&&`${V.data.category.name}: ${V.data.value}`:I?.startsWith(`c:`)?H?.name:B.data?.items.find(e=>e.key===I)?.title:z.data?Te(z.data).flatMap(e=>e.items).find(e=>e.key===I)?.title:void 0;Fe([{label:m(`nav.project`),to:`/space`},...T?[{label:T.label,to:`/space/${T.id}`}]:[],...T&&(_??fe??_e)?[{label:_??fe??_e}]:[]]);let U=C===`results`||C===`data`||I?a.slice(1):E||a.slice(1),W=(0,Q.useRef)(``);if((0,Q.useEffect)(()=>{let e=`${C}#${U}`;U&&W.current!==e&&document.getElementById(U)&&(W.current=e,requestAnimationFrame(()=>Yt(U,!1)))},[C,U,s?.id,f.spaceSections]),!C){let t=a.slice(1),n=t?Re(t,f):null;if(n===`knowledge`&&f.spaceSections.some(e=>e.id===t))return(0,$.jsx)(v,{to:`/space/knowledge?show=s:${t}`,replace:!0});if(n)return(0,$.jsx)(v,{to:p?`/space/${n}?show=${t}`:{pathname:`/space/${n}`,hash:t},replace:!0});if(t&&f.status!==`ready`)return null;if(e!==void 0||!p)return(0,$.jsx)(v,{to:`/space/info`,replace:!0,state:{parts:!0}})}if(C===`knowledge`&&!E&&f.spaceSections.some(e=>e.id===a.slice(1)))return(0,$.jsx)(v,{to:`/space/knowledge?show=s:${a.slice(1)}`,replace:!0});let G=e=>{if(p){r({search:`?show=${e}`});return}W.current=`${C}#${e}`,Yt(e,!0),r({search:``,hash:e},{replace:!0})},K=e=>p?n({show:e}):n(e===`all`?{}:{show:e},{replace:!0}),q=e=>e.flatMap(e=>e.sections).map(e=>f.spaceSections.find(t=>t.id===e.id)).filter(e=>e!==void 0).map(e=>(0,$.jsx)(P,{id:e.id,children:(0,$.jsx)(F,{title:e.label(),hint:e.hint?.(),plain:!0,children:(0,$.jsx)(Ue,{of:e,children:(0,$.jsx)(e.component,{})})})},e.serial)),J=p?void 0:ce;return(0,$.jsx)(Ye.Provider,{value:ae,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:S(`min-w-0 md:sticky md:top-6 md:self-start`,p&&D===2&&`hidden`,p&&A===`back`&&We(`back`)),children:[(0,$.jsx)(Je,{title:oe,open:O===1?T??null:null,onBack:()=>p?r(`/space`):x(C??null)}),(0,$.jsx)(`div`,{className:S(We(k)),children:O===0?(0,$.jsx)(Ze,{entries:ne,current:p?void 0:T,onPick:()=>x(null)}):(0,$.jsx)(`div`,{ref:g})},O)]}),C?(0,$.jsxs)(`div`,{className:S(`min-w-0`,p&&D<2&&`hidden`,p&&A===`deeper`&&We(`deeper`)),children:[p?(0,$.jsx)(`div`,{className:`mb-3`,children:(0,$.jsx)(Qe,{label:T?.label??oe,onBack:()=>r(`/space/${C}`)})}):null,d&&s?(0,$.jsx)(`div`,{className:`mb-6`,children:(0,$.jsx)(qt,{project:s})}):null,C===`results`?(0,$.jsxs)(Z,{children:[(0,$.jsxs)(`ul`,{className:`flex flex-col gap-0.5`,children:[(0,$.jsx)(X,{icon:tt,label:m(`space.resultsAll`),selected:!p&&!M,onPick:()=>K(`all`)}),N.data?.wizards.filter(e=>e.results||e.id===M).map(e=>(0,$.jsx)(X,{icon:Ae,label:e.title,badge:e.results?(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:e.results}):null,selected:!p&&e.id===M,onPick:()=>K(e.id)},e.id))]}),(0,$.jsx)(Xt,{groups:j,current:J,onPick:G})]}):C===`data`?(0,$.jsxs)(Z,{children:[(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:(0,$.jsx)(X,{icon:ue,label:m(`data.all`),selected:!p&&!I,onPick:()=>K(`all`)})}),z.data?Te(z.data).map(e=>(0,$.jsx)(Ke,{label:e.label,children:e.items.map(e=>(0,$.jsx)(X,{icon:me[e.kind],label:e.title,selected:!p&&e.key===I,onPick:()=>K(e.key)},e.key))},e.key)):null,(0,$.jsx)(Xt,{groups:j,current:J,onPick:G})]}):C===`knowledge`?(0,$.jsxs)(Z,{children:[(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:(0,$.jsx)(X,{icon:ue,label:m(`know.all`),selected:!(p||I),onPick:()=>K(`all`)})}),B.data?.categories.length?(0,$.jsx)(Ke,{label:m(`know.categories`),children:B.data.categories.map(e=>(0,$.jsx)(X,{icon:ye[e.type],label:e.name,badge:(0,$.jsx)(`span`,{className:`text-[0.75rem] text-ink-3 tabular-nums`,children:e.proposed?`·`:e.count}),selected:!p&&(I===`c:${e.id}`||V.data?.category.id===e.id),onPick:()=>K(`c:${e.id}`)},e.id))}):null,(0,$.jsx)(Xt,{groups:j,current:p?void 0:L?.id,onPick:e=>K(`s:${e}`)})]}):(0,$.jsx)(Z,{children:(0,$.jsx)(Xt,{groups:se,current:J,onPick:G})}),s&&(C===`info`||C===`knowledge`)?(0,$.jsxs)(Vt,{project:s,group:C,docked:C===`knowledge`&&!!I&&!L,children:[C===`knowledge`?R?R.startsWith(`p:`)?(0,$.jsx)(xe,{pageId:R.slice(2),onGone:()=>K(`all`),onOpen:K},R):R.startsWith(`t:`)?(0,$.jsx)(be,{tableId:R.slice(2),onGone:()=>K(`all`)},R):(0,$.jsx)(bt,{projectId:s.id,fileId:R.slice(2),readOnly:s.readOnly,onGone:()=>K(`all`)},R):B.data?L?(0,$.jsx)(F,{title:L.label(),hint:L.hint?.(),plain:!0,children:(0,$.jsx)(Ue,{of:L,children:(0,$.jsx)(L.component,{})})},I):I?.startsWith(`c:`)?H?(0,$.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,$.jsx)(ve,{projectId:s.id,category:H,readOnly:s.readOnly,onOpen:K,onGone:()=>K(`all`)}),H.type===`choice`?null:(0,$.jsx)(Ee,{projectId:s.id,category:H,categories:B.data.categories,onOpen:K})]},I):null:I?.startsWith(`v:`)?V.data?(0,$.jsx)(pe,{value:V.data,readOnly:s.readOnly,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[V.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:V.data.items.map(e=>(0,$.jsx)(ge,{item:e,categories:B.data.categories.filter(e=>e.id!==V.data?.category.id),onOpen:K},e.key))}):null,V.data.rows.map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>K(`t:${e.tableId}`),className:`px-1 text-left text-[0.8125rem] text-ink-3 hover:text-ink`,children:m(`know.tocRows`,{n:e.count,table:e.title})},e.tableId))]})},I):null:(0,$.jsx)(P,{id:`documents`,children:(0,$.jsx)(we,{projectId:s.id,data:B.data,readOnly:s.readOnly,onOpen:K})}):null:null,C===`info`?q(j):null]},s.id):null,s&&C===`data`?(0,$.jsx)(`div`,{className:`flex flex-col gap-9 pb-20`,children:I?.startsWith(`t:`)?(0,$.jsx)(be,{tableId:I.slice(2),onGone:()=>K(`all`)},I):I?.startsWith(`p:`)?(0,$.jsx)(xe,{pageId:I.slice(2),onGone:()=>K(`all`)},I):(0,$.jsxs)($.Fragment,{children:[z.data?(0,$.jsx)(Ce,{projectId:s.id,data:z.data,readOnly:s.readOnly,onOpen:K}):null,q(j)]})}):null,s&&C===`results`?(0,$.jsxs)(`div`,{className:`flex flex-col gap-9 pb-20`,children:[N.data?(0,$.jsx)(Gt,{data:N.data,wizardId:M,filter:le,onFilter:de}):null,N.isError?(0,$.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:N.error.message}):null,q(j)]}):null,s||u?null:(0,$.jsx)(y,{children:m(`settings.noProject`)})]}):null]})})})}export{Zt as ProjectPage};