"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2373],{93643:function(e,n,t){t.d(n,{Z:function(){return g}});var r=t(85893),i=t(67294),o=t(37340),l=t(87379);function a(){let e=(0,o._)(["\n  from { background-color: rgb(0,0,0,0); }\n  to { background-color: rgb(0,0,0,0.3); }\n"]);return a=function(){return e},e}function s(){let e=(0,o._)(["\n    background-color: ",";\n    border: none;\n    box-shadow: ",";\n    max-height: 90%;\n    max-width: 90%;\n    min-height: 200px;\n    width: 900px;\n    border-radius: ",";\n    padding: 24px;\n\n    ::backdrop {\n      animation-name: ",";\n      animation-duration: 300ms;\n      background-color: rgb(0, 0, 0, 0.3);\n    }\n  "]);return s=function(){return e},e}function u(){let e=(0,o._)(["\n  ","\n"]);return u=function(){return e},e}let c=(0,l.F4)(a()),d=l.ZP.dialog(u(),e=>{let{theme:{borderRadius:n,shadow:t,white:r}}=e;return(0,l.iv)(s(),r,t,n.lg,c)});var p=t(71549),h=t(28673),f=t(68917),g=e=>{let{children:n,hideClose:t=!1,isLoading:o=!1,isOpen:l,message:a,onApply:s,onApplyLabel:u="Continue",onCancel:c,onCloseLabel:g="Cancel",title:x}=e,m=(0,i.useRef)(null),b=()=>{var e,n;null===(n=m.current)||void 0===n||null===(e=n.close)||void 0===e||e.call(n)};return(0,i.useEffect)(()=>{if(l){var e,n;null===(n=m.current)||void 0===n||null===(e=n.showModal)||void 0===e||e.call(n)}else b()},[l]),(0,r.jsx)(d,{ref:m,onClick:b,children:(0,r.jsxs)("span",{onClick:e=>{e.stopPropagation()},children:[(0,r.jsxs)(p.Cd,{children:[(0,r.jsx)(h.xv,{level:3,fontWeight:"medium",children:x}),(0,r.jsx)(p.ZR,{onClick:c||b,iconName:"icon-close",btnType:"ghost",size:"xl"})]}),(0,r.jsxs)(p.dD,{children:[a&&(0,r.jsx)(p.RQ,{level:2,children:a}),n]}),(c||s)&&(0,r.jsxs)(p.y3,{children:[!t&&(0,r.jsx)(f.zx,{label:g,onClick:c||b,btnType:"light",size:"m"}),s&&(0,r.jsx)(p.PX,{label:u,isLoading:o,onClick:s,btnType:"primary",size:"m"})]})]})})}},85839:function(e,n,t){t.d(n,{Ai:function(){return N},Bo:function(){return R},Cm:function(){return O},E0:function(){return L},FH:function(){return q},UO:function(){return E},e$:function(){return F},hP:function(){return H},he:function(){return P},jQ:function(){return B},jR:function(){return T},rI:function(){return A},uw:function(){return M},yo:function(){return D}});var r=t(37340),i=t(87379),o=t(68917),l=t(15374),a=t(4235),s=t(84175);function u(){let e=(0,r._)(["\n    display: flex;\n    align-items: center;\n    border-radius: ",";\n    opacity: ",";\n\n    padding: 0px 5px 0px 0px;\n    margin-top: 24px;\n    box-shadow: ",";\n\n    &:hover ",","," {\n      color: ",";\n    }\n    &:hover ",","," {\n      opacity: 1;\n    }\n\n    &:hover "," {\n      display: inline;\n    }\n\n    &:hover "," {\n      opacity: 1;\n    }\n  "]);return u=function(){return e},e}function c(){let e=(0,r._)(["\n  ","\n"]);return c=function(){return e},e}function d(){let e=(0,r._)(["\n  width: 100%;\n"]);return d=function(){return e},e}function p(){let e=(0,r._)(["\n  line-height: 25px;\n  display: flex;\n  justify-content: space-between;\n  width: 94%;\n"]);return p=function(){return e},e}function h(){let e=(0,r._)(["\n  display: flex;\n"]);return h=function(){return e},e}function f(){let e=(0,r._)(["\n  opacity: 0;\n  padding: 0 4px;\n"]);return f=function(){return e},e}function g(){let e=(0,r._)(["\n    width: 94%;\n    background-color: ",";\n    padding: 12px 15px;\n    border-radius: 8px;\n    font-size: 16px;\n  "]);return g=function(){return e},e}function x(){let e=(0,r._)(["\n  ","\n"]);return x=function(){return e},e}function m(){let e=(0,r._)(["\n  color: transparent;\n  cursor: grab;\n  &:active {\n    cursor: grabbing;\n  }\n"]);return m=function(){return e},e}function b(){let e=(0,r._)(["\n  color: transparent;\n  position: absolute;\n  left: -20px;\n  cursor: grab;\n  &:active {\n    cursor: grabbing;\n  }\n"]);return b=function(){return e},e}function v(){let e=(0,r._)(["\n    font-weight: ",";\n    text-decoration-color: ",";\n    padding: 0;\n    background-color: transparent;\n    width: 95%;\n    height: 20px;\n    overflow: hidden;\n  "]);return v=function(){return e},e}function w(){let e=(0,r._)(["\n  ","\n"]);return w=function(){return e},e}function y(){let e=(0,r._)(["\n      word-break: break-word;\n      white-space: break-spaces;\n\n      &:hover {\n        cursor: grab;\n        box-shadow: ",";\n      }\n    "]);return y=function(){return e},e}function k(){let e=(0,r._)(["\n    position: relative;\n    margin-top: 8px;\n    border-radius: 8px;\n    border: ",";\n    display: flex;\n    align-items: center;\n    padding: 3px;\n\n    color: ",";\n\n    ","\n\n    .highlight {\n      color: white;\n      background-color: ",";\n    }\n  "]);return k=function(){return e},e}function j(){let e=(0,r._)(["\n  ","\n"]);return j=function(){return e},e}function C(){let e=(0,r._)(["\n  object-fit: cover;\n  background: url(",") no-repeat center;\n"]);return C=function(){return e},e}function Z(){let e=(0,r._)(["\n    align-items: center;\n    flex-direction: column;\n    grid-column: span ",";\n    grid-row: span 1;\n    gap: 4px;\n    display: grid;\n    cursor: grab;\n    &:active {\n      cursor: grabbing;\n    }\n    img {\n      width: 100%;\n      height: 140px;\n    }\n  "]);return Z=function(){return e},e}function S(){let e=(0,r._)(["\n  ","\n"]);return S=function(){return e},e}function _(){let e=(0,r._)(["\n  padding: 0px;\n  margin-left: 10px;\n  display: none;\n"]);return _=function(){return e},e}function I(){let e=(0,r._)(["\n  padding: 12px 16px;\n"]);return I=function(){return e},e}let P=i.ZP.div(c(),e=>{let{isDragging:n,isHover:t,theme:{shadow:r,borderRadius:o,colors:l}}=e;return(0,i.iv)(u(),o.lg,n?0:1,t?r:"none",A,L,l.primaryBlue25p,A,L,M,R)}),D=i.ZP.div(d()),T=i.ZP.div(p()),E=i.ZP.div(h()),R=(0,i.ZP)(o.hU).attrs(e=>{let{theme:{colors:n}}=e;return{color:n.primaryBlue25p}})(f()),N=i.ZP.div(x(),e=>{let{theme:{colors:n}}=e;return(0,i.iv)(g(),n.primaryBlue5p)}),L=(0,i.ZP)(l.J)(m()),A=(0,i.ZP)(l.J)(b()),F=(0,i.ZP)(a.Kx)(w(),e=>{let{theme:{colors:n,font:t}}=e;return(0,i.iv)(v(),t.weight.bold,n.primaryBlue)}),O=i.ZP.div(j(),e=>{let{theme:{colors:n,shadow:t},isOver:r,isPlanBuilder:o}=e;return(0,i.iv)(k(),r?"1px dashed":"none",n.planText,o&&(0,i.iv)(y(),t),n.primaryBlue75p)}),B=i.ZP.img(C(),"https://app.fluint.io/loading.svg"),q=i.ZP.div(S(),e=>{let{imageAlignment:n}=e;return(0,i.iv)(Z(),"Landscape"===n?2:1)}),M=(0,i.ZP)(o.hU)(_()),H=(0,i.ZP)(s.Z)(I())},13493:function(e,n,t){t.d(n,{$3:function(){return L},C5:function(){return I},MP:function(){return N},S2:function(){return F},U3:function(){return T},Ud:function(){return S},gK:function(){return M},h1:function(){return R},iM:function(){return q},iQ:function(){return E},kx:function(){return _},mU:function(){return B},nZ:function(){return P},pD:function(){return Z},rE:function(){return O},sh:function(){return A},vw:function(){return D}});var r=t(37340),i=t(87379),o=t(96610),l=t(28673);function a(){let e=(0,r._)(["\n  background-color: #f5f5f5;\n  overflow: auto;\n  padding: 15px;\n"]);return a=function(){return e},e}function s(){let e=(0,r._)(["\n  overflow: auto;\n  padding: 8px;\n  background-color: white;\n  height: 100%;\n  display: flex;\n  flex-direction: column;\n"]);return s=function(){return e},e}function u(){let e=(0,r._)(["\n  display: flex;\n  width: 100%;\n  flex-direction: column;\n  width: 850px;\n  margin: 50px auto;\n"]);return u=function(){return e},e}function c(){let e=(0,r._)(["\n  display: flex;\n  width: 100%;\n  flex-direction: column;\n"]);return c=function(){return e},e}function d(){let e=(0,r._)(["\n  margin-bottom: 25.5px;\n"]);return d=function(){return e},e}function p(){let e=(0,r._)(["\n  display: flex;\n  justify-content: space-between;\n  margin-bottom: 24px;\n  align-items: center;\n"]);return p=function(){return e},e}function h(){let e=(0,r._)(["\n  line-height: 29px;\n  display: flex;\n"]);return h=function(){return e},e}function f(){let e=(0,r._)(["\n  white-space: pre-line;\n"]);return f=function(){return e},e}function g(){let e=(0,r._)(["\n  display: flex;\n  flex-wrap: wrap;\n  width: 100%;\n  margin-top: 48px;\n  gap: 12px;\n"]);return g=function(){return e},e}function x(){let e=(0,r._)(["\n  position: relative;\n  display: flex;\n  align-items: center;\n  flex-direction: column;\n\n  width: 216px;\n  -webkit-line-clamp: 1;\n  overflow: hidden;\n  word-break: break-word;\n\n  div {\n    width: fit-content;\n  }\n\n  img {\n    object-fit: scale-down;\n  }\n\n  &:last-child {\n    margin-right: 0;\n  }\n"]);return x=function(){return e},e}function m(){let e=(0,r._)(["\n  display: -webkit-box;\n  max-width: fit-content;\n  -webkit-line-clamp: 2;\n  -webkit-box-orient: vertical;\n  overflow: hidden;\n  align-self: center;\n  word-break: break-word;\n"]);return m=function(){return e},e}function b(){let e=(0,r._)(["\n  width: 100%;\n  height: 216px;\n  display: flex;\n  gap: 12px;\n  margin-top: 24px;\n  justify-content: center;\n  flex-direction: column;\n  align-items: center;\n  padding: 24px;\n  background: #f3f5f6;\n  border: 1px dashed #809fa8;\n  border-radius: 8px;\n  position: relative;\n"]);return b=function(){return e},e}function v(){let e=(0,r._)(["\n  position: absolute;\n  top: 0;\n  right: 0;\n"]);return v=function(){return e},e}function w(){let e=(0,r._)(["\n  display: none;\n"]);return w=function(){return e},e}function y(){let e=(0,r._)(["\n  position: absolute;\n  width: 100%;\n  height: 100%;\n  top: 0px;\n  right: 0px;\n  bottom: 0px;\n  left: 0px;\n"]);return y=function(){return e},e}function k(){let e=(0,r._)(["\n  display: flex;\n  margin: 16px 0;\n  position: relative;\n  padding: 8px 16px;\n  background: ",";\n  border-radius: 8px;\n"]);return k=function(){return e},e}function j(){let e=(0,r._)(["\n  position: absolute;\n  top: 0;\n  right: 0;\n  i {\n    color: ",";\n  }\n"]);return j=function(){return e},e}function C(){let e=(0,r._)(["\n  display: flex;\n  flex-direction: column;\n\n  span:first-child {\n    font-weight: 700;\n    margin-bottom: 4px;\n  }\n\n  span {\n    color: ",";\n  }\n"]);return C=function(){return e},e}let Z=i.ZP.div(a()),S=i.ZP.div(s()),_=i.ZP.div(u()),I=i.ZP.div(c());(0,i.ZP)(l.Dx)(d());let P=i.ZP.div(p()),D=(0,i.ZP)(l.Dx)(h()),T=(0,i.ZP)(l.Dx)(f()),E=i.ZP.div(g()),R=i.ZP.div(x()),N=(0,i.ZP)(l.xv)(m()),L=i.ZP.div(b()),A=(0,i.ZP)(o.Z)(v()),F=i.ZP.input(w()),O=i.ZP.div(y()),B=i.ZP.div(k(),e=>{let{theme:n}=e;return n.colors.primaryRed25p}),q=(0,i.ZP)(o.Z)(j(),e=>{let{theme:n}=e;return n.colors.primaryRed}),M=i.ZP.div(C(),e=>{let{theme:n}=e;return n.colors.primaryRed})},12373:function(e,n,t){t.d(n,{Z:function(){return em}});var r=t(85893),i=t(67294),o=t(49264),l=t(75316),a=t(15948),s=t(99272),u=t(85839),c=t(82580),d=t(38533),p=t(76053),h=t(55817);let{Quill:f}=t(71167);var g=e=>{let{id:n,trigger:t,index:o,noteId:l,question:a,onDelete:g,onChange:x,answer:m=[],getCustomInsight:b,onDrop:v,getInsight:w}=e,[y,k]=(0,i.useState)(!1),[j,C]=(0,i.useState)(""),[Z,S]=(0,i.useState)(!1),_=(0,d.N)(j,1e3),[I,P]=(0,i.useState)(!1),[D,T]=(0,i.useState)(!1);(0,i.useEffect)(()=>{E.handleSubmit()},[_]);let E=(0,c.TA)({enableReinitialize:!0,initialValues:{title:a,note:m},onSubmit:e=>{x(o,e)}});(0,i.useEffect)(()=>{{let e=document.getElementById("answer-id-".concat(n)),t=new f(e,{modules:{toolbar:["bold","italic","underline",{list:"bullet"},{list:"ordered"},{background:"Yellow"},"clean"]},placeholder:"Add note here...",theme:"bubble"});t.setContents(m);let r=JSON.stringify(t.getContents().ops);j!==r&&C(r),t.on("text-change",()=>{let e=t.getContents(),n=JSON.stringify(e.ops);n.includes("/loading.svg")?console.log("Skipping update...."):C(n),E.setFieldValue("note",e.ops)}),t.on("selection-change",()=>{if(e){let n=e.querySelector(".ql-tooltip");if(n){let e=n.style.left;e&&0>parseFloat(e=e.replace("px",""))&&(n.style.left="0px")}}})}},[t,a,m.length]);let[{isOver:R},N]=(0,s.L)(()=>({accept:"transcribe",drop:()=>({index:o,noteId:l}),collect:e=>({isOver:e.isOver()})})),L=async e=>{S(!1),P(!0);let t=f.find(document.getElementById("answer-id-".concat(n))),r=t.getText(),i=t.root.innerHTML;if(console.log(r.length),r.length>1e4){t.root.innerHTML=i+"<br /><b>Whoops! <br />Your text is too long, we need it to be less than 10000 characters to perform our magic.</b>",P(!1);return}t.root.innerHTML='<img height="75px" width="75px" alt="loading-anm" style="display: block; margin-left: auto; margin-right: auto;" src="/loading.svg" />',b(e,r).then(e=>{if(e.ok){let n=setInterval(function(){console.log("".concat(e.data.id," => status")),w(e.data.id).then(e=>{"complete"==e.data.status&&(clearInterval(n),A(e,t,i))}).catch(()=>{clearInterval(n),A(e,t,i)})},3e3)}else A(e,t,i)}).catch(()=>{t.root.innerHTML=i+"<br /><b>Whoops, we hit an error. Sorry about that. We most likely need more text to work with.</b>",P(!1)})},A=(e,n,t)=>{if(e.ok&&e.data){var r;n.root.innerHTML=t+"<b>"+(null===(r=e.data)||void 0===r?void 0:r.text)+"</b>"}else n.root.innerHTML=t+"<br /><b>Whoops, we hit an error. Sorry about that. We most likely need more text to work with.</b>";P(!1)},F=[{title:"Improve Clarity",prompt:"Improve the clarity of this text"},{title:"Make Shorter",prompt:"Communicate this message with less text"},{title:"Make Longer",prompt:"Develop this text with additional related content"},{title:"Summarize",prompt:"Summarize this text for an executive"}].map((e,n)=>(0,r.jsx)(u.hP,{onClick:()=>L(e.prompt),value:e.title,children:e.title},"workspace-items-".concat(n)));return(0,r.jsxs)(u.he,{isHover:y,children:[(0,r.jsx)(u.E0,{onMouseEnter:()=>{let e=document.getElementById("answer-id-".concat(n)),t=window.getSelection();null==t||t.removeAllRanges(),null==e||e.blur(),k(!0)},onMouseLeave:()=>k(!1),level:4,name:"icon-drag"}),(0,r.jsxs)(u.yo,{children:[(0,r.jsxs)(u.jR,{children:[(0,r.jsx)(u.e$,{scaleHeight:!0,value:E.values.title,handleChange:E.handleChange("title"),handleBlur:()=>{E.handleSubmit()},placeholder:"Question"}),(0,r.jsx)(u.UO,{children:(0,r.jsx)(u.Bo,{size:"xl",iconName:"icon-trash",onClick:()=>{T(!0)},btnType:"ghost"})})]}),(0,r.jsxs)(u.Cm,{ref:N,isOver:R,children:[(0,r.jsx)(u.Ai,{id:"answer-id-".concat(n),className:"answer-dnd",onDrop:v}),!1==I?(0,r.jsx)(u.uw,{onClick:()=>{S(!0)},size:"xl",btnType:"ghost",iconName:"icon-magic-wand"}):(0,r.jsx)(r.Fragment,{}),(0,r.jsx)(p.Z,{open:Z,width:"175px",right:"45px",onClickAway:()=>S(!1),children:F})]})]}),(0,r.jsx)(h.GI,{isOpen:D,title:"Delete Note?",description:"You are about to permanently delete this note!\n\n        Do you wish to continue?",onClose:()=>{T(!1)},onApplyLabel:"Continue",onCloseLabel:"Cancel",onApply:()=>{g(o),T(!1)},onCancel:()=>{T(!1)}})]})},x=e=>{let{index:n,trigger:t,noteId:i,onDelete:o,onChange:l,question:a,notes:s,getCustomInsight:u,getInsight:c,onDrop:d}=e;return(0,r.jsx)(g,{id:"question-".concat(a.position),noteId:i,trigger:t,notes:s,index:n,onChange:l,onDelete:o,answer:a.notes,question:a.question,getCustomInsight:u,onDrop:d,getInsight:c})},m=e=>{let{trigger:n,noteId:t,noteName:o="",onDelete:s,onMove:u,onChange:c,onChangeName:d,onAdd:p,notes:h,getCustomInsight:f,onDrop:g,getInsight:m}=e,[b,v]=(0,i.useState)(o),[w,y]=(0,i.useState)(h);(0,i.useEffect)(()=>{v(o)},[o]),(0,i.useEffect)(()=>{y(h)},[h]);let k=(e,n,t)=>{e.preventDefault(),g(n,e.dataTransfer.getData("text"),t)},j=w.map((e,i)=>(0,r.jsx)(a._l,{draggableId:"question-".concat(i),index:i,children:o=>(0,r.jsx)("div",{ref:o.innerRef,...o.draggableProps,...o.dragHandleProps,children:(0,r.jsx)(x,{trigger:n,noteId:t,notes:h,index:i,question:e,onChange:c,onDelete:s,getCustomInsight:f,onDrop:e=>k(e,t,i),getInsight:m},"question-".concat(i))})},"question-".concat(i))),C=(0,i.useRef)(null),Z=async()=>{var e;await p(),null===(e=C.current)||void 0===e||e.scrollIntoView({behavior:"smooth"})};return(0,r.jsx)(l.W2,{children:(0,r.jsxs)(l.l0,{children:[(0,r.jsx)(l.iZ,{children:(0,r.jsx)(l.cC,{value:b,placeholder:"Untitled Notes",fontSize:24,handleChange:e=>v(e),handleBlur:()=>d(b),type:"text"})}),(0,r.jsxs)(l.rW,{children:[(0,r.jsx)(a.Z5,{onDragEnd:e=>{if(!e.destination||e.source.droppableId===e.destination.droppableId&&e.source.index===e.destination.index)return;let[n]=w.splice(e.source.index,1);w.splice(e.destination.index,0,n),w&&u(w)},children:(0,r.jsx)(a.bK,{droppableId:"droppable",children:e=>(0,r.jsxs)("div",{...e.droppableProps,ref:e.innerRef,children:[(0,r.jsxs)(l.Li,{children:[j,(0,r.jsx)("div",{ref:C})]}),e.placeholder]})})}),(0,r.jsx)("div",{children:(0,r.jsx)(l.z8,{btnType:"primary",leftIcon:"icon-add",label:"Add Topic",onClick:Z,size:"m"})})]})]})})},b=t(5035),v=t(14246),w=e=>{let{workspaceId:n,notesId:t}=e,[l,a]=(0,i.useState)([]),[s,u]=(0,i.useState)(!1),[c,d]=(0,i.useState)(!0),[p,h]=(0,i.useState)({id:"",title:"",isTemplate:!1,notes:[]});(0,i.useEffect)(()=>{c&&(d(!1),u(!0),o.b.getWorkspaceNotesTemplate(n).then(e=>{e.ok&&e.data&&(h({...e.data}),a(e.data.notes),u(!1))}))},[c]);let f=async(e,n,t)=>{var r;let i=JSON.parse(JSON.stringify(l)),s=i[t].notes;(null===(r=s[0])||void 0===r?void 0:r.insert)==="\n"&&1===s.length&&s.shift();let u=s[s.length-1];(null==u?void 0:u.insert)!=="\n"&&s.length>0&&s.push({insert:"\n",attributes:{}}),s.push({insert:n,attributes:{}}),a(i);let c=g(l);await o.b.putNote(e,{notes:c})},g=e=>e.map((e,n)=>({question:e.question,notes:e.notes,position:n+1})),x=async(e,n)=>await o.b.getCustomInsights(e,n),w=async e=>await o.b.getInsight(e);return s?(0,r.jsx)(b.Z,{height:"300px",width:"300px"}):(0,r.jsx)(m,{trigger:!1,workspaceId:n,noteId:t,noteName:p.title,notes:l,onDrop:f,onChangeName:e=>{h(n=>({...n,title:e})),o.b.putNote(p.id,{title:e}),d(!0)},onChange:(e,n)=>{l[e].question=n.title,l[e].notes=n.note,l[e].position=e+1;let t=g(l);(0,v.L9)("workspace-update",{"workspace-id":"workspace.id","workspace-title":"workspace.title"}),o.b.putNote(p.id,{notes:t})},onMove:e=>{let n=g(e);a(n),o.b.putNote(p.id,{notes:n})},onAdd:()=>{l.push({question:"New Question",notes:[],position:l.length+1}),o.b.putNote(p.id,{notes:l}).then(()=>{d(!0)})},onDelete:e=>{l.splice(e,1);let n=g(l);o.b.putNote(p.id,{notes:n}).then(()=>{d(!0)})},getCustomInsight:x,getInsight:w})},y=t(10969),k=t(5152),j=t.n(k),C=t(28673),Z=t(55678),S=t(13493),_=t(3250),I=t(41128);function P(e){let n=new DOMParser().parseFromString(e,"text/html");return n.querySelectorAll(".suggestion").forEach(e=>{if(e.removeAttribute("class"),!e.getAttribute("style")){let t=n.createTextNode(e.textContent||"");e.replaceWith(t)}}),n}let D=j()(()=>Promise.all([t.e(1536),t.e(9601),t.e(7767),t.e(3714),t.e(3905),t.e(9779),t.e(9431)]).then(t.bind(t,79779)),{loadableGenerated:{webpack:()=>[79779]},ssr:!1});var T=e=>{let{plan:n,onChangePlan:t,branding:o,editorHeight:l,editorWidth:a,editable:s,inlineInsights:u,onKeyDown:c,setIsAwaitingSave:p=()=>{}}=e,[h,f]=(0,i.useState)(""),g=(0,d.N)(h,250),[x,m]=(0,i.useState)(!1),[b,w]=(0,i.useState)([]),{setHtmlToAnalyze:k}=(0,_.q)();return(0,i.useEffect)(()=>{if(void 0!==g){let e=P(g).body.innerHTML;if(k(e),x){let r=I.Kl.encode(e);if(r!==n.planFile){let e={"plan-id":n.id||"","plan-title":n.title||""};(0,v.L9)("workspace-update",e),t(r)}}}},[g]),(0,i.useEffect)(()=>{void 0!==n.planFile&&""!==n.planFile&&f(I.Kl.decode(n.planFile)),n&&m(!0)},[]),(0,i.useEffect)(()=>{b.length>0&&b.map(e=>{Z.Am.error((0,r.jsx)(S.mU,{children:(0,r.jsxs)(S.gK,{children:[(0,r.jsx)(C.xv,{level:2,children:e.title}),(0,r.jsx)(C.xv,{level:2,children:e.message})]})},"errorMedia"+e.message),{position:Z.Am.POSITION.TOP_LEFT,icon:!1,onClose:()=>w([])})})},[b]),(0,r.jsx)(y.T_,{justifyContent:"center",children:(0,r.jsx)(y.pF,{children:(0,r.jsx)(D,{height:l||"90vh",width:a||"800px",value:h,onChange:e=>{f(e),p(!0)},branding:o,inlineInsights:void 0===u||u,editable:s,onKeyDown:e=>{c&&c(e)}})})})},E=t(79469),R=t(11163),N=t(69090),L=t(58977),A=t(73935),F=t(77657),O=t(39332),B=e=>{let{planId:n,branding:t,editorHeight:l,editorWidth:a,editable:s,inlineInsights:u}=e,[c,d]=(0,i.useState)(),[p,h]=(0,i.useState)(!1),{documentId:f}=(0,R.useRouter)().query,{contentId:g}=(0,O.useParams)(),x=g||f,m="current_doc_".concat(x),v=(0,i.useContext)(E.Yc),{updatePlanDocumentPlanId:w,selectedDocument:y,setIsEditingId:k,setIsSavingId:j}=(0,L.h)(),C=(0,i.useRef)(),Z=(0,i.useRef)(),S=(0,i.useRef)(),_=document.getElementById(F.P),[I,P]=(0,i.useState)(!1),[D,B]=(0,i.useState)(),[q,M]=(0,i.useState)(!1);(0,i.useEffect)(()=>{h(!0),o.b.getPlanById(n).then(e=>{if(e.ok&&e.data){let{data:n}=e,{id:t,title:r,planFile:i,isTemplate:o,templateId:l,workspaceTitle:a}=n;d({id:t,title:r,planFile:i||"",isTemplate:o||!1,templateId:l||void 0,workspaceTitle:a||""}),S.current=i,h(!1)}})},[n]);let H=null==c?void 0:c.id,z=(0,N.gk)(N.y.COLLABORATE),W=(0,i.useCallback)(async e=>{if(H){B(""),M(!0),z&&y&&j(null==y?void 0:y._id);let t=await o.b.createDocumentRevision(H,{kind:"PlanDocument",content:{planFile:e}});if(t.ok&&t.data?(d(t.data),S.current=e,sessionStorage.removeItem(m),P(!1)):B("Failed to save changes, click to retry and look for the save confirmation."),M(!1),null==v||v.fetchWorkspaceDocumentRevisions(x),z&&y){var n;w(y._id,null===(n=t.data)||void 0===n?void 0:n.id),j()}}},[H,z,y,j,d,S,m,v,x,w]),U=(0,i.useCallback)(()=>{if(B(""),Z.current){clearTimeout(Z.current);let e=sessionStorage.getItem(m);if(e){let{planFile:n}=JSON.parse(e);W(n)}}},[W]);if((0,i.useEffect)(()=>U,[U]),p||!c)return(0,r.jsx)(b.Z,{height:"300px",width:"300px"});let G={plan:c,onChangePlan:e=>{if(Z.current&&clearTimeout(Z.current),S.current===e){sessionStorage.removeItem(m);return}P(!0);let n={planFile:e,timeOfStore:new Date().toISOString()};sessionStorage.setItem(m,JSON.stringify(n)),Z.current=setTimeout(()=>{W(e)},5e3)},workspaceID:"",workspaceName:"",branding:t,editorHeight:l,editorWidth:a,editable:s,inlineInsights:void 0===u||u,setIsAwaitingSave:P};return(0,N.gk)(N.y.COLLABORATE)&&(G.onKeyDown=()=>{k(null==y?void 0:y._id),C.current&&clearTimeout(C.current),C.current=setTimeout(()=>{k()},2e3)}),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(T,{...G}),!!_&&(0,A.createPortal)((0,r.jsx)(F.Z,{handleForceSave:U,isSavePending:I,isSaving:q,saveError:D}),_)]})},q=t(42444),M=t(93643),H=t(16414);let z="addFreeformDocument",W=[];var U=()=>{let e=(0,R.useRouter)(),[n,t]=(0,H._)("onboardingStepsCompleted",W),i=n.includes(z),o="true"===e.query.onboarding&&!i,l=()=>{t(e=>[...e,z]),e.push({pathname:e.pathname,query:{...e.query,onboardingStep:"generate-business-case"}})};return(0,r.jsx)(M.Z,{hideClose:!0,isOpen:o,message:"Don’t worry about the formatting, and Fluint will auto-save your inputs. \n\nNext, hit the *“+ New Document”* button in the top right to head to the 1-Click Business Case option.",onApply:l,onApplyLabel:"Lets go!",onCancel:l,title:"Copy & paste your full transcript here."})};let G=j()(()=>Promise.all([t.e(1536),t.e(9601),t.e(7767),t.e(3714),t.e(3905),t.e(9779),t.e(9431)]).then(t.bind(t,79779)),{loadableGenerated:{webpack:()=>[79779]},ssr:!1});var K=e=>{let{documentId:n,branding:t,editorHeight:l,editable:a,editorWidth:s}=e,[u,c]=(0,i.useState)(!1),[p,h]=(0,i.useState)(""),[f,g]=(0,i.useState)(!1),[x,m]=(0,i.useState)(!1),v=(0,R.useRouter)(),w=(0,i.useContext)(E.Yc),k="true"===v.query.onboarding,j="generate-business-case"===v.query.onboardingStep,C=(0,d.N)(p,1e3),{setHtmlToAnalyze:Z}=(0,_.q)(),S=async e=>{let{content:t,kind:r}=e;await o.b.createDocumentRevision(n,{kind:r,content:{content:t}}),null==w||w.fetchWorkspaceDocumentRevisions(n),m(!0)};(0,i.useEffect)(()=>{if(u||!f)return;let e=P(p).body.innerHTML;Z(e),S({content:I.lD.encode(e),kind:"FreeformDocument"})},[C]),(0,i.useEffect)(()=>{c(!0),o.b.getDocumentById(n).then(e=>{e.ok&&e.data&&("FreeformDocument"===e.data.kind&&"string"==typeof e.data.content&&e.data.content.length>0&&h(I.lD.decode(e.data.content)),g(!0),c(!1))})},[n]);let D=e=>{h(e)};return u||!f?(0,r.jsx)(b.Z,{height:"300px",width:"300px"}):(0,r.jsxs)(y.T_,{justifyContent:"center",children:[(0,r.jsx)(y.pF,{children:(0,r.jsx)(G,{height:l||"90vh",width:s||"800px",value:p||"",onChange:e=>{D(e)},branding:t,inlineInsights:!0,editable:a})}),(0,r.jsx)(U,{}),x&&k&&j&&(0,r.jsx)(q.u,{id:"new-document-button",isOpen:!0,style:{maxWidth:"200px"},children:"Click here to continue onboarding."})]})},J=t(17486);let Q=j()(()=>Promise.all([t.e(1536),t.e(9601),t.e(7767),t.e(3714),t.e(3905),t.e(9779),t.e(9431)]).then(t.bind(t,79779)),{loadableGenerated:{webpack:()=>[79779]},ssr:!1});var Y=e=>{let{document:n}=e,{planId:t}=n||{},[l,a]=i.useState(null),[s,u]=i.useState(!1);return(0,i.useEffect)(()=>{t&&!s&&(u(!0),o.b.getPlanById(t).then(e=>{if(e.ok&&e.data&&e.data.planFile){let{planFile:n}=e.data;a(I.Kl.decode(n))}u(!1)}).catch(e=>{console.error(e),u(!1)}))},[t]),s?(0,r.jsx)(b.Z,{width:"300px",height:"300px"}):(0,r.jsx)(Q,{value:l||"",editable:!1})};let $=j()(()=>Promise.all([t.e(1536),t.e(9601),t.e(7767),t.e(3714),t.e(3905),t.e(9779),t.e(9431)]).then(t.bind(t,79779)),{loadableGenerated:{webpack:()=>[79779]},ssr:!1}),V=e=>{let{isLoading:n,document:t}=e;return n?(0,r.jsx)(b.Z,{width:"300px",height:"300px"}):(0,r.jsx)($,{value:I.lD.decode((null==t?void 0:t.content)||""),editable:!1})};var X=t(80822),ee=t(42084);let en=j()(()=>Promise.all([t.e(9967),t.e(4897),t.e(7097),t.e(24)]).then(t.bind(t,10024)),{loadableGenerated:{webpack:()=>[10024]},ssr:!1});var et=e=>{let{content:n,editable:t,id:i,status:o}=e,l=!(0,R.useRouter)().pathname.includes("collaborate");return(0,r.jsxs)(X.Z,{width:"100%",position:"relative",children:[(0,r.jsx)(en,{content:n,editable:t,status:o,id:i}),l&&(0,r.jsx)(ee.Z,{})]})},er=t(82412),ei=t(74094),eo=t(46901),el=t(82607),ea=e=>{var n;let[t,l]=(0,i.useState)(""),[a,s]=(0,i.useState)(!1),u=null===(n=e.document)||void 0===n?void 0:n._id,c=(0,i.useCallback)(async()=>{if(!u)return;s(!1);let e=await o.b.getDocumentContent(u);e.ok&&e.data&&200===e.status&&l(e.data||""),s(!0)},[u]);if((0,i.useEffect)(()=>{c()},[c]),!a)return(0,r.jsx)(b.Z,{width:"200",height:"200"});if(!t)return(0,r.jsx)(X.Z,{display:"grid",gridTemplateRows:"auto 1fr",width:"100%",children:(0,r.jsx)(eo.Z,{severity:"error",children:(0,r.jsxs)(X.Z,{display:"flex",justifyContent:"center",children:["Error retrieving old document.",(0,r.jsx)(el.Z,{onClick:c,sx:{ml:1},children:"Click to try to fetch again."})]})})});let d=e.document;return(0,r.jsx)(ei.Z,{initialContent:t,editable:!0,organizationId:d.organizationId,status:"HTML_GENERATED",id:d._id,workspaceId:d.workspaceId})},es=t(21114),eu=t(59486),ec=t(85070),ed=t(99051),ep=t(29527),eh=t(29191),ef=e=>{let{doc:n}=e,t=(0,eu.$c)({schema:es.f,collaboration:{fragment:n.getXmlFragment("document-store"),user:{name:"Revisions",color:"#000000"},provider:"yjs"}});return(0,r.jsx)(eh.L6,{editor:t,editable:!1,id:"revision-viewer",theme:"light",emojiPicker:!1,slashMenu:!1,formattingToolbar:!1,style:{position:"relative"}})},eg=t(48764).Buffer,ex=e=>{let{document:n}=e,t=(0,eu.$c)({schema:es.f}),[l,a]=(0,i.useState)(),[s,u]=(0,i.useState)(!0),c=(0,R.useRouter)().query.contentId,{reset:d,setAlertProps:p}=(0,ec.HK)(),[h,f]=(0,i.useState)();return((0,i.useEffect)(()=>{let e=async e=>{d(),u(!0);let n=await o.b.getRevisionsHtmlForBlockNoteDocument({documentId:c,revisionId:e});n.ok&&n.data?a(n.data):p({children:"Failed to load revision",severity:"error"}),u(!1)};(null==n?void 0:n._id)&&c&&t&&e(n._id)},[c,n._id,t,d,p]),(0,i.useEffect)(()=>{if(l&&t){let e=new ep.QW,n=eg.from(l,"base64"),t=new Uint8Array(n);ep.NG(e,t),f(e)}},[t,l]),s)?(0,r.jsx)(ed.Z,{}):(0,r.jsx)(X.Z,{maxWidth:800,sx:{"& div":{fontFamily:"Montserrat !important"}},children:h&&(0,r.jsx)(ef,{doc:h})})},em=e=>{let n=(0,er.U)("collaborate_editable"),{document:t,workspaceId:i,branding:o,splitScreenMode:l,editable:a,inlineInsights:s,viewerWidth:u}=e,c=(0,er.U)("blocksMigration"),d="true"===(0,R.useRouter)().query.edit;if((null==t?void 0:t.kind)=="NotesDocument"&&"notesId"in t&&t.notesId)return(0,r.jsx)(w,{workspaceId:i,notesId:t.notesId});if((null==t?void 0:t.kind)=="PlanDocument"&&t.planId)return(0,r.jsx)(B,{planId:t.planId,branding:o,editorHeight:l?"82vh":"89vh",editorWidth:u,editable:a,inlineInsights:void 0===s||s});if((null==t?void 0:t.kind)=="FreeformDocument")return(0,r.jsx)(K,{documentId:t._id,branding:o,editorHeight:l?"82vh":"89vh",editorWidth:u,editable:a});if((null==t?void 0:t.kind)=="SpreadsheetDocument")return(0,r.jsx)(J.Z,{documentId:t._id,branding:o,editorHeight:l?"750px":"830px",editorWidth:u,editable:a});if((null==t?void 0:t.kind)==="PlanDocumentRevision")return(0,r.jsx)(Y,{document:t});if((null==t?void 0:t.kind)==="FreeformDocumentRevision")return(0,r.jsx)(V,{document:t,isLoading:!1});if(((null==t?void 0:t.kind)==="BlocksDocument"||(null==t?void 0:t.kind)==="GeneratedBlocksDocument")&&(null==t?void 0:t.status)!=="HTML_GENERATED")return!(0,N.gk)(N.y.COLLABORATE)&&c?(0,r.jsx)(ea,{...e}):(0,r.jsx)(et,{content:t.content,editable:!(0,N.gk)(N.y.COLLABORATE),status:t.status,id:t._id});let p=(null==t?void 0:t.kind)==="BlockNote",h=(null==t?void 0:t.kind)==="BlocksDocument"&&(null==t?void 0:t.status)==="HTML_GENERATED";return p||h?(0,r.jsx)(ei.Z,{initialContent:t.content||"",editable:(0,N.gk)(N.y.COLLABORATE)?n&&a&&d:a,organizationId:t.organizationId,status:t.status,id:t._id,workspaceId:t.workspaceId}):(null==t?void 0:t.kind)==="BlockNoteRevision"?(0,r.jsx)(ex,{document:t}):null}},77657:function(e,n,t){t.d(n,{P:function(){return d}});var r=t(85893),i=t(98456),o=t(11057),l=t(34386),a=t(93946),s=t(58703),u=t(62177),c=t(10258);let d="save-indicator-container";n.Z=e=>{let{handleForceSave:n,isSaving:t,saveError:d,isSavePending:p}=e;if(t)return(0,r.jsx)(i.Z,{size:20});if(d){let e=(0,r.jsx)(o.Z,{color:"secondary",size:"small",onClick:n,children:"Retry"});return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.Z,{title:d,arrow:!0,children:(0,r.jsx)(a.Z,{onClick:n,children:(0,r.jsx)(u.Z,{color:"error"})})}),(0,r.jsx)(s.Z,{action:e,open:!!d,message:d})]})}return p?(0,r.jsx)(a.Z,{onClick:n,children:(0,r.jsx)(c.Z,{color:"warning"})}):(0,r.jsx)(l.Z,{title:"Saved",arrow:!0,children:(0,r.jsx)(c.Z,{color:"success"})})}},79469:function(e,n,t){t.d(n,{Yc:function(){return l}});var r=t(85893),i=t(67294),o=t(49264);let l=(0,i.createContext)(null);n.ZP=e=>{let{children:n,view:t,selectedRevision:a}=e,[s,u]=(0,i.useState)(null),[c,d]=(0,i.useState)(a||null),[p,h]=(0,i.useState)(t||""),f=async e=>{try{let n=await o.b.getRevisionsForWorkspaceDocument(e);n.ok&&n.data&&u(n.data)}catch(e){console.error(e)}};return(0,r.jsx)(l.Provider,{value:{revisions:s,view:p,selectedRevision:c,setRevisions:u,setView:h,setSelectedRevision:d,fetchWorkspaceDocumentRevisions:f},children:n})}}}]);