1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[216],{34924:function(e,t,n){n.d(t,{F:function(){return c},P:function(){return d}});var r=n(63343),o=n(2105),i=n(80087),a=n(67142),l=n(45275);let s={"ass-browse":{id:"ass-browse",rank:20,getCommands:()=>[{primary:"/browse",arguments:["URL"],description:"Assistant will download the web page",Icon:i.Z}]},"ass-react":{id:"ass-react",rank:15,getCommands:()=>[{primary:"/react",arguments:["prompt"],description:"Use the AI ReAct strategy to answer your query",Icon:l.Z}]},"ass-t2i":{id:"ass-t2i",rank:10,getCommands:()=>[{primary:"/draw",alternatives:["/imagine","/img"],arguments:["prompt"],description:"Assistant will draw the text",Icon:a.Z}]},"chat-alter":{id:"chat-alter",rank:25,getCommands:()=>[{primary:"/assistant",alternatives:["/a"],arguments:["text"],description:"Injects assistant response"},{primary:"/system",alternatives:["/s"],arguments:["text"],description:"Injects system message"},{primary:"/clear",arguments:["all"],description:"Clears the chat (removes all messages)",Icon:r.Z}]},"cmd-help":{id:"cmd-help",rank:99,getCommands:()=>[{primary:"/help",alternatives:["/?"],description:"Display this list of commands"}]},"mode-beam":{id:"mode-beam",rank:9,getCommands:()=>[{primary:"/beam",arguments:["prompt"],description:"Combine the smarts of models",Icon:o.Z}]}};function d(){return Object.values(s).sort((e,t)=>e.rank-t.rank).map(e=>e.getCommands()).flat()}function c(e){let t=e.trim();if(!t.startsWith("/"))return[{type:"text",value:e}];let n=t.indexOf(" "),r=t.match(/^\/\S+/),o=r?r[0]:t,i=n>=0?t.substring(n+1):"";for(let e of Object.values(s))for(let t of e.getCommands()){var a,l;if(t.primary===o||(null===(a=t.alternatives)||void 0===a?void 0:a.includes(o))){if(null===(l=t.arguments)||void 0===l?void 0:l.length)return[{type:"cmd",providerId:e.id,command:o,params:i||void 0,isError:!i||void 0}];let n=[{type:"cmd",providerId:e.id,command:o,params:void 0}];return i&&n.push({type:"text",value:i}),n}}return[{type:"text",value:e}]}},60359:function(e,t,n){n.d(t,{$3:function(){return d},HP:function(){return c},Mn:function(){return s},R5:function(){return p},Up:function(){return g},YW:function(){return m},jV:function(){return h},qk:function(){return u}});var r=n(73445),o=n(76248),i=n(782),a=n(32010);let l=(0,r.Ue)()((0,i.tJ)((e,t)=>({autoSpeak:"off",setAutoSpeak:t=>e({autoSpeak:t}),autoSuggestDiagrams:!1,setAutoSuggestDiagrams:t=>e({autoSuggestDiagrams:t}),autoSuggestQuestions:!1,setAutoSuggestQuestions:t=>e({autoSuggestQuestions:t}),autoTitleChat:!0,setAutoTitleChat:t=>e({autoTitleChat:t}),filterHasStars:!1,setFilterHasStars:t=>e({filterHasStars:t}),micTimeoutMs:2e3,setMicTimeoutMs:t=>e({micTimeoutMs:t}),showPersonaIcons:!0,setShowPersonaIcons:t=>e({showPersonaIcons:t}),showRelativeSize:!1,setShowRelativeSize:t=>e({showRelativeSize:t}),showTextDiff:!1,setShowTextDiff:t=>e({showTextDiff:t}),showSystemMessages:!1,setShowSystemMessages:t=>e({showSystemMessages:t})}),{name:"app-app-chat",version:1,onRehydrateStorage:()=>e=>{e&&(e.showTextDiff=!1)},migrate:(e,t)=>
1(e&&t<1&&(e.autoTitleChat=!0),e)})),s=()=>l(e=>({autoSpeak:e.autoSpeak,autoSuggestDiagrams:e.autoSuggestDiagrams,autoSuggestQuestions:e.autoSuggestQuestions,autoTitleChat:e.autoTitleChat,setAutoSpeak:e.setAutoSpeak,setAutoSuggestDiagrams:e.setAutoSuggestDiagrams,setAutoSuggestQuestions:e.setAutoSuggestQuestions,setAutoTitleChat:e.setAutoTitleChat}),o.X),d=()=>l.getState(),c=()=>l(e=>e.micTimeoutMs),u=()=>l(e=>[e.micTimeoutMs,e.setMicTimeoutMs],o.X),p=()=>{let e=l((0,a.N)(e=>({filterHasStars:e.filterHasStars,showPersonaIcons:e.showPersonaIcons,showRelativeSize:e.showRelativeSize})));return{...e,toggleFilterHasStars:()=>l.getState().setFilterHasStars(!e.filterHasStars),toggleShowPersonaIcons:()=>l.getState().setShowPersonaIcons(!e.showPersonaIcons),toggleShowRelativeSize:()=>l.getState().setShowRelativeSize(!e.showRelativeSize)}},h=()=>l(e=>[e.showTextDiff,e.setShowTextDiff],o.X),m=()=>l.getState().showSystemMessages,g=()=>l(e=>[e.showSystemMessages,e.setShowSystemMessages],o.X)},29086:function(e,t,n){n.d(t,{D:function(){return v},y:function(){return f}});var r=n(35944);n(67294);var o=n(23924),i=n(40911),a=n(56861),l=n(71978),s=n(60242),d=n(65467),c=n(74876),u=n(21388),p=n(49309),h=n(44497),m=n(9601),g=n(70800);let f=!1;function v(){let e=(0,m.dD)(),{labsAttachScreenCapture:t,setLabsAttachScreenCapture:n,labsCameraDesktop:v,setLabsCameraDesktop:Z,labsChatBarAlt:b,setLabsChatBarAlt:x,labsHighPerformance:S,setLabsHighPerformance:w,labsShowCost:C,setLabsShowCost:y}=(0,g.Z)();return(0,r.BX)(r.HY,{children:[(0,r.tZ)(p.L,{title:(0,r.BX)(r.HY,{children:[(0,r.tZ)(d.Z,{sx:{fontSize:"lg",mr:.5,mb:.25}}),"Performance"]}),description:S?"Unlocked":"Default",checked:S,onChange:w}),f&&(0,r.tZ)(p.L,{title:(0,r.BX)(r.HY,{children:[(0,r.tZ)(c.Z,{sx:{fontSize:"lg",mr:.5,mb:.25}}),"Chat Title"]}),description:"title"===b?"Show Title":"Show Models",checked:"title"===b,onChange:e=>x(!!e&&"title")}),!e&&(0,r.tZ)(p.L,{title:(0,r.BX)(r.HY,{children:[(0,r.tZ)(s.Z,{sx:{fontSize:"lg",mr:.5,mb:.25}})," Screen Capture"]}),description:t?"Enabled":"Disabled",checked:t,onChange:n}),!e&&(0,r.tZ)(p.L,{title:(0,r.BX)(r.HY,{children:[(0,r.tZ)(a.Z,{sx:{fontSize:"lg",mr:.5,mb:.25}})," Webcam Capture"]}),description:v?"Enabled":"Disabled",checked:v,onChange:Z}),(0,r.tZ)(p.L,{title:(0,r.BX)(r.HY,{children:[(0,r.tZ)(l.Z,{sx:{fontSize:"lg",mr:.5,mb:.25}}),"Cost of messages"]}),description:C?"Show when available":"Disabled",checked:C,onChange:y}),(0,r.BX)(o.Z,{orientation:"horizontal",sx:{justifyContent:"space-between",alignItems:"center"},children:[(0,r.tZ)(u.E,{title:"Graduated",description:"Ex-labs"}),(0,r.BX)(i.ZP,{level:"body-xs",children:[(0,r.tZ)(h.r,{href:"https://big-agi.com/blog/beam-multi-model-ai-reasoning",target:"_blank",children:"Beam"})," \xb7 ",(0,r.tZ)(h.r,{href:"https://github.com/enricoros/big-AGI/issues/208",target:"_blank",children:"Split Chats"})," \xb7 ",(0,r.tZ)(h.r,{href:"https://github.com/enricoros/big-AGI/issues/354",target:"_blank",children:"Call AGI"})," \xb7 ",(0,r.tZ)(h.r,{href:"https://github.com/enricoros/big-AGI/issues/282",target:"_blank",children:"Persona Creator"})," \xb7 ",(0,r.tZ)(h.r,{href:"https://github.com/enricoros/big-agi/issues/192",target:"_blank",children:"Auto Diagrams"})," \xb7 ","Imagine \xb7 Chat Search \xb7 Text Tools \xb7 LLM Overheat"]})]})]})}},78930:function(e,t,n){n.d(t,{a:function(){return u}});var r=n(35944);n(67294);var o=n(76248),i=n(23924),a=n(83073),l=n(22581),s=n(9453),d=n(21388),c=n(10604);function u(e){let[t,n]=(0,c.Z)(e=>[e.contentScaling,e.setContentScaling],o.X);return(0,r.BX)(i.Z,{orientation:"horizontal",sx:{justifyContent:e.noLabel?"center":"space-between"},children:[!e.noLabel&&(0,r.tZ)(d.E,{title:"Text Size",description:"xs"===t?"Dense":"sm"===t?"Default":"Comfy"}),(0,r.tZ)(a.Z,{sx:{maxWidth:160,width:"100%","--Step-connectorThickness":"2px","--StepIndicator-size":"2rem"},children:["xs","sm","md"].map(e=>{let o=e===t;return(0,r.tZ)(l.Z,{onClick:()=>n(e),indicator:(0,r.tZ)(s.ZP,{size:"sm",variant:o?"outlined":"soft",sx:{fontSize:e,borderRadius:"50%",width:"1rem",he
1ight:"1rem","--variant-borderWidth":"2px",borderColor:"primary.solidBg"},children:"Aa"})},e)})})]})}},41610:function(e,t,n){n.d(t,{X:function(){return d}});var r=n(35944);n(67294);var o=n(93410),i=n(23926),a=n(74312),l=n(29643);let s=(0,a.Z)(o.r)({zIndex:1e3});function d(e){let t=t=>{t.stopPropagation(),e.onClose()};return(0,r.tZ)(s,{role:void 0,open:e.open&&null!==e.anchorEl,anchorEl:e.anchorEl,placement:e.placement,disablePortal:!1,modifiers:[{name:"offset",options:{offset:e.placementOffset||[0,4]}}],sx:e.zIndex?{zIndex:e.zIndex}:{},children:(0,r.tZ)(i.d,{onClickAway:t,children:(0,r.tZ)(l.Z,{ref:e.listRef,onKeyDown:n=>{if("Tab"===n.key)t(n);else if("Escape"===n.key){var r;e.anchorEl&&(null===(r=e.anchorEl)||void 0===r||r.focus()),t(n)}},sx:{"--ListItem-minHeight":e.dense?"2.25rem":"2.5rem",...e.bigIcons&&{"--Icon-fontSize":"var(--joy-fontSize-xl2)"},backgroundColor:"background.popup",boxShadow:"md",...void 0!==e.maxHeightGapPx?{maxHeight:"calc(100dvh - ".concat(e.maxHeightGapPx,"px)"),overflowY:"auto"}:{},...e.noTopPadding?{pt:0}:{},...e.noBottomPadding?{pb:0}:{},...e.sx||{}},children:e.children})})})}},92808:function(e,t,n){n.d(t,{c:function(){return c}});var r=n(35944);n(67294);var o=n(46457),i=n(40911),a=n(46569),l=n(47556),s=n(6775),d=n(89268);function c(e){return(0,r.BX)(d.M,{open:void 0===e.open||e.open,title:e.noTitleBar?void 0:e.title||"Confirmation",titleStartDecorator:e.noTitleBar?void 0:(0,r.tZ)(s.Z,{sx:{color:"danger.solidBg"}}),noTitleBar:e.noTitleBar,onClose:e.onClose,hideBottomClose:!0,children:[!e.noTitleBar&&(0,r.tZ)(o.Z,{}),(0,r.tZ)(i.ZP,{level:"body-md",children:e.confirmationText}),(0,r.BX)(a.Z,{sx:{display:"flex",gap:1,justifyContent:"flex-end",mt:2},children:[(0,r.tZ)(l.Z,{autoFocus:!0,variant:"plain",color:"neutral",onClick:e.onClose,startDecorator:e.negativeActionStartDecorator,children:e.negativeActionText||"Cancel"}),(0,r.tZ)(l.Z,{variant:e.lowStakes?"soft":"solid",color:e.lowStakes?void 0:"danger",onClick:e.onPositive,sx:{lineHeight:"1.5em"},children:e.positiveActionText})]})]})}},43142:function(e,t,n){n.d(t,{D:function(){return s},s:function(){return l}});var r=n(35944);n(67294);var o=n(9876),i=n(49235),a=n(16903);function l(e){return a.Kc?e.replaceAll("Ctrl","â").replaceAll("Alt","â¥").replaceAll("Shift","â§"):e}function s(e){return(0,r.tZ)(o.Z,{variant:e.dark?"solid":"outlined",color:"neutral",sx:{...i._X,...e.sx},children:l(e.combo)})}},58218:function(e,t,n){n.d(t,{d:function(){return s}});var r=n(35944);n(67294);var o=n(23924),i=n(94925),a=n(4552),l=n(21388);let s=e=>(0,r.BX)(o.Z,{orientation:"horizontal",disabled:e.disabled,sx:{justifyContent:"space-between",alignItems:"center"},children:[(!!e.title||!!e.description)&&(0,r.tZ)(l.E,{title:e.title,description:e.description,tooltip:e.tooltip}),(0,r.tZ)(i.Z,{orientation:"horizontal",value:e.value,onChange:t=>t.target.value&&e.onChange(t.target.value),sx:{flexWrap:"wrap"},children:e.options.map(t=>(0,r.tZ)(a.Z,{value:t.value,label:t.label,disabled:t.disabled||e.disabled},"opt-"+t.value))})]})},1361:function(e,t,n){n.d(t,{S:function(){return l}});var r=n(35944);n(67294);var o=n(16397),i=n(15939),a=n(683);function l(e){let{inverted:t,altColor:n,...l}=e;return(0,r.tZ)(o.Z,{titleAccess:"".concat((0,a.fm)(i.H.Title.Base)," logo mark"),viewBox:"0 0 6.3500006 6.3499996",width:"24",height:"24",stroke:"none",strokeWidth:.691986,strokeLinecap:"round",strokeLinejoin:"round",...l,children:(0,r.tZ)("g",{transform:"translate(51.117939,-42.425365)",children:(0,r.BX)("g",{transform:"matrix(0.07058825,0,0,0.07058823,-47.509613,39.430634)",children:[(0,r.tZ)("rect",{fill:t?n||"#000000":"currentColor",width:"89.958321",height:"89.958321",x:"-51.117939",y:"42.425365",ry:"20"}),(0,r.tZ)("path",{fill:t?"currentColor":n||"#000000",fillOpacity:1,d:"m 4.0021675,49.836309 -5.2e-4,5.1e-4 c -2.16855,0.54197 -4.18593997,1.53104 -6.17895,2.51871 -1.76404,0.94102 -3.50957,1.96574 -4.97024,3.34864 -1.01158,0.95772 -1.10871,1.18722 -1.9327,2.2934 -1.3708395,2.32511 -1.8551195,4.78906 -1.7817995,7.46827 0.0135,0.49268 0.0709,0.98327 0.10645,1.47485 0.16185,1.68282 0.58029,3.32246 0.8893495,4.98006 0.21008,1.12671 0.202,1.19346 0.3514,2.34404 0.16811,1.66717 0.20579,3.37783 -0.27285,5.00331 -0.3570295,1.21244 -0.5419495,1.37085 -1.1849395,2.46755 -1.08741,1.46507 -2.46987,2.7206 -4.05712,3.62975
1-0.6278,0.35961 -1.54734,0.75252 -2.21226,1.05007 -0.14695,0.0581 -1.32968,0.50363 -1.5658,0.66559 -0.2541,0.17428 -0.83933,1.09089 -0.49868,1.31 7.95779,5.11884 6.04665,4.96385 10.3476895,5.0121 0.0404,0.005 0.0678,0.008 0.10749,0.0129 0.32616,0.47435 0.62621,0.96314 0.85524,1.48931 0.37498,0.86147 0.50729,1.81227 0.6718,2.7373 0.28715,1.61456 0.45546,3.251761 0.54673,4.889111 0.20491,3.67585 0,11.0448 0,11.0448 0,0 -0.05519,9.95619 -0.08888,18.80712 h 8.17676 c 0.01797,-5.68374 0.03669,-12.27573 0.03669,-12.27573 v -7.44658 -5.50302 c 0,0 0.0305,-3.26895 0,-4.90358 -0.0285,-1.06103 -0.0599,-1.85635 -0.25373,-2.759521 -0.12533997,-0.58405 -0.33168997,-1.15279 -0.58238997,-1.69499 -0.32913,-0.7118 -0.76001,-1.37445 -1.19993,-2.02364 -0.43112003,-0.63621 -0.86978003,-1.27635 -1.40611003,-1.82677 -0.49313,-0.50609 -1.06346,-0.93626 -1.6459,-1.33635 -0.92028,-0.63214 -1.76336,-1.21583 -2.62258,-1.77663 1.65441,-1.03826 3.09438,-2.40552 4.23334,-3.98839 0.71381,-1.21567 0.92029,-1.40723 1.34255003,-2.73937 0.54445,-1.71766 0.58905,-3.53149 0.43822,-5.3113 -0.11668,-1.06503 -0.13236,-1.36869 -0.3142,-2.41433 -0.28433,-1.63494 -0.74152003,-3.23741 -0.94723003,-4.88704 -0.0502,-0.46371 -0.1235,-0.92552 -0.15089,-1.39113 -0.14629,-2.48733 0.20532,-4.71974 1.46813003,-6.89363 0.77186,-1.01913 0.85052,-1.21803 1.80814997,-2.09238 1.42824,-1.30403 3.1314,-2.25506 4.837439,-3.13934 1.92892,-0.92218 3.8955405,-1.89816 6.0301205,-2.22312 z"})]})})})}},2105:function(e,t,n){n.d(t,{Z:function(){return i}});var r=n(35944);n(67294);var o=n(16397);function i(e){return(0,r.BX)(o.Z,{viewBox:"0 0 24 24",width:"24",height:"24",stroke:"currentColor",fill:"currentColor",strokeLinejoin:"round",...e,children:[(0,r.tZ)("path",{d:"M 4,12 14,9"}),(0,r.tZ)("path",{d:"M 14,15 4,12"}),(0,r.tZ)("path",{d:"m 14,15 6,-3"}),(0,r.tZ)("path",{d:"m 4,12 10,9"}),(0,r.tZ)("path",{d:"M 14,3 4,12"}),(0,r.tZ)("rect",{width:"4",height:"4",x:"2",y:"10"}),(0,r.tZ)("rect",{width:"2",height:"2",x:"19",y:"11",strokeWidth:2}),(0,r.tZ)("rect",{width:"2",height:"2",x:"13",y:"2"}),(0,r.tZ)("rect",{width:"2",height:"2",x:"13",y:"8"}),(0,r.tZ)("rect",{width:"2",height:"2",x:"13",y:"14"}),(0,r.tZ)("rect",{width:"2",height:"2",x:"13",y:"20"})]})}},18361:function(e,t,n){n.d(t,{GX:function(){return r.h},p7:function(){return i.p7},sY:function(){return o.Kl}});var r=n(53242),o=n(32684),i=n(13617)},83609:function(e,t,n){n.d(t,{I:function(){return a},P:function(){return i}});var r=n(67294),o=n(16903);let i={Esc:"Escape",Left:"ArrowLeft",Right:"ArrowRight"},a=e=>{r.useEffect(()=>{let t=t=>{for(let[n,r,i,a,l]of e)if(n&&r===t.ctrlKey&&i===t.shiftKey&&(o.Kc||a===t.altKey)&&t.key.toLowerCase()===n.toLowerCase()){t.preventDefault(),t.stopPropagation(),l();break}};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[e])}},9601:function(e,t,n){n.d(t,{W7:function(){return l},dD:function(){return s}});var r=n(67294),o=n(49235),i=n(16903);let a=()=>"(max-width: ".concat(o.wt.md-1,"px)"),l=()=>!!i.jU&&window.matchMedia(a()).matches,s=()=>(function(e,t){let[n,o]=r.useState(i.jU?window.matchMedia(e).matches:t);return r.useEffect(()=>{if(!i.jU)return;let t=window.matchMedia(e);o(t.matches);let n=e=>o(e.matches);return t.addEventListener("change",n),()=>t.removeEventListener("change",n)},[e]),n})(a(),!1)},53242:function(e,t,n){n.d(t,{h:function(){return l},x:function(){return s}});var r=n(67294),o=n(16903),i=n(10604);let a=null,l=()=>{if(!a){let e=!!d();a={mayWork:e&&!0,isApiAvailable:e,isDeviceNotSupported:!1,warnings:o.lj?["Not tested on this browser/device."]:[]}}return a},s=(e,t)=>{let n=(0,i.Z)(e=>e.preferredLanguage),a=r.useRef(e),s=r.useRef(t),c=r.useRef(null),u=r.useRef(n),p=r.useRef(!1),[h,m]=r.useState(!1),[g,f]=r.useState(!1),[v,Z]=r.useState(!1),[b,x]=r.useState(!1),[S,w]=r.useState(!1);r.useEffect(()=>{a.current=e,s.current=t,u.current!==n&&(u.current=n,c.current&&c.current.setLang(n))},[e,t,n]),r.useEffect(()=>{if(!o.jU)return;if(c.current){console.warn("useSpeechRecognition: [dev-warn]: Speech recognition is already initialized.");return}if(l().isDeviceNotSupported){console.log("Speech recognition is disabled on this device.");return}let e=d();if(!e)return;let t=new e;t.lang=u.current,t.interimResults=o.lg&&s.current>0,t.maxAlternatives=1,t.continuous=!0;let n={transcript:"",interimTranscript:"",done:!1,doneReason:void 0},r=null,i=()=>{r&&(clearTimeout(r),r=null)},h=(e,o)=>{i(),r=setTimeout(()=>{r=null,n.doneReason=o,t.stop()},e)};return t.onaudiostart=()=>Z(!0),t.onaudioend=()=>Z(!1),t.onspeechstart=()=>x(!0),t.onspeechend=()=>x(!1),t.onstart=()=>{p.current=!0,f(!0),n.transcript="",n.interimTranscript="Listening...",n.done=!1,n.doneReason=void 0,a.current(n)},t.onend=()=>{var e;p.current=!1,f(!1),i(),n.interimTranscript="",n.done=!0,n.doneReason=null!==(e=n.doneReason)&&void 0!==e?e:"api-unknown-timeout",a.current(n)},t.onerror=e=>{"no-speech"===e.error?n.doneReason="api-no-speech":(console.error("Error occurred during speech recognition:",e.error),w(!0),n.doneReason="api-error")},t.onresult=e=>{var r,o,i;if(null==e?void 0:null===(r=e.results)||void 0===r?void 0:r.length){for(let t of(n.transcript="",n.interimTranscript="",e.results)){let e=null===(i=t[0])||void 0===i?void 0:null===(o=i.transcript)||void 0===o?void 0:o.trim();e&&((e=e.replaceAll(" comma",",").replaceAll(" exclamation mark","!").replaceAll(" period",".").replaceAll(" question mark","?")).length>=2&&(t.isFinal||!n.interimTranscript)&&(e=e.charAt(0).toUpperCase()+e.slice(1)),!t.isFinal||e.endsWith(".")||e.endsWith("!")||e.endsWith("?")||e.endsWith(":")||e.endsWith(";")||e.endsWith(",")||(e+="."),t.isFinal?n.transcript+=e+" ":n.interimTranscript+=e+" ")}a.current(n),t.interimResults&&h(s.current,"continuous-deadline")}},c.current={setLang:e=>t.lang=e,start:()=>t.start(),stop:e=>{n.doneReason=e,t.stop()},unmount:()=>{i(),t.onaudiostart=void 0,t.onaudioend=void 0,t.onspeechstart=void 0,t.onspeechend=void 0,t.onstart=void 0,t.onend=void 0,t.onerror=void 0,t.onresult=void 0,p.current&&(n.doneReason="react-unmount",t.stop(),p.current=!1)}},p.current=!1,m(!0),()=>{c.current&&(c.current.unmount(),c.current=null),m(!1)}},[]);let C=r.useCallback(()=>
1{if(!c.current)return console.error("startRecording: Speech recognition is not supported or not initialized.");if(p.current)return console.error("startRecording: Start recording called while already recording.");w(!1);try{c.current.start()}catch(e){w(!0),console.log("Speech recognition error - clicking too quickly?",null==e?void 0:e.message)}},[]),y=r.useCallback(()=>c.current?p.current?void c.current.stop("manual"):console.error("stopRecording: Stop recording called while not recording."):console.error("stopRecording: Speech recognition is not supported or not initialized."),[]),k=r.useCallback(()=>{p.current||S?(y(),w(!1)):C()},[S,C,y]);return{isRecording:g,isRecordingAudio:v,isRecordingSpeech:b,isSpeechEnabled:h,isSpeechError:S,startRecording:C,stopRecording:y,toggleRecording:k}};function d(){if(o.jU){var e;return null!==(e=window.SpeechRecognition||window.webkitSpeechRecognition||window.mozSpeechRecognition||window.msSpeechRecognition)&&void 0!==e?e:null}return null}},55374:function(e,t,n){n.d(t,{J:function(){return d},w:function(){return c}});var r=n(35944),o=n(67294),i=n(9601),a=n(16903);let l=o.createContext(void 0),s=!(0,i.W7)()&&!(a.jU&&"/news"===window.location.pathname);function d(e){let[t,n]=o.useState(s),[a,d]=o.useState(!1),c=o.useMemo(()=>({toggleDrawer:()=>n(e=>s=!e),openDrawer:()=>n(s=!0),closeDrawer:()=>n(s=!1),closeDrawerOnMobile:()=>(0,i.W7)()&&n(s=!1),togglePageMenu:()=>d(e=>!e),openPageMenu:()=>d(!0),closePageMenu:()=>d(!1)}),[]);return(0,r.tZ)(l.Provider,{value:{isDrawerOpen:t,isPageMenuOpen:a,...c},children:e.children})}let c=()=>{let e=o.useContext(l);if(!e)throw Error("useOptimaDrawer must be used within an OptimaDrawerProvider");return e}},63417:function(e,t,n){n.d(t,{Fe:function(){return u},Yb:function(){return l},_h:function(){return c},dD:function(){return p}});var r=n(35944),o=n(67294),i=n(83609),a=n(16903);let l={None:0,Chat:1,Voice:2,Draw:3,Tools:4},s={appDrawerContent:null,appBarItems:null,appMenuItems:null,showPreferencesTab:0,showModelsSetup:!1,showLlmOptions:null,showShortcuts:!1,isFocusedMode:!1},d=o.createContext(void 0);function c(e){let[t,n]=o.useState(s),c=o.useMemo(()=>({setPluggableComponents:(e,t,r)=>n(n=>({...n,appDrawerContent:e,appBarItems:t,appMenuItems:r})),openPreferencesTab:e=>n(t=>({...t,showPreferencesTab:e||l.Chat})),closePreferences:()=>n(e=>({...e,showPreferencesTab:0})),openModelsSetup:()=>n(e=>({...e,showModelsSetup:!0})),closeModelsSetup:()=>n(e=>({...e,showModelsSetup:!1})),openLlmOptions:e=>n(t=>({...t,showLlmOptions:e})),closeLlmOptions:()=>n(e=>({...e,showLlmOptions:null})),openShortcuts:()=>n(e=>({...e,showShortcuts:!0})),closeShortcuts:()=>n(e=>({...e,showShortcuts:!1})),setIsFocusedMode:e=>n(t=>({...t,isFocusedMode:e}))}),[]),u=o.useMemo(()=>[[a.Kc?"/":"?",!0,!0,!1,c.openShortcuts],[",",!0,!1,!1,c.openPreferencesTab],["m",!0,!0,!1,c.openModelsSetup]],[c]);return(0,i.I)(u),(0,r.tZ)(d.Provider,{value:{...t,...c},children:e.children})}let u=()=>{let e=o.useContext(d);if(!e)throw Error("useOptimaLayout must be used within an OptimaLayoutProvider");return e},p=(e,t,n,r)=>{let{setPluggableComponents:i}=u();o.useEffect(()=>(i(e,t,n),()=>{i(null,null,null)}),[t,n,e,r,i])}},90216:function(e,t,n){n.d(t,{X:function(){return np}});var r=n(35944),o=n(67294),i=n(11163),a=n.n(i),l=n(3909),s=n(98084),d=n(77227),c=n(43927),u=n(51556),p=n(1123),h=n(1357),m=n(81632),g=n(33570),f=n(71869),v=n(65203),Z=n(67142),b=n(53439),x=n(56693),S=n(25761),w=n(69773),C=n(91019),y=n(91438),k=n(51965),I=n(26565),L=n(34685),M=n(25449),D=n(16397),P=n(23339),A=n(94229),B=n(15939),E=n(2105),T=n(46343);let R="__DIVIDER__",X={apps:[{name:"Chat",icon:k.Z,iconActive:y.Z,type:"app",route:"/"},{name:"Call",barTitle:"Voice Calls",icon:h.Z,iconActive:p.Z,type:"app",route:"/call",hideDrawer:!0,fullWidth:!0},{name:"Draw",barTitle:"Generate Images",icon:v.Z,iconActive:Z.Z,type:"app",route:"/draw",hideDrawer:!0,isDev:!0,_delete:!0},{name:"Cortex",icon:u.Z,iconActive:c.Z,type:"app",route:"/cortex",isDev:!0,_delete:!0},{name:"Patterns",icon:s.Z,iconActive:d.Z,type:"app",route:"/patterns",isDev:!0,_delete:!0},{name:"Workspace",icon:L.Z,iconActive:I.Z,type:"app",route:"/workspace",hideDrawer:!0,hideOnMobile:!0,isDev:!0,_delete:!0},{name:R,type:"app",route:R,icon:()=>null},{name:"Personas",icon:m.Z,type:"app",route:"/personas",hideBar:!0},{name:"Tokenize",icon:b.Z,type:"app",route:"/tokens",hideDrawer:!0},{name:"Beam",icon:E.Z,type:"app",route:"/dev/beam",hideDrawer:!0,hideIcon:!0,isDev:!0},{name:"Media Library",icon:S.Z,iconActive:x.Z,type:"app",route:"/media",isDev:!0,_delete:!0},{name:"Shared Chat",icon:C.Z,iconActive:w.Z,type:"app",route:"/link/chat/[chatLinkId]",landingRoute:"/link/chat/list",hideOnMobile:!0,hideIcon:T.BJ,hideNav:T.BJ},{name:"News",icon:f.Z,iconActive:g.Z,type:"app",route:"/news",hideBar:!0,hideDrawer:!0}
1],modals:[{name:"Manage Models",icon:P.Z,type:"modal",overlayId:"models"},{name:"Preferences",icon:A.Z,type:"modal",overlayId:"settings"}],links:[{type:"extLink",name:"Discord",icon:function(e){return(0,r.BX)(D.Z,{viewBox:"0 0 24 24",width:"24",height:"24",stroke:"currentColor",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",...e,children:[(0,r.tZ)("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),(0,r.tZ)("path",{d:"M14.983 3l.123 .006c2.014 .214 3.527 .672 4.966 1.673a1 1 0 0 1 .371 .488c1.876 5.315 2.373 9.987 1.451 12.28c-1.003 2.005 -2.606 3.553 -4.394 3.553c-.94 0 -2.257 -1.596 -2.777 -2.969l-.02 .005c.838 -.131 1.69 -.323 2.572 -.574a1 1 0 1 0 -.55 -1.924c-3.32 .95 -6.13 .95 -9.45 0a1 1 0 0 0 -.55 1.924c.725 .207 1.431 .373 2.126 .499l.444 .074c-.477 1.37 -1.695 2.965 -2.627 2.965c-1.743 0 -3.276 -1.555 -4.267 -3.644c-.841 -2.206 -.369 -6.868 1.414 -12.174a1 1 0 0 1 .358 -.49c1.392 -1.016 2.807 -1.475 4.717 -1.685a1 1 0 0 1 .938 .435l.063 .107l.652 1.288l.16 -.019c.877 -.09 1.718 -.09 2.595 0l.158 .019l.65 -1.287a1 1 0 0 1 .754 -.54l.123 -.01zm-5.983 6a2 2 0 0 0 -1.977 1.697l-.018 .154l-.005 .149l.005 .15a2 2 0 1 0 1.995 -2.15zm6 0a2 2 0 0 0 -1.977 1.697l-.018 .154l-.005 .149l.005 .15a2 2 0 1 0 1.995 -2.15z",strokeWidth:"0",fill:"currentColor"})]})},href:B.H.URIs.SupportInvite},{type:"extLink",name:"GitHub",icon:M.Z,href:B.H.URIs.OpenRepo}]};function z(e){return(null==e?void 0:e.name)===R}function H(e,t,n){return(!e.hideOnMobile||!t)&&(e===n||("function"==typeof e.hideIcon?!e.hideIcon():!e.hideIcon))}function N(e){return!!e&&("function"==typeof e.hideNav?!e.hideNav():!e.hideNav)}X.apps=X.apps.filter(e=>!e._delete);var O=n(9601),W=n(74312),j=n(46569),F=n(3414),G=n(49235),U=n(55374),K=n(63417);let Y=(0,W.Z)(j.Z)({width:"var(--AGI-Desktop-Drawer-width)",flexShrink:0,flexGrow:0}),_=(0,W.Z)(F.Z)(e=>{let{theme:t}=e;return{width:"100%",height:"100dvh",transition:"transform 0.42s cubic-bezier(.17,.84,.44,1)",zIndex:G.so,backgroundColor:"transparent",borderRight:"1px solid",borderRightColor:t.palette.divider,boxShadow:"0px 0px 6px 0 rgba(".concat(t.palette.neutral.darkChannel," / 0.12)"),display:"flex",flexDirection:"column"}});function V(e){var t,n;let{isDrawerOpen:i,closeDrawer:a,openDrawer:l}=(0,U.w)(),{appDrawerContent:s}=(0,K.Fe)(),[d,c]=o.useState(!1);o.useEffect(()=>{},[i]);let u=!(null===(t=e.currentApp)||void 0===t?void 0:t.hideDrawer);o.useEffect(()=>{u||a()},[a,u]);let p=!(null===(n=e.currentApp)||void 0===n?void 0:n.hideDrawer)&&N(e.currentApp);return o.useEffect(()=>{p&&l()},[l,p]),(0,r.tZ)(Y,{sx:{contain:i?void 0:"strict"},children:(0,r.tZ)(_,{component:e.component,sx:{transform:i?"none":"translateX(-100%)"},children:s})})}var q=n(46457),J=n(2549),Q=n(72868),$=n(59562),ee=n(3243),et=n(51281),en=n(61362),er=n(326),eo=n(79369),ei=n(33388),ea=n(1361),el=n(47556),es=n(44497),ed=n(49856),ec=n(9453);let eu=(0,W.Z)(j.Z)({display:"flex",flexDirection:"column",flexWrap:"wrap",justifyContent:"center",alignItems:"center","--GroupMarginY":"0.125rem"}),ep={typeMenu:"NavButton-typeMenu",typeApp:"NavButton-typeApp",typeLinkOrModal:"NavButton-typeLink",dev:"NavButton-dev",active:"NavButton-active",paneOpen:"NavButton-paneOpen",attractive:"NavButton-attractive"},eh=(0,W.Z)(ec.ZP)(e=>{let{theme:t}=e;return{"--MarginX":"0.25rem",marginBlock:"var(--GroupMarginY)",padding:0,["&.".concat(ep.typeApp,",&.").concat(ep.typeLinkOrModal)]:{"--Icon-fontSize":"1.25rem"},["&.".concat(ep.typeMenu)]:{transition:"rotate 0.6s","&:active":{rotate:"90deg",transition:"rotate 0.2s"}},["&.".concat(ep.typeApp)]:{"--IconButton-size":"calc(var(--Bar) - 2 * var(--MarginX))",transition:"border-radius 0.4s, margin 0.2s, padding 0.2s"},["&.".concat(ep.typeApp,":hover")]:{backgroundColor:"var(--variant-solidHoverBg)",color:t.palette.neutral.softColor},["&.".concat(ep.paneOpen)]:{borderStartStartRadius:"calc(var(--IconButton-size) / 4)",borderEndStartRadius:"calc(var(--IconButton-size) / 4)",borderStartEndRadius:0,borderEndEndRadius:0,marginLeft:"calc(2 * var(--MarginX))",paddingRight:"calc(2 * var(--MarginX))"},["&.".concat(ep.paneOpen,":hover")]:{borderRadius:"var(--joy-radius-md, 0.5rem)",marginLeft:0,paddingRight:0},["&.".concat(ep.attractive)]:{"--Icon-fontSize":"2rem",animation:"".concat(ed.j0," 4s infinite")},["&.".concat(ep.dev)]:{border:"2px dashed red"}}});function em(e){var t;let[n,i]=o.useState(!1);o.useEffect(()=>{if(n){let e=setTimeout(()=>i(!1),7320);return()=>clearTimeout(e)}},[n]);let a=n?"â¤ï¸":null!==(t=(0,r.tZ)(e.icon,{}))&&void 0!==t?t:null;return(0,r.tZ)(J.Z,{followCursor:!0,title:e.text,children:e.asIcon?(0,r.tZ)(eh,{variant:"solid",className:ep.typeLinkOrModal,component:es.r,href:e.link,target:"_blank",onClick:()=>i(!0),sx:{background:"transparent","&:hover":{animation:"".concat(ed.Kz," 5s linear infinite")}},children:a}):(0,r.tZ)(el.Z,{component:es.r,href:e.link,target:"_blank",noLinkStyle:!0,onClick:()=>i(!0),sx:{"&:hover":{animation:"".concat(ed.Kz," 5s linear infinite")},background:"transparent",...e.sx},children:a})})}var eg=n(38629);let ef=(0,W.Z)(j.Z)({width:"var(--Bar)",height:"var(--Bar)",display:"flex",justifyContent:"center",alignItems:"center"}),ev=(0,W.Z)(F.Z)({"--Bar":"var(--AGI-Nav-width)",display:"flex",justifyContent:"space-between",alignItems:"center"}
1),eZ=e=>{let t=(0,eg.F)(),n=(null==t?void 0:t.palette.mode)==="dark",i=o.useMemo(()=>"horizontal"===e.direction?{flexDirection:"row",...e.sx}:{flexDirection:"column",...e.sx},[e.direction,e.sx]);return(0,r.tZ)(ev,{id:e.id,component:e.component,variant:n?"soft":"solid",invertedColors:!n||void 0,sx:i,children:e.children})},eb={zIndex:G.CD};function ex(e){var t;let{isDrawerOpen:n,toggleDrawer:i}=(0,U.w)(),{showPreferencesTab:l,openPreferencesTab:s,showModelsSetup:d,openModelsSetup:c}=(0,K.Fe)(),u=(0,ei.p0)(e=>!e.llms.length),p=!(null===(t=e.currentApp)||void 0===t?void 0:t.hideDrawer)&&!n||n,h=o.useCallback(()=>{p&&i()},[p,i]),m=o.useMemo(()=>{let t=!1,o=[],l=[];X.apps.forEach((n,r)=>{H(n,!1,e.currentApp)&&(t&&n!==e.currentApp?l.push(n):o.push(n),t=t||z(n))});let s=o.map((t,o)=>{let l=t===e.currentApp,s=l&&!t.hideDrawer,d=s&&n;return z(t)?(0,r.tZ)(q.Z,{sx:{my:1,width:"50%",mx:"auto"}},"app-sep-"+o):(0,r.tZ)(J.Z,{disableInteractive:!0,enterDelay:600,title:t.name+(t.isDev?" [DEV]":""),children:(0,r.tZ)(eh,{variant:l?"solid":void 0,onClick:s?i:()=>a().push(t.landingRoute||t.route),className:"".concat(ep.typeApp," ").concat(l?ep.active:""," ").concat(d?ep.paneOpen:""," ").concat(t.isDev?ep.dev:""),children:(0,r.tZ)(t.icon,{})})},"n-m-"+t.route.slice(1))});return l.length&&s.push((0,r.BX)(Q.L,{children:[(0,r.tZ)(J.Z,{disableInteractive:!0,enterDelay:600,title:"More Apps",children:(0,r.tZ)($.Z,{slots:{root:eh},slotProps:{root:{className:ep.typeApp}},children:(0,r.tZ)(eo.Z,{})})}),(0,r.tZ)(ee.Z,{variant:"solid",invertedColors:!0,placement:"right-start",sx:{minWidth:160},children:l.map((e,t)=>(0,r.BX)(et.Z,{onClick:()=>a().push(e.landingRoute||e.route),sx:{minHeight:"2.5rem"},children:[(0,r.tZ)(en.Z,{sx:{ml:1},children:(0,r.tZ)(e.icon,{})}),e.name+(e.isDev?" [DEV]":"")]},"nav-app-extra-"+t))})]},"n-app-overflow")),s},[n,e.currentApp,i]),g=o.useMemo(()=>X.links.map((e,t)=>(0,r.tZ)(em,{asIcon:!0,text:e.name,icon:e.icon,link:e.href,sx:{p:1,mb:t>0?1:0}},"nav-ext-"+e.name)),[]),f=o.useMemo(()=>X.modals.map(e=>{var t;let n={settings:{isActive:!!l,showModal:()=>s()},models:{isActive:d,showModal:c},0:{isActive:!1,showModal:()=>console.log("Action missing for ",e.overlayId)}},{isActive:o,showModal:i}=null!==(t=n[e.overlayId])&&void 0!==t?t:n[0],a=u&&"models"===e.overlayId;return(0,r.tZ)(J.Z,{followCursor:!0,title:a?"Add Language Models - REQUIRED":e.name,children:(0,r.tZ)(eh,{variant:o?"soft":void 0,onClick:i,className:"".concat(ep.typeLinkOrModal," ").concat(o?ep.active:""," ").concat(a?ep.attractive:""),children:o&&e.iconActive?(0,r.tZ)(e.iconActive,{}):(0,r.tZ)(e.icon,{})})},"n-m-"+e.overlayId)}),[u,c,s,d,l]);return(0,r.BX)(eZ,{id:"desktop-nav",component:e.component,direction:"vertical",sx:eb,children:[(0,r.tZ)(ef,{children:(0,r.tZ)(J.Z,{title:n?"Close Drawer":"Open Drawer",children:(0,r.tZ)(eh,{disabled:!p,onClick:h,className:ep.typeMenu,children:p?(0,r.tZ)(er.Z,{}):(0,r.tZ)(ea.S,{inverted:!0,sx:{color:"white"}})})})}),(0,r.tZ)(eu,{children:m}),(0,r.BX)(eu,{sx:{mb:"calc(2 * var(--GroupMarginY))"},children:[g,f]})]})}var eS=n(88858);function ew(e){let{appDrawerContent:t}=(0,K.Fe)(),{isDrawerOpen:n,closeDrawer:o}=(0,U.w)();return(0,r.tZ)(eS.Z,{id:"mobile-drawer",component:e.component,open:n,onClose:o,sx:{"--Drawer-horizontalSize":"clamp(var(--AGI-Drawer-width), 30%, 100%)","--Drawer-transitionDuration":"0.2s"},slotProps:{content:{sx:{backgroundColor:"transparent",borderTopRightRadius:"var(--AGI-Optima-Radius)",borderBottomRightRadius:"var(--AGI-Optima-Radius)"}}},children:t})}var eC=n(76248),ey=n(56143),ek=n(89268),eI=n(16903),eL=n(72654),eM=n(96402),eD=n(23924),eP=n(75913),eA=n(9879),eB=n(6519),eE=n(40911),eT=n(46907),eR=n(22961),eX=n(72450),ez=n(21388);function eH(e){let t=(0,ei.p0)(t=>t.llms.find(t=>t.id===e.llmId),eC.X);if(!t)return"Options issue: LLM not found for id "+e.llmId;let n=(0,eL.S5)(t._source.vId);return n?(0,r.tZ)(n.LLMOptionsComponent,{llm:t}):"Options issue: Vendor not found for LLM "+e.llmId+", source "+t._source.id}function eN(e){let[t,n]=o.useState(!1),{llm:i,removeLLM:a,updateLLM:l,isChatLLM:s,setChatLLMId:d,isFastLLM:c,setFastLLMId:u,isFuncLLM:p,setFuncLLMId:h}=(0,ei.p0)(t=>({llm:t.llms.find(t=>
1t.id===e.id),removeLLM:t.removeLLM,updateLLM:t.updateLLM,isChatLLM:t.chatLLMId===e.id,isFastLLM:t.fastLLMId===e.id,isFuncLLM:t.funcLLMId===e.id,setChatLLMId:t.setChatLLMId,setFastLLMId:t.setFastLLMId,setFuncLLMId:t.setFuncLLMId}),eC.X);return i?(0,r.BX)(ek.M,{title:(0,r.BX)(r.HY,{children:[(0,r.tZ)("b",{children:i.label})," options"]}),open:!!e.id,onClose:e.onClose,startButton:(0,r.tZ)(el.Z,{variant:"plain",color:"neutral",onClick:()=>{a(i.id),e.onClose()},startDecorator:(0,r.tZ)(eT.Z,{}),children:"Delete"}),children:[(0,r.tZ)(j.Z,{sx:{display:"grid",gap:"var(--Card-padding)"},children:(0,r.tZ)(eH,{llmId:e.id})}),(0,r.tZ)(q.Z,{}),(0,r.BX)(eD.Z,{orientation:"horizontal",sx:{flexWrap:"wrap",alignItems:"center"},children:[(0,r.tZ)(ez.E,{title:"Name",sx:{minWidth:80}}),(0,r.tZ)(eP.ZP,{variant:"outlined",value:i.label,onChange:e=>l(i.id,{label:e.target.value||""})})]}),(0,r.BX)(eD.Z,{orientation:"horizontal",sx:{flexWrap:"wrap",alignItems:"center"},children:[(0,r.tZ)(ez.E,{title:"Defaults",sx:{minWidth:80}}),(0,r.BX)(eA.Z,{orientation:"horizontal",size:"sm",variant:"outlined",children:[(0,r.tZ)(J.Z,{title:s?"Default model for new Chats":"Make this model the default Chat model",children:(0,r.tZ)(el.Z,{variant:s?"solid":void 0,onClick:()=>d(s?null:e.id),children:"Chat"})}),(0,r.tZ)(J.Z,{title:'Use this Model for "fast" features, such as Auto-T
1itle, Summarize, etc.',children:(0,r.tZ)(el.Z,{variant:c?"solid":void 0,onClick:()=>u(c?null:e.id),children:"Fast"})}),(0,r.tZ)(J.Z,{title:'Use this Model for "function calling" and other structured features, such as Auto-Chart, Auto-Follow-ups, etc.',children:(0,r.tZ)(el.Z,{variant:p?"solid":void 0,onClick:()=>h(p?null:e.id),children:"Func"})})]})]}),(0,r.BX)(eD.Z,{orientation:"horizontal",sx:{flexWrap:"wrap",alignItems:"center"},children:[(0,r.tZ)(ez.E,{title:"Visible",sx:{minWidth:80}}),(0,r.tZ)(J.Z,{title:i.hidden?"Hide this model from the list of Chat models":"Show this model in the list of Chat models",children:(0,r.tZ)(eB.Z,{checked:!i.hidden,onChange:()=>l(i.id,{hidden:!i.hidden}),endDecorator:i.hidden?(0,r.tZ)(eX.Z,{}):(0,r.tZ)(eR.Z,{}),slotProps:{endDecorator:{sx:{minWidth:26}}}})})]}),(0,r.BX)(eD.Z,{orientation:"horizontal",sx:{flexWrap:"nowrap"},children:[(0,r.tZ)(ez.E,{title:"Details",sx:{minWidth:80},onClick:()=>n(!t)}),t&&(0,r.BX)(j.Z,{sx:{display:"flex",flexDirection:"column",gap:1},children:[!!i.description&&(0,r.tZ)(eE.ZP,{level:"body-sm",children:i.description}),!!i.tmpIsFree&&(0,r.tZ)(eE.ZP,{level:"body-xs",children:"\uD83C\uDF81 Free model - note: refresh models to check for updates in pricing"}),(0,r.BX)(eE.ZP,{level:"body-xs",children:["llm id: ",i.id,(0,r.tZ)("br",{}),"context tokens: ",(0,r.tZ)("b",{children:i.contextTokens?i.contextTokens.toLocaleString():"not provided"})," \xb7 ","max output tokens: ",(0,r.tZ)("b",{children:i.maxOutputTokens?i.maxOutputTokens.toLocaleString():"not provided"}),(0,r.tZ)("br",{}),!!i.created&&(0,r.BX)(r.HY,{children:["created: ",(0,r.tZ)(eM.Z,{date:new Date(1e3*i.created)}),(0,r.tZ)("br",{})]}),!!i.pricing&&(0,r.BX)(r.HY,{children:["pricing: $",(0,r.tZ)("b",{children:i.pricing.chatIn||"(unk) "}),"/M in, $",(0,r.tZ)("b",{children:i.pricing.chatOut||"(unk) "}),"/M out",(0,r.tZ)("br",{})]}),"config: ",JSON.stringify(i.options)]})]})]})]}):(0,r.BX)(r.HY,{children:["Options issue: LLM not found for id ",e.id]})}var eO=n(9876),eW=n(67424),ej=n(9786),eF=n(26465),eG=n(46396),eU=n(94532),eK=n(2525),eY=n(53309);let e_={my:"calc(var(--ListItem-paddingY) / -2)"};function eV(e){let{llm:t,onModelClicked:n,onModelSetHidden:i}=e,a=o.useCallback(e=>{e.stopPropagation(),n(t.id)},[t.id,n]),l=o.useCallback(e=>{e.stopPropagation(),i(t.id,!0)},[t.id,i]),s=o.useCallback(e=>{e.stopPropagation(),i(t.id,!1)},[t.id,i]),d=t.label,c=t._source.label;return t.description&&(c+=" \xb7 "+t.description),c+=" \xb7 ",t.contextTokens?(c+=t.contextTokens.toLocaleString()+" tokens",t.maxOutputTokens&&(c+=" / "+t.maxOutputTokens.toLocaleString()+" max output tokens")):c+="token count not provided",o.useMemo(()=>null,[t.interfaces,e.chipChat,e.chipFunc]),(0,r.tZ)(eW.Z,{children:(0,r.BX)(ej.Z,{"aria-label":"Configure LLM",onClick:a,tabIndex:-1,sx:{width:"100%",display:"flex",alignItems:"center",gap:{xs:.5,md:1}},children:[(0,r.tZ)(eY.s,{title:c,children:(0,r.tZ)(eE.ZP,{sx:{flex:1,color:t.hidden?"neutral.plainDisabledColor":"text.primary",wordBreak:"break-all"},children:d})}),(0,r.BX)(r.HY,{children:[e.chipChat&&(0,r.tZ)(eO.Z,{size:"sm",variant:"plain",sx:{boxShadow:"sm"},children:"chat"}),e.chipFast&&(0,r.tZ)(eO.Z,{size:"sm",variant:"plain",sx:{boxShadow:"sm"},children:"fast"}),e.chipFunc&&(0,r.tZ)(eO.Z,{size:"sm",variant:"plain",sx:{boxShadow:"sm"},children:"\uD835\uDC53n"})]}),(0,r.tZ)(eY.s,{title:t.hidden?"Hidden":"Shown in Chat",children:(0,r.tZ)(ec.ZP,{"aria-label":t.hidden?"Unhide":"Hide in Chat",size:"sm",onClick:t.hidden?s:l,sx:e_,children:t.hidden?(0,r.tZ)(eU.Z,{sx:{opacity:.5,fontSize:"md"}}):(0,r.tZ)(eK.Z,{})})}),(0,r.tZ)(eY.s,{title:"Options",children:(0,r.tZ)(ec.ZP,{"aria-label":"Configure LLM",size:"sm",sx:e_,onClick:a,children:(0,r.tZ)(eG.Z,{})})})]})})}function eq(e){let{chatLLMId:t,fastLLMId:n,funcLLMId:i,llms:a,updateLLM:l}=(0,ei.p0)(t=>({chatLLMId:t.chatLLMId,fastLLMId:t.fastLLMId,funcLLMId:t.funcLLMId,llms:t.llms.filter(t=>!e.filterSourceId||t.sId===e.filterSourceId),updateLLM:t.updateLLM}),(e,t)=>e.chatLLMId===t.chatLLMId&&e.fastLLMId===t.fastLLMId&&e.funcLLMId===t.funcLLMId&&(0,eC.X)(e.llms,t.llms)),{onOpenLLMOptions:s}=e,d=o.useCallback(e=>s(e),[s]),c=o.useCallback((e,t)=>l(e,{hidden:t}),[l]),u=a.length>=2&&a.find(e=>e._source!==a[0]._source),p=!e.filterSourceId,h="",m=[];for(let e of a){let o=e._source.label;(u||p)&&o!==h&&(h=o,m.push((0,r.tZ)(eW.Z,{sx:{justifyContent:"center"},children:(0,r.tZ)(eE.ZP,{children:o})},"lab-"+e._source.id)));let a=(0,eL.S5)(e._source.vId);a&&m.push((0,r.tZ)(eV,{llm:e,vendor:a,chipChat:e.id===t,chipFast:e.id===n,chipFunc:e.id===i,onModelClicked:d,onModelSetHidden:c},"llm-"+e.id))}return(0,r.tZ)(eF.Z,{variant:"outlined",sx:e.sx,children:m.length>0?m:(0,r.tZ)(eW.Z,{children:(0,r.tZ)(eE.ZP,{level:"body-sm",children:"Please configure the service and update the list of models."})})})}var eJ=n(92853),eQ=n(36376),e$=n(17452),e0=n(96540),e1=n(52923),e2=n(41610),e5=n(92808),e4=n(2226);function e3(e,t){let n=null;return(null==e?void 0:e.Icon)&&(n=(0,r.tZ)(e.Icon,{})),t&&n?(0,r.tZ)(eJ.Z,{size:"sm",badgeContent:"",slotProps:{badge:{sx:{backgroundColor:"lime",boxShadow:"none",border:"1px solid gray",p:0}}},children:n}):n}
1function e9(e){let[t,n]=o.useState(null),[i,a]=o.useState(null),l=(0,O.dD)(),{modelSources:s,addModelSource:d,removeModelSource:c}=(0,ei.p0)(e=>({modelSources:e.sources,addModelSource:e.addSource,removeModelSource:e.removeSource}),eC.X),u=e=>n(e.currentTarget),p=()=>n(null),h=o.useCallback(t=>{p();let{sources:n}=ei.p0.getState(),r=(0,eL.yJ)(t,n);r&&(d(r),e.setSelectedSourceId(r.id))},[d,e]),m=!!e.selectedSourceId&&s.length>1,g=e=>a(e),f=o.useCallback(()=>{if(i){var t,n;e.setSelectedSourceId(null!==(n=null===(t=s.find(e=>e.id!==i))||void 0===t?void 0:t.id)&&void 0!==n?n:null),c(i),a(null)}},[i,s,e,c]),v=o.useMemo(()=>(0,eL.BQ)().filter(e=>!!e.instanceLimit).sort((e,t)=>e.name.localeCompare(t.name)).map(e=>{let t=s.filter(t=>t.vId===e.id).length,n=e.instanceLimit>t,o=(0,e1.B)();return{vendor:e,enabled:n,component:(0,r.BX)(et.Z,{disabled:!n,onClick:()=>h(e.id),children:[(0,r.tZ)(en.Z,{children:e3(e,(0,e4.B)(e,o))}),e.name,e.instanceLimit>1&&!!t&&n&&(0,r.BX)(eE.ZP,{component:"span",level:"body-sm",children:["#",t+1]})]},e.id)}}).map(e=>e.component),[h,s]),Z=o.useMemo(()=>s.map(e=>{let t=e3((0,eL.S5)(e.vId),!1);return{source:e,icon:t,component:(0,r.tZ)(eQ.Z,{value:e.id,children:e.label},e.id)}}).sort((e,t)=>e.source.label.localeCompare(t.source.label)),[s]),b=Z.find(t=>t.source.id===e.selectedSourceId),x=!Z.length;return(0,r.BX)(j.Z,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",alignItems:"center",gap:1},children:[!l&&(0,r.tZ)(eE.ZP,{sx:{mr:1},children:"Service:"}),(0,r.tZ)(e$.Z,{variant:"outlined",value:e.selectedSourceId,disabled:x,onChange:(t,n)=>n&&e.setSelectedSourceId(n),startDecorator:null==b?void 0:b.icon,slotProps:{root:{sx:{minWidth:190}},indicator:{sx:{opacity:.5}}},children:Z.map(e=>e.component)}),l?(0,r.tZ)(ec.ZP,{variant:x?"solid":"plain",color:"primary",onClick:u,disabled:!!t,children:(0,r.tZ)(e0.Z,{})}):(0,r.tZ)(el.Z,{variant:x?"solid":"plain",onClick:u,disabled:!!t,startDecorator:(0,r.tZ)(e0.Z,{}),children:"Add"}),(0,r.tZ)(ec.ZP,{variant:"plain",color:"neutral",disabled:!m,sx:{ml:"auto"},onClick:()=>e.selectedSourceId&&g(e.selectedSourceId),children:(0,r.tZ)(eT.Z,{})}),(0,r.tZ)(e2.X,{placement:"bottom-start",zIndex:G.tp,open:!!t,anchorEl:t,onClose:p,sx:{minWidth:200},children:v}),(0,r.tZ)(e5.c,{open:!!i,onClose:()=>a(null),onPositive:f,confirmationText:"Are you sure you want to remove these models? The configuration data will be lost and you may have to enter it again.",positiveActionText:"Remove"})]})}function e6(e){let t=(0,eL.S5)(e.source.vId);return t?(0,r.tZ)(t.SourceSetupComponent,{sourceId:e.source.id},e.source.id):"Configuration issue: Vendor not found for Source "+e.source.id}function e7(e){var t,n;let[i,a]=o.useState(null),[l,s]=o.useState(!1),{closeLlmOptions:d,closeModelsSetup:c,openLlmOptions:u,openModelsSetup:p,showLlmOptions:h,showModelsSetup:m}=(0,K.Fe)(),{modelSources:g,llmCount:f}=(0,ei.p0)(e=>({modelSources:e.sources,llmCount:e.llms.length}),eC.X),v=null!==(n=null!=i?i:null===(t=g[g.length-1])||void 0===t?void 0:t.id)&&void 0!==n?n:null,Z=g.find(e=>e.id===v),b=g.length>1,x=!v&&!e.suspendAutoModelsSetup;o.useEffect(()=>{if(x)return(0,eI.To)(p,2e3)},[x,p]);let S=m&&!e.suspendAutoModelsSetup;return o.useEffect(()=>{let{addSource:e,sources:t}=ei.p0.getState();S&&!t.length&&e((0,eL.ii)(t))},[S]),(0,r.BX)(r.HY,{children:[m&&(0,r.BX)(ek.M,{title:(0,r.BX)(r.HY,{children:["Configure ",(0,r.tZ)("b",{children:"AI Models"})]}),startButton:b?(0,r.tZ)(ey.Z,{label:"All Services",sx:{my:"auto"},checked:l,onChange:()=>s(e=>!e)}):void 0,open:!0,onClose:c,sx:{overflow:"auto"},children:[(0,r.tZ)(e9,{selectedSourceId:v,setSelectedSourceId:a}),!!Z&&(0,r.tZ)(q.Z,{}),!!Z&&(0,r.tZ)(j.Z,{sx:{display:"grid",gap:"var(--Card-padding)"},children:(0,r.tZ)(e6,{source:Z})}),!!f&&(0,r.tZ)(q.Z,{}),!!f&&(0,r.tZ)(eq,{filterSourceId:l?null:v,onOpenLLMOptions:u,sx:{minHeight:"6rem",overflowY:"auto","--ListItem-paddingY":"0rem","--ListItem-paddingRight":"0.5rem",backgroundColor:"rgb(var(--joy-palette-neutral-lightChannel) / 20%)",borderRadius:"md","@media (max-width: 900px)":{"--ListItem-paddingLeft":"0.5rem","--ListItem-paddingRight":"0.25rem"}}}),(0,r.tZ)(q.Z,{})]}),!!h&&(0,r.tZ)(eN,{id:h,onClose:d})]})}var e8=n(8634),te=n(22556),tt=n(5677),tn=n(6687),tr=n(55416),to=n(93751),ti=n(39853),ta=n(69182),tl=n(49451),ts=n(24385),td=n(82085),tc=n(32157),tu=n(64789),tp=n(42373),th=n(75943),tm=n(42761),tg=n(32010),tf=n(39224),tv=n(44569),tZ=n(33829),tb=n(69762),tx=n(43142),tS=n(35692);function tw(){let{mayWork:e,isServerConfig:t,isClientValid:n,inCommand:o,inComposer:i,inReact:a,inPersonas:l}=(0,tS.A)(),{wssEndpoint:s,setWssEndpoint:d,pageTransform:c,setPageTransform:u,setEnableCommandBrowse:p,setEnableComposerAttach:h,setEnableReactTool:m,setEnablePersonaTool:g}=(0,tS.Q)((0,tg.N)(e=>({wssEndpoint:e.wssEndpoint,pageTransform:e.pageTransform,setPageTransform:e.setPageTransform,setWssEndpoint:e.setW
1ssEndpoint,setEnableCommandBrowse:e.setEnableCommandBrowse,setEnableComposerAttach:e.setEnableComposerAttach,setEnableReactTool:e.setEnableReactTool,setEnablePersonaTool:e.setEnablePersonaTool})));return(0,r.BX)(r.HY,{children:[(0,r.BX)(eE.ZP,{level:"body-sm",children:["Configure Browsing to enable loading links and web pages. ",(0,r.tZ)(tZ.d,{href:"https://github.com/enricoros/big-agi/blob/main/docs/config-feature-browse.md",children:"Learn more"}),"."]}),(0,r.tZ)(tb.H,{autoCompleteId:"browse-wss",label:"Puppeteer Wss",noKey:!0,value:s,onChange:d,rightLabel:(0,r.tZ)(tv.b,{required:!t}),required:!t,isError:!n&&!t,placeholder:"wss://..."}),(0,r.BX)(eD.Z,{orientation:"horizontal",sx:{justifyContent:"space-between",alignItems:"center"},children:[(0,r.tZ)(ez.E,{title:"Load pages as:"}),(0,r.BX)(e$.Z,{variant:"outlined",value:c,onChange:(e,t)=>t&&u(t),slotProps:{root:{sx:{minWidth:"140px"}},indicator:{sx:{opacity:.5}},button:{sx:{whiteSpace:"inherit"}}},children:[(0,r.tZ)(eQ.Z,{value:"text",children:"Text (default)"}),(0,r.tZ)(eQ.Z,{value:"markdown",children:"Markdown"}),(0,r.tZ)(eQ.Z,{value:"html",children:"HTML"})]})]}),(0,r.tZ)(eE.ZP,{level:"body-sm",sx:{mt:2},children:"Browsing enablement:"}),(0,r.BX)(eD.Z,{disabled:!e,children:[(0,r.tZ)(ey.Z,{size:"sm",label:"Paste URLs",checked:i,onChange:e=>h(e.target.checked)}),(0,r.tZ)(tf.Z,{children:(0,tx.s)("Load and attach when pasting a URL")})]}),(0,r.BX)(eD.Z,{disabled:!e,children:[(0,r.tZ)(ey.Z,{size:"sm",label:"/browse",checked:o,onChange:e=>p(e.target.checked)}),(0,r.tZ)(tf.Z,{children:(0,tx.s)("Use /browse to load a web page")})]}),(0,r.BX)(eD.Z,{disabled:!e,children:[(0,r.tZ)(ey.Z,{size:"sm",label:"ReAct",checked:a,onChange:e=>m(e.target.checked)}),(0,r.tZ)(tf.Z,{children:"Enables loadURL() in ReAct"})]}),(0,r.BX)(eD.Z,{disabled:!0,children:[(0,r.tZ)(ey.Z,{size:"sm",label:"Chat with Personas",checked:!1,onChange:e=>g(e.target.checked)}),(0,r.tZ)(tf.Z,{children:"Not yet available"})]})]})}var tC=n(98189),ty=n(18361),tk=n(32684),tI=n(13230),tL=n(5049);function tM(){let[e,t]=(0,tL.Vf)(),{isConfiguredServerSide:n}=(0,ty.sY)(),{voicesDropdown:o}=(0,tI.l)(!0),i=(0,tk.Bp)(e);return(0,r.BX)(r.HY,{children:[!n&&(0,r.tZ)(tb.H,{autoCompleteId:"elevenlabs-key",label:"ElevenLabs API Key",rightLabel:(0,r.tZ)(tv.b,{required:!n}),value:e,onChange:t,required:!n,isError:!i}),(0,r.BX)(eD.Z,{orientation:"horizontal",sx:{justifyContent:"space-between",alignItems:"center"},children:[(0,r.tZ)(ez.E,{title:"Assistant Voice"}),o]})]})}var tD=n(19469),tP=n(22684),tA=n(99024);function tB(){let e=(0,e1.B)().hasGoogleCustomSearch,{googleCloudApiKey:t,setGoogleCloudApiKey:n,googleCSEId:o,setGoogleCSEId:i}=(0,tA.S)(e=>({googleCloudApiKey:e.googleCloudApiKey,setGoogleCloudApiKey:e.setGoogleCloudApiKey,googleCSEId:e.googleCSEId,setGoogleCSEId:e.setGoogleCSEId}),eC.X),a=t?(0,tP.Cu)(t):e,l=o?(0,tP.sQ)(o):e;return(0,r.BX)(r.HY,{children:[(0,r.tZ)(tf.Z,{sx:{display:"block"},children:"Configure the Programmable Search Engine to enable searching the web for links."}),(0,r.BX)(eD.Z,{orientation:"horizontal",sx:{justifyContent:"space-between",alignItems:"center"},children:[(0,r.tZ)(ez.E,{title:"GCP API Key",description:(0,r.BX)(r.HY,{children:["Create one ",(0,r.tZ)(es.r,{href:"https://console.cloud.google.com/apis/credentials",noLinkStyle:!0,target:"_blank",children:"here"})]}),tooltip:'Create your Google Cloud "API Key Credential" and enter it here'}),(0,r.tZ)(eP.ZP,{variant:"outlined",placeholder:e?"...":"missing",error:!a,value:t,onChange:e=>n(e.target.value),startDecorator:(0,r.tZ)(tD.Z,{}),slotProps:{input:{sx:{width:"100%"}}},sx:{width:"100%"}})]}),(0,r.BX)(eD.Z,{orientation:"horizontal",sx:{justifyContent:"space-between",alignItems:"center"},children:[(0,r.tZ)(ez.E,{title:"Google CSE ID",description:(0,r.BX)(r.HY,{children:["Get it ",(0,r.tZ)(es.r,{href:"https://programmablesearchengine.google.com/",noLinkStyle:!0,target:"_blank",children:"here"})]}),tooltip:'Create your Google "Programmable Search Engine" and enter its ID here'}),(0,r.tZ)(eP.ZP,{variant:"outlined",placeholder:e?"...":"missing",error:!l,value:o,onChange:e=>i(e.target.value),startDecorator:(0,r.tZ)(tm.Z,{}),slotProps:{input:{sx:{width:"100%"}}},sx:{width:"100%"}})]})]})}var tE=n(39509),tT=n(42450),tR=n(58218);function tX(){let{mayWork:e,providers:t,activeProviderId:n,setActiveProviderId:i}
1=(0,ty.p7)(),a=o.useMemo(()=>{let e=[];return t.forEach(t=>{e.push({label:t.label,value:t.id,disabled:!t.configured})}),e},[t]);return(0,r.tZ)(r.HY,{children:e?(0,r.tZ)(tR.d,{title:"Text-to-Image",description:"Active Service",tooltip:"Select the service to use for text-to-image generation.",disabled:!e,options:a,value:null!=n?n:void 0,onChange:i}):(0,r.tZ)(tT.Z,{variant:"soft",children:"There are no configured services for text-to-image generation. Please configure one service, such as an OpenAI LLM service, or the Prodia service below."})})}var tz=n(60359);function tH(){let{autoSuggestDiagrams:e,autoSuggestQuestions:t,autoTitleChat:n,setAutoSuggestDiagrams:o,setAutoSuggestQuestions:i,setAutoTitleChat:a}=(0,tz.Mn)();return(0,r.BX)(r.HY,{children:[(0,r.BX)(eD.Z,{orientation:"horizontal",sx:{justifyContent:"space-between"},children:[(0,r.tZ)(ez.E,{title:"Auto Chat Title",description:n?"LLM Titling":"Manual only"}),(0,r.tZ)(eB.Z,{checked:n,onChange:e=>a(e.target.checked),endDecorator:n?"On":"Off",slotProps:{endDecorator:{sx:{minWidth:26}}}})]}),(0,r.BX)(eD.Z,{orientation:"horizontal",sx:{justifyContent:"space-between"},children:[(0,r.tZ)(ez.E,{title:"Auto Diagrams",description:e?"LLM Diagrams":"Disabled"}),(0,r.tZ)(eB.Z,{checked:e,onChange:e=>o(e.target.checked),endDecorator:e?"On":"Off",slotProps:{endDecorator:{sx:{minWidth:26}}}})]}),(0,r.BX)(eD.Z,{disabled:!0,orientation:"horizontal",sx:{justifyContent:"space-between"},children:[(0,r.tZ)(ez.E,{title:"Auto Questions",description:t?"LLM Questions":"Disabled",tooltip:(0,r.BX)(r.HY,{children:["Vote ",(0,r.tZ)(es.r,{href:"https://github.com/enricoros/big-agi/issues/228",target:"_blank",children:"#228"})]})}),(0,r.tZ)(eB.Z,{checked:t,onChange:e=>i(e.target.checked),endDecorator:t?"On":"Off",slotProps:{endDecorator:{sx:{minWidth:26}}}})]}),(0,r.BX)(eD.Z,{disabled:!0,orientation:"horizontal",sx:{justifyContent:"space-between"},children:[(0,r.tZ)(ez.E,{title:"Auto UI",description:t?"LLM User Interface":"Disabled",tooltip:(0,r.BX)(r.HY,{children:["Vote ",(0,r.tZ)(es.r,{href:"https://github.com/enricoros/big-agi/issues/227",target:"_blank",children:"#227"})]})}),(0,r.tZ)(eB.Z,{endDecorator:t?"On":"Off",slotProps:{endDecorator:{sx:{minWidth:26}}}})]})]})}var tN=n(6906),tO=n(81410),tW=n(10604),tj=n(78930);let tF=()=>{let{openModelsSetup:e}=(0,K.Fe)();return(0,r.tZ)(el.Z,{onClick:e,startDecorator:(0,r.tZ)(P.Z,{}),sx:{"--Icon-fontSize":"var(--joy-fontSize-xl2)"},children:"Models"})};function tG(){let e=(0,O.dD)(),{centerMode:t,setCenterMode:n,doubleClickToEdit:o,setDoubleClickToEdit:i,enterIsNewline:a,setEnterIsNewline:l,renderMarkdown:s,setRenderMarkdown:d,showPersonaFinder:c,setShowPersonaFinder:u,zenMode:p,setZenMode:h}=(0,tW.Z)(e=>({centerMode:e.centerMode,setCenterMode:e.setCenterMode,doubleClickToEdit:e.doubleClickToEdit,setDoubleClickToEdit:e.setDoubleClickToEdit,enterIsNewline:e.enterIsNewline,setEnterIsNewline:e.setEnterIsNewline,renderMarkdown:e.renderMarkdown,setRenderMarkdown:e.setRenderMarkdown,showPersonaFinder:e.showPersonaFinder,setShowPersonaFinder:e.setShowPersonaFinder,zenMode:e.zenMode,setZenMode:e.setZenMode}),eC.X);return(0,r.BX)(r.HY,{children:[(0,r.BX)(eD.Z,{orientation:"horizontal",sx:{justifyContent:"space-between",alignItems:"center"},children:[(0,r.tZ)(ez.E,{title:"AI Models",description:"Setup"}),(0,r.tZ)(tF,{})]}),(0,r.BX)(eD.Z,{orientation:"horizontal",sx:{justifyContent:"space-between"},children:[(0,r.tZ)(ez.E,{title:"Enter sends â",description:a?"New line":"Sends message"}),(0,r.tZ)(eB.Z,{checked:!a,onChange:e=>l(!e.target.checked),endDecorator:a?"Off":"On",slotProps:{endDecorator:{sx:{minWidth:26}}}})]}),(0,r.BX)(eD.Z,{orientation:"horizontal",sx:{justifyContent:"space-between"},children:[(0,r.tZ)(ez.E,{title:"Markdown",description:s?"Render markdown":"As text"}),(0,r.tZ)(eB.Z,{checked:s,onChange:e=>d(e.target.checked),endDecorator:s?"On":"Off",slotProps:{endDecorator:{sx:{minWidth:26}}}})]}),(0,r.BX)(eD.Z,{orientation:"horizontal",sx:{justifyContent:"space-between"},children:[(0,r.tZ)(ez.E,{title:"Edit mode",description:o?"Double click":"Three dots"}),(0,r.tZ)(eB.Z,{checked:o,onChange:e=>i(e.target.checked),endDecorator:o?"On":"Off",slotProps:{endDecorator:{sx:{minWidth:26}}}})]}
1),!1,(0,r.tZ)(tR.d,{title:"Appearance",description:"clean"===p?"Show senders":"Minimal UI",options:[{label:"Clean",value:"clean"},{label:"Zen",value:"cleaner"}],value:p,onChange:h}),(0,r.tZ)(tj.a,{}),!(0,eI.So)()&&!e&&(0,r.tZ)(tR.d,{title:"Page Size",description:"full"===t?"Full screen chat":"narrow"===t?"Narrow chat":"Wide",options:[{value:"narrow",label:(0,r.tZ)(tN.Z,{sx:{width:25,height:24,mt:-.25}})},{value:"wide",label:(0,r.tZ)(tO.Z,{sx:{width:25,height:24,mt:-.25}})},{value:"full",label:"Full"}],value:t,onChange:n})]})}var tU=n(29086),tK=n(75503),tY=JSON.parse('{"Afrikaans":"af-ZA","á ááá":"am-ET","AzÉrbaycanca":"az-AZ","বাà¦à¦²à¦¾":{"বাà¦à¦²à¦¾à¦¦à§à¦¶":"bn-BD","à¦à¦¾à¦°à¦¤":"bn-IN"},"Bahasa Indonesia":"id-ID","Bahasa Melayu":"ms-MY","Catal\xe0":"ca-ES","ÄeÅ¡tina":"cs-CZ","Dansk":"da-DK","Deutsch":"de-DE","English":{"Australia":"en-AU","Canada":"en-CA","India":"en-IN","Kenya":"en-KE","Tanzania":"en-TZ","Ghana":"en-GH","New Zealand":"en-NZ","Nigeria":"en-NG","South Africa":"en-ZA","Philippines":"en-PH","United Kingdom":"en-GB","United States":"en-US"},"Espa\xf1ol":{"Argentina":"es-AR","Bolivia":"es-BO","Chile":"es-CL","Colombia":"es-CO","Costa Rica":"es-CR","Ecuador":"es-EC","El Salvador":"es-SV","Espa\xf1a":"es-ES","Estados Unidos":"es-US","Guatemala":"es-GT","Honduras":"es-HN","M\xe9xico":"es-MX","Nicaragua":"es-NI","Panam\xe1":"es-PA","Paraguay":"es-PY","Per\xfa":"es-PE","Puerto Rico":"es-PR","Rep\xfablica Dominicana":"es-DO","Uruguay":"es-UY","Venezuela":"es-VE"},"Euskara":"eu-ES","Filipino":"fil-PH","Fran\xe7ais":"fr-FR","Basa Jawa":"jv-ID","Galego":"gl-ES","àªà«àªàª°àª¾àª¤à«":"gu-IN","Hrvatski":"hr-HR","IsiZulu":"zu-ZA","\xcdslenska":"is-IS","Italiano":{"Italia":"it-IT","Svizzera":"it-CH"},"à²à²¨à³à²¨à²¡":"kn-IN","áá¶áá¶ááááá":"km-KH","LatvieÅ¡u":"lv-LV","Lietuvių":"lt-LT","മലയാളà´":"ml-IN","मराठà¥":"mr-IN","Magyar":"hu-HU","ລາວ":"lo-LA","Nederlands":"nl-NL","नà¥à¤ªà¤¾à¤²à¥ à¤à¤¾à¤·à¤¾":"ne-NP","Norsk bokm\xe5l":"nb-NO","Polski":"pl-PL","Portugu\xeas":{"Brasil":"pt-BR","Portugal":"pt-PT"},"Rom\xe2nÄ":"ro-RO","à·à·à¶à·à¶½":"si-LK","SlovenÅ¡Äina":"sl-SI","Basa Sunda":"su-ID","SlovenÄina":"sk-SK","Suomi":"fi-FI","Svenska":"sv-SE","Kiswahili":{"Tanzania":"sw-TZ","Kenya":"sw-KE"},"á¥áá áá£áá":"ka-GE","ÕÕ¡ÕµÕ¥ÖÕ¥Õ¶":"hy-AM","தமிழà¯":{"à®à®¨à¯à®¤à®¿à®¯à®¾":"ta-IN","à®à®¿à®à¯à®à®ªà¯à®ªà¯à®°à¯":"ta-SG","à®à®²à®à¯à®à¯":"ta-LK","மலà¯à®à®¿à®¯à®¾":"ta-MY"},"à°¤à±à°²à±à°à±":"te-IN","Tiếng Viá»t":"vi-VN","T\xfcrk\xe7e":"tr-TR","Ø§ÙØ±Ø¯ÙÙ":{"پاکستاÙ":"ur-PK","بھارت":"ur-IN"},"Îλληνικά":"el-GR","бÑлгаÑÑки":"bg-BG","PÑÑÑкий":"ru-RU","СÑпÑки":"sr-RS","УкÑаÑнÑÑка":"uk-UA","íêµì´":"ko-KR","䏿":{"æ®éè¯ (ä¸å½å¤§é)":"cmn-Hans-CN","æ®éè¯ (馿¸¯)":"cmn-Hans-HK","䏿 (å°ç£)":"cmn-Hant-TW","ç²µèª (馿¸¯)":"yue-Hant-HK"},"æ¥æ¬èª":"ja-JP","हिनà¥à¤¦à¥":"hi-IN","ภาษาà¹à¸à¸¢":"th-TH"}');function t_(){let{preferredLanguage:e,setPreferredLanguage:t}=(0,tW.Z)(e=>({preferredLanguage:e.preferredLanguage,setPreferredLanguage:e.setPreferredLanguage}),eC.X),n=o.useMemo(()=>Object.entries(tY).map(e=>{let[t,n]=e;return"string"==typeof n?(0,r.tZ)(eQ.Z,{value:n,children:t},n):Object.entries(n).map(e=>{let[n,o]=e;return(0,r.tZ)(eQ.Z,{value:o,children:"".concat(t," (").concat(n,")")},o)})}),[]);return(0,r.tZ)(e$.Z,{value:e,onChange:(e,n)=>{n&&t(n)},indicator:(0,r.tZ)(tK.Z,{}),slotProps:{root:{sx:{minWidth:200}},indicator:{sx:{opacity:.5}}},children:n})}function tV(){let e=(0,O.dD)(),{autoSpeak:t,setAutoSpeak:n}=(0,tz.Mn)(),{hasVoices:o}=(0,tI.G)(),[i,a]=(0,tz.qk)();return(0,r.BX)(r.HY,{children:[(0,r.BX)(eD.Z,{orientation:"horizontal",sx:{justifyContent:"space-between",alignItems:"center"},children:[(0,r.tZ)(ez.E,{title:"Language",description:"ASR and TTS",tooltip:"Currently for Microphone input and Voice output. Microphone support varies by browser (iPhone/Safari lacks speech input). We will use the ElevenLabs MultiLanguage model if a language other than English is selected."}),(0,r.tZ)(t_,{})]}),!e&&(0,r.tZ)(tR.d,{title:"Mic Timeout",description:i<1e3?"Best for quick calls":i>
15e3?"Best for thinking":"Standard",options:[{value:"600",label:".6s"},{value:"2000",label:"2s"},{value:"15000",label:"15s"}],value:""+i,onChange:e=>e&&a(parseInt(e))}),(0,r.tZ)(tR.d,{title:"Speak Responses",description:"off"===t?"Off":"First paragraph",tooltip:o?void 0:"No voices available, please configure a voice synthesis service",disabled:!o,options:[{value:"off",label:"Off"},{value:"firstLine",label:"Start"},{value:"all",label:"Full"}],value:t,onChange:n})]})}let tq=(0,W.Z)(e8.Z)(e=>{let{theme:t}=e;return{borderRadius:t.radius.md,overflow:"hidden",["& .".concat(te.Z.button)]:{minHeight:64},["& .".concat(te.Z.indicator)]:{transition:"0.2s"},['& [aria-expanded="true"] .'.concat(te.Z.indicator)]:{transform:"rotate(45deg)"},["& .".concat(tt.Z.content,".").concat(tt.Z.expanded)]:{paddingBlock:"1rem"}}});function tJ(e){let[t,n]=o.useState(!0!==e.startCollapsed),i=!e.title&&!e.icon;return(0,r.BX)(tn.Z,{expanded:t||i,onChange:(e,t)=>n(t),sx:{"&:not(:last-child)":{borderBottomColor:"primary.softActiveBg"},"&:last-child":{borderBottom:"none"}},children:[!i&&(0,r.BX)(tr.Z,{color:"primary",variant:t?"plain":"soft",indicator:(0,r.tZ)(e0.Z,{}),children:[!!e.icon&&(0,r.tZ)(to.Z,{color:"primary",variant:t?"soft":"plain",children:e.icon}),(0,r.tZ)(ti.Z,{children:e.title})]}),(0,r.tZ)(ta.Z,{children:(0,r.tZ)(tl.Z,{sx:{gap:"calc(var(--Card-padding) / 2)",border:"none"},children:e.children})})]})}let tQ={fontFamily:"body",flex:1,p:0,m:0};function t$(e){let t=(0,O.dD)();return(0,r.BX)(ek.M,{title:"Preferences",strongerTitle:!0,open:e.open,onClose:e.onClose,startButton:t?void 0:(0,r.tZ)(el.Z,{variant:"soft",onClick:e.onOpenShortcuts,children:"\uD83D\uDC49 See Shortcuts"}),children:[(0,r.tZ)(q.Z,{}),(0,r.BX)(ts.Z,{"aria-label":"Settings tabbed menu",defaultValue:e.tabIndex,children:[(0,r.BX)(td.Z,{disableUnderline:!0,sx:{bgcolor:"primary.softHoverBg",mb:2,p:.5,borderRadius:"md",fontSize:"md",fontWeight:"md",gap:1,overflow:"hidden",["& .".concat(tc.Z.root,'[aria-selected="true"]')]:{borderRadius:"sm",bgcolor:"background.popup",boxShadow:"sm",fontWeight:"lg"}},children:[(0,r.tZ)(tu.Z,{disableIndicator:!0,value:K.Yb.Chat,sx:tQ,children:"Chat"}),(0,r.tZ)(tu.Z,{disableIndicator:!0,value:K.Yb.Voice,sx:tQ,children:"Voice"}),(0,r.tZ)(tu.Z,{disableIndicator:!0,value:K.Yb.Draw,sx:tQ,children:"Draw"}),(0,r.tZ)(tu.Z,{disableIndicator:!0,value:K.Yb.Tools,sx:tQ,children:"Tools"})]}),(0,r.tZ)(tp.Z,{value:K.Yb.Chat,variant:"outlined",sx:{p:"var(--Tabs-gap)",borderRadius:"md"},children:(0,r.BX)(tq,{children:[(0,r.tZ)(tJ,{children:(0,r.tZ)(tG,{})}),(0,r.tZ)(tJ,{icon:"\uD83E\uDDE0",title:"Chat AI",startCollapsed:!0,children:(0,r.tZ)(tH,{})}),(0,r.tZ)(tJ,{icon:(0,r.tZ)(th.Z,{}),title:"Labs",startCollapsed:!0,children:(0,r.tZ)(tU.D,{})})]})}),(0,r.tZ)(tp.Z,{value:K.Yb.Voice,variant:"outlined",sx:{p:"var(--Tabs-gap)",borderRadius:"md"},children:(0,r.BX)(tq,{children:[(0,r.tZ)(tJ,{icon:"\uD83C\uDF99ï¸",title:"Voice settings",children:(0,r.tZ)(tV,{})}),(0,r.tZ)(tJ,{icon:"\uD83D\uDCE2",title:"ElevenLabs API",children:(0,r.tZ)(tM,{})})]})}),(0,r.tZ)(tp.Z,{value:K.Yb.Draw,variant:"outlined",sx:{p:"var(--Tabs-gap)",borderRadius:"md"},children:(0,r.BX)(tq,{children:[(0,r.tZ)(tJ,{children:(0,r.tZ)(tX,{})}),(0,r.tZ)(tJ,{icon:"\uD83D\uDD8Dï¸ï¸",title:"OpenAI DALL\xb7E",startCollapsed:!0,children:(0,r.tZ)(tC.Y,{})}),(0,r.tZ)(tJ,{icon:"\uD83D\uDD8Dï¸ï¸",title:"Prodia API",startCollapsed:!0,children:(0,r.tZ)(tE.D,{noSkipKey:!0})})]})}),(0,r.tZ)(tp.Z,{value:K.Yb.Tools,variant:"outlined",sx:{p:"var(--Tabs-gap)",borderRadius:"md"},children:(0,r.BX)(tq,{children:[(0,r.tZ)(tJ,{icon:(0,r.tZ)(tm.Z,{}),title:"Browsing",children:(0,r.tZ)(tw,{})}),(0,r.tZ)(tJ,{icon:(0,r.tZ)(tm.Z,{}),title:"Google Search API",startCollapsed:!0,children:(0,r.tZ)(tB,{})})]})})]}),(0,r.tZ)(q.Z,{})]})}var t0=n(91811);let t1=(0,tx.s)("\n\n| Shortcut | Description |\n|------------------|-----------------------------------------|\n| **Edit** | |\n| Shift + Enter | Newline |\n| Alt + Enter | Append (no response) |\n| Ctrl + Shift + B | **Beam** last message |\n| Ctrl + Shift + G | Re**generate** last message |\n| Ctrl + Shift + V | Attach clipboard (better than Ctrl + V) |\n| Ctrl + M | Microphone (voice typing) |\n| **Chats** | |\n| Ctrl + O | Open Chat ... |\n| Ctrl + S | Save Chat ... |\n| Ctrl + Shift + N | **New** chat |\n| Ctrl + Shift + X | **Reset** chat |\n| Ctrl + Shift + D | **Delete** chat |\n| Ctrl + [ | **Previous** chat (in history) |\n| Ctrl + ] | **Next** chat (in history) |\n| **Settings** | |\n| Ctrl + , | âï¸ Preferences |\n| Ctrl + Shift + M | \uD83E\uDDE0 Models |\n| Ctrl + Shift + O | \uD83D\uDCAC Options (current Chat Model) |\n| Ctrl + Shift + + | Increase Text Size |\n| Ctrl + Shift + - | Decrease Text Size |\n| Ctrl + Shift + / | Shortcuts |\n\n").trim();function t2(e){let t=(0,O.dD)();return(0,r.tZ)(ek.M,{open:!0,title:"Desktop Shortcuts",onClose:e.onClose,children:(0,r.tZ)(t0.i,{text:t1,fromRole:"assistant",contentScaling:"sm",fitScreen:t,renderTextAsMarkdown:!0})})}function t5(e){let{showPreferencesTab:t,closePreferences:n,showShortcuts:o,openShortcuts:i,closeShortcuts:a}=(0,K.Fe)();return(0,r.BX)(r.HY,{children:[(0,r.tZ)(t$,{open:!!t,tabIndex:t,onClose:n,onOpenShortcuts:i}),(0,r.tZ)(e7,{suspendAutoModelsSetup:e.suspendAutoModelsSetup}),o&&(0,r.tZ)(t2,{onClose:a})]})}var t4=n(7428),t3=n(95109),t9=n(29613),t6=n(21023),t7=n(99078),t8=n(46646),ne=n(57976),nt=n(9370);function nn(e){return(0,r.BX)(eW.Z,{variant:e.variant,sx:{"--ListItem-minHeight":"var(--AGI-Nav-width)",gap:1},children:[!e.hideApps&&(0,r.tZ)(eA.Z,{component:"nav",variant:e.variant,sx:{"--ButtonGroup-separatorSize":0,"--ButtonGroup-connected":0,gap:1},children:X.apps.filter(e=>H(e,!0,void 0)).map(t=>{let n=t===e.currentApp;return z(t)?null:(0,r.tZ)(J.Z,{disableInteractive:!0,enterDelay:600,title:t.name,children:(0,r.tZ)(el.Z,{size:"sm",variant:n?"soft":"solid",onClick:()=>a().push(t.landingRoute||t.route),children:n&&t.name.length<=4?t.name:(0,r.tZ)(t.icon,{})},"app-"+t.name)},"n-m-"+t.route.slice(1))})}),!e.hideApps&&(0,r.tZ)(q.Z,{orientation:"vertical",sx:{my:1.25}}),!e.hideSocial&&(0,r.tZ)(eA.Z,{variant:e.variant,size:"sm",sx:{"--ButtonGroup-separatorSize":0,"--ButtonGroup-connected":0,ml:"auto",gap:.5},children:X.links.map(e=>(0,r.tZ)(em,{text:e.name,icon:e.icon,link:e.href},"love-"+e.name))})]})}let nr=e=>{var t,n;return(0,r.BX)(j.Z,{sx:{display:"flex",alignItems:"center",gap:{xs:1,md:2}},children:[(0,r.tZ)(es.r,{href:nt.dK,children:(0,r.tZ)(ea.S,{inverted:!0,sx:{width:32,height:32,color:"white"}})}),(0,r.tZ)(eE.ZP,{level:"title-md",children:(null===(t=e.currentApp)||void 0===t?void 0:t.barTitle)||(null===(n=e.currentApp)||void 0===n?void 0:n.name)||B.H.Title.Base})]})};function no(e){let{openPreferencesTab:t}=(0,K.Fe)(),{mode:n,setMode:o}=(0,t3.tv)();return(0,r.tZ)(r.HY,{children:(0,r.BX)(et.Z,{onClick:n=>{n.stopPropagation(),t(),e.onClose()},children:[(0,r.tZ)(en.Z,{children:(0,r.tZ)(A.Z,{})}),"Preferences",(0,r.tZ)(ec.ZP,{size:"sm",variant:"soft",onClick:e=>{e.stopPropagation(),o("dark"===n?"light":"dark")},sx:{ml:"auto",my:"-0.25rem"},children:"dark"!==n?(0,r.tZ)(t7.Z,{}):(0,r.tZ)(t8.Z,{})})]})})}function ni(e){var t;let n=o.useRef(null),{appBarItems:i,appDrawerContent:a,appMenuItems:l}=(0,K.Fe)(),{openDrawer:s,isPageMenuOpen:d,openPageMenu:c,closePageMenu:u}=(0,U.w)(),p=o.useMemo(()=>(0,r.tZ)(no,{onClose:u}),[u]),h=o.useCallback(e=>{e.preventDefault(),c()},[c]);return(null===(t=e.currentApp)||void 0===t?void 0:t.hideBar)&&!e.isMobile?null:(0,r.BX)(r.HY,{children:[(0,r.BX)(eZ,{component:e.component,direction:"horizontal",sx:e.sx,children:[(!!e.isMobile||!N(e.currentApp))&&(0,r.tZ)(ef,{children:a&&N(e.currentApp)?(0,r.tZ)(ec.ZP,{disabled:!a,onClick:s,children:(0,r.tZ)(er.Z,{})}):(0,r.tZ)(ec.ZP,{component:es.r,href:nt.dK,noLinkStyle:!0,children:(0,r.tZ)(t6.Z,{})})}),(0,r.tZ)(j.Z,{sx:{flexGrow:1,minHeight:"var(--Bar)",display:"flex",flexFlow:"row wrap",justifyContent:"center",alignItems:"center",my:"auto",gap:e.isMobile?0:1,WebkitAppRegion:"drag","& > *":{WebkitAppRegion:"no-drag"}},children:i||(0,r.tZ)(nr,{currentApp:e.currentApp})}),(0,r.tZ)(ef,{children:(0,r.tZ)(ec.ZP,{ref:n,disabled:!n,onClick:c,onContextMenu:h,children:(0,r.tZ)(ne.Z,{})})})]}),(0,r.BX)(e2.X,{dense:!0,maxHeightGapPx:80,noBottomPadding:e.isMobile,placement:"bottom-end",open:d&&!!n.current,anchorEl:n.current,onClose:u,sx:{minWidth:280},children:[p,!!l&&(0,r.tZ)(t9.Z,{}),!!l&&(0,r.tZ)(j.Z,{sx:{overflowY:"auto"},children:l}),!!e.isMobile&&!!l&&(0,r.tZ)(t9.Z,{sx:{mb:0}}),!!e.isMobile&&(0,r.tZ)(nn,{variant:"solid",currentApp:e.currentApp})]})]})}let na={backgroundColor:G.Lx,height:"100dvh",display:"flex",flexDirection:"column"},nl={zIndex:G.Te},ns=e=>(0,r.BX)(j.Z,{component:e.component,sx:na,children:[(0,r.tZ)(ni,{component:"header",currentApp:e.currentApp,isMobile:e.isMobile,sx:nl}),e.children]});
1function nd(e){let{isDrawerOpen:t}=(0,U.w)(),n=(0,tW.Z)(t=>{var n;return(0,eI.So)()||e.isMobile||(null===(n=e.currentApp)||void 0===n?void 0:n.fullWidth)?"full":t.centerMode});return e.isMobile?(0,r.tZ)(ns,{component:e.component,isMobile:!0,currentApp:e.currentApp,children:e.children}):(0,r.tZ)(j.Z,{sx:{flex:"1 1 0px",overflow:"hidden",marginLeft:t?0:"calc(-1 * var(--AGI-Desktop-Drawer-width))",transition:"margin-left 0.42s cubic-bezier(.17,.84,.44,1)",willChange:"margin-left"},children:(0,r.tZ)(t4.Z,{disableGutters:!0,maxWidth:"full"!==n&&("narrow"===n?"md":"xl"),sx:{boxShadow:{xs:"none",md:"narrow"===n?"0px 0px 4px 0 rgba(50 56 62 / 0.12)":"none",xl:"full"!==n?"0px 0px 4px 0 rgba(50 56 62 / 0.12)":"none"}},children:(0,r.tZ)(ns,{component:e.component,currentApp:e.currentApp,children:e.children})})})}function nc(e){let{route:t}=(0,i.useRouter)(),n=(0,O.dD)(),o=X.apps.find(e=>e.route===t);return(0,r.BX)(K._h,{children:[(0,r.tZ)(U.J,{children:n?(0,r.BX)(r.HY,{children:[(0,r.tZ)(nd,{component:"main",isMobile:!0,currentApp:o,children:e.children}),(0,r.tZ)(ew,{component:"aside",currentApp:o})]}):(0,r.BX)(l.eh,{direction:"horizontal",id:"root-layout",children:[N(o)&&(0,r.tZ)(ex,{component:"nav",currentApp:o}),(0,r.tZ)(V,{component:"aside",currentApp:o}),(0,r.tZ)(nd,{component:"main",currentApp:o,children:e.children})]})}),(0,r.tZ)(t5,{suspendAutoModelsSetup:e.suspendAutoModelsSetup})]})}function nu(e){return(0,r.tZ)(r.HY,{children:(0,r.tZ)(t4.Z,{disableGutters:!0,children:(0,r.tZ)(j.Z,{sx:{backgroundColor:G.Lx,display:"flex",flexDirection:"column",minHeight:"100dvh"},children:e.children})})})}function np(e,t){return"optima"===e.type?(0,r.tZ)(nc,{...e,children:t}):"plain"===e.type?(0,r.tZ)(nu,{...e,children:t}):(console.error("No layout specified for this top-level page"),(0,r.tZ)(r.HY,{children:t}))}},10604:function(e,t,n){n.d(t,{Z:function(){return l},e:function(){return s}});var r=n(67294),o=n(73445),i=n(782),a=n(16903);let l=(0,o.Ue)()((0,i.tJ)(e=>({preferredLanguage:a.hV,setPreferredLanguage:t=>e({preferredLanguage:t}),centerMode:"wide",setCenterMode:t=>e({centerMode:t}),contentScaling:"md",setContentScaling:t=>e({contentScaling:t}),increaseContentScaling:()=>e(e=>"md"===e.contentScaling?e:{contentScaling:"xs"===e.contentScaling?"sm":"md"}),decreaseContentScaling:()=>e(e=>"xs"===e.contentScaling?e:{contentScaling:"md"===e.contentScaling?"sm":"xs"}),doubleClickToEdit:!0,setDoubleClickToEdit:t=>e({doubleClickToEdit:t}),enterIsNewline:!1,setEnterIsNewline:t=>e({enterIsNewline:t}),renderMarkdown:!0,setRenderMarkdown:t=>e({renderMarkdown:t}),renderCodeSoftWrap:!1,setRenderCodeSoftWrap:t=>e({renderCodeSoftWrap:t}),showPersonaFinder:!1,setShowPersonaFinder:t=>e({showPersonaFinder:t}),zenMode:"clean",setZenMode:t=>e({zenMode:t}),actionCounters:{},incrementActionCounter:t=>e(e=>({actionCounters:{...e.actionCounters,[t]:(e.actionCounters[t]||0)+1}})),resetActionCounter:t=>e(e=>({actionCounters:{...e.actionCounters,[t]:0}}))}),{name:"app-ui",version:1,migrate:(e,t)=>
1(e&&0===t&&(e.enterIsNewline=!1===e.enterToSend),e)}));function s(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return{novel:l(t=>t.actionCounters[e]||0)<t,touch:r.useCallback(()=>l.getState().incrementActionCounter(e),[e]),forget:r.useCallback(()=>l.getState().resetActionCounter(e),[e])}}},70800:function(e,t,n){n.d(t,{Z:function(){return i},z:function(){return a}});var r=n(73445),o=n(782);let i=(0,r.Ue)()((0,o.tJ)(e=>({labsAttachScreenCapture:!1,setLabsAttachScreenCapture:t=>e({labsAttachScreenCapture:t}),labsCameraDesktop:!1,setLabsCameraDesktop:t=>e({labsCameraDesktop:t}),labsChatBarAlt:!1,setLabsChatBarAlt:t=>e({labsChatBarAlt:t}),labsHighPerformance:!1,setLabsHighPerformance:t=>e({labsHighPerformance:t}),labsShowCost:!0,setLabsShowCost:t=>e({labsShowCost:t})}),{name:"app-ux-labs"}));function a(){return i.getState().labsHighPerformance}},49856:function(e,t,n){n.d(t,{Cz:function(){return M},H$:function(){return D},Iq:function(){return C},KC:function(){return I},Kz:function(){return w},MF:function(){return S},P2:function(){return k},dK:function(){return L},j0:function(){return Z},kQ:function(){return b},qo:function(){return x},uu:function(){return y}});var r=n(82729),o=n(70917);function i(){let e=(0,r._)(["\n 100%, 0% {\n color: rgb(219, 255, 77);\n }\n 25% {\n color: rgb(255, 255, 128);\n }\n 50% {\n color: rgba(128, 255, 153);\n }\n 75% {\n color: rgb(255, 204, 77);\n }"]);return i=function(){return e},e}function a(){let e=(0,r._)(["\n 100%, 0% {\n color: rgb(85, 140, 47); // A rich, dark green\n }\n 25% {\n color: rgb(75, 115, 35); // A slightly desaturated green for contrast\n }\n 50% {\n color: rgba(65, 155, 55); // A brighter, more saturated green with slight transparency\n }\n 75% {\n color: rgb(95, 130, 40); // A blend between the first and third colors for a smooth transition\n }"]);return a=function(){return e},e}function l(){let e=(0,r._)(["\n 100%, 0% {\n color: rgb(102, 0, 51);\n }\n 25% {\n color: rgb(76, 0, 76);\n }\n 50% {\n color: rgb(63, 0, 128);\n }\n 75% {\n color: rgb(0, 0, 128);\n }"]);return l=function(){return e},e}function s(){let e=(0,r._)(["\n 0%, 100% {\n color: #636B74; /* Neutral main color (500) */\n }\n 25% {\n color: #12467B; /* Primary darker shade (700) */\n }\n 50% {\n color: #0B6BCB; /* Primary main color (500) */\n }\n 75% {\n color: #083e75; /* Primary lighter shade (300) */\n }"]);return s=function(){return e},e}function d(){let e=(0,r._)(["\n 100%, 0% {\n color: rgb(255, 0, 0);\n }\n 8% {\n color: rgb(204, 102, 0);\n }\n 16% {\n color: rgb(128, 128, 0);\n }\n 25% {\n color: rgb(77, 153, 0);\n }\n 33% {\n color: rgb(0, 179, 0);\n }\n 41% {\n color: rgb(0, 153, 82);\n }\n 50% {\n color: rgb(0, 128, 128);\n }\n 58% {\n color: rgb(0, 102, 204);\n }\n 66% {\n color: rgb(0, 0, 255);\n }\n 75% {\n color: rgb(127, 0, 255);\n }\n 83% {\n color: rgb(153, 0, 153);\n }\n 91% {\n color: rgb(204, 0, 102);\n }"]);return d=function(){return e},e}function c(){let e=(0,r._)(["\n 100%, 0% {\n background-color: rgb(102, 0, 51);\n }\n 25% {\n background-color: rgb(76, 0, 76);\n }\n 50% {\n background-color: rgb(63, 0, 128);\n }\n 75% {\n background-color: rgb(0, 0, 128);\n }"]);return c=function(){return e},e}function u(){let e=(0,r._)(["\n from {\n opacity: 0;\n transform: translateY(8px)\n }\n to {\n opacity: 1;\n transform: translateY(0)\n }\n"]);return u=function(){return e},e}function p(){let e=(0,r._)(["\n 0% {\n //opacity: 0;\n //transform: translateY(8px);\n scale: 0.98;\n //rotate: -5deg;\n }\n 100% {\n //opacity: 1;\n //transform: translateY(0);\n scale: 1;\n //rotate: 0;\n }"]);return p=function(){return e},e}function h(){let e=(0,r._)(["\n 0%, 100% {\n transform: scale(1);\n }\n 50% {\n transform: scale(1.2);\n }"]);return h=function(){return e},e}function m(){let e=(0,r._)(["\n 100%, 0% {\n box-shadow: 1px 1px 0 white, 2px 2px 12px rgb(183, 255, 0
1);\n }\n 25% {\n box-shadow: 1px 1px 0 white, 2px 2px 12px rgb(255, 251, 0);\n //scale: 1.2;\n }\n 50% {\n box-shadow: 1px 1px 0 white, 2px 2px 12px rgba(0, 255, 81);\n //scale: 0.8;\n }\n 75% {\n box-shadow: 1px 1px 0 white, 2px 2px 12px rgb(255, 153, 0);\n }"]);return m=function(){return e},e}function g(){let e=(0,r._)(["\n 100%, 0% {\n box-shadow: 2px 2px 12px rgb(102, 0, 51);\n }\n 25% {\n box-shadow: 2px 2px 12px rgb(76, 0, 76);\n }\n 50% {\n box-shadow: 2px 2px 12px rgb(63, 0, 128);\n }\n 75% {\n box-shadow: 2px 2px 12px rgb(0, 0, 128);\n }"]);return g=function(){return e},e}function f(){let e=(0,r._)(["\n 100%, 0% {\n box-shadow: 2px 2px 12px -6px rgb(183, 255, 0);\n }\n 25% {\n box-shadow: 2px 2px 12px -6px rgb(255, 251, 0);\n }\n 50% {\n box-shadow: 2px 2px 12px -6px rgba(0, 255, 81);\n }\n 75% {\n box-shadow: 2px 2px 12px -6px rgb(255, 153, 0);\n }"]);return f=function(){return e},e}function v(){let e=(0,r._)(["\n 100%, 0% {\n text-shadow: 2px 2px 0 rgba(183, 255, 0, 0.5);\n }\n 25% {\n text-shadow: 2px 2px 0 rgba(255, 251, 0, 0.5);\n }\n 50% {\n text-shadow: 2px 2px 0 rgba(0, 255, 81, 0.5);\n }\n 75% {\n text-shadow: 2px 2px 0 rgba(255, 153, 0, 0.5);\n }"]);return v=function(){return e},e}let Z=(0,o.F4)(i()),b=(0,o.F4)(a()),x=(0,o.F4)(l()),S=(0,o.F4)(s()),w=(0,o.F4)(d()),C=(0,o.F4)(c()),y=(0,o.F4)(u()),k=(0,o.F4)(p()),I=(0,o.F4)(h()),L=(0,o.F4)(m());(0,o.F4)(g());let M=(0,o.F4)(f()),D=(0,o.F4)(v())},21705:function(e,t,n){n.d(t,{Tq:function(){return i},wu:function(){return o},ys:function(){return a}});var r=n(67294);function o(e){new Audio(e).play().catch(t=>console.error("Error playing audio:",e,t))}async function i(e){let t=new AudioContext,n=t.createBufferSource();n.buffer=await t.decodeAudioData(e),n.connect(t.destination),n.start()}function a(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;r.useEffect(()=>{if(!e)return;let r=null,i=setTimeout(()=>{let t=()=>o(e);t(),r=n>0?setInterval(t,n):null},t);return()=>{clearTimeout(i),r&&clearInterval(r)}},[t,n,e])}},32167:function(e,t,n){n.d(t,{St:function(){return a},vQ:function(){return i},vR:function(){return l}});var r=n(84836),o=n(16903);function i(e,t){var n;if(o.jU){if(!(null===(n=window.navigator.clipboard)||void 0===n?void 0:n.writeText)){alert("Clipboard access is blocked. Please enable it in your browser settings.");return}window.navigator.clipboard.writeText(e).then(()=>
1{(0,r.Wp)({key:"copy-to-clipboard",message:"".concat(t," copied to clipboard"),type:"success",closeButton:!1,overrides:{autoHideDuration:1400}})}).catch(e=>{console.error("Failed to copy message: ",e)})}}let a=!o.vU;async function l(){var e;if(!o.jU||!(null===(e=window.navigator.clipboard)||void 0===e?void 0:e.read))return[];try{return await window.navigator.clipboard.read()}catch(e){return console.warn("Failed to read clipboard: ",e),null}}},93820:function(e,t,n){n.d(t,{K:function(){return r}});function r(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=new Date,n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0"),i=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0"),l=String(t.getSeconds()).padStart(2,"0");return"".concat(n,"-").concat(r,"-").concat(o,"-").concat(i).concat(a).concat(e?l:"")}},91811:function(e,t,n){n.d(t,{i:function(){return k},W:function(){return C}});var r=n(35944),o=n(67294),i=n(96402),a=n(46569),l=n(40911),s=n(2549),d=n(47556),c=n(60181),u=n(23508),p=n(49235),h=n(38733),m=n(60614),g=n(40231),f=n(22958),v=n(89639),Z=n(9876),b=n(34924);let x=e=>{let t=(0,b.F)(e.textBlock.content);return(0,r.tZ)(l.ZP,{sx:{mx:1.5,alignItems:"baseline",overflowWrap:"anywhere",whiteSpace:"break-spaces",...e.sx},children:t.map((e,t)=>(0,r.tZ)(o.Fragment,{children:"cmd"===e.type?(0,r.BX)(r.HY,{children:[(0,r.tZ)(Z.Z,{component:"span",size:"md",variant:"solid",color:e.isError?"danger":"neutral",sx:{mr:1},children:e.command}),(0,r.tZ)("span",{children:e.params})]}):(0,r.tZ)("span",{children:e.value})},t))})};var S=n(37963);let w={my:"auto",lineHeight:p.rt},C={...w,flexGrow:1},y={...w,flexGrow:0,overflowX:"auto","& *::selection":{backgroundColor:"primary.solidBg",color:"primary.solidColor"}},k=o.forwardRef((e,t)=>{let[n,Z]=o.useState(!1),b=o.useRef([]),{text:w,errorMessage:C,renderTextDiff:k,wasUserEdited:I=!1}=e,L="assistant"===e.fromRole,M="system"===e.fromRole,D="user"===e.fromRole,{text:P,isTextCollapsed:A}=o.useMemo(()=>{if(D&&!n){let e=w.split("\n");if(e.length>7)return{text:e.slice(0,7).join("\n"),isTextCollapsed:!0}}return{text:w,isTextCollapsed:!1}},[n,D,w]),B=o.useCallback(()=>{Z(!1)},[]),E=o.useCallback(()=>{Z(!0)},[]),T=o.useMemo(()=>{var t,n,r,o,i,a;return{my:e.specialDiagramMode?0:null!==(o=null===(t=p.xT[e.contentScaling])||void 0===t?void 0:t.blockCodeMarginY)&&void 0!==o?o:0,backgroundColor:e.specialDiagramMode?"background.surface":L?"neutral.plainHoverBg":"primary.plainActiveBg",boxShadow:e.specialDiagramMode?void 0:"inset 2px 0px 5px -4px var(--joy-palette-background-backdrop)",borderRadius:"sm",fontFamily:"code",fontSize:null!==(i=null===(n=p.xT[e.contentScaling])||void 0===n?void 0:n.blockCodeFontSize)&&void 0!==i?i:"0.875rem",fontWeight:"md",fontVariantLigatures:"none",lineHeight:null!==(a=null===(r=p.xT[e.contentScaling])||void 0===r?void 0:r.blockLineHeight)&&void 0!==a?a:1.75}},[L,e.contentScaling,e.specialDiagramMode]),R=o.useMemo(()=>{var t,n,r,o,i,a;return{fontSize:null!==(o=null===(t=p.xT[e.contentScaling])||void 0===t?void 0:t.blockFontSize)&&void 0!==o?o:void 0,lineHeight:null!==(i=null===(n=p.xT[e.contentScaling])||void 0===n?void 0:n.blockLineHeight)&&void 0!==i?i:1.75,marginBottom:null!==(a=null===(r=p.xT[e.contentScaling])||void 0===r?void 0:r.blockImageGap)&&void 0!==a?a:1.5}},[e.contentScaling]),X=o.useMemo(()=>{var t,n,r,o;return{fontSize:null!==(r=null===(t=p.xT[e.contentScaling])||void 0===t?void 0:t.blockFontSize)&&void 0!==r?r:void 0,lineHeight:null!==(o=null===(n=p.xT[e.contentScaling])||void 0===n?void 0:n.blockLineHeight)&&void 0!==o?o:1.75}},[e.contentScaling]),z=o.useMemo(()=>{let t=C?[]:function(e,t,n){if(t)return[{type:"text",content:e}];if(n&&n.length>=1)return[{type:"diff",textDiffs:n}];if((0,g.Do)(e))return[{type:"html",html:e}];let r=(0,f.id)(e);if(r)return r;let o=(0,f.$R)(e);if(o)return o;let i={codeBlock:/`{3,}([\S\x20]+)?\n([\s\S]*?)(`{3,}\n?|$)/g,htmlCodeBlock:/<!DOCTYPE html>([\s\S]*?)<\/html>/g,svgBlock:/<svg (xmlns|width|viewBox)=([\s\S]*?)<\/svg>/g},a=[],l=0;for(;;){let t=null,n=null;for(let r in i){let o=i[r];o.lastIndex=l;let a=o.exec(e);a&&(null===t||a.index<t.index)&&(t=a,n=r)}if(null===t)break;switch(t.index>l&&a.push({type:"text",content:e.slice(l,t.index)}),n){case"codeBlock":let r=(t[1]||"").trim(),o=t[2].trim(),s=t[3];a.push({type:"code",blockTitle:r,blockCode:o,complete:s.startsWith("```")});break;case"htmlCodeBlock":let d="<!DOCTYPE html>".concat(t[1],"</html>");a.push({type:"code",blockTitle:"html",blockCode:d,complete:!0});break;case"svgBlock":a.push({type:"code",blockTitle:"svg",blockCode:t[0],complete:!0})}l=t.index+t[0].length}return l<e.length&&a.push({type:"text",content:e.slice(l)}),a}
1(P,M,k),n=[];for(let e=0;e<t.length;e++){let r=t[e],o=b.current[e];if(o&&function(e,t){if(e.type!==t.type)return!1;switch(e.type){case"code":return e.blockTitle===t.blockTitle&&e.blockCode===t.blockCode&&e.complete===t.complete;case"diff":return!1;case"html":return e.html===t.html;case"image":return e.url===t.url&&e.alt===t.alt;case"text":return e.content===t.content}}(o,r))n.push(o);else{n.push(...t.slice(e));break}}return b.current=n,e.specialDiagramMode?n.filter(e=>"code"===e.type||1===n.length):n},[C,M,e.specialDiagramMode,k,P]);return(0,r.BX)(a.Z,{ref:t,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,sx:y,children:[!!e.showDate&&(0,r.tZ)(l.ZP,{level:"body-sm",sx:{mx:1.5,textAlign:L?"left":"right"},children:(0,r.tZ)(i.Z,{date:e.showDate})}),M&&I&&(0,r.tZ)(l.ZP,{level:"body-sm",color:"warning",sx:{mt:1,mx:1.5},children:"modified by user - auto-update disabled"}),C?(0,r.tZ)(s.Z,{title:(0,r.tZ)(l.ZP,{sx:{maxWidth:800},children:P}),variant:"soft",children:(0,r.tZ)(h.b,{error:C})}):z.map((t,n)=>{let o=e.optiAllowMemo&&n!==z.length-1,i=o?m.xG:m.x$,a=o?v.I:v.o;return"html"===t.type?(0,r.tZ)(g.o1,{htmlBlock:t,sx:T},"html-"+n):"code"===t.type?(0,r.tZ)(i,{codeBlock:t,fitScreen:e.fitScreen,initialShowHTML:e.showUnsafeHtml,noCopyButton:e.specialDiagramMode,optimizeLightweight:!o,sx:T},"code-"+n):"image"===t.type?(0,r.tZ)(f.p2,{imageBlock:t,onRunAgain:e.isBottom?e.onImageRegenerate:void 0,sx:R},"image-"+n):"diff"===t.type?(0,r.tZ)(S.Z,{diffBlock:t,sx:X},"text-diff-"+n):!e.renderTextAsMarkdown||M||D&&t.content.startsWith("/")?(0,r.tZ)(x,{textBlock:t,sx:X},"text-"+n):(0,r.tZ)(a,{textBlock:t,sx:X},"text-md-"+n)}),A?(0,r.tZ)(a.Z,{sx:{textAlign:"right"},children:(0,r.tZ)(d.Z,{variant:"soft",size:"sm",onClick:E,startDecorator:(0,r.tZ)(u.Z,{}),sx:{minWidth:120},children:"Expand"})}):n&&(0,r.tZ)(a.Z,{sx:{textAlign:"right"},children:(0,r.tZ)(d.Z,{variant:"soft",size:"sm",onClick:B,startDecorator:(0,r.tZ)(c.Z,{}),sx:{minWidth:120},children:"Collapse"})})]})});k.displayName="BlocksRenderer"},40231:function(e,t,n){n.d(t,{Do:function(){return h},o1:function(){return g},uw:function(){return m}});var r=n(35944),o=n(67294),i=n(46569),a=n(40911),l=n(47556),s=n(2549),d=n(41899),c=n(14210),u=n(32167),p=n(60614);function h(e){return e.startsWith("<!DOCTYPE html")||e.startsWith("<head>\n")}let m=e=>{let t=o.useRef(null);return o.useEffect(()=>{if(t.current){var n;let r=null===(n=t.current.contentWindow)||void 0===n?void 0:n.document;r&&(r.open(),r.write(e.htmlString),r.close())}},[e.htmlString]),(0,r.tZ)("iframe",{ref:t,style:{flexGrow:1,width:"100%",height:"50svh",border:"none",boxSizing:"border-box"},title:"HTML content"})};function g(e){let[t,n]=o.useState(!1),h=e.sx||{};for(let e in h)e.startsWith("font")&&delete h[e];return(0,r.tZ)(i.Z,{sx:{position:"relative"},children:(0,r.BX)(i.Z,{sx:{minWidth:{sm:"480px",md:"750px",lg:"950px",xl:"1200px"},mx:0,p:1.5,display:"block",overflowX:"auto","&:hover > .overlay-buttons":{opacity:1},...h},children:[t?(0,r.tZ)(m,{htmlString:e.htmlBlock.html}):(0,r.BX)(i.Z,{children:[(0,r.BX)(a.ZP,{children:[(0,r.tZ)("b",{children:"CAUTION"})," - The content you are about to access is an HTML page. It is possible that an unauthorized entity is monitoring this connection and has generated this content. Please exercise caution and do not trust the contents blindly. Be aware that proceeding may pose potential risks. Click the button to view the content, if you wish to proceed."]}),(0,r.BX)(i.Z,{sx:{display:"flex",gap:1,justifyContent:"flex-end",mt:2},children:[(0,r.tZ)(l.Z,{variant:"plain",color:"neutral",onClick:()=>n(!1),children:"Ignore"}),(0,r.tZ)(l.Z,{variant:"solid",color:"danger",onClick:()=>n(!0),children:"Show Web Page"})]})]}),(0,r.BX)(i.Z,{className:"overlay-buttons",sx:{...p.fp,p:1.5},children:[(0,r.tZ)(s.Z,{title:t?"Hide":"Show Web Page",variant:"solid",children:(0,r.tZ)(p.EE,{variant:t?"solid":"outlined",color:"danger",onClick:()=>n(!t),children:(0,r.tZ)(c.Z,{})})}),(0,r.tZ)(s.Z,{title:"Copy Code",variant:"solid",children:(0,r.tZ)(p.EE,{variant:"outlined",onClick:t=>{t.stopPropagation(),(0,u.vQ)(e.htmlBlock.html,"HTML")},children:(0,r.tZ)(d.Z,{})})})]})]})})}},22958:function(e,t,n){n.d(t,{$R:function(){return S},id:function(){return b},p2:function(){return w}});var r=n(35944),o=n(67294),i=n(46569),a=n(3414),l=n(42450),s=n(9453),d=n(36191),c=n(66318),u=n(54048),p=n(59994),h=n(6775),m=n(53309),g=n(44497),f=n(60614);let v=/^!\[([^\]]*)]\(([^)]+)\)$/,Z=/\.(jpg|jpeg|png|gif|bmp|svg)/i;function b(e){let t=[];for(let n of e.split("\n")){if(""===n.trim())continue;let e=v.exec(n);if(!(e&&Z.test(e[2])))return null;{let n=e[1],r=e[2];t.push({type:"image",url:r,alt:n})}}return t.length>0?t:null}let x=/^(https?:\/\/images\.prodia\.\S+)$/i;function S(e){let t=[];for(let n of e.split("\n")){let e=x.exec(n);if(!e)return null;{let n=e[1];t.push({type:"image",url:n})}}return t.length>0?t:null}let w=e=>
1{let[t,n]=o.useState(!1),[v,Z]=o.useState(!0),{url:b,alt:x}=e.imageBlock,S=b.startsWith("https://oaidalle");return(0,r.BX)(i.Z,{sx:{},children:[(0,r.BX)(a.Z,{variant:"solid",sx:{mx:1.5,minWidth:256,minHeight:128,boxShadow:"md",position:"relative",display:"grid",justifyContent:"center",alignItems:"center","& picture":{display:"flex"},"& img":{maxWidth:"100%",maxHeight:"100%"},"&:hover > .overlay-buttons":{opacity:1},...e.sx},children:[(0,r.tZ)("picture",{children:(0,r.tZ)("img",{src:b,alt:x?"Generated Image: ".concat(x):"Generated Image"})}),!!x&&t&&(0,r.tZ)(i.Z,{sx:{p:{xs:1,md:3}},children:x}),(0,r.BX)(i.Z,{className:"overlay-buttons",sx:{...f.fp,pt:.5,px:.5,gap:.5},children:[!!e.onRunAgain&&(0,r.tZ)(m.s,{title:"Draw again",children:(0,r.tZ)(f.EE,{variant:"outlined",onClick:e.onRunAgain,children:(0,r.tZ)(p.Z,{})})}),!!x&&(0,r.tZ)(m.s,{title:t?"Hide Prompt":"Show Prompt",children:(0,r.tZ)(f.EE,{variant:t?"solid":"outlined",onClick:()=>n(e=>!e),children:(0,r.tZ)(c.Z,{})})}),(0,r.tZ)(m.s,{title:"Open in new tab",children:(0,r.tZ)(f.EE,{variant:"outlined",component:g.r,href:b,download:x||"image",target:"_blank",children:(0,r.tZ)(u.Z,{})})})]})]}),S&&v&&(0,r.tZ)(l.Z,{variant:"soft",color:"neutral",startDecorator:(0,r.tZ)(h.Z,{}),endDecorator:(0,r.tZ)(s.ZP,{variant:"soft","aria-label":"Close Alert",onClick:()=>Z(e=>!e),sx:{my:-.5},children:(0,r.tZ)(d.Z,{})}),sx:{mx:.5,...e.sx},children:(0,r.BX)("div",{children:[(0,r.tZ)("strong",{children:"Please Save Locally"})," \xb7 OpenAI will delete this image link from their servers one hour after creation."]})})]})}},37963:function(e,t,n){n.d(t,{R:function(){return d},Z:function(){return c}});var r=n(35944),o=n(67294),i=n(17723),a=n(38629),l=n(40911),s=n(46569);function d(e,t,n){let[r,a]=o.useState(null),l=n?e:null,s=n?t:null;return o.useEffect(()=>{if(!l||!s)return a(null);let e=setTimeout(()=>{a((0,i.Hy)((0,i.$T)(s,l,{timeout:1,checkLines:!0}),4))},200);return()=>clearTimeout(e)},[s,l]),r}let c=e=>{let t=(0,a.F)(),n=e.diffBlock.textDiffs,o={backgroundColor:"rgba(".concat("light"===t.palette.mode?t.vars.palette.success.lightChannel:t.vars.palette.success.darkChannel," / 1)"),color:t.vars.palette.success.softColor,padding:"0.1rem 0.1rem",margin:"0 -0.1rem"},d={backgroundColor:"rgba(".concat(t.vars.palette.danger.darkChannel," / 0.05)"),color:t.vars.palette.danger.plainColor,padding:"0 0.25rem",margin:"0 -0.25rem",textDecoration:"line-through"},c={};return(0,r.tZ)(l.ZP,{sx:{mx:1.5,overflowWrap:"anywhere",whiteSpace:"break-spaces",display:"block",...e.sx},children:n.map((e,t)=>{let[n,a]=e;return(0,r.tZ)(s.Z,{component:"span",sx:n===i.NL?d:n===i.D$?o:c,children:a},"diff-"+t)})})}},60614:function(e,t,n){n.d(t,{EE:function(){return V},x$:function(){return $},xG:function(){return ee},Uo:function(){return Y},fp:function(){return q}});var r=n(35944),o=n(67294),i=n(36492),a=n(74312),l=n(9453),s=n(46569),d=n(3414),c=n(40911),u=n(2549),p=n(9879),h=n(41899),m=n(88725),g=n(18629),f=n(43180),v=n(63847),Z=n(87606),b=n(32167),x=n(35060),S=n(10604),w=n(15939),C=n(16397);function y(e){return(0,r.BX)(C.Z,{viewBox:"0 0 100 100",width:"100",height:"100",stroke:"none",fill:"currentColor",...e,children:[(0,r.tZ)("path",{d:"M100 34.2c-.4-2.6-3.3-4-5.3-5.3-3.6-2.4-7.1-4.7-10.7-7.1-8.5-5.7-17.1-11.4-25.6-17.1-2-1.3-4-2.7-6-4-1.4-1-3.3-1-4.8 0-5.7 3.8-11.5 7.7-17.2 11.5L5.2 29C3 30.4.1 31.8 0 34.8c-.1 3.3 0 6.7 0 10v16c0 2.9-.6 6.3 2.1 8.1 6.4 4.4 12.9 8.6 19.4 12.9 8 5.3 16 10.7 24 16 2.2 1.5 4.4 3.1 7.1 1.3 2.3-1.5 4.5-3 6.8-4.5 8.9-5.9 17.8-11.9 26.7-17.8l9.9-6.6c.6-.4 1.3-.8 1.9-1.3 1.4-1 2-2.4 2-4.1V37.3c.1-1.1.2-2.1.1-3.1 0-.1 0 .2 0 0zM54.3 12.3 88 34.8 73 44.9 54.3 32.4V12.3zm-8.6 0v20L27.1 44.8 12 34.8l33.7-22.5zM8.6 42.8 19.3 50 8.6 57.2V42.8zm37.1 44.9L12 65.2l15-10.1 18.6 12.5v20.1zM50 60.2 34.8 50 50 39.8 65.2 50 50 60.2zm4.3 27.5v-20l18.6-12.5 15 10.1-33.6 22.4zm37.1-30.5L80.7 50l10.8-7.2-.1 14.4z"}),(0,r.tZ)("path",{d:"M75 0L100 0L100 25Z"})]})}var k=n(93820);let I=["html","css","javascript","json","typescript"],L=(e,t)=>{let n="css"===t,r=!!t&&["javascript","json","typescript"].includes(t),o=!n&&!r,i=document.createElement("form");i.action="https://codepen.io/pen/define",i.method="POST",i.target="_blank";
1let a={title:"".concat(w.H.Title.Base," Code - ").concat((0,k.K)()),css:n?e:"",html:o?e:"",js:r?e:"",editors:"".concat(o?1:0).concat(n?1:0).concat(r?1:0)},l=document.createElement("input");l.type="hidden",l.name="data",l.value=JSON.stringify(a),i.appendChild(l),document.body.appendChild(i),i.submit(),document.body.removeChild(i)};function M(e){return(0,r.tZ)(u.Z,{title:"Open in CodePen",variant:"solid",children:(0,r.tZ)(V,{variant:"outlined",onClick:()=>L(e.code,e.language),children:(0,r.tZ)(y,{})})})}let D=["html","css","javascript","json","typescript"],P=(e,t)=>{let n="html"===t,r="css"===t,o=document.createElement("form");o.action="https://jsfiddle.net/api/post/library/pure/",o.method="POST",o.target="_blank";let i=document.createElement("input");i.type="hidden",i.name="html",i.value=n?e:"",o.appendChild(i);let a=document.createElement("input");a.type="hidden",a.name="css",a.value=r?e:"",o.appendChild(a);let l=document.createElement("input");l.type="hidden",l.name="js",l.value=n||r?"":e,o.appendChild(l),document.body.appendChild(o),o.submit(),document.body.removeChild(o)};function A(e){return(0,r.tZ)(u.Z,{title:"Open in JSFiddle",variant:"solid",children:(0,r.tZ)(V,{variant:"outlined",onClick:()=>P(e.code,e.language),children:"JS"})})}function B(e){return(0,r.BX)(C.Z,{viewBox:"0 0 28 28",width:"28",height:"28",stroke:"none",fill:"currentColor",...e,children:[(0,r.tZ)("path",{d:"M12.747 16.273h-7.46L18.925 1.5l-3.671 10.227h7.46L9.075 26.5l3.671-10.227z"}),(0,r.tZ)("path",{d:"M21 0L28 0L28 7Z"})]})}let E=["typescript","javascript","json","html","css"],T={typescript:"typescript",javascript:"javascript",json:"javascript",html:"html",css:"html"},R={typescript:"index.ts",javascript:"index.js",json:"data.json",html:"index.html",css:"style.css"},X=(e,t,n)=>{let r=T[t]||"javascript",o={files:{[R[t]||"index.js"]:e},template:r,description:"".concat(w.H.Title.Common," file created on ").concat((0,k.K)()),title:"python"==t?"Python Starter":n},i=document.createElement("form");i.action="https://stackblitz.com/run",i.method="POST",i.target="_blank";let a=(e,t)=>{let n=document.createElement("input");n.type="hidden",n.name=e,n.value=t,i.appendChild(n)};Object.keys(o.files).forEach(e=>{a("project[files][".concat(e,"]"),o.files[e])}),a("project[description]",o.description),a("project[template]",o.template),o.title&&a("project[title]",o.title),document.body.appendChild(i),i.submit(),document.body.removeChild(i)};function z(e){return(0,r.tZ)(u.Z,{title:"Open in StackBlitz",variant:"solid",children:(0,r.tZ)(V,{variant:"outlined",onClick:()=>X(e.code,e.language,e.title),children:(0,r.tZ)(B,{})})})}var H=n(40231),N=n(73445),O=n(49235),W=n(16903);let j=(0,N.Ue)()(()=>({mermaidAPI:null,loadingError:null})),F=!1;function G(e){let[t,n]=o.useState(null),i=o.useRef(!1),a=o.useRef(null),{mermaidAPI:l,error:d}=function(){let{mermaidAPI:e}=j();return o.useEffect(()=>{e||function(){if(W.jU&&!F){F=!0;let e=document.createElement("script");e.src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js",e.defer=!0,e.onload=()=>{var e;j.setState({mermaidAPI:((e=window.mermaid).initialize({startOnLoad:!1,fontFamily:O.yG.fontFamily.code,altFontFamily:O.yG.fontFamily.body,htmlLabels:!0,securityLevel:"loose",theme:"forest",mindmap:{useMaxWidth:!1},flowchart:{useMaxWidth:!1},sequence:{useMaxWidth:!1},timeline:{useMaxWidth:!1},class:{useMaxWidth:!1},state:{useMaxWidth:!1},pie:{useMaxWidth:!1},er:{useMaxWidth:!1},gantt:{useMaxWidth:!1},gitGraph:{useMaxWidth:!1}}),e),loadingError:null})},e.onerror=()=>{j.setState({mermaidAPI:null,loadingError:"Script load error for ".concat(e.src)})},document.head.appendChild(e)}}()},[e]),{mermaidAPI:e,isSuccess:!!e,isLoading:F,error:null}}();return(o.useEffect(()=>{if(!l)return;i.current=!1;let t=setTimeout(()=>{let t="mermaid-".concat(Math.random().toString(36).substring(2,9));l.render(t,e.mermaidCode,a.current).then(e=>{let{svg:t}=e;a.current&&!i.current&&n(t)}).catch(e=>console.warn("The AI-generated Mermaid code is invalid, please try again. Details below:\n >>",e.message))},0);return()=>{i.current=!0,clearTimeout(t)}},[l,e.mermaidCode]),d)?(0,r.BX)("div",{children:["Error: ",d]}
1):(0,r.tZ)(s.Z,{component:"div",ref:a,dangerouslySetInnerHTML:{__html:U(e.fitScreen,t)||"Loading Diagram..."},style:{marginInline:"auto"}})}function U(e,t){return e?(null==t?void 0:t.replace("<svg ",'<svg style="width: 100%; height: 100%; object-fit: contain" '))||null:t||null}var K=n(83454);function Y(){return K.env.NEXT_PUBLIC_PLANTUML_SERVER_URL||"https://www.plantuml.com/plantuml/svg/"}async function _(e){let t=Y();t.endsWith("/")||(t+="/");let r="";try{let{encode:o}=await n.e(18).then(n.t.bind(n,31018,23)),i=o(e),a=await (0,x.z)("".concat(t).concat(i));r=await a.text()}catch(e){return console.error("Error rendering PlantUML on server:",t,e),null}let o=r.indexOf("<svg "),i=r.indexOf("</svg>");if(o<0||i<=o)throw Error("Could not render PlantUML");let a=r.slice(o,i+6).replace("background:#FFFFFF;","");if(a.includes(">Syntax Error?</text>"))throw Error("llm syntax issue (it happens!). Please regenerate or change the language model.");return a}let V=(0,a.Z)(l.ZP)(e=>{let{theme:t,variant:n}=e;return{backgroundColor:"outlined"===n?t.palette.background.surface:void 0,"--Icon-fontSize":t.fontSize.lg}}),q={position:"absolute",top:0,right:0,zIndex:2,display:"flex",flexDirection:"row",gap:1,opacity:0,transition:"opacity 0.2s cubic-bezier(.17,.84,.44,1)","& > div > button":{}};function J(e){var t;let[n,a]=o.useState(!!e.fitScreen),[l,x]=o.useState(!0===e.initialShowHTML),[w,C]=o.useState(!0),[y,k]=o.useState(!0),[L,P]=o.useState(!0),[B,T]=(0,S.Z)(e=>[e.renderCodeSoftWrap,e.setRenderCodeSoftWrap]),{codeBlock:{blockTitle:R,blockCode:X,complete:N},highlightCode:O,inferCodeLanguage:W,optimizeLightweight:j}=e,{highlightedCode:F,inferredCodeLanguage:K}=o.useMemo(()=>{let e=W(R,X);return{highlightedCode:O(e,X),inferredCodeLanguage:e}},[W,R,X,O]),Y=(0,H.Do)(X),J=Y&&l,Q="mermaid"===R&&N,$=Q&&w,ee=X.startsWith("@startuml")&&X.endsWith("@enduml")||X.startsWith("@startmindmap")&&X.endsWith("@endmindmap")||X.startsWith("@startsalt")&&X.endsWith("@endsalt")||X.startsWith("@startwbs")&&X.endsWith("@endwbs")||X.startsWith("@startgantt")&&X.endsWith("@endgantt"),et=ee&&y,{data:en,error:er}=(0,i.a)({enabled:et,queryKey:["plantuml",X],queryFn:()=>_(X),staleTime:864e5});et=et&&(!!en||!!er);let eo=(X.startsWith("<svg")||X.startsWith('<?xml version="1.0" encoding="UTF-8"?>\n<svg'))&&X.endsWith("</svg>"),ei=eo&&L,ea=ei&&X.includes('viewBox="'),el=N&&(eo||!!K&&I.includes(K)),es=N&&!!K&&D.includes(K)&&(null==X?void 0:X.length)>10,ed=N&&!!(t=K)&&E.includes(t);return(0,r.tZ)(s.Z,{sx:{position:"relative"},children:(0,r.BX)(s.Z,{component:"code",className:"language-".concat(K||"unknown"),sx:{whiteSpace:B?"break-spaces":"pre",mx:0,p:1.5,display:"flex",flexDirection:"column",overflowX:"auto",minWidth:160,"&:hover > .overlay-buttons":{opacity:1},...e.sx||{},'[data-joy-color-scheme="dark"] &':et||$?{backgroundColor:"neutral.300"}:{}},children:[R!=K&&(R.includes(".")||R.includes("://"))&&(0,r.tZ)(d.Z,{sx:{backgroundColor:"background.surface",boxShadow:"xs",borderRadius:"xs",m:-.5,mb:1.5},children:(0,r.tZ)(c.ZP,{level:"body-sm",sx:{px:1,py:.5,color:"text.primary"},children:R})}),J?(0,r.tZ)(H.uw,{htmlString:X}):$?(0,r.tZ)(G,{mermaidCode:X,fitScreen:n}):(0,r.tZ)(s.Z,{component:"div",dangerouslySetInnerHTML:{__html:ei?U(n,X)||"No SVG code":et?U(n,en)||er||"No PlantUML rendering.":F},sx:{...ei?{lineHeight:0}:{},...et?{textAlign:"center",mx:"auto"}:{}}}),(0,r.BX)(s.Z,{className:"overlay-buttons",sx:{...q,p:.5},children:[Y&&(0,r.tZ)(u.Z,{title:j?null:J?"Hide":"Show Web Page",children:(0,r.tZ)(V,{variant:J?"solid":"outlined",color:"danger",onClick:()=>x(!l),children:(0,r.tZ)(g.Z,{sx:{fontSize:"xl2"}})})}),eo&&(0,r.tZ)(u.Z,{title:j?null:ei?"Show Code":"Render SVG",children:(0,r.tZ)(V,{variant:ei?"solid":"outlined",onClick:()=>P(!L),children:(0,r.tZ)(v.Z,{})})}),(Q||ee)&&(0,r.BX)(p.Z,{"aria-label":"Diagram",children:[(0,r.tZ)(u.Z,{title:j?null:$||et?"Show Code":"Render Mermaid",children:(0,r.tZ)(V,{variant:$||et?"solid":"outlined",onClick:()=>{Q&&C(e=>!e),ee&&k(e=>!e)},children:(0,r.tZ)(f.Z,{})})}),(Q&&w||ee&&y&&!er||eo&&L&&ea)&&(0,r.tZ)(u.Z,{title:j?null:n?"Original Size":"Fit Screen",children:(0,r.tZ)(V,{variant:n?"solid":"outlined",onClick:()=>a(e=>!e),children:(0,r.tZ)(m.Z,{})})})]}),(es||el||ed)&&(0,r.BX)(p.Z,{"aria-label":"Open code in external editors",children:[es&&(0,r.tZ)(A,{code:X,language:K}),el&&(0,r.tZ)(M,{code:X,language:K}),ed&&(0,r.tZ)(z,{code:X,title:R,language:K})]}),!J&&!$&&!et&&!ei&&(0,r.tZ)(u.Z,{title:"Toggle Soft Wrap",children:(0,r.tZ)(V,{variant:B?"solid":"outlined",onClick:()=>T(!B),children:(0,r.tZ)(Z.Z,{})})}),!0!==e.noCopyButton&&(0,r.tZ)(u.Z,{title:j?null:"Copy Code",children:(0,r.tZ)(V,{variant:"outlined",onClick:e=>{e.stopPropagation(),(0,b.vQ)(X,"Code")},children:(0,r.tZ)(h.Z,{})})})]})]})})}let Q=o.lazy(async()=>{let{highlightCode:e,inferCodeLanguage:t}=await Promise.all([n.e(355),n.e(114)]).then(n.bind(n,34114));return{default:n=>(0,r.tZ)(J,{highlightCode:e,inferCodeLanguage:t,...n})}});function $(e){return(0,r.tZ)(o.Suspense,{fallback:(0,r.tZ)(s.Z,{component:"
1code",sx:{p:1.5,display:"block",...e.sx}}),children:(0,r.tZ)(Q,{...e})})}let ee=o.memo($)},89639:function(e,t,n){n.d(t,{I:function(){return u},o:function(){return c}});var r=n(35944),o=n(67294),i=n(74312),a=n(46569),l=n(49235);let s=(0,i.Z)(a.Z)({marginInline:"0.75rem !important",lineHeight:l.rt,"& table":{width:"inherit !important"}}),d=o.lazy(()=>Promise.all([n.e(265),n.e(748),n.e(126)]).then(n.bind(n,56126)));function c(e){return(0,r.tZ)(s,{className:"markdown-body",sx:e.sx,children:(0,r.tZ)(o.Suspense,{fallback:(0,r.tZ)("div",{children:"Loading..."}),children:(0,r.tZ)(d,{content:e.textBlock.content})})})}let u=o.memo(c)},35692:function(e,t,n){n.d(t,{A:function(){return l},Q:function(){return a}});var r=n(73445),o=n(782),i=n(52923);let a=(0,r.Ue)()((0,o.tJ)(e=>({wssEndpoint:"",setWssEndpoint:t=>e(()=>({wssEndpoint:t})),pageTransform:"text",setPageTransform:t=>e(()=>({pageTransform:t})),enableCommandBrowse:!0,setEnableCommandBrowse:t=>e(()=>({enableCommandBrowse:t})),enableComposerAttach:!0,setEnableComposerAttach:t=>e(()=>({enableComposerAttach:t})),enableReactTool:!0,setEnableReactTool:t=>e(()=>({enableReactTool:t})),enablePersonaTool:!0,setEnablePersonaTool:t=>e(()=>({enablePersonaTool:t}))}),{name:"app-module-browse"}));function l(){let e=(0,i.B)().hasBrowsing,{wssEndpoint:t,enableCommandBrowse:n,enableComposerAttach:r,enableReactTool:o,enablePersonaTool:l}=a(),s=!!t,d=(null==t?void 0:t.startsWith("wss://"))&&(null==t?void 0:t.length)>10||(null==t?void 0:t.startsWith("ws://"))&&(null==t?void 0:t.length)>9,c=e||s&&d;return{mayWork:c,isServerConfig:e,isClientConfig:s,isClientValid:d,inCommand:c&&n,inComposer:c&&r,inReact:c&&o,inPersonas:c&&l}}},32684:function(e,t,n){n.d(t,{Kd:function(){return h},Bp:function(){return c},cP:function(){return p},Kl:function(){return u}});var r=n(52923);class o{async EXPERIMENTAL_playStream(e){if(this.reader&&await this.stop(),!e.body)return;let t=e.body;this.audioContext.createMediaElementSource(this.audioElement).connect(this.audioContext.destination),this.mediaSource.addEventListener("sourceopen",async()=>{let e=this.mediaSource.addSourceBuffer("audio/mpeg");for(this.reader=t.getReader(),this.onStart&&this.onStart();;){let{done:t,value:n}=await this.reader.read();if(t){e.onupdateend=()=>this.mediaSource.endOfStream();break}if(await new Promise(t=>{e.updating?e.addEventListener("updateend",()=>t(null),{once:!0}):t(null)}),this.audioElement.buffered.length>0){let t=this.audioElement.currentTime;if(this.audioElement.buffered.end(this.audioElement.buffered.length-1)-t>this.bufferSizeLimit)try{e.remove(0,t-1),await new Promise(t=>{e.addEventListener("updateend",()=>t(null),{once:!0})})}catch(e){console.warn("Error removing old data from the buffer:",e)}}await new Promise(t=>{e.updating?e.addEventListener("updateend",()=>t(null),{once:!0}):t(null)}),e.appendBuffer(n)}this.onStop&&this.onStop()}),this.audioElement.src=URL.createObjectURL(this.mediaSource),this.audioElement.autoplay=!0}async stop(){this.reader&&(await this.reader.cancel(),this.reader=null,this.mediaSource.endOfStream(),this.audioElement.pause())}constructor(){this.audioContext=new AudioContext,this.audioElement=new Audio,this.mediaSource=new MediaSource,this.bufferSizeLimit=5,this.onStart=null,this.onStop=null,this.reader=null}}var i=n(35060),a=n(21705),l=n(10604),s=n(5049);let d=e=>{var t;return!!e&&(null===(t=e.trim())||void 0===t?void 0:t.length)>=32},c=e=>e?d(e):(0,r.B)().hasVoiceElevenLabs;function u(){let[e,t]=(0,s.g5)(),n=(0,r.B)().hasVoiceElevenLabs,o=!!e&&d(e);return{mayWork:n||o||!!t,isConfiguredServerSide:n,isConfiguredClientSide:o}}async function p(e,t){var n;if(!(null==e?void 0:e.trim()))return;let{elevenLabsApiKey:r,elevenLabsVoiceId:o}=(0,s.JB)();if(!c(r))return;let{preferredLanguage:i}=l.Z.getState(),d=!(null==i?void 0:null===(n=i.toLowerCase())||void 0===n?void 0:n.startsWith("en"));try{let n=await m(e,r,t||o,d,!1),i=await n.arrayBuffer();await (0,a.Tq)(i)}catch(e){console.error("Error playing first text:",e)}}async function h(e,t){var n;if(!(null==e?void 0:e.trim()))return;let{elevenLabsApiKey:r,elevenLabsVoiceId:i}=(0,s.JB)();if(!c(r))return;let{preferredLanguage:a}=l.Z.getState(),d=!(null==a?void 0:null===(n=a.toLowerCase())||void 0===n?void 0:n.startsWith("en"));try{let n=await m(e,r,t||i,d,!0);new o().EXPERIMENTAL_playStream(n)}catch(e){console.error("EXPERIMENTAL_speakTextStream:",e)}}async function m(e,t,n,r,o){let a={elevenKey:t,text:e.slice(0,1e3),voiceId:n,nonEnglish:r,...o&&{streaming:!0,streamOptimization:4}},l=await (0,i.z)("/api/elevenlabs/speech",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!l.ok){let e=await l.json();throw Error(e.error||e.message||"Unknown error")}return l}},5049:function(e,t,n){n.d(t,{JB:function(){return c},Vf:function(){return l},X6:function(){return s},g5:function(){return d}});var r=n(73445),o=n(782),i=n(76248);let a=(0,r.Ue)()((0,o.tJ)(e=>({elevenLabsApiKey:"",setElevenLabsApiKey:t=>e({elevenLabsApiKey:t}),elevenLabsVoiceId:"",setElevenLabsVoiceId:t=>e({elevenLabsVoiceId:t})}),{name:"app-module-elevenlabs"})),l=()=>a(e=>[e.elevenLabsApiKey,e.setElevenLabsApiKey],i.X),s=()=>a(e=>[e.elevenLabsVoiceId,e.setElevenLabsVoiceId],i.X),d=()=>a(e=>[e.elevenLabsApiKey,e.elevenLabsVoiceId],i.X),c=()=>a.getState()},13230:function(e,t,n){n.d(t,{G:function(){return g},l:function(){return f}});var r=n(35944),o=n(67294),i=n(17452),a=n(48699),l=n(36376),s=n(75503),d=n(92290),c=n(71921),u=n(21705),p=n(32684),h=n(5049);function m(e){return(0,r.tZ)(i.Z,{value:e.voiceId,onChange:(t,n)=>e.setVoiceId(n||""),variant:"outlined",disabled:e.disabled||!e.voices.length,placeholder:e.isErrorVoices?"Issue loading voices":e.isValidKey?"Select a voice":"Missing API Key",startDecorator:(0,r.tZ)(d.Z,{}),endDecorator:e.isValidKey&&e.isLoadingVoices&&(0,r.tZ)(a.Z,{size:"sm"}),indicator:(0,r.tZ)(s.Z,{}),slotProps:{root:{sx:{width:"100%"}},indicator:{sx:{opacity:.5}}},children:e.voices.map(e=>(0,r.tZ)(l.Z,{value:e.id,children:e.name},e.id))})}function g(){let[e]=(0,h.Vf)(),t=(0,p.Bp)(e),{data:n,isLoading:r,isError:o}=c.GN.elevenlabs.listVoices.useQuery({elevenKey:e},{enabled:t,staleTime:3e5});return{isConfigured:t,isLoading:r,isError:o,hasVoices:!r&&!!(null==n?void 0:n.voices.length),voices:(null==n?void 0:n.voices)||[]}}function f(e,t){let{isConfigured:n,isLoading:i,isError:a,hasVoices:l,voices:s}=g(),[d,c]=(0,h.X6)(),p=s.find(e=>e.id===d),f=e&&(null==p?void 0:p.previewUrl)||null;o.useEffect(()=>{f&&(0,u.wu)(f)},[f]);let v=o.useMemo(()=>(0,r.tZ)(m,{isValidKey:n,isLoadingVoices:i,isErrorVoices:a,disabled:t,voices:s,voiceId:d,setVoiceId:c}),[t,n,a,i,c,d,s]);return{hasVoices:l,voiceId:d,voiceName:null==p?void 0:p.name,voicesDropdown:v}}},22684:function(e,t,n){n.d(t,{Cu:function(){return i},dK:function(){return l},sQ:function(){return a}});var r=n(71921),o=n(99024);let i=e=>{var t;return!!e&&(null===(t=e.trim())||void 0===t?void 0:t.length)>=39},a=e=>{var t;return!!e&&(null===(t=e.trim())||void 0===t?void 0:t.length)>=17};async function l(e){let{googleCloudApiKey:t,googleCSEId:n}=o.S.getState();try{return await r.Ge.googleSearch.search.query({query:e,key:t,cx:n})}catch(t){let e=(null==t?void 0:t.message)||(null==t?void 0:t.toString())||"Unknown error";throw console.error("callApiSearchGoogle: ".concat(e)),Error(e)}}},99024:function(e,t,n){n.d(t,{S:function(){return i}});var r=n(73445),o=n(782);let i=(0,r.Ue)()((0,o.tJ)(e=>({googleCloudApiKey:"",setGoogleCloudApiKey:t=>e({googleCloudApiKey:t}),googleCSEId:"",setGoogleCSEId:t=>e({googleCSEId:t})}),{name:"app-module-google-search"}))},98189:function(e,t,n){n.d(t,{Y:function(){return v}});var r=n(35944);n(67294);var o=n(76248),i=n(23924),a=n(17452),l=n(36376),s=n(6519),d=n(40911),c=n(6775),u=n(21388),p=n(58218),h=n(44497),m=n(88349),g=n(19004),f=n(19538);function v(){let e=(0,m.P)(!1,"DallESettings"),{dalleModelId:t,setDalleModelId:n,dalleQuality:v,setDalleQuality:Z,dalleSize:b,setDalleSize:x,dalleStyle:S,setDalleStyle:w,dalleNoRewrite:C,setDalleNoRewrite:y}
1=(0,g.t)(e=>({dalleModelId:e.dalleModelId,setDalleModelId:e.setDalleModelId,dalleQuality:e.dalleQuality,setDalleQuality:e.setDalleQuality,dalleSize:e.dalleSize,setDalleSize:e.setDalleSize,dalleStyle:e.dalleStyle,setDalleStyle:e.setDalleStyle,dalleNoRewrite:e.dalleNoRewrite,setDalleNoRewrite:e.setDalleNoRewrite}),o.X),k="dall-e-3"===t,I="hd"===v&&k,L="dall-e-2"===t?["256x256","512x512","1024x1024"]:["1024x1024","1792x1024","1024x1792"],M=L.includes(b),D=(0,f.X)(t,v,b);return(0,r.BX)(r.HY,{children:[(0,r.tZ)(p.d,{title:"Model",description:"dall-e-2"===t?"Older":"Newer",options:[{value:"dall-e-2",label:"DALL\xb7E 2"},{value:"dall-e-3",label:"DALL\xb7E 3"}],value:t,onChange:n}),k&&(0,r.tZ)(p.d,{title:"Style",description:k&&"vivid"===S?"Hyper-Real":"Realistic",disabled:!k,options:[{value:"natural",label:"Natural"},{value:"vivid",label:"Vivid"}],value:k?S:"natural",onChange:w}),(0,r.BX)(i.Z,{orientation:"horizontal",sx:{justifyContent:"space-between",alignItems:"center"},children:[(0,r.tZ)(u.E,{title:"Resolution",description:M?b===g.e?"Default":"Custom":"Unsupported"}),(0,r.tZ)(a.Z,{variant:"outlined",value:b,onChange:(e,t)=>
1t&&x(t),startDecorator:M?void 0:(0,r.tZ)(c.Z,{color:"warning"}),slotProps:{root:{sx:{minWidth:"140px"}},indicator:{sx:{opacity:.5}},button:{sx:{whiteSpace:"inherit"}}},children:L.map(e=>(0,r.tZ)(l.Z,{value:e,children:e.replace("x"," x ")},"dalle-res-"+e))})]}),k&&(0,r.BX)(i.Z,{orientation:"horizontal",disabled:!k,sx:{justifyContent:"space-between"},children:[(0,r.tZ)(u.E,{title:"Quality",description:I?"Detailed":"Default"}),(0,r.tZ)(s.Z,{checked:I,onChange:e=>Z(e.target.checked?"hd":"standard"),startDecorator:I?"HD":"Standard"})]}),e.on&&(0,r.BX)(i.Z,{orientation:"horizontal",sx:{justifyContent:"space-between"},children:[(0,r.tZ)(u.E,{title:"Better Prompt",description:C?"No Rewrite":"Default",tooltip:(0,r.BX)(r.HY,{children:["OpenAI improves the prompt by rewriting it by default. This can be disabled to get more control over the prompt. See ",(0,r.tZ)(h.r,{href:"https://platform.openai.com/docs/guides/images/prompting",target:"_blank",children:"This OpenAI document "})]})}),(0,r.tZ)(s.Z,{checked:!C,onChange:e=>y(!e.target.checked),startDecorator:C?"No":"Improve"})]}),e.on&&(0,r.BX)(i.Z,{orientation:"horizontal",sx:{justifyContent:"space-between"},children:[(0,r.tZ)(u.E,{title:"Cost per Image",description:(0,r.tZ)(h.r,{href:"https://openai.com/pricing",target:"_blank",noLinkStyle:!0,sx:{textDecoration:"none"},children:"OpenAI Pricing "})}),(0,r.BX)(d.ZP,{children:["$ ",D]})]}),(0,r.tZ)(u.E,{title:e.on?"Hide Advanced":"Advanced",onClick:e.toggle})]})}},19538:function(e,t,n){n.d(t,{I:function(){return a},X:function(){return l}});var r=n(71921),o=n(72654),i=n(19004);async function a(e,t,n){let{dalleModelId:a,dalleQuality:l,dalleSize:s,dalleStyle:d,dalleNoRewrite:c}=i.t.getState();c&&(t="I NEED to test how the tool works with extremely simple prompts. DO NOT add any detail, just use it AS-IS: "+t);let u="dall-e-3"===a,p=[];for(;n>0;){let i=Math.min(n,u?1:10),c=r.Ge.llmOpenAI.createImages.mutate({access:(0,o.t8)(e).transportAccess,config:{prompt:t,count:i,model:a,quality:l,responseFormat:"url",size:s,style:d}}).then(e=>e.map(e=>{let{imageUrl:t,altText:n}=e;return".concat(t,")")}));p.push(c),n-=i}let h=await Promise.allSettled(p);if(h.every(e=>"rejected"===e.status)){let e=h.map(e=>{var t;let n=e.reason;return(null==n?void 0:null===(t=n.shape)||void 0===t?void 0:t.message)||(null==n?void 0:n.message)||""}).filter(e=>!!e).join(", ");throw Error("OpenAI image generation: ".concat(e))}return h.filter(e=>"fulfilled"===e.status).map(e=>e.value).flat()}function l(e,t,n){if("dall-e-3"===e){if("hd"===t){if("1024x1024"===n)return"0.08";if("1792x1024"===n||"1024x1792"===n)return"0.12"}else if("standard"===t){if("1024x1024"===n)return"0.04";if("1792x1024"===n||"1024x1792"===n)return"0.08"}}else if("dall-e-2"===e){if("256x256"===n)return"0.016";if("512x512"===n)return"0.018";if("1024x1024"===n)return"0.02"}return"?"}},19004:function(e,t,n){n.d(t,{e:function(){return i},t:function(){return a}});var r=n(73445),o=n(782);let i="1024x1024",a=(0,r.Ue)()((0,o.tJ)(e=>({dalleModelId:"dall-e-3",setDalleModelId:t=>e({dalleModelId:t}),dalleQuality:"standard",setDalleQuality:t=>e({dalleQuality:t}),dalleSize:i,setDalleSize:t=>e({dalleSize:t}),dalleStyle:"vivid",setDalleStyle:t=>e({dalleStyle:t}),dalleNoRewrite:!1,setDalleNoRewrite:t=>e({dalleNoRewrite:t})}),{name:"app-module-dalle"}))},39509:function(e,t,n){n.d(t,{D:function(){return D}});var r=n(35944),o=n(67294),i=n(76248),a=n(23924),l=n(17452),s=n(48699),d=n(36376),c=n(9876),u=n(75913),p=n(76681),h=n(6519),m=n(2610),g=n(67142),f=n(75503),v=n(96929),Z=n(59595),b=n(52923),x=n(44569),S=n(69762),w=n(21388),C=n(58218),y=n(38733),k=n(71921),I=n(88349),L=n(22492);let M=e=>{var t;return!!e&&(null===(t=e.trim())||void 0===t?void 0:t.length)>=36};function D(e){var t;let n=(0,I.P)(!1,"ProdiaSettings"),D=(0,b.B)().hasImagingProdia,{apiKey:P,setApiKey:A,modelId:B,setModelId:E,modelGen:T,setModelGen:R,negativePrompt:X,setNegativePrompt:z,steps:H,setSteps:N,cfgScale:O,setCfgScale:W,prodiaAspectRatio:j,setProdiaAspectRatio:F,upscale:G,setUpscale:U,prodiaResolution:K,setProdiaResolution:Y,seed:_,setSeed:V}=(0,L.Nl)(e=>({apiKey:e.prodiaApiKey,setApiKey:e.setProdiaApiKey,modelId:e.prodiaModelId,setModelId:e.setProdiaModelId,modelGen:e.prodiaModelGen,setModelGen:e.setProdiaModelGen,negativePrompt:e.prodiaNegativePrompt,setNegativePrompt:e.setProdiaNegativePrompt,steps:e.prodiaSteps,setSteps:e.setProdiaSteps,cfgScale:e.prodiaCfgScale,setCfgScale:e.setProdiaCfgScale,prodiaAspectRatio:e.prodiaAspectRatio,setProdiaAspectRatio:e.setProdiaAspectRatio,upscale:e.prodiaUpscale,setUpscale:e.setProdiaUpscale,prodiaResolution:e.prodiaResolution,setProdiaResolution:e.setProdiaResolution,seed:e.prodiaSeed,setSeed:e.setProdiaSeed}),i.X),q=P?M(P):D,J="sdxl"===T,{data:Q,isLoading:$,isError:ee,error:et}=k.GN.prodia.listModels.useQuery({prodiaKey:P},{enabled:q,staleTime:36e5});return o.useEffect(()=>{(null==Q?void 0:Q.models)&&!B&&(E(Q.models[0].id),R(Q.models[0].gen))},[Q,B,E,R]),(0,r.BX)(r.HY,{children:[!D&&!!e.noSkipKey&&(0,r.tZ)(S.H,{autoCompleteId:"prodia-key",label:"Prodia API Key",rightLabel:(0,r.tZ)(x.b,{required:!D}),value:P,onChange:A,required:!D,isError:!q}),ee&&(0,r.tZ)(y.b,{error:et}),(0,r.BX)(a.Z,{orientation:"horizontal",sx:{justifyContent:"space-between",alignItems:"center"},children:[(0,r.tZ)(w.E,{title:"Diffusion Model"}),(0,r.tZ)(l.Z,{variant:"outlined",placeholder:q?"Select a model":"Enter API Key",value:
1B,onChange:(e,t)=>{if(t){var n,r;let e=null!==(r=null==Q?void 0:null===(n=Q.models)||void 0===n?void 0:n.find(e=>e.id===t))&&void 0!==r?r:null;e&&(E(e.id),R(e.gen))}},startDecorator:(0,r.tZ)(g.Z,{sx:{display:{xs:"none",sm:"inherit"}}}),endDecorator:q&&$&&(0,r.tZ)(s.Z,{size:"sm"}),indicator:(0,r.tZ)(f.Z,{}),slotProps:{root:{sx:{width:"100%"}},indicator:{sx:{opacity:.5}},button:{sx:{whiteSpace:"inherit"}}},children:!!Q&&(null===(t=Q.models)||void 0===t?void 0:t.map((e,t)=>(0,r.BX)(d.Z,{value:e.id,sx:e.priority?{fontWeight:"md"}:void 0,children:["sdxl"===e.gen&&(0,r.tZ)(c.Z,{size:"sm",variant:"outlined",children:"XL"})," ",e.label]},"prodia-model-"+t)))})]}),(0,r.BX)(a.Z,{orientation:"horizontal",sx:{justifyContent:"space-between",alignItems:"center"},children:[(0,r.tZ)(w.E,{title:"Negative Prompt",description:X?"Custom":"Not set",tooltip:"Avoid these image traits: comma-separated names & adjectives that you want the images to Not have. Example: ugly, blurry, malformed"}),(0,r.tZ)(u.ZP,{"aria-label":"Image Generation Negative Prompt",variant:"outlined",placeholder:"ugly, blurry, ...",value:X,onChange:e=>z(e.target.value),slotProps:{input:{sx:{width:"100%"}}},sx:{width:"100%"}})]}),(0,r.BX)(a.Z,{orientation:"horizontal",sx:{justifyContent:"space-between"},children:[(0,r.tZ)(w.E,{title:"Diffusion Steps",description:25===H?"Default":H>30?H>40?"May be unnecessary":"More detail":H<=15?"Less detail":"Balanced",tooltip:"More steps boost image detail & quality but risk oversaturation and cost increase. Start from 20 steps, and increase gradually. Defaults to 25."}),(0,r.tZ)(p.Z,{"aria-label":"Image Generation steps",valueLabelDisplay:"auto",value:H,onChange:(e,t)=>
1N(t),min:10,max:50,step:1,defaultValue:25,sx:{width:"100%"}})]}),(0,r.BX)(a.Z,{orientation:"horizontal",sx:{justifyContent:"space-between"},children:[(0,r.tZ)(w.E,{title:"Cfg-Scale",description:7===O?"Default":O>=9?O>=12?"Heavy guidance":"Intense guidance":O<=5?"More freedom":"Balanced",tooltip:"Adjust the prompt intensity for generation. Low values deviate, high values overfit. Default: 7 - a balanced start."}),(0,r.tZ)(p.Z,{"aria-label":"Image Generation Guidance",valueLabelDisplay:"auto",value:O,onChange:(e,t)=>W(t),min:1,max:15,step:.5,defaultValue:7,sx:{width:"100%"}})]}),n.on&&J&&(0,r.BX)(a.Z,{orientation:"horizontal",sx:{justifyContent:"space-between",alignItems:"center"},children:[(0,r.tZ)(w.E,{title:"[SDXL] Resolution"}),(0,r.tZ)(l.Z,{variant:"outlined",value:K||L.YU,onChange:(e,t)=>t&&Y(t),slotProps:{root:{sx:{width:"100%"}},indicator:{sx:{opacity:.5}},button:{sx:{whiteSpace:"inherit"}}},children:L.Cf.map(e=>(0,r.tZ)(d.Z,{value:e,children:e.replace("x"," x ")},"sdxl-res-"+e))})]}),n.on&&!J&&(0,r.tZ)(C.d,{title:"[SD] Aspect Ratio",description:"square"===j?"Square":"portrait"===j?"Portrait":"Landscape",options:[{value:"square",label:(0,r.tZ)(m.Z,{sx:{width:25,height:24,mt:-.25}})},{value:"portrait",label:(0,r.tZ)(Z.Z,{sx:{width:25,height:24,mt:-.25}})},{value:"landscape",label:(0,r.tZ)(v.Z,{sx:{width:25,height:24,mt:-.25}})}],value:j,onChange:F}),n.on&&!J&&(0,r.BX)(a.Z,{orientation:"horizontal",sx:{justifyContent:"space-between"},children:[(0,r.tZ)(w.E,{title:"[SD] Upscale",description:G?"1024px":"Default"}),(0,r.tZ)(h.Z,{checked:G,onChange:e=>U(e.target.checked),endDecorator:G?"2x":"Off",slotProps:{endDecorator:{sx:{minWidth:26}}}})]}),n.on&&(0,r.BX)(a.Z,{orientation:"horizontal",sx:{justifyContent:"space-between",alignItems:"center"},children:[(0,r.tZ)(w.E,{title:"Noise Seed",description:_?"Custom":"Random",tooltip:"Set value for reproducible images. Different by default."}),(0,r.tZ)(u.ZP,{"aria-label":"Image Generation Seed",variant:"outlined",placeholder:"Random",value:_||"",onChange:e=>V(e.target.value||""),slotProps:{input:{type:"number",sx:{width:"100%"}}},sx:{width:"100%"}})]}),(0,r.tZ)(w.E,{title:n.on?"Hide Advanced":"Advanced",onClick:n.toggle})]})}},22492:function(e,t,n){n.d(t,{Cf:function(){return i},Nl:function(){return l},YU:function(){return a}});var r=n(73445),o=n(782);let i=["1024x1024","1152x896","1216x832","1344x768","1536x640","640x1536","768x1344","832x1216"],a=i[0],l=(0,r.Ue)()((0,o.tJ)(e=>({prodiaApiKey:"",setProdiaApiKey:t=>e({prodiaApiKey:t}),prodiaModelId:"",setProdiaModelId:t=>e({prodiaModelId:t}),prodiaModelGen:"sd",setProdiaModelGen:t=>e({prodiaModelGen:t}),prodiaNegativePrompt:"",setProdiaNegativePrompt:t=>e({prodiaNegativePrompt:t}),prodiaSteps:25,setProdiaSteps:t=>e({prodiaSteps:t}),prodiaCfgScale:7,setProdiaCfgScale:t=>e({prodiaCfgScale:t}),prodiaAspectRatio:"square",setProdiaAspectRatio:t=>e({prodiaAspectRatio:t}),prodiaUpscale:!1,setProdiaUpscale:t=>e({prodiaUpscale:t}),prodiaResolution:a,setProdiaResolution:t=>e({prodiaResolution:t}),prodiaSeed:null,setProdiaSeed:t=>{var n;return e({prodiaSeed:""===t||"-1"===t?null:null!==(n=parseInt(t))&&void 0!==n?n:null})}}),{name:"app-module-prodia",version:2}))},13617:function(e,t,n){n.d(t,{o_:function(){return f},ZS:function(){return v},p7:function(){return g}});var r=n(67294),o=n(76248),i=n(32010),a=n(33388),l=n(52923),s=n(19538),d=n(71921),c=n(22492);async function u(e,t){let{prodiaApiKey:n,prodiaModelId:r,prodiaModelGen:o,prodiaNegativePrompt:i,prodiaSteps:a,prodiaCfgScale:l,prodiaAspectRatio:s,prodiaUpscale:u,prodiaResolution:p,prodiaSeed:h}=c.Nl.getState();return await Promise.all(Array(t).fill(void 0).map(async()=>{let t=await d.Ge.prodia.createImage.query({...!!n&&{prodiaKey:n},prodiaModel:r||"sd_xl_base_1.0.safetensors [be9edd61]",prodiaGen:o||"sd",prompt:e,...!!i&&{negativePrompt:i},...!!a&&{steps:a},...!!l&&{cfgScale:l},...!!s&&"square"!==s&&{aspectRatio:s},...u&&{upscale:u},...!!p&&{resolution:p},...!!h&&{seed:h}});if(1!==t.length)throw Error("Prodia image generation failed - expected 1 image, got "+t.length);let{imageUrl:c,altText:m}=t[0];return".concat(c,")")}))}var p=n(73445),h=n(782);let m=(0,p.Ue)()((0,h.tJ)(e=>({activeProviderId:null,setActiveProviderId:t=>e({activeProviderId:t})}
1),{name:"app-module-t2i",version:1}));function g(){let{activeProviderId:e,setActiveProviderId:t}=m((0,i.N)(e=>({activeProviderId:e.activeProviderId,setActiveProviderId:e.setActiveProviderId}))),n=(0,a.p0)(e=>{let{llms:t,sources:n}=e;return Z(t,n)},(e,t)=>e.length===t.length&&e.every((e,n)=>(0,o.X)(e,t[n]))),l=(0,c.Nl)(e=>!!e.prodiaModelId),s=r.useMemo(()=>b(n,l),[l,n]);return r.useEffect(()=>{let n=s.map(e=>e.id);if(e&&n.includes(e))return;let r=s.find(e=>e.configured);r&&t(r.id)},[e,s,t]),{mayWork:void 0!==s.find(e=>e.configured),providers:s,activeProviderId:e,setActiveProviderId:t}}function f(){let{activeProviderId:e}=m.getState();if(!e)throw Error("No TextToImage Provider selected");let{llms:t,sources:n}=a.p0.getState(),r=b(Z(t,n),!!c.Nl.getState().prodiaModelId).find(t=>t.id===e);if(!r)throw Error("Text-to-image is not configured correctly");return r}async function v(e,t,n){switch(e.vendor){case"openai":if(!e.id)throw Error("No OpenAI model source configured for TextToImage");return await (0,s.I)(e.id,t,n);case"localai":throw Error("LocalAI t2i integration is not yet available");case"prodia":let r=(0,l.B)().hasImagingProdia,o=!!c.Nl.getState().prodiaModelId;if(!r&&!o)throw Error("No Prodia configuration found for TextToImage");return await u(t,n)}}function Z(e,t){return t.filter(e=>"openai"===e.vId).map(t=>({label:t.label,modelVendorId:t.vId,modelSourceId:t.id,hasAnyModels:e.some(e=>e.sId===t.id)}))}function b(e,t){let n=[];for(let{modelVendorId:t,modelSourceId:r,label:o,hasAnyModels:i}of e)switch(t){case"localai":n.push({id:r,label:o,painter:"LocalAI",description:"LocalAI's models",configured:i,vendor:"localai"});break;case"openai":n.push({id:r,label:o,painter:"DALL\xb7E",description:"OpenAI's DALL\xb7E models",configured:i,vendor:"openai"});break;default:console.error("Unknown model vendor",t)}let r=(0,l.B)().hasImagingProdia;return n.push({id:"prodia",label:"Prodia",painter:"Prodia",description:"Prodia's models",configured:r||t,vendor:"prodia"}),n}},46343:function(e,t,n){n.d(t,{BJ:function(){return p},DL:function(){return c},Xs:function(){return u},ft:function(){return l},hr:function(){return s},m9:function(){return d}});var r=n(73445),o=n(782),i=n(76248);let a=(0,r.Ue)()((0,o.tJ)(e=>({chatLinkItems:[],chatLinkItemAdd:(t,n,r,o,i)=>e(e=>{var a;return{chatLinkItems:[...e.chatLinkItems,{chatTitle:t,objectId:n,createdAt:r.toISOString(),expiresAt:null!==(a=null==o?void 0:o.toISOString())&&void 0!==a?a:null,deletionKey:i}]}}),chatLinkItemRemove:t=>e(e=>({chatLinkItems:e.chatLinkItems.filter(e=>e.objectId!==t)})),chatLinkItemChangeDeletionKey:(t,n)=>e(e=>({chatLinkItems:e.chatLinkItems.map(e=>e.objectId===t?{...e,deletionKey:n}:e)})),linkStorageOwnerId:void 0,setLinkStorageOwnerId:t=>e({linkStorageOwnerId:t})}),{name:"app-sharing"})),l=()=>a(e=>e.chatLinkItems,i.X),s=a.getState().chatLinkItemAdd,d=a.getState().chatLinkItemChangeDeletionKey,c=a.getState().chatLinkItemRemove,u=()=>a(e=>({linkStorageOwnerId:e.linkStorageOwnerId,setLinkStorageOwnerId:e.setLinkStorageOwnerId}),i.X);function p(){return!a.getState().chatLinkItems.length}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.