1import{r as n,R as Ne,j as e}from"./vendor-trpc-BNJGOXGz.js";import{D as Br}from"./DashboardLayout-BvLdCgUs.js";import{x as Ms,a as Vr,u as Qr,b as Wr,P as X,t as P,c as w,B as E}from"./index-2QFcfS8K.js";import{A as qr}from"./AIImageGenerator-BNpLgU7E.js";import{E as Ft}from"./ExportExcelButton-B5RpZKkc.js";import{C as $e,c as Be,a as Yr,b as Xr}from"./card-BDajpTwT.js";import{B as Le}from"./badge-DFJnj6FU.js";import{I as O}from"./input-BN2EXvzm.js";import{L as k}from"./label-N6NopUtw.js";import{T as Xe}from"./textarea-TaL4Y_S8.js";import{S as He,a as Ge,b as Ze,c as Ke,d as W}from"./select-Dt0L1Of7.js";import{D as os,a as ns,b as ls,c as ds,e as ft}from"./dialog-JbEtAZdc.js";import{T as Hr,a as Gr,b as _t,c as $t}from"./tabs-C2nqtPuP.js";import{f as Kr}from"./formatDuration-Bn-2J79Q.js";import{b1 as ut,P as Js,B as Zs,G as Bt,a0 as Vt,U as Os,D as Jr,g as nr,q as ee,C as Ct,ao as Zr,bk as Dt,E as ea,F as Rs,j as js,H as sa,J as lr,K as ta,l as Ls,aF as Ps,M as ra,n as aa,N as ca,ac as vt,at as Hs,au as Rt,a2 as jt,cl as oa,aj as dr,X as As,m as gs,V as bt,Y as Qt,p as na,$ as Wt,ar as Gs,cm as la,a6 as da,bv as ia,cn as ua,co as xa,_ as xt,cp as pa,cq as ga,ch as ha,a3 as ma}from"./vendor-ui-CO8Y4Ef_.js";import"./vendor-react-BN0qJr-I.js";import"./index-BldL7dXw.js";import"./Combination-DjkEoW3C.js";import"./index-IFwrAkbB.js";import"./useComposition-DsKjXeZD.js";import"./index-BdQq_4o_.js";import"./index-ChBGO05s.js";function fa(){for(var s=arguments.length,t=new Array(s),r=0;r<s;r++)t[r]=arguments[r];return n.useMemo(()=>a=>{t.forEach(c=>c(a))},t)}const at=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ns(s){const t=Object.prototype.toString.call(s);return t==="[object Window]"||t==="[object global]"}function Tt(s){return"nodeType"in s}function we(s){var t,r;return s?Ns(s)?s:Tt(s)&&(t=(r=s.ownerDocument)==null?void 0:r.defaultView)!=null?t:window:window}function kt(s){const{Document:t}=we(s);return s instanceof t}function Vs(s){return Ns(s)?!1:s instanceof we(s).HTMLElement}function ir(s){return s instanceof we(s).SVGElement}function ws(s){return s?Ns(s)?s.document:Tt(s)?kt(s)?s:Vs(s)||ir(s)?s.ownerDocument:document:document:document}const Je=at?n.useLayoutEffect:n.useEffect;function Mt(s){const t=n.useRef(s);return Je(()=>{t.current=s}),n.useCallback(function(){for(var r=arguments.length,a=new Array(r),c=0;c<r;c++)a[c]=arguments[c];return t.current==null?void 0:t.current(...a)},[])}function Ca(){const s=n.useRef(null),t=n.useCallback((a,c)=>{s.current=setInterval(a,c)},[]),r=n.useCallback(()=>{s.current!==null&&(clearInterval(s.current),s.current=null)},[]);return[t,r]}function Fs(s,t){t===void 0&&(t=[s]);const r=n.useRef(s);return Je(()=>{r.current!==s&&(r.current=s)},t),r}function Qs(s,t){const r=n.useRef();return n.useMemo(()=>{const a=s(r.current);return r.current=a,a},[...t])}function et(s){const t=Mt(s),r=n.useRef(null),a=n.useCallback(c=>{c!==r.current&&t?.(c,r.current),r.current=c},[]);return[r,a]}function Nt(s){const t=n.useRef();return n.useEffect(()=>{t.current=s},[s]),t.current}let pt={};function Ws(s,t){return n.useMemo(()=>{if(t)return t;const r=pt[s]==null?0:pt[s]+1;return pt[s]=r,s+"-"+r},[s,t])}function ur(s){return function(t){for(var r=arguments.length,a=new Array(r>1?r-1:0),c=1;c<r;c++)a[c-1]=arguments[c];return a.reduce((o,d)=>{const i=Object.entries(d);for(const[p,u]of i){const f=o[p];f!=null&&(o[p]=f+s*u)}return o},{...t})}}const bs=ur(1),_s=ur(-1);function va(s){return"clientX"in s&&"clientY"in s}function At(s){if(!s)return!1;const{KeyboardEvent:t}=we(s.target);return t&&s instanceof t}function Ra(s){if(!s)return!1;const{TouchEvent:t}=we(s.target);return t&&s instanceof t}function wt(s){if(Ra(s)){if(s.touches&&s.touches.length){const{clientX:t,clientY:r}=s.touches[0];return{x:t,y:r}}else if(s.changedTouches&&s.changedTouches.length){const{clientX:t,clientY:r}=s.changedTouches[0];return{x:t,y:r}}}return va(s)?{x:s.clientX,y:s.clientY}:null}const $s=Object.freeze({Translate:{toString(s){if(!s)return;const{x:t,y:r}=s;return"translate3d("+(t?Math.round(t):0)+"px, "+(r?Math.round(r):0)+"px, 0)"}},Scale:{toString(s){if(!s)return;const{scaleX:t,scaleY:r}=s;return"scaleX("+t+") scaleY("+r+")"}},Transform:{toString(s){if(s)return[$s.Translate.toString(s),$s.Scale.toString(s)].join(" ")}},Transition:{toString(s){let{property:t,duration:r,easing:a}=s;return t+" "+r+"ms "+a}}}),qt="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function ja(s){return s.matches(qt)?s:s.querySelector(qt)}const ba={display:"none"};function Na(s){let{id:t,value:r}=s;return Ne.createElement("div",{id:t,style:ba},r)}function wa(s){let{id:t,announcement:r,ariaLiveType:a="assertive"}=s;const c={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Ne.createElement("div",{id:t,style:c,role:"status","aria-live":a,"aria-atomic":!0},r)}function ya(){const[s,t]=n.useState("");return{announce:n.useCallback(a=>{a!=null&&t(a)},[]),announcement:s}}const xr=n.createContext(null);function Sa(s){const t=n.useContext(xr);n.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(s)},[s,t])}function Ea(){const[s]=n.useState(()=>new Set),t=n.useCallback(a=>(s.add(a),()=>s.delete(a)),[s]);return[n.useCallback(a=>{let{type:c,event:o}=a;
1s.forEach(d=>{var i;return(i=d[c])==null?void 0:i.call(d,o)})},[s]),t]}const Da={draggable:` 2 To pick up a draggable item, press the space bar. 3 While dragging, use the arrow keys to move the item. 4 Press space again to drop the item in its new position, or press escape to cancel. 5 `},Ta={onDragStart(s){let{active:t}=s;return"Picked up draggable item "+t.id+"."},onDragOver(s){let{active:t,over:r}=s;return r?"Draggable item "+t.id+" was moved over droppable area "+r.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(s){let{active:t,over:r}=s;return r?"Draggable item "+t.id+" was dropped over droppable area "+r.id:"Draggable item "+t.id+" was dropped."},onDragCancel(s){let{active:t}=s;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function ka(s){let{announcements:t=Ta,container:r,hiddenTextDescribedById:a,screenReaderInstructions:c=Da}=s;const{announce:o,announcement:d}=ya(),i=Ws("DndLiveRegion"),[p,u]=n.useState(!1);if(n.useEffect(()=>{u(!0)},[]),Sa(n.useMemo(()=>({onDragStart(v){let{active:g}=v;o(t.onDragStart({active:g}))},onDragMove(v){let{active:g,over:m}=v;t.onDragMove&&o(t.onDragMove({active:g,over:m}))},onDragOver(v){let{active:g,over:m}=v;o(t.onDragOver({active:g,over:m}))},onDragEnd(v){let{active:g,over:m}=v;o(t.onDragEnd({active:g,over:m}))},onDragCancel(v){let{active:g,over:m}=v;o(t.onDragCancel({active:g,over:m}))}}),[o,t])),!p)return null;const f=Ne.createElement(Ne.Fragment,null,Ne.createElement(Na,{id:a,value:c.draggable}),Ne.createElement(wa,{id:i,announcement:d}));return r?Ms.createPortal(f,r):f}var ce;(function(s){s.DragStart="dragStart",s.DragMove="dragMove",s.DragEnd="dragEnd",s.DragCancel="dragCancel",s.DragOver="dragOver",s.RegisterDroppable="registerDroppable",s.SetDroppableDisabled="setDroppableDisabled",s.UnregisterDroppable="unregisterDroppable"})(ce||(ce={}));function st(){}function Yt(s,t){return n.useMemo(()=>({sensor:s,options:t??{}}),[s,t])}function Ma(){for(var s=arguments.length,t=new Array(s),r=0;r<s;r++)t[r]=arguments[r];return n.useMemo(()=>[...t].filter(a=>a!=null),[...t])}const Ve=Object.freeze({x:0,y:0});function pr(s,t){return Math.sqrt(Math.pow(s.x-t.x,2)+Math.pow(s.y-t.y,2))}function gr(s,t){let{data:{value:r}}=s,{data:{value:a}}=t;return r-a}function Aa(s,t){let{data:{value:r}}=s,{data:{value:a}}=t;return a-r}function Xt(s){let{left:t,top:r,height:a,width:c}=s;return[{x:t,y:r},{x:t+c,y:r},{x:t,y:r+a},{x:t+c,y:r+a}]}function hr(s,t){if(!s||s.length===0)return null;const[r]=s;return r[t]}function Ht(s,t,r){return t===void 0&&(t=s.left),r===void 0&&(r=s.top),{x:t+s.width*.5,y:r+s.height*.5}}const Oa=s=>{let{collisionRect:t,droppableRects:r,droppableContainers:a}=s;const c=Ht(t,t.left,t.top),o=[];for(const d of a){const{id:i}=d,p=r.get(i);if(p){const u=pr(Ht(p),c);o.push({id:i,data:{droppableContainer:d,value:u}})}}return o.sort(gr)},La=s=>{let{collisionRect:t,droppableRects:r,droppableContainers:a}=s;const c=Xt(t),o=[];for(const d of a){const{id:i}=d,p=r.get(i);if(p){const u=Xt(p),f=c.reduce((g,m,j)=>g+pr(u[j],m),0),v=Number((f/4).toFixed(4));o.push({id:i,data:{droppableContainer:d,value:v}})}}return o.sort(gr)};function Ua(s,t){const r=Math.max(t.top,s.top),a=Math.max(t.left,s.left),c=Math.min(t.left+t.width,s.left+s.width),o=Math.min(t.top+t.height,s.top+s.height),d=c-a,i=o-r;if(a<c&&r<o){const p=t.width*t.height,u=s.width*s.height,f=d*i,v=f/(p+u-f);return Number(v.toFixed(4))}return 0}const Ia=s=>{let{collisionRect:t,droppableRects:r,droppableContainers:a}=s;const c=[];for(const o of a){const{id:d}=o,i=r.get(d);if(i){const p=Ua(i,t);p>0&&c.push({id:d,data:{droppableContainer:o,value:p}})}}return c.sort(Aa)};function za(s,t,r){return{...s,scaleX:t&&r?t.width/r.width:1,scaleY:t&&r?t.height/r.height:1}}function mr(s,t){return s&&t?{x:s.left-t.left,y:s.top-t.top}:Ve}function Pa(s){return function(r){for(var a=arguments.length,c=new Array(a>1?a-1:0),o=1;o<a;o++)c[o-1]=arguments[o];return c.reduce((d,i)=>({...d,top:d.top+s*i.y,bottom:d.bottom+s*i.y,left:d.left+s*i.x,right:d.right+s*i.x}),{...r})}}const Fa=Pa(1);function _a(s){if(s.startsWith("matrix3d(")){const t=s.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(s.startsWith("matrix(")){const t=s.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function $a(s,t,r){const a=_a(t);if(!a)return s;const{scaleX:c,scaleY:o,x:d,y:i}=a,p=s.left-d-(1-c)*parseFloat(r),u=s.top-i-(1-o)*parseFloat(r.slice(r.indexOf(" ")+1)),f=c?s.width/c:s.width,v=o?s.height/o:s.height;return{width:f,height:v,top:u,right:p+f,bottom:u+v,left:p}}const Ba={ignoreTransform:!1};function ys(s,t){t===void 0&&(t=Ba);let r=s.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:f}=we(s).getComputedStyle(s);u&&(r=$a(r,u,f))}const{top:a,left:c,width:o,height:d,bottom:i,right:p}=r;return{top:a,left:c,width:o,height:d,bottom:i,right:p}}function Gt(s){return ys(s,{ignoreTransform:!0})}function Va(s){const t=s.innerWidth,r=s.innerHeight;return{top:0,left:0,right:t,bottom:r,width:t,height:r}}function Qa(s,t){return t===void 0&&(t=we(s).getComputedStyle(s)),t.position==="fixed"}function Wa(s,t){t===void 0&&(t=we(s).getComputedStyle(s));const r=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(c=>{const o=t[c];
5return typeof o=="string"?r.test(o):!1})}function ct(s,t){const r=[];function a(c){if(t!=null&&r.length>=t||!c)return r;if(kt(c)&&c.scrollingElement!=null&&!r.includes(c.scrollingElement))return r.push(c.scrollingElement),r;if(!Vs(c)||ir(c)||r.includes(c))return r;const o=we(s).getComputedStyle(c);return c!==s&&Wa(c,o)&&r.push(c),Qa(c,o)?r:a(c.parentNode)}return s?a(s):r}function fr(s){const[t]=ct(s,1);return t??null}function gt(s){return!at||!s?null:Ns(s)?s:Tt(s)?kt(s)||s===ws(s).scrollingElement?window:Vs(s)?s:null:null}function Cr(s){return Ns(s)?s.scrollX:s.scrollLeft}function vr(s){return Ns(s)?s.scrollY:s.scrollTop}function yt(s){return{x:Cr(s),y:vr(s)}}var de;(function(s){s[s.Forward=1]="Forward",s[s.Backward=-1]="Backward"})(de||(de={}));function Rr(s){return!at||!s?!1:s===document.scrollingElement}function jr(s){const t={x:0,y:0},r=Rr(s)?{height:window.innerHeight,width:window.innerWidth}:{height:s.clientHeight,width:s.clientWidth},a={x:s.scrollWidth-r.width,y:s.scrollHeight-r.height},c=s.scrollTop<=t.y,o=s.scrollLeft<=t.x,d=s.scrollTop>=a.y,i=s.scrollLeft>=a.x;return{isTop:c,isLeft:o,isBottom:d,isRight:i,maxScroll:a,minScroll:t}}const qa={x:.2,y:.2};function Ya(s,t,r,a,c){let{top:o,left:d,right:i,bottom:p}=r;a===void 0&&(a=10),c===void 0&&(c=qa);const{isTop:u,isBottom:f,isLeft:v,isRight:g}=jr(s),m={x:0,y:0},j={x:0,y:0},h={height:t.height*c.y,width:t.width*c.x};return!u&&o<=t.top+h.height?(m.y=de.Backward,j.y=a*Math.abs((t.top+h.height-o)/h.height)):!f&&p>=t.bottom-h.height&&(m.y=de.Forward,j.y=a*Math.abs((t.bottom-h.height-p)/h.height)),!g&&i>=t.right-h.width?(m.x=de.Forward,j.x=a*Math.abs((t.right-h.width-i)/h.width)):!v&&d<=t.left+h.width&&(m.x=de.Backward,j.x=a*Math.abs((t.left+h.width-d)/h.width)),{direction:m,speed:j}}function Xa(s){if(s===document.scrollingElement){const{innerWidth:o,innerHeight:d}=window;return{top:0,left:0,right:o,bottom:d,width:o,height:d}}const{top:t,left:r,right:a,bottom:c}=s.getBoundingClientRect();return{top:t,left:r,right:a,bottom:c,width:s.clientWidth,height:s.clientHeight}}function br(s){return s.reduce((t,r)=>bs(t,yt(r)),Ve)}function Ha(s){return s.reduce((t,r)=>t+Cr(r),0)}function Ga(s){return s.reduce((t,r)=>t+vr(r),0)}function Ka(s,t){if(t===void 0&&(t=ys),!s)return;const{top:r,left:a,bottom:c,right:o}=t(s);fr(s)&&(c<=0||o<=0||r>=window.innerHeight||a>=window.innerWidth)&&s.scrollIntoView({block:"center",inline:"center"})}const Ja=[["x",["left","right"],Ha],["y",["top","bottom"],Ga]];class Ot{constructor(t,r){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const a=ct(r),c=br(a);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,d,i]of Ja)for(const p of d)Object.defineProperty(this,p,{get:()=>{const u=i(a),f=c[o]-u;return this.rect[p]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Us{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(r=>{var a;return(a=this.target)==null?void 0:a.removeEventListener(...r)})},this.target=t}add(t,r,a){var c;(c=this.target)==null||c.addEventListener(t,r,a),this.listeners.push([t,r,a])}}function Za(s){const{EventTarget:t}=we(s);return s instanceof t?s:ws(s)}function ht(s,t){const r=Math.abs(s.x),a=Math.abs(s.y);return typeof t=="number"?Math.sqrt(r**2+a**2)>t:"x"in t&&"y"in t?r>t.x&&a>t.y:"x"in t?r>t.x:"y"in t?a>t.y:!1}var Ue;(function(s){s.Click="click",s.DragStart="dragstart",s.Keydown="keydown",s.ContextMenu="contextmenu",s.Resize="resize",s.SelectionChange="selectionchange",s.VisibilityChange="visibilitychange"})(Ue||(Ue={}));function Kt(s){s.preventDefault()}function ec(s){s.stopPropagation()}var F;(function(s){s.Space="Space",s.Down="ArrowDown",s.Right="ArrowRight",s.Left="ArrowLeft",s.Up="ArrowUp",s.Esc="Escape",s.Enter="Enter",s.Tab="Tab"})(F||(F={}));const Nr={start:[F.Space,F.Enter],cancel:[F.Esc],end:[F.Space,F.Enter,F.Tab]},sc=(s,t)=>{let{currentCoordinates:r}=t;switch(s.code){case F.Right:return{...r,x:r.x+25};case F.Left:return{...r,x:r.x-25};case F.Down:return{...r,y:r.y+25};case F.Up:return{...r,y:r.y-25}}};class Lt{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:r}}=t;this.props=t,this.listeners=new Us(ws(r)),this.windowListeners=new Us(we(r)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Ue.Resize,this.handleCancel),this.windowListeners.add(Ue.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Ue.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:r}=this.props,a=t.node.current;a&&Ka(a),r(Ve)}handleKeyDown(t){if(At(t)){const{active:r,context:a,options:c}=this.props,{keyboardCodes:o=Nr,coordinateGetter:d=sc,scrollBehavior:i="smooth"}=c,{code:p}=t;if(o.end.includes(p)){this.handleEnd(t);return}if(o.cancel.includes(p)){this.handleCancel(t);return}const{collisionRect:u}=a.current,f=u?{x:u.left,y:u.top}:Ve;this.referenceCoordinates||(this.referenceCoordinates=f);const v=d(t,{active:r,context:a.current,currentCoordinates:f});if(v){const g=_s(v,f),m={x:0,y:0},{scrollableAncestors:j}=a.current;for(const h of j){const R=t.code,{isTop:b,isRight:N,isLeft:y,isBottom:A,maxScroll:L,minScroll:I}=jr(h),U=Xa(h),z={x:Math.min(R===F.Right?U.right-U.width/2:U.right,Math.max(R===F.Right?U.left:U.left+U.width/2,v.x)),y:Math.min(R===F.Down?U.bottom-U.height/2:U.bottom,Math.max(R===F.Down?U.top:U.top+U.height/2,v.y))},V=R===F.Right&&!N||R===F.Left&&!y,q=R===F.Down&&!A||R===F.Up&&!b;if(V&&z.x!==v.x){const $=h.scrollLeft+g.x,oe=R===F.Right&&$<=L.x||R===F.Left&&$>=I.x;if(oe&&!g.y){h.scrollTo({left:$,behavior:i});return}oe?m.x=h.scrollLeft-$:m.x=R===F.Right?h.scrollLeft-L.x:h.scrollLeft-I.x,m.x&&h.scrollBy({left:-m.x,behavior:i});break}else if(q&&z.y!==v.y){const $=h.scrollTop+g.y,oe=R===F.Down&&$<=L.y||R===F.Up&&$>=I.y;if(oe&&!g.x){h.scrollTo({top:$,behavior:i});return}oe?m.y=h.scrollTop-$:m.y=R===F.Down?h.scrollTop-L.y:h.scrollTop-I.y,m.y&&h.scrollBy({top:-m.y,behavior:i});break}}this.handleMove(t,bs(_s(v,this.referenceCoordinates),m))}}}handleMove(t,r){const{onMove:a}=this.props;t.preventDefault(),a(r)}handleEnd(t){const{onEnd:r}=this.props;t.preventDefault(),this.detach(),r()}handleCancel(t){const{onCancel:r}=this.props;t.preventDefault(),this.detach(),r()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Lt.activators=[{eventName:"onKeyDown",handler:(s,t,r)=>{let{keyboardCodes:a=Nr,onActivation:c}=t,{active:o}=r;const{code:d}=s.nativeEvent;if(a.start.includes(d)){const i=o.activatorNode.current;return i&&s.target!==i?!1:(s.preventDefault(),c?.({event:s.nativeEvent}),!0)}return!1}}];function Jt(s){return!!(s&&"distance"in s)}function Zt(s){return!!(s&&"delay"in s)}class Ut{constructor(t,r,a){var c;a===void 0&&(a=Za(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=r;const{event:o}=t,{target:d}=o;this.props=t,this.events=r,this.document=ws(d),this.documentListeners=new Us(this.document),this.listeners=new Us(a),this.windowListeners=new Us(we(d)),this.initialCoordinates=(c=wt(o))!=null?c:Ve,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:r,bypassActivationConstraint:a}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Ue.Resize,this.handleCancel),this.windowListeners.add(Ue.DragStart,Kt),this.windowListeners.add(Ue.VisibilityChange,this.handleCancel),this.windowListeners.add(Ue.ContextMenu,Kt),this.documentListeners.add(Ue.Keydown,this.handleKeydown),r){if(a!=null&&a({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Zt(r)){this.timeoutId=setTimeout(this.handleStart,r.delay),this.handlePending(r);return}if(Jt(r)){this.handlePending(r);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,r){const{active:a,onPending:c}=this.props;c(a,t,this.initialCoordinates,r)}handleStart(){const{initialCoordinates:t}=this,{onStart:r}=this.props;
5t&&(this.activated=!0,this.documentListeners.add(Ue.Click,ec,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Ue.SelectionChange,this.removeTextSelection),r(t))}handleMove(t){var r;const{activated:a,initialCoordinates:c,props:o}=this,{onMove:d,options:{activationConstraint:i}}=o;if(!c)return;const p=(r=wt(t))!=null?r:Ve,u=_s(c,p);if(!a&&i){if(Jt(i)){if(i.tolerance!=null&&ht(u,i.tolerance))return this.handleCancel();if(ht(u,i.distance))return this.handleStart()}if(Zt(i)&&ht(u,i.tolerance))return this.handleCancel();this.handlePending(i,u);return}t.cancelable&&t.preventDefault(),d(p)}handleEnd(){const{onAbort:t,onEnd:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleCancel(){const{onAbort:t,onCancel:r}=this.props;this.detach(),this.activated||t(this.props.active),r()}handleKeydown(t){t.code===F.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const tc={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class It extends Ut{constructor(t){const{event:r}=t,a=ws(r.target);super(t,tc,a)}}It.activators=[{eventName:"onPointerDown",handler:(s,t)=>{let{nativeEvent:r}=s,{onActivation:a}=t;return!r.isPrimary||r.button!==0?!1:(a?.({event:r}),!0)}}];const rc={move:{name:"mousemove"},end:{name:"mouseup"}};var St;(function(s){s[s.RightClick=2]="RightClick"})(St||(St={}));class ac extends Ut{constructor(t){super(t,rc,ws(t.event.target))}}ac.activators=[{eventName:"onMouseDown",handler:(s,t)=>{let{nativeEvent:r}=s,{onActivation:a}=t;return r.button===St.RightClick?!1:(a?.({event:r}),!0)}}];const mt={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class cc extends Ut{constructor(t){super(t,mt)}static setup(){return window.addEventListener(mt.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(mt.move.name,t)};function t(){}}}cc.activators=[{eventName:"onTouchStart",handler:(s,t)=>{let{nativeEvent:r}=s,{onActivation:a}=t;const{touches:c}=r;return c.length>1?!1:(a?.({event:r}),!0)}}];var Is;(function(s){s[s.Pointer=0]="Pointer",s[s.DraggableRect=1]="DraggableRect"})(Is||(Is={}));var tt;(function(s){s[s.TreeOrder=0]="TreeOrder",s[s.ReversedTreeOrder=1]="ReversedTreeOrder"})(tt||(tt={}));function oc(s){let{acceleration:t,activator:r=Is.Pointer,canScroll:a,draggingRect:c,enabled:o,interval:d=5,order:i=tt.TreeOrder,pointerCoordinates:p,scrollableAncestors:u,scrollableAncestorRects:f,delta:v,threshold:g}=s;const m=lc({delta:v,disabled:!o}),[j,h]=Ca(),R=n.useRef({x:0,y:0}),b=n.useRef({x:0,y:0}),N=n.useMemo(()=>{switch(r){case Is.Pointer:return p?{top:p.y,bottom:p.y,left:p.x,right:p.x}:null;case Is.DraggableRect:return c}},[r,c,p]),y=n.useRef(null),A=n.useCallback(()=>{const I=y.current;if(!I)return;const U=R.current.x*b.current.x,z=R.current.y*b.current.y;I.scrollBy(U,z)},[]),L=n.useMemo(()=>i===tt.TreeOrder?[...u].reverse():u,[i,u]);n.useEffect(()=>{if(!o||!u.length||!N){h();return}for(const I of L){if(a?.(I)===!1)continue;const U=u.indexOf(I),z=f[U];if(!z)continue;const{direction:V,speed:q}=Ya(I,z,N,t,g);for(const $ of["x","y"])m[$][V[$]]||(q[$]=0,V[$]=0);if(q.x>0||q.y>0){h(),y.current=I,j(A,d),R.current=q,b.current=V;return}}R.current={x:0,y:0},b.current={x:0,y:0},h()},[t,A,a,h,o,d,JSON.stringify(N),JSON.stringify(m),j,u,L,f,JSON.stringify(g)])}const nc={x:{[de.Backward]:!1,[de.Forward]:!1},y:{[de.Backward]:!1,[de.Forward]:!1}};function lc(s){let{delta:t,disabled:r}=s;const a=Nt(t);return Qs(c=>{if(r||!a||!c)return nc;const o={x:Math.sign(t.x-a.x),y:Math.sign(t.y-a.y)};return{x:{[de.Backward]:c.x[de.Backward]||o.x===-1,[de.Forward]:c.x[de.Forward]||o.x===1},y:{[de.Backward]:c.y[de.Backward]||o.y===-1,[de.Forward]:c.y[de.Forward]||o.y===1}}},[r,t,a])}function dc(s,t){const r=t!=null?s.get(t):void 0,a=r?r.node.current:null;return Qs(c=>{var o;return t==null?null:(o=a??c)!=null?o:null},[a,t])}function ic(s,t){return n.useMemo(()=>s.reduce((r,a)=>{const{sensor:c}=a,o=c.activators.map(d=>({eventName:d.eventName,handler:t(d.handler,a)}));return[...r,...o]},[]),[s,t])}var Bs;(function(s){s[s.Always=0]="Always",s[s.BeforeDragging=1]="BeforeDragging",s[s.WhileDragging=2]="WhileDragging"})(Bs||(Bs={}));var Et;(function(s){s.Optimized="optimized"})(Et||(Et={}));const er=new Map;function uc(s,t){let{dragging:r,dependencies:a,config:c}=t;const[o,d]=n.useState(null),{frequency:i,measure:p,strategy:u}=c,f=n.useRef(s),v=R(),g=Fs(v),m=n.useCallback(function(b){b===void 0&&(b=[]),!g.current&&d(N=>N===null?b:N.concat(b.filter(y=>!N.includes(y))))},[g]),j=n.useRef(null),h=Qs(b=>{if(v&&!r)return er;if(!b||b===er||f.current!==s||o!=null){const N=new Map;for(let y of s){if(!y)continue;if(o&&o.length>0&&!o.includes(y.id)&&y.rect.current){N.set(y.id,y.rect.current);continue}const A=y.node.current,L=A?new Ot(p(A),A):null;y.rect.current=L,L&&N.set(y.id,L)}return N}return b},[s,o,r,v,p]);return n.useEffect(()=>{f.current=s},[s]),n.useEffect(()=>{v||m()},[r,v]),n.useEffect(()=>{o&&o.length>0&&d(null)},[JSON.stringify(o)]),n.useEffect(()=>{v||typeof i!="number"||j.current!==null||(j.current=setTimeout(()=>{m(),j.current=null},i))},[i,v,m,...a]),{droppableRects:h,measureDroppableContainers:m,measuringScheduled:o!=null};function R(){switch(u){case Bs.Always:return!1;case Bs.BeforeDragging:return r;default:return!r}}}function wr(s,t){return Qs(r=>s?r||(typeof t=="function"?t(s):s):null,[t,s])}function xc(s,t){return wr(s,t)}function pc(s){let{callback:t,disabled:r}=s;const a=Mt(t),c=n.useMemo(()=>
5{if(r||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(a)},[a,r]);return n.useEffect(()=>()=>c?.disconnect(),[c]),c}function ot(s){let{callback:t,disabled:r}=s;const a=Mt(t),c=n.useMemo(()=>{if(r||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(a)},[r]);return n.useEffect(()=>()=>c?.disconnect(),[c]),c}function gc(s){return new Ot(ys(s),s)}function sr(s,t,r){t===void 0&&(t=gc);const[a,c]=n.useState(null);function o(){c(p=>{if(!s)return null;if(s.isConnected===!1){var u;return(u=p??r)!=null?u:null}const f=t(s);return JSON.stringify(p)===JSON.stringify(f)?p:f})}const d=pc({callback(p){if(s)for(const u of p){const{type:f,target:v}=u;if(f==="childList"&&v instanceof HTMLElement&&v.contains(s)){o();break}}}}),i=ot({callback:o});return Je(()=>{o(),s?(i?.observe(s),d?.observe(document.body,{childList:!0,subtree:!0})):(i?.disconnect(),d?.disconnect())},[s]),a}function hc(s){const t=wr(s);return mr(s,t)}const tr=[];function mc(s){const t=n.useRef(s),r=Qs(a=>s?a&&a!==tr&&s&&t.current&&s.parentNode===t.current.parentNode?a:ct(s):tr,[s]);return n.useEffect(()=>{t.current=s},[s]),r}function fc(s){const[t,r]=n.useState(null),a=n.useRef(s),c=n.useCallback(o=>{const d=gt(o.target);d&&r(i=>i?(i.set(d,yt(d)),new Map(i)):null)},[]);return n.useEffect(()=>{const o=a.current;if(s!==o){d(o);const i=s.map(p=>{const u=gt(p);return u?(u.addEventListener("scroll",c,{passive:!0}),[u,yt(u)]):null}).filter(p=>p!=null);r(i.length?new Map(i):null),a.current=s}return()=>{d(s),d(o)};function d(i){i.forEach(p=>{const u=gt(p);u?.removeEventListener("scroll",c)})}},[c,s]),n.useMemo(()=>s.length?t?Array.from(t.values()).reduce((o,d)=>bs(o,d),Ve):br(s):Ve,[s,t])}function rr(s,t){t===void 0&&(t=[]);const r=n.useRef(null);return n.useEffect(()=>{r.current=null},t),n.useEffect(()=>{const a=s!==Ve;a&&!r.current&&(r.current=s),!a&&r.current&&(r.current=null)},[s]),r.current?_s(s,r.current):Ve}function Cc(s){n.useEffect(()=>{if(!at)return;const t=s.map(r=>{let{sensor:a}=r;return a.setup==null?void 0:a.setup()});return()=>{for(const r of t)r?.()}},s.map(t=>{let{sensor:r}=t;return r}))}function vc(s,t){return n.useMemo(()=>s.reduce((r,a)=>{let{eventName:c,handler:o}=a;return r[c]=d=>{o(d,t)},r},{}),[s,t])}function yr(s){return n.useMemo(()=>s?Va(s):null,[s])}const ar=[];function Rc(s,t){t===void 0&&(t=ys);const[r]=s,a=yr(r?we(r):null),[c,o]=n.useState(ar);function d(){o(()=>s.length?s.map(p=>Rr(p)?a:new Ot(t(p),p)):ar)}const i=ot({callback:d});return Je(()=>{i?.disconnect(),d(),s.forEach(p=>i?.observe(p))},[s]),c}function jc(s){if(!s)return null;if(s.children.length>1)return s;const t=s.children[0];return Vs(t)?t:s}function bc(s){let{measure:t}=s;const[r,a]=n.useState(null),c=n.useCallback(u=>{for(const{target:f}of u)if(Vs(f)){a(v=>{const g=t(f);return v?{...v,width:g.width,height:g.height}:g});break}},[t]),o=ot({callback:c}),d=n.useCallback(u=>{const f=jc(u);o?.disconnect(),f&&o?.observe(f),a(f?t(f):null)},[t,o]),[i,p]=et(d);return n.useMemo(()=>({nodeRef:i,rect:r,setRef:p}),[r,i,p])}const Nc=[{sensor:It,options:{}},{sensor:Lt,options:{}}],wc={current:{}},Ks={draggable:{measure:Gt},droppable:{measure:Gt,strategy:Bs.WhileDragging,frequency:Et.Optimized},dragOverlay:{measure:ys}};class zs extends Map{get(t){var r;return t!=null&&(r=super.get(t))!=null?r:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:r}=t;return!r})}getNodeFor(t){var r,a;return(r=(a=this.get(t))==null?void 0:a.node.current)!=null?r:void 0}}const yc={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new zs,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:st},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Ks,measureDroppableContainers:st,windowRect:null,measuringScheduled:!1},Sc={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:st,draggableNodes:new Map,over:null,measureDroppableContainers:st},nt=n.createContext(Sc),Sr=n.createContext(yc);function Ec(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new zs}}}function Dc(s,t){switch(t.type){case ce.DragStart:return{...s,draggable:{...s.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ce.DragMove:return s.draggable.active==null?s:{...s,draggable:{...s.draggable,translate:{x:t.coordinates.x-s.draggable.initialCoordinates.x,y:t.coordinates.y-s.draggable.initialCoordinates.y}}};case ce.DragEnd:case ce.DragCancel:return{...s,draggable:{...s.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ce.RegisterDroppable:{const{element:r}=t,{id:a}
5=r,c=new zs(s.droppable.containers);return c.set(a,r),{...s,droppable:{...s.droppable,containers:c}}}case ce.SetDroppableDisabled:{const{id:r,key:a,disabled:c}=t,o=s.droppable.containers.get(r);if(!o||a!==o.key)return s;const d=new zs(s.droppable.containers);return d.set(r,{...o,disabled:c}),{...s,droppable:{...s.droppable,containers:d}}}case ce.UnregisterDroppable:{const{id:r,key:a}=t,c=s.droppable.containers.get(r);if(!c||a!==c.key)return s;const o=new zs(s.droppable.containers);return o.delete(r),{...s,droppable:{...s.droppable,containers:o}}}default:return s}}function Tc(s){let{disabled:t}=s;const{active:r,activatorEvent:a,draggableNodes:c}=n.useContext(nt),o=Nt(a),d=Nt(r?.id);return n.useEffect(()=>{if(!t&&!a&&o&&d!=null){if(!At(o)||document.activeElement===o.target)return;const i=c.get(d);if(!i)return;const{activatorNode:p,node:u}=i;if(!p.current&&!u.current)return;requestAnimationFrame(()=>{for(const f of[p.current,u.current]){if(!f)continue;const v=ja(f);if(v){v.focus();break}}})}},[a,t,c,d,o]),null}function kc(s,t){let{transform:r,...a}=t;return s!=null&&s.length?s.reduce((c,o)=>o({transform:c,...a}),r):r}function Mc(s){return n.useMemo(()=>({draggable:{...Ks.draggable,...s?.draggable},droppable:{...Ks.droppable,...s?.droppable},dragOverlay:{...Ks.dragOverlay,...s?.dragOverlay}}),[s?.draggable,s?.droppable,s?.dragOverlay])}function Ac(s){let{activeNode:t,measure:r,initialRect:a,config:c=!0}=s;const o=n.useRef(!1),{x:d,y:i}=typeof c=="boolean"?{x:c,y:c}:c;Je(()=>{if(!d&&!i||!t){o.current=!1;return}if(o.current||!a)return;const u=t?.node.current;if(!u||u.isConnected===!1)return;const f=r(u),v=mr(f,a);if(d||(v.x=0),i||(v.y=0),o.current=!0,Math.abs(v.x)>0||Math.abs(v.y)>0){const g=fr(u);g&&g.scrollBy({top:v.y,left:v.x})}},[t,d,i,a,r])}const Er=n.createContext({...Ve,scaleX:1,scaleY:1});var cs;(function(s){s[s.Uninitialized=0]="Uninitialized",s[s.Initializing=1]="Initializing",s[s.Initialized=2]="Initialized"})(cs||(cs={}));const Oc=n.memo(function(t){var r,a,c,o;let{id:d,accessibility:i,autoScroll:p=!0,children:u,sensors:f=Nc,collisionDetection:v=Ia,measuring:g,modifiers:m,...j}=t;const h=n.useReducer(Dc,void 0,Ec),[R,b]=h,[N,y]=Ea(),[A,L]=n.useState(cs.Uninitialized),I=A===cs.Initialized,{draggable:{active:U,nodes:z,translate:V},droppable:{containers:q}}=R,$=U!=null?z.get(U):null,oe=n.useRef({initial:null,translated:null}),J=n.useMemo(()=>{var Y;return U!=null?{id:U,data:(Y=$?.data)!=null?Y:wc,rect:oe}:null},[U,$]),ne=n.useRef(null),[se,he]=n.useState(null),[H,ye]=n.useState(null),ie=Fs(j,Object.values(j)),Se=Ws("DndDescribedBy",d),Ie=n.useMemo(()=>q.getEnabled(),[q]),te=Mc(g),{droppableRects:G,measureDroppableContainers:Re,measuringScheduled:me}=uc(Ie,{dragging:I,dependencies:[V.x,V.y],config:te.droppable}),re=dc(z,U),Ee=n.useMemo(()=>H?wt(H):null,[H]),K=it(),ue=xc(re,te.draggable.measure);Ac({activeNode:U!=null?z.get(U):null,config:K.layoutShiftCompensation,initialRect:ue,measure:te.draggable.measure});const _=sr(re,te.draggable.measure,ue),De=sr(re?re.parentElement:null),pe=n.useRef({activatorEvent:null,active:null,activeNode:re,collisionRect:null,collisions:null,droppableRects:G,draggableNodes:z,draggingNode:null,draggingNodeRect:null,droppableContainers:q,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Te=q.getNodeFor((r=pe.current.over)==null?void 0:r.id),fe=bc({measure:te.dragOverlay.measure}),je=(a=fe.nodeRef.current)!=null?a:re,Q=I?(c=fe.rect)!=null?c:_:null,le=!!(fe.nodeRef.current&&fe.rect),hs=hc(le?null:_),x=yr(je?we(je):null),M=mc(I?Te??re:null),ze=Rc(M),is=kc(m,{transform:{x:V.x-hs.x,y:V.y-hs.y,scaleX:1,scaleY:1},activatorEvent:H,active:J,activeNodeRect:_,containerNodeRect:De,draggingNodeRect:Q,over:pe.current.over,overlayNodeRect:fe.rect,scrollableAncestors:M,scrollableAncestorRects:ze,windowRect:x}),Ss=Ee?bs(Ee,V):null,Qe=fc(M),Me=rr(Qe),ms=rr(Qe,[_]),We=bs(is,Me),Pe=Q?Fa(Q,is):null,us=J&&Pe?v({active:J,collisionRect:Pe,droppableRects:G,droppableContainers:Ie,pointerCoordinates:Ss}):null,Es=hr(us,"id"),[qe,fs]=n.useState(null),es=le?is:bs(is,ms),qs=za(es,(o=qe?.rect)!=null?o:null,_),Ds=n.useRef(null),Cs=n.useCallback((Y,Ce)=>{let{sensor:xe,options:Ye}=Ce;if(ne.current==null)return;const ge=z.get(ne.current);if(!ge)return;const ve=Y.nativeEvent,Ae=new xe({active:ne.current,activeNode:ge,event:ve,options:Ye,context:pe,onAbort(ae){if(!z.get(ae))return;const{onDragAbort:be}=ie.current,ke={id:ae};be?.(ke),N({type:"onDragAbort",event:ke})},onPending(ae,Fe,be,ke){if(!z.get(ae))return;const{onDragPending:ts}=ie.current,_e={id:ae,constraint:Fe,initialCoordinates:be,offset:ke};ts?.(_e),N({type:"onDragPending",event:_e})},onStart(ae){const Fe=ne.current;if(Fe==null)return;const be=z.get(Fe);if(!be)return;const{onDragStart:ke}=ie.current,xs={activatorEvent:ve,active:{id:Fe,data:be.data,rect:oe}};Ms.unstable_batchedUpdates(()=>{ke?.(xs),L(cs.Initializing),b({type:ce.DragStart,initialCoordinates:ae,active:Fe}),N({type:"onDragStart",event:xs}),he(Ds.current),ye(ve)})},onMove(ae){b({type:ce.DragMove,coordinates:ae})},onEnd:ss(ce.DragEnd),onCancel:ss(ce.DragCancel)});Ds.current=Ae;function ss(ae){return async function(){const{active:be,collisions:ke,over:xs,scrollAdjustedTranslate:ts}=pe.current;let _e=null;if(be&&ts){const{cancelDrop:ps}=ie.current;_e={activatorEvent:ve,active:be,collisions:ke,delta:ts,over:xs},ae===ce.DragEnd&&typeof ps=="function"&&await Promise.resolve(ps(_e))&&(ae=ce.DragCancel)}ne.current=null,Ms.unstable_batchedUpdates(()=>{b({type:ae}),L(cs.Uninitialized),fs(null),he(null),ye(null),Ds.current=null;const ps=ae===ce.DragEnd?"onDragEnd":"onDragCancel";if(_e){const rs=ie.current[ps];rs?.(_e),N({type:ps,event:_e})}})}}},[z]),Ts=n.useCallback((Y,Ce)=>(xe,Ye)=>{const ge=xe.nativeEvent,ve=z.get(Ye);if(ne.current!==null||!ve||ge.dndKit||ge.defaultPrevented)return;const Ae={active:ve};Y(xe,Ce.options,Ae)===!0&&(ge.dndKit={capturedBy:Ce.sensor},ne.current=Ye,Cs(xe,Ce))},[z,Cs]),ks=ic(f,Ts);Cc(f),Je(()=>{_&&A===cs.Initializing&&L(cs.Initialized)},[_,A]),n.useEffect(()=>{const{onDragMove:Y}=ie.current,{active:Ce,activatorEvent:xe,collisions:Ye,over:ge}=pe.current;if(!Ce||!xe)return;const ve={active:Ce,activatorEvent:xe,collisions:Ye,delta:{x:We.x,y:We.y},over:ge};Ms.unstable_batchedUpdates(()=>{Y?.(ve),N({type:"onDragMove",event:ve})})},[We.x,We.y]),n.useEffect(()=>{const{active:Y,activatorEvent:Ce,collisions:xe,droppableContainers:Ye,scrollAdjustedTranslate:ge}=pe.current;if(!Y||ne.current==null||!Ce||!ge)return;const{onDragOver:ve}=ie.current,Ae=Ye.get(Es),ss=Ae&&Ae.rect.current?{id:Ae.id,rect:Ae.rect.current,data:Ae.data,disabled:Ae.disabled}:null,ae={active:Y,activatorEvent:Ce,collisions:xe,delta:{x:ge.x,y:ge.y},over:ss};Ms.unstable_batchedUpdates(()=>
5{fs(ss),ve?.(ae),N({type:"onDragOver",event:ae})})},[Es]),Je(()=>{pe.current={activatorEvent:H,active:J,activeNode:re,collisionRect:Pe,collisions:us,droppableRects:G,draggableNodes:z,draggingNode:je,draggingNodeRect:Q,droppableContainers:q,over:qe,scrollableAncestors:M,scrollAdjustedTranslate:We},oe.current={initial:Q,translated:Pe}},[J,re,us,Pe,z,je,Q,G,q,qe,M,We]),oc({...K,delta:V,draggingRect:Pe,pointerCoordinates:Ss,scrollableAncestors:M,scrollableAncestorRects:ze});const lt=n.useMemo(()=>({active:J,activeNode:re,activeNodeRect:_,activatorEvent:H,collisions:us,containerNodeRect:De,dragOverlay:fe,draggableNodes:z,droppableContainers:q,droppableRects:G,over:qe,measureDroppableContainers:Re,scrollableAncestors:M,scrollableAncestorRects:ze,measuringConfiguration:te,measuringScheduled:me,windowRect:x}),[J,re,_,H,us,De,fe,z,q,G,qe,Re,M,ze,te,me,x]),dt=n.useMemo(()=>({activatorEvent:H,activators:ks,active:J,activeNodeRect:_,ariaDescribedById:{draggable:Se},dispatch:b,draggableNodes:z,over:qe,measureDroppableContainers:Re}),[H,ks,J,_,b,Se,z,qe,Re]);return Ne.createElement(xr.Provider,{value:y},Ne.createElement(nt.Provider,{value:dt},Ne.createElement(Sr.Provider,{value:lt},Ne.createElement(Er.Provider,{value:qs},u)),Ne.createElement(Tc,{disabled:i?.restoreFocus===!1})),Ne.createElement(ka,{...i,hiddenTextDescribedById:Se}));function it(){const Y=se?.autoScrollEnabled===!1,Ce=typeof p=="object"?p.enabled===!1:p===!1,xe=I&&!Y&&!Ce;return typeof p=="object"?{...p,enabled:xe}:{enabled:xe}}}),Lc=n.createContext(null),cr="button",Uc="Draggable";function Ic(s){let{id:t,data:r,disabled:a=!1,attributes:c}=s;const o=Ws(Uc),{activators:d,activatorEvent:i,active:p,activeNodeRect:u,ariaDescribedById:f,draggableNodes:v,over:g}=n.useContext(nt),{role:m=cr,roleDescription:j="draggable",tabIndex:h=0}=c??{},R=p?.id===t,b=n.useContext(R?Er:Lc),[N,y]=et(),[A,L]=et(),I=vc(d,t),U=Fs(r);Je(()=>(v.set(t,{id:t,key:o,node:N,activatorNode:A,data:U}),()=>{const V=v.get(t);V&&V.key===o&&v.delete(t)}),[v,t]);const z=n.useMemo(()=>({role:m,tabIndex:h,"aria-disabled":a,"aria-pressed":R&&m===cr?!0:void 0,"aria-roledescription":j,"aria-describedby":f.draggable}),[a,m,h,R,j,f.draggable]);return{active:p,activatorEvent:i,activeNodeRect:u,attributes:z,isDragging:R,listeners:a?void 0:I,node:N,over:g,setNodeRef:y,setActivatorNodeRef:L,transform:b}}function zc(){return n.useContext(Sr)}const Pc="Droppable",Fc={timeout:25};function _c(s){let{data:t,disabled:r=!1,id:a,resizeObserverConfig:c}=s;const o=Ws(Pc),{active:d,dispatch:i,over:p,measureDroppableContainers:u}=n.useContext(nt),f=n.useRef({disabled:r}),v=n.useRef(!1),g=n.useRef(null),m=n.useRef(null),{disabled:j,updateMeasurementsFor:h,timeout:R}={...Fc,...c},b=Fs(h??a),N=n.useCallback(()=>{if(!v.current){v.current=!0;return}m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{u(Array.isArray(b.current)?b.current:[b.current]),m.current=null},R)},[R]),y=ot({callback:N,disabled:j||!d}),A=n.useCallback((z,V)=>{y&&(V&&(y.unobserve(V),v.current=!1),z&&y.observe(z))},[y]),[L,I]=et(A),U=Fs(t);return n.useEffect(()=>{!y||!L.current||(y.disconnect(),v.current=!1,y.observe(L.current))},[L,y]),n.useEffect(()=>(i({type:ce.RegisterDroppable,element:{id:a,key:o,disabled:r,node:L,rect:g,data:U}}),()=>i({type:ce.UnregisterDroppable,key:o,id:a})),[a]),n.useEffect(()=>{r!==f.current.disabled&&(i({type:ce.SetDroppableDisabled,id:a,key:o,disabled:r}),f.current.disabled=r)},[a,o,r,i]),{active:d,rect:g,isOver:p?.id===a,node:L,over:p,setNodeRef:I}}function zt(s,t,r){const a=s.slice();return a.splice(r<0?a.length+r:r,0,a.splice(t,1)[0]),a}function $c(s,t){return s.reduce((r,a,c)=>{const o=t.get(a);return o&&(r[c]=o),r},Array(s.length))}function Ys(s){return s!==null&&s>=0}function Bc(s,t){if(s===t)return!0;if(s.length!==t.length)return!1;for(let r=0;r<s.length;r++)if(s[r]!==t[r])return!1;return!0}function Vc(s){return typeof s=="boolean"?{draggable:s,droppable:s}:s}const Dr=s=>{let{rects:t,activeIndex:r,overIndex:a,index:c}=s;const o=zt(t,a,r),d=t[c],i=o[c];return!i||!d?null:{x:i.left-d.left,y:i.top-d.top,scaleX:i.width/d.width,scaleY:i.height/d.height}},Xs={scaleX:1,scaleY:1},Qc=s=>{var t;let{activeIndex:r,activeNodeRect:a,index:c,rects:o,overIndex:d}=s;const i=(t=o[r])!=null?t:a;if(!i)return null;if(c===r){const u=o[d];return u?{x:0,y:r<d?u.top+u.height-(i.top+i.height):u.top-i.top,...Xs}:null}const p=Wc(o,c,r);return c>r&&c<=d?{x:0,y:-i.height-p,...Xs}:c<r&&c>=d?{x:0,y:i.height+p,...Xs}:{x:0,y:0,...Xs}};function Wc(s,t,r){const a=s[t],c=s[t-1],o=s[t+1];return a?r<t?c?a.top-(c.top+c.height):o?o.top-(a.top+a.height):0:o?o.top-(a.top+a.height):c?a.top-(c.top+c.height):0:0}
5const Tr="Sortable",kr=Ne.createContext({activeIndex:-1,containerId:Tr,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Dr,disabled:{draggable:!1,droppable:!1}});function qc(s){let{children:t,id:r,items:a,strategy:c=Dr,disabled:o=!1}=s;const{active:d,dragOverlay:i,droppableRects:p,over:u,measureDroppableContainers:f}=zc(),v=Ws(Tr,r),g=i.rect!==null,m=n.useMemo(()=>a.map(I=>typeof I=="object"&&"id"in I?I.id:I),[a]),j=d!=null,h=d?m.indexOf(d.id):-1,R=u?m.indexOf(u.id):-1,b=n.useRef(m),N=!Bc(m,b.current),y=R!==-1&&h===-1||N,A=Vc(o);Je(()=>{N&&j&&f(m)},[N,m,j,f]),n.useEffect(()=>{b.current=m},[m]);const L=n.useMemo(()=>({activeIndex:h,containerId:v,disabled:A,disableTransforms:y,items:m,overIndex:R,useDragOverlay:g,sortedRects:$c(m,p),strategy:c}),[h,v,A.draggable,A.droppable,y,m,R,p,g,c]);return Ne.createElement(kr.Provider,{value:L},t)}const Yc=s=>{let{id:t,items:r,activeIndex:a,overIndex:c}=s;return zt(r,a,c).indexOf(t)},Xc=s=>{let{containerId:t,isSorting:r,wasDragging:a,index:c,items:o,newIndex:d,previousItems:i,previousContainerId:p,transition:u}=s;return!u||!a||i!==o&&c===d?!1:r?!0:d!==c&&t===p},Hc={duration:200,easing:"ease"},Mr="transform",Gc=$s.Transition.toString({property:Mr,duration:0,easing:"linear"}),Kc={roleDescription:"sortable"};function Jc(s){let{disabled:t,index:r,node:a,rect:c}=s;const[o,d]=n.useState(null),i=n.useRef(r);return Je(()=>{if(!t&&r!==i.current&&a.current){const p=c.current;if(p){const u=ys(a.current,{ignoreTransform:!0}),f={x:p.left-u.left,y:p.top-u.top,scaleX:p.width/u.width,scaleY:p.height/u.height};(f.x||f.y)&&d(f)}}r!==i.current&&(i.current=r)},[t,r,a,c]),n.useEffect(()=>{o&&d(null)},[o]),o}function Zc(s){let{animateLayoutChanges:t=Xc,attributes:r,disabled:a,data:c,getNewIndex:o=Yc,id:d,strategy:i,resizeObserverConfig:p,transition:u=Hc}=s;const{items:f,containerId:v,activeIndex:g,disabled:m,disableTransforms:j,sortedRects:h,overIndex:R,useDragOverlay:b,strategy:N}=n.useContext(kr),y=eo(a,m),A=f.indexOf(d),L=n.useMemo(()=>({sortable:{containerId:v,index:A,items:f},...c}),[v,c,A,f]),I=n.useMemo(()=>f.slice(f.indexOf(d)),[f,d]),{rect:U,node:z,isOver:V,setNodeRef:q}=_c({id:d,data:L,disabled:y.droppable,resizeObserverConfig:{updateMeasurementsFor:I,...p}}),{active:$,activatorEvent:oe,activeNodeRect:J,attributes:ne,setNodeRef:se,listeners:he,isDragging:H,over:ye,setActivatorNodeRef:ie,transform:Se}=Ic({id:d,data:L,attributes:{...Kc,...r},disabled:y.draggable}),Ie=fa(q,se),te=!!$,G=te&&!j&&Ys(g)&&Ys(R),Re=!b&&H,me=Re&&G?Se:null,Ee=G?me??(i??N)({rects:h,activeNodeRect:J,activeIndex:g,overIndex:R,index:A}):null,K=Ys(g)&&Ys(R)?o({id:d,items:f,activeIndex:g,overIndex:R}):A,ue=$?.id,_=n.useRef({activeId:ue,items:f,newIndex:K,containerId:v}),De=f!==_.current.items,pe=t({active:$,containerId:v,isDragging:H,isSorting:te,id:d,index:A,items:f,newIndex:_.current.newIndex,previousItems:_.current.items,previousContainerId:_.current.containerId,transition:u,wasDragging:_.current.activeId!=null}),Te=Jc({disabled:!pe,index:A,node:z,rect:U});return n.useEffect(()=>{te&&_.current.newIndex!==K&&(_.current.newIndex=K),v!==_.current.containerId&&(_.current.containerId=v),f!==_.current.items&&(_.current.items=f)},[te,K,v,f]),n.useEffect(()=>{if(ue===_.current.activeId)return;if(ue!=null&&_.current.activeId==null){_.current.activeId=ue;return}const je=setTimeout(()=>{_.current.activeId=ue},50);return()=>clearTimeout(je)},[ue]),{active:$,activeIndex:g,attributes:ne,data:L,rect:U,index:A,newIndex:K,items:f,isOver:V,isSorting:te,isDragging:H,listeners:he,node:z,overIndex:R,over:ye,setNodeRef:Ie,setActivatorNodeRef:ie,setDroppableNodeRef:q,setDraggableNodeRef:se,transform:Te??Ee,transition:fe()};function fe(){if(Te||De&&_.current.newIndex===A)return Gc;if(!(Re&&!At(oe)||!u)&&(te||pe))return $s.Transition.toString({...u,property:Mr})}}function eo(s,t){var r,a;return typeof s=="boolean"?{draggable:s,droppable:!1}:{draggable:(r=s?.draggable)!=null?r:t.draggable,droppable:(a=s?.droppable)!=null?a:t.droppable}}function rt(s){if(!s)return!1;const t=s.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const so=[F.Down,F.Right,F.Up,F.Left],to=(s,t)=>{let{context:{active:r,collisionRect:a,droppableRects:c,droppableContainers:o,over:d,scrollableAncestors:i}}=t;if(so.includes(s.code)){if(s.preventDefault(),!r||!a)return;const p=[];
5o.getEnabled().forEach(v=>{if(!v||v!=null&&v.disabled)return;const g=c.get(v.id);if(g)switch(s.code){case F.Down:a.top<g.top&&p.push(v);break;case F.Up:a.top>g.top&&p.push(v);break;case F.Left:a.left>g.left&&p.push(v);break;case F.Right:a.left<g.left&&p.push(v);break}});const u=La({collisionRect:a,droppableRects:c,droppableContainers:p});let f=hr(u,"id");if(f===d?.id&&u.length>1&&(f=u[1].id),f!=null){const v=o.get(r.id),g=o.get(f),m=g?c.get(g.id):null,j=g?.node.current;if(j&&m&&v&&g){const R=ct(j).some((I,U)=>i[U]!==I),b=Ar(v,g),N=ro(v,g),y=R||!b?{x:0,y:0}:{x:N?a.width-m.width:0,y:N?a.height-m.height:0},A={x:m.left,y:m.top};return y.x&&y.y?A:_s(A,y)}}}};function Ar(s,t){return!rt(s)||!rt(t)?!1:s.data.current.sortable.containerId===t.data.current.sortable.containerId}function ro(s,t){return!rt(s)||!rt(t)||!Ar(s,t)?!1:s.data.current.sortable.index<t.data.current.sortable.index}const ao={draft:"Ù
Ø³ÙØ¯Ø©",pending_review:"Ø¨Ø§ÙØªØ¸Ø§Ø± اÙÙ
راجعة",changes_requested:"Ù
Ø·ÙÙØ¨ تعدÙÙØ§Øª",approved:"Ù
عتÙ
دة",published:"Ù
ÙØ´Ùرة",unpublished:"ØºÙØ± Ù
ÙØ´Ùرة",rejected:"Ù
رÙÙØ¶Ø©"},co={draft:"bg-gray-100 text-gray-700",pending_review:"bg-yellow-100 text-yellow-700",changes_requested:"bg-orange-100 text-orange-700",approved:"bg-blue-100 text-blue-700",published:"bg-green-100 text-green-700",unpublished:"bg-gray-100 text-gray-600",rejected:"bg-red-100 text-red-700"};function Uo(){const{user:s}=Vr(),{hasPermission:t,hasAnyPermission:r}=Qr(),[,a]=Wr(),c=s?.roleId===1;n.useEffect(()=>{s&&!c&&t(X.INSTRUCTOR_DASHBOARD_VIEW)&&!r([X.RECORDED_COURSES_CREATE,X.RECORDED_COURSES_EDIT,X.RECORDED_COURSES_DELETE,X.RECORDED_COURSES_REVIEW,X.RECORDED_COURSES_PUBLISH,X.RECORDED_COURSES_ENROLLMENTS,X.RECORDED_COURSES_EARNINGS])&&a("/instructor-dashboard")},[s,c,t,r,a]);const o=c||t(X.RECORDED_COURSES_VIEW),d=c||t(X.RECORDED_COURSES_CREATE),i=c||t(X.RECORDED_COURSES_EDIT),p=c||t(X.RECORDED_COURSES_DELETE),u=c||t(X.RECORDED_COURSES_REVIEW),f=c||t(X.RECORDED_COURSES_PUBLISH),v=c||t(X.RECORDED_COURSES_ENROLLMENTS),g=c||t(X.RECORDED_COURSES_EARNINGS),m=c||t(X.RECORDED_COURSES_MANUAL_ENROLL),j=c||r([X.RECORDED_COURSES_VIEW,X.RECORDED_COURSES_CREATE,X.RECORDED_COURSES_EDIT,X.RECORDED_COURSES_DELETE,X.RECORDED_COURSES_REVIEW,X.RECORDED_COURSES_PUBLISH,X.RECORDED_COURSES_ENROLLMENTS,X.RECORDED_COURSES_EARNINGS]),[h,R]=n.useState(""),[b,N]=n.useState("all"),[y,A]=n.useState(!1),[L,I]=n.useState(null),[U,z]=n.useState(!1),[V,q]=n.useState(!1),[$,oe]=n.useState(null),[J,ne]=n.useState(!1),[se,he]=n.useState({courseId:0,email:"",fullName:"",phone:"",paidAmount:"",paymentMethod:"bank_transfer"}),[H,ye]=n.useState(!1),[ie,Se]=n.useState(null),[Ie,te]=n.useState(""),G=j?P.recordedCourses.list.useQuery({}):P.recordedCourses.myCourses.useQuery(),Re=P.instructors.list.useQuery(),me=o?P.recordedCourses.stats.useQuery():null,re=n.useMemo(()=>(G?.data||[]).filter(x=>x.status==="published"),[G?.data]),Ee=P.recordedCourses.enrollments.adminManualEnroll.useMutation({onSuccess:x=>{w.success("تÙ
تسجÙ٠اÙÙ
تدرب Ø¨ÙØ¬Ø§Ø",{description:x.userExists?"تÙ
ربط Ø§ÙØªØ³Ø¬ÙÙ Ø¨ØØ³Ø§Ø¨ اÙÙ
تدرب":"اÙÙ
تدرب ÙÙ
ÙØ³Ø¬Ù ØØ³Ø§Ø¨ بعد - Ø³ÙØªÙ
ربط Ø§ÙØªØ³Ø¬ÙÙ Ø¹ÙØ¯ Ø¥ÙØ´Ø§Ø¡ Ø§ÙØØ³Ø§Ø¨"}),ne(!1),he({courseId:0,email:"",fullName:"",phone:"",paidAmount:"",paymentMethod:"bank_transfer"}),G?.refetch()},onError:x=>{w.error("خطأ",{description:x.message})}}),K=P.recordedCourses.create.useMutation({onSuccess:()=>{w.success("تÙ
Ø¥ÙØ´Ø§Ø¡ Ø§ÙØ¯Ùرة Ø¨ÙØ¬Ø§Ø"),G.refetch(),A(!1)},onError:x=>w.error(x.message)}),ue=P.recordedCourses.update.useMutation({onSuccess:()=>{w.success("تÙ
ØªØØ¯ÙØ« Ø§ÙØ¯Ùرة Ø¨ÙØ¬Ø§Ø"),G.refetch(),z(!1)},onError:x=>w.error(x.message)}),_=P.recordedCourses.delete.useMutation({onSuccess:()=>{w.success("تÙ
ØØ°Ù Ø§ÙØ¯Ùرة"),G.refetch()},onError:x=>w.error(x.message)}),De=P.recordedCourses.submitForReview.useMutation({onSuccess:()=>{w.success("تÙ
Ø¥Ø±Ø³Ø§Ù Ø§ÙØ¯Ùرة ÙÙÙ
راجعة"),G.refetch()},onError:x=>w.error(x.message)}
5),pe=P.recordedCourses.reviewCourse.useMutation({onSuccess:()=>{w.success("تÙ
ØªØØ¯ÙØ« ØØ§ÙØ© اÙÙ
راجعة"),G.refetch()},onError:x=>w.error(x.message)}),Te=P.recordedCourses.togglePublish.useMutation({onSuccess:x=>{w.success(x.status==="published"?"تÙ
ÙØ´Ø± Ø§ÙØ¯Ùرة":"تÙ
Ø¥ÙØºØ§Ø¡ ÙØ´Ø± Ø§ÙØ¯Ùرة"),G.refetch()},onError:x=>w.error(x.message)}),fe=G.data||[],je=n.useMemo(()=>fe.filter(x=>{const M=!h||x.title?.toLowerCase().includes(h.toLowerCase()),ze=b==="all"||x.status===b;return M&&ze}),[fe,h,b]),[Q,le]=n.useState({title:"",instructorId:0,category:"",level:"all_levels",language:"Ø§ÙØ¹Ø±Ø¨ÙØ©",shortDescription:"",detailedDescription:"",price:"0",discountPrice:"",commissionRate:"30"}),hs=()=>{if(!Q.title||!Q.instructorId){w.error("ÙØ±Ø¬Ù Ù
ÙØ¡ Ø§ÙØÙÙ٠اÙÙ
Ø·ÙÙØ¨Ø©");return}K.mutate({...Q,discountPrice:Q.discountPrice||void 0})};return e.jsxs(Br,{"data-loc":"client/src/pages/RecordedCourses.tsx:227",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:228",className:"p-6 space-y-6",dir:"rtl",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:230",className:"flex items-center justify-between",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:231",children:[e.jsx("h1",{"data-loc":"client/src/pages/RecordedCourses.tsx:232",className:"text-2xl font-bold",children:"Ø§ÙØ¯Ùرات اÙÙ
Ø³Ø¬ÙØ©"}),e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:233",className:"text-muted-foreground text-sm mt-1",children:j?"إدارة جÙ
ÙØ¹ Ø§ÙØ¯Ùرات اÙÙ
Ø³Ø¬ÙØ© - اÙÙ
راجعة ÙØ§ÙÙØ´Ø±":"إدارة Ø¯ÙØ±Ø§ØªÙ اÙÙ
Ø³Ø¬ÙØ©"})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:237",className:"flex gap-2",children:[m&&e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:239",variant:"outline",onClick:()=>ne(!0),className:"gap-2",children:[e.jsx(ut,{"data-loc":"client/src/pages/RecordedCourses.tsx:240",className:"h-4 w-4"}),"Ø¥Ø¶Ø§ÙØ© Ù
تدرب ÙØ¯ÙÙØ§Ù"]}),d&&e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:245",onClick:()=>A(!0),children:[e.jsx(Js,{"data-loc":"client/src/pages/RecordedCourses.tsx:246",className:"h-4 w-4 ml-1"}),"Ø¯ÙØ±Ø© Ø¬Ø¯ÙØ¯Ø©"]})]})]}),o&&me?.data&&e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:255",className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[e.jsx($e,{"data-loc":"client/src/pages/RecordedCourses.tsx:256",children:e.jsxs(Be,{"data-loc":"client/src/pages/RecordedCourses.tsx:257",className:"p-4 text-center",children:[e.jsx(Zs,{"data-loc":"client/src/pages/RecordedCourses.tsx:258",className:"h-6 w-6 mx-auto mb-2 text-primary"}),e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:259",className:"text-2xl font-bold",children:me.data.totalCourses}),e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:260",className:"text-xs text-muted-foreground",children:"إجÙ
اÙÙ Ø§ÙØ¯Ùرات"})]})}),e.jsx($e,{"data-loc":"client/src/pages/RecordedCourses.tsx:263",children:e.jsxs(Be,{"data-loc":"client/src/pages/RecordedCourses.tsx:264",className:"p-4 text-center",children:[e.jsx(Bt,{"data-loc":"client/src/pages/RecordedCourses.tsx:265",className:"h-6 w-6 mx-auto mb-2 text-green-600"}),e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:266",className:"text-2xl font-bold",children:me.data.publishedCourses}),e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:267",className:"text-xs text-muted-foreground",children:"Ù
ÙØ´Ùرة"})]})}),e.jsx($e,{"data-loc":"client/src/pages/RecordedCourses.tsx:270",children:e.jsxs(Be,{"data-loc":"client/src/pages/RecordedCourses.tsx:271",className:"p-4 text-center",children:[e.jsx(Vt,{"data-loc":"client/src/pages/RecordedCourses.tsx:272",className:"h-6 w-6 mx-auto mb-2 text-yellow-600"}),e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:273",className:"text-2xl font-bold",children:me.data.pendingReview}),e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:274",className:"text-xs text-muted-foreground",children:"Ø¨Ø§ÙØªØ¸Ø§Ø± اÙÙ
راجعة"})]})}),e.jsx($e,{"data-loc":"client/src/pages/RecordedCourses.tsx:277",children:e.jsxs(Be,{"data-loc":"client/src/pages/RecordedCourses.tsx:278",className:"p-4 text-center",children:[e.jsx(Os,{"data-loc":"client/src/pages/RecordedCourses.tsx:279",className:"h-6 w-6 mx-auto mb-2 text-blue-600"}),e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:280",className:"text-2xl font-bold",children:me.data.totalEnrollments}),e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:281",className:"text-xs text-muted-foreground",children:"إجÙ
اÙ٠اÙÙ
سجÙÙÙ"})]})}),e.jsx($e,{"data-loc":"client/src/pages/RecordedCourses.tsx:284",children:e.jsxs(Be,{"data-loc":"client/src/pages/RecordedCourses.tsx:285",className:"p-4 text-center",children:[e.jsx(Jr,{"data-loc":"client/src/pages/RecordedCourses.tsx:286",className:"h-6 w-6 mx-auto mb-2 text-emerald-600"}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:287",className:"text-2xl font-bold",children:[me.data.totalRevenue.toFixed(0)," ر.س"]}),e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:288",className:"text-xs text-muted-foreground",children:"إجÙ
اÙÙ Ø§ÙØ¥Ùرادات"})]})})]}),c&&e.jsx(xo,{"data-loc":"client/src/pages/RecordedCourses.tsx:295"}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:298",className:"flex gap-3 items-center flex-wrap",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:299",className:"relative flex-1 max-w-sm",children:[e.jsx(nr,{"data-loc":"client/src/pages/RecordedCourses.tsx:300",className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:301",placeholder:"Ø¨ØØ« Ø¹Ù Ø¯ÙØ±Ø©...",value:h,onChange:x=>R(x.target.value),className:"pr-9"})]}),e.jsxs(He,{"data-loc":"client/src/pages/RecordedCourses.tsx:308",value:b,onValueChange:N,children:[e.jsx(Ge,{"data-loc":"client/src/pages/RecordedCourses.tsx:309",className:"w-[180px]",children:e.jsx(Ze,{"data-loc":"client/src/pages/RecordedCourses.tsx:310",placeholder:"Ø§ÙØØ§ÙØ©"})}),e.jsxs(Ke,{"data-loc":"client/src/pages/RecordedCourses.tsx:312",children:[e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:313",value:"all",children:"جÙ
ÙØ¹ Ø§ÙØØ§ÙØ§Øª"}),e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:314",value:"draft",children:"Ù
Ø³ÙØ¯Ø©"}),e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:315",value:"pending_review",children:"Ø¨Ø§ÙØªØ¸Ø§Ø± اÙÙ
راجعة"}),e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:316",value:"approved",children:"Ù
عتÙ
دة"}),e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:317",value:"published",children:"Ù
ÙØ´Ùرة"}),e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:318",value:"rejected",children:"Ù
رÙÙØ¶Ø©"})]})]}),v&&e.jsx(Ft,{"data-loc":"client/src/pages/RecordedCourses.tsx:322",url:"/api/export/all-recorded-enrollments",filename:`جÙ
ÙØ¹-اÙÙ
سجÙÙÙ-${new Date().toLocaleDateString("ar-SA")}.xlsx`,label:"ØªØµØ¯ÙØ± جÙ
ÙØ¹ اÙÙ
سجÙÙÙ",variant:"outline",size:"sm"})]}),G.isLoading?e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:334",className:"flex justify-center py-12",children:e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:335",className:"h-8 w-8 animate-spin text-muted-foreground"})}):je.length===0?e.jsx($e,{"data-loc":"client/src/pages/RecordedCourses.tsx:338",children:e.jsxs(Be,{"data-loc":"client/src/pages/RecordedCourses.tsx:339",className:"flex flex-col items-center justify-center py-16",children:[e.jsx(Ct,{"data-loc":"client/src/pages/RecordedCourses.tsx:340",className:"h-12 w-12 text-muted-foreground mb-4"}),e.jsx("h3",{"data-loc":"client/src/pages/RecordedCourses.tsx:341",className:"text-lg font-semibold",children:"ÙØ§ ØªÙØ¬Ø¯ Ø¯ÙØ±Ø§Øª Ù
Ø³Ø¬ÙØ©"}),e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:342",className:"text-muted-foreground text-sm mt-1",children:"ابدأ Ø¨Ø¥ÙØ´Ø§Ø¡ Ø¯ÙØ±ØªÙ Ø§ÙØ£ÙÙÙ"})]})}):e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:346",className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:je.map(x=>e.jsxs($e,{"data-loc":"client/src/pages/RecordedCourses.tsx:348",className:"overflow-hidden hover:shadow-md transition-shadow",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:350",className:"relative h-40 bg-gradient-to-br from-primary/10 to-primary/5",children:[x.thumbnailUrl?e.jsx("img",{"data-loc":"client/src/pages/RecordedCourses.tsx:352",src:x.thumbnailUrl,alt:x.title,className:"w-full h-full object-cover"}):e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:354",className:"flex items-center justify-center h-full",children:e.jsx(Ct,{"data-loc":"client/src/pages/RecordedCourses.tsx:355",className:"h-12 w-12 text-primary/30"})}),e.jsx(Le,{"data-loc":"client/src/pages/RecordedCourses.tsx:358",className:`absolute top-2 left-2 ${c
5o[x.status]||""}`,children:ao[x.status]||x.status}),!!x.isFeatured&&e.jsxs(Le,{"data-loc":"client/src/pages/RecordedCourses.tsx:362",className:"absolute top-2 right-2 bg-amber-100 text-amber-700",children:[e.jsx(Zr,{"data-loc":"client/src/pages/RecordedCourses.tsx:363",className:"h-3 w-3 ml-1"})," Ù
Ù
ÙØ²Ø©"]})]}),e.jsxs(Be,{"data-loc":"client/src/pages/RecordedCourses.tsx:368",className:"p-4 space-y-3",children:[e.jsx("h3",{"data-loc":"client/src/pages/RecordedCourses.tsx:369",className:"font-semibold text-lg line-clamp-2",children:x.title}),x.instructorId&&(()=>{const M=(Re.data||[]).find(ze=>ze.id===x.instructorId);return M?e.jsxs("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:373",className:"text-sm text-muted-foreground",children:["اÙÙ
درب: ",M.name]}):null})(),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:377",className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.jsxs("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:378",className:"flex items-center gap-1",children:[e.jsx(Dt,{"data-loc":"client/src/pages/RecordedCourses.tsx:379",className:"h-3.5 w-3.5"}),x.totalLessons||0," درس"]}),e.jsxs("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:382",className:"flex items-center gap-1",children:[e.jsx(Vt,{"data-loc":"client/src/pages/RecordedCourses.tsx:383",className:"h-3.5 w-3.5"}),Kr(x.totalDuration||0)||"0 دÙÙÙØ©"]}),e.jsxs("button",{"data-loc":"client/src/pages/RecordedCourses.tsx:386",className:"flex items-center gap-1 hover:text-primary hover:underline transition-colors cursor-pointer",onClick:()=>{Se(x.id),te(x.title),ye(!0)},title:"عرض اÙÙ
سجÙÙÙ",children:[e.jsx(Os,{"data-loc":"client/src/pages/RecordedCourses.tsx:395",className:"h-3.5 w-3.5"}),x.totalEnrollments||0]})]}),e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:401",className:"flex items-center gap-2",children:x.discountPrice?e.jsxs(e.Fragment,{children:[e.jsxs("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:404",className:"text-lg font-bold text-primary",children:[parseFloat(x.discountPrice).toFixed(0)," ر.س"]}),e.jsxs("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:405",className:"text-sm line-through text-muted-foreground",children:[parseFloat(x.price).toFixed(0)," ر.س"]})]}):parseFloat(x.price)===0?e.jsx("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:408",className:"text-lg font-bold text-green-600",children:"Ù
جاÙÙØ©"}):e.jsxs("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:410",className:"text-lg font-bold text-primary",children:[parseFloat(x.price).toFixed(0)," ر.س"]})}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:415",className:"flex gap-2 pt-2 border-t",children:[e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:416",size:"sm",variant:"outline",title:"Ù
عاÙÙØ© Ø§ÙØµÙØØ© ÙÙ
ا ÙØ±Ø§Ùا اÙÙ
تدرب",className:"text-emerald-600 hover:text-emerald-700 hover:bg-emerald-50",onClick:()=>window.open(x.slug?`/public/recorded-courses/${x.slug}`:"/public/recorded-courses","_blank"),children:e.jsx(ea,{"data-loc":"client/src/pages/RecordedCourses.tsx:423",className:"h-3.5 w-3.5"})}),e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:425",size:"sm",variant:"outline",onClick:()=>{oe(x.id),q(!0)},children:[e.jsx(Rs,{"data-loc":"client/src/pages/RecordedCourses.tsx:433",className:"h-3.5 w-3.5 ml-1"}),"اÙÙ
ØØªÙÙ"]}),e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:436",size:"sm",variant:"outline",onClick:()=>{I(x),z(!0)},children:[e.jsx(js,{"data-loc":"client/src/pages/RecordedCourses.tsx:444",className:"h-3.5 w-3.5 ml-1"}),"تعدÙÙ"]}),(x.status==="draft"||x.status==="changes_requested")&&e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:450",size:"sm",onClick:()=>De.mutate({id:x.id}),disabled:De.isPending,children:[e.jsx(sa,{"data-loc":"client/src/pages/RecordedCourses.tsx:455",className:"h-3.5 w-3.5 ml-1"}),"إرسا٠ÙÙÙ
راجعة"]}),u&&x.status==="pending_review"&&e.jsxs(e.Fragment,{children:[e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:463",size:"sm",variant:"default",className:"bg-green-600 hover:bg-green-700",onClick:()=>pe.mutate({id:x.id,action:"approve"}),children:[e.jsx(lr,{"data-loc":"client/src/pages/RecordedCourses.tsx:469",className:"h-3.5 w-3.5 ml-1"}),"اعتÙ
اد"]}),e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:472",size:"sm",variant:"destructive",onClick:()=>pe.mutate({id:x.id,action:"reject"}),children:[e.jsx(ta,{"data-loc":"client/src/pages/RecordedCourses.tsx:477",className:"h-3.5 w-3.5 ml-1"}),"Ø±ÙØ¶"]})]}),f&&(x.status==="approved"||x.status==="published"||x.status==="unpublished")&&e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:485",size:"sm",variant:x.status==="published"?"outline":"default",onClick:()=>Te.mutate({id:x.id}),children:[e.jsx(Bt,{"data-loc":"client/src/pages/RecordedCourses.tsx:490",className:"h-3.5 w-3.5 ml-1"}),x.status==="published"?"Ø¥ÙØºØ§Ø¡ اÙÙØ´Ø±":"ÙØ´Ø±"]}),v&&x.totalEnrollments>0&&e.jsx(Ft,{"data-loc":"client/src/pages/RecordedCourses.tsx:497",url:`/api/export/enrollments?courseId=${x.id}`,filename:`Ù
سجÙÙÙ-${x.title||x.id}.xlsx`,label:"ØªØµØ¯ÙØ± اÙÙ
سجÙÙÙ",variant:"outline",size:"sm"}),p&&e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:508",size:"sm",variant:"ghost",className:"text-destructive hover:text-destructive",onClick:()=>{confirm("ÙÙ Ø£ÙØª Ù
ØªØ£ÙØ¯ Ù
Ù ØØ°Ù ÙØ°Ù Ø§ÙØ¯ÙرةØ")&&_.mutate({id:x.id})},children:e.jsx(Ls,{"data-loc":"client/src/pages/RecordedCourses.tsx:518",className:"h-3.5 w-3.5"})})]}),x.reviewNotes&&(x.status==="changes_requested"||x.status==="rejected")&&e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:525",className:"bg-orange-50 border border-orange-200 rounded-lg p-3 text-sm",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:526",className:"flex items-center gap-1 text-orange-700 font-medium mb-1",children:[e.jsx(Ps,{"data-loc":"client/src/pages/RecordedCourses.tsx:527",className:"h-3.5 w-3.5"}),"Ù
ÙØ§ØØ¸Ø§Øª اÙÙ
راجعة:"]}),e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:530",className:"text-orange-600",children:x.reviewNotes})]})]})]},x.id))}),e.jsx(os,{"data-loc":"client/src/pages/RecordedCourses.tsx:540",open:y,onOpenChange:A,children:e.jsxs(ns,{"data-loc":"client/src/pages/RecordedCourses.tsx:541",className:"max-w-[95vw] w-[95vw] max-h-[95vh] h-[95vh] overflow-y-auto",dir:"rtl",children:[e.jsx(ls,{"data-loc":"client/src/pages/RecordedCourses.tsx:542",children:e.jsx(ds,{"data-loc":"client/src/pages/RecordedCourses.tsx:543",children:"Ø¥ÙØ´Ø§Ø¡ Ø¯ÙØ±Ø© Ù
Ø³Ø¬ÙØ© Ø¬Ø¯ÙØ¯Ø©"})}),e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:545",className:"space-y-4",children:e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:546",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:547",className:"col-span-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:548",children:"عÙÙØ§Ù Ø§ÙØ¯Ùرة *"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:549",value:Q.title,onChange:x=>le(M=>({...M,title:x.target.value})),placeholder:"Ù
ثاÙ: Ø£Ø³Ø§Ø³ÙØ§Øª Ø§ÙØ¨Ø±Ù
جة Ø¨ÙØºØ© Python"})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:555",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:556",children:"اÙÙ
درب *"}),e.jsxs(He,{"data-loc":"client/src/pages/RecordedCourses.tsx:557",value:Q.instructorId?String(Q.instructorId):"",onValueChange:x=>le(M=>({...M,instructorId:parseInt(x)})),children:[e.jsx(Ge,{"data-loc":"client/src/pages/RecordedCourses.tsx:561",children:e.jsx(Ze,{"data-loc":"client/src/pages/RecordedCourses.tsx:562",placeholder:"اختر اÙÙ
درب"})}),e.jsx(Ke,{"data-loc":"client/src/pages/RecordedCourses.tsx:564",children:(Re.data||[]).map(x=>e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:566",value:String(x.id),children:x.name},x.id))})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:571",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:572",children:"اÙÙ
ستÙÙ"}),e.jsxs(He,{"data-loc":"client/src/pages/RecordedCourses.tsx:573",value:Q.level,onValueChange:x=>le(M=>({...M,level:x})),children:[e.jsx(Ge,{"data-loc":"client/src/pages/RecordedCourses.tsx:577",children:e.jsx(Ze,{"data-loc":"client/src/pages/RecordedCourses.tsx:578"})}),e.jsxs(Ke,{"data-loc":"client/src/pages/RecordedCourses.tsx:580",children:[e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:581",value:"beginner",children:"Ù
بتدئ"}),e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:582",value:"intermediate",children:"Ù
ØªÙØ³Ø·"}),e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:583",value:"advanced",children:"Ù
ØªÙØ¯Ù
"}),e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:584",value:"all_levels",children:"جÙ
ÙØ¹ اÙÙ
ستÙÙØ§Øª"})]})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:588",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:589",children:"Ø§ÙØªØµÙÙÙ"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:590",value:Q.category,onChange:x=>le(M=>({...M,category:x.target.value})),placeholder:"Ù
ثاÙ: برÙ
Ø¬Ø©Ø ØªØ³ÙÙÙØ ÙØºØ§Øª"})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:596",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:597",children:"اÙÙØºØ©"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:598",value:Q.language,onChange:x=>le(M=>({...M,language:x.target.value}))})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:603",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:604",children:"Ø§ÙØ³Ø¹Ø± (ر.س)"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:605",type:"number",value:Q.price,onChange:x=>le(M=>({...M,price:x.target.value})),placeholder:"0 = Ù
جاÙÙØ©"})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:612",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:613",children:"سعر Ø§ÙØ®ØµÙ
(ر.س)"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:614",type:"number",value:Q.discountPrice,onChange:x=>le(M=>({...M,discountPrice:x.target.value})),placeholder:"اترÙÙ ÙØ§Ø±ØºØ§Ù إذا ÙØ§ ÙÙØ¬Ø¯ خصÙ
"})]}),(i||g)&&e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:622",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:623",children:"ÙØ³Ø¨Ø© عÙ
ÙÙØ© اÙÙ
ÙØµØ© (%)"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:624",type:"number",value:Q.commissionRate,onChange:x=>le(M=>({...M,commissionRate:x.target.value}))})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:631",className:"col-span-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:632",children:"ÙØµÙ Ù
ختصر"}),e.jsx(Xe,{"data-loc":"client/src/pages/RecordedCourses.tsx:633",value:Q.shortDescription,onChange:x=>le(M=>({...M,shortDescription:x.target.value})),placeholder:"ÙØµÙ Ù
ختصر ÙØ¸Ùر ÙÙ Ø¨Ø·Ø§ÙØ© Ø§ÙØ¯Ùرة",rows:2})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:640",className:"col-span-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:641",children:"ÙØµÙ ØªÙØµÙÙÙ"}),e.jsx(Xe,{"data-loc":"client/src/pages/RecordedCourses.tsx:642",value:Q.detailedDescription,onChange:x=>le(M=>({...M,detailedDescription:x.target.value})),placeholder:"ÙØµÙ ØªÙØµÙÙÙ ÙÙØ¯Ùرة",rows:4})]})]})}),e.jsxs(ft,{"data-loc":"client/src/pages/RecordedCourses.tsx:651",children:[e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:652",variant:"outline",onClick:()=>A(!1),children:"Ø¥ÙØºØ§Ø¡"}),e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:653",onClick:hs,disabled:K.isPending,children:[K.isPending?e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:654",className:"h-4 w-4 animate-spin ml-1"}):e.jsx(Js,{"data-loc":"client/src/pages/RecordedCourses.tsx:654",className:"h-4 w-4 ml-1"}),"Ø¥ÙØ´Ø§Ø¡ Ø§ÙØ¯Ùرة"]})]})]})}),L&&e.jsx(no,{"data-loc":"client/src/pages/RecordedCourses.tsx:663",course:L,open:U,onOpenChange:x=>{z(x),x||I(null)},instructors:Re.data||[],isAdmin:i||g,onSave:x=>ue.mutate({id:L.id,...x}),isPending:ue.isPending},L.id),$&&e.jsx(uo,{"data-loc":"client/src/pages/RecordedCourses.tsx:680",courseId:$,open:V,onOpenChange:x=>{q(x),x||oe(null)}})]}),e.jsx(os,{"data-loc":"client/src/pages/RecordedCourses.tsx:692",open:J,onOpenChange:ne,children:e.jsxs(ns,{"data-loc":"client/src/pages/RecordedCourses.tsx:693",className:"sm:max-w-[500px]",dir:"rtl",children:[e.jsx(ls,{"data-loc":"client/src/pages/RecordedCourses.tsx:694",children:e.jsxs(ds,{"data-loc":"client/src/pages/RecordedCourses.tsx:695",className:"flex items-center gap-2",children:[e.jsx(ut,{"data-loc":"client/src/pages/RecordedCourses.tsx:696",className:"h-5 w-5 text-primary"}),"Ø¥Ø¶Ø§ÙØ© Ù
تدرب ÙØ¯ÙÙØ§Ù"]})}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:700",className:"space-y-4 py-2",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:701",className:"space-y-2",children:[e.jsxs(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:702",className:"flex items-center gap-1.5",children:[e.jsx(Zs,{"data-loc":"client/src/pages/RecordedCourses.tsx:702",className:"h-3.5 w-3.5"})," Ø§ÙØ¯Ùرة *"]}),e.jsxs(He,{"data-loc":"client/src/pages/RecordedCourses.tsx:703",value:se.courseId?se.courseId.toString():"",onValueChange:x=>he(M=>({...M,courseId:Number(x)})),children:[e.jsx(Ge,{"data-loc":"client/src/pages/RecordedCourses.tsx:704",children:e.jsx(Ze,{"data-loc":"client/src/pages/RecordedCourses.tsx:705",placeholder:"اختر Ø§ÙØ¯Ùرة"})}),e.jsx(Ke,{"data-loc":"client/src/pages/RecordedCourses.tsx:707",children:re.map(x=>e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:709",value:x.id.toString(),children:x.title},x.id))})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:714",className:"space-y-2",children:[e.jsxs(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:715",className:"flex items-center gap-1.5",children:[e.jsx(Os,{"data-loc":"client/src/pages/RecordedCourses.tsx:715",className:"h-3.5 w-3.5"})," اسÙ
اÙÙ
تدرب *"]}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:716",placeholder:"Ø§ÙØ§Ø³Ù
اÙÙØ§Ù
Ù",value:se.fullName,onChange:x=>he(M=>({...M,fullName:x.target.value}))})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:718",className:"space-y-2",children:[e.jsxs(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:719",className:"flex items-center gap-1.5",children:[e.jsx(ra,{"data-loc":"client/src/pages/RecordedCourses.tsx:719",className:"h-3.5 w-3.5"})," Ø§ÙØ¨Ø±Ùد Ø§ÙØ¥ÙÙØªØ±ÙÙÙ *"]}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:720",type:"email",dir:"ltr",className:"text-left",placeholder:"[email protected]",value:se.email,onChange:x=>he(M=>({...M,email:x.target.value}))})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:722",className:"space-y-2",children:[e.jsxs(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:723",className:"flex items-center gap-1.5",children:[e.jsx(aa,{"data-loc":"client/src/pages/RecordedCourses.tsx:723",className:"h-3.5 w-3.5"})," رÙÙ
Ø§ÙØ¬ÙاÙ"]}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:724",dir:"ltr",className:"text-left",placeholder:"05xxxxxxxx",value:se.phone,onChange:x=>he(M=>({...M,phone:x.target.value}))})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:726",className:"space-y-2",children:[e.jsxs(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:727",className:"flex items-center gap-1.5",children:[e.jsx(ca,{"data-loc":"client/src/pages/RecordedCourses.tsx:727",className:"h-3.5 w-3.5"})," اÙÙ
Ø¨ÙØº اÙÙ
دÙÙØ¹ (ر.س)"]}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:728",type:"number",dir:"ltr",className:"text-left",placeholder:"0",value:se.paidAmount,onChange:x=>he(M=>({...M,paidAmount:x.target.value}))})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:730",className:"space-y-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:731",children:"طرÙÙØ© Ø§ÙØ¯Ùع"}),e.jsxs(He,{"d
5ata-loc":"client/src/pages/RecordedCourses.tsx:732",value:se.paymentMethod,onValueChange:x=>he(M=>({...M,paymentMethod:x})),children:[e.jsx(Ge,{"data-loc":"client/src/pages/RecordedCourses.tsx:733",children:e.jsx(Ze,{"data-loc":"client/src/pages/RecordedCourses.tsx:734"})}),e.jsxs(Ke,{"data-loc":"client/src/pages/RecordedCourses.tsx:736",children:[e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:737",value:"bank_transfer",children:"تØÙÙ٠بÙÙÙ"}),e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:738",value:"cash",children:"ÙÙØ¯Ù"}),e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:739",value:"free",children:"Ù
جاÙÙ"}),e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:740",value:"other",children:"أخرÙ"})]})]})]})]}),e.jsxs(ft,{"data-loc":"client/src/pages/RecordedCourses.tsx:745",className:"gap-2 sm:gap-0",children:[e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:746",variant:"outline",onClick:()=>ne(!1),children:"Ø¥ÙØºØ§Ø¡"}),e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:747",onClick:()=>{if(!se.courseId||!se.email||!se.fullName){w.error("ÙØ±Ø¬Ù تعبئة Ø§ÙØÙÙ٠اÙÙ
Ø·ÙÙØ¨Ø© (Ø§ÙØ¯ÙØ±Ø©Ø Ø§ÙØ§Ø³Ù
Ø Ø§ÙØ¨Ø±Ùد)");return}Ee.mutate(se)},disabled:Ee.isPending,className:"gap-2",children:[Ee.isPending?e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:758",className:"h-4 w-4 animate-spin"}):e.jsx(ut,{"data-loc":"client/src/pages/RecordedCourses.tsx:758",className:"h-4 w-4"}),"تسجÙ٠اÙÙ
تدرب"]})]})]})}),H&&ie&&e.jsx(oo,{"data-loc":"client/src/pages/RecordedCourses.tsx:767",courseId:ie,courseTitle:Ie,open:H,onOpenChange:ye})]})}function oo({courseId:s,courseTitle:t,open:r,onOpenChange:a}){const[c,o]=n.useState(""),d=P.recordedCourses.enrollments.list.useQuery({courseId:s}),i=d.data||[],p=i.filter(u=>u.fullName?.toLowerCase().includes(c.toLowerCase())||u.email?.toLowerCase().includes(c.toLowerCase())||u.phone?.includes(c));return e.jsx(os,{"data-loc":"client/src/pages/RecordedCourses.tsx:790",open:r,onOpenChange:a,children:e.jsxs(ns,{"data-loc":"client/src/pages/RecordedCourses.tsx:791",className:"sm:max-w-[680px] max-h-[85vh] flex flex-col",dir:"rtl",children:[e.jsx(ls,{"data-loc":"client/src/pages/RecordedCourses.tsx:792",children:e.jsxs(ds,{"data-loc":"client/src/pages/RecordedCourses.tsx:793",className:"flex items-center gap-2",children:[e.jsx(Os,{"data-loc":"client/src/pages/RecordedCourses.tsx:794",className:"h-5 w-5 text-primary"}),"اÙÙ
سجÙÙÙ ÙÙ: ",t,e.jsxs("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:796",className:"text-sm font-normal text-muted-foreground",children:["(",i.length,")"]})]})}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:799",className:"relative mb-3",children:[e.jsx(nr,{"data-loc":"client/src/pages/RecordedCourses.tsx:800",className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:801",placeholder:"Ø¨ØØ« Ø¨Ø§ÙØ§Ø³Ù
Ø£Ù Ø§ÙØ¨Ø±Ùد Ø£Ù Ø§ÙØ¬ÙاÙ...",value:c,onChange:u=>o(u.target.value),className:"pr-9"})]}),e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:808",className:"flex-1 overflow-y-auto",children:d.isLoading?e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:810",className:"flex justify-center py-10",children:e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:811",className:"h-6 w-6 animate-spin text-muted-foreground"})}):p.length===0?e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:814",className:"flex flex-col items-center justify-center py-10 text-muted-foreground",children:[e.jsx(Os,{"data-loc":"client/src/pages/RecordedCourses.tsx:815",className:"h-10 w-10 mb-2 opacity-30"}),e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:816",children:c?"ÙØ§ ØªÙØ¬Ø¯ ÙØªØ§Ø¦Ø¬":"ÙØ§ ÙÙØ¬Ø¯ Ù
سجÙÙ٠بعد"})]}):e.jsxs("table",{"data-loc":"client/src/pages/RecordedCourses.tsx:819",className:"w-full text-sm",children:[e.jsx("thead",{"data-loc":"client/src/pages/RecordedCourses.tsx:820",children:e.jsxs("tr",{"data-loc":"client/src/pages/RecordedCourses.tsx:821",className:"border-b bg-muted/50",children:[e.jsx("th",{"data-loc":"client/src/pages/RecordedCourses.tsx:822",className:"text-right py-2 px-3 font-medium",children:"#"}),e.jsx("th",{"data-loc":"client/src/pages/RecordedCourses.tsx:823",className:"text-right py-2 px-3 font-medium",children:"Ø§ÙØ§Ø³Ù
"}),e.jsx("th",{"data-loc":"client/src/pages/RecordedCourses.tsx:824",className:"text-right py-2 px-3 font-medium",children:"Ø§ÙØ¨Ø±Ùد Ø§ÙØ¥ÙÙØªØ±ÙÙÙ"}),e.jsx("th",{"data-loc":"client/src/pages/RecordedCourses.tsx:825",className:"text-right py-2 px-3 font-medium",children:"Ø§ÙØ¬ÙاÙ"}),e.jsx("th",{"data-loc":"client/src/pages/RecordedCourses.tsx:826",className:"text-right py-2 px-3 font-medium",children:"اÙÙ
Ø¨ÙØº"}),e.jsx("th",{"data-loc":"client/src/pages/RecordedCourses.tsx:827",className:"text-right py-2 px-3 font-medium",children:"Ø§ÙØ¥Ùجاز"}),e.jsx("th",{"data-loc":"client/src/pages/RecordedCourses.tsx:828",className:"text-right py-2 px-3 font-medium",children:"ØªØ§Ø±ÙØ® Ø§ÙØªØ³Ø¬ÙÙ"})]})}),e.jsx("tbody",{"data-loc":"client/src/pages/RecordedCourses.tsx:831",children:p.map((u,f)=>e.jsxs("tr",{"data-loc":"client/src/pages/RecordedCourses.tsx:833",className:"border-b hover:bg-muted/30 transition-colors",children:[e.jsx("td",{"data-loc":"client/src/pages/RecordedCourses.tsx:834",className:"py-2 px-3 text-muted-foreground",children:f+1}),e.jsx("td",{"data-loc":"client/src/pages/RecordedCourses.tsx:835",className:"py-2 px-3 font-medium",children:u.fullName||"-"}),e.jsx("td",{"data-loc":"client/src/pages/RecordedCourses.tsx:836",className:"py-2 px-3 text-muted-foreground",dir:"ltr",children:u.email||"-"}),e.jsx("td",{"data-loc":"client/src/pages/RecordedCourses.tsx:837",className:"py-2 px-3 text-muted-foreground",dir:"ltr",children:u.phone||"-"}),e.jsx("td",{"data-loc":"client/src/pages/RecordedCourses.tsx:838",className:"py-2 px-3",children:parseFloat(u.paidAmount||"0")===0?e.jsx("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:840",className:"text-green-600 font-medium",children:"Ù
جاÙÙ"}):e.jsxs("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:842",children:[parseFloat(u.paidAmount).toFixed(0)," ر.س"]})}),e.jsx("td",{"data-loc":"client/src/pages/RecordedCourses.tsx:845",className:"py-2 px-3",children:e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:846",className:"flex items-center gap-1.5",children:[e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:847",className:"w-16 h-1.5 bg-muted rounded-full overflow-hidden",children:e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:848",className:"h-full bg-primary rounded-full",style:{width:`${u.completionPercentage||0}%`}})}),e.jsxs("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:853",className:"text-xs text-muted-foreground",children:[Math.round(u.completionPercentage||0),"%"]})]})}),e.jsx("td",{"data-loc":"client/src/pages/RecordedCourses.tsx:856",className:"py-2 px-3 text-muted-foreground text-xs",children:u.enrolledAt?new Date(u.enrolledAt).toLocaleDateString("ar-SA"):"-"})]},u.id))})]})})]})})}function or(s){return{title:s.title||"",instructorId:s.instructorId||0,category:s.category||"",level:s.level||"all_levels",language:s.language||"Ø§ÙØ¹Ø±Ø¨ÙØ©",shortDe
5scription:s.shortDescription||"",detailedDescription:s.detailedDescription||"",price:s.price||"0",discountPrice:s.discountPrice||"",commissionRate:s.commissionRate||"30",completionThreshold:s.completionThreshold??80,thumbnailUrl:s.thumbnailUrl||"",promoVideoUrl:s.promoVideoUrl||"",isFeatured:s.isFeatured===!0||s.isFeatured===1,certificateEnabled:s.certificateEnabled===void 0||s.certificateEnabled===null?!0:s.certificateEnabled===!0||s.certificateEnabled===1}}function no({course:s,open:t,onOpenChange:r,instructors:a,isAdmin:c,onSave:o,isPending:d}){const i=P.recordedCourses.getById.useQuery({id:s.id},{enabled:t}),p=n.useMemo(()=>i.data?.sections?i.data.sections.flatMap(g=>(g.lessons||[]).filter(m=>m.lessonType==="video"&&m.videoUrl)):[],[i.data]),[u,f]=n.useState(()=>or(s));n.useEffect(()=>{t&&f(or(s))},[s.id,t]);const v=a.find(g=>g.id===u.instructorId);return e.jsx(os,{"data-loc":"client/src/pages/RecordedCourses.tsx:918",open:t,onOpenChange:r,children:e.jsxs(ns,{"data-loc":"client/src/pages/RecordedCourses.tsx:919",className:"max-w-[95vw] w-[95vw] max-h-[95vh] h-[95vh] overflow-y-auto",dir:"rtl",children:[e.jsx(ls,{"data-loc":"client/src/pages/RecordedCourses.tsx:920",children:e.jsxs(ds,{"data-loc":"client/src/pages/RecordedCourses.tsx:921",children:["تعدÙÙ Ø§ÙØ¯Ùرة: ",s.title]})}),e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:923",className:"space-y-4",children:e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:924",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:925",className:"col-span-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:926",children:"عÙÙØ§Ù Ø§ÙØ¯Ùرة"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:927",value:u.title,onChange:g=>f(m=>({...m,title:g.target.value}))})]}),c&&e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:930",className:"col-span-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:931",children:"اÙÙ
درب اÙÙ
سؤÙÙ"}),e.jsxs(He,{"data-loc":"client/src/pages/RecordedCourses.tsx:932",value:u.instructorId?String(u.instructorId):"",onValueChange:g=>f(m=>({...m,instructorId:parseInt(g)})),children:[e.jsx(Ge,{"data-loc":"client/src/pages/RecordedCourses.tsx:936",children:e.jsx(Ze,{"data-loc":"client/src/pages/RecordedCourses.tsx:937",placeholder:"اختر اÙÙ
درب"})}),e.jsx(Ke,{"data-loc":"client/src/pages/RecordedCourses.tsx:939",children:a.map(g=>e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:941",value:String(g.id),children:g.name},g.id))})]}),v&&e.jsxs("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:946",className:"text-xs text-muted-foreground mt-1",children:["اÙÙ
درب Ø§ÙØØ§ÙÙ: ",v.name,v.userId?" (Ù
Ø±Ø¨ÙØ· Ø¨ØØ³Ø§Ø¨)":" (ØºÙØ± Ù
Ø±Ø¨ÙØ· Ø¨ØØ³Ø§Ø¨)"]})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:953",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:954",children:"اÙÙ
ستÙÙ"}),e.jsxs(He,{"data-loc":"client/src/pages/RecordedCourses.tsx:955",value:u.level,onValueChange:g=>f(m=>({...m,level:g})),children:[e.jsx(Ge,{"data-loc":"client/src/pages/RecordedCourses.tsx:956",children:e.jsx(Ze,{"data-loc":"client/src/pages/RecordedCourses.tsx:956"})}),e.jsxs(Ke,{"data-loc":"client/src/pages/RecordedCourses.tsx:957",children:[e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:958",value:"beginner",children:"Ù
بتدئ"}),e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:959",value:"intermediate",children:"Ù
ØªÙØ³Ø·"}),e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:960",value:"advanced",children:"Ù
ØªÙØ¯Ù
"}),e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:961",value:"all_levels",children:"جÙ
ÙØ¹ اÙÙ
ستÙÙØ§Øª"})]})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:965",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:966",children:"Ø§ÙØªØµÙÙÙ"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:967",value:u.category,onChange:g=>f(m=>({...m,category:g.target.value}))})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:969",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:970",children:"Ø§ÙØ³Ø¹Ø± (ر.س)"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:971",type:"number",value:u.price,onChange:g=>f(m=>({...m,price:g.target.value}))})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:973",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:974",children:"سعر Ø§ÙØ®ØµÙ
(ر.س)"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:975",type:"number",value:u.discountPrice,onChange:g=>f(m=>({...m,discountPrice:g.target.value}))})]}),c&&e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:978",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:979",children:"ÙØ³Ø¨Ø© عÙ
ÙÙØ© اÙÙ
ÙØµØ© (%)"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:980",type:"number",value:u.commissionRate,onChange:g=>f(m=>({...m,commissionRate:g.target.value}))})]}),c&&e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:984",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:985",children:"ÙØ³Ø¨Ø© اÙÙ
Ø´Ø§ÙØ¯Ø© اÙÙ
Ø·ÙÙØ¨Ø© ÙÙØ¥ÙÙ
ا٠(%)"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:986",type:"number",min:"0",max:"100",value:u.completionThreshold,onChange:g=>f(m=>({...m,completionThreshold:Math.min(100,Math.max(0,parseInt(g.target.value)||0))}
5))}),e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:993",className:"text-xs text-muted-foreground mt-1",children:"اÙÙØ³Ø¨Ø© اÙÙ
ئÙÙØ© اÙÙ
Ø·ÙÙØ¨Ø© Ù
Ù Ù
Ø´Ø§ÙØ¯Ø© اÙÙÙØ¯ÙÙ ÙØªÙعÙ٠زر Ø¥ÙÙ
Ø§Ù Ø§ÙØ¯Ø±Ø³ (Ø§ÙØ§ÙتراضÙ: 80%)"})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:998",className:"col-span-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:999",children:"ØµÙØ±Ø© Ø§ÙØ¯Ùرة (Thumbnail)"}),e.jsx(lo,{"data-loc":"client/src/pages/RecordedCourses.tsx:1000",value:u.thumbnailUrl,onChange:g=>f(m=>({...m,thumbnailUrl:g}))})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1005",className:"col-span-2",children:[e.jsxs(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:1006",className:"flex items-center gap-1.5",children:[e.jsx(Ct,{"data-loc":"client/src/pages/RecordedCourses.tsx:1007",className:"h-4 w-4 text-gold"}),"اÙÙ
ÙØ·Ø¹ Ø§ÙØªØ´ÙÙÙÙ (ÙØ¸Ùر ÙÙÙ
تدربÙÙ ÙØ¨Ù Ø§ÙØªØ³Ø¬ÙÙ)"]}),i.isLoading?e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1011",className:"flex items-center gap-2 text-sm text-muted-foreground mt-1",children:[e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:1012",className:"h-4 w-4 animate-spin"})," جار٠تØÙ
ÙÙ Ù
ÙØ§Ø·Ø¹ Ø§ÙØ¯Ùرة..."]}):p.length>0?e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1015",className:"space-y-2 mt-1",children:[e.jsxs(He,{"data-loc":"client/src/pages/RecordedCourses.tsx:1016",value:u.promoVideoUrl||"",onValueChange:g=>f(m=>({...m,promoVideoUrl:g==="__none__"?"":g})),children:[e.jsx(Ge,{"data-loc":"client/src/pages/RecordedCourses.tsx:1020",children:e.jsx(Ze,{"data-loc":"client/src/pages/RecordedCourses.tsx:1021",placeholder:"اختر Ù
ÙØ·Ø¹Ø§Ù Ù
Ù Ø§ÙØ¯Ùرة..."})}),e.jsxs(Ke,{"data-loc":"client/src/pages/RecordedCourses.tsx:1023",dir:"rtl",children:[e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:1024",value:"__none__",children:"-- بدÙÙ Ù
ÙØ·Ø¹ تشÙÙÙÙ (ØªØ¸ÙØ± Ø§ÙØµÙرة) --"}),p.map(g=>e.jsxs(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:1026",value:g.videoUrl,children:[g.title,g.duration?` (${Math.floor(g.duration/60)}:${(g.duration%60).toString().padStart(2,"0")})`:""]},g.id))]})]}),e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:1033",className:"text-xs text-muted-foreground",children:"أ٠أدخ٠رابطا٠Ù
باشرا٠(YouTube / Vimeo):"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:1034",value:u.promoVideoUrl,onChange:g=>f(m=>({...m,promoVideoUrl:g.target.value})),placeholder:"https://youtube.com/watch?v=...",dir:"ltr"})]}):e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1042",className:"space-y-1 mt-1",children:[e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:1043",value:u.promoVideoUrl,onChange:g=>f(m=>({...m,promoVideoUrl:g.target.value})),placeholder:"https://youtube.com/watch?v=...",dir:"ltr"}),e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:1049",className:"text-xs text-muted-foreground",children:"ÙØ§ ØªÙØ¬Ø¯ Ù
ÙØ§Ø·Ø¹ ÙÙØ¯ÙÙ ÙÙ Ø§ÙØ¯Ùرة بعد. أض٠Ù
ÙØ§Ø·Ø¹ Ø£ÙÙØ§Ù أ٠أدخ٠رابطا٠Ù
باشراÙ."})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1053",className:"col-span-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:1054",children:"ÙØµÙ Ù
ختصر"}),e.jsx(Xe,{"data-loc":"client/src/pages/RecordedCourses.tsx:1055",value:u.shortDescription,onChange:g=>f(m=>({...m,shortDescription:g.target.value})),rows:2})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1057",className:"col-span-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:1058",children:"ÙØµÙ ØªÙØµÙÙÙ"}),e.jsx(Xe,{"data-loc":"client/src/pages/RecordedCourses.tsx:1059",value:u.detailedDescription,onChange:g=>f(m=>({...m,detailedDescription:g.target.value})),rows:4})]}),c&&e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1062",className:"col-span-2",children:e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1063",className:"flex items-center justify-between p-3 border rounded-lg bg-muted/30",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1064",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:1065",className:"text-sm font-medium",children:"ØªÙØ¹ÙÙ Ø§ÙØ¥Ùادة (Ø´ÙØ§Ø¯Ø© Ø§ÙØ¥ÙÙ
اÙ)"}),e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:1066",className:"text-xs text-muted-foreground mt-0.5",children:"Ø¹ÙØ¯ Ø§ÙØªÙعÙÙØ ÙØØµÙ Ø§ÙÙ
تدرب عÙÙ Ø¥ÙØ§Ø¯Ø© Ø¥ÙÙ
Ø§Ù Ø¹ÙØ¯ إتÙ
اÙ
Ø§ÙØ¯Ùرة"})]}),e.jsx("button",{"data-loc":"client/src/pages/RecordedCourses.tsx:1068",type:"button",role:"switch","aria-checked":u.certificateEnabled,onClick:()=>f(g=>({...g,certificateEnabled:!g.certificateEnabled})),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-gold focus:ring-offset-2 ${u.certificateEnabled?"bg-emerald-500":"bg-gray-300"}`,children:e.jsx("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:1077",className:`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${u.certificateEnabled?"translate-x-6":"translate-x-1"}`})})]})})]})}),e.jsxs(ft,{"data-loc":"client/src/pages/RecordedCourses.tsx:1088",children:[e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:1089",variant:"outline",onClick:()=>r(!1),children:"Ø¥ÙØºØ§Ø¡"}),e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:1090",onClick:()=>o(u),disabled:d,children:[d?e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:1091",className:"h-4 w-4 animate-spin ml-1"}):null,"ØÙظ Ø§ÙØªØ¹Ø¯ÙÙØ§Øª"]})]})]})})}function lo({value:s,onChange:t}){const[r,a]=n.useState(s||null),[c,o]=n.useState(!1),[d,i]=n.useState(null),[p,u]=n.useState(null),f=(m,j=1200,h=.85)=>new Promise((R,b)=>{const N=new Image,y=URL.createObjectURL(m);N.onload=()=>{URL.revokeObjectURL(y);const A=document.createElement("canvas");let{width:L,height:I}=N;L>j&&(I=Math.round(I*j/L),L=j),A.width=L,A.height=I;const U=A.getContext("2d");if(!U){b(new Error("Canvas not supported"));return}U.imageSmoothingEnabled=!0,U.imageSmoothingQuality="high",U.drawImage(N,0,0,L,I);const V=A.toDataURL("image/webp",h);V.startsWith("data:image/webp")?R(V):R(A.toDataURL("image/jpeg",h))},N.onerror=()=>{URL.revokeObjectURL(y),b(new Error("Failed to load image"))},N.src=y}),v=async m=>{const j=m.target.files?.[0];
5if(j){if(!j.type.startsWith("image/")){w.error("ÙØ±Ø¬Ù Ø§Ø®ØªÙØ§Ø± Ù
ÙÙ ØµÙØ±Ø©");return}if(j.size>10*1024*1024){w.error("ØØ¬Ù
Ø§ÙØµÙرة ÙØ¬Ø¨ Ø£Ù ÙÙÙ٠أÙÙ Ù
Ù 10 Ù
ÙØºØ§Ø¨Ø§Ùت");return}o(!0),i(j.size);try{const h=await f(j),R=Math.round(h.length*3/4);u(R),a(h),t(h);const b=Math.round((1-R/j.size)*100);b>5&&w.success(`تÙ
ضغط Ø§ÙØµÙرة: ${g(j.size)} â ${g(R)} (ÙÙÙØ±Øª ${b}%)`)}catch{const h=new FileReader;h.onload=R=>{const b=R.target?.result;a(b),t(b)},h.readAsDataURL(j)}finally{o(!1)}}},g=m=>m<1024?m+" B":m<1024*1024?(m/1024).toFixed(1)+" KB":(m/(1024*1024)).toFixed(1)+" MB";return e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1187",className:"flex items-start gap-4 mt-1",children:[r?e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1189",className:"relative w-40 h-24 rounded-lg overflow-hidden border bg-muted flex-shrink-0",children:[e.jsx("img",{"data-loc":"client/src/pages/RecordedCourses.tsx:1190",src:r,alt:"ØµÙØ±Ø© Ø§ÙØ¯Ùرة",className:"w-full h-full object-cover"}),e.jsx("button",{"data-loc":"client/src/pages/RecordedCourses.tsx:1191",type:"button",className:"absolute top-1 left-1 bg-black/60 hover:bg-black/80 text-white rounded-full p-0.5 transition-colors",onClick:()=>{a(null),t("")},children:e.jsx(As,{"data-loc":"client/src/pages/RecordedCourses.tsx:1196",className:"h-3 w-3"})})]}):e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1200",className:"w-40 h-24 rounded-lg border-2 border-dashed border-muted-foreground/30 flex items-center justify-center bg-muted/50 flex-shrink-0",children:e.jsx(da,{"data-loc":"client/src/pages/RecordedCourses.tsx:1201",className:"h-8 w-8 text-muted-foreground/50"})}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1204",className:"flex flex-col gap-2 flex-1",children:[e.jsxs("label",{"data-loc":"client/src/pages/RecordedCourses.tsx:1205",className:`cursor-pointer ${c?"pointer-events-none opacity-50":""}`,children:[e.jsx("input",{"data-loc":"client/src/pages/RecordedCourses.tsx:1206",type:"file",accept:"image/*",className:"hidden",onChange:v}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1207",className:"flex items-center gap-2 px-3 py-2 border rounded-md hover:bg-accent transition-colors text-sm w-fit",children:[e.jsx(gs,{"data-loc":"client/src/pages/RecordedCourses.tsx:1208",className:"h-4 w-4"}),e.jsx("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:1209",children:c?"جار٠ضغط Ø§ÙØµÙرة...":"Ø±ÙØ¹ ØµÙØ±Ø©"})]})]}),d&&p&&p<d?e.jsxs("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:1213",className:"text-xs text-green-600",children:["تÙ
Ø§ÙØ¶ØºØ·: ",g(d)," â ",g(p)," (ÙÙÙØ±Øª ",Math.round((1-p/d)*100),"%)"]}):null,e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:1217",className:"text-xs text-muted-foreground",children:"Ø§ÙØØ¬Ù
Ø§ÙØ£ÙصÙ: 10 Ù
ÙØºØ§Ø¨Ø§Ùت. ÙØªÙ
ضغط Ø§ÙØµÙرة تÙÙØ§Ø¦Ùا٠Ù
ع Ø§ÙØÙØ§Ø¸ عÙÙ Ø§ÙØ¬Ùدة"}),e.jsx(qr,{"data-loc":"client/src/pages/RecordedCourses.tsx:1218",onImageGenerated:m=>{t(m),a(m)},defaultPrompt:"ØµÙØ±Ø© Ø§ØØªØ±Ø§ÙÙØ© ÙØ¯Ùرة ØªØ¯Ø±ÙØ¨ÙØ© Ù
Ø³Ø¬ÙØ©",buttonLabel:"Ø¥ÙØ´Ø§Ø¡ Ø¨Ø§ÙØ°Ùاء Ø§ÙØ§ØµØ·ÙاعÙ"}),e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:1226",className:"text-xs text-muted-foreground",children:"أ٠أدخ٠رابط Ø§ÙØµÙرة Ù
باشرة:"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:1227",placeholder:"https://...",value:s?.startsWith("data:")?"":s,onChange:m=>{const j=m.target.value;t(j),a(j||null)}})]})]})}function io({lesson:s,lIdx:t,isEditing:r,onEdit:a,onDelete:c,onArchive:o,onMove:d,onAiQuiz:i,onResources:p,sections:u,currentSectionId:f,children:v}){const{attributes:g,listeners:m,setNodeRef:j,transform:h,transition:R,isDragging:b}=Zc({id:s.id}),N={transform:$s.Transform.toString(h),transition:R,opacity:b?.5:1,zIndex:b?50:void 0};return e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1268",ref:j,style:N,children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1269",className:`flex items-center justify-between py-2 px-3 rounded-lg hover:bg-muted/50 ${b?"bg-muted shadow-lg":""}`,children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1270",className:"flex items-center gap-2",children:[e.jsx("button",{"data-loc":"client/src/pages/RecordedCourses.tsx:1271",...g,...m,className:"cursor-grab active:cursor-grabbing touch-none p-1 rounded hover:bg-muted",title:"Ø§Ø³ØØ¨ ÙØªØºÙÙØ± Ø§ÙØªØ±ØªÙب",children:e.jsx(ia,{"data-loc":"client/src/pages/RecordedCourses.tsx:1277",className:"h-4 w-4 text-muted-foreground"})}),e.jsx("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:1279",className:"text-sm text-muted-foreground w-6",children:t+1}),s.lessonType==="quiz"?e.jsx(Ps,{"data-loc":"client/src/pages/RecordedCourses.tsx:1281",className:"h-4 w-4 text-amber-500"}):s.lessonType==="text"?e.jsx(Rs,{"data-loc":"client/src/pages/RecordedCourses.tsx:1283",className:"h-4 w-4 text-blue-500"}):s.lessonType==="document"?e.jsx(gs,{"data-loc":"client/src/pages/RecordedCourses.tsx:1285",className:"h-4 w-4 text-orange-500"}):e.jsx(Dt,{"data-loc":"client/src/pages/RecordedCourses.tsx:1287",className:"h-4 w-4 text-primary"}),e.jsx("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:1289",className:"text-sm font-medium",children:s.title}),s.lessonType==="quiz"&&e.jsx(Le,{"data-loc":"client/src/pages/RecordedCourses.tsx:1290",variant:"outline",className:"text-xs bg-amber-50",children:"اختبار"}),s.lessonType==="text"&&e.jsx(Le,{"data-loc":"client/src/pages/RecordedCourses.tsx:1291",variant:"outline",className:"text-xs bg-blue-50",children:"ÙØµÙ"}),s.lessonType==="document"&&e.jsx(Le,{"data-loc":"client/src/pages/RecordedCourses.tsx:1292",variant:"outline",className:"text-xs bg-orange-50",children:"PDF"}),s.videoSource==="youtube"&&e.jsx(Le,{"data-loc":"client/src/pages/RecordedCourses.tsx:1293",variant:"outline",className:"text-xs bg-red-50",children:"YouTube"}),s.videoSource==="vimeo"&&e.jsx(Le,{"data-loc":"client/src/pages/RecordedCourses.tsx:1294",variant:"outline",className:"text-xs bg-cyan-50",children:"Vimeo"}),s.isFreePreview&&e.jsx(Le,{"data-loc":"client/src/pages/RecordedCourses.tsx:1296",variant:"outline",className:"text-xs",children:"Ù
عاÙÙØ© Ù
جاÙÙØ©"})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1299",className:"flex items-center gap-2",children:[e.jsx("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:1300",className:"text-xs text-muted-foreground",children:s.lessonType==="quiz"?"اختبار":s.lessonType==="text"?"Ù
ØØªÙÙ ÙØµÙ":s.lessonType==="document"?"Ù
Ø³ØªÙØ¯":s.duration?`${Math.floor(s.duration/60)}:${(s.duration%60).toString().padStart(2,"0")}`:"--:--"}),s.isArchived&&e.jsx(Le,{"data-loc":"client/src/pages/RecordedCourses.tsx:1304",variant:"outline",className:"text-xs bg-gray-100 text-gray-500",children:"Ù
ؤرشÙ"}),e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:1306",size:"sm",variant:"ghost",className:"h-7 w-7 p-0",title:"تعدÙÙ",onClick:a,children:e.jsx(js,{"data-loc":"client/src/pages/RecordedCourses.tsx:1313",className:"h-3.5 w-3.5"})}),u&&u.length>1&&e.jsxs(He,{"data-loc":"client/src/pages/RecordedCourses.tsx:1316",onValueChange:y=>
5d?.(parseInt(y)),children:[e.jsx(Ge,{"data-loc":"client/src/pages/RecordedCourses.tsx:1317",className:"h-7 w-7 p-0 border-0 shadow-none [&>svg]:hidden",title:"ÙÙÙ ÙÙØ³Ù
آخر",children:e.jsx(ua,{"data-loc":"client/src/pages/RecordedCourses.tsx:1318",className:"h-3.5 w-3.5 text-muted-foreground"})}),e.jsx(Ke,{"data-loc":"client/src/pages/RecordedCourses.tsx:1320",dir:"rtl",children:u.filter(y=>y.id!==f).map(y=>e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:1322",value:y.id.toString(),children:y.title},y.id))})]}),p&&e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:1330",size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-emerald-600 hover:text-emerald-700 hover:bg-emerald-50",title:"اÙÙ
صادر اÙÙ
عرÙÙØ©",onClick:p,children:e.jsx(bt,{"data-loc":"client/src/pages/RecordedCourses.tsx:1337",className:"h-3.5 w-3.5"})}),i&&e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:1341",size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-purple-600 hover:text-purple-700 hover:bg-purple-50",title:"تÙÙÙØ¯ Ø£Ø³Ø¦ÙØ© Ø¨Ø§ÙØ°Ùاء Ø§ÙØ§ØµØ·ÙاعÙ",onClick:i,children:e.jsx(Gs,{"data-loc":"client/src/pages/RecordedCourses.tsx:1348",className:"h-3.5 w-3.5"})}),e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:1351",size:"sm",variant:"ghost",className:`h-7 w-7 p-0 ${s.isArchived?"text-green-600":"text-amber-600"}`,title:s.isArchived?"Ø¥ÙØºØ§Ø¡ Ø§ÙØ£Ø±Ø´ÙØ©":"Ø£Ø±Ø´ÙØ©",onClick:o,children:s.isArchived?e.jsx(xa,{"data-loc":"client/src/pages/RecordedCourses.tsx:1358",className:"h-3.5 w-3.5"}):e.jsx(dr,{"data-loc":"client/src/pages/RecordedCourses.tsx:1358",className:"h-3.5 w-3.5"})}),e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:1360",size:"sm",variant:"ghost",className:"text-destructive h-7 w-7 p-0",onClick:c,children:e.jsx(Ls,{"data-loc":"client/src/pages/RecordedCourses.tsx:1366",className:"h-3.5 w-3.5"})})]})]}),r&&v]})}function uo({courseId:s,open:t,onOpenChange:r}){const a=P.recordedCourses.getById.useQuery({id:s}),[c,o]=n.useState(!1),[d,i]=n.useState(null),[p,u]=n.useState(""),[f,v]=n.useState(null),[g,m]=n.useState(""),[j,h]=n.useState({title:"",description:"",videoUrl:"",duration:0,isFreePreview:!1,lessonType:"video",videoSource:"upload",textContent:"",documentUrl:"",documentType:"pdf",documentName:""}),[R,b]=n.useState(null),[N,y]=n.useState({title:"",description:"",videoUrl:"",duration:0,isFreePreview:!1,lessonType:"video",videoSource:"upload",textContent:"",documentUrl:"",documentType:"pdf",documentName:""}),A=n.useRef(null),[L,I]=n.useState(new Set),[U,z]=n.useState(!1),[V,q]=n.useState(!1),[$,oe]=n.useState(!1),[J,ne]=n.useState(null),[se,he]=n.useState(!1),[H,ye]=n.useState(""),[ie,Se]=n.useState(""),[Ie,te]=n.useState(""),[G,Re]=n.useState("files"),[me,re]=n.useState(!1),Ee=n.useRef(null),[K,ue]=n.useState(null),[_,De]=n.useState(""),[pe,Te]=n.useState(""),[fe,je]=n.useState(""),[Q,le]=n.useState(null),[hs,x]=n.useState(!1),[M,ze]=n.useState(5),[is,Ss]=n.useState("mixed"),[Qe,Me]=n.useState([]),[ms,We]=n.useState(!1),[Pe,us]=n.useState(null),Es=P.recordedCourses.sections.create.useMutation({onSuccess:()=>{w.success("تÙ
Ø¥Ø¶Ø§ÙØ© اÙÙØ³Ù
"),a.refetch(),o(!1),u("")}}),qe=P.recordedCourses.sections.delete.useMutation({onSuccess:()=>{w.success("تÙ
ØØ°Ù اÙÙØ³Ù
"),a.refetch()}}),fs=P.recordedCourses.sections.update.useMutation({onSuccess:()=>{w.success("تÙ
ØªØØ¯ÙØ« عÙÙØ§Ù اÙÙØ³Ù
"),a.refetch(),v(null),m("")},onError:l=>w.error(l.message)}),es=P.recordedCourses.lessons.fetchVideoDuration.useMutation(),qs=P.recordedCourses.lessons.create.useMutation({onSuccess:()=>{w.success("تÙ
Ø¥Ø¶Ø§ÙØ© Ø§ÙØ¯Ø±Ø³"),a.refetch(),i(null),h({title:"",description:"",videoUrl:"",duration:0,isFreePreview:!1,lessonType:"video",videoSource:"upload",textContent:"",documentUrl:"",documentType:"pdf",documentName:""})}}),Ds=P.recordedCourses.lessons.delete.useMutation({onSuccess:()=>{w.success("تÙ
ØØ°Ù Ø§ÙØ¯Ø±Ø³"),a.refetch()}}),Cs=P.recordedCourses.lessons.update.useMutation({onSuccess:()=>{w.success("تÙ
ØªØØ¯ÙØ« Ø§ÙØ¯Ø±Ø³"),a.refetch(),b(null)},onError:l=>w.error(l.message)}),Ts=P.recordedCourses.quizzes.update.useMutation({onSuccess:()=>{w.success("تÙ
ØªØØ¯ÙØ« Ø§ÙØ§Ø®ØªØ¨Ø§Ø±"),a.refetch(),b(null)},onError:l=>w.error(l.message)}),ks=P.recordedCourses.reorderLessons.useMutation({onSuccess:()=>{w.success("تÙ
ØªØØ¯ÙØ« ØªØ±ØªÙØ¨ Ø§ÙØ¯Ø±Ùس"),a.refetch()},onError:l=>w.error(l.message)}),lt=P.recordedCourses.lessons.archive.useMutation({onSuccess:()=>{w.success("تÙ
Ø£Ø±Ø´ÙØ© Ø§ÙØ¯Ø±Ø³"),a.refetch()},onError:l=>w.error(l.message)}),dt=P.recordedCourses.lessons.unarchive.useMutation({onSuccess:()=>{w.success("تÙ
Ø¥ÙØºØ§Ø¡ Ø£Ø±Ø´ÙØ© Ø§ÙØ¯Ø±Ø³"),a.refetch()},onError:l=>w.error(l.message)}),it=P.recordedCourses.moveLessonToSection.useMutation({onSuccess:()=>{w.success("تÙ
ÙÙÙ Ø§ÙØ¯Ø±Ø³ ÙÙÙØ³Ù
Ø§ÙØ¬Ø¯Ùد"),a.refetch()},onError:l=>w.error(l.message)}
5),Y=P.lessonResources.getByLesson.useQuery({lessonId:J?.id||0},{enabled:!!J&&se}),Ce=P.lessonResources.uploadFile.useMutation({onSuccess:()=>{w.success("تÙ
Ø±ÙØ¹ اÙÙ
ÙÙ Ø¨ÙØ¬Ø§Ø"),Y.refetch(),ye(""),Se(""),re(!1)},onError:l=>{w.error(l.message||"ÙØ´Ù ÙÙ Ø±ÙØ¹ اÙÙ
ÙÙ"),re(!1)}}),xe=P.lessonResources.addLink.useMutation({onSuccess:()=>{w.success("تÙ
Ø¥Ø¶Ø§ÙØ© Ø§ÙØ±Ø§Ø¨Ø· Ø¨ÙØ¬Ø§Ø"),Y.refetch(),ye(""),Se(""),te("")},onError:l=>w.error(l.message||"ÙØ´Ù ÙÙ Ø¥Ø¶Ø§ÙØ© Ø§ÙØ±Ø§Ø¨Ø·")}),Ye=P.lessonResources.delete.useMutation({onSuccess:()=>{w.success("تÙ
ØØ°Ù اÙÙ
صدر"),Y.refetch()},onError:l=>w.error(l.message)}),ge=P.lessonResources.update.useMutation({onSuccess:()=>{w.success("تÙ
ØªØØ¯ÙØ« اÙÙ
صدر"),Y.refetch(),ue(null),De(""),Te(""),je("")},onError:l=>w.error(l.message)}),ve=()=>{if(!K||!_.trim()){w.error("ÙØ±Ø¬Ù Ø¥Ø¯Ø®Ø§Ù Ø§ÙØ¹ÙÙØ§Ù");return}const l={id:K.id,title:_.trim(),description:pe.trim()||void 0};if(K.resourceType==="link"){let T=fe.trim();T&&!T.match(/^https?:\/\//i)&&(T="https://"+T),l.linkUrl=T||void 0}ge.mutate(l)},Ae=async l=>{const T=l.target.files?.[0];if(!T||!J)return;if(T.size>50*1024*1024){w.error("ØØ¬Ù
اÙÙ
ÙÙ ÙØ¬Ø¨ Ø£Ù ÙØ§ ÙØªØ¬Ø§Ùز 50 Ù
ÙØºØ§Ø¨Ø§Ùت");return}re(!0);const C=new FileReader;C.onload=()=>{const S=C.result.split(",")[1],Z=H||T.name.replace(/\.[^.]+$/,"");Ce.mutate({lessonId:J.id,courseId:s,title:Z,description:ie||void 0,fileName:T.name,contentType:T.type||"application/octet-stream",fileData:S})},C.onerror=()=>{w.error("ÙØ´Ù ÙÙ ÙØ±Ø§Ø¡Ø© اÙÙ
ÙÙ"),re(!1)},C.readAsDataURL(T),Ee.current&&(Ee.current.value="")},ss=()=>{if(!J||!Ie||!H){w.error("ÙØ±Ø¬Ù Ø¥Ø¯Ø®Ø§Ù Ø§ÙØ¹ÙÙØ§Ù ÙØ§Ùرابط");return}let l=Ie.trim();l&&!l.match(/^https?:\/\//i)&&(l="https://"+l),xe.mutate({lessonId:J.id,courseId:s,title:H,description:ie||void 0,linkUrl:l})},ae=l=>{if(l.resourceType==="link")return e.jsx(Wt,{"data-loc":"client/src/pages/RecordedCourses.tsx:1645",className:"h-4 w-4 text-blue-500"});switch(l.fileType){case"pdf":return e.jsx(Rs,{"data-loc":"client/src/pages/RecordedCourses.tsx:1647",className:"h-4 w-4 text-red-500"});case"word":return e.jsx(xt,{"data-loc":"client/src/pages/RecordedCourses.tsx:1648",className:"h-4 w-4 text-blue-600"});case"excel":return e.jsx(ma,{"data-loc":"client/src/pages/RecordedCourses.tsx:1649",className:"h-4 w-4 text-green-600"});case"powerpoint":return e.jsx(xt,{"data-loc":"client/src/pages/RecordedCourses.tsx:1650",className:"h-4 w-4 text-orange-500"});case"image":return e.jsx(ha,{"data-loc":"client/src/pages/RecordedCourses.tsx:1651",className:"h-4 w-4 text-purple-500"});case"video":return e.jsx(ga,{"data-loc":"client/src/pages/RecordedCourses.tsx:1652",className:"h-4 w-4 text-pink-500"});case"audio":return e.jsx(pa,{"data-loc":"client/src/pages/RecordedCourses.tsx:1653",className:"h-4 w-4 text-amber-500"});default:return e.jsx(xt,{"data-loc":"client/src/pages/RecordedCourses.tsx:1654",className:"h-4 w-4 text-gray-500"})}},Fe=l=>l?l<1024?`${l} B`:l<1024*1024?`${(l/1024).toFixed(1)} KB`:`${(l/(1024*1024)).toFixed(1)} MB`:"",be=P.aiQuestions.generate.useMutation({onSuccess:l=>{Me(l.questions||[]),We(!1),w.success(`تÙ
تÙÙÙØ¯ ${l.questions?.length||0} Ø³Ø¤Ø§Ù Ø¨ÙØ¬Ø§Ø`)},onError:l=>{We(!1),w.error(l.message||"ÙØ´Ù Ù٠تÙÙÙØ¯ Ø§ÙØ£Ø³Ø¦ÙØ©")}}),ke=P.aiQuestions.approve.useMutation({onSuccess:()=>{w.success("تÙ
اعتÙ
اد Ø§ÙØ£Ø³Ø¦ÙØ© Ø¨ÙØ¬Ø§Ø"),x(!1),Me([]),le(null),a.refetch()},onError:l=>w.error(l.message)}),xs=()=>{Q&&(We(!0),Me([]),be.mutate({lessonId:Q.id,courseId:s,numberOfQuestions:M,questionType:is}))},ts=(l,T,C)=>{Me(S=>{const Z=[...S];return(T==="questionText"||T==="explanation"||T==="questionType")&&(Z[l]={...Z[l],[T]:C}),Z})},_e=(l,T,C,S)=>{Me(Z=>{const D=[...Z],B=[...D[l].answers];return C==="isCorrect"?B.forEach((vs,as)=>{B[as]={...vs,isCorrect:as===T}}):B[T]={...B[T],[C]:S},D[l]={...D[l],answers:B},D})},ps=l=>{Me(T=>T.filter((C,S)=>S!==l))},rs=P.recordedCourses.reorderSections.useMutation({onSuccess:()=>{w.success("تÙ
ØªØØ¯ÙØ« ØªØ±ØªÙØ¨ Ø§ÙØ£ÙساÙ
"),a.refetch()},onError:l=>w.error(l.message)}),Or=P.recordedCourses.uploadDocument.useMutation({onSuccess:l=>{h(T=>({...T,documentUrl:l.url})),q(!1),w.success("تÙ
Ø±ÙØ¹ اÙÙ
Ø³ØªÙØ¯ Ø¨ÙØ¬Ø§Ø")},onError:l=>{q(!1),w.error(l.message||"ÙØ´Ù Ø±ÙØ¹ اÙÙ
Ø³ØªÙØ¯")}}),Lr=P.recordedCourses.uploadDocument.useMutation({onSuccess:l=>{y(T=>({...T,documentUrl:l.url})),oe(!1),w.success("تÙ
Ø±ÙØ¹ اÙÙ
Ø³ØªÙØ¯ Ø¨ÙØ¬Ø§Ø")},onError:l=>{oe(!1),w.error(l.message||"ÙØ´Ù Ø±ÙØ¹ اÙÙ
Ø³ØªÙØ¯")}}),Pt=(l,T=!1)=>{const C=l.target.files?.[0];if(!C)return;const S=50*1024*1024;if(C.size>S){w.error("ØØ¬Ù
اÙÙ
ÙÙ ÙØ¬Ø¨ Ø£Ù ÙÙÙ٠أÙÙ Ù
Ù 50 Ù
ÙØºØ§Ø¨Ø§Ùت");return}let Z="other";C.type==="application/pdf"?Z="pdf":C.type.startsWith("image/")?Z="image":(C.type.includes("word")||C.name.endsWith(".doc")||C.name.endsWith(".docx"))&&(Z="word"),T?(y(B=>({...B,documentType:Z,documentName:C.name})),oe(!0)):(h(B=>({...B,documentType:Z,documentName:C.name})),q(!0));const D=new FileReader;D.onload=B=>{const vs=(B.target?.result).split(",")[1];T?Lr.mutate({courseId:s,fileName:C.name,contentType:C.type,fileData:vs}):Or.mutate({courseId:s,fileName:C.name,contentType:C.type,fileData:vs})},D.readAsDataURL(C)},Ur=l=>{if(l<=0||!Oe?.sections)return;const C=[...Oe.sections].map(S=>S.id);[C[l-1],C[l]]=[C[l],C[l-1]],rs.mutate({courseId:s,sectionIds:C})},Ir=l=>{if(!Oe?.sections||l>=Oe.sections.length-1)return;const C=[...Oe.sections].map(S=>S.id);[C[l],C[l+1]]=[C[l+1],C[l]],rs.mutate({courseId:s,sectionIds:C})},zr=l=>{I(T=>{const C=new Set(T);return C.has(l)?C.delete(l):C.add(l),C})},Pr=()=>I(new Set),Fr=()=>{const l=new Set((Oe?.sections||[]).map(T=>T.id));I(l)},_r=Ma(Yt(It,{activationConstraint:{distance:8}}),Yt(Lt,{coordinateGetter:to})),$r=n.useCallback((l,T)=>C=>{const{active:S,over:Z}=C;if(!Z||S.id===Z.id)return;const D=T.findIndex(as=>as.id===S.id),B=T.findIndex(as=>as.id===Z.id);if(D===-1||B===-1)return;const vs=zt(T,D,B);ks.mutate({sectionId:l,lessonIds:vs.map(as=>as.id)})},[ks]);n.useEffect(()=>{R&&A.current&&setTimeout(()=>{A.current?.scrollIntoView({behavior:"smooth",block:"nearest"})},100)},[R]);const Oe=a.data;return e.jsxs(e.Fragment,{children:[e.jsx(os,{"data-loc":"client/src/pages/RecordedCourses.tsx:1864",open:t,onOpenChange:r,children:e.jsxs(ns,{"data-loc":"client/src/pages/RecordedCourses.tsx:1865",className:"max-w-[95vw] w-[95vw] max-h-[95vh] h-[95vh] overflow-y-auto",dir:"rtl",children:[e.jsx(ls,{"data-loc":"client/src/pages/RecordedCourses.tsx:1866",children:e.jsxs(ds,{"data-loc":"client/src/pages/RecordedCourses.tsx:1867",children:["Ù
ØØªÙÙ Ø§ÙØ¯Ùرة: ",Oe?.title||"..."]})}),!a.isLoading&&(Oe?.sections?.length??0)>0&&e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1872",className:"flex items-center justify-between gap-2 pb-2 border-b",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1873",className:"flex items-center gap-2",children:[e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:1874",size:"sm",variant:"outline",className:"text-xs h-7",onClick:Pr,children:[e.jsx(oa,{"data-loc":"client/src/pages/RecordedCourses.tsx:1875",className:"h-3.5 w-3.5 ml-1"}),"ØªÙØ³Ùع اÙÙÙ"]}),e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:1878",size:"sm",variant:"outline",className:"text-xs h-7",onClick:Fr,children:[e.jsx(Hs,{"data-loc":"client/src/pages/RecordedCourses.tsx:1879",className:"h-3.5 w-3.5 ml-1"}),"ط٠اÙÙÙ"]})]}),e.jsxs("label",{"data-loc":"client/src/pages/RecordedCourses.tsx:1883",className:"flex items-center gap-1.5 text-xs text-muted-foreground cursor-pointer",children:[e.jsx("input",{"data-loc":"client/src/pages/RecordedCourses.tsx:1884",type:"checkbox",checked:U,onChange:l=>z(l.target.checked),className:"rounded"}),e.jsx(dr,{"data-loc":"client/src/pages/RecordedCourses.tsx:1885",className:"h-3.5 w-3.5"}),"Ø¥Ø¸ÙØ§Ø± اÙÙ
ؤرشÙ"]})]}),a.isLoading?e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1892",className:"flex justify-center py-8",children:e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:1893",className:"h-8 w-8 animate-spin"})}):e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1896",className:"space-y-4",children:[Oe?.sections?.map((l,T)=>e.jsxs($e,{"data-loc":"client/src/pages/RecordedCourses.tsx:1899",children:[e.jsx(Yr,{"data-loc":"client/src/pages/RecordedCourses.tsx:1900",className:"py-3 px-4",children:e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1901",className:"flex items-center justify-between",children:[f===l.id?e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1903",className:"flex items-center gap-2 flex-1",children:[e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:1904",value:g,onChange:C=>m(C.target.value),className:"h-8 text-sm",autoFocus:!0,onKeyDown:C=>{C.key==="Enter"&&g.trim()?fs.mutate({id:l.id,title:g.trim()}):C.key==="Escape"&&v(null)}}),e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:1917",size:"sm",variant:"ghost",className:"h-8 px-2",disabled:!g.trim()||fs.isPending,onClick:()=>fs.mutate({id:l.id,title:g.trim()}),children:e.jsx(lr,{"data-loc":"client/src/pages/RecordedCourses.tsx:1924",className:"h-3.5 w-3.5 text-green-600"})}),e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:1926",size:"sm",variant:"ghost",className:"h-8 px-2",onClick:()=>v(null),children:e.jsx(As,{"data-loc":"client/src/pages/RecordedCourses.tsx:1932",className:"h-3.5 w-3.5"})})]}):e.jsxs(Xr,{"data-loc":"client/src/pages/RecordedCourses.tsx:1936",className:"text-base flex items-center gap-2 cursor-pointer select-none",onClick:()=>zr(l.id),children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1937",className:"flex flex-col gap-0",onClick:C=>C.stopPropagation(),children:[e.jsx("button",{"data-loc":"client/src/pages/RecordedCourses.tsx:1938",className:"p-0.5 rounded hover:bg-muted disabled:opacity-30 disabled:cursor-not-allowed",disabled:T===0||rs.isPending,onClick:()=>Ur(T),title:"ØªØØ±ÙÙ ÙØ£Ø¹ÙÙ",children:e.jsx(Hs,{"data-loc":"client/src/pages/RecordedCourses.tsx:1944",className:"h-3.5 w-3.5 text-muted-foreground"})}),e.jsx("button",{"data-loc":"client/src/pages/RecordedCourses.tsx:1946",className:"p-0.5 rounded hover:bg-muted disabled:opacity-30 disabled:cursor-not-allowed",disabled:T===(Oe?.sections?.length||0)-1||rs.isPending,onClick:()=>Ir(T),title:"ØªØØ±ÙÙ ÙØ£Ø³ÙÙ",children:e.jsx(Rt,{"data-loc":"client/src/pages/RecordedCourses.tsx:1952",className:"h-3.5 w-3.5 text-muted-foreground"})})]}),L.has(l.id)?e.jsx(Rt,{"data-loc":"client/src/pages/RecordedCourses.tsx:1955",className:"h-4 w-4"}):e.jsx(Hs,{"data-loc":"client/src/pages/RecordedCourses.tsx:1955",className:"h-4 w-4"}),"اÙÙØ³Ù
",T+1,": ",l.title,e.jsxs("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:1957",className:"text-xs text-muted-foreground font-normal",children:["(",(l.lessons||[]).filter(C=>!C.isArchived).length," درس)"]})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:1960",className:"flex gap-1",children:[f!==l.id&&e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:1962",size:"sm",variant:"ghost",onClick:()=>{v(l.id),m(l.title)},children:e.jsx(js,{"data-loc":"client/src/pages/RecordedCourses.tsx:1970",className:"h-3.5 w-3.5"})}),e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:1973",size:"sm",variant:"ghost",onClick:()=>i(l.id),children:[e.jsx(Js,{"data-loc":"client/src/pages/RecordedCourses.tsx:1978",className:"h-3.5 w-3.5 ml-1"}),"درس"]}
5),e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:1981",size:"sm",variant:"ghost",className:"text-destructive",onClick:()=>{confirm("ØØ°Ù ÙØ°Ø§ اÙÙØ³Ù
ÙØ¬Ù
ÙØ¹ Ø¯Ø±ÙØ³ÙØ")&&qe.mutate({id:l.id})},children:e.jsx(Ls,{"data-loc":"client/src/pages/RecordedCourses.tsx:1991",className:"h-3.5 w-3.5"})})]})]})}),!L.has(l.id)&&e.jsxs(Be,{"data-loc":"client/src/pages/RecordedCourses.tsx:1997",className:"py-2 px-4",children:[(()=>{const C=(l.lessons||[]).filter(S=>U||!S.isArchived);return C.length===0?e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2001",className:"text-sm text-muted-foreground py-2",children:"ÙØ§ ØªÙØ¬Ø¯ Ø¯Ø±ÙØ³ ÙÙ ÙØ°Ø§ اÙÙØ³Ù
"}):e.jsx(Oc,{"data-loc":"client/src/pages/RecordedCourses.tsx:2003",sensors:_r,collisionDetection:Oa,onDragEnd:$r(l.id,C),children:e.jsx(qc,{"data-loc":"client/src/pages/RecordedCourses.tsx:2008",items:C.map(S=>S.id),strategy:Qc,children:e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2012",className:"space-y-1",children:C.map((S,Z)=>e.jsx(io,{"data-loc":"client/src/pages/RecordedCourses.tsx:2014",lesson:S,lIdx:Z,isEditing:R?.id===S.id,onEdit:()=>{b(S),y({title:S.title||"",description:S.description||"",videoUrl:S.videoUrl||"",duration:S.duration||0,isFreePreview:S.isFreePreview||!1,lessonType:S.lessonType||"video",videoSource:S.videoSource||"upload",textContent:S.textContent||"",documentUrl:S.documentUrl||"",documentType:S.documentType||"pdf",documentName:S.documentName||""})},onDelete:()=>{confirm("ØØ°Ù ÙØ°Ø§ Ø§ÙØ¯Ø±Ø³Ø")&&Ds.mutate({id:S.id,courseId:s})},onArchive:()=>{S.isArchived?dt.mutate({id:S.id,courseId:s}):lt.mutate({id:S.id,courseId:s})},onMove:D=>{it.mutate({lessonId:S.id,targetSectionId:D,sortOrder:0})},onResources:()=>{ne(S),he(!0),ye(""),Se(""),te(""),Re("files")},onAiQuiz:()=>{le(S),x(!0),Me([]),ze(5),Ss("mixed")},sections:Oe?.sections,currentSectionId:l.id,children:R?.id===S.id&&e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2070",ref:A,className:"mt-2 mb-2 mx-3 p-3 border border-primary/30 rounded-lg space-y-3 bg-primary/5",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2071",className:"flex items-center justify-between",children:[e.jsxs("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:2072",className:"text-sm font-semibold text-primary",children:[R.lessonType==="quiz"?"تعدÙÙ Ø§ÙØ§Ø®ØªØ¨Ø§Ø±":"تعدÙÙ Ø§ÙØ¯Ø±Ø³",": ",R.title]}),e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2075",size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:()=>b(null),children:e.jsx(As,{"data-loc":"client/src/pages/RecordedCourses.tsx:2076",className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2079",className:"grid gap-2",children:[e.jsxs(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2080",children:["عÙÙØ§Ù ",R.lessonType==="quiz"?"Ø§ÙØ§Ø®ØªØ¨Ø§Ø±":"Ø§ÙØ¯Ø±Ø³"," *"]}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2081",value:N.title,onChange:D=>y(B=>({...B,title:D.target.value}))})]}),N.lessonType==="video"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2086",className:"grid gap-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2087",children:"Ù
صدر اÙÙÙØ¯ÙÙ"}),e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2088",className:"flex gap-2",children:["upload","youtube","vimeo"].map(D=>e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2090",type:"button",size:"sm",variant:N.videoSource===D?"default":"outline",onClick:()=>y(B=>({...B,videoSource:D})),className:"text-xs",children:D==="upload"?"Ø±ÙØ¹ Ù
Ù Ø§ÙØ¬Ùاز":D==="youtube"?"YouTube":"Vimeo"},D))})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2099",className:"grid gap-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2100",children:"رابط اÙÙÙØ¯ÙÙ"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2101",value:N.videoUrl,onChange:D=>y(B=>({...B,videoUrl:D.target.value})),dir:"ltr"})]}),(N.videoSource==="vimeo"||N.videoSource==="youtube")&&N.videoUrl&&e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2105",type:"button",size:"sm",variant:"outline",className:"text-xs w-fit",disabled:es.isPending,onClick:()=>{es.mutate({videoUrl:N.videoUrl,videoSource:N.videoSource},{onSuccess:D=>{D.duration>0?(y(B=>({...B,duration:D.duration})),w.success(`تÙ
Ø§ÙØªØ´Ø§Ù اÙÙ
دة: ${Math.floor(D.duration/60)}:${String(D.duration%60).padStart(2,"0")}`)):w.error("ÙÙ
ÙØªÙ
Ø§ÙØ¹Ø«Ùر عÙÙ Ù
دة اÙÙÙØ¯ÙÙ")},onError:D=>w.error(D.message)})},children:[es.isPending?e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:2128",className:"h-3.5 w-3.5 animate-spin ml-1"}):null,"Ø§ÙØªØ´Ø§Ù اÙÙ
دة تÙÙØ§Ø¦ÙاÙ"]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2132",className:"grid gap-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2133",children:"اÙÙ
دة (Ø¨Ø§ÙØ«ÙاÙÙ)"}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2134",className:"flex items-center gap-2",children:[e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2135",type:"number",value:N.duration||"",onChange:D=>y(B=>({...B,duration:parseInt(D.target.value)||0})),className:"w-40"}),N.duration>0&&e.jsxs("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:2137",className:"text-xs text-muted-foreground",children:["(",Math.floor(N.duration/60),":",String(N.duration%60).padStart(2,"0")," دÙÙÙØ©)"]})]})]})]}),N.lessonType==="text"&&e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2147",className:"grid gap-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2148",children:"اÙÙ
ØØªÙ٠اÙÙØµÙ"}),e.jsx(Xe,{"data-loc":"client/src/pages/RecordedCourses.tsx:2149",value:N.textContent,onChange:D=>y(B=>({...B,textContent:D.target.value})),rows:4})]}),N.lessonType==="document"&&e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2154",className:"space-y-3",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2155",children:"Ø±ÙØ¹ اÙÙ
Ø³ØªÙØ¯ *"}),N.documentUrl?e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2157",className:"flex items-center gap-3 p-3 rounded-lg border bg-green-50 dark:bg-green-950/20",children:[e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2158",className:"flex-shrink-0 w-10 h-10 rounded-lg bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:e.jsx(Rs,{"data-loc":"client/src/pages/RecordedCourses.tsx:2159",className:"h-5 w-5 text-green-600"})}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2161",className:"flex-1 min-w-0",children:[e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2162",className:"text-sm font-medium truncate",children:N.documentName||"Ù
Ø³ØªÙØ¯ Ù
رÙÙØ¹"}),e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2163",className:"text-xs text-green-600 dark:text-green-400",children:"تÙ
Ø§ÙØ±Ùع Ø¨ÙØ¬Ø§Ø"})]}),e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2165",size:"sm",variant:"ghost",className:"text-red-500",onClick:()=>y(D=>({...D,documentUrl:"",documentName:""})),children:e.jsx(As,{"data-loc":"client/src/pages/RecordedCourses.tsx:2166",className:"h-4 w-4"})})]}):e.jsxs("label",{"data-loc":"client/src/pages/RecordedCourses.tsx:2170",className:"cursor-pointer",children:[e.jsx("input",{"data-loc":"client/src/pages/RecordedCourses.tsx:2171",type:"file",accept:".pdf,.doc,.docx,.png,.jpg,.jpeg,.gif,.webp",className:"hidden",onChange:D=>Pt(D,!0),disabled:$}),e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2178",className:`flex flex-col items-center gap-2 p-6 border-2 border-dashed rounded-lg transition-colors ${$?"border-primary/50 bg-primary/5":"border-muted-foreground
5/30 hover:border-primary/50 hover:bg-accent/50"}`,children:$?e.jsxs(e.Fragment,{children:[e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:2183",className:"h-8 w-8 animate-spin text-primary"}),e.jsx("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:2184",className:"text-sm text-muted-foreground",children:"Ø¬Ø§Ø±Ù Ø±ÙØ¹ اÙÙ
Ø³ØªÙØ¯..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(gs,{"data-loc":"client/src/pages/RecordedCourses.tsx:2188",className:"h-8 w-8 text-muted-foreground/50"}),e.jsx("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:2189",className:"text-sm font-medium",children:"اضغط ÙØ§Ø®ØªÙار Ù
Ø³ØªÙØ¯ Ù
Ù Ø¬ÙØ§Ø²Ù"}),e.jsx("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:2190",className:"text-xs text-muted-foreground",children:"PDF, Word, ØµÙØ± (ØØ¯ Ø£ÙØµÙ 50 Ù
ÙØºØ§Ø¨Ø§Ùت)"})]})})]})]}),N.lessonType==="quiz"&&R.quiz&&e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2200",className:"space-y-3 p-3 bg-amber-50 border border-amber-200 rounded-lg",children:[e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2201",className:"text-sm font-medium text-amber-800",children:"إعدادات Ø§ÙØ§Ø®ØªØ¨Ø§Ø±"}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2202",className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2203",className:"grid gap-1",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2204",className:"text-xs",children:"درجة اÙÙØ¬Ø§Ø (%)"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2205",type:"number",min:0,max:100,defaultValue:R.quiz.passingScore||70,onChange:D=>R.quiz._passingScore=parseInt(D.target.value)||70})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2208",className:"grid gap-1",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2209",className:"text-xs",children:"عدد اÙÙ
ØØ§ÙÙØ§Øª"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2210",type:"number",min:1,defaultValue:R.quiz.maxAttempts||3,onChange:D=>R.quiz._maxAttempts=parseInt(D.target.value)||3})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2213",className:"grid gap-1",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2214",className:"text-xs",children:"اÙÙÙØª اÙÙ
ØØ¯Ø¯ (Ø¯ÙØ§Ø¦ÙØ 0 = بدÙÙ ØØ¯)"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2215",type:"number",min:0,defaultValue:R.quiz.timeLimit||0,onChange:D=>R.quiz._timeLimit=parseInt(D.target.value)||0})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2219",className:"flex items-center gap-4 text-sm",children:[e.jsxs("label",{"data-loc":"client/src/pages/RecordedCourses.tsx:2220",className:"flex items-center gap-1",children:[e.jsx("input",{"data-loc":"client/src/pages/RecordedCourses.tsx:2221",type:"checkbox",defaultChecked:R.quiz.shuffleQuestions||!1,onChange:D=>R.quiz._shuffleQuestions=D.target.checked}),"Ø®ÙØ· Ø§ÙØ£Ø³Ø¦ÙØ©"]}),e.jsxs("label",{"data-loc":"client/src/pages/RecordedCourses.tsx:2225",className:"flex items-center gap-1",children:[e.jsx("input",{"data-loc":"client/src/pages/RecordedCourses.tsx:2226",type:"checkbox",defaultChecked:R.quiz.showCorrectAnswers!==!1,onChange:D=>R.quiz._showCorrectAnswers=D.target.checked}),"Ø¥Ø¸ÙØ§Ø± Ø§ÙØ¥Ø¬Ø§Ø¨Ø§Øª Ø§ÙØµØÙØØ©"]})]}),e.jsxs("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2231",className:"text-xs text-amber-600",children:["عدد Ø§ÙØ£Ø³Ø¦ÙØ©: ",R.quiz.questions?.length||0," - ÙØ¥Ø¯Ø§Ø±Ø© Ø§ÙØ£Ø³Ø¦ÙØ© استخدÙ
ÙÙØØ© اÙÙ
درب"]})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2235",className:"grid gap-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2236",children:"ÙØµÙ (Ø§Ø®ØªÙØ§Ø±Ù)"}),e.jsx(Xe,{"data-loc":"client/src/pages/RecordedCourses.tsx:2237",value:N.description,onChange:D=>y(B=>({...B,description:D.target.value})),rows:2})]}),e.jsxs("label",{"data-loc":"client/src/pages/RecordedCourses.tsx:2240",className:"flex items-center gap-2 text-sm",children:[e.jsx("input",{"data-loc":"client/src/pages/RecordedCourses.tsx:2241",type:"checkbox",checked:N.isFreePreview,onChange:D=>y(B=>({...B,isFreePreview:D.target.checked}))}),"Ù
عاÙÙØ© Ù
جاÙÙØ©"]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2246",className:"flex gap-2",children:[e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2247",size:"sm",disabled:Cs.isPending||Ts.isPending,onClick:()=>
5{if(!N.title.trim()){w.error("Ø§ÙØ¹ÙÙØ§Ù Ù
Ø·ÙÙØ¨");return}if(Cs.mutate({id:R.id,courseId:s,title:N.title,description:N.description||void 0,videoUrl:N.lessonType==="video"?N.videoUrl:void 0,videoSource:N.lessonType==="video"?N.videoSource:void 0,duration:N.lessonType==="video"?N.duration:void 0,textContent:N.lessonType==="text"?N.textContent:void 0,documentUrl:N.lessonType==="document"?N.documentUrl:void 0,documentType:N.lessonType==="document"?N.documentType||"pdf":void 0,documentName:N.lessonType==="document"?N.documentName:void 0,isFreePreview:N.isFreePreview}),R.lessonType==="quiz"&&R.quiz){const D=R.quiz;Ts.mutate({id:D.id,title:N.title,description:N.description||void 0,passingScore:D._passingScore??D.passingScore,maxAttempts:D._maxAttempts??D.maxAttempts,timeLimit:D._timeLimit??D.timeLimit,shuffleQuestions:D._shuffleQuestions??D.shuffleQuestions,showCorrectAnswers:D._showCorrectAnswers??D.showCorrectAnswers})}},children:[Cs.isPending||Ts.isPending?e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:2278",className:"h-4 w-4 animate-spin ml-1"}):null,"ØÙظ Ø§ÙØªØ¹Ø¯ÙÙØ§Øª"]}),e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2281",size:"sm",variant:"outline",onClick:()=>b(null),children:"Ø¥ÙØºØ§Ø¡"})]})]})},S.id))})})})})(),d===l.id&&e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2295",className:"mt-3 p-3 border rounded-lg space-y-3 bg-muted/30",children:[e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2296",placeholder:"عÙÙØ§Ù Ø§ÙØ¯Ø±Ø³",value:j.title,onChange:C=>h(S=>({...S,title:C.target.value}))}),e.jsx(Xe,{"data-loc":"client/src/pages/RecordedCourses.tsx:2301",placeholder:"ÙØµÙ Ø§ÙØ¯Ø±Ø³ (Ø§Ø®ØªÙØ§Ø±Ù)",value:j.description,onChange:C=>h(S=>({...S,description:C.target.value})),rows:2}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2309",className:"flex gap-2",children:[e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2310",type:"button",size:"sm",variant:j.lessonType==="video"?"default":"outline",onClick:()=>h(C=>({...C,lessonType:"video"})),className:"flex items-center gap-1",children:[e.jsx(Dt,{"data-loc":"client/src/pages/RecordedCourses.tsx:2317",className:"h-3.5 w-3.5"})," ÙÙØ¯ÙÙ"]}),e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2319",type:"button",size:"sm",variant:j.lessonType==="quiz"?"default":"outline",onClick:()=>h(C=>({...C,lessonType:"quiz"})),className:"flex items-center gap-1",children:[e.jsx(Ps,{"data-loc":"client/src/pages/RecordedCourses.tsx:2326",className:"h-3.5 w-3.5"})," اختبار"]}),e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2328",type:"button",size:"sm",variant:j.lessonType==="text"?"default":"outline",onClick:()=>h(C=>({...C,lessonType:"text"})),className:"flex items-center gap-1",children:[e.jsx(Rs,{"data-loc":"client/src/pages/RecordedCourses.tsx:2335",className:"h-3.5 w-3.5"})," Ù
ØØªÙÙ ÙØµÙ"]}),e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2337",type:"button",size:"sm",variant:j.lessonType==="document"?"default":"outline",onClick:()=>h(C=>({...C,lessonType:"document"})),className:"flex items-center gap-1",children:[e.jsx(gs,{"data-loc":"client/src/pages/RecordedCourses.tsx:2344",className:"h-3.5 w-3.5"})," Ù
Ø³ØªÙØ¯ PDF"]})]}),j.lessonType==="video"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2352",className:"flex gap-2",children:[e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2353",type:"button",size:"sm",variant:j.videoSource==="upload"?"default":"outline",onClick:()=>h(C=>({...C,videoSource:"upload"})),className:"text-xs",children:"Ø±ÙØ¹ Ù
Ù Ø§ÙØ¬Ùاز"}),e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2362",type:"button",size:"sm",variant:j.videoSource==="youtube"?"default":"outline",onClick:()=>h(C=>({...C,videoSource:"youtube"})),className:"text-xs",children:"YouTube"}),e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2371",type:"button",size:"sm",variant:j.videoSource==="vimeo"?"default":"outline",onClick:()=>h(C=>({...C,videoSource:"vimeo"})),className:"text-xs",children:"Vimeo"})]}),j.videoSource==="upload"?e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2383",placeholder:"رابط اÙÙÙØ¯ÙÙ (بعد Ø§ÙØ±Ùع)",value:j.videoUrl,onChange:C=>h(S=>({...S,videoUrl:C.target.value}))}):j.videoSource==="youtube"?e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2389",placeholder:"رابط YouTube (Ù
ثاÙ: https://www.youtube.com/watch?v=xxxxx)",value:j.videoUrl,onChange:C=>h(S=>({...S,videoUrl:C.target.value}))}):e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2395",placeholder:"رابط Vimeo (Ù
ثاÙ: https://vimeo.com/123456789)",value:j.videoUrl,onChange:C=>h(S=>({...S,videoUrl:C.target.value}))}),(j.videoSource==="vimeo"||j.videoSource==="youtube")&&j.videoUrl&&e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2404",type:"button",size:"sm",variant:"outline",className:"text-xs",disabled:es.isPending,onClick:()=>{es.mutate({videoUrl:j.videoUrl,videoSource:j.videoSource},{onSuccess:C=>{C.duration>0?(h(S=>({...S,duration:C.duration})),w.success(`تÙ
Ø§ÙØªØ´Ø§Ù اÙÙ
دة: ${Math.floor(C.duration/60)}:${String(C.duration%60).padStart(2,"0")}`)):w.error("ÙÙ
ÙØªÙ
Ø§ÙØ¹Ø«Ùر عÙÙ Ù
دة اÙÙÙØ¯ÙÙ")},onError:C=>w.error(C.message)})},children:[es.isPending?e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:2427",className:"h-3.5 w-3.5 animate-spin ml-1"}):null,"Ø§ÙØªØ´Ø§Ù اÙÙ
دة تÙÙØ§Ø¦ÙاÙ"]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2432",className:"flex items-center gap-2",children:[e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2433",type:"number",placeholder:"اÙÙ
دة (Ø¨Ø§ÙØ«ÙاÙÙ)",value:j.duration||"",onChange:C=>h(S=>({...S,duration:parseInt(C.target.value)||0})),className:"w-40"}),j.duration>0&&e.jsxs("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:2441",className:"text-xs text-muted-foreground",children:["(",Math.floor(j.duration/60),":",String(j.duration%60).padStart(2,"0")," دÙÙÙØ©)"]})]})]}),j.lessonType==="text"&&e.jsx(Xe,{"data-loc":"client/src/pages/RecordedCourses.tsx:2451",placeholder:"Ø§ÙØªØ¨ اÙÙ
ØØªÙ٠اÙÙØµÙ ÙÙØ§ (ÙØ¯Ø¹Ù
HTML)",value:j.textContent,onChange:C=>h(S=>({...S,textContent:C.target.value})),rows:6}),j.lessonType==="document"&&e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2461",className:"space-y-3",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2462",children:"Ø±ÙØ¹ اÙÙ
Ø³ØªÙØ¯ *"}),j.documentUrl?e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2464",className:"flex items-center gap-3 p-3 rounded-lg border bg-green-50 dark:bg-green-950/20",children:[e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2465",className:"flex-shrink-0 w-10 h-10 rounded-lg bg-green-100 dark:bg-green-900/30 flex items-center justify-center",children:e.jsx(Rs,{"data-loc":"client/src/pages/RecordedCourses.tsx:2466",className:"h-5 w-5 text-green-600"})}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2468",className:"flex-1 min-w-0",children:[e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2469",className:"text-sm font-medium truncate",children:j.documentName||"Ù
Ø³ØªÙØ¯ Ù
رÙÙØ¹"}),e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2470",className:"text-xs text-green-600 dark:text-green-400",children:"تÙ
Ø§ÙØ±Ùع Ø¨ÙØ¬Ø§Ø"})]}),e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2472",size:"sm",variant:"ghost",className:"text-red-500",onClick:()=>h(C=>({...C,documentUrl:"",documentName:""})),children:e.jsx(As,{"data-loc":"client/src/pages/RecordedCourses.tsx:2473",className:"h-4 w-4"})})]}):e.jsxs("label",{"data-loc":"client/src/pages/RecordedCourses.tsx:2477",className:"cursor-pointer",children:[e.jsx("input",{"data-loc":"client/src/pages/RecordedCourses.tsx:2478",type:"file",accept:".pdf,.doc,.docx,.png,.jpg,.jpeg,.gif,.webp",className:"hidden",onChange:C=>Pt(C,!1),disabled:V}),e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2485",className:`flex flex-col items-center gap-2 p-6 border-2 border-dashed rounded-lg transition-colors ${V?"border-primary/50 bg-primary/5":"border-muted-foreground
5/30 hover:border-primary/50 hover:bg-accent/50"}`,children:V?e.jsxs(e.Fragment,{children:[e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:2490",className:"h-8 w-8 animate-spin text-primary"}),e.jsx("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:2491",className:"text-sm text-muted-foreground",children:"Ø¬Ø§Ø±Ù Ø±ÙØ¹ اÙÙ
Ø³ØªÙØ¯..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(gs,{"data-loc":"client/src/pages/RecordedCourses.tsx:2495",className:"h-8 w-8 text-muted-foreground/50"}),e.jsx("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:2496",className:"text-sm font-medium",children:"اضغط ÙØ§Ø®ØªÙار Ù
Ø³ØªÙØ¯ Ù
Ù Ø¬ÙØ§Ø²Ù"}),e.jsx("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:2497",className:"text-xs text-muted-foreground",children:"PDF, Word, ØµÙØ± (ØØ¯ Ø£ÙØµÙ 50 Ù
ÙØºØ§Ø¨Ø§Ùت)"})]})})]})]}),j.lessonType==="quiz"&&e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2508",className:"p-3 bg-amber-50 border border-amber-200 rounded-lg text-sm text-amber-700",children:[e.jsx(Ps,{"data-loc":"client/src/pages/RecordedCourses.tsx:2509",className:"h-4 w-4 inline ml-1"}),"Ø³ÙØªÙ
Ø¥ÙØ´Ø§Ø¡ Ø§ÙØ§Ø®ØªØ¨Ø§Ø± بعد Ø¥Ø¶Ø§ÙØ© Ø§ÙØ¯Ø±Ø³. ÙÙ
ÙÙÙ Ø¥Ø¶Ø§ÙØ© Ø§ÙØ£Ø³Ø¦ÙØ© ÙØ§ØÙا٠Ù
Ù ØµÙØØ© إدارة Ø§ÙØ¯Ùرة."]}),e.jsxs("label",{"data-loc":"client/src/pages/RecordedCourses.tsx:2514",className:"flex items-center gap-2 text-sm",children:[e.jsx("input",{"data-loc":"client/src/pages/RecordedCourses.tsx:2515",type:"checkbox",checked:j.isFreePreview,onChange:C=>h(S=>({...S,isFreePreview:C.target.checked}))}),"Ù
عاÙÙØ© Ù
جاÙÙØ©"]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2523",className:"flex gap-2",children:[e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2524",size:"sm",onClick:()=>{if(!j.title){w.error("عÙÙØ§Ù Ø§ÙØ¯Ø±Ø³ Ù
Ø·ÙÙØ¨");return}qs.mutate({sectionId:l.id,courseId:s,title:j.title,description:j.description,lessonType:j.lessonType,videoUrl:j.lessonType==="video"?j.videoUrl:void 0,videoSource:j.lessonType==="video"?j.videoSource:void 0,duration:j.lessonType==="video"?j.duration:void 0,textContent:j.lessonType==="text"?j.textContent:void 0,documentUrl:j.lessonType==="document"?j.documentUrl:void 0,documentType:j.lessonType==="document"?"pdf":void 0,documentName:j.lessonType==="document"?j.documentName:void 0,isFreePreview:j.isFreePreview,sortOrder:l.lessons?.length||0})},disabled:qs.isPending,children:"Ø¥Ø¶Ø§ÙØ© Ø§ÙØ¯Ø±Ø³"}),e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2549",size:"sm",variant:"outline",onClick:()=>i(null),children:"Ø¥ÙØºØ§Ø¡"})]})]})]})]},l.id)),c?e.jsx($e,{"data-loc":"client/src/pages/RecordedCourses.tsx:2560",children:e.jsxs(Be,{"data-loc":"client/src/pages/RecordedCourses.tsx:2561",className:"p-4 space-y-3",children:[e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2562",placeholder:"عÙÙØ§Ù اÙÙØ³Ù
Ø§ÙØ¬Ø¯Ùد",value:p,onChange:l=>u(l.target.value)}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2567",className:"flex gap-2",children:[e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2568",size:"sm",onClick:()=>{if(!p){w.error("عÙÙØ§Ù اÙÙØ³Ù
Ù
Ø·ÙÙØ¨");return}Es.mutate({courseId:s,title:p,sortOrder:Oe?.sections?.length||0})},disabled:Es.isPending,children:"Ø¥Ø¶Ø§ÙØ© اÙÙØ³Ù
"}),e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2582",size:"sm",variant:"outline",onClick:()=>o(!1),children:"Ø¥ÙØºØ§Ø¡"})]})]})}):e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2587",variant:"outline",className:"w-full",onClick:()=>o(!0),children:[e.jsx(Js,{"data-loc":"client/src/pages/RecordedCourses.tsx:2588",className:"h-4 w-4 ml-1"}),"Ø¥Ø¶Ø§ÙØ© ÙØ³Ù
Ø¬Ø¯ÙØ¯"]})]})]})}),e.jsx(os,{"data-loc":"client/src/pages/RecordedCourses.tsx:2598",open:se,onOpenChange:l=>{he(l),l||ne(null)},children:e.jsxs(ns,{"data-loc":"client/src/pages/RecordedCourses.tsx:2599",className:"max-w-[90vw] w-[90vw] max-h-[90vh] overflow-y-auto",dir:"rtl",children:[e.jsx(ls,{"data-loc":"client/src/pages/RecordedCourses.tsx:2600",children:e.jsxs(ds,{"data-loc":"client/src/pages/RecordedCourses.tsx:2601",className:"flex items-center gap-2",children:[e.jsx(bt,{"data-loc":"client/src/pages/RecordedCourses.tsx:2602",className:"h-5 w-5 text-emerald-600"}),"اÙÙ
صادر اÙÙ
عرÙÙØ© - ",J?.title]})}),e.jsxs(Hr,{"data-loc":"client/src/pages/RecordedCourses.tsx:2607",value:G,onValueChange:l=>Re(l),dir:"rtl",children:[e.jsxs(Gr,{"data-loc":"client/src/pages/RecordedCourses.tsx:2608",className:"grid w-full grid-cols-2",children:[e.jsxs(_t,{"data-loc":"client/src/pages/RecordedCourses.tsx:2609",value:"files",className:"flex items-center gap-1",children:[e.jsx(gs,{"data-loc":"client/src/pages/RecordedCourses.tsx:2610",className:"h-4 w-4"})," Ø±ÙØ¹ Ù
ÙÙ"]}),e.jsxs(_t,{"data-loc":"client/src/pages/RecordedCourses.tsx:2612",value:"link",className:"flex items-center gap-1",children:[e.jsx(Qt,{"data-loc":"client/src/pages/RecordedCourses.tsx:2613",className:"h-4 w-4"})," Ø¥Ø¶Ø§ÙØ© رابط"]})]}),e.jsxs($t,{"data-loc":"client/src/pages/RecordedCourses.tsx:2617",value:"files",className:"space-y-3 mt-3",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2618",className:"grid gap-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2619",children:"عÙÙØ§Ù اÙÙ
صدر (Ø§Ø®ØªÙØ§Ø±Ù - Ø³ÙØ³ØªØ®Ø¯Ù
اسÙ
اÙÙ
ÙÙ Ø¥Ù ØªØ±Ù ÙØ§Ø±ØºØ§Ù)"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2620",value:H,onChange:l=>ye(l.target.value),placeholder:"Ù
ثاÙ: Ù
ÙØ®Øµ Ø§ÙØ¯Ø±Ø³"})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2626",className:"grid gap-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2627",children:"ÙØµÙ (Ø§Ø®ØªÙØ§Ø±Ù)"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2628",value:ie,onChange:l=>Se(l.target.value),placeholder:"ÙØµÙ Ù
ختصر ÙÙÙ
صدر"})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2634",className:"grid gap-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2635",children:"اختر Ù
ÙÙ"}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2636",className:"flex items-center gap-2",children:[e.jsx("input",{"data-loc":"client/src/pages/RecordedCourses.tsx:2637",ref:Ee,type:"file",accept:".pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.jpg,.jpeg,.png,.gif,.mp3,.mp4,.wav,.zip,.rar",onChange:Ae,className:"hidden",id:"resource-file-input"}),e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2645",variant:"outline",className:"w-full h-20 border-dashed flex flex-col items-center gap-2",onClick:()=>Ee.current?.click(),disabled:me,children:me?e.jsxs(e.Fragment,{children:[e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:2652",className:"h-6 w-6 animate-spin"})," Ø¬Ø§Ø±Ù Ø§ÙØ±Ùع..."]}
5):e.jsxs(e.Fragment,{children:[e.jsx(gs,{"data-loc":"client/src/pages/RecordedCourses.tsx:2654",className:"h-6 w-6"})," اضغط ÙØ§Ø®ØªÙار Ù
ÙÙ (PDF, Word, Excel, ØµÙØ±, ÙÙØ¯ÙÙ...)"]})})]}),e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2658",className:"text-xs text-muted-foreground",children:"Ø§ÙØØ¯ Ø§ÙØ£ÙØµÙ ÙØØ¬Ù
اÙÙ
ÙÙ: 50 Ù
ÙØºØ§Ø¨Ø§Ùت"})]})]}),e.jsxs($t,{"data-loc":"client/src/pages/RecordedCourses.tsx:2662",value:"link",className:"space-y-3 mt-3",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2663",className:"grid gap-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2664",children:"عÙÙØ§Ù Ø§ÙØ±Ø§Ø¨Ø· *"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2665",value:H,onChange:l=>ye(l.target.value),placeholder:"Ù
ثاÙ: Ù
ÙØ§Ù Ù
رجعÙ"})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2671",className:"grid gap-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2672",children:"Ø§ÙØ±Ø§Ø¨Ø· *"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2673",value:Ie,onChange:l=>te(l.target.value),placeholder:"https://example.com/resource",dir:"ltr"})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2680",className:"grid gap-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2681",children:"ÙØµÙ (Ø§Ø®ØªÙØ§Ø±Ù)"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2682",value:ie,onChange:l=>Se(l.target.value),placeholder:"ÙØµÙ Ù
ختصر ÙÙØ±Ø§Ø¨Ø·"})]}),e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2688",onClick:ss,disabled:xe.isPending||!H||!Ie,className:"w-full",children:[xe.isPending?e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:2693",className:"h-4 w-4 animate-spin ml-2"}):e.jsx(Qt,{"data-loc":"client/src/pages/RecordedCourses.tsx:2693",className:"h-4 w-4 ml-2"}),"Ø¥Ø¶Ø§ÙØ© Ø§ÙØ±Ø§Ø¨Ø·"]})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2700",className:"mt-4",children:[e.jsxs("h4",{"data-loc":"client/src/pages/RecordedCourses.tsx:2701",className:"text-sm font-semibold mb-2 flex items-center gap-2",children:[e.jsx(Zs,{"data-loc":"client/src/pages/RecordedCourses.tsx:2702",className:"h-4 w-4"}),"اÙÙ
صادر اÙÙ
رÙÙØ© (",Y.data?.length||0,")"]}),Y.isLoading?e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2706",className:"flex items-center justify-center py-6",children:e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:2707",className:"h-5 w-5 animate-spin text-muted-foreground"})}):Y.data?.length?e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2715",className:"space-y-2",children:Y.data.map(l=>e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2717",className:"flex items-center justify-between p-2.5 rounded-lg border hover:bg-muted/30 transition-colors",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2718",className:"flex items-center gap-2 flex-1 min-w-0",children:[ae(l),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2720",className:"flex-1 min-w-0",children:[e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2721",className:"text-sm font-medium truncate",children:l.title}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2722",className:"flex items-center gap-2 text-xs text-muted-foreground",children:[l.resourceType==="file"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:2725",children:l.fileName}),l.fileSize&&e.jsxs("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:2726",children:["· ",Fe(l.fileSize)]})]}),l.resourceType==="link"&&e.jsx("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:2730",className:"truncate",dir:"ltr",children:l.linkUrl})]}),l.description&&e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2734",className:"text-xs text-muted-foreground mt-0.5",children:l.description})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2738",className:"flex items-center gap-1 mr-2",children:[l.resourceType==="file"&&l.fileUrl&&e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2740",size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-blue-600",title:"تØÙ
ÙÙ",onClick:()=>window.open(l.fileUrl,"_blank"),children:e.jsx(na,{"data-loc":"client/src/pages/RecordedCourses.tsx:2747",className:"h-3.5 w-3.5"})}),l.resourceType==="link"&&l.linkUrl&&e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2751",size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-blue-600",title:"ÙØªØ Ø§ÙØ±Ø§Ø¨Ø·",onClick:()=>window.open(l.linkUrl,"_blank"),children:e.jsx(Wt,{"data-loc":"client/src/pages/RecordedCourses.tsx:2758",className:"h-3.5 w-3.5"})}),e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2761",
5size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-amber-600",title:"تعدÙÙ",onClick:()=>{ue(l),De(l.title||""),Te(l.description||""),je(l.linkUrl||"")},children:e.jsx(js,{"data-loc":"client/src/pages/RecordedCourses.tsx:2773",className:"h-3.5 w-3.5"})}),e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2775",size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-destructive",title:"ØØ°Ù",onClick:()=>{confirm("ÙÙ Ø£ÙØª Ù
ØªØ£ÙØ¯ Ù
Ù ØØ°Ù ÙØ°Ø§ اÙÙ
صدرØ")&&Ye.mutate({id:l.id})},children:e.jsx(Ls,{"data-loc":"client/src/pages/RecordedCourses.tsx:2786",className:"h-3.5 w-3.5"})})]})]},l.id))}):e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2710",className:"text-center py-6 text-muted-foreground text-sm border rounded-lg border-dashed",children:[e.jsx(bt,{"data-loc":"client/src/pages/RecordedCourses.tsx:2711",className:"h-8 w-8 mx-auto mb-2 opacity-30"}),"ÙØ§ ØªÙØ¬Ø¯ Ù
صادر Ù
رÙÙØ© بعد"]})]})]})}),e.jsx(os,{"data-loc":"client/src/pages/RecordedCourses.tsx:2798",open:!!K,onOpenChange:l=>{l||(ue(null),De(""),Te(""),je(""))},children:e.jsxs(ns,{"data-loc":"client/src/pages/RecordedCourses.tsx:2799",className:"max-w-md",dir:"rtl",children:[e.jsx(ls,{"data-loc":"client/src/pages/RecordedCourses.tsx:2800",children:e.jsxs(ds,{"data-loc":"client/src/pages/RecordedCourses.tsx:2801",className:"flex items-center gap-2",children:[e.jsx(js,{"data-loc":"client/src/pages/RecordedCourses.tsx:2802",className:"h-5 w-5 text-amber-600"}),"تعدÙ٠اÙÙ
صدر"]})}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2806",className:"space-y-4 py-2",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2807",className:"space-y-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2808",children:"عÙÙØ§Ù اÙÙ
صدر *"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2809",value:_,onChange:l=>De(l.target.value),placeholder:"عÙÙØ§Ù اÙÙ
صدر",dir:"rtl"})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2816",className:"space-y-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2817",children:"اÙÙØµÙ (Ø§Ø®ØªÙØ§Ø±Ù)"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2818",value:pe,onChange:l=>Te(l.target.value),placeholder:"ÙØµÙ Ù
ختصر ÙÙÙ
صدر",dir:"rtl"})]}),K?.resourceType==="link"&&e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2826",className:"space-y-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2827",children:"Ø§ÙØ±Ø§Ø¨Ø· Ø§ÙØ®Ø§Ø±Ø¬Ù *"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2828",value:fe,onChange:l=>je(l.target.value),placeholder:"https://example.com",dir:"ltr",className:"text-left"})]}),K?.resourceType==="file"&&e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2838",className:"p-3 bg-muted/30 rounded-lg text-sm text-muted-foreground",children:[e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2839",className:"font-medium mb-1",children:"Ù
عÙÙÙ
ات اÙÙ
ÙÙ"}),e.jsxs("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2840",children:["اسÙ
اÙÙ
ÙÙ: ",K?.fileName]}),K?.fileSize&&e.jsxs("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2841",children:["Ø§ÙØØ¬Ù
: ",Fe(K.fileSize)]})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2845",className:"flex gap-2 justify-end pt-2",children:[e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2846",variant:"outline",onClick:()=>ue(null),children:"Ø¥ÙØºØ§Ø¡"}),e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2847",onClick:ve,disabled:ge.isPending,className:"bg-amber-600 hover:bg-amber-700",children:[ge.isPending?e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:2852",className:"h-4 w-4 animate-spin ml-2"}):null,"ØÙظ Ø§ÙØªØ¹Ø¯ÙÙØ§Øª"]})]})]})}),e.jsx(os,{"data-loc":"client/src/pages/RecordedCourses.tsx:2860",open:hs,onOpenChange:l=>{x(l),l||(Me([]),le(null))},children:e.jsxs(ns,{"data-loc":"client/src/pages/RecordedCourses.tsx:2861",className:"max-w-[90vw] w-[90vw] max-h-[90vh] overflow-y-auto",dir:"rtl",children:[e.jsxs(ls,{"data-loc":"client/src/pages/RecordedCourses.tsx:2862",children:[e.jsxs(ds,{"data-loc":"client/src/pages/RecordedCourses.tsx:2863",className:"flex items-center gap-2",children:[e.jsx(Gs,{"data-loc":"client/src/pages/RecordedCourses.tsx:2864",className:"h-5 w-5 text-purple-600"}),"تÙÙÙØ¯ Ø£Ø³Ø¦ÙØ© Ø¨Ø§ÙØ°Ùاء Ø§ÙØ§ØµØ·ÙاعÙ"]}),Q&&e.jsxs("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2868",className:"text-sm text-muted-foreground mt-1",children:["Ø§ÙØ¯Ø±Ø³: ",Q.title]})]}),Qe.length===0&&!ms&&e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2874",className:"space-y-4 py-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2875",className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2876",className:"space-y-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2877",children:"عدد Ø§ÙØ£Ø³Ø¦ÙØ©"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:2878",type:"number",min:3,max:20,value:M,onChange:l=>ze(Math.max(3,Math.min(20,parseInt(l.target.value)||3)))}),e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2885",className:"text-xs text-muted-foreground",children:"Ø§ÙØØ¯ Ø§ÙØ£Ø¯ÙÙ 3 Ø£Ø³Ø¦ÙØ©Ø Ø§ÙØØ¯ Ø§ÙØ£Ùص٠20"})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2887",className:"space-y-2",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:2888",children:"ÙÙØ¹ Ø§ÙØ£Ø³Ø¦ÙØ©"}),e.jsxs(He,{"data-loc":"client/src/pages/RecordedCourses.tsx:2889",value:is,onValueChange:l=>Ss(l),children:[e.jsx(Ge,{"data-loc":"client/src/pages/RecordedCourses.tsx:2890",children:e.jsx(Ze,{"data-loc":"client/src/pages/RecordedCourses.tsx:2891"})}),e.jsxs(Ke,{"data-loc":"client/src/pages/RecordedCourses.tsx:2893",dir:"rtl",children:[e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:2894",value:"mixed",children:"Ù
Ø®ØªÙØ· (Ø§Ø®ØªÙØ§Ø± Ù
Ù Ù
تعدد + صØ/خطأ)"}),e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:2895",value:"multiple_choice",children:"Ø§Ø®ØªÙØ§Ø± Ù
Ù Ù
تعدد ÙÙØ·"}),e.jsx(W,{"data-loc":"client/src/pages/RecordedCourses.tsx:2896",value:"true_false",children:"ØµØ Ø£Ù Ø®Ø·Ø£ ÙÙØ·"})]})]})]})]}),e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2902",className:"bg-purple-50 dark:bg-purple-950/20 border border-purple-200 dark:border-purple-800 rounded-lg p-4",children:e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2903",className:"flex items-start gap-3",children:[e.jsx(la,{"data-loc":"client/src/pages/RecordedCourses.tsx:2904",className:"h-5 w-5 text-purple-600 mt-0.5"}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2905",children:[e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2906",className:"text-sm font-medium text-purple-800 dark:text-purple-200",children:"ÙÙÙ ÙØ¹Ù
ÙØ"}),e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2907",className:"text-xs text-purple-600 dar
5k:text-purple-400 mt-1",children:"سÙÙÙÙ
Ø§ÙØ°Ùاء Ø§ÙØ§ØµØ·Ùاع٠بتØÙÙ٠عÙÙØ§Ù Ø§ÙØ¯Ø±Ø³ ÙÙØµÙÙ ÙÙ
ØØªÙا٠اÙÙØµÙ ÙØªÙÙÙØ¯ Ø£Ø³Ø¦ÙØ© اختبار Ù
تÙÙØ¹Ø©. ÙÙ
ÙÙ٠تعدÙÙ Ø§ÙØ£Ø³Ø¦ÙØ© ÙØ§Ùإجابات ÙØ¨Ù اعتÙ
Ø§Ø¯ÙØ§."})]})]})}),e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2915",className:"w-full bg-purple-600 hover:bg-purple-700",onClick:xs,disabled:ms,children:[e.jsx(Gs,{"data-loc":"client/src/pages/RecordedCourses.tsx:2920",className:"h-4 w-4 ml-2"}),"تÙÙÙØ¯ Ø§ÙØ£Ø³Ø¦ÙØ©"]})]}),ms&&e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2928",className:"flex flex-col items-center justify-center py-12 gap-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2929",className:"relative",children:[e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:2930",className:"h-12 w-12 animate-spin text-purple-600"}),e.jsx(Gs,{"data-loc":"client/src/pages/RecordedCourses.tsx:2931",className:"h-5 w-5 text-purple-400 absolute -top-1 -right-1 animate-pulse"})]}),e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2933",className:"text-sm text-muted-foreground",children:"جار٠تÙÙÙØ¯ Ø§ÙØ£Ø³Ø¦ÙØ© Ø¨Ø§ÙØ°Ùاء Ø§ÙØ§ØµØ·ÙاعÙ..."}),e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2934",className:"text-xs text-muted-foreground",children:"ÙØ¯ ÙØ³ØªØºØ±Ù ÙØ°Ø§ بضع Ø«ÙØ§ÙÙ"})]}),Qe.length>0&&!ms&&e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2940",className:"space-y-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2941",className:"flex items-center justify-between",children:[e.jsxs("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2942",className:"text-sm font-medium",children:["تÙ
تÙÙÙØ¯ ",Qe.length," سؤاÙ"]}),e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2943",size:"sm",variant:"outline",onClick:()=>{Me([])},className:"text-xs",children:[e.jsx(jt,{"data-loc":"client/src/pages/RecordedCourses.tsx:2949",className:"h-3.5 w-3.5 ml-1"}),"إعادة Ø§ÙØªÙÙÙØ¯"]})]}),e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2954",className:"space-y-4",children:Qe.map((l,T)=>e.jsx($e,{"data-loc":"client/src/pages/RecordedCourses.tsx:2956",className:"border-r-4 border-r-purple-400",children:e.jsxs(Be,{"data-loc":"client/src/pages/RecordedCourses.tsx:2957",className:"p-4 space-y-3",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2958",className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2959",className:"flex items-center gap-2",children:[e.jsx(Le,{"data-loc":"client/src/pages/RecordedCourses.tsx:2960",variant:"outline",className:"text-xs",children:T+1}),e.jsx(Le,{"data-loc":"client/src/pages/RecordedCourses.tsx:2963",variant:"outline",className:`text-xs ${l.questionType==="true_false"?"bg-green-50 text-green-700":"bg-blue-50 text-blue-700"}`,children:l.questionType==="true_false"?"صØ/خطأ":"Ø§Ø®ØªÙØ§Ø± Ù
Ù Ù
تعدد"})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:2967",className:"flex items-center gap-1",children:[e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2968",size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>us(Pe===T?null:T),children:e.jsx(js,{"data-loc":"client/src/pages/RecordedCourses.tsx:2974",className:"h-3.5 w-3.5"})}),e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:2976",size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-destructive",onClick:()=>ps(T),children:e.jsx(Ls,{"data-loc":"client/src/pages/RecordedCourses.tsx:2982",className:"h-3.5 w-3.5"})})]})]}),Pe===T?e.jsx(Xe,{"data-loc":"client/src/pages/RecordedCourses.tsx:2989",value:l.questionText,onChange:C=>ts(T,"questionText",C.target.value),rows:2,className:"text-sm"}):e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:2996",className:"text-sm font-medium",children:l.questionText}),e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:3000",className:"space-y-2 mr-4",children:l.answers?.map((C,S)=>e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:3002",className:`flex items-center gap-2 p-2 rounded-lg text-sm ${C.isCorrect?"bg-green-50 dark:bg-green-950/20 border border-green-200":"bg-muted/50 border border-transparent"}`,children:Pe===T?e.jsxs(e.Fragment,{children:[e.jsx("input",{"data-loc":"client/src/pages/RecordedCourses.tsx:3007",type:"radio",name:`q-${T}-correct`,checked:C.isCorrect,onChange:()=>_e(T,S,"isCorrect",!0),className:"accent-green-600"}),e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:3014",value:C.answerText,onChange:Z=>_e(T,S,"answerText",Z.target.value),className:"text-sm h-8"})]}):e.jsxs(e.Fragment,{children:[C.isCorrect?e.jsx(vt,{"data-loc":"client/src/pages/RecordedCourses.tsx:3023",className:"h-4 w-4 text-green-600 flex-shrink-0"}):e.jsx("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:3025",className:"w-4 h-4 rounded-full border-2 border-muted-foreground
5/30 flex-shrink-0"}),e.jsx("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:3027",className:C.isCorrect?"text-green-700 dark:text-green-300 font-medium":"",children:C.answerText})]})},S))}),l.explanation&&e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:3036",className:"bg-amber-50 dark:bg-amber-950/20 border border-amber-200 dark:border-amber-800 rounded-lg p-3",children:Pe===T?e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:3038",children:[e.jsx(k,{"data-loc":"client/src/pages/RecordedCourses.tsx:3039",className:"text-xs text-amber-700",children:"Ø§ÙØ´Ø±Ø:"}),e.jsx(Xe,{"data-loc":"client/src/pages/RecordedCourses.tsx:3040",value:l.explanation,onChange:C=>ts(T,"explanation",C.target.value),rows:2,className:"text-xs mt-1"})]}):e.jsxs("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:3048",className:"text-xs text-amber-700 dark:text-amber-300",children:[e.jsx("strong",{"data-loc":"client/src/pages/RecordedCourses.tsx:3049",children:"Ø§ÙØ´Ø±Ø:"})," ",l.explanation]})})]})},T))}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:3060",className:"flex gap-3 pt-4 border-t",children:[e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:3061",className:"flex-1 bg-green-600 hover:bg-green-700",onClick:()=>{be.data?.id?ke.mutate({id:be.data.id,questions:Qe}):w.error("ÙØ§ ÙÙØ¬Ø¯ Ø³Ø¬Ù ÙØ§Ø¹ØªÙ
ادÙ")},disabled:ke.isPending||Qe.length===0,children:[ke.isPending?e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:3075",className:"h-4 w-4 animate-spin ml-2"}):e.jsx(vt,{"data-loc":"client/src/pages/RecordedCourses.tsx:3075",className:"h-4 w-4 ml-2"}),"اعتÙ
اد Ø§ÙØ£Ø³Ø¦ÙØ© (",Qe.length,")"]}),e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:3078",variant:"outline",onClick:()=>{x(!1),Me([]),le(null)},children:"Ø¥ÙØºØ§Ø¡"})]})]})]})})]})}function xo(){const s=P.recordedCourses.lessonsWithoutDuration.useQuery(),t=P.recordedCourses.bulkUpdateLessonDurations.useMutation({onSuccess:h=>{w.success(`تÙ
ØªØØ¯ÙØ« Ù
دة ${h.updatedCount} درس Ø¨ÙØ¬Ø§Ø`),s.refetch()},onError:h=>w.error(h.message)}),r=P.recordedCourses.lessons.fetchVideoDuration.useMutation(),[a,c]=n.useState(!1),[o,d]=n.useState({}),[i,p]=n.useState(new Set),u=n.useMemo(()=>(s.data||[]).filter(h=>h.lessonType==="video"),[s.data]),f=n.useMemo(()=>(s.data||[]).filter(h=>h.lessonType!=="video"),[s.data]);if(s.isLoading||!u.length)return null;const v=async h=>{if(!h.videoUrl||h.videoUrl==="NULL"||!h.videoSource||h.videoSource==="upload"){w.error("ÙØ°Ø§ Ø§ÙØ¯Ø±Ø³ ÙØ§ ÙØØªÙ٠عÙ٠رابط ÙÙØ¯Ù٠خارجÙ");return}p(R=>new Set(R).add(h.id));try{const R=await r.mutateAsync({videoUrl:h.videoUrl,videoSource:h.videoSource});R.duration>0?(d(b=>({...b,[h.id]:R.duration})),w.success(`تÙ
Ø¬ÙØ¨ اÙÙ
دة: ${Math.floor(R.duration/60)}:${String(R.duration%60).padStart(2,"0")}`)):w.info("ÙÙ
ÙØªÙ
Ø§ÙØ¹Ø«Ùر عÙÙ Ù
دة اÙÙÙØ¯ÙÙ - أدخÙÙØ§ ÙØ¯ÙÙØ§Ù")}catch(R){w.error(R.message||"ÙØ´Ù ÙÙ Ø¬ÙØ¨ Ù
دة اÙÙÙØ¯ÙÙ")}finally{p(R=>{const b=new Set(R);return b.delete(h.id),b})}},g=async()=>{const h=u.filter(R=>R.videoUrl&&R.videoUrl!=="NULL"&&R.videoSource&&R.videoSource!=="upload");if(!h.length){w.info("ÙØ§ ØªÙØ¬Ø¯ Ø¯Ø±ÙØ³ ÙÙ
ÙÙ Ø¬ÙØ¨ Ù
Ø¯ØªÙØ§ تÙÙØ§Ø¦ÙاÙ");return}w.info(`Ø¬Ø§Ø±Ù Ø¬ÙØ¨ Ù
دة ${h.length} درس...`);for(const R of h)await v(R)},m=()=>{const h=Object.entries(o).filter(([,R])=>R>0).map(([R,b])=>({id:parseInt(R),duration:b}));if(!h.length){w.error("ÙÙ
ÙØªÙ
إدخا٠أ٠Ù
دة");return}t.mutate({updates:h})},j=Object.values(o).filter(h=>h>0).length;return e.jsx($e,{"data-loc":"client/src/pages/RecordedCourses.tsx:3171",className:"border-amber-300 bg-amber-50/50 dark:bg-amber-950/10",children:e.jsxs(Be,{"data-loc":"client/src/pages/RecordedCourses.tsx:3172",className:"p-4",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:3173",className:"flex items-center justify-between cursor-pointer",onClick:()=>c(!a),children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:3177",className:"flex items-center gap-2",children:[e.jsx(Ps,{"data-loc":"client/src/pages/RecordedCourses.tsx:3178",className:"h-5 w-5 text-amber-600"}),e.jsxs("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:3179",className:"font-semibold text-amber-800 dark:text-amber-300",children:[u.length," درس ÙÙØ¯Ù٠بدÙÙ Ù
دة Ù
ØØ¯Ø¯Ø©"]}),f.length>0&&e.jsxs("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:3183",className:"text-xs text-muted-foreground",children:["(+ ",f.length," درس ØºÙØ± ÙÙØ¯ÙÙ)"]})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:3188",className:"flex items-center gap-2",children:[a&&j>0&&e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:3190",size:"sm",onClick:h=>{h.stopPropagation(),m()},disabled:t.isPending,className:"bg-green-600 hover:bg-green-700",children:[t.isPending?e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:3197",className:"h-4 w-4 animate-spin ml-1"}):e.jsx(vt,{"data-loc":"client/src/pages/RecordedCourses.tsx:3199",className:"h-4 w-4 ml-1"}),"ØÙظ (",j,")"]}),a?e.jsx(Hs,{"data-loc":"client/src/pages/RecordedCourses.tsx:3204",className:"h-4 w-4"}):e.jsx(Rt,{"data-loc":"client/src/pages/RecordedCourses.tsx:3204",className:"h-4 w-4"})]})]}),a&&e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:3209",className:"mt-4 space-y-3",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:3210",className:"flex items-center justify-between",children:[e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:3211",className:"text-sm text-muted-foreground",children:"أدخ٠Ù
دة Ù٠درس Ø¨Ø§ÙØ«ÙاÙ٠أ٠استخدÙ
Ø§ÙØ¬Ùب Ø§ÙØªÙÙØ§Ø¦Ù ÙÙÙØ¯ÙÙÙØ§Øª YouTube Ù Vimeo"}),e.jsxs(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:3214",size:"sm",variant:"outline",onClick:g,disabled:i.size>0,children:[i.size>0?e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:3221",className:"h-4 w-4 animate-spin ml-1"}):e.jsx(jt,{"data-loc":"client/src/pages/RecordedCourses.tsx:3223",className:"h-4 w-4 ml-1"}),"Ø¬ÙØ¨ اÙÙ٠تÙÙØ§Ø¦ÙاÙ"]})]}),Object.entries(u.reduce((h,R)=>{const b=R.courseTitle||"بدÙÙ Ø¯ÙØ±Ø©";return h[b]||(h[b]=[]),h[b].push(R),h},{})).map(([h,R])=>e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:3238",className:"space-y-2",children:[e.jsxs("h4",{"data-loc":"client/src/pages/RecordedCourses.tsx:3239",className:"text-sm font-semibold text-amber-800 dark:text-amber-300 flex items-center gap-1",children:[e.jsx(Zs,{"data-loc":"client/src/pages/RecordedCourses.tsx:3240",className:"h-4 w-4"}),h]}),e.jsx("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:3243",className:"space-y-1.5 mr-4",children:R.map(b=>e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:3245",className:"flex items-center gap-3 p-2 rounded-lg bg-white dark:bg-background border",children:[e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:3246",className:"flex-1 min-w-0",children:[e.jsx("p",{"data-loc":"client/src/pages/RecordedCourses.tsx:3247",className:"text-sm font-medium truncate",children:b.title}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:3248",className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:3249",children:b.sectionTitle}),b.videoSource&&b.videoSource!=="upload"&&e.jsx(Le,{"data-loc":"client/src/pages/RecordedCourses.tsx:3251",variant:"outline",className:"text-[10px]",children:b.videoSource})]})]}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:3255",className:"flex items-center gap-2",children:[b.videoSource&&b.videoSource!=="upload"&&b.videoUrl&&b.videoUrl!=="NULL"&&e.jsx(E,{"data-loc":"client/src/pages/RecordedCourses.tsx:3257",size:"sm",variant:"ghost",className:"h-8 px-2",onClick:()=>v(b),disabled:i.has(b.id),title:"Ø¬ÙØ¨ اÙÙ
دة تÙÙØ§Ø¦ÙاÙ",children:i.has(b.id)?e.jsx(ee,{"data-loc":"client/src/pages/RecordedCourses.tsx:3266",className:"h-3.5 w-3.5 animate-spin"}):e.jsx(jt,{"data-loc":"client/src/pages/RecordedCourses.tsx:3268",className:"h-3.5 w-3.5"})}),e.jsxs("div",{"data-loc":"client/src/pages/RecordedCourses.tsx:3272",className:"flex items-center gap-1",children:[e.jsx(O,{"data-loc":"client/src/pages/RecordedCourses.tsx:3273",type:"number",min:0,placeholder:"Ø«ÙØ§ÙÙ",value:o[b.id]||"",onChange:N=>d(y=>({...y,[b.id]:parseInt(N.target.value)||0})),className:"w-24 h-8 text-sm"}),(o[b.id]||0)>0&&e.jsxs("span",{"data-loc":"client/src/pages/RecordedCourses.tsx:3285",className:"text-xs text-muted-foreground whitespace-nowrap",children:["(",Math.floor(o[b.id]/60),":",String(o[b.id]%60).padStart(2,"0"),")"]})]})]})]},b.id))})]},h))]})]})})}export{Uo as default};
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.