1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[378],{4312:function(e,t,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/test",function(){return i(6808)}])},1309:function(e,t,i){"use strict";i.d(t,{Z:function(){return s}});var r=i(7294),a=i(7565);let n="trendingsCache";function s(){let[e,t]=(0,r.useState)([]),[i,s]=(0,r.useState)(!0),{mutateAsync:l}=a.h.trending.getTrending.useMutation();(0,r.useEffect)(()=>{try{var e;let i=JSON.parse(localStorage.getItem(n)||"{}");Date.now()-i.ts<3e5&&(null===(e=i.list)||void 0===e?void 0:e.length)&&(t(i.list),s(!1))}catch(e){}},[]);let o=(0,r.useCallback)(async()=>{s(!0);try{let{error:e,list:i}=await l();e||(t(i),localStorage.setItem(n,JSON.stringify({ts:Date.now(),list:i})))}finally{s(!1)}},[l]);return(0,r.useEffect)(()=>{0===e.length&&o()},[e.length,o]),{trendings:e,isLoadingTrending:i,refreshTrendings:o}}},3352:function(e,t,i){"use strict";var r=i(3299),a=i(7294),n=i(9754),s=i(673),l=i(7565);t.Z=()=>{let{mutateAsync:e}=l.h.bookmark.add.useMutation(),{mutateAsync:t}=l.h.bookmark.get.useMutation(),{mutateAsync:i}=l.h.bookmark.delete.useMutation(),{data:o,status:d}=(0,r.useSession)(),{isSubscribed:c}=(0,s.L)(),{setGuessWallShow:u}=(0,n.H)(),[p,h]=(0,a.useState)([]),g=(0,a.useCallback)(async t=>{var i,r;let{data:a,topic:n}=t;a&&n&&"unauthenticated"!==d&&(null==o?void 0:null===(i=o.user)||void 0===i?void 0:i.id)?(await e({userId:null==o?void 0:null===(r=o.user)||void 0===r?void 0:r.id,topic:n,data:a}),alert("Added to Bookmark")):c||u(!0)},[d]),v=(0,a.useCallback)(async()=>{var e,i;if("unauthenticated"!==d&&(null==o?void 0:null===(e=o.user)||void 0===e?void 0:e.id)){let e=await t({userId:null==o?void 0:null===(i=o.user)||void 0===i?void 0:i.id});e.error||h(e.data)}},[d]),x=(0,a.useCallback)(async e=>{var t,r;let{bookmarkId:a,modelId:n}=e;if("unauthenticated"!==d&&(null==o?void 0:null===(t=o.user)||void 0===t?void 0:t.id)){let e=await i({userId:null==o?void 0:null===(r=o.user)||void 0===r?void 0:r.id,bookmarkId:a,modelId:n});if(!e.error){let e=p.find(e=>e._id===a);if(e.listsID.length>=2){let e=p.map(e=>(e._id===a&&(e.lists=e.lists.filter(e=>e._id!==n),e.listsID=e.listsID.filter(e=>e!==n)),e));h(e)}else{let e=p.filter(e=>e._id!==a);h(e)}}}},[d,p]);return(0,a.useEffect)(()=>{},[d]),{addToBookmark:g,getBookmark:v,bookmarks:p,deleteBookmark:x}}},7105:function(e,t,i){"use strict";var r=i(7565),a=i(7636),n=i(7294),s=i(284),l=i(1163),o=i(673);t.Z=()=>{let{mutateAsync:e}=r.h.news.getRelevance.useMutation(),{mutateAsync:t}=r.h.news.getNarrativeTitles.useMutation(),{mutateAsync:i}=r.h.news.saveStory.useMutation(),{mutateAsync:d}=r.h.news.getStory.useMutation(),{mutateAsync:c}=r.h.news.updateStory.useMutation(),{mutateAsync:u}=r.h.user.customerSubscribe.useMutation(),{mutateAsync:p}=r.h.trending.getTopic.useMutation(),{setStory:h,setIsLoadingNarrativeStream:g,setTopicMatches:v,addStoryProgress:x,setStoryProgress:y,setTopicKey:b}=(0,s.y)(),{user:f}=(0,o.L)(),[m,j]=(0,n.useState)([]),[k,S]=(0,n.useState)(!1),[C,w]=(0,n.useState)(!1),[_,T]=(0,n.useState)(a.ZP.PINECODE_FILTER.score),[E,N]=(0,n.useState)(!1),[I,D]=(0,n.useState)(""),[M,P]=(0,n.useState)([]),[A,L]=(0,n.useState)(""),[K,Z]=(0,n.useState)(""),[O,q]=(0,n.use
1State)(!1),[R,U]=(0,n.useState)([]),[B,F]=(0,n.useState)(0),[J,G]=(0,n.useState)([]),[H,X]=(0,n.useState)(a.ZP.PINECODE_FILTER.topK),[V,z]=(0,n.useState)([]),[Q,W]=(0,n.useState)("include"),Y=(0,l.useRouter)(),{push:$,query:ee,pathname:et}=Y,ei=ee.searchType,er="keyword"===ei||"vector"===ei?ei:"vector",ea=(0,n.useCallback)(e=>{e!==er&&$({pathname:et,query:{...ee,searchType:e}},void 0,{shallow:!0})},[$,et,ee,er]),en=e=>{let{topic:t}=e;return t.replace(/\b\w/g,e=>e.toUpperCase())},es=e=>{let{storiesData:t,query:i}=e;t.map(e=>{h({...e,topic:i})})},el=async e=>{let{narrative:t,prompt:r}=e;try{let{story:e}=await d({title:t.title,query:t.query});if((null==e?void 0:e.contents.length)>1){let t=await i({topic:r,title:null==e?void 0:e.title,insights:null==e?void 0:e.insights,contents:e.contents});if(!t.error){var a;e._id=null==t?void 0:null===(a=t.data)||void 0===a?void 0:a._id,e.topic=r,U(t=>[...t,e]),h({...e,mainPoints:[]})}x(25)}else x(25)}catch(e){x(25)}},eo=async e=>{let{narratives:t,prompt:i}=e;if(t.length>0)for(let e of t)el({narrative:e,prompt:i})},ed=async r=>{var n,s,l;let{query:o}=r,d=en({topic:o});console.log("[useRelevance] getNarratives called:",{searchType:er,query:null==d?void 0:d.substring(0,50),page:window.location.pathname});let{matches:c,content:u}=await e({keywords:d,userId:null==f?void 0:f._id,filterType:Q,searchType:er});if(console.log("[useRelevance] getNarratives received:",{matchesCount:(null==c?void 0:c.length)||0,searchTypeUsed:er,firstHeadline:null==c?void 0:null===(n=c[0])||void 0===n?void 0:null===(s=n.metadata)||void 0===s?void 0:null===(l=s.headline)||void 0===l?void 0:l.substring(0,50)}),c.length<4)"local"!==a.ZP.NODE_ENV.production&&alert("Content is ".concat(c.length,' lest than 4"')),$("/topicerror"),i({topic:o,title:"",insights:[],contents:[]}),q(!0),y(100);else{z(c),v(c);let e=await p({topic:o});if(e.error){alert("error from checktopic"),y(100);return}if(!e.error){if(e.data)es({storiesData:e.data.stories,query:o}),y(100);else{let{narratives:e}=await t({topic:o,content:u});await eo({narratives:e,prompt:o})}}}},ec=async e=>{let{value:t}=e,i=await fetch("/api/translate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({value:t,to:"en"})});if(!i.ok)throw Error("Language detection failed");let r=await i.json();return{language:r.language||"en",text:r.text||t}},eu=(0,n.useCallback)(async e=>{let{query:t,filterByScoreData:i=!0}=e;try{b(t),N(!0),g(!0);let e=await ec({value:t});"en"!==e.language?(b(e.text),await ed({query:e.text})):await ed({query:t})}catch(e){G([]),U([])}},[A,K,_,H,er,Q,null==f?void 0:f._id]),ep=(0,n.useCallback)(async e=>{let{_id:t}=e;t&&c({_id:t})},[R]),eh=(0,n.useCallback)(async e=>{let{email:t}=e;return S(!0),await u({email:t}),S(!1),!0},[]);return{setSystemPrompt:L,setUserPrompt:Z,userPrompt:K,systemPrompt:A,streamLoading:E,contentData:M,queryResponse:I,score:_,setScore:T,isLoading:k,relevance:m,getRelevance:eu,filterByScore:C,setFilterByScore:w,subscribe:eh,hasError:O,stories:R,progress:B,narratives:J,readStory:ep,setTopK:X,topK:H,topicMatches:V,filterType:Q,setFilterType:W,searchType:er,setSearchType:ea}}},6808:function(e,t,i){"use strict";i.r(t);var r=i(5893),a=i(7105),n=i(7294),s=i(3299),l=i(1309),o=i(284),d=i(3352),c=i(6531);t.default=()=>{let{queryResponse:e,score:t,setScore:i,isLoading:u,relevance:p,getRelevance:h,filterByScore:g,setFilterByScore:v,contentData:x,systemPrompt:y,setSystemPrompt:b,userPrompt:f,setUserPrompt:m,subscribe:j,streamLoading:k,stories:S,progress:C,narratives:w,topK:_,setTopK:T,topicMatches:E}=(0,a.Z)(),{setTopicKey:N}=(0,o.y)(),{trendings:I,refreshTrendings:D,isLoadingTrending:M}=(0,l.Z)(),{userBilling:P}=(0,c.Z)(),{addToBookmark:A}=(0,d.Z)(),{data:L,status:K}=(0,s.useSession)(),[Z,O]=(0,n.useState)(""),[q,R]=(0,n.useState)(""),[U,B]=(0,n.useState)(""),[F,J]=(0,n.use
1State)(""),G=()=>{let e=S.map((e,t)=>{let i=e.insights.map((e,t)=>(0,r.jsxs)("div",{style:{border:"1px solid black",padding:"10px",margin:"10px",borderColor:"green"},children:[(0,r.jsx)("p",{children:e.insight}),(0,r.jsx)("p",{children:e.sourceUrl}),(0,r.jsx)("img",{src:e.image,style:{width:"300px",height:"200px",border:"1px solid black"}}),(0,r.jsx)("p",{children:e.datePublished})]},"insight-".concat(t)));return(0,r.jsxs)("div",{style:{border:"1px solid black",padding:"10px",margin:"10px",borderColor:"pink"},children:[(0,r.jsx)("p",{onClick:()=>{A({data:e,topic:Z})},children:e.title}),(0,r.jsxs)("p",{children:["Story Date Created: ",e.dateCreated]}),(0,r.jsx)("p",{children:"Insights:"}),i]},"story-".concat(t))});return e},H=()=>w.map((e,t)=>(0,r.jsxs)("div",{onClick:()=>{},style:{border:"1px solid black",padding:"10px",margin:"10px",borderColor:"yellow"},children:[(0,r.jsx)("b",{children:e.title}),(0,r.jsx)("p",{children:e.query})]},"narrative-".concat(t)));return(0,n.useEffect)(()=>{console.log(K)},[K]),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("textarea",{style:{border:"1px solid black",padding:"10px",margin:"10px",borderColor:"green"},onKeyUp:e=>{e.shiftKey&&"Enter"===e.key?(O(e.target.value+"\n"),N(e.target.value+"\n")):(O(e.target.value),N(e.target.value))}}),(0,r.jsxs)("button",{onClick:()=>{h({query:Z,filterByScoreData:g})},children:["Generate",k||u?"...":""," ",C,"%"]})]}),(0,r.jsxs)("div",{children:["Score:"," ",(0,r.jsx)("input",{style:{border:"1px solid black",padding:"10px",margin:"10px",borderColor:"blue"},value:q,type:"number",onChange:e=>{R(e.target.value)}}),(0,r.jsxs)("button",{style:{border:"1px solid black",padding:"10px",margin:"10px",borderColor:"green"},onClick:()=>{i(parseFloat(q))},children:["Enter Score ",t,u?"...":""]})]}),(0,r.jsxs)("div",{children:["topK:"," ",(0,r.jsx)("input",{style:{border:"1px solid black",padding:"10px",margin:"10px",borderColor:"blue"},value:U,type:"number",onChange:e=>{B(e.target.value)}}),(0,r.jsxs)("button",{style:{border:"1px solid black",padding:"10px",margin:"10px",borderColor:"green"},onClick:()=>{T(parseInt(U))},children:["topK ",_,u?"...":""]})]}),(0,r.jsxs)("div",{children:["# of Content: ",x.length]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("button",{style:{border:"1px solid black",padding:"10px",margin:"10px",borderColor:"green"},onClick:()=>{D()},children:["Get Trending ",M?"...":""]}),(0,r.jsx)("div",{children:(0,r.jsx)(()=>I.map((e,t)=>(0,r.jsx)("div",{style:{border:"1px solid black",padding:"10px",margin:"10px",borderColor:"red"},children:(0,r.jsx)("b",{children:e})},"trending-".concat(t))),{})})]}),(0,r.jsx)("div",{children:(0,r.jsx)(()=>100===C||0===C?(0,r.jsx)("div",{children:(0,r.jsx)("div",{children:(0,r.jsx)(G,{})})}):(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{children:(0,r.jsx)(H,{})}),(0,r.jsx)("div",{children:"....Loading"})]}),{})}),(0,r.jsx)("div",{children:(0,r.jsx)(()=>(console.log(E),E.map((e,t)=>(0,r.jsxs)("div",{onClick:()=>{A({data:e,topic:Z})},style:{border:"1px solid black",padding:"10px",margin:"10px",borderColor:"violet"},children:[(0,r.jsx)("b",{children:e.metadata.headline}),(0,r.jsx)("p",{children:e.metadata.datePublished})]},"topic-match-".concat(t)))),{})}),(0,r.jsxs)("div",{children:[(0,r.jsx)("textarea",{style:{border:"1px solid black",padding:"10px",margin:"10px",borderColor:"green"},onKeyUp:e=>{console.log(e),e.shiftKey&&e.key,J(e.target.value)}}),(0,r.jsxs)("button",{onClick:()=>{j({email:F})},children:["Subscribe to Newsletter",u?"...":""]}),(0,r.jsx)("div",{children:(0,r.jsx)("button",{onClick:()=>{P()},children:"Billing"})})]})]})}},284:function(e,t,i){"use strict";i.d(t,{y:function(){return s}});var r=i(4529);let a={currentTopicKeyword:null,stories:[],contentData:[],isLoadingNarrativeStream:!1,topicMatches:[],isLoadingStreamDone:!1,progress:0},n=e=>({setTopicKey:t=>{e(()=>({currentTopicKeyword:t}))},setIsLoadingNarrativeStream:t=>{e(()=>({isLoadingNarrativeStream:t}))},setTopicMatches:t=>{e(e=>({topicMatches:t}))},setContentData:t=>{e(e=>({contentData:[...e.contentData,...t]}))},reset:()=>{e(()=>({...a}))},setStory:t=>{e(e=>{let{stories:i}=e,r=i.findIndex(e=>e.title==t.title);if(-1==r)return{stories:[...i,t]};{let e=[...i];return e[r]=t,{stories:e}}})},filterStory:t=>{e(e=>{let{stories:i}=e,r=i.filter(e=>e.topic==t);return{stories:r}})},setStoryProgress:t=>{e(()=>({progress:t}))},addStoryProgress:t=>{e(e=>{let{progress:i}=e;return{progress:i+t}})}}),s=(0,r.Ue)()(e=>({...a,...n(e)}))}},function(e){e.O(0,[774,888,179],function(){return e(e.s=4312)}),_N_E=e.O()}]);
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.