1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,69851,e=>{"use strict";var t=e.i(43476),r=e.i(71645),s=e.i(10980),a=e.i(47163);function l({coverPath:e,alt:l,className:i,fill:n}){let[o,d]=(0,r.useState)(!1),c=e&&!o?e.startsWith("/uploads/")||e.startsWith("http")?e:`/api/covers?file=${encodeURIComponent(e)}`:null;return c?(0,t.jsx)("img",{src:c,alt:l,className:(0,a.cn)("object-cover",i),onError:()=>d(!0),loading:"lazy"}):(0,t.jsx)("div",{className:(0,a.cn)("flex items-center justify-center bg-secondary",i),children:(0,t.jsx)(s.BookOpen,{className:"h-8 w-8 text-muted-foreground/40"})})}e.s(["CoverImage",()=>l])},31278,e=>{"use strict";let t=(0,e.i(75254).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);e.s(["Loader2",()=>t],31278)},84762,e=>{"use strict";var t=e.i(43476),r=e.i(71645),s=e.i(47163);let a=r.forwardRef(({className:e,...r},a)=>(0,t.jsx)("textarea",{className:(0,s.cn)("flex min-h-[80px] w-full rounded-lg border border-input bg-input px-3 py-2 text-sm","placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50 resize-none transition-colors",e),ref:a,...r}));a.displayName="Textarea",e.s(["Textarea",()=>a])},27612,e=>{"use strict";let t=(0,e.i(75254).default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);e.s(["Trash2",()=>t],27612)},84614,e=>{"use strict";let t=(0,e.i(75254).default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);e.s(["User",()=>t],84614)},70273,e=>{"use strict";let t=(0,e.i(75254).default)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);e.s(["Star",()=>t],70273)},14764,31245,90597,1928,78021,48256,e=>{"use strict";var t=e.i(75254);let r=(0,t.default)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);e.s(["Send",()=>r],14764);let s=(0,t.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);e.s(["Bot",()=>s],31245);let a=(0,t.default)("heart",[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]]);e.s(["Heart",()=>a],90597);let l=(0,t.default)("shopping-cart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]]);e.s(["ShoppingCart",()=>l],1928);let i=(0,t.default)("twitter",[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]]);e.s(["Twitter",()=>i],78021);let n=(0,t.default)("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);e.s(["Globe",()=>n],48256)},56076,e=>{"use strict";var t=e.i(43476),r=e.i(71645),s=e.i(67881),a=e.i(84762),l=e.i(86311),i=e.i(14764),n=e.i(31278),o=e.i(84614),d=e.i(31245),c=e.i(27612),h=e.i(61911),m=e.i(10980),x=e.i(90597),p=e.i(1928),u=e.i(70273),f=e.i(78021),g=e.i(48256),b=e.i(18789),j=e.i(69851),y=e.i(47163);let N=["How many episodes does Coastal Connections have?","Tell me about the characters in Bad Day","What stories are available?","Give me a summary of Beauty Salon","What are the most recent episodes?","Tell me about the Charming Nurses series"];function v(){let[e,v]=(0,r.useState)([]),[w,k]=(0,r.useState)(""),[C,S]=(0,r.useState)(!1),A=(0,r.useRef)(null);async function E(t){let r=t||w.trim();if(!r||C)return;k("");let s=[...e,{role:"user",content:r}];v(s),S(!0);try{let e=await fetch("/api/ai/chat",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({messages:s})});if(!e.body)throw Error("No response body");
1let t=e.body.getReader(),r=new TextDecoder,a="";for(v(e=>[...e,{role:"assistant",content:""}]);;){let{done:e,value:s}=await t.read();if(e)break;for(let e of r.decode(s).split("\n"))if(e.startsWith("data: ")){let t=e.slice(6);if("[DONE]"===t)continue;try{let e=JSON.parse(t),r=e.choices?.[0]?.delta?.content||"";r&&(a+=r,v(e=>{let t=[...e];return t[t.length-1]={role:"assistant",content:a},t}))}catch{}}}}catch(e){v(t=>[...t,{role:"assistant",content:`Error: ${e.message}`}])}finally{S(!1)}}return(0,r.useEffect)(()=>{A.current?.scrollIntoView({behavior:"smooth"})},[e]),(0,t.jsxs)("div",{className:"max-w-screen-lg mx-auto px-6 py-10 page-enter",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[(0,t.jsx)(l.MessageSquare,{className:"h-6 w-6 text-primary"}),"AI Assistant"]}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm mt-1",children:"Ask me anything about Pat3dx comics"})]}),e.length>0&&(0,t.jsxs)(s.Button,{variant:"ghost",size:"sm",onClick:()=>v([]),children:[(0,t.jsx)(c.Trash2,{className:"h-4 w-4"}),"Clear"]})]}),(0,t.jsxs)("div",{className:"flex flex-col h-[60vh] rounded-xl border border-border overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[0===e.length?(0,t.jsxs)("div",{className:"h-full flex flex-col items-center justify-center text-center",children:[(0,t.jsx)(d.Bot,{className:"h-12 w-12 text-muted-foreground/30 mb-3"}),(0,t.jsx)("p",{className:"text-muted-foreground font-medium",children:"Ask me anything about Pat3dx comics"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground/60 mt-1",children:"Stories, episodes, characters, and more..."}),(0,t.jsx)("div",{className:"mt-6 flex flex-wrap gap-2 justify-center max-w-lg",children:N.map(e=>(0,t.jsx)("button",{onClick:()=>E(e),className:"px-3 py-1.5 rounded-lg border border-border text-xs text-muted-foreground hover:text-foreground hover:border-primary/50 transition-all text-left",children:e},e))})]}):e.map((r,a)=>(0,t.jsxs)("div",{className:(0,y.cn)("flex gap-3","user"===r.role?"justify-end":"justify-start"),children:["assistant"===r.role&&(0,t.jsx)("div",{className:"w-7 h-7 rounded-full bg-primary/20 border border-primary/40 flex items-center justify-center flex-shrink-0 mt-0.5",children:(0,t.jsx)(d.Bot,{className:"h-3.5 w-3.5 text-primary"})}),(0,t.jsx)("div",{className:(0,y.cn)("max-w-[85%] rounded-2xl px-5 py-3 text-[15px] leading-relaxed shadow-sm","user"===r.role?"bg-primary text-primary-foreground rounded-tr-none":"bg-secondary/80 text-foreground rounded-tl-none border border-border/50 backdrop-blur-sm"),children:"assistant"===r.role?(0,t.jsx)("div",{className:"prose prose-invert prose-sm max-w-none prose-p:leading-relaxed prose-p:mb-4 prose-pre:bg-black/50 prose-pre:p-3 prose-pre:rounded-lg",children:r.content?(0,t.jsx)("div",{className:"space-y-4",children:r.content.replace(/[;:]*IMAGE\[\s*(https?:\/\/[^\]\s]+?\.(?:jpg|jpeg|png|webp|gif))\s*\][;:]*/gi,":::IMAGE[$1]:::").split(/(:::IMAGE\[.*?\]:::)/g).map(e=>e.startsWith(":::IMAGE[")?e:e.replace(/https?:\/\/[^\s\])]+?\.(?:jpg|jpeg|png|webp|gif)/gi,e=>`:::IMAGE[${e}]:::`)).join("").replace(/(^|\n)\s*IMAGE\[\s*(?=\n|$)/gi,"$1").replace(/(^|\n)\s*\]\s*(?=\n|$)/g,"$1").split(/(\[STORY:.*?\]|\[CHARLIST\]|\[EPISODELIST\]|\[CHARNAME:.*?\]|\[CHAR:.*?\]|\[EP:.*?\]|:::IMAGE\[.*?\]:?::?|\[CTA:.*?\])/g).map((e,r)=>{if(!e)return null;if(e.startsWith("[STORY:")){let s=e.substring(7,e.length-1);return(0,t.jsx)("div",{className:"mt-8 mb-3",children:(0,t.jsx)("h3",{className:"text-xl font-bold bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent m-0 p-0 tracking-tight",children:s})},r)}if("[CHARLIST]"===e)return(0,t.jsx)("div",{className:"mt-6 mb-3",children:(0,t.jsxs)("h4",{className:"text-lg font-bold text-foreground/90 flex items-center gap-2",children:[(0,t.jsx)(h.Users,{className:"h-5 w-5 text-primary"}),"Characters:"]})},r);if("[EPISODELIST]"===e)return(0,t.jsx)("div",{className:"mt-6 mb-3",children:(0,t.jsxs)("h4",{className:"text-lg font-bold text-foreground
1/90 flex items-center gap-2",children:[(0,t.jsx)(m.BookOpen,{className:"h-5 w-5 text-pink-500"}),"Episodes:"]})},r);if(e.startsWith("[CHARNAME:")){let s=e.substring(10,e.length-1);return(0,t.jsx)("div",{className:"mt-4 mb-1",children:(0,t.jsx)("h5",{className:"text-base font-bold text-primary m-0 p-0",children:s})},r)}if(e.startsWith("[CHAR:")){let s=e.substring(6,e.length-1);return(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-6 mb-3",children:[(0,t.jsx)("div",{className:"w-8 h-8 rounded-lg bg-primary/20 flex items-center justify-center text-primary shadow-sm border border-primary/20",children:(0,t.jsx)(h.Users,{className:"h-4 w-4"})}),(0,t.jsx)("h3",{className:"text-lg font-bold text-foreground m-0 p-0 tracking-tight",children:s})]},r)}if(e.startsWith("[EP:")){let s=e.substring(4,e.length-1);return(0,t.jsxs)("div",{className:"flex items-center gap-2 mt-8 mb-4",children:[(0,t.jsx)("div",{className:"w-8 h-8 rounded-lg bg-pink-500/20 flex items-center justify-center text-pink-500 shadow-sm border border-pink-500/20",children:(0,t.jsx)(m.BookOpen,{className:"h-4 w-4"})}),(0,t.jsxs)("h3",{className:"text-lg font-bold text-foreground m-0 p-0 tracking-tight",children:["Episode ",s]})]},r)}if(e.startsWith(":::IMAGE[")){let s=e.lastIndexOf("]");if(-1===s)return null;let a=e.substring(9,s).trim();return!a||"none"===a||a.length<3?null:(0,t.jsx)("div",{className:"inline-block w-20 h-28 rounded-lg overflow-hidden border-2 border-primary/30 shadow-lg mr-2 mb-2 ring-2 ring-primary/10",children:(0,t.jsx)(j.CoverImage,{coverPath:a,alt:"Character",className:"w-full h-full object-cover"})},r)}if(e.startsWith("[CTA:")){let a=e.substring(5,e.length-1).toUpperCase();return"AFFECT3D"===a?(0,t.jsx)(s.Button,{asChild:!0,className:"bg-[#FF0080] hover:bg-[#E60073] text-white border-none shadow-lg shadow-pink-500/20 px-6 mt-4",children:(0,t.jsxs)("a",{href:"https://affect3dstore.com/artist/pat",target:"_blank",rel:"noopener noreferrer",children:[(0,t.jsx)(p.ShoppingCart,{className:"h-4 w-4 mr-2"}),"Buy on Affect3D"]})},r):"SITE"===a?(0,t.jsx)(s.Button,{asChild:!0,variant:"outline",className:"border-primary text-primary hover:bg-primary/10 mt-4",children:(0,t.jsxs)("a",{href:"https://pat3dx.shop/",target:"_blank",rel:"noopener noreferrer",children:[(0,t.jsx)(g.Globe,{className:"h-4 w-4 mr-2"}),"Visit Pat3DX.shop"]})},r):"PATREON"===a?(0,t.jsx)(s.Button,{asChild:!0,variant:"outline",className:"border-orange-500/50 text-orange-500 hover:bg-orange-500/10 mt-4",children:(0,t.jsxs)("a",{href:"https://www.patreon.com/c/Pat3dx05",target:"_blank",rel:"noopener noreferrer",children:[(0,t.jsx)(x.Heart,{className:"h-4 w-4 mr-2 fill-orange-500"}),"Support on Patreon"]})},r):"SUBSCRIBESTAR"===a?(0,t.jsx)(s.Button,{asChild:!0,variant:"outline",className:"border-yellow-500/50 text-yellow-500 hover:bg-yellow-500/10 mt-4",children:(0,t.jsxs)("a",{href:"https://subscribestar.adult/pat",target:"_blank",rel:"noopener noreferrer",children:[(0,t.jsx)(u.Star,{className:"h-4 w-4 mr-2"}),"Support on SubscribeStar"]})},r):"SOCIALS"===a?(0,t.jsxs)("div",{className:"mt-8 p-6 rounded-2xl bg-gradient-to-br from-primary/10 to-accent/10 border border-primary/20 space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)(g.Globe,{className:"h-5 w-5 text-primary"}),(0,t.jsx)("h4",{className:"font-bold text-foreground",children:"Follow & Support Pat3DX"})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(s.Button,{size:"sm",variant:"outline",asChild:!0,className:"text-[10px] h-8 border-primary/30 text-primary hover:bg-primary/5",children:(0,t.jsxs)("a",{href:"https://pat3dx.shop/",target:"_blank",children:[(0,t.jsx)(g.Globe,{className:"h-3 w-3 mr-1.5"})," Official Site"]})}),(0,t.jsx)(s.Button,{size:"sm",asChild:!0,className:"bg-[#FF0080] hover:bg-[#E60073] text-white text-[10px] h-8",children:(0,t.jsxs)("a",{href:"https://affect3dstore.com/artist/pat",target:"_blank",children:[(0,t.jsx)(p.ShoppingCart,{className:"h-3 w-3 mr-1.5"})," Affect3D"]})}),(0,t.jsx)(s.Button,{size:"sm",variant:"outline",asChild:!0,className:"text-[10px] h-8 border-orange-500/30 text-orange-500 hover:bg-orange-500/5",children:(0,t.jsxs)("a",{href:"https://www.patreon.com/c/Pat3dx05",target:"_blank",children:[(0,t.jsx)(x.Heart,{className:"h-3 w-3 mr-1.5"})," Patreon"]})}),(0,t.jsx)(s.Button,{size:"sm",variant:"outline",asChild:!0,className:"text-[10px] h-8 border-yellow-500/30 text-yellow-500 hover:bg-yellow-500/5",children:(0,t.jsxs)("a",{href:"https://subscribestar.adult/pat",target:"_blank",children:[(0,t.jsx)(u.Star,{className:"h-3 w-3 mr-1.5"})," SubscribeStar"]})}),(0,t.jsx)(s.Button,{size:"sm",variant:"outline",asChild:!0,className:"text-[10px] h-8 border-foreground
1/30 text-foreground hover:bg-foreground/5",children:(0,t.jsxs)("a",{href:"https://x.com/Pat69940096",target:"_blank",children:[(0,t.jsx)(f.Twitter,{className:"h-3 w-3 mr-1.5"})," Twitter"]})})]})]},r):null}return(0,t.jsx)(b.default,{children:e},r)})}):C&&a===e.length-1?(0,t.jsxs)("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[(0,t.jsx)(n.Loader2,{className:"h-3 w-3 animate-spin"}),"Thinking..."]}):null}):(0,t.jsx)("div",{className:"whitespace-pre-wrap",children:r.content})}),"user"===r.role&&(0,t.jsx)("div",{className:"w-7 h-7 rounded-full bg-secondary border border-border flex items-center justify-center flex-shrink-0 mt-0.5",children:(0,t.jsx)(o.User,{className:"h-3.5 w-3.5"})})]},a)),(0,t.jsx)("div",{ref:A})]}),(0,t.jsxs)("div",{className:"border-t border-border p-3 flex gap-2",children:[(0,t.jsx)(a.Textarea,{value:w,onChange:e=>k(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),E())},placeholder:"Ask about stories, episodes, characters...",className:"min-h-[42px] max-h-32 resize-none py-2.5",rows:1}),(0,t.jsx)(s.Button,{onClick:()=>E(),disabled:!w.trim()||C,size:"icon",className:"h-auto",children:C?(0,t.jsx)(n.Loader2,{className:"h-4 w-4 animate-spin"}):(0,t.jsx)(i.Send,{className:"h-4 w-4"})})]})]})]})}e.s(["default",()=>v])}]);
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.