PageSourceSearch

https://shelfy.so/_next/static/chunks/99534-d5e1362041f4eb2c.js

js shelfy.so collected 2026-10-09 22:42:46 UTC 10,964 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[99534],{99534:(e,t,s)=>{s.d(t,{A:()=>w});var r=s(95155),a=s(12115),l=s(968),n=s(20063),i=s(94994),o=s(52773),c=s(63892);let d=e=>{let{resource:t,onClick:s}=e,[l,n]=(0,a.useState)(!1),i=t.thumbnail_url&&"note-icon"!==t.thumbnail_url?t.thumbnail_url:null,o=i&&!l;return(0,r.jsxs)("div",{onClick:s,className:"flex items-center gap-3 p-3 rounded-lg border border-gray-100 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-600/50 cursor-pointer transition-colors",children:[(0,r.jsx)("div",{className:"w-10 h-10 rounded-md bg-gray-100 dark:bg-gray-600 flex-shrink-0 overflow-hidden flex items-center justify-center",children:o?(0,r.jsx)("img",{src:i,alt:"",className:"w-full h-full object-cover",onError:()=>n(!0)}):(0,r.jsx)(c.A,{name:"Link",width:16,height:16,className:"text-gray-400 dark:text-gray-500"})}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("h3",{className:"text-sm font-medium text-gray-900 dark:text-gray-100 truncate",children:t.title||"Untitled"}),t.url&&(0,r.jsx)("p",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:t.url})]})]})},x=e=>{var t,s,a,l;let{chatId:c,resultSetId:x,onClose:h}=e,g=(0,n.useRouter)(),{data:u,isLoading:m,error:p}=(0,o.useGetResultSetQuery)({chatId:c,resultSetId:x}),y=null!=(l=null!=(a=null==u?void 0:u.total)?a:null==u||null==(t=u.resources)?void 0:t.length)?l:0;return(0,r.jsxs)(i.A,{isOpen:!0,onClose:h,title:"Show found resources".concat(y?" (".concat(y,")"):""),size:"3xl",children:[m&&(0,r.jsx)("div",{className:"py-8 text-center text-sm text-gray-500 dark:text-gray-400",children:"Loading resources…"}),p&&(0,r.jsx)("div",{className:"py-8 text-center text-sm text-red-500 dark:text-red-400",children:"Couldn't load resources. Try again later."}),!m&&!p&&u&&(null==(s=u.resources)?void 0:s.length)===0&&(0,r.jsx)("div",{className:"py-8 text-center text-sm text-gray-500 dark:text-gray-400",children:"No resources for this answer."}),!m&&!p&&u&&u.resources&&u.resources.length>0&&(0,r.jsx)("div",{className:"space-y-2 max-h-[60vh] overflow-y-auto pr-1",children:u.resources.map(e=>(0,r.jsx)(d,{resource:e,onClick:()=>{var t;return t=e.id,void(h(),g.push("/resources/".concat(t)))}},e.id))})]})},h=e=>{let{chatId:t,resultSetId:s}=e,[l,n]=(0,a.useState)(!1);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("button",{type:"button",onClick:()=>n(!0),className:"inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-gray-100 dark:bg-gray-600 text-gray-600 dark:text-gray-300 text-[11px] font-medium cursor-pointer",children:[(0,r.jsx)(c.A,{name:"Search",width:12,height:12,"aria-hidden":"true"}),"Show all found resources"]}),l&&(0,r.jsx)(x,{chatId:t,resultSetId:s,onClose:()=>n(!1)})]})};var g=s(67606);let u=(0,a.lazy)(()=>Promise.all([s.e(97330),s.e(39242),s.e(64287),s.e(38355),s.e(28177)]).then(s.bind(s,28177))),m=e=>{let{children:t}=e;return(0,r.jsx)(a.Suspense,{fallback:(0,r.jsx)("div",{className:"assistant-md whitespace-pre-wrap",children:t}),children:(0,r.jsx)(u,{children:t})})}
1,p=["Shelfying","Magicking","Pondering","Noodling","Cogitating","Brewing","Conjuring","Brainstorming"],y=["Combobulating","Synthesizing","Distilling","Weaving","Crystallizing","Polishing","Stitching","Wrangling"],j=["Tooling","Toolhandling","Toolmagicking"],k={search_resources_intuitive:"Sherlocking",search_resources:"Sherlocking",search_collections:"Sherlocking",get_resource:"Peeking",get_collection:"Peeking",summarize:"Condensing",compare:"Weighing"};function f(e,t){let[s,r]=(0,a.useState)(()=>e[Math.floor(Math.random()*e.length)]),l=(0,a.useRef)(t);return(0,a.useEffect)(()=>{t!==l.current&&(r(e[Math.floor(Math.random()*e.length)]),l.current=t)},[t,e]),s}let v=e=>{let{className:t=""}=e;return(0,r.jsx)("div",{className:"assistant-pulse-dot ".concat(t),"aria-hidden":"true"})},w=e=>{let{messages:t,streamingContent:s="",isStreaming:n=!1,streamingPhase:i={type:"idle"},isLoadingChat:o=!1,isFreePlan:d=!1,resourceSummary:x=null,resourceTitle:u=null,chatId:w=null,onSuggestionClick:N}=e,b=(0,a.useRef)(null),C=f(p,i.type),L=f(y,i.type);return(0,a.useEffect)(()=>{b.current&&(b.current.scrollTop=b.current.scrollHeight)},[t,s,n,i]),(0,r.jsxs)("div",{ref:b,className:"flex-1 overflow-y-auto px-6 py-4 space-y-4",children:[o&&(0,r.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,r.jsx)("div",{className:"text-gray-500 dark:text-gray-400 text-sm font-medium",children:"Loading chat..."})}),!o&&!n&&0===t.length&&!s&&!x&&(0,r.jsxs)("div",{className:"flex flex-col items-center pt-4 pb-2 px-1",children:[(0,r.jsx)("div",{className:"w-12 h-12 rounded-full bg-white flex items-center justify-center mb-4 border border-gray-200 dark:border-gray-300 shadow-sm",children:(0,r.jsx)(c.A,{name:"Spark",width:22,height:22,className:"text-gray-900"})}),(0,r.jsx)("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100 text-center mb-6 tracking-tight",children:"\uD83D\uDC4B\uD83C\uDFFB Welcome to Shelfy Assistant!"}),d?(0,r.jsx)("button",{onClick:()=>window.location.href="/pricing-plans",className:"px-4 h-9 bg-[#0D99FF] hover:bg-[#0B87E5] text-white text-sm font-medium rounded-lg transition-colors cursor-pointer",children:"Upgrade to Pro to chat"}):N?(0,r.jsxs)("div",{className:"w-full",children:[(0,r.jsx)("div",{className:"text-xs font-semibold text-gray-500 dark:text-gray-400 mb-2 px-1",children:"Example use cases"}),(0,r.jsx)("ul",{className:"space-y-0.5",children:g.P.map(e=>(0,r.jsx)("li",{children:(0,r.jsxs)("button",{type:"button",onClick:()=>N(e.text),className:"w-full flex items-center gap-2.5 -mx-2 px-2 py-1.5 rounded-lg hover:bg-gray-100 dark:hover:bg-gray-600 transition-colors cursor-pointer text-left",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"w-8 h-8 rounded-md flex items-center justify-center flex-shrink-0 ".concat(e.tileClass),children:(0,r.jsx)(c.A,{name:"Note",width:15,height:15})}),(0,r.jsx)("span",{className:"text-sm text-gray-800 dark:text-gray-200 leading-relaxed",children:e.text})]})},e.text))})]}):null]}),!o&&x&&(0,r.jsx)("div",{className:"flex justify-start",children:(0,r.jsx)("div",{className:"max-w-full w-full",children:(0,r.jsx)(l.A,{summary:x,title:u})})}),!o&&t.map((e,t)=>"assistant"!==e.role||e.content&&0!==e.content.trim().length?(0,r.jsx)("div",{className:"flex ".concat("user"===e.role?"justify-end":"justify-start"),children:"user"===e.role?(0,r.jsx)("div",{className:"max-w-[75%]",children:(0,r.jsx)("div",{className:"bg-gray-100 dark:bg-gray-600 text-gray-900 dark:text-gray-200 rounded-[18px] px-4 py-2.5 text-sm font-normal",children:e.content})}):(0,r.jsxs)("div",{className:"max-w-full",children:[(0,r.jsx)("div",{className:"text-gray-900 dark:text-gray-200 text-sm font-normal leading-normal",children:(0,r.jsx)(m,{children:e.content})}),(0,r.jsxs)("div",{className:"flex items-center gap-1 mt-1.5",children:[(0,r.jsx)("button",{onClick:()=>console.log("Copy message"),className:"p-1 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors cursor-pointer","aria-label":"Copy message",title:"Copy message text",children:(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,r.jsx)("path",{d:"M5.5 4.5V3.5C5.5 2.67157 6.17157 2 7 2H12C12.8284 2 13.5 2.67157 13.5 3.5V10C13.5 10.8284 12.8284 11.5 12 11.5H11M5 5H4C3.17157 5 2.5 5.67157 2.5 6.5V12.5C2.5 13.3284 3.17157 14 4 14H9C9.82843 14 10.5 13.3284 10.5 12.5V6.5C10.5 5.67157 9.82843 5 9 5H5Z",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})})}),(0,r.jsx)("button",{onClick:()=>console.log("Like message"),className:"p-1 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors cursor-pointer","aria-label":"Like message",title:"Good response",children:(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,r.jsx)("path",{d:"M5 7.5V13.5H3C2.72386 13.5 2.5 13.2761 2.5 13V8C2.5 7.72386 2.72386 7.5 3 7.5H5ZM5 7.5L7 2.5C7.5 2.5 8.5 2.5 8.5 3.5V6.5H12C12.8284 6.5 13.5 7.17157 13.5 8V8.5C13.5 8.63261 13.4733 8.76389 13.4214 8.88582L11.9214 12.8858C11.7792 13.2425 11.4425 13.5 11.0572 13.5H5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}),(0,r.jsx)("button",{onClick:()=>console.log("Dislike message"),className:"p-1 text-gray-400 dark:text-gray-500 hover:text-gray-600 dark:hover:text-gray-300 transition-colors cursor-pointer","aria-label":"Dislike message",title:"Bad response",children:(0,r.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,r.jsx)("path",{d:"M11 8.5V2.5H13C13.2761 2.5 13.5 2.72386 13.5 3V8C13.5 8.27614 13.2761 8.5 13 8.5H11ZM11 8.5L9 13.5C8.5 13.5 7.5 13.5 7.5 12.5V9.5H4C3.17157 9.5 2.5 8.82843 2.5 8V7.5C2.5 7.36739 2.52668 7.23611 2.57863 7.
111418L4.07863 3.11418C4.22084 2.75752 4.55752 2.5 4.94281 2.5H11",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})}),null!=w&&null!=e.result_set_id&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{"aria-hidden":"true",className:"w-1 h-1 rounded-full bg-gray-300 dark:bg-gray-500 mx-1.5 flex-shrink-0"}),(0,r.jsx)(h,{chatId:w,resultSetId:e.result_set_id})]})]})]})},e.id?"message-".concat(e.id):"message-".concat(t)):null),!o&&n&&(0,r.jsx)("div",{className:"flex justify-start",children:(0,r.jsxs)("div",{className:"max-w-full",children:["thinking"===i.type&&!s&&(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(v,{}),(0,r.jsxs)("span",{className:"text-sm assistant-pulse-text",children:[C,"..."]})]}),"processing"===i.type&&!s&&(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(v,{}),(0,r.jsxs)("span",{className:"text-sm assistant-pulse-text",children:[L,"..."]})]}),"tool_call"===i.type&&!s&&(0,r.jsxs)("div",{className:"flex items-center gap-3",children:["completed"===i.status?(0,r.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:i.success?"text-green-500":"text-red-400",children:i.success?(0,r.jsx)("path",{d:"M3.5 8.5L6.5 11.5L12.5 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}):(0,r.jsx)("path",{d:"M4.5 4.5L11.5 11.5M11.5 4.5L4.5 11.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}):(0,r.jsx)(v,{}),(0,r.jsxs)("span",{className:"text-sm assistant-pulse-text",children:[((e,t)=>k[e]?k[e]:j[(e=>{let t=0;for(let s=0;s<e.length;s++)t=31*t+e.charCodeAt(s)|0;return Math.abs(t)})(t||e)%j.length])(i.tool_name,i.tool_call_id),"completed"!==i.status&&"..."]})]}),s&&(0,r.jsxs)("div",{className:"text-gray-900 dark:text-gray-200 text-sm font-normal leading-normal max-w-none",children:[(0,r.jsx)(m,{children:s}),(0,r.jsx)(v,{className:"inline-block align-middle ml-1.5"})]})]})})]})}}}]);

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.