1/*! For license information please see 5562.9203e795.chunk.js.LICENSE.txt */ 2"use strict";(globalThis.webpackChunkhive_postify_client||=[]).push([[5562],{5562(e,t,a){a.r(t);var s=a(9950),r=a(8429),l=a(9502),i=a(9201),n=a(4215),d=a(7838),c=a(7637),o=a(6859),m=a(2796),x=a(2737),u=a(1064),p=a(8520),h=a(2857),b=a(7232),y=a(9734),g=a(4414);const j=()=>{const e=(0,r.Zp)(),{isAuthenticated:t,user:a,loginMethod:j,postingKey:v}=(0,p.useAuthStore)(),[f,N]=(0,s.useState)(!1),[k,w]=(0,s.useState)(!1),[D,A]=(0,s.useState)(""),[P,S]=(0,s.useState)({subject:"",permlink:"",receiver:"",dailyPay:"",duration:"",startDate:"",endDate:"",description:""}),[C,H]=(0,s.useState)({}),q=(e,t)=>{S(a=>{const s={...a,[e]:t};if("subject"===e&&(s.permlink=t.toLowerCase().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").substring(0,255)),("startDate"===e||"duration"===e)&&s.startDate&&s.duration){const e=new Date(s.startDate),t=new Date(e);t.setDate(e.getDate()+parseInt(s.duration)),s.endDate=t.toISOString().split("T")[0]}return s}),C[e]&&H(t=>({...t,[e]:""}))};return t?(0,g.jsxs)("div",{className:"max-w-4xl mx-auto px-4 py-6",children:[(0,g.jsxs)("div",{className:"mb-6",children:[(0,g.jsx)("h1",{className:"text-3xl font-bold mb-2",children:"Create Hive Proposal"}),(0,g.jsx)("p",{className:"text-gray-600 dark:text-gray-400",children:"Submit a funding proposal to the Hive community"})]}),(0,g.jsx)("div",{className:"card p-6 mb-6 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800",children:(0,g.jsxs)("div",{className:"flex items-start gap-3",children:[(0,g.jsx)(o.A,{className:"w-6 h-6 text-blue-600 dark:text-blue-400 flex-shrink-0 mt-0.5"}),(0,g.jsxs)("div",{children:[(0,g.jsx)("h3",{className:"font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"Proposal Guidelines"}),(0,g.jsxs)("ul",{className:"text-sm text-blue-800 dark:text-blue-200 space-y-1",children:[(0,g.jsx)("li",{children:"\u2022 Be clear and specific about what you're building"}),(0,g.jsx)("li",{children:"\u2022 Include detailed milestones and deliverables"}),(0,g.jsx)("li",{children:"\u2022 Justify your budget and timeline"}),(0,g.jsx)("li",{children:"\u2022 Show your experience and past work"}),(0,g.jsx)("li",{children:"\u2022 Engage with the community for feedback"})]})]})]})}),(0,g.jsxs)("form",{onSubmit:async s=>{if(s.preventDefault(),t)if((()=>{const e={};if(P.subject.trim()?P.subject.length<10?e.subject="Title must be at least 10 characters":P.subject.length>255&&(e.subject="Title must be less than 255 characters"):e.subject="Proposal title is required",P.receiver.trim()?/^[a-z0-9.-]{3,16}$/.test(P.receiver)||(e.receiver="Invalid Hive username format"):e.receiver="Receiver account is required",P.dailyPay?parseFloat(P.dailyPay)<=0?e.dailyPay="Daily pay must be greater than 0":parseFloat(P.dailyPay)>1e3&&(e.dailyPay="Daily pay cannot exceed 1000 HBD"):e.dailyPay="Daily pay amount is required",P.duration?parseInt(P.duration)<1?e.duration="Duration must be at least 1 day":parseInt(P.duration)>365&&(e.duration="Duration cannot exceed 365 days"):e.duration="Duration is required",P.startDate){const t=new Date(P.startDate),a=new Date;a.setHours(0,0,0,0),t<a&&(e.startDate="Start date cannot be in the past")}else e.startDate="Start date is required";P.description.trim()?P.description.length<100&&(e.description="Description must be at least 100 characters"):e.description="Proposal description is required";const t=p.useAuthStore.getState().isVaultUser();return"keychain"===j||t||D.trim()||(e.activeKey="Active key is required"),H(e),0===Object.keys(e).length})())try{N(!0);const t={title:P.subject,body:P.description,tags:["hive-proposals","proposal","hive"],author:a.username,permlink:P.permlink},s="keychain"===j?null:v||await p.useAuthStore.getState().fetchSessionKey();await h.B.createPost(s,a.username,t.title,t.body,t.tags,t.permlink),await new Promise(e=>setTimeout(e,3e3));const r={creator:a.username,receiver:P.receiver,start_date:P.startDate,end_date:P.endDate,daily_pay:`${parseFloat(P.dailyPay).toFixed(3)} HBD`,subject:P.subject,permlink:P.permlink,extensions:[]},l="keychain"===j?null:D.trim()||await p.useAuthStore.getState().fetchActiveKey();await h.B.createProposal(l,r),b.oR.success("Proposal created successfully!"),e("/proposals")}catch(r){console.error("Error creating proposal:",r),b.oR.error("Failed to create proposal: "+r.message)}finally{N(!1)}else b.oR.error("Please fix the errors in the form");else b.oR.error("Please login to create a proposal")},className:"space-y-6",children:[(0,g.jsxs)("div",{className:"card p-6",children:[(0,g.jsxs)("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[(0,g.jsx)(c.A,{className:"w-5 h-5"}),"Basic Information"]}),(0,g.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,g.jsxs)("div",{className:"md:col-span-2",children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-2",children:"Proposal Title *"}),(0,g.jsx)("input",{type:"text",value:P.subject,onChange:e=>q("subject",e.target.value),placeholder:"Enter a clear, descriptive title for your proposal",className:"input-field w-full "+(C.subject?"border-red-500":""),maxLength:255}),C.subject&&(0,g.jsx)("p",{className:"text-red-500 text-sm mt-1",children:C.subject}),(0,g.jsxs)("p",{className:"text-xs text-gray-500 mt-1",children:[P.subject.length,"/255 characters"]})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-2",children:"URL Slug (Auto-generated)"}),(0,g.jsx)("input",{type:"text",value:P.permlink,onChange:e=>q("permlink",e.target.value),placeholder:"proposal-url-slug",className:"input-field w-full bg-gray-50 dark:bg-dark-700",maxLength:255}),(0,g.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"This will be your proposal's
2URL"})]}),(0,g.jsxs)("div",{children:[(0,g.jsxs)("label",{className:"block text-sm font-medium mb-2",children:[(0,g.jsx)(u.A,{className:"w-4 h-4 inline mr-1"}),"Receiver Account *"]}),(0,g.jsx)("input",{type:"text",value:P.receiver,onChange:e=>q("receiver",e.target.value),placeholder:"username",className:"input-field w-full "+(C.receiver?"border-red-500":"")}),C.receiver&&(0,g.jsx)("p",{className:"text-red-500 text-sm mt-1",children:C.receiver}),(0,g.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Account that will receive the funds"})]})]})]}),(0,g.jsxs)("div",{className:"card p-6",children:[(0,g.jsxs)("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[(0,g.jsx)(n.A,{className:"w-5 h-5"}),"Funding Details"]}),(0,g.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-2",children:"Daily Pay (HBD) *"}),(0,g.jsx)("input",{type:"number",step:"0.001",min:"0.001",max:"1000",value:P.dailyPay,onChange:e=>q("dailyPay",e.target.value),placeholder:"0.000",className:"input-field w-full "+(C.dailyPay?"border-red-500":"")}),C.dailyPay&&(0,g.jsx)("p",{className:"text-red-500 text-sm mt-1",children:C.dailyPay})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-2",children:"Duration (Days) *"}),(0,g.jsx)("input",{type:"number",min:"1",max:"365",value:P.duration,onChange:e=>q("duration",e.target.value),placeholder:"30",className:"input-field w-full "+(C.duration?"border-red-500":"")}),C.duration&&(0,g.jsx)("p",{className:"text-red-500 text-sm mt-1",children:C.duration})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-2",children:"Total Budget (HBD)"}),(0,g.jsx)("input",{type:"text",value:P.dailyPay&&P.duration?(parseFloat(P.dailyPay)*parseInt(P.duration)).toFixed(3):"0.000",readOnly:!0,className:"input-field w-full bg-gray-50 dark:bg-dark-700 font-mono"}),(0,g.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Calculated automatically"})]})]})]}),(0,g.jsxs)("div",{className:"card p-6",children:[(0,g.jsxs)("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[(0,g.jsx)(i.A,{className:"w-5 h-5"}),"Timeline"]}),(0,g.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-2",children:"Start Date *"}),(0,g.jsx)("input",{type:"date",value:P.startDate,onChange:e=>q("startDate",e.target.value),min:(new Date).toISOString().split("T")[0],className:"input-field w-full "+(C.startDate?"border-red-500":"")}),C.startDate&&(0,g.jsx)("p",{className:"text-red-500 text-sm mt-1",children:C.startDate})]}),(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-2",children:"End Date (Auto-calculated)"}),(0,g.jsx)("input",{type:"date",value:P.endDate,readOnly:!0,className:"input-field w-full bg-gray-50 dark:bg-dark-700"})]})]})]}),(0,g.jsxs)("div",{className:"card p-6",children:[(0,g.jsx)("h2",{className:"text-xl font-semibold mb-4",children:"Proposal Description *"}),(0,g.jsxs)("div",{className:"mb-4",children:[(0,g.jsxs)("div",{className:"flex gap-2 mb-2",children:[(0,g.jsx)("button",{type:"button",onClick:()=>w(!1),className:"px-4 py-2 rounded-lg text-sm font-medium transition "+(k?"bg-gray-100 dark:bg-dark-700 hover:bg-gray-200 dark:hover:bg-dark-600":"bg-primary-600 text-white"),children:"Write"}),(0,g.jsxs)("button",{type:"button",onClick:()=>w(!0),className:"px-4 py-2 rounded-lg text-sm font-medium transition flex items-center gap-2 "+(k?"bg-primary-600 text-white":"bg-gray-100 dark:bg-dark-700 hover:bg-gray-200 dark:hover:bg-dark-600"),children:[(0,g.jsx)(d.A,{className:"w-4 h-4"}),"Preview"]})]}),k?(0,g.jsx)("div",{className:"border border-gray-300 dark:border-dark-600 rounded-lg p-4 min-h-[300px] bg-white dark:bg-dark-800",children:P.description?(0,g.jsx)(y.A,{content:P.description}):(0,g.jsx)("p",{className:"text-gray-500 italic",children:"Nothing to preview yet..."})}):(0,g.jsx)("textarea",{value:P.description,onChange:e=>q("description",e.target.value),placeholder:"Describe your proposal in detail. Include:\r\n\u2022 What you're building and why it's needed\r\n\u2022 Your experience and qualifications\r\n\u2022 Detailed timeline and milestones\r\n\u2022 How the funds will be used\r\n\u2022 Expected outcomes and benefits to Hive\r You can use Markdown formatting for better presentation.",rows:15,className:"input-field w-full resize-none "+(C.description?"border-red-500":"")}
2),C.description&&(0,g.jsx)("p",{className:"text-red-500 text-sm mt-1",children:C.description}),(0,g.jsxs)("p",{className:"text-xs text-gray-500 mt-1",children:[P.description.length," characters (minimum 100 required)"]})]})]}),"keychain"!==j&&(0,g.jsxs)("div",{className:"card p-6",children:[(0,g.jsxs)("h2",{className:"text-xl font-semibold mb-4 flex items-center gap-2",children:[(0,g.jsx)(m.A,{className:"w-5 h-5"}),"Authentication"]}),(0,g.jsxs)("div",{children:[(0,g.jsx)("label",{className:"block text-sm font-medium mb-2",children:"Active Key *"}),(0,g.jsx)("input",{type:"password",value:D,onChange:e=>A(e.target.value),placeholder:"Enter your active key",className:"input-field w-full "+(C.activeKey?"border-red-500":"")}),C.activeKey&&(0,g.jsx)("p",{className:"text-red-500 text-sm mt-1",children:C.activeKey}),(0,g.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:"Required to create proposals. Your key is not stored."})]})]}),"keychain"===j&&(0,g.jsx)("div",{className:"card p-6 bg-orange-50 dark:bg-orange-900/20 border border-orange-200 dark:border-orange-800",children:(0,g.jsxs)("div",{className:"flex items-center gap-3",children:[(0,g.jsx)("img",{src:"https://images.hive.blog/DQmQZZDTgk2EGNiM8nvaPQRQpXtxTDjuK3fZur1DgajDHQm/Hivekeychain.png",alt:"Hive Keychain",className:"w-8 h-8 rounded-full"}),(0,g.jsxs)("div",{children:[(0,g.jsx)("h3",{className:"font-semibold text-orange-900 dark:text-orange-100",children:"Hive Keychain Integration"}),(0,g.jsx)("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:"Your proposal will be created securely through Hive Keychain. You'll be prompted to approve the transactions."})]})]})}),(0,g.jsx)("div",{className:"card p-6 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800",children:(0,g.jsxs)("div",{className:"flex items-start gap-3",children:[(0,g.jsx)(l.A,{className:"w-6 h-6 text-yellow-600 dark:text-yellow-400 flex-shrink-0 mt-0.5"}),(0,g.jsxs)("div",{children:[(0,g.jsx)("h3",{className:"font-semibold text-yellow-900 dark:text-yellow-100 mb-2",children:"Important Notes"}),(0,g.jsxs)("ul",{className:"text-sm text-yellow-800 dark:text-yellow-200 space-y-1",children:[(0,g.jsx)("li",{children:"\u2022 Creating a proposal requires platform fees as per network rules"}),(0,g.jsx)("li",{children:"\u2022 Your proposal will be visible to the entire community"}),(0,g.jsx)("li",{children:"\u2022 Make sure all information is accurate before submitting"}),(0,g.jsx)("li",{children:"\u2022 Engage with the community to promote your proposal"}),(0,g.jsx)("li",{children:"\u2022 Review all details carefully as changes may not be possible after submission"})]})]})]})}),(0,g.jsxs)("div",{className:"flex gap-4",children:[(0,g.jsx)("button",{type:"button",onClick:()=>e("/proposals"),className:"btn-secondary flex-1",disabled:f,children:"Cancel"}),(0,g.jsx)("button",{type:"submit",className:"btn-primary flex-1 flex items-center justify-center gap-2",disabled:f,children:f?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("div",{className:"animate-spin rounded-full h-4 w-4 border-2 border-white border-t-transparent"}),"Creating..."]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(x.A,{className:"w-4 h-4"}),"Create Proposal"]})})]})]})]}):(0,g.jsx)("div",{className:"max-w-4xl mx-auto px-4 py-8",children:(0,g.jsxs)("div",{className:"card p-8 text-center",children:[(0,g.jsx)(c.A,{className:"w-16 h-16 mx-auto mb-4 text-gray-400"}),(0,g.jsx)("h2",{className:"text-2xl font-bold mb-4",children:"Login Required"}),(0,g.jsx)("p",{className:"text-gray-600 dark:text-gray-400 mb-6",children:"You need to be logged in to create a proposal"}),(0,g.jsx)("button",{onClick:()=>e("/login"),className:"btn-primary",children:"Login to Continue"})]})})};a.d(t,["default",0,j])},9502(e,t,a){const s=(0,a(9655).A)("AlertCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);a.d(t,["A",0,s])},9201(e,t,a){const s=(0,a(9655).A)("Calendar",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",ry:"2",key:"eu3xkr"}],["line",{x1:"16",x2:"16",y1:"2",y2:"6",key:"m3sa8f"}],["line",{x1:"8",x2:"8",y1:"2",y2:"6",key:"18kwsl"}],["line",{x1:"3",x2:"21",y1:"10",y2:"10",key:"xt86sb"}]]);a.d(t,["A",0,s])},2796(e,t,a){const s=(0,a(9655).A)("Key",[["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["path",{d:"m15.5 7.5 3 3L22 7l-3-3",key:"1rn1fs"}]]);a.d(t,["A",0,s])}}]);
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.