vendor: 4,262 bytes, line 1
1import{r as a,j as e,A as q,a as B,u as V,B as X,t as T}from"./index-BP0_N660.js";import{u as $}from"./useServerFn-Cr2xP_kQ.js";import{P as J}from"./PageShell-LCNzu4Qs.js";import{I as S}from"./input-CEym3y2N.js";import{L as y}from"./label-DlD2pKok.js";import{T as Q}from"./textarea-CKAB-hp2.js";import{S as W,a as Y,b as Z,c as ee,d as w}from"./select-Cjcb5w8s.js";import{d as te,P as _,a as se,c as L,r as re,e as ae,q as ne}from"./Header-CWPVOOUG.js";import{u as oe}from"./index-BI9NBkf4.js";import{c as ce}from"./learning.functions-CMnV8jcF.js";import"./Footer-WDYd_B9C.js";var N="Checkbox",[ie]=ae(N),[le,E]=ie(N);function de(s){const{__scopeCheckbox:i,checked:n,children:p,defaultChecked:o,disabled:r,form:h,name:m,onCheckedChange:l,required:b,value:f="on",internal_do_not_use_render:d}=s,[u,g]=se({prop:n,defaultProp:o??!1,onChange:l,caller:N}),[x,v]=a.useState(null),[k,c]=a.useState(null),t=a.useRef(!1),j=x?!!h||!!x.closest("form"):!0,I={checked:u,disabled:r,setChecked:g,control:x,setControl:v,name:m,form:h,value:f,hasConsumerStoppedPropagationRef:t,required:b,defaultChecked:C(o)?!1:o,isFormControl:j,bubbleInput:k,setBubbleInput:c};return e.jsx(le,{scope:i,...I,children:ue(d)?d(I):p})}var A="CheckboxTrigger",D=a.forwardRef(({__scopeCheckbox:s,onKeyDown:i,onClick:n,...p},o)=>{const{control:r,value:h,disabled:m,checked:l,required:b,setControl:f,setChecked:d,hasConsumerStoppedPropagationRef:u,isFormControl:g,bubbleInput:x}=E(A,s),v=q(o,f),k=a.useRef(l);return a.useEffect(()=>{const c=r?.form;if(c){const t=()=>d(k.current);return c.addEventListener("reset",t),()=>c.removeEventListener("reset",t)}},[r,d]),e.jsx(_.button,{type:"button",role:"checkbox","aria-checked":C(l)?"mixed":l,"aria-required":b,"data-state":H(l),"data-disabled":m?"":void 0,disabled:m,value:h,...p,ref:v,onKeyDown:L(i,c=>{c.key==="Enter"&&c.preventDefault()}),onClick:L(n,c=>{d(t=>C(t)?!0:!t),x&&g&&(u.current=c.isPropagationStopped(),u.current||c.stopPropagation())})})});D.displayName=A;var P=a.forwardRef((s,i)=>{const{__scopeCheckbox:n,name:p,checked:o,defaultChecked:r,required:h,disabled:m,value:l,onCheckedChange:b,form:f,...d}=s;return e.jsx(de,{__scopeCheckbox:n,checked:o,defaultChecked:r,disabled:m,required:h,onCheckedChange:b,name:p,form:f,value:l,internal_do_not_use_render:({isFormControl:u})=>e.jsxs(e.Fragment,{children:[e.jsx(D,{...d,ref:i,__scopeCheckbox:n}),u&&e.jsx(z,{__scopeCheckbox:n})]})})});P.displayName=N;var F="CheckboxIndicator",M=a.forwardRef((s,i)=>{const{__scopeCheckbox:n,forceMount:p,...o}=s,r=E(F,n);return e.jsx(te,{present:p||C(r.checked)||r.checked===!0,children:e.jsx(_.span,{"data-state":H(r.checked),"data-disabled":r.disabled?"":void 0,...o,ref:i,style:{pointerEvents:"none",...s.style}})})});M.displayName=F;var O="CheckboxBubbleInput",z=a.forwardRef(({__scopeCheckbox:s,...i},n)=>{const{control:p,hasConsumerStoppedPropagationRef:o,checked:r,defaultChecked:h,required:m,disabled:l,name:b,value:f,form:d,bubbleInput:u,setBubbleInput:g}=E(O,s),x=q(n,g),v=oe(r),k=re(p);a.useEffect(()=>{const t=u;if(!t)return;const j=window.HTMLInputElement.prototype,R=Object.getOwnPropertyDescriptor(j,"checked").set,K=!o.current;if(v!==r&&R){const U=new Event("click",{bubbles:K});t.indeterminate=C(r),R.call(t,C(r)?!1:r),t.dispatchEvent(U)}},[u,v,r,o]);const c=a.useRef(C(r)?!1:r);return e.jsx(_.input,{type:"checkbox","aria-hidden":!0,defaultChecked:h??c.current,required:m,disabled:l,name:b,value:f,form:d,...i,tabIndex:-1,ref:x,style:{...i.style,...k,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});z.displayName=O;function ue(s){return typeof s=="function"}function C(s){return s==="indeterminate"}function H(s){return C(s)?"indeterminate":s?"checked":"unchecked"}const G=a.forwardRef(({className:s,...i},n)=>e.jsx(P,{ref:n,className:B("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow cursor-pointer focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",s),...i,children:e.jsx(M,{className:B("grid place-content-center text-current"),children:e.jsx(ne,{className:"h-4 w-4"})})}));G.displayName=P.displayName;
1function ye(){const[s,i]=a.useState(""),[n,p]=a.useState(""),[o,r]=a.useState(""),[h,m]=a.useState(""),[l,b]=a.useState("general"),[f,d]=a.useState("beginner"),[u,g]=a.useState(!1),[x,v]=a.useState(!1),k=$(ce),c=V();return e.jsx(J,{children:e.jsxs("div",{className:"container mx-auto max-w-2xl px-4 py-12",children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Create course"}),e.jsxs("form",{className:"mt-8 space-y-5",onSubmit:async t=>{t.preventDefault(),v(!0);try{const j=await k({data:{title:s,slug:n,subtitle:o,description:h,category:l,level:f,is_interview_prep:u}});T.success("Course created"),c({to:"/instructor/$courseId",params:{courseId:j.id}})}catch(j){T.error(j.message)}finally{v(!1)}},children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(y,{children:"Title"}),e.jsx(S,{value:s,onChange:t=>i(t.target.value),required:!0,minLength:3})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(y,{children:"Slug (url)"}),e.jsx(S,{value:n,onChange:t=>p(t.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-")),required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(y,{children:"Subtitle"}),e.jsx(S,{value:o,onChange:t=>r(t.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(y,{children:"Description"}),e.jsx(Q,{rows:5,value:h,onChange:t=>m(t.target.value)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(y,{children:"Category"}),e.jsx(S,{value:l,onChange:t=>b(t.target.value)})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(y,{children:"Level"}),e.jsxs(W,{value:f,onValueChange:t=>d(t),children:[e.jsx(Y,{children:e.jsx(Z,{})}),e.jsxs(ee,{children:[e.jsx(w,{value:"beginner",children:"Beginner"}),e.jsx(w,{value:"intermediate",children:"Intermediate"}),e.jsx(w,{value:"advanced",children:"Advanced"})]})]})]})]}),e.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[e.jsx(G,{checked:u,onCheckedChange:t=>g(!!t)}),"Interview prep track"]}),e.jsx(X,{type:"submit",disabled:x,children:x?"Creating...":"Create course"})]})]})})}export{ye as component};
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.