1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[869],{8750:function(e,t,a){(window.__NEXT_P=window.__NEXT_P||[]).push(["/[realm]/tasks",function(){return a(1637)}])},2745:function(e,t,a){"use strict";var l=a(5893),s=a(7294),r=a(1163),o=a(5921),n=a(6108);t.Z=e=>t=>{let a=(0,r.useRouter)(),{user:i,loggedIn:d}=(0,o.tN)(e=>e),{currentRealm:c}=(0,n.kL)(e=>e);return(0,s.useEffect)(()=>{i&&c||a.push("/login")},[i,a]),i?(0,l.jsx)(e,{...t}):(0,l.jsx)("div",{children:"Loading..."})}},1041:function(e,t,a){"use strict";var l=a(5893),s=a(7294),r=a(1517),o=a(4080),n=a(5788),i=a(9583);t.Z=e=>{let{onChange:t,onBlur:a,value:d,onFocus:c,options:u,multiple:m}=e;return(0,l.jsx)(r.R,{value:d,onChange:e=>{e instanceof Array&&e.length>0&&t(e),"string"==typeof e&&t(e)},multiple:m,children:(0,l.jsxs)("div",{className:"relative flex flex-col gap-2 min-w-[9rem] max-w-[9rem]",children:[(0,l.jsxs)(r.R.Button,{onFocus:c,onBlur:a,className:"relative z-40 flex w-full min-w-[9rem] max-w-[9rem] items-center rounded-lg bg-bg-primary px-3 py-1.5 shadow-shadow-form-input outline-1 outline-offset-2 focus:!outline-blue-700",children:[(0,l.jsx)("span",{className:"max-w-[94%] overflow-hidden text-ellipsis text-sm whitespace-nowrap",children:"string"==typeof d&&("All"===d?e.label:d)||Array.isArray(d)&&d.map(e=>e).join(", ")}),(0,l.jsx)("span",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2",children:(0,l.jsx)(n.px3,{className:"h-5 w-5 text-gray-400","aria-hidden":"true"})})]}),(0,l.jsx)(o.u,{as:s.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,l.jsx)(r.R.Options,{className:"absolute z-30 top-[100%] min-w-[9rem] max-w-[9rem] mt-1 max-h-60 w-full overflow-auto rounded-md bg-bg-primary-light text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm",children:u.map((e,t)=>(0,l.jsx)(r.R.Option,{className:e=>{let{active:t}=e;return"relative cursor-default select-none py-2 pl-10 pr-4 ".concat(t?"bg-gray-600":"text-text-primary")},value:e.name,children:t=>{let{selected:a}=t;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"block truncate ".concat(a?"font-medium":"font-normal"),children:e.name}),a?(0,l.jsx)("span",{className:"absolute inset-y-0 left-0 flex items-center pl-3 text-amber-600",children:(0,l.jsx)(i.l_A,{className:"h-5 w-5 fill-green-600","aria-hidden":"true"})}):null]})}},t))})})]})})}},5037:function(e,t,a){"use strict";var l=a(5893),s=a(7294),r=a(1517),o=a(4080),n=a(5788),i=a(9583);t.Z=e=>{let{hasError:t,onChange:a,onBlur:d,lable:c,value:u,errorMessage:m,onFocus:p,labelColor:f,error:x,options:g,multiple:h}=e;return(0,l.jsx)(r.R,{value:u,onChange:e=>{e instanceof Array&&e.length>0&&a(e),"string"==typeof e&&a(e)},multiple:h,children:(0,l.jsxs)("div",{className:"relative flex flex-col gap-2 w-full",children:[(0,l.jsx)("label",{className:"text-grey-light",htmlFor:"form-".concat(c.toLowerCase().split(" ").join("-")),style:{color:f||"currentColor"},children:e.lable}),(0,l.jsxs)(r.R.Button,{onFocus:p,onBlur:d,className:"relative z-50 flex w-full items-center rounded-lg bg-bg-primary px-3 py-1.5 shadow-shadow-form-input outline-0 outline-offset-2 focus:!outline-blue-700 ".concat(t?"outline !outline-1 outline-red-500":x?"":"outline !outline-1 outline-green-600"),children:[(0,l.jsx)("span",{className:"max-w-[94%] overflow-hidden text-ellipsis whitespace-nowrap",children:"string"==typeof u&&u||Array.isArray(u)&&u.map(e=>e).join(", ")}),(0,l.jsx)("span",{className:"pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2",children:(0,l.jsx)(n.px3,{className:"h-5 w-5 text-gray-400","aria-hidden":"true"})})]}),(0,l.jsx)(o.u,{as:s.Fragment,leave:"transition ease-in duration-100",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,l.jsx)(r.R.Options,{className:"absolute top-[4.5rem] z-[200] mt-1 max-h-60 w-full overflow-auto rounded-md bg-bg-primary-light text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm",children:g.map((e,t)=>(0,l.jsx)(r.R.Option,{className:e=>{let{active:t}=e;return"relative cursor-default select-none py-2 pl-10 pr-4 ".concat(t?"bg-gray-600":"text-text-primary")},value:e.name,children:t=>{let{selected:a}=t;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"block truncate ".concat(a?"font-medium":"font-normal"),children:e.name}),a?(0,l.jsx)("span",{className:"absolute inset-y-0 left-0 flex items-center pl-3 text-amber-600",children:(0,l.jsx)(i.l_A,{className:"h-5 w-5 text-green-600","aria-hidden":"true"})}):null]})}},t))})})]})})}},1637:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return ei}});var l,s,r,o,n=a(5893),i=a(2745),d=a(5921),c=a(6108);(l=r||(r={})).todo="todo",l["in-progress"]="in-progress",l.completed="completed",(s=o||(o={})).low="low",s.medium="medium",s.high="high",s.urgent="urgent";var u=a(4529),m=a(2391),p=a(5678);let f=new m.KU,x=new m.Lg(f),g=new m.Ke(f);f.setEndpoint("https://cloud.appwrite.io/v1").setProject("647dc841ab72fff2362b");let h=(0,u.Ue)(e=>
1({todo:null,setTodo:t=>{e({todo:t})},"in-progress":null,setInProgress:t=>{e({"in-progress":t})},completed:null,setCompleted:t=>{e({completed:t})}})),v=async e=>{try{var t;let{description:a,priority:l,realm:s,status:r,title:o,userId:n,images:i,setIsLoading:d,onSuccess:c,taskStore:u,dueDate:p}=e;d(!0);let f=[];i&&await Promise.all(i.map(async e=>{let t=await g.createFile("6487faf04cf5d163778b",m.ID.unique(),e);f.push("https://cloud.appwrite.io/v1/storage/buckets/".concat("6487faf04cf5d163778b","/files/").concat(t.$id,"/view?project=647dc841ab72fff2362b"))}));let h=await x.createDocument("647e598757fffd819407","647f9afd2cc70d6685b4",m.ID.unique(),{userId:n,realm:s,title:o,status:r,priority:l,description:a,keywords:"".concat(o),images:f,index:((null===(t=u[r])||void 0===t?void 0:t.totalLength)||0)+1,dueDate:p||null});if(console.log(p),u[r]){let e="in-progress"===r&&u.setInProgress||"todo"===r&&u.setTodo;"completed"===r&&u.setCompleted;let t=Object.assign(u[r],{});t.tasks=[h,...t.tasks],e&&e(t)}d(!1),c()}catch(t){e.setIsLoading(!1),p.Am.error((null==t?void 0:t.message)||"Something Went Wrong!")}},w=async e=>{try{var t,a,l,s,r;let{description:o,priority:n,realm:i,status:d,title:c,userId:u,images:p,setIsLoading:f,onSuccess:h,taskStore:v,dueDate:w,task:b}=e;f(!0);let y=b.images;p&&await Promise.all(p.map(async e=>{let t=await g.createFile("6487faf04cf5d163778b",m.ID.unique(),e);y.push("https://cloud.appwrite.io/v1/storage/buckets/".concat("6487faf04cf5d163778b","/files/").concat(t.$id,"/view?project=647dc841ab72fff2362b"))}));let j=await x.updateDocument("647e598757fffd819407","647f9afd2cc70d6685b4",b.$id,{userId:u,realm:i,title:c,status:d,priority:n,description:o,keywords:"".concat(c),images:y,index:((null===(t=v[d])||void 0===t?void 0:t.totalLength)||0)+1,dueDate:w||null});if(b.status!==d){let e=Object.assign(v[b.status],{}),t=Object.assign(v[d],{}),r="in-progress"===b.status&&v.setInProgress||"todo"===b.status&&v.setTodo||"completed"===b.status&&v.setCompleted,o="in-progress"===d&&v.setInProgress||"todo"===d&&v.setTodo||"completed"===d&&v.setCompleted,n=null===(a=v[b.status])||void 0===a?void 0:null===(l=a.tasks)||void 0===l?void 0:l.findIndex(e=>e.$id===b.$id);e&&void 0!==n&&(null==e||null===(s=e.tasks)||void 0===s||s.splice(n,1)),r&&r(e),t.tasks=[j,...t.tasks||[]],o&&o(t),console.log(t,e,n)}if(b.status===d){let e=Object.assign(v[b.status],{}),t="in-progress"===b.status&&v.setInProgress||"todo"===b.status&&v.setTodo||"completed"===b.status&&v.setCompleted;e.tasks=(null===(r=e.tasks)||void 0===r?void 0:r.map(e=>e.$id===b.$id?j:e))||null,t&&t(e)}f(!1),h()}catch(t){e.setIsLoading(!1),p.Am.error((null==t?void 0:t.message)||"Something Went Wrong!")}},b=async e=>{try{var t,a,l,s,r;let{result:o,taskStore:n}=e;if(console.log(o),!(null===(t=o.destination)||void 0===t?void 0:t.droppableId))return;let i=Object.assign(n[o.source.droppableId],{});"in-progress"===o.source.droppableId&&n.setInProgress||"todo"===o.source.droppableId&&n.setTodo||"completed"===o.source.droppableId&&n.setCompleted;let d=Object.assign(n[o.destination.droppableId],{}),c="in-progress"===o.destination.droppableId&&n.setInProgress||"todo"===o.destination.droppableId&&n.setTodo||"completed"===o.destination.droppableId&&n.setCompleted;if(o.source.droppableId===o.destination.droppableId&&o.source.index===o.destination.index)return;if(o.source.droppableId===o.destination.droppableId&&n[o.source.droppableId]&&i&&d){let e=null===(a=i.tasks)||void 0===a?void 0:a.splice(o.source.index,1);e&&(null===(l=d.tasks)||void 0===l||l.splice(o.destination.index,0,e[0])),c&&c(d),await x.updateDocument("647e598757fffd819407","647f9afd2cc70d6685b4",o.draggableId,{index:o.destination.index})}if(o.source.droppableId!==o.destination.droppableId&&i&&d){let e=null===(s=i.tasks)||void 0===s?void 0:s.splice(o.source.index,1);i.totalLength=i.totalLength-1,d.totalLength=d.totalLength+1,e&&(null===(r=d.tasks)||void 0===r||r.splice(o.destination.index,0,e[0])),c&&c(d),await x.updateDocument("647e598757fffd819407","647f9afd2cc70d6685b4",o.draggableId,{status:o.destination.droppableId,index:o.destination.index})}}catch(e){p.Am.error((null==e?void 0:e.message)||"Something Went Wrong!")}},y=async e=>{try{let{realm:t,userId:a,taskStore:l,filters:s,status:r,setIsLoading:o}=e;o(!0);let n=[m.AE.equal("userId",a),m.AE.equal("realm",t),m.AE.equal("status",r),m.AE.limit(15),m.AE.orderAsc("index"),m.AE.orderDesc("$updatedAt")];(null==s?void 0:s.priority)&&n.push(m.AE.equal("priority",s.priority)),(null==s?void 0:s.keyword)&&n.push(m.AE.search("keywords",s.keyword));let i=await x.listDocuments("647e598757fffd819407","647f9afd2cc70d6685b4",n
1),d={tasks:i.documents,hasMore:i.total>i.documents.length,totalLength:i.documents.length,page:1},c="in-progress"===r&&l.setInProgress||"todo"===r&&l.setTodo||"completed"===r&&l.setCompleted;c&&c(d),o(!1)}catch(t){e.setIsLoading(!1),p.Am.error((null==t?void 0:t.message)||"Something Went Wrong!")}},j=async e=>{try{var t;let{realm:a,userId:l,taskStore:s,filters:r,status:o,setIsLoading:n,page:i}=e;n(!0);let d=[m.AE.equal("userId",l),m.AE.equal("realm",a),m.AE.equal("status",o),m.AE.limit(6),m.AE.orderAsc("index"),m.AE.orderDesc("$updatedAt"),m.AE.offset((i-1)*15)];(null==r?void 0:r.priority)&&d.push(m.AE.equal("priority",r.priority)),(null==r?void 0:r.keyword)&&d.push(m.AE.search("keywords",r.keyword));let c=await x.listDocuments("647e598757fffd819407","647f9afd2cc70d6685b4",d),u=[...(null===(t=s[o])||void 0===t?void 0:t.tasks)||[],...c.documents],p={tasks:u,hasMore:u>c.documents.length,totalLength:u.length,page:i},f="in-progress"===o&&s.setInProgress||"todo"===o&&s.setTodo||"completed"===o&&s.setCompleted;f&&f(p),console.log(p),n(!1)}catch(t){e.setIsLoading(!1),p.Am.error((null==t?void 0:t.message)||"Something Went Wrong!")}},N=async e=>{try{var t,a;let{taskStore:l,task:s}=e,r="in-progress"===s.status&&l.setInProgress||"todo"===s.status&&l.setTodo||"completed"===s.status&&l.setCompleted,o=Object.assign(l[s.status],{}),n=null===(t=o.tasks)||void 0===t?void 0:t.findIndex(e=>e.$id===s.$id);void 0!==n&&(null===(a=o.tasks)||void 0===a||a.splice(n,1)),r&&r(o),await x.deleteDocument("647e598757fffd819407","647f9afd2cc70d6685b4",s.$id)}catch(e){p.Am.error((null==e?void 0:e.message)||"Something Went Wrong!")}};var k=a(7294),I=a(3750),C=a(9583),S=a(7106),L=a(7484),T=a.n(L),A=a(5675),D=a.n(A),F=a(5948),E=a(1203),P=a(5434),Z=a(4080),M=a(7137),O=a(3643),$=a(6655),z=a(9989),W=a(6957),q=a(5037),R=a(8501);let U=Object.values(r).map(e=>({name:e.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join("-")})),B=Object.values(o).map(e=>({name:e.charAt(0).toUpperCase()+e.slice(1)}));var _=e=>{var t,a;let l=(0,k.useRef)(null),{task:s}=e,[r,o]=(0,k.useState)(!1),{user:i}=(0,d.tN)(e=>e),{currentRealm:u}=(0,c.kL)(e=>e),m=(0,R.X$)(e=>e),f=h(e=>e),{balance:x,id:g,debit:v,credit:b}=m,[y,j]=(0,k.useState)(null),[N,I]=(0,k.useState)(s.images),C=(0,O.Z)($.eu(0,20),(null===(t=U.find(e=>e.name.toLowerCase()===(null==s?void 0:s.status)))||void 0===t?void 0:t.name)||""),S=(0,O.Z)($.eu(0,20),(null===(a=B.find(e=>e.name.toLowerCase()===(null==s?void 0:s.priority)))||void 0===a?void 0:a.name)||""),L=(0,O.Z)($.eu(3,75),s.title),T=(0,O.Z)($.eu(5,400),s.description),[A,F]=(0,k.useState)(s.dueDate?new Date(s.dueDate).toISOString():null),E=()=>{C.resetInput(),L.resetInput(),S.resetInput(),T.resetInput(),e.setOpen(!1)},P=async e=>{if(e.preventDefault(),u&&i){if(C.error||T.error||S.error||L.error){C.onBlur(),S.onBlur(),L.onBlur(),T.onBlur();return}w({taskStore:f,task:s,description:T.value,priority:S.value.toLowerCase(),realm:u.name,status:C.value.toLowerCase(),title:L.value,userId:i.$id,onSuccess:E,images:y||void 0,setIsLoading:o})}};return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(Z.u,{appear:!0,show:e.open,as:k.Fragment,children:(0,n.jsxs)(M.V,{as:"div",className:"relative z-50 w-full",onClick:e=>e.stopPropagation(),onClose:function(){e.setOpen(!1)},children:[(0,n.jsx)(Z.u.Child,{as:k.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,n.jsx)("div",{className:"fixed z-50 inset-0 bg-black bg-opacity-25 backdrop-blur-[1.5px] "})}),(0,n.jsx)("div",{className:"fixed z-50 inset-0 w-[min(80vh,80vw)] max-[600px]:w-[92vw] max-[600px]:w-[92vw] max-h-[90vh] overflow-auto h-fit rounded-2xl bg-bg-primary top-1/2 py-4 left-1/2 -translate-x-1/2 shadow-lg -translate-y-1/2",children:(0,n.jsx)("div",{className:"flex min-h-full items-center justify-center p-4 text-center w-full",children:(0,n.jsx)(Z.u.Child,{as:k.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-85",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-85",children:(0,n.jsxs)(M.V.Panel,{className:"text-text-primary w-full transform overflow-hidden text-left align-middle transition-all",children:[(0,n.jsx)(M.V.Title,{as:"h3",className:"mx-auto mb-8 bg-gradient-to-b from-primary to-secondary bg-clip-text text-center text-2xl text-transparent font-medium",children:"Update Task"}),(0,n.jsxs)("form",{noValidate:!0,onSubmit:P,className:"grid gap-[min(3vh,3vw)] gap-y-[min(4vh,4vw)] max-[600px]:gap-y-[min(6vh,6vw)] grid-cols-2 flex-col max-[700px]:grid-cols-1 px-[min(3vh,3vw)]",children:[(0,n.jsx)(q.Z,{lable:"Status*",errorMessage:"Select type",multiple:!1,...C,options:U}),(0,n.jsx)(q.Z,{lable:"Priority*",errorMessage:"Select type",multiple:!1,...S,options:B}),(0,n.jsx)(z.Z,{...L,type:"text",lable:"Title*",errorMessage:"Length: min/max = 3/75"}),(0,n.jsx)(z.Z,{...T,type:"text",lable:"Description",errorMessage:"Length: min/max = 5/400"}),(0,n.jsxs)("div",{className:"z-0 flex flex-col gap-2 w-full",children:[(0,n.jsx)("div",{className:"flex items-center",children:(0,n.jsx)("label",{className:"text-grey-light",htmlFor:"datepicker",onClick:()=>{var e;null===(e=l.current)||void 0===e||e.click()},children:"Due Date"})}),(0,n.jsx)("input",{type:"date",id:"datepicker",onChange:e=>{F(e.target.value)},value:A||void 0,onClick:()=>{var e;null===(e=l.current)||void 0===e||e.click()}
1,placeholder:new Date().getDay().toLocaleString(),className:"input2 fill-red-300 w-full h-fit rounded-lg px-3 py-1.5 shadow-shadow-form-input !bg-transparent autofill:shadow-shadow-form-autofill autofill:!text-red-200 outline-0 outline-offset-2 focus:!outline-blue-700"})]}),(0,n.jsxs)("div",{className:"z-0 flex flex-col gap-2 w-full",children:[(0,n.jsx)("label",{className:"text-grey-light",htmlFor:"datepickerTasks",onClick:()=>{var e;null===(e=l.current)||void 0===e||e.click()},children:"Images"}),N?(0,n.jsx)("div",{className:"flex gap-2",children:N.map((e,t)=>(0,n.jsx)("label",{htmlFor:"datepickerTasks",className:"cursor-pointer",children:(0,n.jsx)(D(),{src:e,alt:"Selected Image",className:"w-11 h-11 rounded-full object-cover",width:32,height:32})},t))}):(0,n.jsx)("label",{className:"relative h-fit cursor-pointer z-50 flex w-full items-center bg-bg-primary input2 rounded-lg px-3 py-1.5 shadow-shadow-form-input !bg-transparent autofill:shadow-shadow-form-autofill autofill:!text-red-200 outline-0 outline-offset-2 focus:outline-blue-700",htmlFor:"datepickerTasks",onClick:()=>{var e;null===(e=l.current)||void 0===e||e.click()},children:"Image"}),(0,n.jsx)("input",{type:"file",id:"datepickerTasks",onClick:()=>{var e;null===(e=l.current)||void 0===e||e.click()},onChange:e=>{let t=e.target.files;if(t&&(null==t?void 0:t.length)>5){p.Am.warn("Maximum 5 images are allowed.");return}if(!t)return;let a=Array.from(t);if(j(a),t&&t.length>0){let e=a.map(e=>URL.createObjectURL(e));I(e)}},multiple:!0,placeholder:new Date().getDay().toLocaleString(),accept:"image/*",className:"w-0 h-0 opacity-0 pointer-events-none"})]}),(0,n.jsx)("div",{className:"w-full flex col-[1/-1] justify-end",children:(0,n.jsx)(W.Z,{isLoading:r,text:"Update",className:"w-fit mt-2"})})]})]})})})})]})})})},V=e=>{let{onConfirm:t,open:a,setOpen:l,text:s}=e;return(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(Z.u,{appear:!0,show:a,as:k.Fragment,children:(0,n.jsxs)(M.V,{as:"div",className:"relative z-50 w-full",onClose:()=>l(!1),onClick:e=>e.stopPropagation(),children:[(0,n.jsx)(Z.u.Child,{as:k.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,n.jsx)("div",{className:"fixed z-50 inset-0 bg-black bg-opacity-25 backdrop-blur-[1.5px] "})}),(0,n.jsx)("div",{className:"fixed z-50 inset-0 w-[min(40vh,40vw)] overflow-visible h-fit rounded-2xl bg-bg-primary top-1/2 py-6 left-1/2 -translate-x-1/2 shadow-lg -translate-y-1/2",children:(0,n.jsx)("div",{className:"flex min-h-full items-center justify-center text-center w-full",children:(0,n.jsx)(Z.u.Child,{as:k.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-85",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-85",children:(0,n.jsxs)(M.V.Panel,{className:"text-text-primary w-full max-h[80vh] transform overflow-hidden px-6 text-left align-middle transition-all",children:[(0,n.jsx)(M.V.Title,{as:"h3",className:"mx-auto mb-8 text-lg font-medium text-center",children:s}),(0,n.jsxs)("div",{className:"w-full justify-end flex gap-2",children:[(0,n.jsx)(W.Z,{text:"Cancle",onClick:()=>l(!1),className:"text-sm !ml-0 !px-3 !py-1"}),(0,n.jsx)(W.Z,{onClick:t,text:"Confirm",className:"text-sm !ml-0 !px-3 !py-1"})]})]})})})})]})})})};let Y=(0,k.forwardRef)((e,t)=>{let{task:a,index:l}=e,[s,r]=(0,k.useState)(!1),[o,i]=(0,k.useState)(!1),d=h(e=>e),c=a.description.length>=70?a.description.slice(0,70)+"...":a.description;return(0,n.jsxs)("div",{ref:t,onClick:()=>r(!0),children:[(0,n.jsx)(F._l,{draggableId:a.$id,index:l,children:(e,t)=>(0,n.jsxs)("div",{className:"w-full grow shadow-shadow-primary-xsm bg-bg-primary flex-wrap pb-0 pt-8 relative rounded-lg flex flex-col",...e.dragHandleProps,...e.draggableProps,ref:e.innerRef,children:[(0,n.jsxs)("div",{className:"px-3",children:[(0,n.jsx)(E.fC,{children:(0,n.jsx)(E.xz,{asChild:!0,onClick:e=>e.stopPropagation(),children:(0,n.jsx)("button",{className:"absolute right-2 top-2","aria-label":"Update dimensions",onClick:()=>i(!0),children:(0,n.jsx)(P.ZkW,{className:"w-5 h-5"})})})}),(0,n.jsx)("span",{className:"absolute left-0 text-[10px] top-0 px-3 rounded-tl-lg border py-0.5 border-dashed rounded-br-lg ".concat("urgent"===a.priority&&"border-[#FE2F48]"," ").concat("high"===a.priority&&"border-[#fa5252]"," ").concat("medium"===a.priority&&"border-[#fcc419]"," ").concat("low"===a.priority&&"border-[#868e96]"),children:a.priority.charAt(0).toUpperCase()+a.priority.slice(1)}),(0,n.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,n.jsx)("span",{className:"font-medium",children:a.title}),(0,n.jsx)("span",{className:"text-text-secondary text-sm",children:c}),a.images.length>0&&(0,n.jsx)("div",{className:"flex gap-1.5 mt-2",children:a.images.length>0&&a.images.map(e=>(0,n.jsx)(D(),{src:e,width:58,height:58,alt:"Task Image",className:"w-[4.5rem] rounded-lg h-[4.5rem] object-cover"},e))})]})]}),(0,n.jsxs)("div",{className:"py-2 px-3 mt-4 border-t text-text-secondary border-border-primary flex justify-between items-center",children:[(0,n.jsx)("span",{className:"text-xs",children:T()(a.$createdAt).format("D MMMM YYYY")}),a.dueDate&&(0,n.jsxs)("span",{className:"text-xs flex items-center gap-1.5",children:[(0,n.jsx)(I.NbQ,{})," ",T()(a.dueDate).format("D MMMM YYYY")]})]})]})}),(0,n.jsx)(_,{task:a,open:s,setOpen:r}),(0,n.jsx)(V,{open:o,text:"Are you sure you want to delete?",onConfirm:()=>{N({task:a,taskStore:d})},setOpen:i})]})});Y.displayName="TaskCard";var X=a(549);a(4989);var K=a(7650);let H=[{heading:"Todo",enum:r.todo,icon:(0,n.jsx)(S.tjc,{className:"w-[22px] h-[22px] fill-[#adb5bd]"})},{heading:"In-Progess",enum:r["in-progress"],icon:(0,n.jsx)(I.qL,{className:"w-[19px] h-[19px] fill-primary"})},{heading:"Completed",enum:r.completed,icon:(0,n.jsx)(C.FJM,{className:"w-[19px] h-[19px] fill-lime-500"})}];var J=e=>{let{filters:t,setNewTransactionModal:a,setDefaultStatus:l}=e,s=h(e=>e);return(0,n.jsx)("div",{className:"w-full h-full grow gap-[min(2vh,2vw)] overflow-hidden grid grid-cols-3 max-[900px]:grid-cols-2 max-[600px]:grid-cols-1 justify-between",children:(0,n.jsx)(F.Z5,{onDragEnd:e=>b({result:e,taskStore:s}),children:H.map(e=>(0,n.jsx)(Q,{setNewTransactionModal:a,setDefaultStatus:l,filters:t,...e},e.enum))})})};let Q=e=>{let t=h(e=>e),[a,l]=(0,K.YD)({triggerOnce:!0}),{user:s}=(0,d.tN)(e=>e),{currentRealm:r}=(0,c.kL)(e=>e),[o,i]=(0,k.useState)(!1),[u,m]=(0,k.useState)(!1);return(0,k.useEffect)(()=>{let a;return r&&s&&!o&&(a=setTimeout(()=>{y({setIsLoading:i,taskStore:t,userId:s.$id,realm:r.name,status:e.enum,filters:e.filters})},500)),()=>{clearTimeout(a)}},[s,r,e.filters]),(0,k.useEffect)(()=>{var a;let n;return r&&s&&!o&&(null===(a=t[e.enum])||void 0===a?void 0:a.hasMore)&&l&&(n=setTimeout(()=>{var a;j({setIsLoading:m,taskStore:t,userId:s.$id,realm:r.name,page:((null===(a=t[e.enum])||void 0===a?void 0:a.page)||0)+1,status:e.enum,filters:e.filters})},0)),()=>{clearTimeout(n)}},[s,r,l]),(0,n.jsx)(F.bK,{droppableId:e.enum,children:(l,s)=>{var r,i,d;return(0,n.jsxs)("div",{className:"w-full h-full relative min-h-[75vh] max-[600px]:max-h-[30vh] grow shadow-shadow-form-input rounded-2xl overflow-auto pb-3",ref:l.innerRef,...l.droppableProps,children:[(0,n.jsxs)("div",{className:"w-full z-10 border-b border-border-primary mb-6 sticky top-0 left-0 bg-bg-primary shadow-shadow-form-input px-8 py-3 flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex gap-3 items-center",children:[(0,n.jsx)("span",{className:"text-lg",children:e.heading}),e.icon]}),(0,n.jsx)("span",{className:"bg-bg-primary-light px-3 rounded-xl",children:t[e.enum]&&(null===(r=t[e.enum])||void 0===r?void 0:r.totalLength)})]}),(0,n.jsxs)("div",{className:"flex flex-col gap-4 px-6 grow",children:[t[e.enum]&&!o&&
1(null===(i=t[e.enum])||void 0===i?void 0:null===(d=i.tasks)||void 0===d?void 0:d.map((l,s)=>{var r,o;return(null===(r=t[e.enum])||void 0===r?void 0:null===(o=r.tasks)||void 0===o?void 0:o.length)===s+1?(0,n.jsx)(Y,{task:l,ref:a,index:s},l.$id):(0,n.jsx)(Y,{task:l,index:s},l.$id)})),!o&&(0,n.jsx)("div",{onClick:()=>{e.setDefaultStatus(e.enum),e.setNewTransactionModal(!0)},className:"w-full cursor-pointer rounded-2xl flex justify-center items-center",children:(0,n.jsxs)("span",{className:"text-lg flex gap-3 items-center border-dashed border w-full justify-center border-border-primary py-2 px-6 rounded-2xl",children:["Create Task"," ",(0,n.jsx)("span",{className:"",children:(0,n.jsx)(P.x06,{})})]})})," "]}),l.placeholder,o&&(0,n.jsx)(G,{}),u&&(0,n.jsx)(G,{})]})}})},G=()=>(0,n.jsxs)("div",{className:"w-full h-fit flex flex-col gap-4 px-6 mt-4",children:[(0,n.jsx)(X.Z,{className:"w-full h-32 shadow-shadow-primary-xsm",baseColor:"#212529",highlightColor:"#202020"}),(0,n.jsx)(X.Z,{className:"w-full h-24 shadow-shadow-primary-xsm",baseColor:"#212529",highlightColor:"#202020"}),(0,n.jsx)(X.Z,{className:"w-full h-48 shadow-shadow-primary-xsm",baseColor:"#212529",highlightColor:"#202020"})]}),ee=Object.values(r).map(e=>({name:e.charAt(0).toUpperCase()+e.slice(1)})),et=Object.values(o).map(e=>({name:e.charAt(0).toUpperCase()+e.slice(1)}));var ea=e=>{let t=(0,k.useRef)(null),[a,l]=(0,k.useState)(!1),{user:s}=(0,d.tN)(e=>e),{currentRealm:r}=(0,c.kL)(e=>e),o=(0,R.X$)(e=>e),i=h(e=>e),{balance:u,id:m,debit:f,credit:x}=o,[g,w]=(0,k.useState)(null),[b,y]=(0,k.useState)(null),j=(0,O.Z)($.eu(0,20),ee[0].name),N=(0,O.Z)($.eu(0,20),et[0].name),I=(0,O.Z)($.eu(3,75),""),C=(0,O.Z)($.eu(5,400),""),[S,L]=(0,k.useState)(null),T=()=>{j.resetInput(),I.resetInput(),N.resetInput(),C.resetInput(),e.setOpen(!1)},A=async e=>{if(e.preventDefault(),r&&s){if(j.error||C.error||N.error||I.error){j.onBlur(),N.onBlur(),I.onBlur(),C.onBlur();return}v({taskStore:i,description:C.value,priority:N.value.toLowerCase(),realm:r.name,status:j.value.toLowerCase(),title:I.value,userId:s.$id,onSuccess:T,images:g||void 0,setIsLoading:l,dueDate:S||void 0})}};return(0,k.useEffect)(()=>{var t;j.onChange((null===(t=ee.find(t=>t.name.toLowerCase()===e.status))||void 0===t?void 0:t.name)||ee[0].name)},[e.open]),(0,n.jsx)(n.Fragment,{children:(0,n.jsx)(Z.u,{appear:!0,show:e.open,as:k.Fragment,children:(0,n.jsxs)(M.V,{as:"div",className:"relative z-50 w-full",onClose:function(){e.setOpen(!1)},children:[(0,n.jsx)(Z.u.Child,{as:k.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0",enterTo:"opacity-100",leave:"ease-in duration-200",leaveFrom:"opacity-100",leaveTo:"opacity-0",children:(0,n.jsx)("div",{className:"fixed z-50 inset-0 bg-black bg-opacity-25 backdrop-blur-[1.5px] "})}),(0,n.jsx)("div",{className:"fixed z-50 inset-0 w-[min(80vh,80vw)] max-[600px]:w-[92vw] max-h-[90vh] overflow-auto h-fit rounded-2xl bg-bg-primary top-1/2 py-4 left-1/2 -translate-x-1/2 shadow-lg -translate-y-1/2",children:(0,n.jsx)("div",{className:"flex min-h-full items-center justify-center text-center w-full",children:(0,n.jsx)(Z.u.Child,{as:k.Fragment,enter:"ease-out duration-300",enterFrom:"opacity-0 scale-85",enterTo:"opacity-100 scale-100",leave:"ease-in duration-200",leaveFrom:"opacity-100 scale-100",leaveTo:"opacity-0 scale-85",children:(0,n.jsxs)(M.V.Panel,{className:"text-text-primary w-full transform overflow-hidden text-left align-middle transition-all",children:[(0,n.jsx)(M.V.Title,{as:"h3",className:"mx-auto mb-8 bg-gradient-to-b from-primary to-secondary bg-clip-text text-center text-2xl text-transparent font-medium",children:"New Task"}),(0,n.jsxs)("form",{noValidate:!0,onSubmit:A,className:"grid gap-[min(3vh,3vw)] gap-y-[min(4vh,4vw)] max-[600px]:gap-y-[min(6vh,6vw)] grid-cols-2 flex-col max-[700px]:grid-cols-1 px-[min(3vh,3vw)]",children:[(0,n.jsx)(q.Z,{lable:"Status*",errorMessage:"Select type",multiple:!1,...j,options:ee}),(0,n.jsx)(q.Z,{lable:"Priority*",errorMessage:"Select type",multiple:!1,...N,options:et}),(0,n.jsx)(z.Z,{...I,type:"text",lable:"Title*",errorMessage:"Length: min/max = 3/75"}),(0,n.jsx)(z.Z,{...C,type:"text",lable:"Description",errorMessage:"Length: min/max = 5/400"}),(0,n.jsxs)("div",{className:"z-0 flex flex-col gap-2 w-full",children:[(0,n.jsx)("div",{className:"flex items-center",children:(0,n.jsx)("label",{className:"text-grey-light",htmlFor:"datepicker",onClick:()=>{var e;null===(e=t.current)||void 0===e||e.click()},children:"Due Date"})}),(0,n.jsx)("input",{type:"date",id:"datepicker",onChange:e=>{L(e.target.value),console.log(e.target.value)},value:S||void 0,onClick:()=>{var e;null===(e=t.current)||void 0===e||e.click()}
1,placeholder:new Date().getDay().toLocaleString(),className:"input2 fill-red-300 w-full h-fit rounded-lg px-3 py-1.5 shadow-shadow-form-input !bg-transparent autofill:shadow-shadow-form-autofill autofill:!text-red-200 outline-0 outline-offset-2 focus:!outline-blue-700"})]}),(0,n.jsxs)("div",{className:"z-0 flex flex-col gap-2 w-full",children:[(0,n.jsx)("label",{className:"text-grey-light",htmlFor:"datepickerTasks",onClick:()=>{var e;null===(e=t.current)||void 0===e||e.click()},children:"Images"}),b?(0,n.jsx)("div",{className:"flex gap-2",children:b.map((e,t)=>(0,n.jsx)("label",{htmlFor:"datepickerTasks",className:"cursor-pointer",children:(0,n.jsx)(D(),{src:e,alt:"Selected Image",className:"w-11 h-11 rounded-full object-cover",width:32,height:32})},t))}):(0,n.jsx)("label",{className:"relative h-fit cursor-pointer z-50 flex w-full items-center bg-bg-primary input2 rounded-lg px-3 py-1.5 shadow-shadow-form-input !bg-transparent autofill:shadow-shadow-form-autofill autofill:!text-red-200 outline-0 outline-offset-2 focus:outline-blue-700",htmlFor:"datepickerTasks",onClick:()=>{var e;null===(e=t.current)||void 0===e||e.click()},children:"Image"}),(0,n.jsx)("input",{type:"file",id:"datepickerTasks",onClick:()=>{var e;null===(e=t.current)||void 0===e||e.click()},onChange:e=>{let t=e.target.files;if(t&&(null==t?void 0:t.length)>5){p.Am.warn("Maximum 5 images are allowed.");return}if(!t)return;let a=Array.from(t);if(w(a),t&&t.length>0){let e=a.map(e=>URL.createObjectURL(e));y(e)}},multiple:!0,placeholder:new Date().getDay().toLocaleString(),accept:"image/*",className:"w-0 h-0 opacity-0 pointer-events-none"})]}),(0,n.jsx)("div",{className:"w-full flex col-[1/-1] justify-end px-6 mb-3",children:(0,n.jsx)(W.Z,{isLoading:a,text:"Submit",className:"w-fit mt-2"})})]})]})})})})]})})})},el=a(155),es=a(1041);let er=[{name:"All"},{name:"Urgent"},{name:"High"},{name:"Medium"},{name:"Low"}];var eo=e=>{let{filters:t,setFilters:a}=e,{user:l}=(0,d.tN)(e=>e),{currentRealm:s}=(0,c.kL)(e=>e),[r,o]=(0,k.useState)(!1);h(e=>e);let[i,u]=(0,k.useState)(""),m=(0,O.Z)(()=>!0,er[0].name);return(0,k.useEffect)(()=>{let e;return s&&l&&r&&(e=setTimeout(()=>{a({priority:"All"===m.value?void 0:m.value,keyword:i})},500)),()=>{clearTimeout(e)}},[m.value,r,i]),(0,k.useEffect)(()=>{(!r&&"All"!==m.value||i.length>0)&&o(!0)},[m.value,i]),(0,n.jsxs)("div",{className:"w-full justify-end gap-4 top-0 left-0 z-30 inset-0 flex items-center flex-wrap",children:[(0,n.jsx)("h2",{className:"mb-2 px-2 text-xl font-medium mr-auto",children:"Tasks"}),(0,n.jsx)("div",{className:"flex flex-col gap-2",children:(0,n.jsxs)("div",{className:"relative",children:[(0,n.jsx)("input",{onChange:e=>u(e.target.value),className:"w-fit min-w-[18rem] pl-12 autofill:!text-red-200 outline-1 text-sm outline-offset-2 focus:!outline-blue-700 bg-bg-primary shadow-shadow-form-input rounded-lg py-1.5"}),(0,n.jsx)(el.eaK,{className:"absolute top-1/2 -translate-y-1/2 left-4 w-4 h-4"})]})}),(0,n.jsx)("div",{className:"",children:(0,n.jsx)(es.Z,{multiple:!1,label:"Select Priority",...m,options:er})})]})},en=a(1649),ei=(0,i.Z)(()=>{let[e,t]=(0,k.useState)(!1),[a,l]=(0,k.useState)("todo"),[s,r]=(0,k.useState)(null);return(0,n.jsxs)("div",{className:"p-[min(3vh,3vw)] py-[min(2vh,2vw)] h-full relative flex flex-col grow overflow-auto gap-[min(3vh,3vw)] max-[900px]:h-fit",children:[(0,n.jsx)("button",{onClick:()=>t(!0),className:"p-1 bg-gradient-to-b z-10 from-primary to-secondary justify-center flex items-center gap-2 fixed rounded-full right-[5rem] bottom-[5rem]",children:(0,n.jsx)(en.gyF,{className:"w-8 h-8"})}),(0,n.jsx)(ea,{setOpen:t,open:e,status:a})," ",(0,n.jsx)(eo,{filters:s||void 0,setFilters:r}),(0,n.jsx)(J,{setNewTransactionModal:t,filters:s||void 0,setDefaultStatus:l})]})})},8501:function(e,t,a){"use strict";a.d(t,{$N:function(){return d},X$:function(){return i},_X:function(){return u},f1:function(){return m}});var l=a(4529),s=a(2391),r=a(5678);let o=new s.KU,n=new s.Lg(o);o.setEndpoint("https://cloud.appwrite.io/v1").setProject("647dc841ab72fff2362b");let i=(0,l.Ue)(e=>({balance:null,credit:null,debit:null,realm:null,id:null,transactions:null,filters:null,transactionsIsLoading:!1,newPageIsLoading:!1,hasMore:!1,page:null,setTransactionsIsLoading:t=>{e({transactionsIsLoading:t})},setTransactions:(t,a,l)=>{e({transactions:t,page:a,hasMore:l})},setBalance:(t,a,l,s,r)=>{e({balance:t,realm:s,credit:a,debit:l,id:r})},isLoading:!1,setisLoading:t=>{e({isLoading:t})},setNewPageIsLoading:t=>{e({newPageIsLoading:t})}})),d=async e=>{try{e.walletStore.setisLoading(!0);let t=await n.listDocuments("647e598757fffd819407","648132bfda72920e3376",[s.AE.equal("userId",e.userId),s.AE.equal("realm",e.realm)]);0===t.total?c({userId:e.userId,realm:e.realm,walletStore:e.walletStore}):e.walletStore.setBalance(t.documents[0].balance,t.documents[0].credit,t.documents[0].debit,t.documents[0].realm,t.documents[0].$id),e.walletStore.setisLoading(!1)}catch(t){console.log(t),e.walletStore.setisLoading(!1),r.Am.error((null==t?void 0:t.message)||"Something Went Wrong!")}},c=async e=>{try{e.walletStore.setisLoading(!0);let t=await n.createDocument("647e598757fffd819407","648132bfda72920e3376",s.ID.unique(),{userId:e.userId,realm:e.realm,balance:0,credit:0,debit:0});
1e.walletStore.setBalance(t.balance,0,0,e.realm,t.$id),e.walletStore.setisLoading(!1)}catch(t){console.log(t),e.walletStore.setisLoading(!1),r.Am.error((null==t?void 0:t.message)||"Something Went Wrong!")}},u=async e=>{try{e.walletStore.setisLoading(!0);let{balance:t,credit:a,debit:l,id:r}=e.walletStore;if(null===t||null===a||null===l||null===r)return;let o="Credit"===e.transactionType?t+Number(e.amount):t-Number(e.amount),i="Credit"===e.transactionType?{from:e.from}:{to:e.to},d="Credit"===e.transactionType?l:l+e.amount,c="Credit"===e.transactionType?a+e.amount:a;console.log(e.method.toLowerCase(),e.amount);let u=await n.createDocument("647e598757fffd819407","6480970d31195ca8a028",s.ID.unique(),{date:e.date,amount:e.amount,userId:e.userId,realm:e.realm,type:e.transactionType.toLowerCase(),...i,description:e.description||"",balance:o,method:e.method.toLowerCase(),keywords:"".concat((null==e?void 0:e.from)?e.from:e.to||""," ").concat(e.description)});await n.updateDocument("647e598757fffd819407","648132bfda72920e3376",r,{credit:c,balance:o,debit:d}),e.walletStore.setBalance(o,c,d,e.realm,r);let m=[u,...e.walletStore.transactions||[]].sort((e,t)=>{let a=new Date(e.date),l=new Date(t.date);return a<l?1:a>l?-1:0});e.walletStore.setTransactions(m,e.walletStore.page,e.walletStore.hasMore),e.onSuccess(),e.walletStore.setisLoading(!1)}catch(t){console.log(t),e.walletStore.setisLoading(!1),r.Am.error((null==t?void 0:t.message)||"Something Went Wrong!")}},m=async e=>{try{let{realm:t,userId:a,walletStore:l,filters:r,page:o}=e;l.setTransactionsIsLoading(!0),o>1&&l.setNewPageIsLoading(!0);let i=[s.AE.limit(15),s.AE.offset((o-1)*15)];i.push(s.AE.equal("userId",a)),i.push(s.AE.equal("realm",t)),(null==r?void 0:r.transactionType)&&i.push(s.AE.equal("type",null==r?void 0:r.transactionType)),(null==r?void 0:r.transactionMedthod)&&i.push(s.AE.equal("method",r.transactionMedthod)),(null==r?void 0:r.toDate)&&i.push(s.AE.lessThan("date",null==r?void 0:r.toDate)),(null==r?void 0:r.search)&&i.push(s.AE.search("keywords",r.search));let d=await n.listDocuments("647e598757fffd819407","6480970d31195ca8a028",i),c=l.transactions||[],u=[...o>1?c:[],...d.documents];u.sort((e,t)=>{let a=new Date(e.date),l=new Date(t.date);return a<l?1:a>l?-1:0}),l.setTransactions(u,o,(null==u?void 0:u.length)<d.total),l.setTransactionsIsLoading(!1),o>1&&l.setNewPageIsLoading(!1)}catch(t){e.walletStore.setNewPageIsLoading(!1),e.walletStore.setTransactionsIsLoading(!1),r.Am.error((null==t?void 0:t.message)||"Something Went Wrong!")}}}},function(e){e.O(0,[13,260,907,228,630,307,675,389,774,888,179],function(){return e(e.s=8750)}),_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.