PageSourceSearch

https://www.branchprompt.com/_next/static/chunks/pages/settings-e3f473dffe87dedf.js

js branchprompt.com collected 2026-10-08 10:08:17 UTC 46,152 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[199,4844],{9554:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>R});var n=s(37876),r=s(14232),a=s(22885),i=s(71449),c=s(45450),o=s(71678),l=s(26257),d=s(29812),m=s(89142),x=s(97870),h=s(97685),u=s(48230),p=s.n(u),g=s(89099),b=s(38203),f=s(30207),j=s(17210),k=s(70672),v=s(10345),y=s(11713);let z=(0,y.A)("pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);var N=s(12089),w=s(65104),A=s(31771),C=s(41456),I=s(35516);let _=e=>{let{editingPersona:t,formData:s,formLoading:r,onInputChange:a,onSave:i,onCancel:c}=e;return(0,n.jsxs)("div",{className:"bg-zinc-50 dark:bg-zinc-800/50 rounded-lg p-4 mb-4",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between mb-4 gap-3",children:[(0,n.jsxs)("h4",{className:"font-medium text-zinc-900 dark:text-zinc-100 flex-1 min-w-0",children:[(0,n.jsx)("span",{className:"hidden xs:inline",children:t?"Edit Memory Bucket":"Create New Memory Bucket"}),(0,n.jsx)("span",{className:"xs:hidden",children:t?"Edit Bucket":"New Bucket"})]}),(0,n.jsx)("button",{onClick:c,className:"text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300 flex-shrink-0",children:(0,n.jsx)(k.A,{size:16,className:"pointer-events-none"})})]}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)("label",{className:"block text-sm font-medium text-zinc-700 dark:text-zinc-300",children:"Name *"}),(0,n.jsx)("input",{type:"text",value:s.name,onChange:e=>a("name",e.target.value),className:"w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-lg text-sm bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 focus:ring-2 focus:ring-emerald-500 focus:border-emerald-500",placeholder:"Personal, Work, Creative...",maxLength:100})]}),(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)("label",{className:"block text-sm font-medium text-zinc-700 dark:text-zinc-300",children:"Description"}),(0,n.jsx)("input",{type:"text",value:s.description,onChange:e=>a("description",e.target.value),className:"w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-lg text-sm bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 focus:ring-2 focus:ring-emerald-500 focus:border-emerald-500",placeholder:"Brief description of this persona...",maxLength:500})]}),(0,n.jsxs)("div",{className:"border-t border-zinc-200 dark:border-zinc-700 pt-4",children:[(0,n.jsx)("h5",{className:"text-sm font-medium text-zinc-800 dark:text-zinc-200 mb-3",children:"AI Customization"}),(0,n.jsxs)("div",{className:"space-y-1 mb-3",children:[(0,n.jsx)("label",{className:"block text-sm font-medium text-zinc-700 dark:text-zinc-300",children:"What should the AI call you?"}),(0,n.jsx)("input",{type:"text",value:s.nickname,onChange:e=>a("nickname",e.target.value),className:"w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-lg text-sm bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 focus:ring-2 focus:ring-emerald-500 focus:border-emerald-500",placeholder:"Your preferred name...",maxLength:100})]}),(0,n.jsxs)("div",{className:"space-y-1 mb-3",children:[(0,n.jsx)("label",{className:"block text-sm font-medium text-zinc-700 dark:text-zinc-300",children:"What do you do for work?"}),(0,n.jsx)("input",{type:"text",value:s.occupation,onChange:e=>a("occupation",e.target.value),className:"w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-lg text-sm bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 focus:ring-2 focus:ring-emerald-500 focus:border-emerald-500",placeholder:"Your job title or profession...",maxLength:200})]}),(0,n.jsxs)("div",{className:"space-y-1 mb-3",children:[(0,n.jsx)("label",{className:"block text-sm font-medium text-zinc-700 dark:text-zinc-300",children:"What personality traits should the AI have?"}),(0,n.jsx)("textarea",{value:s.traits,onChange:e=>a("traits",e.target.value),rows:3,className:"w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-lg text-sm bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 resize-none focus:ring-2 focus:ring-emerald-500 focus:border-emerald-500",placeholder:"Be conversational and friendly. Use an encouraging tone...",maxLength:1e3})]}),(0,n.jsxs)("div",{className:"space-y-1",children:[(0,n.jsx)("label",{className:"block text-sm font-medium text-zinc-700 dark:text-zinc-300",children:"Anything else the AI should know?"}),(0,n.jsx)("textarea",{value:s.additionalInfo,onChange:e=>a("additionalInfo",e.target.value),rows:3,className:"w-full px-3 py-2 border border-zinc-300 dark:border-zinc-600 rounded-lg text-sm bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 resize-none focus:ring-2 focus:ring-emerald-500 focus:border-emerald-500",placeholder:"Your interests, values, goals...",maxLength:2e3})]})]}),(0,n.jsxs)("div",{className:"flex flex-col xs:flex-row gap-2 pt-3",children:[(0,n.jsx)("button",{onClick:i,disabled:r||!s.name.trim(),className:"flex items-center justify-center gap-2 px-4 py-2 bg-emerald-600 text-white text-sm font-medium rounded-lg hover:bg-emerald-700 disabled:opacity-50 disabled:cursor-not-allowed w-full xs:w-auto",children:(0,n.jsxs)(b.If,{condition:r,children:[(0,n.jsxs)(b.al,{children:[(0,n.jsx)("div",{className:"w-4 h-4 border-2 border-white border-t-transparent roun
1ded-full animate-spin pointer-events-none"}),(0,n.jsx)("span",{className:"pointer-events-none",children:"Saving..."})]}),(0,n.jsxs)(b._I,{children:[(0,n.jsx)(v.A,{size:16,className:"pointer-events-none"}),(0,n.jsx)("span",{className:"pointer-events-none",children:t?"Update":"Create"})]})]})}),(0,n.jsx)("button",{onClick:c,className:"flex items-center justify-center px-4 py-2 text-zinc-600 dark:text-zinc-400 text-sm font-medium rounded-lg hover:bg-zinc-100 dark:hover:bg-zinc-800 w-full xs:w-auto",children:(0,n.jsx)("span",{className:"pointer-events-none",children:"Cancel"})})]})]})]})},D=e=>{var t;let{isInline:s=!1}=e,{personas:a,isLoading:i,createPersona:c,updatePersona:o,deletePersona:l,fetchPersonas:d}=(0,A.v5)(),{getDefaultPersona:m,userSettings:u}=(0,A.Hk)(),{settings:p,saveSettings:g,isLoading:f}=(0,C.t)(),j=(0,r.useMemo)(()=>[m(),...a],[m,a,u]);(0,r.useEffect)(()=>{u&&M(e=>({...e}))},[u]);let[k,v]=(0,r.useState)(!1),[y,D]=(0,r.useState)(null),[S,M]=(0,r.useState)({name:p.name,description:p.description,nickname:p.nickname,occupation:p.occupation,traits:p.traits,additionalInfo:p.additionalInfo}),[E,T]=(0,r.useState)(!1),[P,L]=(0,r.useState)(!1),[B,F]=(0,r.useState)(null),[O,q]=(0,r.useState)(!1),J=()=>{M({name:"",description:p.description,nickname:p.nickname,occupation:p.occupation,traits:p.traits,additionalInfo:p.additionalInfo}),v(!1),D(null)},Y=e=>{D(e);let t=R(e)?m():e;M({name:t.name||"",description:t.description||p.description,nickname:t.nickname||p.nickname,occupation:t.occupation||p.occupation,traits:t.traits||p.traits,additionalInfo:t.additionalInfo||p.additionalInfo})},G=async()=>{if(!S.name.trim()){h.Ay.error("Memory bucket name is required");return}let e=S.name.trim();if(a.find(t=>t.name.toLowerCase()===e.toLowerCase()&&(!y||t._id!==y._id))){h.Ay.error("A memory bucket with this name already exists");return}try{T(!0);let e=null;if(y)if(R(y)){let t="";S.nickname&&(t+="My preferred name: ".concat(S.nickname,"\n")),S.occupation&&(t+="My occupation: ".concat(S.occupation,"\n")),S.traits&&(t+="".concat(S.traits,"\n")),S.additionalInfo&&(t&&(t+="\n"),t+="About me: ".concat(S.additionalInfo)),await g({customInstructions:t.trim()}),e={success:!0},h.Ay.success("Default memory bucket settings updated")}else e=await o(y._id,S);else e=await c(S);e&&J()}catch(e){console.error("Error saving persona:",e),e.message?h.Ay.error(e.message):h.Ay.error("Failed to ".concat(y?"update":"create"," persona. Please try again."))}finally{T(!1)}},H=e=>{if(R(e)){h.Ay.error("Cannot delete the default memory bucket");return}F(e),L(!0)},U=async()=>{if(B){q(!0);try{await l(B._id)}finally{q(!1),L(!1),F(null)}}},R=e=>"default"===e._id||e.isVirtual,W=e=>{let{persona:t}=e,s=R(t),r=s?m():t;return(0,n.jsxs)("div",{className:"border border-zinc-200 dark:border-zinc-700 rounded-lg p-4 bg-white dark:bg-zinc-800/50",children:[(0,n.jsxs)("div",{className:"flex items-start justify-between mb-3 gap-3",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[(0,n.jsx)("div",{className:"w-8 h-8 bg-emerald-100 dark:bg-emerald-900/30 rounded-full flex items-center justify-center flex-shrink-0",children:(0,n.jsx)(x.qd,{size:20,className:"text-gray-500"})}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,n.jsx)("h4",{className:"font-medium text-zinc-900 dark:text-zinc-100 truncate",children:r.name}),(0,n.jsx)(b.If,{condition:s,children:(0,n.jsx)(b.al,{children:(0,n.jsx)("div",{className:"flex items-center gap-1 px-2 py-1 bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300 text-xs rounded-full flex-shrink-0",children:(0,n.jsx)("span",{className:"pointer-events-none",children:"Default"})})})})]}),(0,n.jsx)(b.If,{condition:r.description,children:(0,n.jsx)(b.al,{children:(0,n.jsx)("p",{className:"text-sm text-zinc-600 dark:text-zinc-400 mt-1 line-clamp-2",children:r.description})})})]})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1 flex-shrink-0",children:[(0,n.jsx)("button",{onClick:()=>Y(r),className:"p-2 text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-700 rounded-lg",title:"Edit memory bucket",children:(0,n.jsx)(z,{size:16,className:"pointer-events-none"})}),(0,n.jsx)(b.If,{condition:!s,children:(0,n.jsx)(b.al,{children:(0,n.jsx)("button",{onClick:()=>H(r),className:"p-2 text-zinc-400 hover:text-red-600 dark:hover:text-red-400 hover:bg-zinc-100 dark:hover:bg-zinc-700 rounded-lg",title:"Delete memory bucket",children:(0,n.jsx)(N.A,{size:16,className:"pointer-events-none"})})})})]})]}),(0,n.jsxs)("div",{className:"text-xs text-zinc-500 dark:text-zinc-400 space-y-1",children:[(0,n.jsx)(b.If,{condition:r.nickname,children:(0,n.jsx)(b.al,{children:(0,n.jsxs)("div",{children:["Name: ",r.nickname]})})}),(0,n.jsx)(b.If,{condition:r.occupation,children:(0,n.jsx)(b.al,{children:(0,n.jsxs)("div",{children:["Occupation: ",r.occupation]})})}),(0,n.jsx)(b.If,{condition:r.traits,children:(0,n.jsx)(b.al,{children:(0,n.jsxs)("div",{children:["Traits: ",r.traits.substring(0,100),r.traits.length>100?"...":""]})})})]})]})};return(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"flex flex-col xs:flex-row xs:items-center xs:justify-between gap-3 xs:gap-2",children:[(0,n.jsx)("h3",{className:"text-lg font-semibold text-zinc-900 dark:text-zinc-100",children:"Memory Buckets"}),(0,n.jsx)("div",{className:"flex items-center gap-2",children:(0,n.jsxs)("button",{onClick:()=>{M({name:"",description:p.description,nickname:p.nickname,occupation:p.occupation,traits:p.traits,additionalInfo:p.additionalInfo}),D(null),v(!0)},className:"flex items-center justify-center gap-2 px-3 py-2 bg-emerald-600 text-white text-sm font-medium rounded-lg hover:bg-emerald-700 w-full xs:w-auto",children:[(0,n.jsx)(w.A,{size:16,className:"pointer-events-none flex-shrink-0"}),(0,n.jsx)("span",{className:"pointer-events-none hidden xs:inline",children:"New Memory Bucket"}),(0,n.jsx)("span",{className:"pointer-events-none xs:hidden",children:"New Bucket"})]})})]}),(0,n.jsx)("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"Memory buckets allow you to quickly switch between different personas to improve the chat relevancy and history. Add custom context & persona information and Branch Prompt will isolate memories between buckets."}),(0,n.jsxs)("div",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:[j.length," bucket(s) | Default: ",(null===(t=j.find(e=>R(e)))||void 0===t?void 0:t.name)||"None"]}),(0,n.jsx)(b.If,{condition:k||y,children:(0,n.jsx)(b.al,{children:(0,n.jsx)(_,{editingPersona:y,formData:S,formLoading:E,onInputChange:(e,t)=>
1{M(s=>({...s,[e]:t}))},onSave:G,onCancel:J})})}),(0,n.jsx)(b.If,{condition:!k&&!y,children:(0,n.jsx)(b.al,{children:(0,n.jsxs)(b.If,{condition:i||f,children:[(0,n.jsx)(b.al,{children:(0,n.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,n.jsx)("div",{className:"w-6 h-6 border-2 border-emerald-600 border-t-transparent rounded-full animate-spin"})})}),(0,n.jsx)(b._I,{children:(0,n.jsx)("div",{className:"space-y-3",children:j.map(e=>(0,n.jsx)(W,{persona:e},e._id))})})]})})}),(0,n.jsx)(I.A,{isOpen:P,onClose:()=>{L(!1),F(null)},onConfirm:U,title:"Delete Memory Bucket",message:'Are you sure you want to delete "'.concat(null==B?void 0:B.name,'"? This action cannot be undone.'),confirmText:"Delete",cancelText:"Cancel",isDanger:!0,isLoading:O})]})};var S=s(35234),M=s(92577);let E=(0,y.A)("bell-off",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]);var T=s(498),P=s(86739),L=s(3609);function B(){let{settings:e,saveSettings:t,isSaving:s}=(0,C.t)(),{permission:a,isEnabled:i,isSupported:c,requestPermission:o,enableNotifications:l,disableNotifications:d}=(0,S.M)(),[m,x]=(0,r.useState)(!1),[u,p]=(0,r.useState)("send"),[g,f]=(0,r.useState)(!1);(0,r.useEffect)(()=>{x(/Mac|iPhone|iPad|iPod/.test(navigator.userAgent))},[]),(0,r.useEffect)(()=>{p(e.enterKeyBehavior||"send")},[e.enterKeyBehavior]);let j=async()=>{f(!0);try{let e=await o();"granted"===e?h.Ay.success("Notifications enabled"):"denied"===e?h.Ay.error("Permission denied. Please enable notifications in your browser settings."):(0,h.Ay)("Permission not granted. You may need to enable notifications in your browser settings.",{icon:"⚠️"})}finally{f(!1)}},k=async()=>{try{t({enterKeyBehavior:u}),h.Ay.success("Settings saved successfully")}catch(e){h.Ay.error("Failed to save settings")}};return(0,n.jsxs)("div",{className:"space-y-6",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-lg font-semibold text-zinc-900 dark:text-zinc-100 mb-2",children:"Chat Settings"}),(0,n.jsx)("p",{className:"text-sm text-zinc-600 dark:text-zinc-400 mb-4",children:"Customize how the message input works."}),(0,n.jsxs)("div",{className:"bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg p-4 sm:p-6",children:[(0,n.jsxs)("label",{className:"block text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-3",children:["When writing a message, press ",(0,n.jsx)("kbd",{className:"px-2 py-1 bg-zinc-100 dark:bg-zinc-700 rounded border border-zinc-300 dark:border-zinc-600",children:"Enter"})," to..."]}),(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsxs)("label",{className:"flex items-center gap-3 cursor-pointer group",children:[(0,n.jsx)("input",{type:"radio",name:"enterKeyBehavior",value:"send",checked:"send"===u,onChange:e=>p(e.target.value),className:"w-4 h-4 text-emerald-600 focus:ring-emerald-500"}),(0,n.jsx)("span",{className:"text-sm text-zinc-700 dark:text-zinc-300 group-hover:text-zinc-900 dark:group-hover:text-zinc-100",children:"Send the message"})]}),(0,n.jsxs)("label",{className:"flex items-center gap-3 cursor-pointer group",children:[(0,n.jsx)("input",{type:"radio",name:"enterKeyBehavior",value:"newline",checked:"newline"===u,onChange:e=>p(e.target.value),className:"w-4 h-4 text-emerald-600 focus:ring-emerald-500"}),(0,n.jsxs)("span",{className:"text-sm text-zinc-700 dark:text-zinc-300 group-hover:text-zinc-900 dark:group-hover:text-zinc-100 flex items-center gap-2",children:["Start a new line (use ",(0,n.jsx)("kbd",{className:"px-1.5 py-0.5 text-xs bg-zinc-100 dark:bg-zinc-700 rounded border border-zinc-300 dark:border-zinc-600",children:m?"⌘":"Ctrl"})," +"," ",(0,n.jsx)("kbd",{className:"px-1.5 py-0.5 text-xs bg-zinc-100 dark:bg-zinc-700 rounded border border-zinc-300 dark:border-zinc-600",children:"Enter"})," to send)"]})]})]}),(0,n.jsx)("button",{onClick:k,disabled:s,className:"mt-4 w-full sm:w-auto px-6 py-2.5 bg-emerald-600 hover:bg-emerald-700 dark:bg-emerald-700 dark:hover:bg-emerald-600 text-white rounded-lg font-medium text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:(0,n.jsxs)(b.If,{condition:s,children:[(0,n.jsx)(b.al,{children:"Saving..."}),(0,n.jsx)(b._I,{children:"Save Settings"})]})})]})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-lg font-semibold text-zinc-900 dark:text-zinc-100 mb-2",children:"Notifications"}),(0,n.jsx)("p",{className:"text-sm text-zinc-600 dark:text-zinc-400 mb-4",children:"Get notified when AI responses are ready while you're away."}),(0,n.jsx)("div",{className:"bg-white dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg p-4 sm:p-6",children:(0,n.jsxs)(b.If,{condition:c,children:[(0,n.jsx)(b.al,{children:(0,n.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[(0,n.jsxs)("div",{className:"flex items-start gap-3",children:[(0,n.jsx)("div",{className:"flex-shrink-0 mt-0.5",children:(0,n.jsxs)(b.If,{condition:i,children:[(0,n.jsx)(b.al,{children:(0,n.jsx)(M.A,{size:20,className:"text-emerald-500"})}),(0,n.jsx)(b._I,{children:(0,n.jsx)(E,{size:20,className:"text-zinc-400"})})]})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("p",{className:"text-sm font-medium text-zinc-700 dark:text-zinc-300",children:"Desktop Notifications"}),(0,n.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400 mt-0.5",children:"Receive a notification when AI finishes responding while you're on another tab"}),(0,n.jsx)("div",{className:"flex items-center gap-1.5 mt-2",children:(0,n.jsxs)(b.If,{condition:"granted"===a,children:[(0,n.jsx)(b.al,{children:(0,n.jsxs)(b.If,{condition:i,children:[(0,n.jsxs)(b.al,{children:[(0,n.jsx)(T.A,{size:14,className:"text-emerald-500"}),(0,n.jsx)("span",{className:"text-xs text-emerald-600 dark:text-emerald-400",children:"Enabled"})]}),(0,n.jsxs)(b._I,{children:[(0,n.jsx)(P.A,{size:14,className:"text-zinc-400"}),(0,n.jsx)("span",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Disabled"})]})]})}),(0,n.jsx)(b._I,{children:(0,n.jsxs)(b.If,{condition:"denied"===a,children:[(0,n.jsxs)(b.al,{children:[(0,n.jsx)(L.A,{size:14,className:"text-red-500"}),(0,n.jsx)("span",{className:"text-xs text-red-600 dark:text-red-400",children:"Blocked by browser"})]}),(0,n.jsxs)(b._I,{children:[(0,n.jsx)(P.A,{size:14,className:"text-amber-500"}
1),(0,n.jsx)("span",{className:"text-xs text-amber-600 dark:text-amber-400",children:"Permission required"})]})]})})]})})]})]}),(0,n.jsx)("div",{className:"flex-shrink-0",children:(0,n.jsxs)(b.If,{condition:"denied"===a,children:[(0,n.jsx)(b.al,{children:(0,n.jsx)("p",{className:"text-xs text-zinc-500 dark:text-zinc-400 text-center sm:text-right",children:"Enable in browser settings"})}),(0,n.jsx)(b._I,{children:(0,n.jsxs)(b.If,{condition:"granted"===a,children:[(0,n.jsx)(b.al,{children:(0,n.jsx)("button",{onClick:()=>{i?(d(),h.Ay.success("Notifications disabled")):"granted"===a?(l(),h.Ay.success("Notifications enabled")):j()},className:"relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-offset-2 dark:focus:ring-offset-zinc-800 ".concat(i?"bg-emerald-600":"bg-zinc-300 dark:bg-zinc-600"),role:"switch","aria-checked":i,"data-posthog":"settings_notification_toggle",children:(0,n.jsx)("span",{className:"inline-block h-4 w-4 transform rounded-full bg-white transition-transform ".concat(i?"translate-x-6":"translate-x-1")})})}),(0,n.jsx)(b._I,{children:(0,n.jsx)("button",{onClick:j,disabled:g,className:"px-4 py-2 bg-emerald-600 hover:bg-emerald-700 dark:bg-emerald-700 dark:hover:bg-emerald-600 text-white rounded-lg font-medium text-sm transition-colors disabled:opacity-50 disabled:cursor-not-allowed","data-posthog":"settings_notification_request_permission",children:(0,n.jsxs)(b.If,{condition:g,children:[(0,n.jsx)(b.al,{children:"Requesting..."}),(0,n.jsx)(b._I,{children:"Enable"})]})})})]})})]})})]})}),(0,n.jsx)(b._I,{children:(0,n.jsxs)("div",{className:"flex items-center gap-3 text-zinc-500 dark:text-zinc-400",children:[(0,n.jsx)(E,{size:20}),(0,n.jsx)("p",{className:"text-sm",children:"Desktop notifications are not supported in this browser."})]})})]})})]})]})}var F=s(79984),O=s(77985),q=s(79516),J=s(12377),Y=s(61150),G=s(67901),H=s(60693);let U=()=>{let[e,t]=(0,r.useState)(""),[s,a]=(0,r.useState)(null),[i,c]=(0,r.useState)(!1),[o,l]=(0,r.useState)({title:"",content:""}),[d,m]=(0,r.useState)(!1),[x,u]=(0,r.useState)(!1),[p,g]=(0,r.useState)(null),[f,j]=(0,r.useState)(!1),{templates:k,loading:v,createTemplate:y,updateTemplate:z,deleteTemplate:A}=(0,H.D)(),C=(0,r.useMemo)(()=>{if(!e)return k;let t=e.toLowerCase();return k.filter(e=>e.title.toLowerCase().includes(t)||e.content.toLowerCase().includes(t))},[k,e]),_=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;e?(a(e),l({title:e.title,content:e.content})):(a(null),l({title:"",content:""})),c(!0)},D=()=>{c(!1),a(null),l({title:"",content:""})},S=async e=>{if(e.preventDefault(),!o.title.trim()){h.Ay.error("Template title is required");return}if(!o.content.trim()){h.Ay.error("Template content is required");return}if(o.title.trim().length>100){h.Ay.error("Template title must be 100 characters or less");return}if(o.content.trim().length>5e3){h.Ay.error("Template content must be 5000 characters or less");return}m(!0);try{s?(await z(s._id,o.title,o.content),h.Ay.success("Template updated successfully")):(await y(o.title,o.content),h.Ay.success("Template created successfully")),D()}catch(e){console.error("Error saving template:",e),e.message?h.Ay.error(e.message):h.Ay.error("Failed to ".concat(s?"update":"create"," template. Please try again."))}finally{m(!1)}},M=e=>{g(e),u(!0)},E=async()=>{if(p){j(!0);try{return await A(p._id),h.Ay.success("Template deleted successfully"),!0}catch(e){return console.error("Error deleting template:",e),e.message?h.Ay.error(e.message):h.Ay.error("Failed to delete template. Please try again."),!1}finally{j(!1),u(!1),g(null)}}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(b.If,{condition:i,children:[(0,n.jsx)(b.al,{children:(0,n.jsxs)("form",{onSubmit:S,className:"space-y-4",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-2",children:"Title"}),(0,n.jsx)("input",{type:"text",value:o.title,onChange:e=>l({...o,title:e.target.value}),placeholder:"Enter template title",className:"w-full px-3 py-2 border border-zinc-300 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder-zinc-400 dark:placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-blue-500",maxLength:100,required:!0})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"block text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-2",children:"Content"}),(0,n.jsx)("textarea",{value:o.content,onChange:e=>l({...o,content:e.target.value}),placeholder:"Enter common content Example: Please summarize the main points of the article in one precise sentence",className:"w-full px-3 py-2 border border-zinc-300 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder-zinc-400 dark:placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-none",rows:8,maxLength:5e3,required:!0})]}),(0,n.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,n.jsx)(Y.A,{variation:"secondary",onClick:D,disabled:d,children:"Cancel"}),(0,n.jsx)(Y.A,{variation:"primary",type:"submit",disabled:d||!o.title.trim()||!o.content.trim(),children:(0,n.jsxs)(b.If,{condition:d,children:[(0,n.jsx)(b.al,{children:"Saving..."}),(0,n.jsx)(b._I,{children:(0,n.jsxs)(b.If,{condition:s,children:[(0,n.jsx)(b.al,{children:"Update"}),(0,n.jsx)(b._I,{children:"Create"})]})})]})})]})]})}),(0,n.jsx)(b._I,{children:(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"flex gap-3",children:[(0,n.jsxs)("div",{className:"relative flex-1",children:[(0,n.jsx)(q.A,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-zinc-400"}
1),(0,n.jsx)("input",{type:"text",value:e,onChange:e=>t(e.target.value),placeholder:"Search Saved Prompts",className:"w-full pl-10 pr-3 py-2 border border-zinc-300 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder-zinc-400 dark:placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),(0,n.jsxs)(Y.A,{variation:"primary",onClick:()=>_(),className:"flex items-center gap-2 whitespace-nowrap",children:[(0,n.jsx)(w.A,{className:"w-4 h-4"}),"Add Prompt"]})]}),(0,n.jsxs)(b.If,{condition:v,children:[(0,n.jsx)(b.al,{children:(0,n.jsx)("div",{className:"flex justify-center py-8",children:(0,n.jsx)(G.A,{})})}),(0,n.jsx)(b._I,{children:(0,n.jsxs)(b.If,{condition:0===C.length,children:[(0,n.jsx)(b.al,{children:(0,n.jsx)("div",{className:"text-center py-12 text-zinc-500 dark:text-zinc-400",children:(0,n.jsxs)(b.If,{condition:e,children:[(0,n.jsx)(b.al,{children:"No templates found matching your search"}),(0,n.jsx)(b._I,{children:'No saved prompts yet. Click "Add Prompt" to create one.'})]})})}),(0,n.jsx)(b._I,{children:(0,n.jsxs)("div",{className:"border border-zinc-200 dark:border-zinc-800 rounded-lg overflow-hidden",children:[(0,n.jsxs)("div",{className:"grid grid-cols-[1fr,2fr,100px] gap-4 px-4 py-3 bg-zinc-50 dark:bg-zinc-800/50 border-b border-zinc-200 dark:border-zinc-800",children:[(0,n.jsx)("div",{className:"text-sm font-medium text-zinc-600 dark:text-zinc-400",children:"Title"}),(0,n.jsx)("div",{className:"text-sm font-medium text-zinc-600 dark:text-zinc-400",children:"Content"}),(0,n.jsx)("div",{className:"text-sm font-medium text-zinc-600 dark:text-zinc-400 text-right",children:"Actions"})]}),(0,n.jsx)("div",{className:"divide-y divide-zinc-200 dark:divide-zinc-800",children:C.map(e=>(0,n.jsxs)("div",{className:"grid grid-cols-[1fr,2fr,100px] gap-4 px-4 py-3 hover:bg-zinc-50 dark:hover:bg-zinc-800/30 transition-colors",children:[(0,n.jsx)("div",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate",children:e.title}),(0,n.jsx)("div",{className:"text-sm text-zinc-600 dark:text-zinc-400 truncate",children:e.content}),(0,n.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,n.jsx)("button",{onClick:()=>_(e),className:"p-1.5 rounded hover:bg-zinc-200 dark:hover:bg-zinc-700 transition-colors",title:"Edit template",children:(0,n.jsx)(J.A,{className:"w-4 h-4 text-zinc-600 dark:text-zinc-400"})}),(0,n.jsx)("button",{onClick:()=>M(e),className:"p-1.5 rounded hover:bg-red-100 dark:hover:bg-red-900/30 transition-colors",title:"Delete template",children:(0,n.jsx)(N.A,{className:"w-4 h-4 text-red-600 dark:text-red-400"})})]})]},e._id))})]})})]})})]})]})})]}),(0,n.jsx)(I.A,{isOpen:x,onClose:()=>{u(!1),g(null)},onConfirm:E,title:"Delete Prompt Template",message:'Are you sure you want to delete "'.concat(null==p?void 0:p.title,'"? This action cannot be undone.'),confirmText:"Delete",cancelText:"Cancel",isDanger:!0,isLoading:f})]})},R=()=>{let[e,t]=(0,r.useState)("personas"),{isSignedIn:s}=(0,F.Jd)(),u=(0,r.useRef)(null),{handleNewConversation:k}=(0,O.Y)(),v=(0,g.useRouter)(),[y,z]=(0,r.useState)(!1),[N,w]=(0,r.useState)(0),[A,C]=(0,r.useState)(null),[I,_]=(0,r.useState)(0),[S,M]=(0,r.useState)(0),[E,T]=(0,r.useState)(!1),P=async e=>{var t;let s=null===(t=e.target.files)||void 0===t?void 0:t[0];if(s){z(!0),w(0),C(null),_(0),M(0),T(!1);try{let e=new FileReader;e.onload=async e=>{try{let i=e.target.result,c=JSON.parse(i),o=[];if(Array.isArray(c))if(c.length>0&&c.every(e=>e.role&&e.content&&"string"==typeof e.content)){var t,s,n,r,a;console.log("\uD83D\uDCDD Detected simple message array format with ".concat(c.length," messages")),o=[{title:(null===(s=c[0])||void 0===s?void 0:null===(t=s.content)||void 0===t?void 0:t.substring(0,50))+((null===(r=c[0])||void 0===r?void 0:null===(n=r.content)||void 0===n?void 0:n.length)>50?"...":"")||"Imported Messages",messages:c,create_time:(null===(a=c[0])||void 0===a?void 0:a.timestamp)?new Date(c[0].timestamp).getTime()/1e3:Date.now()/1e3,source:"simple_messages"}]}else o=c;else o=[c];
1if(0===o.length)throw Error("No conversations found in import file");if(M(o.length),o.every(e=>e.mapping&&"object"==typeof e.mapping)&&o.length>5){console.log("\uD83D\uDE80 Using batch import for ".concat(o.length," ChatGPT JSON conversations"));let e=0;try{for(let t=0;t<o.length;t+=5){let s=o.slice(t,t+5),n=Math.min(t+5,o.length),r=Math.floor(t/5)+1,a=Math.ceil(o.length/5);console.log("\uD83D\uDCE6 Processing chunk ".concat(r,"/").concat(a,": conversations ").concat(t+1," to ").concat(n)),_(t),w(Math.round(t/o.length*100));try{let n=await fetch("/api/import/batch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({conversations:s})});if(n.ok){let t=await n.json();console.log("✅ Chunk ".concat(r," completed: ").concat(t.successfulImports,"/").concat(t.totalConversations," successful")),e+=t.successfulImports}else{let e=await n.json().catch(()=>({}));console.error("Chunk ".concat(r," import failed:"),e)}let a=Math.min(t+5,o.length);_(a),w(Math.round(a/o.length*100)),console.log("\uD83D\uDCCA Overall progress: ".concat(a,"/").concat(o.length," (").concat(Math.round(a/o.length*100),"%)")),await new Promise(e=>setTimeout(e,500))}catch(e){console.error("Error in chunk ".concat(r,":"),e)}}}catch(e){throw console.error("Error in import loop:",e),e}h.Ay.success("Imported ".concat(e," out of ").concat(o.length," conversations successfully")),e>0&&setTimeout(()=>{(0,h.Ay)("\uD83D\uDCDD Summaries are being generated in the background for ".concat(e," conversations. This may take a few minutes."),{duration:8e3,position:"top-center",icon:"⏳"})},1e3)}else{console.log("\uD83D\uDCE6 Using individual imports for ".concat(o.length," conversations"));let e=0,t=0;for(let s=0;s<o.length;s+=10){let n=o.slice(s,s+10);console.log("\uD83D\uDCE6 Processing batch ".concat(Math.floor(s/10)+1,": conversations ").concat(s+1," to ").concat(Math.min(s+10,o.length)));let r=n.map(async(e,t)=>{let n=s+t;try{let t;e.mapping&&"object"==typeof e.mapping?t="/api/import/json":(e.messages&&Array.isArray(e.messages),t="/api/import/chatgpt"),console.log("\uD83D\uDCE5 Importing conversation ".concat(n+1,"/").concat(o.length," using ").concat(t));let s=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(s.ok){let e=await s.json();return console.log("✅ Successfully imported conversation ".concat(n+1,": ").concat(e.conversationId)),{success:!0,index:n,result:e}}{let e=await s.json().catch(()=>({}));return console.error("Failed to import conversation ".concat(n+1,"/").concat(o.length,":"),e),{success:!1,index:n}}}catch(e){return console.error("Error importing conversation ".concat(n+1,":"),e),{success:!1,index:n,error:e.message}}});(await Promise.allSettled(r)).forEach((s,n)=>{e++,"fulfilled"===s.status&&s.value.success&&t++,_(e),w(Math.round(e/o.length*100))}),console.log("\uD83D\uDCCA Batch completed: ".concat(t,"/").concat(e," successful imports so far")),s+10<o.length&&await new Promise(e=>setTimeout(e,500))}h.Ay.success("Imported ".concat(t," out of ").concat(o.length," conversations successfully")),t>0&&setTimeout(()=>{(0,h.Ay)("\uD83D\uDCDD Summaries are being generated in the background for ".concat(t," conversations. This may take a few minutes."),{duration:8e3,position:"top-center",icon:"⏳"})},1e3)}u.current&&(u.current.value=""),T(!0),w(100),_(o.length),console.log("\uD83C\uDF89 All imports completed! Progress should show: ".concat(o.length,"/").concat(o.length," (100%)")),await new Promise(e=>setTimeout(e,4e3)),setTimeout(()=>{z(!1),w(0),_(0),M(0),T(!1),v.push("/"),k()},1e3)}catch(e){console.error("Error processing import file:",e),C(e.message||"Failed to process the import file"),h.Ay.error("Failed to process the import file"),z(!1)}},e.onerror=()=>{C("Failed to read the import file"),h.Ay.error("Failed to read the import file")},e.readAsText(s)}catch(e){console.error("Error during import:",e),C(e.message||"An unexpected error occurred during import"),h.Ay.error("An unexpected error occurred during import")}finally{A&&setTimeout(()=>{z(!1),w(0),_(0),M(0),T(!1)},3e3)}}};return(0,n.jsxs)(f.A,{children:[(0,n.jsx)(j.A,{}),(0,n.jsx)("div",{className:"flex flex-col h-full",children:(0,n.jsxs)("div",{className:"flex-1 flex flex-col overflow-y-auto bg-zinc-50 dark:bg-zinc-900",children:[(0,n.jsx)("div",{className:"bg-white dark:bg-zinc-800 border-b border-zinc-200 dark:border-zinc-700",children:(0,n.jsx)("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 py-4 sm:py-6",children:(0,n.jsxs)("div",{className:"flex items-center gap-3 sm:gap-4",children:[(0,n.jsx)(p(),{href:"/",className:"p-2 text-zinc-500 hover:text-zinc-700 dark:text-zinc-400 dark:hover:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-700 rounded-lg transition-colors",children:(0,n.jsx)(a.A,{size:20})}),(0,n.jsxs)("h1",{className:"text-xl sm:text-2xl font-semibold text-zinc-900 dark:text-zinc-100 flex items-center gap-2 sm:gap-3",children:[(0,n.jsx)(i.A,{size:22,className:"text-zinc-700 dark:text-zinc-300"}),"Settings"]})]})})}),(0,n.jsx)("div",{className:"max-w-4xl mx-auto px-4 sm:px-6 py-6 sm:py-8 w-full",children:(0,n.jsxs)("div",{className:"bg-white dark:bg-zinc-800 rounded-lg shadow-sm border border-zinc-200 dark:border-zinc-700",children:[(0,n.jsx)("div",{className:"border-b border-zinc-200 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-800/50",children:(0,n.jsxs)("div",{className:"flex px-4 sm:px-6 overflow-x-auto",children:[(0,n.jsxs)("button",{onClick:()=>t("personas"),className:"px-3 sm:px-4 py-3 sm:py-4 text-sm font-medium border-b-2 flex items-center gap-2 transition-colors whitespace-nowrap ".concat("personas"===e?"border-emerald-500 text-emerald-600 dark:text-emerald-400 bg-white dark:bg-zinc-800":"border-transparent text-zinc-600 dark:text-zinc-400 hover:text-zinc-800 dark:hover:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-700"),"data-posthog":"settings_tab_personas",children:[(0,n.jsx)(x.qd,{size:20,className:"text-gray-500"}),(0,n.jsx)("span",{className:"hidden xs:inline",children:"Memory Buckets"}),(0,n.jsx)("span",{className:"xs:hidden",children:"Memory"})]}),(0,n.jsxs)("button",{onClick:()=>t("tools"),className:"px-3 sm:px-4 py-3 sm:py-4 text-sm font-medium border-b-2 flex items-center gap-2 transition-colors whitespace-nowrap ".concat("tools"===e?"border-emerald-500 text-emerald-600 dark:text-emerald-400 bg-white dark:bg-zinc-800":"border-transparent text-zinc-600 dark:text-zinc-400 hover:text-zinc-800 dark:hover:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-700"),"data-posthog":"settings_tab_tools",children:[(0,n.jsx)(i.A,{size:16}),"Tools"]}),(0,n.jsxs)("button",{onClick:()=>t("chat"),className:"px-3 sm:px-4 py-3 sm:py-4 text-sm font-medium border-b-2 flex items-center gap-2 transition-colors whitespace-nowrap ".concat("chat"===e?"border-emerald-500 text-emerald-600 dark:text-emerald-400 bg-white dark:bg-zinc-800":"border-transparent text-zinc-600 dark:text-zinc-400 hover:text-zinc-800 dark:hover:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-700"),"data-posthog":"settings_tab_chat",children:[(0,n.jsx)(c.A,{size:16}),"Chat"]}),(0,n.jsxs)("button",{onClick:()=>t("prompts"),className:"px-3 sm:px-4 py-3 sm:py-4 text-sm font-medium border-b-2 flex items-center gap-2 transition-colors whitespace-nowrap ".concat("prompts"===e?"border-emerald-500 text-emerald-600 dark:text-emerald-400 bg-white dark:bg-zinc-800":"border-transparent text-zinc-600 dark:text-zinc-400 hover:text-zinc-800 dark:hover:text-zinc-200 hover:bg-zinc-100 dark:hover:bg-zinc-700"),"data-posthog":"settings_tab_prompts",children:[(0,n.jsx)(o.A,{size:16}),(0,n.jsx)("span",{className:"hidden xs:inline",children:"Prompt Templates"}),(0,n.jsx)("span",{className:"xs:hidden",children:"Prompts"})]})]})}),(0,n.jsxs)("div",{className:"p-4 sm:p-6",children:["personas"===e&&(0,n.jsx)(D,{isInline:!0}),"chat"===e&&(0,n.jsx)(B,{}),"prompts"===e&&(0,n.jsx)(U,{}),"tools"===e&&(0,n.jsx)("div",{className:"space-y-6",children:(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-lg font-semibold text-zinc-900 dark:text-zinc-100 mb-2",children:"Import & Export"}),(0,n.jsx)("p",{className:"text-sm text-zinc-600 dark:text-zinc-400 mb-4 sm:mb-6",children:"Import conversations from other platforms or use our Chrome extension for seamless integration."}),(0,n.jsxs)("div",{className:"space-y-4",children:[(0,n.jsxs)("div",{className:"bg-gradient-to-r from-emerald-50 to-blue-50 dark:from-emerald-900/20 dark:to-blue-900/20 border border-emerald-200 dark:border-emerald-800 rounded-lg p-4 sm:p-6",children:[(0,n.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsxs)("h4",{className:"text-base font-semibold text-zinc-800 dark:text-zinc-200 mb-2 flex items-center gap-2",children:[(0,n.jsx)(l.A,{size:20,className:"text-emerald-600 dark:text-emerald-400 flex-shrink-0"}),"Import Conversations"]}),(0,n.jsx)("p",{className:"text-sm text-zinc-600 dark:text-zinc-400 mb-2",children:"Upload a JSON file containing your conversations from ChatGPT exports or other compatible platforms. Supports both single conversations and batch imports."}
1),(0,n.jsx)("p",{className:"text-xs text-amber-600 dark:text-amber-400 bg-amber-50 dark:bg-amber-900/20 px-2 py-1 rounded",children:"ℹ️ Conversations import quickly, but summaries are generated in the background and may take several minutes"})]}),(0,n.jsx)("div",{className:"flex justify-start sm:justify-end",children:(0,n.jsx)("button",{onClick:()=>{if(!s){h.Ay.error("Please sign in to import conversations",{position:"top-center"});return}u.current&&u.current.click()},className:"w-full sm:w-auto px-4 sm:px-6 py-3 rounded-lg text-sm font-medium transition-all ".concat(s?"bg-emerald-600 text-white hover:bg-emerald-700 dark:bg-emerald-700 dark:hover:bg-emerald-600 shadow-sm hover:shadow-md":"bg-emerald-300 text-emerald-800 cursor-not-allowed dark:bg-emerald-900 dark:text-emerald-400"),disabled:!s||y,"aria-label":"Import conversations","data-posthog":"settings_import_conversations",children:(0,n.jsxs)(b.If,{condition:y,children:[(0,n.jsx)(b.al,{children:(0,n.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,n.jsx)("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),"Importing..."]})}),(0,n.jsx)(b._I,{children:(0,n.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,n.jsx)(l.A,{size:16}),"Choose File"]})})]})})})]}),(0,n.jsx)(b.If,{condition:y,children:(0,n.jsx)(b.al,{children:(0,n.jsxs)("div",{className:"mt-4",children:[(0,n.jsxs)("div",{className:"flex justify-between text-sm text-zinc-700 dark:text-zinc-300 mb-2",children:[(0,n.jsx)("span",{children:"Importing conversations..."}),(0,n.jsxs)("span",{children:[I,"/",S]})]}),(0,n.jsx)("div",{className:"w-full bg-zinc-200 dark:bg-zinc-700 rounded-full h-2",children:(0,n.jsx)("div",{className:"bg-emerald-500 h-2 rounded-full transition-all duration-300",style:{width:"".concat(N,"%")}})}),(0,n.jsxs)("div",{className:"text-xs text-zinc-500 dark:text-zinc-400 mt-1",children:[N,"% complete • Summaries will be generated in background"]})]})})}),(0,n.jsx)(b.If,{condition:A,children:(0,n.jsx)(b.al,{children:(0,n.jsx)("div",{className:"mt-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3",children:(0,n.jsxs)("div",{className:"text-sm text-red-700 dark:text-red-300 break-words",children:[(0,n.jsx)("strong",{children:"Error:"})," ",A]})})})}),(0,n.jsx)(b.If,{condition:!s,children:(0,n.jsx)(b.al,{children:(0,n.jsx)("div",{className:"mt-4 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-3",children:(0,n.jsxs)("div",{className:"text-sm text-blue-700 dark:text-blue-300",children:[(0,n.jsx)("strong",{children:"Note:"})," You need to be signed in to import conversations."]})})})}),(0,n.jsx)("input",{type:"file",ref:u,onChange:P,accept:".json",className:"hidden"})]}),(0,n.jsx)("div",{className:"bg-gradient-to-r from-blue-50 to-purple-50 dark:from-blue-900/20 dark:to-purple-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4 sm:p-6",children:(0,n.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,n.jsxs)("div",{className:"flex-1",children:[(0,n.jsxs)("h4",{className:"text-base font-semibold text-zinc-800 dark:text-zinc-200 mb-2 flex items-center gap-2",children:[(0,n.jsx)(d.A,{size:20,className:"text-blue-600 dark:text-blue-400 flex-shrink-0"}),"Chrome Extension"]}),(0,n.jsx)("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"Install our Chrome extension to easily import conversations directly from ChatGPT and other platforms."})]}),(0,n.jsx)("div",{className:"flex justify-start sm:justify-end",children:(0,n.jsxs)("a",{href:"https://chromewebstore.google.com/detail/branchprompt-import/lpckgfpogdmdmkfdnkfpebnnbjkegoop",target:"_blank",rel:"noopener noreferrer",className:"w-full sm:w-auto px-4 sm:px-6 py-3 rounded-lg text-sm font-medium bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-700 dark:hover:bg-blue-600 transition-all shadow-sm hover:shadow-md flex items-center justify-center gap-2","aria-label":"Get Chrome Extension","data-posthog":"settings_chrome_extension_link",children:[(0,n.jsx)(d.A,{size:16}),(0,n.jsx)("span",{className:"hidden xs:inline",children:"Get Extension"}),(0,n.jsx)("span",{className:"xs:hidden",children:"Get Extension"}),(0,n.jsx)(m.A,{size:14})]})})]})})]})]})})]})]})})]})})]})}},10345:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(11713).A)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},13100:(e,t,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/settings",function(){return s(9554)}])},22885:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(11713).A)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},26257:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});
1let n=(0,s(11713).A)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]])},29812:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(11713).A)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]])},60693:(e,t,s)=>{"use strict";s.d(t,{D:()=>a});var n=s(14232),r=s(79984);let a=()=>{let{isSignedIn:e}=(0,r.Jd)(),[t,s]=(0,n.useState)([]),[a,i]=(0,n.useState)(!1),[c,o]=(0,n.useState)(null),l=(0,n.useCallback)(async()=>{if(!e){s([]),i(!1);return}try{i(!0),o(null);let e=await fetch("/api/prompt-templates");if(!e.ok)throw Error("Failed to fetch templates");let t=await e.json();s(t.templates||[])}catch(e){console.error("Error fetching templates:",e),o(e.message)}finally{i(!1)}},[e]),d=(0,n.useCallback)(async(t,n)=>{if(!e)throw Error("You must be signed in to create templates");try{let e=await fetch("/api/prompt-templates",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:t,content:n})}),r=await e.json();if(!e.ok)throw Error(r.error||"Failed to create template");return s(e=>[r.template,...e]),r.template}catch(e){throw console.error("Error creating template:",e),e}},[e]),m=(0,n.useCallback)(async(t,n,r)=>{if(!e)throw Error("You must be signed in to update templates");try{let e=await fetch("/api/prompt-templates/".concat(t),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:n,content:r})}),a=await e.json();if(!e.ok)throw Error(a.error||"Failed to update template");return s(e=>e.map(e=>e._id===t?a.template:e)),a.template}catch(e){throw console.error("Error updating template:",e),e}},[e]),x=(0,n.useCallback)(async t=>{if(!e)throw Error("You must be signed in to delete templates");try{let e=await fetch("/api/prompt-templates/".concat(t),{method:"DELETE"}),n=await e.json();if(!e.ok)throw Error(n.error||"Failed to delete template");s(e=>e.filter(e=>e._id!==t))}catch(e){throw console.error("Error deleting template:",e),e}},[e]);return(0,n.useEffect)(()=>
1{l()},[l]),{templates:t,loading:a,error:c,fetchTemplates:l,createTemplate:d,updateTemplate:m,deleteTemplate:x}}},65104:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(11713).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},71678:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(11713).A)("text-select",[["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 14v1",key:"169vum"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h6",key:"1vyc9m"}],["path",{d:"M7 8h8",key:"1jbsf9"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M9 3h1",key:"1yesri"}]])},92577:(e,t,s)=>{"use strict";s.d(t,{A:()=>n});let n=(0,s(11713).A)("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]])}},e=>{var t=t=>e(e.s=t);e.O(0,[347,1327,8230,3474,3005,3,5979,6658,9591,636,6593,8792],()=>t(13100)),_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.