1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[12],{52133:function(a,b,c){c.d(b,{Z:function(){return at}});var d=c(47568),e=c(828),f=c(34051),g=c.n(f),h=c(85893),i=c(67294),j=c(1591),k=c(59009),l=c(24794),m=c(85639),n=c(26605),o=c(46869),p=c(22318),q=c(73637),r=c(45258),s=c(28358),t=c(17812),u=c(67265),v=c(50253),w=c(33426),x=c(7397),y=c(95477),z=c(282),A=c(39636),B=c(55517),C=c(51972),D=c(19814),E=c(75898),F=c(95306),G=c(17215),H=c(71987),I=c(64126),J=c(59544),K=c(11163),L=c(51472),M=c(77941),N=c(26042),O=c(29815),P=c(82285),Q=c(52663),R=c(33681),S=c(62822),T=c(50998),U=c(95757),V=c(81860),W=c(80797),X=c(72156),Y=c(7806),Z=c(84434),$=c(39777),_=c(69396),aa=c(88767),ab=c(22264),ac=c(45823);function ad(){var a=(0,ac.Z)().user;return(0,aa.useQuery)(["notifications",Boolean(null==a?void 0:a.uid)?a.uid:"guest"],(0,d.Z)(g().mark(function b(){var c,d;return g().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(c={all:[],normalPriority:[],highPriority:[]},"loading"!=a.status){b.next=3;break}return b.abrupt("return",c);case 3:return b.next=5,ab.RZ.collection("notifications").where("to","==",Boolean(null==a?void 0:a.uid)?a.uid:"guest").where("status","==","unread").get();case 5:return(d=b.sent).empty||(c.all=d.docs.map(function(a){return(0,_.Z)((0,N.Z)({},a.data()),{notificationId:a.id})}).sort(function(a,b){return a.addedAt>b.addedAt?-1:1}),c.normalPriority=c.all.filter(function(a){return 1!=a.priority}),c.highPriority=c.all.filter(function(a){return 1==a.priority})),b.abrupt("return",c);case 8:case"end":return b.stop()}},b)})),{retry:2,keepPreviousData:!0})}var ae=c(29413),af=c(22783),ag=i.forwardRef(function(a,b){return(0,h.jsx)(P.Z,(0,N.Z)({direction:"up",ref:b},a))}),ah=function(a){var b=a.notification,c=a.selectedNotifications,d=a.setSelectedNotifications,e=function(){d(c.includes(b.notificationId)?c.filter(function(a){return a!=b.notificationId}):(0,O.Z)(c).concat([b.notificationId]))};return(0,h.jsxs)(T.Z,{button:!0,onClick:e,children:[1==b.priority&&(0,h.jsx)(o.Z,{children:(0,h.jsx)(Y.Z,{fontSize:"small"})}),(0,h.jsx)(U.Z,{primary:b.content.text,secondary:b.type}),(0,h.jsx)(V.Z,{children:(0,h.jsx)(W.Z,{edge:"end",checked:c.includes(b.notificationId),onClick:e})})]})},ai=function(a){var b,c,f,j,k,l=a.data,m=a.dialog,n=a.setCreateAccount,o=a.setDialog,q=a.setSnack,r=l||[],s=(0,$.Z)(),u=(0,af.yK)(),w=(c=ad(),f=(0,aa.useQueryClient)(),(0,aa.useMutation)((j=(0,d.Z)(g().mark(function a(b){var e,f;return g().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return f=(e=c.data).all.map(function(a){return(0,_.Z)((0,N.Z)({},a),{status:b.includes(a.notificationId)?"read":a.status})}),a.next=4,Promise.all(f.map(function(){var a=(0,d.Z)(g().mark(function a(b){return g().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,ab.RZ.collection("notifications").doc(b.notificationId).update({status:b.status});case 2:case"end":return a.stop()}},a)}));return function(b){return a.apply(this,arguments)}}()));case 4:return a.abrupt("return",f);case 5:case"end":return a.stop()}},a)})),function(a){return j.apply(this,arguments)}),{onSuccess:function(){f.invalidateQueries(["notifications"])}})),x=(0,ac.Z)().user,y=(0,ae.Z)(),A=(0,e.Z)(i.useState([]),2),B=A[0],C=A[1],D=(k=(0,d.Z)(g().mark(function a(){return g().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(Boolean(null==x?void 0:x.uid)){a.next=4;break}return o(!1),setTimeout(function(){n(!0)},250),a.abrupt("return");case 4:return a.next=6,w.mutateAsync(B.length?B:l.all.map(function(a){return a.notificationId}),{onError:function(a){console.error("Error marking notifications as read: ".concat(a)),q({open:!0,message:"There was an error handling this request",severity:"error"}),s.mutate({activity:"marking notifications read",error:JSON.stringify(a),location:"FlexiNotifications.js",type:"error"})},onSuccess:function(){C([])}});case 6:case"end":return a.stop()}},a)})),function(){return k.apply(this,arguments)}),E=function(){C([]),o(!1)};return(0,h.jsx)(h.Fragment,{children:(0,h.jsxs)(Q.Z,{fullScreen:"xs"==y,open:Boolean(m),onClose:E,TransitionComponent:ag,children:[w.isLoading&&(0,h.jsx)(R.Z,{}),(0,h.jsxs)(v.Z,{width:"xs"==y?"inherit":af.Ru,children:[(0,h.jsx)(v.Z,{className:u.dialogHeader,p:2,children:(0,h.jsxs)(v.Z,{alignItems:"center",display:"flex",children:[(0,h.jsxs)(v.Z,{alignItems:"center",display:"flex",flexGrow:1,children:[(0,h.jsx)(t.Z,{edge:"start",onClick:E,children:(0,h.jsx)(X.Z,{})}),(0,h.jsxs)(p.Z,{variant:"body1",children:["Notifications"," ",(null==r?void 0:null===(b=r.all)|| void 0===b?void 0:b.length)>0?"("+r.all.length+")":""]})]}),(0,h.jsx)(z.Z,{disabled:w.isLoading||!l.all.length,onClick:D,size:"small",variant:"outlined",children:"Mark ".concat(B.length?B.length:"All"," Read")})]})}),0==l.all.length?(0,h.jsx)(v.Z,{p:2,children:(0,h.jsx)(Z.Z,{override:{action:(0,h.jsx)(z.Z,{onClick:E,size:"small",variant:"outlined",children:"Close"})},text:"You don't have any notifications to review."})}):(0,h.jsx)(S.Z,{dense:!0,children:(0,O.Z)(r.highPriority).concat((0,O.Z)(r.normalPriority)).map(function(a){return(0,h.jsx)(ah,{notification:a,selectedNotifications:B,setSelectedNotifications:C},a.notificationId)})})]})]})})},aj=c(87662),ak=c(37693),al=c(88081),am=c(86198),an=c(93127),ao=c(46905),ap=c(45767),aq=c(83846),ar=c(56362),as=(0,j.Z)(function(a){return{badge:{border:"2px s
1olid ".concat(a.palette.background.paper),padding:"0 4px",right:10,top:13}}})(k.Z);function at(a){var b,c,f,j,A=a.isSelecting,B=a.setClicked,J=a.setEditing,N=a.setIsSelecting,O=a.setSelectedNotes,P=a.setShowSearchShortcuts,Q=a.setSnack,R=(0,$.Z)(),S=(0,af.yK)(),T=(0,ap.Z)(),U=(0,ar.Z)(),V=ad(),W=(0,K.useRouter)(),X=W.query,Y=X.promptId,Z=X.query,_=(0,aq.Z)(),aa=(0,ac.Z)().user,ab=(0,ae.Z)(),ag=(0,e.Z)(i.useState(!1),2),ah=ag[0],an=ag[1],ao=(0,e.Z)(i.useState(null),2),at=ao[0],av=ao[1],aw=(0,e.Z)(i.useState(!1),2),ax=aw[0],ay=aw[1],az=(0,e.Z)(i.useState(!1),2),aA=az[0],aB=az[1],aC=(0,e.Z)(i.useState(!1),2),aD=aC[0],aE=aC[1],aF=(0,e.Z)(i.useState(""),2),aG=aF[0],aH=aF[1];i.useEffect(function(){W.isReady&&Boolean(Z)&&aH(Z)},[W.query]);var aI=null===(b=_.data)|| void 0===b?void 0:b.find(function(a){return a.promptId==Y}),aJ=!1;Boolean(Y)&&("xs"==ab||"sm"==ab)&&_.isSuccess&&Boolean(aI)&&!Boolean(null==aI?void 0:null===(j=aI.access)|| void 0===j?void 0:j.includes(null==aa?void 0:aa.uid))&&"loggedOut"==aa.status&&(aJ=!0);var aK,aL="loggedIn"==aa.status,aM=V.isSuccess&&"loading"!=aa.status&&ab,aN=(aK=(0,d.Z)(g().mark(function a(){return g().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:if(!("loggedIn"!=aa.status)){a.next=3;break}return an(!0),a.abrupt("return");case 3:return a.next=5,T.mutateAsync({obj:aI,uid:aa.uid},{onError:function(a){console.error("Error copying prompt: ".concat(a)),Q({open:!0,message:"There was an error handling this request",severity:"error"}),R.mutate({activity:"copying prompt",error:JSON.stringify(a),location:"Navbar.js",type:"error"})},onSuccess:function(a){Q({open:!0,message:"Prompt duplicated",severity:"success"}),W.push("/?promptId=".concat(a.promptId))}});case 5:case"end":return a.stop()}},a)})),function(){return aK.apply(this,arguments)}),aO=function(){av(null)},aP=function(){if(!Boolean(aG)){W.push((0,ak.B)("".concat(window.location.origin,"/search"),W,["query",])),P(!1);return}if(aG.length<4){Q({open:!0,message:"Please add a longer search query",severity:"warning"});return}W.push((0,ak.B)("".concat(window.location.origin,"/search"),W,["query"],[{key:"query",value:encodeURI(aG)}])),P(!1)},aQ=(0,h.jsxs)(l.Z,{anchorEl:at,anchorOrigin:{vertical:"top",horizontal:"right"},keepMounted:!0,transformOrigin:{vertical:"top",horizontal:"right"},open:Boolean(at),onClose:aO,children:[(0,h.jsxs)(m.Z,{onClick:function(){ay(!0),av(null)},children:[(0,h.jsx)(n.ZP,{title:"Notifications",children:(0,h.jsx)(o.Z,{color:"inherit",children:(0,h.jsx)(C.Z,{})})}),(0,h.jsxs)(p.Z,{variant:"inherit",children:["Notifications",V.isSuccess&&V.data.all.length?" (".concat(V.data.all.length,")"):""]})]}),(0,h.jsxs)(m.Z,{onClick:function(){aa&&"loggedIn"===aa.status?aE(!0):an(!0),av(null)},children:[(0,h.jsx)(o.Z,{color:"inherit",children:(0,h.jsx)(D.Z,{})}),(0,h.jsx)(p.Z,{variant:"inherit",children:"Profile"})]}),(!Boolean(aI)||(null==aI?void 0:null===(c=aI.access)|| void 0===c?void 0:c.includes(null==aa?void 0:aa.uid)))&&Boolean(N)&&(null==aa?void 0:aa.status)=="loggedIn"&&"/search"==W.pathname&&(0,h.jsxs)(m.Z,{onClick:function(){av(null),setTimeout(function(){A?(O([]),N(!1)):N(!0)},250)},children:[(0,h.jsx)(n.ZP,{title:A?"Select Notes":"StopSelecting",children:(0,h.jsx)(o.Z,{color:"inherit",children:(0,h.jsx)(E.Z,{})})}),(0,h.jsx)(p.Z,{variant:"inherit",children:A?"Stop Selecting":"Select Notes"})]})]});return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(q.Z,{in:!0,timeout:500,children:(0,h.jsxs)("div",{className:S.grow,children:[(0,h.jsx)(r.Z,{color:"inherit",position:"fixed",children:(0,h.jsxs)(s.Z,{children:["xs"==ab||"sm"==ab?(0,h.jsx)(t.Z,{edge:"start",className:S.menuButton,color:"inherit",onClick:function(){return aB(!0)},children:(0,h.jsx)(F.Z,{})}):(0,h.jsx)(n.ZP,{title:"Home",children:(0,h.jsx)(u.Z,{alt:"Eazl.ai Logo",className:"loggedIn"==aa.status?S.cursor:null,onClick:function(){"loggedIn"==aa.status&&W.push("/")},src:am.Lw,variant:"square"})}),"xs"!=ab&&"sm"!=ab&&(0,h.jsx)(v.Z,{className:"loggedIn"==aa.status?S.cursor:null,ml:2,onClick:function(){"loggedIn"==aa.status&&W.push("/")},children:(0,h.jsx)(p.Z,{className:S.title,variant:"h6",noWrap:!0,children:"Eazl.ai"})}),aL&&(0,h.jsx)(v.Z,{ml:"xs"==ab?0:2,width:"xs"==ab?"inherit":300,children:(0,h.jsx)("form",{onSubmit:function(a){a.preventDefault(),aP()},children:(0,h.jsx)(w.Z,{autoComplete:"off",fullWidth:!0,InputProps:{endAdornment:(0,h.jsx)(x.Z,{position:"end",children:(0,h.jsx)(n.ZP,{title:"Search your stuff",children:(0,h.jsx)(t.Z,{edge:"end",size:"small",onClick:aP,children:(0,h.jsx)(G.Z,{})})})})},onChange:function(a){return aH(a.target.value)},onFocus:function(){Boolean(aG)||P(!0)},placeholder:"Searchâ¦",value:aG})})}),(0,h.jsx)("div",{className:S.grow}),(0,h.jsxs)("div",{className:S.sectionDesktop,children:[(0,h.jsx)(n.ZP,{title:"Notifications",children:(0,h.jsx)(t.Z,{color:"inherit",onClick:function(){return ay(!0)},children:(0,h.jsx)(k.Z,{badgeContent:aM?V.data.all.length:0,color:"secondary",overlap:"rectangular",children:(0,h.jsx)(C.Z,{})})})}),(0,h.jsx)(n.ZP,{title:"My Profile",children:(0,h.jsx)(v.Z,{className:S.hover,onClick:function(){aa&&"loggedIn"===aa.status?aE(!0):an(!0)},children:aa&&"loggedIn"===aa.status?(0,h.jsx)(v.Z,{ml:2,children:(0,h.jsx)(k.Z,{badgeContent:aa.emailVerified?0:1,color:"error",overlap:"circular",variant:"dot",children:Boolean(null==U?void 0:U.data)?Boolean(null==U?void 0:null===(f=U.data)|| void 0===f?void 0:f.profilePic)?(0,h.jsx)(u.Z,{src:U.data.profilePic}):(0,h.jsx)(u.Z,{children:(0,al.ZM)(U.data).charAt(0)}):(0,h.jsx)(u.Z,{children:(0,h.jsx)(y.Z,{})})})}):(0,h.jsx)(t.Z,{color:"inherit",children:(0,h.jsx)(D.Z,{})})})})]}),(0,h.jsxs)("div",{className:S.sectionMobile,children:[aJ&&(0,h.jsx)(v.Z,{mr:1,children:(0,h.jsx)(q.Z,{in:!0,timeout:800,children:(0,h.jsx)(z.Z,{onClick:aN,size:"small",startIcon:(0,h.jsx)(H.Z,{}),variant:"outlined",children:"Save Prompt"})})}),(0,h.jsx)(as,{badgeContent:V.isSuccess?V.data.all.length:0,color:"secondary",overlap:"rectangular",children:(0,h.jsx)(t.Z,{onClick:function(a){av(a.currentTarget)},color:"inherit",children:(0,h.jsx)(I.Z,{})})})]})]})}),(0,h.jsx)(s.Z,{}),aQ,(0,h.jsx)(au,{open:aA,setClicked:B,setEditing:J,setOpen:aB,setSearchString:aH,setSelectedNotes:O,setShowSearchShortcuts:P,setSnack:Q})]})}),(0,h.jsx)(L.ZP,{dialog:aD,setDialog:aE,setSnack:Q}),(0,h.jsx)(M.ZP,{dialog:ah,setDialog:an,setSnack:Q}),(0,h.jsx)(ai,{data:V.isSuccess?V.data:{all:[],normalPriority:[],highPriority:[]},dialog:ax,setCreateAccount:an,setDialog:ay,setSnack:Q}),(0,h.jsx)(aj.Z,{dialog:T.isLoading})]})}var au=function(a){var b=a.open,c=a.setClicked,d=a.setEditing,e=a.setOpen,f=a.setSearchString,g=a.setShowSearchShortcuts,i=a.setSnack,j=(0,af.yK)(),k=(0,aq.Z)(),l=(0,K.useRouter)(),m=(null==l?void 0:l.pathname)=="/search";return(0,h.jsx)(v.Z,{role:"presentation",children:(0,h.jsxs)(A.ZP,{anchor:"left",open:b,variant:"persistent",children:[(0,h.jsxs)(v.Z,{className:j.dialogHeader,children:[(0,h.jsxs)(v.Z,{alignItems:"center",display:"flex",height:af.zP,children:[(0,h.jsx)(v.Z,{flexGrow:1,children:(0,h.jsxs)(v.Z,{alignItems:"center",className:j.hover,dis
1play:"flex",ml:2,onClick:function(){e(!b),l.push("/")},py:1,children:[(0,h.jsx)(u.Z,{alt:"Eazl.ai Logo",src:am.Lw,variant:"square"}),(0,h.jsx)(v.Z,{ml:1,children:(0,h.jsx)(p.Z,{variant:"h6",children:"Eazl.ai"})})]})}),(0,h.jsx)(t.Z,{onClick:function(){return e(!b)},children:(0,h.jsx)(J.Z,{})})]}),(0,h.jsx)(B.Z,{})]}),m?(0,h.jsx)(v.Z,{width:250,children:(0,h.jsx)(ao.Z,{setClicked:c,setEditing:d,setOpen:e,setSnack:i})}):(0,h.jsx)(an.ZP,{myPromptsQuery:k,setEditing:d,setOpen:e,setSearchString:f,setShowSearchShortcuts:g,setSnack:i})]})})}},33129:function(a,b,c){c.d(b,{Z:function(){return f}});var d=c(828),e=c(67294);function f(){var a=(0,d.Z)(e.useState(!1),2),b=a[0],c=a[1];return e.useEffect(function(){c(!0)},[]),b}}}])
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.