PageSourceSearch

https://eyefortin-drops-zqfgbmh.gamma.site/_next/static/chunks/5641-976b61f2ff508e90.js

js eyefortin-drops-zqfgbmh.gamma.site collected 2026-10-03 04:08:35 UTC 55,972 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5641],{90980:function(e,t,a){a.d(t,{H:function(){return u}});var n=a(52322),r=a(29117),s=a(19376),o=a(77533),i=a(54933),l=a(49929),c=a(94523),d=a(5879);let u=e=>{let{charCount:t,max:a,shouldShow:u,units:m,...g}=e,p=t>a?(0,n.jsx)(d.cC,{id:"YEfcBv"}):(0,n.jsx)(d.cC,{id:"ZSr/Fa"});return(0,n.jsx)(c.kH,{label:u?p:"",placement:"top",children:(0,n.jsxs)(r.U,{p:1,px:2,borderRadius:"md",display:"inline-flex",bg:t>a?"red.200":t>=.9*a?"orange.200":"transparent",color:t>a?"red.700":t>=.9*a?"orange.700":"gray.600",fontSize:"sm",cursor:"help",zIndex:1,opacity:u?1:0,transitionProperty:"common",transitionDuration:"normal",borderWidth:"1px",borderColor:t>a?"red.300":t>=.9*a?"orange.300":"transparent",...g,children:[t>a?(0,n.jsx)(l.G,{icon:i.ik8}):(0,n.jsx)(s.D,{value:t/a*100,color:"blackAlpha.700",trackColor:"blackAlpha.200",thickness:"12px",size:4}),(0,n.jsxs)(o.x,{children:[t,"/",a,m?" ".concat(m):""]})]})})}},39486:function(e,t,a){a.d(t,{Nl:function(){return f},m3:function(){return y},c1:function(){return h}});var n=a(95993),r=a(41774),s=a(22537),o=a(6501);class i extends n.GJ{constructor(e,t){super({transform:async(t,a)=>{if("data"!==t.event){a.enqueue(t);return}let{data:n}=t,r=await (0,o.sj)(n,{cardIndex:this.index,docFormatKey:e.docFormatKey,imageOptions:e.imageOptions,loadImages:!e.lazyImages,theme:e.theme}),s={index:this.index,cardComplete:!0,content:r,id:r.attrs.id,raw:n};a.enqueue({id:t.id,event:"data",data:s}),this.index++}}),this.index=0,null!=t&&(this.index=t+1)}}let l=e=>{let t=e.match(/(<[^>]+>|<\/[^>]+>)|\S+/g);if(!t)throw Error("Could not parse tokens");return t};class c extends n.GJ{constructor(e){super({transform:async(t,a)=>{if("data"!==t.event){a.enqueue(t);return}let n=t.data,r=performance.now()-this.startTime,s=l(n.raw);e({index:this.index,duration:r,numTokens:s.length}),this.index++,this.startTime=performance.now(),a.enqueue(t)}}),this.index=0,this.startTime=performance.now()}}class d extends n.GJ{constructor(){super({transform:async(e,t)=>{"done"===e.event||"cancel"===e.event?t.enqueue({...e,content:this.content}):(this.content+=e.data.raw||"",t.enqueue(e))}}),this.content=""}}class u extends n.GJ{constructor(){let e=(e,t)=>{for(;;){let a=this._buffer.match(/<section\b[^>]*>(?:(?!<\/?section\b)[\s\S])*<\/section>/i);if(!a)break;let n=a[0],r=a.index;this._buffer=this._buffer.slice(r+n.length);let s=n+"\n\n";e.enqueue({id:t,event:"data",data:s})}};super({transform:async(t,a)=>{if("data"===t.event){if(!t.data)return;this._buffer+=t.data,e(a,t.id);return}this.lastId=t.id,a.enqueue(t)},flush:async t=>{e(t,this.lastId)}}),this._buffer=""}}class m extends n.GJ{constructor(){super({transform(e,t){if("done"===e.event){t.enqueue({id:e.id,event:"done",finishReason:e.data,content:""});return}if("cancel"===e.event){t.enqueue({id:e.id,event:"cancel",content:""});return}if("content"===e.event){t.enqueue({id:e.id,event:"data",data:e.data});return}console.error("[StreamMessageEventParser] unknown event type",e)}})}}var g=a(1010);let p="CANCEL",h=e=>new n.GJ({transform(t,a){e(t),a.enqueue(t)}}),f=e=>{let{stream:t,docId:a,lastCompletedCardId:n,lastCompletedCardIndex:o,interactionId:i,options:l,store:c}=e,d=x(t,l,o),[u,m]=d.tee(),p=u.pipeThrough(h(e=>{"done"===e.event&&s.a.trackStreamResponse(c,{interactionId:i,outputContent:e.content})}));(0,g.GO)(p,{}),c.dispatch((0,r.kO)({stream:{id:i,status:"running",stream:m,docId:a,isResuming:!0,lastCompletedCardId:n}}));let f=(0,r.oH)(a)(c.getState());if(!f)throw Error("Expected valid StreamResponse when resuming from stream");return f},y=e=>{let t,{stream:a,onCancel:n,interactionId:o,options:i,bufferCards:l=2,docId:d,store:u}=e,m=x(a,i),[f,y]=m.tee(),k=f.pipeThrough(new c(e=>{u.dispatch((0,r.Ms)({interactionId:o,data:e}))})).pipeThrough(h(e=>{"done"===e.event&&s.a.trackStreamResponse(u,{interactionId:o,outputContent:e.content})}));u.dispatch((0,r.kO)({stream:{id:o,status:"running",stream:y,isResuming:!1,docId:d}}));let b=new Promise((e,a)=>{t=a;let n=[];(0,g.GO)(k,{onError:e=>{a(e)},onMessage(t){if("done"===t.event){e({status:"READY",cards:n});return}if("data"===t.event){let a=t.data.index+1;n.push(t.data),a>=l&&e({status:"READY",cards:n})}}})}).catch(e=>{if(e===p)return{status:"CANCELED",cards:[]};throw e}),w=!1;return{promise:b,cancel:()=>{w||(console.log("[AIStream] cancelling..."),w=!0,n(),null==t||t(p))}}},x=(e,t,a)=>e.pipeThrough(new m).pipeThrough(new u).pipeThrough(new i(t,a)).pipeThrough(h(e=>{"data"===e.event&&console.log("[AIStream] processed card ".concat(e.data.index+1))})).pipeThrough(new d).pipeThrough(h(e=>{"done"===e.event&&console.log("[AIStream] done (".concat(e.finishReason,")")),"cancel"===e.event&&console.log("[AIStream] cancelled")}))},22537:function(e,t,a){a.d(t,{a:function(){return i}});var n=a(1163),r=a(36651),s=a(31490),o=a(41774);let i={trackRequestSent(e,t){console.log("[AIStream] EVENT: ai.request.sent"),t.product=(0,n.K9)((0,r.rW)()),(0,s.hq)(t);let a=performance.now();e.dispatch((0,o.Jh)({...t,startTime:a}))},trackStreamError(e,t){e.dispatch((0,o.fj)({endTime:performance.now(),interactionId:t.interactionId}));let a=(0,o.Sn)(t.interactionId)(e.getState());if(!a)return;let{startTime:n,...r}=a,{errorName:i,errorMessage:l,errorCode:c}=t,d={...r,errorName:i,errorMessage:l,errorCode:c,outputMessage:"",latency:performance.now()-n};console.log("[AIStream] EVENT: ai.request.error"),(0,s.pQ)(d)},trackStreamAbort(e,t){let a=(0,o.Sn)(t.interactionId)(e.getState());if(!a)return;let{startTime:n,...r}=a,i={...r,abortReason:t.abortReason,timeToAbort:performance.now()-n};console.log("[AIStream] EVENT: ai.request.abort"),(0,s.mV)(i)},trackStreamStart(e,t){e.dispatch((0,o.af)(t));let a=(0,o.Sn)(t.interactionId)(e.getState());if(!a)return;let{startTime:n,...r}=a,i={...r,timeToStart:performance.now()-n};console.log("[AIStream] EVENT: ai.request.streamStart"),(0,s.qZ)(i)},trackStreamResponse(e,t){e.dispatch((0,o.fj)({endTime:performance.now(),...t}));let a=(0,o.Sn)(t.interactionId)(e.getState());if(!a)return;let{startTime:n,...r}=a;console.log("[AIStream] EVENT: ai.request.response"),(0,s.o)(r)},trackStreamComplete(e,t,a){let n=(0,o.Sn)(t)(e.getState());if(!n)return;let{startTime:r,...i}=n,l={...i,timeToComplete:performance.now()-r,...a};console.log("[AIStream] EVENT: ai.request.complete"),(0,s.gb)(l)}}},26961:function(e,t,a){a.d(t,{T:function(){return c}});var n=a(2784),r=a(93202),s=a(91994),o=a(29318),i=a(47968),l=a(12825);let c=()=>{let{editor:e}=(0,l._)(),t=null==e?void 0:e.gammaDocId,{updateDocThemeWithAccentImages:a}=(0,o.vi)({docId:t,editor:e}),c=(0,s.CG)(i.F_),d=(0,n.useCallback)(e=>c===e,[c]),u=(0,r.WQq)(),m=(0,n.useCallback)(async e=>{try{let{data:t}=await u.query({query:r.vGj,variables:{id:e},returnPartialData:!1});return(null==t?void 0:t.theme)!==null}catch(e){return console.warn("[useThemeModificationController.isValidTheme] Error checking if theme is valid",e),!1}},[u]);return{setThemeWithAccentImages:a,isThemeApplied:d,currentThemeId:c,isValidTheme:m}}
1},54680:function(e,t,a){a.d(t,{bo:function(){return l},dn:function(){return i},g5:function(){return c}});var n=a(2784),r=a(31490),s=a(93202),o=a(42111);let i=e=>{let t=(0,o.ye)("openAiStatus"),[a,s]=(0,n.useState)("input"),[i,l]=(0,n.useState)(e),[c,d]=(0,n.useState)(),u=(0,n.useMemo)(()=>(0,r.nZ)(),[]);return{step:a,setStep:s,generateFormat:i,setGenerateFormat:l,selectedTheme:c,openAiStatus:t,setSelectedTheme:d,interactionId:u}},l=()=>{let{data:e,loading:t}=(0,s.BCl)({variables:{workspaceId:null,archived:!1},fetchPolicy:"cache-first",nextFetchPolicy:"cache-only"}),a=(0,n.useMemo)(()=>(null==e?void 0:e.themes)||[],[e]);return{themes:a,isThemesLoading:t}},c=()=>{let e=(0,o.ye)("azureOpenAI")?s.nyn.Azure:s.nyn.Openai;return e}},4425:function(e,t,a){a.d(t,{n:function(){return n}});let n=()=>{let e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",e.style.msOverflowStyle="scrollbar",document.body.appendChild(e);let t=document.createElement("div");e.appendChild(t);let a=e.offsetWidth-t.offsetWidth;return e.parentNode.removeChild(e),a}},84405:function(e,t,a){a.d(t,{J:function(){return o},Q:function(){return s}});var n=a(11050),r=a(25566);let s=e=>{let{doc_id:t,source:a,source_doc_id:s,channel:o,extra:i}=e;null===n.co||void 0===n.co||n.co.track(r.AA.DOC_CREATED,{doc_id:t,source_doc_id:s,source:a,channel:o,extra:i})},o=e=>{let{docId:t,type:a,source:s}=e;if(!t){console.debug("[trackDocShareLinkCopiedEvent]: doc_id is required");return}null===n.co||void 0===n.co||n.co.track(r.AA.DOC_SHARELINK_COPIED,{doc_id:t,source:s,type:a})}},6085:function(e,t,a){a.d(t,{m:function(){return c}});var n=a(72338),r=a(27191),s=a(37160),o=a(86581),i=a(18455),l=a(87008);let c=n.hj.create({name:"clipboardLight",addCommands:()=>({insertMarkdownAt:(e,t)=>a=>{let{state:n,tr:r}=a;try{let a=(0,o.aT)(t,n.schema);return r.replaceRange(e.from,e.to,a),!0}catch(e){return console.warn("(caught) [Clipboard] insertMarkdownAt error",e),!1}}}),addProseMirrorPlugins(){let e=this.editor;return[new r.Sy({key:new r.H$("clipboardLight"),props:{clipboardSerializer:{serializeFragment:t=>(0,l.Xb)(t,e.schema)},handlePaste:(t,a,n)=>(0,o.iO)(e,a)||(0,s.g)(t,a,n),transformPastedHTML:e=>(0,i.B)(e,!0)}})]}})},28086:function(e,t,a){a.d(t,{xg:function(){return ev},rN:function(){return ew},r8:function(){return eb}});var n=a(52322),r=a(38035),s=a(43297),o=a(25925),i=a(2784),l=a(97763),c=a(77533),d=a(62614),u=a(20437),m=a(75009),g=a(5879),p=a(91994),h=a(86323),f=a(26031),y=a(25314),x=a(67422),k=a(70065),b=a(29117),w=a(36474),I=a(75768),v=a(32899),C=a(87651),S=a(29494),j=a(42946),E=a(49929),A=a(94523),R=a(87254),T=a(11050);let M=(0,i.memo)(e=>{let{message:t}=e,a=(0,k.p)(),r=(0,T.z$)(),{scrollToBottom:o}=eb(),l=(0,i.useRef)(null),[c,u]=(0,i.useState)(!1),[m,p]=(0,i.useState)(null);(0,i.useEffect)(()=>{if(c){var e;null===(e=l.current)||void 0===e||e.focus(),null==o||o()}},[c,o,r]);let h=t.interactionId,f=t.type,y=(0,i.useCallback)(e=>{p(e),u(!0),null==r||r.track(T.AA.AI_SUGGESTION_FEEDBACK,{interactionId:h,rating:e,type:f})},[r,h,f]),x=(0,i.useCallback)(()=>{var e;u(!1),null==r||r.track(T.AA.AI_SUGGESTION_FEEDBACK,{interactionId:h,rating:m,type:f,feedback:null===(e=l.current)||void 0===e?void 0:e.value}),l.current&&(l.current.value=""),a({title:(0,n.jsx)(g.cC,{id:"d6N994"}),description:(0,n.jsx)(g.cC,{id:"s/fQ3s"}),status:"success",duration:5e3,isClosable:!0})},[a,r,h,m,f]);return(0,n.jsxs)(s.K,{width:"100%",children:[(0,n.jsxs)(b.U,{children:[(0,n.jsx)(w.L,{}),(0,n.jsxs)(I.h,{size:"xs",variant:"ghost",colorScheme:"blackAlpha",children:[(0,n.jsx)(A.kH,{label:(0,n.jsx)(g.cC,{id:"kR82DG"}),placement:"top",children:(0,n.jsx)(v.h,{"aria-label":"thumbs down",color:"poor"===m?"red.600":void 0,borderWidth:"1px",borderColor:"poor"===m?"red.600":"transparent",bg:"poor"===m?"red.100":void 0,_hover:{bg:"poor"===m?"red.200":"blackAlpha.100"},icon:(0,n.jsx)(E.G,{icon:j.bam}),onClick:()=>{y("poor")}})}),(0,n.jsx)(A.kH,{label:(0,n.jsx)(g.cC,{id:"y1GvbS"}),placement:"top",children:(0,n.jsx)(v.h,{"aria-label":"thumbs up",color:"good"===m?"green.600":void 0,borderWidth:"1px",borderColor:"good"===m?"green.600":"transparent",bg:"good"===m?"green.100":void 0,_hover:{bg:"good"===m?"green.200":"blackAlpha.100"},icon:(0,n.jsx)(E.G,{icon:j.u8Q}),onClick:()=>{y("good")}})})]})]}),(0,n.jsx)(C.U,{in:c,children:(0,n.jsxs)(s.K,{children:[(0,n.jsx)(S.g,{ref:l,bg:"white",size:"sm",placeholder:R.ag._({id:"ZVGh9y"})}),(0,n.jsxs)(I.h,{children:[(0,n.jsx)(w.L,{}),(0,n.jsx)(d.z,{onClick:()=>u(!1),size:"xs",variant:"ghost",colorScheme:"blackAlpha",children:(0,n.jsx)(g.cC,{id:"6Uau97"})}),(0,n.jsx)(d.z,{onClick:x,size:"xs",variant:"plain",children:(0,n.jsx)(g.cC,{id:"RoafuO"})})]})]})})]})});M.displayName="SuggestionFeedback";let _=(0,i.memo)(e=>{let{message:t,editor:a}=e,r=t.suggestions.slice(0,1),o=(0,p.TL)(),l=(0,p.qr)(),k=(0,i.useCallback)(()=>{let e=(0,f.AZ)(l.getState());return e},[l]),b=(0,i.useCallback)(e=>{let t={timestamp:Date.now(),...e};o((0,f.Hz)({message:t}))},[o]),{sendMessage:w}
1=(0,y.n)({addMessage:b,getMessageHistory:k,editor:a});return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(x.K,{children:(0,n.jsxs)(s.K,{align:"start",children:[(0,n.jsx)(c.x,{children:(0,n.jsx)(g.cC,{id:"A9MA7Q",components:{0:(0,n.jsx)(d.z,{variant:"link",onClick:()=>{w({message:t.message||""})}})}})}),(0,n.jsx)(c.x,{color:"gray.500",textAlign:"center",fontSize:"xs",children:(0,n.jsx)(g.cC,{id:"ygs5tU"})}),(0,n.jsx)(u.M,{columns:2,spacing:2,w:"100%",children:r.map(e=>(0,n.jsx)(m.E,{src:e.attrs.src,onDragStart:()=>{a&&(0,h.UV)(a,{type:"image",attrs:e.attrs})},h:36,draggable:!0,w:"100%",borderRadius:"md",transitionDuration:"normal",transitionProperty:"common",objectFit:"cover",cursor:"grab",_hover:{shadow:"outline"}},e.attrs.src))}),(0,n.jsx)(M,{message:t})]})}),t.isFirstGenerationInSession&&(0,n.jsx)(x.K,{children:(0,n.jsx)(c.x,{children:(0,n.jsx)(g.cC,{id:"VraWhP"})})})]})});_.displayName="GenerateImage";var D=a(21733),N=a(17993),O=a(45393),P=a.n(O);let q=()=>[R.ag._({id:"91gjMr"}),R.ag._({id:"PHyjBQ"}),R.ag._({id:"zhFV/H"}),R.ag._({id:"4ReFRy"}),R.ag._({id:"aepNQh"}),R.ag._({id:"fr8euV"}),R.ag._({id:"+TEOEl"}),R.ag._({id:"gQIRQv"}),R.ag._({id:"pbDMHv"}),R.ag._({id:"LP7cSD"}),R.ag._({id:"ugneAh"})],F=()=>[R.ag._({id:"DZ/eyq"}),R.ag._({id:"S2U0+k"}),R.ag._({id:"YZJ7kT"}),R.ag._({id:"fLq3m1"}),R.ag._({id:"1nrH2R"})],L=e=>{let{sendMessage:t}=e,[a]=(0,i.useState)(P()(q(),4).concat(P()(F(),2)));return(0,n.jsx)(N.g,{spacing:2,align:"flex-start",children:a.map((e,a)=>(0,n.jsx)(d.z,{variant:"unstyled",bg:"white",borderRadius:"md",size:"sm",px:2,border:"1px solid",borderColor:"gray.200",color:"orchid.400",fontWeight:"500",_hover:{bg:"trueblue.50",color:"trueblue.700"},onClick:()=>{t(e)},children:e},a))})},G=e=>({from:"Designer",type:"text",message:R.ag._({id:"q65R55",values:{userName:e}}),timestamp:Date.now()}),z=e=>{let{sendMessage:t,hideSuggestions:a=!1}=e,{user:r}=(0,D.SE)();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(x.K,{from:"Designer",children:G(null==r?void 0:r.firstName).message}),!a&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(c.x,{color:"gray.500",fontSize:"sm",children:(0,n.jsx)(g.cC,{id:"MVir6z"})}),(0,n.jsx)(L,{sendMessage:t})]})]})};var H=a(74008),U=a(28535),K=a(37417),V=a(54933),W=a(26961),B=a(32186),J=a(47968),$=a(43176),Q=a(54073),Y=a.n(Q);function Z(e,t,a){var n;return null!==(n=a.find(a=>a.modification.isApplied(e,t)))&&void 0!==n?n:null}function X(e,t){let a=(0,p.CG)(J.Pu),n=(0,W.T)(),[r,s]=(0,i.useState)(()=>e?Z(e,n,t):null),o=(0,i.useCallback)(()=>{e&&s(Z(e,n,t))},[e,t,n]);return(0,i.useEffect)(()=>{if(!e)return;let a=Y()(()=>{s(Z(e,n,t))},1e3);return e.on("update",a),()=>{e.off("update",a)}},[e,t,n]),(0,i.useEffect)(()=>{o()},[o,a]),{activeSuggestion:r,forceUpdate:o}}let ee=(0,i.memo)(e=>{let{message:t,editor:a}=e,r=(0,$.E)(),o=(0,W.T)(),{activeSuggestion:l,forceUpdate:d}=X(a,t.suggestions),u=(0,i.useCallback)(e=>{a&&(r.trackSuggestionApplied({interactionId:t.interactionId,suggestionType:e.type,suggestionLabel:e.description,suggestionContent:e.getContentForTracking()}),e.apply(a,o),d())},[a,d,t.interactionId,o,r]);return a?(0,n.jsx)(x.K,{children:(0,n.jsxs)(s.K,{divider:(0,n.jsx)(H.i,{borderColor:"blackAlpha.200"}),children:[(0,n.jsx)(c.x,{children:t.message||"How's this?"}),t.suggestions.map((e,t)=>(0,n.jsx)(et,{isSelected:e.label===(null==l?void 0:l.label),jsonContentPreview:e.jsonContentPreview,label:e.label,modification:e.modification,onClick:()=>{u(e.modification)}},t)),(0,n.jsx)(M,{message:t})]})}):null});ee.displayName="SuggestContent";let et=e=>{let{label:t,modification:a,jsonContentPreview:s,isSelected:o,onClick:l}=e,d=(0,p.CG)(J.Pu);console.debug("[".concat(t,"] jsonContentPreview"),s,a);let u=(0,i.useCallback)(()=>{o||l()},[o,l]);return(0,n.jsxs)(b.U,{onClick:u,cursor:"pointer",px:2,py:1,borderRadius:"xl",_hover:{bg:"blackAlpha.100"},bg:o?"whiteAlpha.600":void 0,transitionProperty:"common",transitionDuration:"normal",spacing:4,children:[s&&(0,n.jsx)(r.k,{sx:{"mask-image":"linear-gradient(to bottom, black 75%, transparent 100%)"},children:(0,n.jsx)(r.k,{sx:B.n,justifyContent:"center",alignItems:"top",width:"150px",h:16,children:(0,n.jsx)(U.xu,{transformOrigin:"top",transform:"scale(0.15)",pointerEvents:"none",children:(0,n.jsx)(B.m,{content:s,theme:d})})})}),(0,n.jsx)(c.x,{flex:1,fontSize:"sm",children:t}),(0,n.jsx)(K.M,{in:o,children:(0,n.jsx)(E.G,{icon:V.LEp,fixedWidth:!0})})]})};var ea=a(75652),en=a.n(ea),er=a(50279),es=a(87205);let eo=(0,i.memo)(e=>{let{message:t,editor:a}=e,r=t.suggestions.slice(0,8),o=en()(r.map(e=>{let{query:t}=e;return t})),i=0===o.length?R.ag._({id:"QICyFn"}):1==o.length?R.ag._({id:"x/YBq7",values:{0:o[0].toLowerCase()}}):2==o.length?R.ag._({id:"Tn1hkb",values:{0:o[0].toLowerCase(),1:o[1].toLowerCase()}}):R.ag._({id:"Z918ro",values:{0:o[0].toLowerCase(),1:o[1].toLowerCase(),2:o[2].toLowerCase()}});return(0,n.jsx)(x.K,{children:(0,n.jsxs)(s.K,{align:"start",children:[(0,n.jsxs)(c.x,{children:[i," ",(0,n.jsx)(g.cC,{id:"CvUN7V"})]}),(0,n.jsx)(c.x,{color:"gray.500",textAlign:"center",fontSize:"xs",children:(0,n.jsx)(g.cC,{id:"fg3FfA"})}),(0,n.jsx)(u.M,{columns:2,spacing:2,w:"100%",children:r.map(e=>{let{image:t,query:r,provider:s}=e,o=(0,es.SN)(t.thumbnailUrl,{width:250,height:250});return(0,n.jsx)(m.E,{src:o,fallbackSrc:t.thumbnailUrl,onDragStart:()=>{a&&(0,h.UV)(a,{type:"image",attrs:(0,er.C)(t,r,s)})},h:24,draggable:!0,w:"100%",borderRadius:"md",transitionDuration:"normal",transitionProperty:"common",objectFit:"cover",cursor:"grab",_hover:{shadow:"outline"}},t.id)})}),(0,n.jsx)(M,{message:t})]})})});eo.displayName="SuggestImage";let ei=e=>e.replace(/(<([^>]+)>)/gi,""),el=(0,i.memo)(e=>{let{message:t,editor:a}
1=e,r=(0,$.E)(),s=(0,W.T)(),{activeSuggestion:o,forceUpdate:i}=X(a,t.suggestions);return(0,n.jsx)(x.K,{from:t.from,children:(0,n.jsxs)(N.g,{spacing:2,align:"start",children:[(0,n.jsx)(c.x,{children:t.message||"Here are some ideas:"}),t.suggestions.map((e,l)=>(0,n.jsx)(ec,{value:e,isSelected:e===o,onClick:()=>{if(!a)return;let{modification:n}=e;r.trackSuggestionApplied({interactionId:t.interactionId,suggestionType:n.type,suggestionLabel:n.description,suggestionContent:n.getContentForTracking()}),n.apply(a,s),i()}},l)),(0,n.jsx)(M,{message:t})]})})}),ec=e=>{let{value:t,isSelected:a,onClick:r}=e,s=(0,i.useCallback)(()=>{a||r()},[a,r]);return(0,n.jsxs)(b.U,{onClick:s,cursor:"pointer",p:4,borderRadius:"xl",_hover:{bg:"whiteAlpha.600"},bg:"white",transitionProperty:"common",transitionDuration:"normal",spacing:4,shadow:"md",align:"start",children:[(0,n.jsxs)(U.xu,{children:[(0,n.jsx)(c.x,{fontSize:"sm",color:"gray.500",children:t.reason}),(0,n.jsx)(c.x,{fontSize:"sm",noOfLines:3,children:ei(t.value)})]}),(0,n.jsx)(K.M,{in:a,children:(0,n.jsx)(E.G,{icon:V.LEp,fixedWidth:!0})})]})};el.displayName="SuggestText";var ed=a(53596),eu=a(29318),em=a(18412);let eg=(0,i.memo)(e=>{let{message:t,editor:a}=e,{onClose:r}=eb(),o=(0,$.E)(),l=(0,W.T)(),{activeSuggestion:u}=X(a,t.suggestions),m=(0,i.useCallback)(e=>{a&&(o.trackSuggestionApplied({interactionId:t.interactionId,suggestionType:t.type,suggestionLabel:e.description,suggestionContent:e.getContentForTracking()}),e.apply(a,l))},[a,o,t,l]);return(0,n.jsx)(x.K,{children:(0,n.jsxs)(s.K,{children:[(0,n.jsx)(c.x,{children:t.message}),t.suggestions.map(e=>{let{themeId:t,label:a,isOriginal:r}=e;return(0,n.jsxs)(i.Fragment,{children:[r&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(H.i,{borderColor:"blackAlpha.200"}),(0,n.jsxs)(c.x,{children:[a,": "]})]}),(0,n.jsx)(ep,{themeId:t,onClick:()=>m(e.modification),isSelected:(null==u?void 0:u.themeId)===t})]},t)}),(0,n.jsx)(c.x,{children:(0,n.jsx)(g.cC,{id:"eVMeEi"})}),(0,n.jsx)(d.z,{leftIcon:(0,n.jsx)(E.G,{icon:j.q2v}),w:"100%",onClick:()=>{r(),em.T.emit("toggleThemeBlock",!0)},children:(0,n.jsx)(g.cC,{id:"ni+gIz"})}),(0,n.jsx)(M,{message:t})]})})});eg.displayName="SuggestThemes";let ep=(0,i.memo)(e=>{let{themeId:t,onClick:a,isSelected:r}=e,s=(0,eu.c2)(t);return"new"===s.id?null:(0,n.jsxs)(N.g,{onClick:a,cursor:"pointer",p:2,borderRadius:"xl",_hover:{bg:"blackAlpha.100"},bg:r?"whiteAlpha.600":void 0,transitionProperty:"common",transitionDuration:"normal",children:[(0,n.jsx)(U.xu,{borderRadius:"lg",overflow:"hidden",w:"100%",children:(0,n.jsx)(ed.n,{theme:s,variant:"outline"})}),(0,n.jsxs)(b.U,{alignSelf:"flex-start",color:r?"trueblue.700":void 0,children:[(0,n.jsx)(K.M,{in:r,unmountOnExit:!0,children:(0,n.jsx)(E.G,{icon:V.LEp,fixedWidth:!0})}),(0,n.jsx)(c.x,{fontSize:"sm",fontWeight:r?"semibold":void 0,children:s.name})]})]})});ep.displayName="ThemeMessageThumbnailPreview";var eh=a(29705),ef=a(11082);let ey=(0,i.memo)(e=>{let{message:t,sendMessage:a}=e;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(x.K,{children:t.message&&(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)(c.x,{children:[(0,n.jsx)("span",{className:"emoji",role:"img","aria-label":"sorry",children:"\uD83D\uDE14"})," ",t.message," ",t.learnMoreLink&&(0,n.jsxs)(ef.r,{href:t.learnMoreLink,textDecoration:"underline",isExternal:!0,children:["Learn more ",(0,n.jsx)(eh.h,{mx:"2px",fontSize:"sm"})]})]})})}),(0,n.jsx)(c.x,{color:"gray.500",fontSize:"sm",children:"Here are some other things I can do:"}),(0,n.jsx)(L,{sendMessage:a})]})});ey.displayName="UnsupportedTask";let ex=(0,i.memo)(e=>{let{message:t}=e;return(0,n.jsx)(x.K,{warning:t.warning,from:t.from,children:t.message})});ex.displayName="UserDesignerMessage";let ek=i.createContext({scrollToBottom:()=>{},onClose:()=>{}}),eb=()=>i.useContext(ek),ew=e=>{let{messages:t,scrollSelector:a,editor:c,sendMessage:d,isLoading:u,onClose:m}=e,{hasEnoughCreditsToChat:g,isCreditsReady:p}=(0,l.qO)(),h=(0,i.useCallback)(()=>{let e=a&&document.querySelector(a);e&&setTimeout(()=>{requestAnimationFrame(()=>{e.scrollTo({top:e.scrollHeight,behavior:"smooth"})})},400)},[a]),f=(0,i.useRef)({scrollToBottom:h,onClose:m});return f.current.scrollToBottom=h,(0,n.jsx)(ek.Provider,{value:f.current,children:(0,n.jsx)(r.k,{flex:1,flexDirection:"column",justifyContent:"flex-end",children:(0,n.jsx)(s.K,{pt:12,spacing:2,children:(0,n.jsxs)(o.M,{children:[(0,n.jsx)(z,{sendMessage:d,hideSuggestions:p&&!g}),t.map(e=>{if("text"===e.type)return(0,n.jsx)(ex,{message:e},e.timestamp);if("suggestImages"===e.type)return(0,n.jsx)(eo,{message:e,editor:c},e.timestamp);if("generateImage"===e.type)return(0,n.jsx)(_,{message:e,editor:c},e.timestamp);if("suggestText"===e.type)return(0,n.jsx)(el,{message:e,editor:c},e.timestamp);if("suggestThemes"===e.type)return(0,n.jsx)(eg,{message:e,editor:c},e.timestamp);if("suggestContent"===e.type)return(0,n.jsx)(ee,{message:e,editor:c},e.timestamp);if("unsupported"===e.type)return(0,n.jsx)(ey,{message:e,sendMessage:d}
1,e.timestamp);return console.warn("[MessageList] Message type not found",e),null}),u&&(0,n.jsx)(eI,{},"loading")]})})})})},eI=()=>(0,n.jsx)(x.K,{from:"Designer",children:(0,n.jsx)(ev,{})}),ev=()=>(0,n.jsxs)(r.k,{className:"bouncing-loader",justify:"center",children:[(0,n.jsx)("div",{}),(0,n.jsx)("div",{}),(0,n.jsx)("div",{})]})},43176:function(e,t,a){a.d(t,{E:function(){return i}});var n=a(2784),r=a(31490),s=a(91994),o=a(61515);let i=()=>{let e=(0,s.qr)(),t=(0,s.TL)(),a=(0,n.useCallback)((e,a)=>{t((0,o.Cj)({taskContext:e,provider:a})),(0,r.hq)({interactionId:e.interactionId,interface:"chat",inputMessage:e.message,docId:e.docId,cardId:e.editorContext.card.cardId,provider:a})},[t]),i=(0,n.useCallback)(e=>{t((0,o.z5)(e))},[t]),l=(0,n.useCallback)(e=>{t((0,o.zw)(e))},[t]),c=(0,n.useCallback)(a=>{t((0,o._M)(a));let{taskContext:n}=a,s=(0,o.FK)(n.interactionId)(e.getState());if(!s){console.error("[trackRequestComplete] no data found for interactionId",n.interactionId);return}(0,r.gb)({interactionId:n.interactionId,interface:"chat",docId:n.docId,cardId:s.cardId,classification:s.classification,provider:s.provider,inputMessage:n.message,inputContent:s.inputContent,rawResponse:a.resp,outputMessage:s.outputMessage,outputContent:s.outputContent,latency:performance.now()-n.startTime,timeToComplete:performance.now()-n.startTime})},[t,e]),d=(0,n.useCallback)(t=>{let{outputMessage:a,errorMessage:n,errorCode:s,interactionId:i,resp:l,errorName:c}=t,d=(0,o.FK)(i)(e.getState());if(!d){console.error("[trackRequestError] no data found for interactionId",i);return}(0,r.pQ)({interactionId:i,interface:"chat",docId:d.docId,cardId:d.cardId,classification:d.classification,provider:d.provider,inputMessage:d.message,inputContent:d.inputContent,outputMessage:a,errorName:c,errorMessage:n,errorCode:s,rawResponse:l,latency:performance.now()-d.startTime})},[e]),u=(0,n.useCallback)(t=>{let{interactionId:a,retriesRemaining:n,resp:s}=t,i=(0,o.FK)(a)(e.getState());if(!i){console.error("[trackRequestRetry] no data found for interactionId",a);return}(0,r.Wf)({interactionId:a,interface:"chat",classification:i.classification,docId:i.docId,cardId:i.cardId,provider:i.provider,inputMessage:i.message,inputContent:i.inputContent,rawResponse:s,retriesRemaining:n})},[e]),m=(0,n.useCallback)(t=>{let{interactionId:a,suggestionContent:n,suggestionType:s,suggestionLabel:i,autoApplied:l}=t,c=(0,o.FK)(a)(e.getState());if(!c){console.error("[trackSuggestionApplied] no data found for interactionId",a);return}let d="string"==typeof n?n:"html"===n.type?n.html:"json"===n.type?n.json:void 0;(0,r.vL)({interactionId:a,interface:"chat",docId:c.docId,cardId:c.cardId,classification:c.classification,provider:c.provider,inputMessage:c.message,inputContent:c.inputContent,outputMessage:c.outputMessage,outputContent:c.outputContent,suggestionType:s,suggestionLabel:i,suggestionContent:d,autoApplied:!!l})},[e]),g=(0,n.useMemo)(()=>({trackClassification:i,trackRequestComplete:c,trackInputContent:l,trackRequestSent:a,trackRequestError:d,trackRequestRetry:u,trackSuggestionApplied:m}),[i,l,c,a,d,u,m]);return g}},67422:function(e,t,a){a.d(t,{K:function(){return m}});var n=a(52322),r=a(38035),s=a(50019),o=a(47443),i=a(52929),l=a(56453),c=a(75397),d=a(41004);let u=(0,d.E)(r.k),m=e=>{let{children:t,from:a="Designer",warning:r=!1,cardStyleOverrides:d,error:m=!1,...g}=e,p=(0,s.ff)("orchid.400","blue.700"),h=(0,s.ff)("trueblue.50","sunglow.700"),f=(0,s.ff)("red.100","red.500"),y="User"===a,x=y?{bg:p,borderBottomRightRadius:0,color:"white",...d}:{bg:r?void 0:m?f:h,borderBottomLeftRadius:0,...d};return(0,n.jsx)(u,{justify:y?"flex-end":"flex-start",initial:{opacity:0,translateX:-20},animate:{opacity:1,translateX:0},...g,children:r?(0,n.jsxs)(o.b,{status:"warning",borderColor:"orange.200",borderWidth:"1px",fontSize:"inherit",...x,children:[(0,n.jsx)(i.z,{}),t]}):(0,n.jsx)(l.Z,{size:"sm",shadow:"sm",borderRadius:"xl",variant:"filled",minH:0,borderColor:m?"red.200":"blackAlpha.200",...x,children:(0,n.jsx)(c.e,{py:2,px:2,children:t})})})}},25314:function(e,t,a){a.d(t,{n:function(){return e4}});var n=a(12483),r=a(2784),s=a(31151),o=a(21156),i=a(93202),l=a(79758),c=a(54691),d=a(19585),u=a(93934),m=a(64488);
1class g extends l.B{async runPrompt(e){let{input:t,context:a,variables:n,trackFns:r,retries:o=2}=e,i=await (0,c.I)(t,a.interactionId,{timeout:d.VH.get("aiRequestTimeouts").basicReply});if(!i)throw Error("Couldn't get response from prompt");if((0,u.y)(i)||(null==i?void 0:i.includes("```"))){if(o<=0)throw new s.eo("Did not receive proper response after retries",{chatMessage:"Sorry, I am having trouble understanding. Could you try asking in a different way?",inputMessage:a.message,resp:i,interactionId:a.interactionId});return r.trackRequestRetry({interactionId:a.interactionId,retriesRemaining:o,resp:i}),this.runPrompt({input:t,context:a,variables:n,trackFns:r,retries:o-1})}return i}async run(e){let{context:t,addMessage:a,history:n,trackFns:r,provider:s}=e,o={message:t.message},i=(0,m.x)(n||[]),l=this.prompt.prepare({variables:o,history:i,params:{provider:s},interactionId:t.interactionId}),c=await this.runPrompt({input:l,context:t,variables:o,trackFns:r,retries:1});r.trackRequestComplete({taskContext:t,outputMessage:c}),a({from:"Designer",type:"text",message:c,resp:c,interactionId:t.interactionId})}constructor(e){super(e),this.prompt=e.prompt}}let p=new g({key:"CHAT",description:"A general chat message, or a request that doesn't fit any of the previous categories",classifyExamples:["hi how are you","hdfoho;safjw","help there are bees everywhere","great job!","this looks ugly"],prompt:new o.V({systemPromptOperation:i.Run.BasicReplyChatSystem,userPromptOperation:i.Run.BasicReplyChatUser,variables:["message"],params:{maxTokens:150,temperature:0}})}),h=[p],f=e=>h.find(t=>t.key===e),y=e=>!!h.find(t=>t.key===e);var x=a(36528),k=a(42111),b=a(67964),w=a(31490),I=a(66922),v=a(46772),C=a(36651);class S extends l.B{async run(e){let{addMessage:t,context:a,trackFns:n,history:r}=e,s=performance.now(),o=v.S.prepare({variables:{input:a.message,html:a.editorContext.cardContent.html}}),i=await (0,c.I)(o,a.interactionId);if(!i)throw Error("Couldn't get response from prompt");let l={prompt:i,count:1,model:k.VH.get("aiGeneratedImagesDefaultModel")},d=I.Iw[l.model],u={interactionId:a.interactionId,interface:"generate-image",provider:d.provider,streaming:!1,inputContent:i,docId:a.docId,generateImageOptions:l};try{(0,w.hq)(u);let e=await (0,I.Qz)({interactionId:a.interactionId,docId:a.docId,workspaceId:(0,C.n_)(),...l});if(0===e.length)throw Error("No images generated");t({from:"Designer",type:"generateImage",suggestions:e,interactionId:a.interactionId,isFirstGenerationInSession:!r||!r.some(e=>"generateImage"===e.type),message:a.message}),(0,w.o)({...u,latency:performance.now()-s,generateImageUrls:e.map(e=>e.attrs.src)}),n.trackRequestComplete({taskContext:a,outputContent:JSON.stringify(e),outputMessage:""})}catch(e){console.error("(caught) [AIGenerateImage] error:",e),(0,w.pQ)({...u,latency:performance.now()-s,errorName:"GenerateImageError",errorMessage:e.message,outputMessage:""})}}constructor(e){super(e)}}let j=new S({key:"GENERATE_IMAGE",description:"Generate an image using AI.",classifyExamples:["generate an image of a panda eating starbursts","add an AI image that shows people talking and working","use AI to make a picture of a laptop on a windowsill","generate an image of a watercolor painting of a flower vase"],classifyReply:"Sure, I'll generate an image of a panda...",checkEnabled:()=>(0,b.uL)("unlimited_ai")}),E=[j],A=e=>E.find(t=>t.key===e),R=e=>!!A(e);var T=a(6501),M=a(87148),_=a(9850),D=a.n(_),N=a(35873),O=a(96255),P=a(38322),q=a(83194);class F{isApplied(e){let t=(0,O.Bw)(e,this.cardId);return!!t}getPreviewJson(e){let t=e.state.tr;this.transact(e,t);let a=D()(t.doc.toJSON());return(0,q.Y0)(a,this.cardId)}apply(e){if(this.isApplied(e)){console.debug("[InsertCardModification] NOT applying modification, card already exists with cardId=".concat(this.cardId),{modification:this});return}let t=e.state.tr;this.transact(e,t),console.debug("[InsertCardModification] Applying modification",{modification:this}),e.view.dispatch(t),(0,N.YS)({editor:e,cardId:this.cardId})}transact(e,t){let a=(0,O.Bw)(e,this.afterCardId);if(!a)return null;let n=(0,q.Fr)(e,this.content),r=a.pos+a.node.nodeSize;t.insert(r,n.content.firstChild);let s=(0,P.t)(t.doc.resolve(r),1);return t.setSelection(s),{from:r,to:r+t.doc.nodeAt(r).nodeSize}}getContentForTracking(){return this.content}constructor(e){this.type="insert-card",this.description=e.description,this.cardId=e.cardId,this.afterCardId=e.afterCardId,this.content=e.content}}class L{isApplied(e){let t=(0,O.Bw)(e,this.cardId);return!t}getPreviewJson(e){return null}apply(e){let t=e.state.tr,a=(0,O.Bw)(e,this.cardId);a&&(t.delete(a.pos,a.pos+a.node.nodeSize),console.debug("[RemoveCardModification] Applying modification",{modification:this}),e.view.dispatch(t))}getContentForTracking(){return this.cardId}constructor(e){this.type="remove-card",this.description=e.description,this.cardId=e.cardId}}var G=a(81087);class z extends G.w6{async getResponseMessages(e){let{editor:t,context:a,response:{suggestion:n,message:r,raw:o}}=e;if(!n)throw new s.$D("No card content returned",{interactionId:a.interactionId,resp:o,chatMessage:r||(0,G.az)(),inputMessage:a.message});let i=(0,M.hx)((0,M.VA)(t)),{generateInfo:l}=(0,M.VA)(t),c=await (0,T.sj)(n,{loadImages:!0,docFormatKey:i.key,cardIndex:1,imageOptions:(null==l?void 0:l.imageOptions)||{provider:"web"},theme:a.editorContext.theme,context:{docId:a.docId,workspaceId:(0,C.n_)(),interactionId:a.interactionId}}),d=c.attrs.id,u=new F({description:"New Card",content:{type:"json",json:[c]},cardId:d,afterCardId:a.editorContext.card.cardId}),m={label:"New card",modification:u,jsonContentPreview:u.getPreviewJson(t)},g=new L({description:"Remove card",cardId:d}),p={label:"Remove card",modification:g,jsonContentPreview:g.getPreviewJson(t)},h={from:"Designer",type:"suggestContent",resp:o,message:r||"How about this?",suggestions:[m,p],interactionId:a.interactionId};return console.debug("[addCard]",{insert:m,remove:p,message:r,html:n,content:c}),{messages:[h],suggestionToApply:m}}}let H=new o.V({systemPromptOperation:i.Run.AddCardSystem,userPromptOperation:i.Run.AddCardUser,variables:["html","message","outline"],params:{temperature:.7,maxTokens:1e3}}),U=new z({key:"ADD_CARD",description:"Add a new card after the current one",classifyExamples:["add a new slide","add a card describing our mission","i want a new section for leadership development","make another card","on a new card compare the two options in a table"],classifyReply:"Ok, I'll start writing a new card...",prompt:H});var K=a(87254),V=a(78374);class W{isApplied(e){let t=(0,O.Bw)(e,this.cardId);return t?t.node.attrs.layout===this.layout:(console.error("[SetCardLayoutModification.apply] Could not find card to update: ".concat(this.cardId,", maybe deleted")),!1)}getPreviewJson(e){let t=e.state.tr;this.transact(e,t);let a=D()(t.doc.toJSON()),n=(0,q.Y0)(a,this.cardId);return console.debug("[SetCardLayoutModification.getPreviewJson] result",n),n}apply(e){if(this.isApplied(e)){console.debug("[SetCardLayoutModification] NOT applying modification, card already has layout=".concat(this.layout),{modification:this});return}let t=e.state.tr;this.transact(e,t),console.debug("[SetCardLayoutModification] Applying modification",{modification:this}),e.view.dispatch(t),(0,N.YS)({editor:e,cardId:this.cardId})}transact(e,t){let a=(0,O.Bw)(e,this.cardId);if(!a){console.error("[SetCardLayoutModification.apply] Could not find card to update: ".concat(this.cardId,", maybe deleted"));return}(0,V.G)(e,t,a.pos,this.layout)}getContentForTracking(){return this.layout}constructor(e){this.type="set-card-layout",this.description=e.description,this.cardId=e.cardId,this.layout=e.layout}}let B=()=>K.ag._({id:"ppX7+s"});class J extends G.w6{async getResponseMessages(e){let{editor:t,context:a,rangeId:n,response:{suggestion:r,raw:o,message:i}}=e;if(!r)throw new s.$D("No card layout returned",{resp:o,chatMessage:B(),inputMessage:a.message,interactionId:a.interactionId});if(!(0,O.ol)(r))throw console.error("Invalid card layout:",r),new s.$D("Invalid card layout: ".concat(r),{resp:o,chatMessage:B(),inputMessage:a.message,interactionId:a.interactionId});let l=new W({description:K.ag._({id:"nyQWMb"}),cardId:a.editorContext.card.cardId,layout:r}),c={label:K.ag._({id:"nyQWMb"}),modification:l,jsonContentPreview:l.getPreviewJson(t)},d=new W({description:K.ag._({id:"HxF6Fk"}),cardId:a.editorContext.card.cardId,layout:a.editorContext.card.attrs.layout}),u={label:K.ag._({id:"HxF6Fk"}),modification:d,jsonContentPreview:d.getPreviewJson(t)},m={from:"Designer",type:"suggestContent",resp:o,message:i||K.ag._({id:"pMSbe+"}),interactionId:a.interactionId,suggestions:[c,u]};return{messages:[m],suggestionToApply:c}}}let $=new J({key:"MOVE_ACCENT_IMAGE",description:"Move or remove the accent image of the card. Use ADD_IMAGE to add accent images.",classifyExamples:["move the sand dune to the left","remove the cover photo"],classifyReply:"Ok, I will move the accent image to the left...",getTaskTarget:e=>e.card,prompt:new o.V({systemPromptOperation:i.Run.ChangeAccentImageLayoutSystem,userPromptOperation:i.Run.ChangeAccentImageLayoutUser,variables:["html","message"],params:{temperature:.2,maxTokens:100}}),checkEnabled(e){let t="blank"!==e.card.attrs.layout;return t}}),Q=new o.V({systemPromptOperation:i.Run.ChangeContentSystem,userPromptOperation:i.Run.ChangeContentUser,variables:["html","message","outline"],params:{temperature:.7,maxTokens:1e3}}),Y=new G.w6({key:"CHANGE_CONTENT",description:"Rephrase, summarize, expand, change text formatting, add content, or express ideas differently.",classifyExamples:["condense this to just the key points","say this like a pirate","make this more formal","add a box about health benefits","add more text please","make the bullets red","make the text bigger","fill in the last  column","write something about ___","add ___ to the table"],classifyReply:"Ok, I'll try making it shorter...",prompt:Q});var Z=a(81136),X=a(39877),ee=a(13773),et=a(50279);let ea=new o.V({systemPromptOperation:i.Run.RateImagesSystem,userPromptOperation:i.Run.RateImagesUser,variables:["dataset"],params:{temperature:.1,maxTokens:100}}),en=async(e,t)=>{let a=e.map((e,t)=>{let{description:a,query:n}=e;return"".concat(t+1,": ").concat(a,": ").concat(n)}).join("\n"),n=ea.prepare({variables:{dataset:a},history:[]}),r=await (0,c.I)(n,t,{timeout:d.VH.get("aiRequestTimeouts").rateImages})||"";return r.split("\n").map(e=>{let[,t]=e.split("-");return Number(t.trim())})};class er extends G.w6{async getResponseData(e,t){let a=(await Promise.all(e.replaceAll(this.key,"").split("\n").map(async e=>{let t=e.split(",").map(e=>e.trim()).slice(0,2),a=await (0,X.J)({queries:t,count:ee.x.count,provider:"web",prefetch:!0,options:{gammaFeature:"aiChat"}});return a}))).flat();console.debug("[SuggestImagesTask][getResponseData] allResults",a);let n=a.map(e=>{let{image:t,query:a}=e,n=(0,et.C)(t,a,"web"),r=(0,et.K)(n)||"";return{description:r,query:a}});console.debug("[SuggestImagesTask][imageRatingData]",{imagesToRate:n});try{let e=await en(n,t);if(console.debug("[SuggestImagesTask][imageRatingValues]",{imageRatingValues:e}),e.length!==a.length)throw Error("Image rating values length does not match allResults length");let r=a.map((t,a)=>({...t,rating:e[a]})),s=r.sort((e,t)=>
1t.rating-e.rating);return console.debug("[SuggestImagesTask][allResultsSorted]",{allResultsSorted:s}),s}catch(e){console.warn("[SuggestImagesTask] Error rating images. Returing unsorted results.",e)}return a}async getResponseMessages(e){let{context:t,response:{message:a,raw:n,suggestion:r}}=e;if(!r)throw new s.$D("No image results were returned",{resp:n,inputMessage:t.message,chatMessage:a||"I'm sorry, I wasn't able to find any images for this.",interactionId:t.interactionId});let o=await this.getResponseData(r,t.interactionId),i={from:"Designer",type:"suggestImages",suggestions:o,resp:n,interactionId:t.interactionId,message:a||"Here are some suggestions:"};return{messages:[i]}}}let es=new er({key:"ADD_IMAGE",description:"Add images, or replace an existing image. Do not use for moving or removing images.",classifyExamples:["add a picture of a bus","find some different images","this needs a pic","show me dolphins","find a meme of stonks","give me more images","add a background image","i need a graph of population over time"],classifyReply:"Let me look for some good bus pictures...",getTaskTarget:e=>e.defaultRange,prompt:new o.V({systemPromptOperation:i.Run.SuggestImagesSystem,userPromptOperation:i.Run.SuggestImagesUser,variables:["html","message"],params:{temperature:.7,maxTokens:500}})});var eo=a(27191),ei=a(5029);class el extends G.w6{getResponseData(e){let t=[];for(let a of e.matchAll(/^\/\/\s*(.*)$\n(.*)$/gm)){let e=a[1],n=a[2];t.push({reason:e,value:n})}return t}async getResponseMessages(e){let{editor:t,context:a,rangeId:n,response:{suggestion:r,message:o,raw:i}}=e;if(!r)throw new s.$D("No suggestions found in response",{interactionId:a.interactionId,inputMessage:a.message,chatMessage:o||K.ag._({id:"7KKeOM"})});let l=this.getResponseData(r),c=l.map(e=>{let a=new ei.O(t,{description:e.reason,content:{type:"html",html:e.value},rangeId:n});return{...e,modification:a}}),d=this.determineTaskTarget(a.editorContext).html,u=new ei.O(t,{description:K.ag._({id:"HxF6Fk"}),content:{type:"html",html:d},rangeId:n}),m={reason:K.ag._({id:"HxF6Fk"}),value:d,modification:u},g={from:"Designer",type:"suggestText",message:o||K.ag._({id:"3YHvwF"}),resp:i,suggestions:[...c,m],interactionId:a.interactionId};return{messages:[g]}}}let ec=new el({key:"SUGGEST_TEXT",description:"Open-ended request to rephrase a sentence or paragraph",classifyExamples:["write a better headline","How else could i say this?","this feels too corporate","suggest a more engaging way to say this","give me a more interesting description"],classifyReply:"Let me think of some other headlines...",getTaskTarget:e=>e.selectionRange,prompt:new o.V({systemPromptOperation:i.Run.SuggestTextSystem,userPromptOperation:i.Run.SuggestTextUser,variables:["html","message"],params:{temperature:.7,maxTokens:1e3}}),checkEnabled(e){let{selection:t}=e,a=t instanceof eo.Bs,n=t.$from.parent.eq(t.$to.parent),r=a&&!t.empty&&t.to-t.from<800&&n;return r}});class ed{apply(e,t){t.setThemeWithAccentImages(this.themeId)}isApplied(e,t){return t.isThemeApplied(this.themeId)}getPreviewJson(){return null}getContentForTracking(){return this.themeId}constructor(e,t){this.type="change-theme",this.description=t.description,this.themeId=t.themeId}}class eu extends G.w6{async getResponseMessages(e){let{editor:t,context:a,response:{raw:n,suggestion:r,message:o},themeModificationController:i}=e,{currentThemeId:l,isValidTheme:c}=i,d=null==r?void 0:r.split("\n"),u=await this.getFilteredSuggestions({ids:d,idToRemove:l,editor:t,isValid:c});if(0===u.length)throw new s.$D("[SuggestContentTask] No themes provided in prompt response",{resp:n,chatMessage:K.ag._({id:"GNHk+9"}),inputMessage:a.message,interactionId:a.interactionId});let m={label:K.ag._({id:"HxF6Fk"}),themeId:l,modification:new ed(t,{description:K.ag._({id:"HxF6Fk"}),themeId:l}),isOriginal:!0},g={from:"Designer",type:"suggestThemes",resp:n,message:o||K.ag._({id:"pMSbe+"}),suggestions:[...u,m],interactionId:a.interactionId};return{messages:[g],suggestionToApply:u[0]}}async getFilteredSuggestions(e){let{ids:t,idToRemove:a,editor:n,isValid:r}=e;if(!t||0===t.length)return[];let s=await Promise.all(t.map(e=>r(e).then(t=>t?e:null))),o=s.filter(e=>null!==e).filter(e=>e!==a).map(e=>{let t=new ed(n,{description:K.ag._({id:"nyQWMb"}),themeId:e});return{label:K.ag._({id:"nyQWMb"}),themeId:e,modification:t}});return o}}let em=new o.V({systemPromptOperation:i.Run.SuggestThemeSystem,userPromptOperation:i.Run.SuggestThemeUser,variables:["html","message","outline"],params:{temperature:.7,maxTokens:100,model:"gpt-4-1106-preview"}}),eg=new eu({key:"SUGGEST_THEME",description:"Suggest a theme for the deck. This task will suggest themes based on the deck content or the prompt",classifyExamples:["change the theme","give me a blue theme","change the color palette","make this a dark theme","use a more colorful theme","let'
1s change the look and the feel","change the theme to lilac and periwinkle","i'd like it to look more cheerful and welcoming"],classifyReply:"Let me find some themes...",prompt:em}),ep=[$,Z.a,Y,ec,es,U,eg],eh=e=>ep.find(t=>t.key===e),ef=e=>!!ep.find(t=>t.key===e);class ey extends l.B{async run(e){let{classificationResult:t,addMessage:a,context:n,trackFns:r}=e;a({from:"Designer",type:"unsupported",task:t.classification,message:this.apology,learnMoreLink:this.apologyLink,resp:t.resp,interactionId:n.interactionId}),r.trackRequestComplete({taskContext:n,outputMessage:this.apology})}constructor(e){super(e),this.apology=e.apology,this.apologyLink=e.apologyLink}}let ex=new ey({key:"CHANGE_CARD_BACKGROUND",description:"Change the background of the entire section.",classifyExamples:["make the background red","put a tunnel in the background","remove the background","get rid of the image in the background"],apology:"Sorry, I can't change backgrounds yet, but you can click on a card and change the background yourself. You can also change the document background by clicking Page Setup located at the top left corner of the page."}),ek=new ey({key:"CHANGE_FONT",description:"Change the font family or font style.",classifyExamples:["give me a more playful font","make the headings use arial","change the font to be more readable"],apology:"Sorry, I can't 
1change fonts yet. But you can edit them yourself by creating a custom theme.",apologyLink:"https://gamma.app/public/o2he6ual8noal7u#card-82e40n78edir2x8"}),eb=new ey({key:"RESIZE_IMAGE",description:"Change the size of an image (its dimensions), or crop an image",classifyExamples:["make the image smaller","can you make the cat bigger","crop it so it's just the face","I want the disposition of the photos for more portrait instead of landscape"],apology:"Sorry, I can't resize images yet. But you can do it yourself by clicking on the image and dragging the boxes on the corners, or pressing the crop button above the image."}),ew=new ey({key:"EDIT_IMAGE",description:"Edit the appearance of an image",classifyExamples:["make the image brighter","add a blue border to the image","make the image black and white","add a nice filter to the image"],apology:"Sorry, I can't edit images yet."}),eI=new ey({key:"EXPORT",description:"Export or download the deck into a different a format.",classifyExamples:["download as ppt","make a pdf","export to google slides"],apology:"Sorry, I can't export files yet. However, you can download a PDF yourself by using the Share menu."}),ev=new ey({key:"SPLIT_CARD",description:"Split a card into multiple cards, or move content between cards.",classifyExamples:["break this into two cards","split this up as multiple slides","put the gallery on the next card"],apology:"Sorry, I can't split cards or move things between them yet. However, you can split cards yourself by typing /split inside a card."}),eC=new ey({key:"NEW_DECK",description:"Create a whole new deck",classifyExamples:["i need a presentation about [topic]","write a whole document about animal","make me a landing page about this"],apology:"To make a new deck, go back to the home screen and click New with AI."}),eS=new ey({key:"CHANGE_MULTIPLE_CARDS",description:"Make changes across multiple cards at once",classifyExamples:["I want this entire deck to be summarized","combine the cards together in one","make the whole doc sound more professional","make the deck more consistent","translate all of the cards","change the font for the whole deck"],apology:"Sorry, I can only change one card at a time right now."}),ej=new ey({key:"CHANGE_ANOTHER_CARDS",description:"Make changes for an unselected card",classifyExamples:["make the same change for the next card","do the same thing for the other cards","change the last card too","make this layout match the layout of the previous card","copy the first section from the last card here"],apology:"Sorry, I can only look at one card at a time right now. You can have me edit other cards by clicking on them."}),eE=new ey({key:"ADD_VIDEO",description:"Add a video or replace an existing video",classifyExamples:["add a youtube video about scrum","find videos of cats","i need more videos"],apology:"Sorry, I can't search for videos yet. You can embed video by copying the URL and pasting it into the card directly."}),eA=new ey({key:"ADD_FOOTNOTE",description:"Add a footnote to a card, or change footnotes",classifyExamples:["add a biography for him in a footnote","put the details into footnotes"],apology:"Sorry, I haven't learned to add footnotes yet. You can make footnotes by highlighting text and clicking the footnote button in the menu."}),eR=new ey({key:"MOVE_CARD",description:"Move a card to a different position in the deck",classifyExamples:["shift the slide to the top","move this card to the bottom"],apology:"Sorry, I haven't learned to move cards yet. You can move them by hovering on the table of contents on the left side of the screen and dragging them around."}),eT=new ey({key:"ADD_CHART",description:"Add a chart, diagram, or graph",classifyExamples:["put this information into a scatter plot","add a card about market share using a pie chart","i need to display this as a flow chart","create a diagram illustrating the interactions and relationships","can you change the card to have a line graph","turn this into a gantt chart","could you do this as a funnel diagram"],apology:"Sorry, Gamma doesn't support charts yet. You can paste in images of charts from other tools, or type /diagram in the editor to draw your own."}),eM=new ey({key:"ANIMATION",description:"Add animations to a card or edit animations",classifyExamples:["animate transitions","make the text appear one by one","fade in the images","make the bullets fly in"],apology:'Sorry, Gamma doesn\'t support custom animations yet. You can animate line by line by going into Present mode and pressing S for "spotlight".'}),e_=new ey({key:"FOLLOW_LINK",description:"Read content from an external website",classifyExamples:["go to this website and add the content to this card http://www.example.com/","here is his linkedin page now add the details https://www.linkedin.com/...","add the images from https://medium.com/posts/2022/9/6/..."],apology:"Sorry, I'm not able to open links and read the content."}),eD=new ey({key:"SHADOW",description:"Add or edit shadow for an element or text",classifyExamples:["add a drop shadow to the image","make the text have a shadow","make the button have a darker shadow"],apology:"Sorry, I'm not able to add custom shadows yet."}),eN=[ex,ek,eb,ew,eI,ev,eC,eS,ej,eE,eA,eR,eT,eM,e_,eD],eO=e=>eN.find(t=>t.key===e),eP=e=>!!eO(e),eq=new o.V({variables:["message","taskList","ackExamples","html","cardHtml"],systemPromptOperation:i.Run.ClassifySystem,userPromptOperation:i.Run.ClassifyUser,params:{maxTokens:100,temperature:.2}}),eF=[...ep,...eN,...h,...E],eL="\uD83D\uDE14 Sorry, I didn't understand your request. Could you please try asking a different way?",eG=async e=>{let{message:t,context:a,history:n,provider:r}=e,{ackExamples:s,taskList:o,enabledTasks:i}=eU(eF,a.editorContext),l=eK(n),d=eq.prepare({variables:{message:t,ackExamples:s,taskList:o,html:a.editorContext.defaultRange.html,cardHtml:a.editorContext.card.html},params:{provider:r},history:l});console.debug("[AIChat classify] Getting classification",{classifyHistory:l,input:d});let u=await (0,x.oO)(d),m=await (0,c.I)(u,a.interactionId,{timeout:k.VH.get("aiRequestTimeouts").classify}),g=eH(m,i);return(g||(console.debug("Failed classification, trying again...",{resp:m,parsedResp:g}),g=eH(m=await (0,c.I)(d,a.interactionId),i)),g)?(console.debug("[AIChat classify] Got classification",{resp:m,parsedResp:g}),g):{type:"UNKNOWN",classification:"UNKNOWN",ack:eL,resp:m||""}},ez="Ok, I'll get right on it.",eH=(e,t)=>{var a;if(!e)return;let n=e.split("\n"),r=null===(a=n[0])||void 0===a?void 0:a.trim().toUpperCase(),s=t.find(e=>e.key===r);if(!s)return;let o=n[1];return{classification:r.trim(),ack:o.includes(r.trim())?ez:o||("UNKNOWN"!==r?ez:eL),resp:e,type:"CLASSIFICATION"}},eU=(e,t)=>{let a=e.filter(e=>!t||!e.checkEnabled||e.checkEnabled(t)),n=a.map(e=>{var t;return"".concat(e.key,": ").concat(e.description,"\n").concat(null===(t=e.classifyExamples)||void 0===t?void 0:t.map(e=>"- ".concat(e)).join("\n"))}).join("\n\n"),r=a.filter(e=>e.classifyExamples&&e.classifyExamples.length>0&&e.classifyReply).map(e=>"Request:\n".concat(e.classifyExamples[0],"\nResponse:\n").concat([e.key,e.classifyReply].join("\n"))).join("\n\n");return{taskList:n,ackExamples:r,enabledTasks:a}},eK=e=>e.slice(-7).map(e=>"User"===e.from?{role:i.XaP.User,content:e.message}:e.isClassification?{role:i.XaP.Assistant,content:e.resp}:null).filter(e=>!!e);var eV=a(26961),eW=a(54680),eB=a(97763),eJ=a(7144),e$=a(91994),eQ=a(77787),eY=a(66625),eZ=a(47968),eX=a(11093),e0=a(46795),e1=a(74684);let e2=(e,t)=>{let{content:a}=e.state.doc.slice(t.from,t.to);return(0,eQ.c)(e,a)},e7=(e,t)=>{let{selection:a}=e.state,n=(0,eX.Ru)(a.$from,O.KH)[0],r=n&&(0,e1.NE)(n.node,n.pos);if(!n||!r)throw Error("Cant find parent card for selection ".concat(a));let s={from:n.pos,to:n.pos+n.node.nodeSize},o={from:r.pos+1,to:r.pos+r.node.nodeSize-1},i=a.$from.blockRange(a.$to),l={from:i.start,to:i.end},c={range:(0,e0.bb)(e.state,o),html:e2(e,o)},d={range:(0,e0.bb)(e.state,a),html:e2(e,a)},u={range:(0,e0.bb)(e.state,l),html:e2(e,l)},m=a instanceof eo.qv&&(0,O.KH)(a.node)||a.empty||0===d.html.trim().length||a instanceof eo.qv&&a.node.isAtom,g=!a.$from.parent.eq(a.$to.parent)||0===i.$from.parentOffset&&i.$to.parentOffset===i.$to.parent.content.size,p=d,h="selectionRange";m?(p=c,h="cardContent"):g&&(p=u,h="blockRange");let f=e5(t),y=(0,eZ.Pu)(t.getState());return{card:{cardId:n.node.attrs.id,range:(0,e0.bb)(e.state,s),html:e2(e,s),attrs:n.node.attrs},cardContent:c,blockRange:u,selectionRange:d,defaultRange:p,selection:a,outline:f,selectedDefaultRange:h,theme:y}},e5=e=>{let t=e.getState(),a=(0,eZ.X9)(t),n=(0,eY.mT)(t),r=Object.keys(a.tree).map(e=>{var t;return null===(t=n.find(t=>
1t.id===e))||void 0===t?void 0:t.title}).filter(e=>!!e);return r.join("\n")};var e9=a(43176),e3=a(26031);let e4=e=>{let{editor:t,addMessage:a,getMessageHistory:o}=e,i=(0,e$.qr)(),l=(0,e9.E)(),{hasEnoughCreditsToChat:c}=(0,eB.qO)(),d=(0,eV.T)(),u=(0,eW.g5)(),m=(0,e$.TL)(),g=(0,e$.CG)(e3.mW),p=(0,r.useCallback)(e=>{m((0,e3.Tf)(e))},[m]),h=(0,r.useCallback)(async e=>{let r,m,g,{message:h}=e;if(!t)return;let k=(0,w.nZ)();try{r=e7(t,i),m={interactionId:k,startTime:performance.now(),message:h,editorContext:r,docId:t.gammaDocId},console.debug("[AIChat] starting interaction",m);let e=o();if(a({from:"User",type:"text",message:h,interactionId:k}),l.trackRequestSent(m,u),!c)return;p("classifying");let n=await eG({message:h,context:m,history:e,provider:u});if(l.trackClassification({taskContext:m,classification:n.classification}),p("fetching"),console.debug("[AIChat] Starting task",{taskContext:m,classification:n.classification,history:e}),"UNKNOWN"===n.type)a({from:"Designer",type:"text",message:n.ack,resp:n.resp,isClassification:!0,interactionId:k}),l.trackRequestComplete({taskContext:m,outputMessage:n.ack});else if(y(n.classification)){let r=f(n.classification);await r.run({editor:t,addMessage:a,context:m,classificationResult:n,history:e,trackFns:l,themeModificationController:d,provider:u})}else if(eP(n.classification)){let r=eO(n.classification);await r.run({editor:t,context:m,addMessage:a,classificationResult:n,history:e,trackFns:l,themeModificationController:d,provider:u})}else if(ef(n.classification)){a({from:"Designer",type:"text",message:n.ack||"Sure, let me see what I can do...",resp:n.resp,isClassification:!0});let e=o(),r=eh(n.classification);await r.run({editor:t,context:m,addMessage:a,classificationResult:n,history:e,trackFns:l,themeModificationController:d,provider:u}),g="chatSuggestion"}else if(R(n.classification)){a({from:"Designer",type:"text",message:n.ack||"Sure, let me see what I can do...",resp:n.resp,isClassification:!0});let r=A(n.classification);await r.run({editor:t,context:m,addMessage:a,classificationResult:n,history:e,trackFns:l,themeModificationController:d,provider:u}),g="generateImage"}}catch(t){console.log("[AIChat.sendMessage] ERROR: ".concat(t.message,"}"),{err:t,taskContext:m});let e="Sorry, something unexpected happened. Please try again.";if(t instanceof s.Og){let n=t.opts.chatMessage||e;a({from:"Designer",type:"text",message:n,resp:t.opts.resp,interactionId:k}),l.trackRequestError({errorName:t.name,interactionId:k,outputMessage:n,errorMessage:t.message,resp:t.opts.resp})}else n.Tb(t),a({from:"Designer",type:"text",message:e,interactionId:k}),l.trackRequestError({errorName:t.name,interactionId:k,outputMessage:e,errorMessage:t.message,errorCode:(0,x.uc)(t)[0]})}g&&(0,eJ.d)(g),p("idle")},[t,i,o,a,l,c,d,u,p]);return{sendMessage:h,status:g}}},18412:function(e,t,a){a.d(t,{T:function(){return r}});var n=a(76919);let r=new n.v}}]);
2//# sourceMappingURL=5641-976b61f2ff508e90.js.map

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.