PageSourceSearch

https://aiplans.org/assets/SubmitResearchDirectionView-B0XUF9ha.js

js aiplans.org collected 2026-10-08 11:09:41 UTC 4,630 bytes, 1 lines download raw bytes

1import{s as E,u as N,g as O,h as H,z as r,o as _,c as Y,a as s,j as l,k as c,F as q,l as i,i as x,V as G,e as J,Y as K,U as P,a0 as Q,a1 as W}from"./index-D8GvWgwI.js";import{u as X}from"./researchDirectionStore-AWp8pEWC.js";import{u as Z}from"./postStore-fxCwPju5.js";const ee={class:"justify-content-center mt-2 surface-section"},te={class:"px-2 py-1"},oe={class:"flex flex-column justify-content-end"},se={style:{"margin-top":"10px",padding:"10px"}},le={class:"flex w-full"},ne={style:{display:"flex","justify-content":"center","align-items":"center",height:"150px",margin:"0 auto"}},ce={__name:"SubmitResearchDirectionView",setup(ae){const d=E(),D=X(),F=Z(),U=N(),p=i(""),w=i(""),y=i(""),C=J(()=>{var t;return!!((t=d.User)!=null&&t.username)}),m=i(""),S=i([]),f=i([]),h=O(),V=i("center"),v=i(!1),b=K(P),g=i(!0),z=()=>{V.value="center",v.value=!0},L=()=>{v.value=!1};async function R(t,e){const u=t.map(async n=>{if(console.log("Post:",n),!n.id){console.error("Post is missing an id:",n);return}try{const a=await h.collection("posts").getOne(n.id);return a.research_direction||(a.research_direction=[]),a.research_direction.includes(e)||a.research_direction.push(e),await h.collection("posts").update(n.id,{research_direction:a.research_direction})}catch(a){if(a.status===404)console.error(`Post with ID ${n.id} not found.`);else throw a}});return Promise.all(u)}const $=async()=>{try{const t=await D.addResearchDirection({title:p.value,attribution:y.value,description:m.value,author:d.pb.authStore.model.id,published:!0,admin:d.User.id}),e={research_directions:[t.id],plan:f.value.map(u=>u.id),reason:w.value,user:d.User.id};await h.collection("plans_to_directions").create(e),await R(f.value,t.id),await U.push(`/research_direction/${t.id}`)}catch(t){console.error("An error occurred:",t)}};H(async()=>{try{console.log("Fetching posts..."),S.value=await F.fetchAllPosts()}catch(t){console.error("Error fetching posts:",t)}});function B(t){return new DOMParser().parseFromString(t||"","text/html").body.textContent||""}const M=async t=>{switch(t){case"SignInForm":b.value=P,g.value=!0;break;case"SignUpForm":b.value=W,g.value=!0;break;case"ForgotPasswordForm":b.value=Q,g.value=!1;break}};return(t,e)=>{const u=r("InputText"),n=r("FloatLabel"),a=r("Editor"),T=r("MultiSelect"),k=r("Button"),I=r("Card"),j=r("Dialog"),A=r("Toast");return _(),Y(q,null,[s("div",ee,[l(I,null,{content:c(()=>[s("div",te,[s("div",oe,[e[11]||(e[11]=s("span",{class:"pt-2"},null,-1)),l(n,null,{default:c(()=>[l(u,{id:"title",type:"text",class:"w-full",modelValue:p.value,"onUpdate:modelValue":e[0]||(e[0]=o=>p.value=o),autoresize:""},null,8,["modelValue"]),e[8]||(e[8]=s("label",{for:"title"},"Title",-1))]),_:1}),e[12]||(e[12]=s("span",{class:"pt-2"},null,-1)),l(n,null,{default:c(()=>[l(u,{id:"attribution",type:"text",class:"w-full",modelValue:y.value,"onUpdate:modelValue":e[1]||(e[1]=o=>y.value=o),autoresize:""},null,8,["modelValue"]),e[9]||(e[9]=s("label",{for:"attribution"},"Attribution",-1))]),_:1}),e[13]||(e[13]=s("span",{class:"pt-2"},null,-1)),l(a,{id:"content",class:"w-full",editorStyle:"height: 320px",modelValue:m.value,"onUpdate:modelValue":e[2]||(e[2]=o=>m.value=o),autoResize:""},null,8,["modelValue"]),s("div",se,[l(T,{modelValue:f.value,"onUpdate:modelValue":e[3]||(e[3]=o=>f.value=o),options:S.value,optionLabel:"name",filter:"",placeholder:"Select Plans",maxSelectedLabels:1,class:"w-full md:w-80",filterMatchMode:"contains",showToggleAll:!1,selectionLimit:1},null,8,["modelValue","options"])]),l(n,null,{default:c(()=>[l(u,{id:"reason",type:"text",class:"w-full",modelValue:w.value,"onUpdate:modelValue":e[4]||(e[4]=o=>w.value=o),autoresize:""},null,8,["modelValue"]),e[10]||(e[10]=s("label",{for:"reason"},"Reason",-1))]),_:1}),s("div",le,[s("div",ne,[C.value?(_(),x(k,{key:0,disabled:!p.value||B(m.value).length<100,onClick:e[5]||(e[5]=o=>$()),icon:"pi pi-plus",class:"mt-2",label:"Submit",style:{"font-size":"1.2rem",padding:"1rem 2rem","background-color":"#b19df7",color:"white",border:"none"},size:"large"},null,8,["disabled"])):(_(),x(k,{key:1,onClick:e[6]||(e[6]=o=>z()),icon:"pi pi-user",class:"mt-2",label:"Sign up/Login to submit",style:{"font-size":"1.2rem",padding:"1rem 2rem","background-color":"#b19df7",color:"white",border:"none"},size:"large"}))])])])])]),_:1}
1)]),l(j,{visible:v.value,"onUpdate:visible":e[7]||(e[7]=o=>v.value=o),style:{width:"50vw"},breakpoints:{"1199px":"75vw","575px":"90vw"},position:V.value,modal:!0,draggable:!1,closable:g.value},{default:c(()=>[(_(),x(G(b.value),{onChange_form:M,onSuccess:L},null,32))]),_:1},8,["visible","position","closable"]),l(A)],64)}}};export{ce as default};

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.