"use strict";exports.id=5016,exports.ids=[5016],exports.modules={53926:(e,t,l)=>{l.d(t,{A:()=>i});var s=l(8732),a=l(82015),n=l.n(a);function i({confirmedDelegetedUser:e,linksArray:t,user:l}){let[a,i]=n().useState(t||null);return a&&a[1]?(0,s.jsx)("div",{className:"text-sm mt-2 flex-wrap",children:a.map((e,t,l)=>t===a.length-1?(0,s.jsx)("a",{href:e.path,className:"text-slate-400 dark:text-slate-500 pointer-events-none",children:e.title},t):(0,s.jsxs)(n().Fragment,{children:[(0,s.jsx)("a",{href:e.path,className:"query-url",children:e.title}),(0,s.jsx)("span",{className:"opacity-20",children:"|"})]},t))}):(0,s.jsx)(n().Fragment,{})}},55904:(e,t,l)=>{l.d(t,{A:()=>i});var s=l(8732),a=l(82015),n=l.n(a);function i({children:e,column:t,className:l}){let a=n().useRef();return(0,s.jsx)("div",{className:"items-stretch gap-0"+(t?" flex-col":" flex-wrap xl:flex-nowrap")+(l?" "+l:""),ref:a,children:e})}},55016:(e,t,l)=>{l.d(t,{A:()=>v});var s=l(8732),a=l(82015),n=l.n(a),i=l(83155),r=l(16757),c=l(40373),d=l(55904),o=l(96725);function u({targetElement:e,setOpenStyleModal:t}){return e?(0,s.jsxs)("div",{className:"flex flex-col items-stretch p-6 max-w-lg",children:[(0,s.jsxs)("div",{className:"w-full justify-between",children:[(0,s.jsx)("span",{className:"text-xl",children:"Element Style"}),(0,s.jsx)("button",{className:"w-10 h-10 plain-text",onClick:()=>{t(!1)},children:(0,s.jsx)(o.A,{})})]}),(0,s.jsxs)("div",{className:"items-stretch p-2 bg-slate-100 rounded add-css-block",children:[(0,s.jsx)("input",{type:"text",placeholder:"CSS key"}),(0,s.jsx)("input",{type:"text",placeholder:"CSS Value",onKeyDownCapture:t=>{let l=t.target;if(t.key?.match(/enter/i)){let t=l.closest(".add-css-block")?.children[0],s=l.closest(".add-css-block")?.children[1],a=t?.value,n=s?.value;if(!a?.match(/./)||!n?.match(/./))return;e.style[a]=n}}}),(0,s.jsx)("button",{onClick:t=>{let l=t.target,s=l.closest(".add-css-block")?.children[0],a=l.closest(".add-css-block")?.children[1],n=s?.value,i=a?.value;n?.match(/./)&&i?.match(/./)&&(e.style[n]=i)},children:"Add"})]}),(0,s.jsxs)("div",{className:"flex-wrap",children:[(0,s.jsx)("button",{onClick:t=>{e.removeAttribute("style")},className:"secondary grow",children:"Reset"}),(0,s.jsx)("button",{onClick:t=>{e.style.display="flex",e.style.alignItems="center",e.style.gap="10px"},className:"outlined black grow",children:"Flex"}),(0,s.jsx)("button",{onClick:t=>{e.style.backgroundColor="rgb(241 245 249)"},className:"outlined black grow",children:"BG-Slate-100"}),(0,s.jsx)("button",{onClick:t=>{e.style.backgroundColor="#F6F4F8"},className:"outlined black grow",children:"BG-Main-light"}),(0,s.jsx)("button",{onClick:t=>{e.style.padding="10px"},className:"outlined black grow",children:"Padding-10px"}),(0,s.jsx)("button",{onClick:t=>{e.style.padding="10px 20px"},className:"outlined black grow",children:"Padding-10px-20px"}),(0,s.jsx)("button",{onClick:t=>{e.style.borderRadius="5px"},className:"outlined black grow",children:"Border-Radius-5px"}),(0,s.jsx)("button",{onClick:t=>{e.style.border="1px solid rgb(241 245 249)"},className:"outlined black grow",children:"Border-Slate-100"}),(0,s.jsx)("button",{onClick:t=>{e.style.border="1px solid rgb(226 232 240)"},className:"outlined black grow",children:"Border-Slate-200"}),(0,s.jsx)("button",{onClick:t=>{e.style.border="1px solid rgb(203 213 225)"},className:"outlined black grow",children:"Border-Slate-300"})]}),(0,s.jsx)("span",{className:"font-semibold text-xl mt-4",children:"Add class Name"}),(0,s.jsxs)("div",{className:"items-stretch p-2 bg-slate-100 rounded add-class-name-block",children:[(0,s.jsx)("input",{type:"text",placeholder:"Class Name",onKeyDownCapture:t=>{let l=t.target,s=l.closest(".add-class-name-block")?.children[0];if(t.key?.match(/enter/i)){let t=s?.value;if(!t?.match(/./))return;e.classList.add(t)}}}),(0,s.jsx)("button",{onClick:t=>{let l=t.target,s=l.closest(".add-class-name-block")?.children[0],a=s?.value;a?.match(/./)&&e.classList.add(a)},children:"Add"}),(0,s.jsx)("button",{onClick:t=>{let l=t.target,s=l.closest(".add-class-name-block")?.children[0],a=s?.value;a?.match(/./)&&e.classList.remove(a)},className:"outlined",children:"Remove"})]}),e?.nodeName?.match(/^a$/i)?(0,s.jsxs)(n().Fragment,{children:[(0,s.jsx)("span",{className:"font-semibold text-xl mt-4",children:"Add URL"}),(0,s.jsxs)("div",{className:"items-stretch p-2 bg-slate-100 rounded href-block",children:[(0,s.jsx)("input",{type:"text",placeholder:"Class Name",onKeyDownCapture:t=>{let l=t.target,s=l.closest(".href-block")?.children[0];if(t.key?.match(/enter/i)){let t=s?.value;if(!t?.match(/./))return;e.href=t}},defaultValue:e?.href}),(0,s.jsx)("button",{onClick:t=>{let l=t.target,s=l.closest(".href-block")?.children[0],a=s?.value;a?.match(/./)&&(e.href=a)},children:"Add"})]})]}):(0,s.jsx)(n().Fragment,{})]}):null}function h({targetElement:e,back:t}){if(!e)return;let l=e.nextElementSibling,s=e.previousElementSibling;!t&&l?l.after(e):t&&s&&s.before(e)}function x({editor:e,node:t,setTargetElement:l}){e.getDoc().querySelectorAll(".target-node").forEach(e=>{e.classList.remove("target-node")});let s=e.getWin(),a=s.getSelection()?.anchorNode?.parentElement,n=t||a||null;n&&(n?.classList?.add("target-node"),l&&l(n))}var m=l(54677);let p=(0,l(82544).A)("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]);function g({editorRef:e}){let[t,l]=n().useState(null),[a,i]=n().useState(!1),[r,c]=n().useState(!1);return(0,s.jsxs)("div",{className:"absolute top-[60px] z-50 -left-[38px] w-[40px] flex flex-col items-end",style:{boxShadow:"0 0 40px rgba(15, 23, 42, 0.2)"},children:[(0,s.jsxs)(d.A,{column:!0,className:"gap-[1px]",children:[(0,s.jsx)("div",{onClick:()=>{x({editor:e.current,setTargetElement:l})},style:{width:"40px",height:"40px"},className:"button secondary",children:(0,s.jsx)("span",{children:"Click1"})}),(0,s.jsx)("div",{onClick:()=>{h({targetElement:t,back:!0})},style:{width:"40px",height:"40px"},className:"button dark",children:(0,s.jsx)(m.A,{})}),(0,s.jsx)("div",{onClick:()=>{h({targetElement:t})},style:{width:"40px",height:"40px"},className:"button dark",children:(0,s.jsx)(m.A,{})}),(0,s.jsx)("div",{onClick:()=>{c(!0)},style:{width:"40px",height:"40px"},className:"button",children:(0,s.jsx)(p,{})}),(0,s.jsx)("div",{onClick:()=>{i(!0)},style:{width:"40px",height:"40px"},className:"button",children:(0,s.jsx)(m.A,{})}),(0,s.jsx)("div",{onClick:()=>{!function({editor:e,targetElement:t,setTargetElement:l}){if(e.getWin(),!t)return;let s=t.cloneNode(!0);s.nodeName.match(/html|document|body/i)||(t.insertAdjacentElement("afterend",s),t.classList.remove("target-node"),l(s))}({editor:e.current,targetElement:t,setTargetElement:l})},style:{width:"40px",height:"40px"},className:"button",children:(0,s.jsx)(m.A,{})}),(0,s.jsx)("div",{onClick:()=>{!function({editor:e,targetElement:t,setTargetElement:l}){if(e.getWin(),!t||t.nodeName.match(/html|document|body/i))return;let s=t.parentElement;s||(l(t),x({editor:e,node:t,setTargetElement:l})),s?.nodeName.match(/html|document|body/i)?(l(t),x({editor:e,node:t,setTargetElement:l})):s&&(l(s),x({editor:e,node:s,setTargetElement:l}))}({editor:e.current,targetElement:t,setTargetElement:l})},style:{width:"40px",height:"40px"},className:"button",children:(0,s.jsx)(m.A,{})}),(0,s.jsx)("div",{onClick:()=>{!function({editor:e,targetElement:t,setTargetElement:l}){if(e.getWin(),!t)return;let s=t.children[0];s?(l(s),x({editor:e,node:s,setTargetElement:l})):(l(t),x({editor:e,node:t,setTargetElement:l}))}({editor:e.current,targetElement:t,setTargetElement:l})},style:{width:"40px",height:"40px"},className:"button",children:(0,s.jsx)(m.A,{className:"rotate-180"})}),(0,s.jsx)("div",{onClick:()=>{!function({editor:e,targetElement:t,setTargetElement:l}){if(!t)return;let s=t.previousElementSibling;s?(l(s),x({editor:e,node:s,setTargetElement:l})):(l(t),x({editor:e,node:t,setTargetElement:l}))}({editor:e.current,targetElement:t,setTargetElement:l})},style:{width:"40px",height:"40px"},className:"button",children:(0,s.jsx)(m.A,{})}),(0,s.jsx)("div",{onClick:()=>{!function({editor:e,targetElement:t,setTargetElement:l}){if(!t)return;let s=t.nextElementSibling;s?(l(s),x({editor:e,node:s,setTargetElement:l})):(l(t),x({editor:e,node:t,setTargetElement:l}))}({editor:e.current,targetElement:t,setTargetElement:l})},style:{width:"40px",height:"40px"},className:"button",children:(0,s.jsx)(m.A,{})}),(0,s.jsx)("div",{onClick:()=>{if(t){let s=t.parentNode;s.removeChild(t),x({editor:e.current,node:s,setTargetElement:l})}},style:{width:"40px",height:"40px"},className:"button bg-red-500",children:(0,s.jsx)(o.A,{})}),(0,s.jsx)("div",{onClick:()=>{e.current.getDoc().querySelectorAll(".target-node").forEach(e=>{e.classList.remove("target-node")}),l(null)},style:{width:"40px",height:"40px"},className:"button white",children:(0,s.jsx)(m.A,{})})]}),(0,s.jsx)("span",{children:(0,s.jsx)(u,{targetElement:t,setOpenStyleModal:i})})]})}function b({user:e,blockObject:t,placeholder:l,editorRef:a,height:i,extend:r}){let[d,o]=n().useState(!1);return(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(c.Editor,{tinymceScriptSrc:"https://datasquirel.com/tinymce-public/tinymce.min.js",onInit:(e,t)=>{if(r){let e=t.getBody();e.style.padding="40px",e.className="RTE-DOCS"}a&&(a.current=t)},initialValue:t&&t.content?t.content:"",init:{height:i||400,width:"100%",relative_urls:!1,remove_script_host:!1,menubar:!1,plugins:r?["advlist","autolink","lists","link","image","charmap","anchor","searchreplace","visualblocks","code","fullscreen","insertdatetime","media","table","preview","help","wordcount","codesample"]:["link"],toolbar:r?"undo redo | blocks | bold italic forecolor | codesample link image | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat":"undo redo | blocks | link",content_style:"body { font-family:Helvetica,Arial,sans-serif; font-size:18px }",placeholder:l||"Type something ...",content_css:r?"/styles/tiny.css":void 0,statusbar:!!r}}),r&&a&&(0,s.jsx)(g,{editorRef:a})]})}var y=l(46169),f=l(59023),j=l(80830),k=l(53926);function v({data:e,user:t}){let l=!!e?.title,[a,c]=n().useState(!1),[d,o]=n().useState(e?.level),[u,h]=n().useState(e?.page_order),[x,m]=n().useState(null),[p,g]=n().useState(null),v=n().useRef(),N=n().useRef();return(0,s.jsx)(n().Fragment,{children:(0,s.jsxs)("section",{className:"items-start justify-start p-6",children:[(0,s.jsxs)("div",{className:"mb-1",children:[(0,s.jsx)(f.A,{}),(0,s.jsx)("h2",{className:"text-xl m-0",children:l?"Update page":"Create a new Docs Page"})]}),(0,s.jsx)("div",{className:"mb-4",children:(0,s.jsx)(k.A,{user:t})}),(0,s.jsxs)("div",{className:"paper flex-col items-stretch gap-10 w-full relative",children:[a&&(0,s.jsx)(r.A,{}),(0,s.jsxs)("form",{onSubmit:t=>{t.preventDefault(),c(!0);let s=t.target.title,a=N.current?.getDoc(),n=v.current?.getDoc();function i(e){let t=e.href;t?.match(/\~/)&&(e.href=t.replace(/.*?\~\//,"/")),t?.match(/\.\.\//)&&(e.href=t.replace(/.*?\.\.\//,"/"))}a?.querySelectorAll(".target-node").forEach(e=>e.classList.remove("target-node")),a?.querySelectorAll("a").forEach(e=>{i(e)}),n?.querySelectorAll("a").forEach(e=>{i(e)});let r=v.current?.getContent(),o=N.current?.getBody().innerHTML,h=N.current?.getBody().innerText,x={title:s.value,description:r,content:o,text_content:h,level:d,page_order:u};l&&(x.id=e.id),p?.id&&(x.parent_id=p.id),(0,y.A)(`/api/admin/docs/${l?"update-page":"add-page"}`,{method:"post",body:x}).then(e=>{e.success?window.location.reload():(alert("Operation Failed!"),setTimeout(()=>{c(!1)},1e3))})},className:"flex flex-col gap-4 w-full",children:[(0,s.jsx)(i.A,{placeholder:"Enter a title",fontSize:"30px",name:"title",defaultValue:l?e.title:null}),(0,s.jsxs)("div",{className:"card no-hover",children:[(0,s.jsx)(i.A,{numberText:!0,placeholder:"Level",defaultValue:l?d:"1",maxWidth:"140px",minValue:1,maxValue:4,step:1,name:"page-level",title:"Page Level",setValue:o}),(0,s.jsx)(i.A,{numberText:!0,placeholder:"Level",defaultValue:l?u:"1",maxWidth:"140px",minValue:1,step:1,name:"page-order",title:"Page Order",setValue:h}),x&&Array.isArray(x)&&(0,s.jsx)(j.A,{selectOptions:x.map(e=>({title:e.title,payload:e.id,default:p?.id==e.id})),title:"Parent Page",required:!0,onChangeHandler:e=>{let t=x.filter(t=>t.id==e.target.value);t[0]?g(t[0]):window.alert("No Matching parent page!")}})]}),(0,s.jsx)(b,{placeholder:"Describe this page briefly",editorRef:v,blockObject:l?{content:e.description}:null,height:200}),(0,s.jsx)(b,{placeholder:"Page Content",editorRef:N,blockObject:l?{content:e.content}:null,height:600,extend:!0}),(0,s.jsx)("button",{type:"submit",children:l?"Update Page":"Add Page"})]})]})]})})}},96725:(e,t,l)=>{l.d(t,{A:()=>s});let s=(0,l(82544).A)("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]])}};