import{jsxs as e,jsx as t}from"react/jsx-runtime";import{I as m}from"./input-error-BbsDx4-P.js";import{L as q}from"./loading-button-B_LaGOAp.js";import{H,J as S,B as c,K as b,M as I,N as L,L as d,I as N,O as j,Q as y}from"./ui-components-B24mpb8o.js";import{o as B}from"./inertia-FIn3q7f1.js";import{usePage as E,useForm as F}from"@inertiajs/react";import{SquarePen as M}from"lucide-react";import{useState as O}from"react";import{Editor as w}from"richtor";/* empty css                */import"next-themes";import"sonner";import"@radix-ui/react-label";import"class-variance-authority";import"@radix-ui/react-checkbox";import"@radix-ui/react-avatar";import"@radix-ui/react-dropdown-menu";import"@radix-ui/react-scroll-area";import"@radix-ui/react-popover";import"@radix-ui/react-radio-group";import"@radix-ui/react-dialog";import"@radix-ui/react-slot";import"clsx";import"@radix-ui/react-separator";import"@radix-ui/react-tooltip";import"@radix-ui/react-tabs";import"@radix-ui/react-accordion";import"@radix-ui/react-progress";import"@radix-ui/react-select";import"cmdk";import"@radix-ui/react-switch";import"react-day-picker";import"@radix-ui/react-slider";import"embla-carousel-react";import"@radix-ui/react-toggle-group";import"vaul";import"tailwind-merge";const vt=({url:u,forum:r})=>{const[h,a]=O(!1),{props:g}=E(),{translate:f}=g,{button:n,input:i,frontend:C}=f,{data:p,setData:s,put:D,errors:l,processing:_,reset:v}=F({url:u,title:r.title,description:r.description}),x=o=>{o.preventDefault(),D(route("course-forums.update",r.id),{onSuccess:()=>{v(),a(!1)}})};return e(H,{open:h,onOpenChange:a,children:[t(S,{asChild:!0,children:e(c,{size:"sm",variant:"ghost",className:"w-full cursor-pointer justify-start px-2",children:[t(M,{className:"h-4 w-4"}),t("span",{children:n.edit})]})}),e(b,{children:[t(I,{children:t(L,{children:C.edit_forum_question})}),e("form",{onSubmit:x,className:"space-y-4 p-0.5",children:[e("div",{children:[t(d,{children:i.question_title}),t(N,{required:!0,type:"text",name:"title",value:p.title,placeholder:i.question_title_placeholder,onChange:o=>B(o,s)}),t(m,{message:l.title})]}),e("div",{children:[t(d,{children:i.description}),t(w,{ssr:!0,output:"html",placeholder:{paragraph:i.content_placeholder,imageCaption:i.image_caption_placeholder},contentMinHeight:260,contentMaxHeight:600,initialContent:p.description,onContentChange:o=>s("description",o)}),t(m,{message:l.description})]}),e(j,{children:[t(q,{loading:_,children:n.update}),t(y,{asChild:!0,children:t(c,{variant:"outline",children:n.cancel})})]})]})]})]})};export{vt as default};
