1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6034],{25016:(e,t,r)=>{r.d(t,{cn:()=>u,uj:()=>x,wN:()=>d});var s=r(12115),n=r(2821),a=r(75889),o=r(81123),i=r(95704);let l=i.env.NEXT_PUBLIC_APP_CONFIG_ENDPOINT,c=i.env.SANDBOX_ID,d="theme-mode",x="(prefers-color-scheme: dark)";function u(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,a.QP)((0,n.$)(t))}(0,s.cache)(async e=>{if(l){var t;let r=null!=(t=null!=c?c:e.get("x-sandbox-id"))?t:"";try{if(!r)throw Error("Sandbox ID is required");let e=await fetch(l,{cache:"no-store",headers:{"X-Sandbox-ID":r}});if(e.ok){let t=await e.json(),s={...o.C,sandboxId:r};for(let[e,r]of Object.entries(t))null!==r&&(e in o.C&&void 0===o.C[e]||typeof s[e]===r.type&&typeof s[e]==typeof r.value)&&(s[e]=r.value);return s}console.error("ERROR: querying config endpoint failed with status ".concat(e.status,": ").concat(e.statusText))}catch(e){console.error("ERROR: getAppConfig() - lib/utils.ts",e)}}return o.C})},36034:(e,t,r)=>{r.r(t),r.d(t,{SpeechWriter:()=>x});var s=r(95155),n=r(12115),a=r(656),o=r(25126);r(50429),r(1642);var i=r(97003),l=r(31066);function c(e,t){if(!t)return e;let r=t.toLowerCase();return e.filter(e=>{var t;return e.title.toLowerCase().includes(r)||(null==(t=e.aliases)?void 0:t.some(e=>e.toLowerCase().includes(r)))})}function d(e){let t=[];for(let s of e){let e=s.content,n="";if(Array.isArray(e)&&(n=e.map(e=>"string"==typeof e.text?e.text:"").join("")),"heading"===s.type){var r;let e=(null==(r=s.props)?void 0:r.level)||2,a="#".repeat(e);t.push("".concat(a," ").concat(n))}else n?t.push(n):t.push("")}return t.join("\n")}function x(e){let{speechType:t,side:r,topic:x,flowData:u,evidenceQueue:p,embedded:h=!1,initialText:m,initialBlocknoteJson:f,onTextChange:g,onBlocknoteChange:y,editorRef:b}=e,[v,j]=(0,n.useState)(0),[C,N]=(0,n.useState)(!1),[k,w]=(0,n.useState)(!1),I=(0,n.useRef)(null),A=(0,n.useMemo)(()=>{if(f)try{return JSON.parse(f)}catch(e){}if(m){let e=m.split("\n").filter(e=>e.trim());return 0!==e.length?e.map(e=>({type:"paragraph",content:[{type:"text",text:e,styles:{}}]})):void 0}let e=l.GT[t]||[],r=[];return e.forEach(e=>{r.push({type:"heading",props:{level:2},content:[{type:"text",text:e.heading,styles:{}}]}),r.push({type:"paragraph",content:[{type:"text",text:e.placeholder,styles:{italic:!0,textColor:"gray"}}]}),r.push({type:"paragraph",content:[]})}),r.length>0?r:void 0},[t,m,f]),E=(0,a.Hx)({initialContent:A});I.current=E,b&&(b.current=E),(0,n.useEffect)(()=>{if(!E)return;let e=()=>{let e=E.document;if(j(function e(t){let r=0;for(let s of t){let t=s.content;if(Array.isArray(t))for(let e of t)"string"==typeof e.text&&(r+=e.text.split(/\s+/).filter(Boolean).length);let n=s.children;Array.isArray(n)&&(r+=e(n))}return r}(e)),g&&g(d(e)),y)try{y(JSON.stringify(e))}catch(e){}};E.onEditorContentChange(e),e()},[E,g,y]);let S=(0,n.useCallback)(async()=>{if(!E)return;let e=d(E.document);try{await navigator.clipboard.writeText(e),N(!0),setTimeout(()=>N(!1),2e3)}catch(r){let t=document.createElement("textarea");t.value=e,document.body.appendChild(t),t.select(),document.execCommand("copy"),document.body.removeChild(t),N(!0),setTimeout(()=>N(!1),2e3)}},[E]),T=(0,n.useCallback)(e=>{if(!E)return;let t=E.getTextCursorPosition();E.insertBlocks([{type:"paragraph",content:[{type:"text",text:"[".concat(e.cite||e.tag,"] "),styles:{bold:!0}},{type:"text",text:e.card||e.fulltext||"",styles:{}}]}],t.block,"after")},[E]),O=(0,n.useCallback)(async e=>{if(E&&!k){w(!0);try{var s;let n=E.getTextCursorPosition(),a=E.document,o=(null==(s=E.getSelectedText)?void 0:s.call(E))||"",i=(n.block.content||[]).map(e=>e.text||"").join(""),l=a.findIndex(e=>e.id===n.block.id),c=d(a.slice(0,l)),u=d([a[l]]),p=d(a.slice(l+1)),h="".concat(c,"\n>>> CURSOR IS HERE: ").concat(u," <<<\n").concat(p),m=await fetch("/api/debate/speech-writer/inline",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({command:e,selectedText:o||i,surroundingContext:h,speechType:t,side:r,topic:x||""})});if(!m.ok||!m.body)throw Error("AI request failed");let f=m.body.getReader(),g=new TextDecoder,y="";for(;;){let{done:e,value:t}=await f.read();if(e)break;y+=g.decode(t,{stream:!0})}if(y.trim()){let e=y.split("\n").filter(e=>e.trim()).map(e=>({type:"paragraph",content:[{type:"text",text:e,styles:{}}]}));E.insertBlocks(e,n.block,"after")}}catch(e){console.error("AI inline command failed:",e)}finally{w(!1)}}},[E,k,t,r,x]),R=(0,n.useCallback)(e=>[{title:"Expand",subtext:"Flesh out your reasoning and warrants",onItemClick:()=>O("expand"),aliases:["elaborate","develop"],group:"AI Coach"},{title:"Strengthen",subtext:"Sharpen your language and clarity",onItemClick:()=>O("strengthen"),aliases:["improve","enhance"],group:"AI Coach"},{title:"Impact",subtext:"Articulate why your point matters",onItemClick:()=>O("impact"),aliases:["weigh","significance"],group:"AI Coach"}
1,{title:"Transition",subtext:"Connect your ideas smoothly",onItemClick:()=>O("transition"),aliases:["connect","link"],group:"AI Coach"},{title:"Continue",subtext:"Finish your current thought",onItemClick:()=>O("continue"),aliases:["next","write"],group:"AI Coach"},...(0,a.HN)(e)],[O]),F=l.$u[t]||t,_="aff"===r?"AFF":"NEG",D="aff"===r?"text-green-500":"text-red-500";return h?(0,s.jsxs)("div",{className:"flex h-full flex-col",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between border-b px-3 py-2 flex-shrink-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-sm font-semibold",children:F}),(0,s.jsx)("span",{className:"text-xs font-medium ".concat(D),children:_}),(0,s.jsxs)("span",{className:"text-xs text-muted-foreground",children:[v," words"]})]}),(0,s.jsx)(i.$,{size:"sm",variant:"outline",onClick:S,className:"text-xs",children:C?"Copied!":"Copy Text"})]}),p&&p.length>0&&(0,s.jsxs)("div",{className:"border-b bg-primary/5 px-3 py-2 flex-shrink-0",children:[(0,s.jsx)("div",{className:"flex items-center gap-2 mb-1",children:(0,s.jsxs)("span",{className:"text-xs font-semibold text-primary",children:["Queued Evidence (",p.length,")"]})}),(0,s.jsx)("div",{className:"flex gap-1.5 overflow-x-auto pb-1",children:p.map(e=>(0,s.jsx)("button",{onClick:()=>T(e),className:"flex-shrink-0 rounded border border-primary/30 bg-primary/10 px-2 py-1 text-xs text-primary hover:bg-primary/20 transition-colors",title:"Click to insert: ".concat(e.tag),children:e.cite||e.tag},e.id))})]}),(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,s.jsx)(o.NP,{editor:E,theme:"light",slashMenu:!1,children:(0,s.jsx)(a.ge,{triggerCharacter:"/",getItems:async e=>c(R(E),e)})}),k&&(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 text-xs text-muted-foreground border-t",children:[(0,s.jsxs)("svg",{className:"h-3 w-3 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[(0,s.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,s.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"AI writing..."]})]})]}):(0,s.jsxs)("div",{className:"flex h-full",children:[(0,s.jsxs)("div",{className:"flex flex-1 flex-col overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between border-b px-4 py-3 flex-shrink-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[(0,s.jsxs)("h2",{className:"text-lg font-bold",children:[F," Speech Writer"]}),(0,s.jsx)("span",{className:"rounded-full px-2 py-0.5 text-xs font-bold ".concat("aff"===r?"bg-green-500/20 text-green-500":"bg-red-500/20 text-red-500"),children:_}),(0,s.jsxs)("span",{className:"text-sm text-muted-foreground",children:[v," words"]})]}),(0,s.jsx)(i.$,{onClick:S,variant:"outline",children:C?"Copied!":"Copy as Text"})]}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto px-4",children:(0,s.jsx)(o.NP,{editor:E,theme:"light",slashMenu:!1,children:(0,s.jsx)(a.ge,{triggerCharacter:"/",getItems:async e=>c(R(E),e)})})})]}),(0,s.jsxs)("div",{className:"hidden w-72 shrink-0 flex-col border-l lg:flex overflow-y-auto",children:[u&&Object.keys(u).length>0&&(0,s.jsxs)("div",{className:"border-b p-3",children:[(0,s.jsx)("h3",{className:"mb-2 text-xs font-bold uppercase tracking-wider text-muted-foreground",children:"Flow Hints"}),(0,s.jsx)("div",{className:"space-y-2",children:Object.entries(u).slice(0,10).map(e=>{let[t,r]=e;return(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:t}),r.slice(0,3).map(e=>(0,s.jsx)("div",{className:"ml-2 text-xs text-foreground",children:e.claim},e.id))]},t)})})]}),p&&p.length>0&&(0,s.jsxs)("div",{className:"p-3",children:[(0,s.jsxs)("h3",{className:"mb-2 text-xs font-bold uppercase tracking-wider text-muted-foreground",children:["Queued Evidence (",p.length,")"]}),(0,s.jsx)("div",{className:"space-y-2",children:p.map(e=>(0,s.jsxs)("button",{onClick:()=>T(e),className:"w-full rounded-lg border p-2 text-left hover:border-primary/30 transition-colors",children:[(0,s.jsx)("div",{className:"text-xs font-semibold",children:e.tag}),e.cite&&(0,s.jsx)("div",{className:"text-xs text-muted-foreground",children:e.cite}),(0,s.jsx)("p",{className:"mt-1 line-clamp-2 text-xs text-muted-foreground",children:e.card||e.fulltext}),(0,s.jsx)("span",{className:"mt-1 inline-block text-[10px] text-primary",children:"Click to insert"})]},e.id))})]}),(null==p?void 0:p.length)===0&&!u&&(0,s.jsx)("div",{className:"p-4 text-center text-xs text-muted-foreground",children:"Queue evidence from the Evidence tab to see it here."})]})]})}},81123:(e,t,r)=>{r.d(t,{C:()=>s});let s={companyName:"my-desk.ai",pageTitle:"my-desk.ai",pageDescription:"Your AI-powered personal workspace",supportsChatInput:!0,supportsVideoInput:!1,supportsScreenShare:!1,isPreConnectBufferEnabled:!0,logo:"/my-desk-logo.png",accent:"#00DFFF",logoDark:"/my-desk-logo-dark.png",accentDark:"#00DFFF",startButtonText:"Connect",sandboxId:void 0,agentName:"persona-agent"}},97003:(e,t,r)=>{r.d(t,{$:()=>o});var s=r(95155),n=r(12115),a=r(25016);let o=n.forwardRef((e,t)=>
1{let{className:r,variant:n="default",size:o="default",...i}=e;return(0,s.jsx)("button",{className:(0,a.cn)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{"bg-primary text-primary-foreground shadow hover:bg-primary/90":"default"===n,"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90":"destructive"===n,"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground":"outline"===n,"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80":"secondary"===n,"hover:bg-accent hover:text-accent-foreground":"ghost"===n,"text-primary underline-offset-4 hover:underline":"link"===n},{"h-9 px-4 py-2":"default"===o,"h-8 rounded-md px-3 text-xs":"sm"===o,"h-10 rounded-md px-8":"lg"===o,"h-9 w-9":"icon"===o},r),ref:t,...i})});o.displayName="Button"}}]);
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.