1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2051],{6392:function(e,s,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/ind-admin/prompts",function(){return t(8632)}])},2500:function(e,s,t){"use strict";t.d(s,{Z:function(){return d}});var l=t(2322),a=t(5784),n=t(5632),i=t(2556),r=t.n(i),c=t(3009),d=function(e){let{children:s}=e,{user:t,loadingUser:i}=(0,a.a)(),d=(0,n.useRouter)();if(i)return(0,l.jsx)("div",{className:r().container,children:(0,l.jsx)("div",{className:"space-y-4 ".concat(r().main," flex flex-col items-center"),children:(0,l.jsx)(c.Z,{})})});if(t){if(t.isAdmin)return s;d.push("/")}else d.push("/sign-in");return(0,l.jsx)(l.Fragment,{})}},8632:function(e,s,t){"use strict";t.r(s),t.d(s,{__N_SSG:function(){return k},default:function(){return S}});var l=t(2322),a=t(2500),n=t(3469),i=t(8883),r=t(195),c=t(3955),d=t(9080),o=t(6613),u=t(3259),x=t(4001),m=t(3889),h=t(5971),p=t(2784),f=t(1706),j=t.n(f),g=t(4438),N=t.n(g),v=t(2779),b=t.n(v),_=t(516);let y=p.forwardRef((e,s)=>{var t,a;let{children:n,label:i,error:r,...c}=e,d=null!==(a=null!==(t=c.id)&&void 0!==t?t:c.name)&&void 0!==a?a:(0,p.useId)();return(0,l.jsxs)(l.Fragment,{children:[i?(0,l.jsx)("label",{htmlFor:d,children:i}):null,(0,l.jsx)("textarea",{...c,id:d,className:b()(j().default,N().states,c.className),ref:s,children:n}),(0,l.jsx)(_.Z,{children:null==r?void 0:r.message})]})});var w=t(1700),F=t(2170),k=!0,S=(0,u.W)(function(){var e;let{register:s,handleSubmit:t,formState:{errors:u},setError:p,reset:f,control:j,watch:g}=(0,c.cI)({resolver:(0,i.F)(F.yc.extend({categories:r.z.string().array().min(1)})),defaultValues:{schedule:w.r4}}),{data:N}=x.SX.useQuery(["publicPrompt.getAllCategories"],{enabled:!1}),{mutate:v,isLoading:b}=x.SX.useMutation("admin.createPrompt"),_="ACTIVE"===g("schedule.status");return(0,l.jsx)(a.Z,{children:(0,l.jsx)(o._z,{children:(0,l.jsxs)("div",{className:"font-sans prose prose-neutral",children:[(0,l.jsx)(o.mr,{title:"Manage prompts"}),(0,l.jsxs)("form",{className:"flex flex-col space-y-4",onSubmit:t(async e=>{try{let{categories:s,...t}=e;v({categories:s,prompt:t}),f()}catch(l){l instanceof window.Error&&p("title",{message:"Something went wrong saving the prompt: ".concat(l.message)})}}),children:[(0,l.jsx)(n.x,{as:"H3",children:"New Prompt"}),(0,l.jsx)("div",{className:"flex flex-col space-y-1",children:(0,l.jsx)(h.Z,{className:"form-input",...s("title"),label:"Prompt",type:"text",error:u.title})}),(0,l.jsx)("div",{className:"flex flex-col space-y-1",children:(0,l.jsx)(y,{...s("description"),label:"Description",error:u.description,className:"form-textarea"})}),(0,l.jsxs)("div",{className:"flex flex-col",children:[(0,l.jsx)(n.x,{className:"mb-2",children:"Categories *"}),(0,l.jsxs)("div",{className:"grid grid-cols-2 gap-x-4 md:grid-cols-3",children:[null==N?void 0:N.map(e=>(0,l.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,l.jsx)("input",{...s("categories"),className:"form-checkbox",type:"checkbox",id:e.id,value:e.id}),(0,l.jsx)("label",{htmlFor:e.id,children:e.title})]},e.id)),(0,l.jsx)("input",{...s("categories"),className:"hidden",type:"checkbox"})]}),(0,l.jsx)(d.Z,{children:null===(e=u.categories)||void 0===e?void 0:e.message})]}),(0,l.jsxs)("div",{children:[(0,l.jsx)(n.x,{as:"H4",className:"my-2",children:"Suggested schedule"}),(0,l.jsx)(n.x,{children:"If the prompt can be used as a thread, add a suggested schedule below. If no schedule is added, prompt will be treated as one-offâi.e. not shown with suggested threads."}),(0,l.jsx)(w.l0,{register:s,control:j,watch:g})]}),(0,l.jsxs)(m.Z,{disabled:b,type:"submit",children:["Add ",_?"thread":"prompt"]})]}),(0,l.jsxs)("form",{className:"flex flex-col space-y-4",children:[(0,l.jsx)(n.x,{as:"H3",children:"New Category (not active yet)"}),(0,l.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,l.jsx)("label",{htmlFor:"title",children:"Title"}),(0,l.jsx)("input",{className:"form-input",type:"text"})]}),(0,l.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,l.jsx)("label",{htmlFor:"shortDescription",children:"Short Description"}),(0,l.jsx)("input",{className:"form-input",type:"text"})]}),(0,l.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,l.jsx)("label",{htmlFor:"description",children:"Description"}),(0,l.jsx)("textarea",{className:"form-textarea"})]}),(0,l.jsx)(m.Z,{disabled:!0,type:"submit",children:"Add Category"})]})]})})})}
1,{breadcrumbs:[{name:"All entries",link:"/"},{name:"Admin",link:"/ind-admin"},{name:"Prompts",link:!1}]})},5971:function(e,s,t){"use strict";var l=t(2322),a=t(2784),n=t(7403),i=t.n(n),r=t(4438),c=t.n(r),d=t(2779),o=t.n(d),u=t(516);let x=a.forwardRef((e,s)=>{var t,n;let{label:r,error:d,...x}=e,m=null!==(n=null!==(t=x.id)&&void 0!==t?t:x.name)&&void 0!==n?n:(0,a.useId)();return(0,l.jsxs)(l.Fragment,{children:[r?(0,l.jsx)("label",{htmlFor:m,children:r}):null,(0,l.jsx)("input",{...x,id:m,className:o()(i().input,c().states,x.className),ref:s}),(0,l.jsx)(u.Z,{children:null==d?void 0:d.message})]})});s.Z=x},7403:function(e){e.exports={input:"Input_input___aMFm"}},4438:function(e){e.exports={states:"States_states__Kp5mX"}},1706:function(e){e.exports={default:"Textarea_default__nll7q"}}},function(e){e.O(0,[8917,2123,5891,5789,8898,4872,7816,2445,2652,3285,442,8757,3955,5772,3612,3259,9226,5420,9774,2888,179],function(){return e(e.s=6392)}),_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.