import{d as Qt,c as ot,a1 as Ko,u as S,a as te,r as Qo,G as en,D as eo,m as tn,o as Co,J as Ve,P as on,$ as Rt,R as nn,C as an,b as ie,x as rn,e as je,f as oe,s as ne,g as M,w as B,l as Ke,z as ln,h as we,F as sn,k as un,t as cn,j as Te,A as ro,Z as mt,p as dn}from"./vue.BxlDVA1H.js";import{g as pn,a as fn,u as vn,b as hn,d as mn,e as gn,h as bn,i as _n,s as yn}from"./api.BeM3vxkG.js";import{h as lo,S as wn,a3 as xn,af as Dn,ag as Sn,b as Cn,ah as En,m as Ye,s as Bt,I as Ie,w as Tn,E as In}from"./index.lP_uh0LI.js";import{b as A,c as J}from"./curriculum.model.DmH5tfDc.js";import{l as gt}from"./lodash.BFZPcw-o.js";var On=Object.defineProperty,Tt=Object.getOwnPropertySymbols,Eo=Object.prototype.hasOwnProperty,To=Object.prototype.propertyIsEnumerable,io=(e,o,t)=>o in e?On(e,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[o]=t,Ue=(e,o)=>{for(var t in o||(o={}))Eo.call(o,t)&&io(e,t,o[t]);if(Tt)for(var t of Tt(o))To.call(o,t)&&io(e,t,o[t]);return e},Io=(e,o)=>{var t={};for(var n in e)Eo.call(e,n)&&o.indexOf(n)<0&&(t[n]=e[n]);if(e!=null&&Tt)for(var n of Tt(e))o.indexOf(n)<0&&To.call(e,n)&&(t[n]=e[n]);return t};const Oo="[vue-draggable-plus]: ";function kn(e){console.warn(Oo+e)}function Mn(e){console.error(Oo+e)}function so(e,o,t){return t>=0&&tt?t.toUpperCase():"")}function An(e){return Object.keys(e).reduce((o,t)=>(typeof e[t]<"u"&&(o[Pn(t)]=e[t]),o),{})}function uo(e,o){return Array.isArray(e)&&e.splice(o,1),e}function co(e,o,t){return Array.isArray(e)&&e.splice(o,0,t),e}function Nn(e){return typeof e>"u"}function Vn(e){return typeof e=="string"}function po(e,o,t){const n=e.children[t];e.insertBefore(o,n)}function jt(e){e.parentNode&&e.parentNode.removeChild(e)}function Rn(e,o=document){var t;let n=null;return typeof(o==null?void 0:o.querySelector)=="function"?n=(t=o==null?void 0:o.querySelector)==null?void 0:t.call(o,e):n=document.querySelector(e),n||kn(`Element not found: ${e}`),n}function Bn(e,o,t=null){return function(...n){return e.apply(t,n),o.apply(t,n)}}function jn(e,o){const t=Ue({},e);return Object.keys(o).forEach(n=>{t[n]?t[n]=Bn(e[n],o[n]):t[n]=o[n]}),t}function Yn(e){return e instanceof HTMLElement}function fo(e,o){Object.keys(e).forEach(t=>{o(t,e[t])})}function Fn(e){return e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97)}const $n=Object.assign;/**! * Sortable 1.15.2 * @author RubaXa * @author owenm * @license MIT */function vo(e,o){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);o&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),t.push.apply(t,n)}return t}function _e(e){for(var o=1;o=0)&&(t[a]=e[a]);return t}function zn(e,o){if(e==null)return{};var t=Un(e,o),n,a;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var Hn="1.15.2";function xe(e){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(e)}var Se=xe(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),st=xe(/Edge/i),ho=xe(/firefox/i),nt=xe(/safari/i)&&!xe(/chrome/i)&&!xe(/android/i),ko=xe(/iP(ad|od|hone)/i),Mo=xe(/chrome/i)&&xe(/android/i),Po={capture:!1,passive:!1};function I(e,o,t){e.addEventListener(o,t,!Se&&Po)}function T(e,o,t){e.removeEventListener(o,t,!Se&&Po)}function It(e,o){if(o){if(o[0]===">"&&(o=o.substring(1)),e)try{if(e.matches)return e.matches(o);if(e.msMatchesSelector)return e.msMatchesSelector(o);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(o)}catch{return!1}return!1}}function Ln(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function me(e,o,t,n){if(e){t=t||document;do{if(o!=null&&(o[0]===">"?e.parentNode===t&&It(e,o):It(e,o))||n&&e===t)return e;if(e===t)break}while(e=Ln(e))}return null}var mo=/\s+/g;function se(e,o,t){if(e&&o)if(e.classList)e.classList[t?"add":"remove"](o);else{var n=(" "+e.className+" ").replace(mo," ").replace(" "+o+" "," ");e.className=(n+(t?" "+o:"")).replace(mo," ")}}function w(e,o,t){var n=e&&e.style;if(n){if(t===void 0)return document.defaultView&&document.defaultView.getComputedStyle?t=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(t=e.currentStyle),o===void 0?t:t[o];!(o in n)&&o.indexOf("webkit")===-1&&(o="-webkit-"+o),n[o]=t+(typeof t=="string"?"":"px")}}function He(e,o){var t="";if(typeof e=="string")t=e;else do{var n=w(e,"transform");n&&n!=="none"&&(t=n+" "+t)}while(!o&&(e=e.parentNode));var a=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return a&&new a(t)}function Ao(e,o,t){if(e){var n=e.getElementsByTagName(o),a=0,i=n.length;if(t)for(;a=i,!s)return n;if(n===be())break;n=Me(n,!1)}return!1}function Le(e,o,t,n){for(var a=0,i=0,s=e.children;i2&&arguments[2]!==void 0?arguments[2]:{},n=t.evt,a=zn(t,ea);ut.pluginEvent.bind(x)(e,o,_e({dragEl:p,parentEl:z,ghostEl:D,rootEl:j,nextEl:Ne,lastDownEl:Dt,cloneEl:F,cloneHidden:ke,dragStarted:Qe,putSortable:Q,activeSortable:x.active,originalEvent:n,oldIndex:ze,oldDraggableIndex:rt,newIndex:ue,newDraggableIndex:Oe,hideGhostForTarget:$o,unhideGhostForTarget:Xo,cloneNowHidden:function(){ke=!0},cloneNowShown:function(){ke=!1},dispatchSortableEvent:function(i){ae({sortable:o,name:i,originalEvent:n})}},a))};function ae(e){Qn(_e({putSortable:Q,cloneEl:F,targetEl:p,rootEl:j,oldIndex:ze,oldDraggableIndex:rt,newIndex:ue,newDraggableIndex:Oe},e))}var p,z,D,j,Ne,Dt,F,ke,ze,ue,rt,Oe,bt,Q,Xe=!1,Ot=!1,kt=[],Pe,he,$t,Xt,_o,yo,Qe,$e,lt,it=!1,_t=!1,St,ee,Ut=[],Wt=!1,Mt=[],At=typeof document<"u",yt=ko,wo=st||Se?"cssFloat":"float",ta=At&&!Mo&&!ko&&"draggable"in document.createElement("div"),jo=function(){if(At){if(Se)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto",e.style.pointerEvents==="auto"}}(),Yo=function(e,o){var t=w(e),n=parseInt(t.width)-parseInt(t.paddingLeft)-parseInt(t.paddingRight)-parseInt(t.borderLeftWidth)-parseInt(t.borderRightWidth),a=Le(e,0,o),i=Le(e,1,o),s=a&&w(a),d=i&&w(i),r=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+W(a).width,l=d&&parseInt(d.marginLeft)+parseInt(d.marginRight)+W(i).width;if(t.display==="flex")return t.flexDirection==="column"||t.flexDirection==="column-reverse"?"vertical":"horizontal";if(t.display==="grid")return t.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(a&&s.float&&s.float!=="none"){var f=s.float==="left"?"left":"right";return i&&(d.clear==="both"||d.clear===f)?"vertical":"horizontal"}return a&&(s.display==="block"||s.display==="flex"||s.display==="table"||s.display==="grid"||r>=n&&t[wo]==="none"||i&&t[wo]==="none"&&r+l>n)?"vertical":"horizontal"},oa=function(e,o,t){var n=t?e.left:e.top,a=t?e.right:e.bottom,i=t?e.width:e.height,s=t?o.left:o.top,d=t?o.right:o.bottom,r=t?o.width:o.height;return n===s||a===d||n+i/2===s+r/2},na=function(e,o){var t;return kt.some(function(n){var a=n[ce].options.emptyInsertThreshold;if(!(!a||to(n))){var i=W(n),s=e>=i.left-a&&e<=i.right+a,d=o>=i.top-a&&o<=i.bottom+a;if(s&&d)return t=n}}),t},Fo=function(e){function o(a,i){return function(s,d,r,l){var f=s.options.group.name&&d.options.group.name&&s.options.group.name===d.options.group.name;if(a==null&&(i||f))return!0;if(a==null||a===!1)return!1;if(i&&a==="clone")return a;if(typeof a=="function")return o(a(s,d,r,l),i)(s,d,r,l);var v=(i?s:d).options.group.name;return a===!0||typeof a=="string"&&a===v||a.join&&a.indexOf(v)>-1}}var t={},n=e.group;(!n||xt(n)!="object")&&(n={name:n}),t.name=n.name,t.checkPull=o(n.pull,!0),t.checkPut=o(n.put),t.revertClone=n.revertClone,e.group=t},$o=function(){!jo&&D&&w(D,"display","none")},Xo=function(){!jo&&D&&w(D,"display","")};At&&!Mo&&document.addEventListener("click",function(e){if(Ot)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Ot=!1,!1},!0);var Ae=function(e){if(p){e=e.touches?e.touches[0]:e;var o=na(e.clientX,e.clientY);if(o){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.target=t.rootEl=o,t.preventDefault=void 0,t.stopPropagation=void 0,o[ce]._onDragOver(t)}}},aa=function(e){p&&p.parentNode[ce]._isOutsideThisEl(e.target)};function x(e,o){if(!(e&&e.nodeType&&e.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=o=De({},o),e[ce]=this;var t={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Yo(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(i,s){i.setData("Text",s.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:x.supportPointer!==!1&&"PointerEvent"in window&&!nt,emptyInsertThreshold:5};ut.initializePlugins(this,e,t);for(var n in t)!(n in o)&&(o[n]=t[n]);Fo(o);for(var a in this)a.charAt(0)==="_"&&typeof this[a]=="function"&&(this[a]=this[a].bind(this));this.nativeDraggable=o.forceFallback?!1:ta,this.nativeDraggable&&(this.options.touchStartThreshold=1),o.supportPointer?I(e,"pointerdown",this._onTapStart):(I(e,"mousedown",this._onTapStart),I(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(I(e,"dragover",this),I(e,"dragenter",this)),kt.push(this.el),o.store&&o.store.get&&this.sort(o.store.get(this)||[]),De(this,Jn())}x.prototype={constructor:x,_isOutsideThisEl:function(e){!this.el.contains(e)&&e!==this.el&&($e=null)},_getDirection:function(e,o){return typeof this.options.direction=="function"?this.options.direction.call(this,e,o,p):this.options.direction},_onTapStart:function(e){if(e.cancelable){var o=this,t=this.el,n=this.options,a=n.preventOnFilter,i=e.type,s=e.touches&&e.touches[0]||e.pointerType&&e.pointerType==="touch"&&e,d=(s||e).target,r=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||d,l=n.filter;if(pa(t),!p&&!(/mousedown|pointerdown/.test(i)&&e.button!==0||n.disabled)&&!r.isContentEditable&&!(!this.nativeDraggable&&nt&&d&&d.tagName.toUpperCase()==="SELECT")&&(d=me(d,n.draggable,t,!1),!(d&&d.animated)&&Dt!==d)){if(ze=fe(d),rt=fe(d,n.draggable),typeof l=="function"){if(l.call(this,e,d,this)){ae({sortable:o,rootEl:r,name:"filter",targetEl:d,toEl:t,fromEl:t}),le("filter",o,{evt:e}),a&&e.cancelable&&e.preventDefault();return}}else if(l&&(l=l.split(",").some(function(f){if(f=me(r,f.trim(),t,!1),f)return ae({sortable:o,rootEl:f,name:"filter",targetEl:d,fromEl:t,toEl:t}),le("filter",o,{evt:e}),!0}),l)){a&&e.cancelable&&e.preventDefault();return}n.handle&&!me(r,n.handle,t,!1)||this._prepareDragStart(e,s,d)}}},_prepareDragStart:function(e,o,t){var n=this,a=n.el,i=n.options,s=a.ownerDocument,d;if(t&&!p&&t.parentNode===a){var r=W(t);if(j=a,p=t,z=p.parentNode,Ne=p.nextSibling,Dt=t,bt=i.group,x.dragged=p,Pe={target:p,clientX:(o||e).clientX,clientY:(o||e).clientY},_o=Pe.clientX-r.left,yo=Pe.clientY-r.top,this._lastX=(o||e).clientX,this._lastY=(o||e).clientY,p.style["will-change"]="all",d=function(){if(le("delayEnded",n,{evt:e}),x.eventCanceled){n._onDrop();return}n._disableDelayedDragEvents(),!ho&&n.nativeDraggable&&(p.draggable=!0),n._triggerDragStart(e,o),ae({sortable:n,name:"choose",originalEvent:e}),se(p,i.chosenClass,!0)},i.ignore.split(",").forEach(function(l){Ao(p,l.trim(),zt)}),I(s,"dragover",Ae),I(s,"mousemove",Ae),I(s,"touchmove",Ae),I(s,"mouseup",n._onDrop),I(s,"touchend",n._onDrop),I(s,"touchcancel",n._onDrop),ho&&this.nativeDraggable&&(this.options.touchStartThreshold=4,p.draggable=!0),le("delayStart",this,{evt:e}),i.delay&&(!i.delayOnTouchOnly||o)&&(!this.nativeDraggable||!(st||Se))){if(x.eventCanceled){this._onDrop();return}I(s,"mouseup",n._disableDelayedDrag),I(s,"touchend",n._disableDelayedDrag),I(s,"touchcancel",n._disableDelayedDrag),I(s,"mousemove",n._delayedDragTouchMoveHandler),I(s,"touchmove",n._delayedDragTouchMoveHandler),i.supportPointer&&I(s,"pointermove",n._delayedDragTouchMoveHandler),n._dragStartTimer=setTimeout(d,i.delay)}else d()}},_delayedDragTouchMoveHandler:function(e){var o=e.touches?e.touches[0]:e;Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){p&&zt(p),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;T(e,"mouseup",this._disableDelayedDrag),T(e,"touchend",this._disableDelayedDrag),T(e,"touchcancel",this._disableDelayedDrag),T(e,"mousemove",this._delayedDragTouchMoveHandler),T(e,"touchmove",this._delayedDragTouchMoveHandler),T(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,o){o=o||e.pointerType=="touch"&&e,!this.nativeDraggable||o?this.options.supportPointer?I(document,"pointermove",this._onTouchMove):o?I(document,"touchmove",this._onTouchMove):I(document,"mousemove",this._onTouchMove):(I(p,"dragend",this),I(j,"dragstart",this._onDragStart));try{document.selection?Ct(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(e,o){if(Xe=!1,j&&p){le("dragStarted",this,{evt:o}),this.nativeDraggable&&I(document,"dragover",aa);var t=this.options;!e&&se(p,t.dragClass,!1),se(p,t.ghostClass,!0),x.active=this,e&&this._appendGhost(),ae({sortable:this,name:"start",originalEvent:o})}else this._nulling()},_emulateDragOver:function(){if(he){this._lastX=he.clientX,this._lastY=he.clientY,$o();for(var e=document.elementFromPoint(he.clientX,he.clientY),o=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(he.clientX,he.clientY),e!==o);)o=e;if(p.parentNode[ce]._isOutsideThisEl(e),o)do{if(o[ce]){var t=void 0;if(t=o[ce]._onDragOver({clientX:he.clientX,clientY:he.clientY,target:e,rootEl:o}),t&&!this.options.dragoverBubble)break}e=o}while(o=o.parentNode);Xo()}},_onTouchMove:function(e){if(Pe){var o=this.options,t=o.fallbackTolerance,n=o.fallbackOffset,a=e.touches?e.touches[0]:e,i=D&&He(D,!0),s=D&&i&&i.a,d=D&&i&&i.d,r=yt&&ee&&bo(ee),l=(a.clientX-Pe.clientX+n.x)/(s||1)+(r?r[0]-Ut[0]:0)/(s||1),f=(a.clientY-Pe.clientY+n.y)/(d||1)+(r?r[1]-Ut[1]:0)/(d||1);if(!x.active&&!Xe){if(t&&Math.max(Math.abs(a.clientX-this._lastX),Math.abs(a.clientY-this._lastY))=0&&(ae({rootEl:z,name:"add",toEl:z,fromEl:j,originalEvent:e}),ae({sortable:this,name:"remove",toEl:z,originalEvent:e}),ae({rootEl:z,name:"sort",toEl:z,fromEl:j,originalEvent:e}),ae({sortable:this,name:"sort",toEl:z,originalEvent:e})),Q&&Q.save()):ue!==ze&&ue>=0&&(ae({sortable:this,name:"update",toEl:z,originalEvent:e}),ae({sortable:this,name:"sort",toEl:z,originalEvent:e})),x.active&&((ue==null||ue===-1)&&(ue=ze,Oe=rt),ae({sortable:this,name:"end",toEl:z,originalEvent:e}),this.save()))),this._nulling()},_nulling:function(){le("nulling",this),j=p=z=D=Ne=F=Dt=ke=Pe=he=Qe=ue=Oe=ze=rt=$e=lt=Q=bt=x.dragged=x.ghost=x.clone=x.active=null,Mt.forEach(function(e){e.checked=!0}),Mt.length=$t=Xt=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":p&&(this._onDragOver(e),ra(e));break;case"selectstart":e.preventDefault();break}},toArray:function(){for(var e=[],o,t=this.el.children,n=0,a=t.length,i=this.options;na.right+i||e.clientY>n.bottom&&e.clientX>n.left:e.clientY>a.bottom+i||e.clientX>n.right&&e.clientY>n.top}function ua(e,o,t,n,a,i,s,d){var r=n?e.clientY:e.clientX,l=n?t.height:t.width,f=n?t.top:t.left,v=n?t.bottom:t.right,E=!1;if(!s){if(d&&Stf+l*i/2:rv-St)return-lt}else if(r>f+l*(1-a)/2&&rv-l*i/2)?r>f+l/2?1:-1:0}function ca(e){return fe(p){if(U&&(a==null?void 0:a.length)!==O.childNodes.length)return Z.insertBefore(U,re.nextSibling),!0;const qe=O.childNodes[ve];U=O==null?void 0:O.replaceChild(re,qe)})}}catch(U){Y=U}finally{a=null}Ve(()=>{if(Do(),Y)throw Y})}const V={onUpdate:m,onStart:E,onAdd:_,onRemove:N,onEnd:R};function K(y){const C=S(i);return y||(y=Vn(C)?Rn(C,n==null?void 0:n.$el):C),y&&!Yn(y)&&(y=y.$el),y||Mn("Root element not found"),y}function $(){var y;const C=(y=S(d))!=null?y:{},{immediate:X,clone:Z}=C,O=Io(C,["immediate","clone"]);return fo(O,(Y,L)=>{Fn(Y)&&(O[Y]=(U,...re)=>{const ve=ga();return $n(U,ve),L(U,...re)})}),jn(s===null?{}:V,O)}const de=y=>{y=K(y),r&&H.destroy(),r=new x(y,$())};tn(()=>d,()=>{r&&fo($(),(y,C)=>{r==null||r.option(y,C)})},{deep:!0});const H={option:(y,C)=>r==null?void 0:r.option(y,C),destroy:()=>{r==null||r.destroy(),r=null},save:()=>r==null?void 0:r.save(),toArray:()=>r==null?void 0:r.toArray(),closest:(...y)=>r==null?void 0:r.closest(...y)},pe=()=>H==null?void 0:H.option("disabled",!0),ge=()=>H==null?void 0:H.option("disabled",!1);return ma(()=>{l&&de()}),ha(H.destroy),Ue({start:de,pause:pe,resume:ge},H)}const Kt=["update","start","add","remove","choose","unchoose","end","sort","filter","clone","move","change"],_a=["clone","animation","ghostClass","group","sort","disabled","store","handle","draggable","swapThreshold","invertSwap","invertedSwapThreshold","removeCloneOnHide","direction","chosenClass","dragClass","ignore","filter","preventOnFilter","easing","setData","dropBubble","dragoverBubble","dataIdAttr","delay","delayOnTouchOnly","touchStartThreshold","forceFallback","fallbackClass","fallbackOnBody","fallbackTolerance","fallbackOffset","supportPointer","emptyInsertThreshold","scroll","forceAutoScrollFallback","scrollSensitivity","scrollSpeed","bubbleScroll","modelValue","tag","target","customUpdate",...Kt.map(e=>`on${e.replace(/^\S/,o=>o.toUpperCase())}`)],ya=Qt({name:"VueDraggable",model:{prop:"modelValue",event:"update:modelValue"},props:_a,emits:["update:modelValue",...Kt],setup(e,{slots:o,emit:t,expose:n,attrs:a}){const i=Kt.reduce((f,v)=>{const E=`on${v.replace(/^\S/,_=>_.toUpperCase())}`;return f[E]=(..._)=>t(v,..._),f},{}),s=ot(()=>{const f=Ko(e),{modelValue:v}=f,E=Io(f,["modelValue"]),_=Object.entries(E).reduce((N,[m,R])=>{const V=S(R);return V!==void 0&&(N[m]=V),N},{});return Ue(Ue({},i),An(Ue(Ue({},a),_)))}),d=ot({get:()=>e.modelValue,set:f=>t("update:modelValue",f)}),r=te(),l=Qo(ba(e.target||r,d,s));return n(l),()=>{var f;return en(e.tag||"div",{ref:r},(f=o==null?void 0:o.default)==null?void 0:f.call(o,l))}}}),wa={class:"curriculum-back"},xa={class:"curriculum-box"},Da={class:"curriculum-box-sidebar"},Sa={class:"curriculum-box-sidebar-header"},Ca={class:"curriculum-box-sidebar-content"},Ea=["onClick"],Ta={class:"curriculum-box-sidebar-content-item-text"},Ia={key:0,class:"curriculum-box-sidebar-content-item-number"},Oa={key:1,class:"mdd-line-clamp-2"},ka={class:"curriculum-box-sidebar-content-item-btns"},Ma={class:"submit-btn"},Pa=Qt({name:"curriculumManageContent"}),ja=Qt({...Pa,setup(e){const o=te(""),t=nn(),n=an(),a=te(""),i=te(),s=te(),d=te(null),r=te([{uuid:"",title:"",type:A.chapter,disabled:!1}]),l=te({course:"",chapter:"",title:"",content_type:J.video,is_free:!1,video_url:"",video_picture_url:"",live_url:"",live_time:"",live_video_url:"",course_files:[],course_plan:""}),f=te(gt.cloneDeep(l.value)),v=te(0),E=te(""),_=ot(()=>({dataList:$.value.dataList.map(c=>({title:[{required:!0,message:`请输入${c.type===A.chapter?"标题":"内容"}`,trigger:"change"},{min:1,max:c.type==A.chapter?20:30,message:`长度在1到${c.type==A.chapter?"20":"30"}个字符`,trigger:"change"}]}))})),N=te({title:[{required:!0,message:"请输入内容标题",trigger:"blur"},{min:1,max:30,message:"长度在1到30个字符",trigger:"blur"}],content_type:[{required:!0,message:"请选择课程类型",trigger:"change"}],is_free:[{required:!0,message:"请选择是否为免费试看",trigger:"change"}],video_url:lo([{required:!0,message:"请上传视频",trigger:"change"}]),live_url:lo([{required:!0,message:"请上传图片",trigger:"change"}])}),m=te(""),R=te(!1),V=te(!1),K=te(!1),$=ot(()=>({dataList:[...r.value]})),de=ot(()=>{let c=0;return r.value.map(u=>u.type==A.period?(c++,{...u,sequence:c}):{...u,sequence:null})}),H=c=>{switch(c){case J.video:l.value.live_url="",l.value.live_time="",l.value.live_video_url="";break;case J.live:l.value.is_free=!1,l.value.video_url="",l.value.video_picture_url="";break}v.value=0,E.value=""},pe=c=>{const{res:u}=c;if(u)switch(v.value=u.video_duration,E.value=u.video_first_frame_url,l.value.content_type){case J.video:l.value.video_url=u.url;break;case J.live:l.value.live_video_url=u.url;break}},ge=()=>{switch(v.value=0,E.value="",l.value.content_type){case J.video:l.value.video_url="";break;case J.live:l.value.live_video_url="";break}},y=async(c=!1)=>{const u=await pn(a.value);if(c)if(u.length==0)Ve(()=>{var h;(h=d.value)==null||h[0].focus()});else{u.forEach(g=>{g.disabled=!0}),r.value=u;const h=u.findIndex(g=>g.type==A.period);if(h==-1)return;m.value=u[h].uuid,Z(u[h],h,!1),R.value=!0}else{u.forEach(g=>{g.disabled=!0});const h=u.findIndex(g=>g.uuid===m.value);R.value&&h!=-1&&(u[h].title=l.value.title),r.value=u}},C=async c=>{const u={course:a.value,title:c.title};c.uuid&&(u.uuid=c.uuid),(c.uuid?await mn(u,c.uuid):await gn(u))?y():Ie("保存失败")},X=async(c,u)=>{await bn(c)?(await y(),Bt("删除成功"),ao()):Ie("删除失败")},Z=async(c,u,h=!1)=>{V.value=!0;const g=await fn(m.value);V.value=!1,g&&(Object.keys(l.value).forEach(k=>{l.value[k]=g[k]??""}),f.value={...l.value},v.value=g.video_duration||0,E.value=g.video_first_frame_url||"",pt(c,u,h))},O=async(c=!1,u={},h=-1)=>{const g={...l.value};switch(g.content_type){case J.video:g.video_duration=g.video_url?v.value:0,g.video_first_frame_url=g.video_url?E.value:"";break;case J.live:g.video_duration=g.live_video_url?v.value:0,g.video_first_frame_url=g.live_video_url?E.value:"";break}Object.keys(g).forEach(G=>{!g[G]&&G!="is_free"&&(g[G]=null)}),V.value=!0;const k=m.value?await vn(g,m.value):await hn(g);V.value=!1,k?(await y(),Bt("保存成功"),c?(R.value=!0,m.value=u.uuid??"",u&&u.uuid&&Z(u,h)):Nt()):Ie("保存失败")},Y=async(c,u)=>{await _n(c)?(c==m.value&&(m.value="",R.value=!1),y(),Bt("删除成功")):Ie("删除失败")},L=async()=>{const c=[];r.value.forEach(h=>{const g={uuid:h.uuid,title:h.title,type:h.type};h.chapter_uuid&&(g.chapter_uuid=h.chapter_uuid),c.push(g)}),await yn(c)?y():Ie("排序失败")},U=async(c,u,h=!1)=>{!c.uuid||c.type==A.chapter||m.value===c.uuid||!await Re(!0,!0,c,u)||(R.value=!0,m.value=c.uuid,c.uuid&&Z(c,u,h))},re=async()=>{const c=r.value.findIndex(h=>h.uuid===m.value);await Re(c!=-1,!1,r.value[c],c)&&(r.value.forEach(h=>{h.disabled=!0}),r.value.push({uuid:"",title:"",type:A.chapter,disabled:!1}),Ve(()=>{var h;(h=d.value)==null||h[0].focus()}))},ve=async(c,u)=>{if(!await Re(!0,!1,c,u))return;const k=r.value.slice(u+1).findIndex(P=>P.type==A.chapter);r.value.forEach(P=>{P.disabled=!0});const G={uuid:"",title:"",type:A.period,chapter_uuid:c.type==A.chapter?c.uuid:c.chapter_uuid,disabled:!1};k==-1?r.value.push(G):r.value.splice(u+k+1,0,G),Object.keys(l.value).forEach(P=>{["course","chapter","content_type","is_free","course_files"].includes(P)||(l.value[P]=""),P=="course"&&(l.value[P]=a.value),P=="chapter"&&(l.value[P]=c.type==A.chapter?c.uuid:c.chapter_uuid),P=="content_type"&&(l.value[P]=J.video),P=="is_free"&&(l.value[P]=!1),P=="course_files"&&(l.value[P]=[])}),f.value={...l.value},R.value=!0,m.value="",Ve(()=>{var P;(P=d.value)==null||P[0].focus()})},qe=async(c,u)=>{if(c.type==A.chapter){if(!await Re(!0,!1,c,u))return;r.value.forEach(g=>{g.disabled=!0}),r.value[u].disabled=!1,Ve(()=>{var g;(g=d.value)==null||g[0].focus()});return}c.type==A.period&&U(c,u,!0)},ct=async(c,u)=>{if(!c.uuid){r.value.splice(u,1),K.value=!1,m.value||Nt();return}const h=c.uuid!=m.value;await Re(!0,!1,c,u,h)&&c.uuid&&(c.type==A.chapter?X(c.uuid):Y(c.uuid))},dt=async()=>{const c=r.value.findIndex(u=>u.uuid===m.value);await Re(c!==-1,!1,r.value[c],c,c!==-1)},ao=()=>{const c=r.value;c.forEach((u,h)=>{if(u.type==A.period){const k=r.value.slice(0,h).findLastIndex(G=>G.type==A.chapter);k==-1?u.chapter_uuid="":u.chapter_uuid=c[k].uuid}}),r.value=c,L()},Re=async(c,u,h,g,k=!0)=>{var Ce,Ge,ft,Be,Je,vt;const G=r.value.findIndex(ht=>ht.uuid===m.value);if(c&&await pt(G==-1?h:r.value[G],G==-1?g:G),K.value)return Tn("请先完成当前操作"),!1;if(!k)return!0;(Ce=l.value)!=null&&Ce.course_plan&&((Ge=l.value)==null?void 0:Ge.course_plan)=="


"&&(l.value.course_plan=""),(ft=f.value)!=null&&ft.course_plan&&((Be=f.value)==null?void 0:Be.course_plan)=="


"&&(f.value.course_plan="");let P=gt.isMatch(f.value,l.value);if(!P&&((Je=l.value)==null?void 0:Je.course_plan)=="


"&&(P=!0),R.value&&!P)try{await In.confirm(`当前${m.value?"编辑":"新建"}的内容没有保存,是否保存?`,{confirmButtonText:"确认",cancelButtonText:"取消",type:"warning"}),await O(u,h,g)}catch{const Ze=r.value.findIndex(Vt=>Vt.uuid===m.value);if(Ze==-1)return!1;m.value?r.value[Ze].title=((vt=f.value)==null?void 0:vt.title)??"":r.value.splice(Ze,1),Nt()}return!0},pt=async(c,u,h=!1)=>{if(h)return r.value.forEach(g=>{g.disabled=!0}),r.value[u].disabled=!1,Ve(()=>{var g;(g=d.value)==null||g[0].focus()}),!0;try{if(!(await Promise.all(r.value.map((k,G)=>i.value.validateField(`dataList[${G}].title`).catch(()=>!1)))).every(Boolean))throw new Error("标题校验不通过");return c.type===A.period&&R.value&&!await s.value.validate()?!1:(K.value=!1,!0)}catch{return K.value=!0,!1}},Lo=async(c,u)=>{const h=await pt(c,u);r.value[u].title&&(r.value[u].disabled=!0),h&&c.type==A.chapter&&C(c)},qo=gt.debounce(async()=>{const c=r.value.findIndex(g=>g.uuid===m.value);if(c==-1)return;const u=r.value[c];await pt(u,c)&&u.type==A.period&&O()},500),We=({file:c},u,h,g,k=1)=>{if(g.length>=k)return Ie(`最多只能上传 ${k} 个文件`),!1;const G=c.size/1024/1024<=h,Ce={video:["video/mp4","video/3gpp","application/x-mpegURL"],image:["image/png","image/jpeg","image/jpg"],document:["image/png","image/jpeg","image/jpg","application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/zip","application/x-zip-compressed","application/x-rar-compressed"]}[`${u}`];return(Ce?Ce.includes(c.type):!1)?G?!0:(Ie(`文件大小不能超过 ${h}MB`),!1):(Ie(`只能上传${u==="video"?"mp4、3gp、m3u8":u==="image"?"png、jpg、jpeg":"png, jpg, jpeg, pdf, doc, docx, ppt, pptx, xls, xlsx, rar, zip"}格式的文件`),!1)},Wo=gt.debounce(c=>{if(c.uuid!=m.value)return;const u=r.value.findIndex(h=>h.uuid==m.value);u!=-1&&(l.value.title=r.value[u].title)},200),Go=()=>{const c=r.value.findIndex(u=>u.uuid==m.value);c!=-1&&(r.value[c].title=l.value.title,r.value[c].title&&(r.value[c].disabled=!0))},Nt=()=>{R.value=!1,m.value="",Object.keys(l.value).forEach(c=>{["course","content_type","is_free","course_files"].includes(c)||(l.value[c]=""),c=="course"&&(l.value[c]=a.value),c=="content_type"&&(l.value[c]=J.video),c=="is_free"&&(l.value[c]=!1),c=="course_files"&&(l.value[c]=[])}),f.value={...l.value}},Jo=()=>{n.go(-1)};return Co(async()=>{a.value=t.query.course,a.value&&y(!0),o.value=wn.get("sessionId")}),(c,u)=>{const h=ie("el-button"),g=ie("el-input"),k=ie("el-form-item"),G=ie("el-popconfirm"),P=ie("el-form"),Ce=ie("el-radio"),Ge=ie("el-radio-group"),ft=ie("el-switch"),Be=ie("fs-file-uploader"),Je=ie("fs-cropper-uploader"),vt=ie("el-date-picker"),ht=ie("fs-editor-wang5"),Ze=ie("el-affix"),Vt=rn("loading");return oe(),je("div",{class:"curriculum-manage-content-page",style:dn(`padding: ${o.value?0:16}px`)},[ne("div",wa,[M(h,{onClick:Jo},{default:B(()=>u[12]||(u[12]=[Ke("返回")])),_:1,__:[12]})]),ne("div",xa,[ne("div",Da,[ne("div",Sa,[u[14]||(u[14]=ne("div",{class:"curriculum-box-sidebar-title"},"内容",-1)),M(h,{type:"primary",onClick:re},{default:B(()=>u[13]||(u[13]=[Ke("添加章节")])),_:1,__:[13]})]),ne("div",Ca,[M(P,{model:$.value,ref_key:"titleFormRef",ref:i,rules:_.value},{default:B(()=>[(oe(),we(S(ya),{modelValue:r.value,"onUpdate:modelValue":u[1]||(u[1]=b=>r.value=b),key:r.value.length,animation:100,handle:".rank",disabled:K.value,onUpdate:ao,onStart:dt},{default:B(()=>[(oe(!0),je(sn,null,un(de.value,(b,Ee)=>(oe(),je("div",{class:cn(["curriculum-box-sidebar-content-item",[b.type==S(A).chapter?"curriculum-box-sidebar-content-line":"",b.uuid==m.value?"curriculum-box-sidebar-content-active":""]]),key:b.uuid,onClick:ye=>U(b,Ee)},[ne("div",Ta,[b.type==S(A).period?(oe(),je("div",Ia,ro(b.sequence),1)):Te("",!0),b.disabled?(oe(),je("div",Oa,ro(b.title),1)):(oe(),we(k,{key:2,prop:`dataList[${Ee}].title`,rules:[{required:!0,message:`请输入${b.type==S(A).chapter?"标题":"内容"}`,trigger:"blur"},{min:1,max:b.type==S(A).chapter?20:30,message:`长度在1到${b.type==S(A).chapter?"20":"30"}个字符`,trigger:"blur"}]},{default:B(()=>[M(g,{ref_for:!0,ref_key:"textareaRef",ref:d,type:"text",rows:1,autosize:{minRows:1,maxRows:6},placeholder:`请输入${b.type==S(A).chapter?"标题":"内容"}`,minlength:1,maxlength:b.type==S(A).chapter?20:30,modelValue:r.value[Ee].title,"onUpdate:modelValue":ye=>r.value[Ee].title=ye,onBlur:ye=>Lo(b,Ee),onInput:ye=>S(Wo)(b)},null,8,["placeholder","maxlength","modelValue","onUpdate:modelValue","onBlur","onInput"])]),_:2},1032,["prop","rules"]))]),ne("div",ka,[M(h,{icon:S(xn),size:"small",circle:"",disabled:b.uuid==m.value,onClick:mt(ye=>qe(b,Ee),["stop"])},null,8,["icon","disabled","onClick"]),M(h,{icon:S(Dn),size:"small",circle:"",onClick:mt(ye=>ve(b,Ee),["stop"])},null,8,["icon","onClick"]),M(G,{width:"220",placement:"top",icon:S(Sn),"icon-color":"#f56c6c",title:"你确定要删除这条数据吗?",onConfirm:ye=>ct(b,Ee)},{reference:B(()=>[M(h,{icon:S(Cn),size:"small",circle:"",onClick:u[0]||(u[0]=mt(()=>{},["stop"]))},null,8,["icon"])]),actions:B(({confirm:ye,cancel:Zo})=>[M(h,{size:"small",onClick:Zo},{default:B(()=>u[15]||(u[15]=[Ke("取消")])),_:2,__:[15]},1032,["onClick"]),M(h,{type:"danger",size:"small",onClick:ye},{default:B(()=>u[16]||(u[16]=[Ke("确定")])),_:2,__:[16]},1032,["onClick"])]),_:2},1032,["icon","onConfirm"]),M(h,{icon:S(En),size:"small",class:"rank",circle:"",onClick:mt(dt,["stop"])},null,8,["icon"])])],10,Ea))),128))]),_:1},8,["modelValue","disabled"]))]),_:1},8,["model","rules"])])]),ln((oe(),je("div",{class:"curriculum-box-content",key:m.value},[R.value?(oe(),we(P,{key:0,ref_key:"contentFormRef",ref:s,model:l.value,rules:N.value,"label-width":"120px"},{default:B(()=>[M(k,{label:"内容标题",prop:"title"},{default:B(()=>[M(g,{modelValue:l.value.title,"onUpdate:modelValue":u[2]||(u[2]=b=>l.value.title=b),minlength:1,maxlength:30,placeholder:"请输入内容标题",onInput:Go},null,8,["modelValue"])]),_:1}),M(k,{label:"课程类型",prop:"content_type"},{default:B(()=>[M(Ge,{modelValue:l.value.content_type,"onUpdate:modelValue":u[3]||(u[3]=b=>l.value.content_type=b),onChange:H},{default:B(()=>[M(Ce,{label:"视频",value:S(J).video},null,8,["value"]),M(Ce,{label:"直播",value:S(J).live},null,8,["value"])]),_:1},8,["modelValue"])]),_:1}),l.value.content_type==S(J).video?(oe(),we(k,{key:0,label:"免费试看",prop:"is_free"},{default:B(()=>[M(ft,{modelValue:l.value.is_free,"onUpdate:modelValue":u[4]||(u[4]=b=>l.value.is_free=b),"active-text":"开","inactive-text":"关","inline-prompt":""},null,8,["modelValue"])]),_:1})):Te("",!0),l.value.content_type==S(J).video?(oe(),we(k,{key:1,label:"视频课程",prop:"video_url"},{default:B(()=>[M(Be,{class:"curriculum-file-uploader",modelValue:l.value.video_url,"onUpdate:modelValue":u[5]||(u[5]=b=>l.value.video_url=b),limit:1,accept:"mp4, 3gp, m3u8","max-size":500,uploader:{action:`${S(Ye).knowledge}course/file/manage/`},button:{text:"视频上传",disabled:!!l.value.video_url},"before-upload":b=>We(b,"video",500,l.value.video_url?[l.value.video_url]:[]),onSuccess:pe,onRemove:ge},null,8,["modelValue","uploader","button","before-upload"]),u[17]||(u[17]=ne("div",{class:"helper-text"},"限上传mp4、3gp、m3u8文件,且不超过500M",-1))]),_:1,__:[17]})):Te("",!0),l.value.content_type==S(J).video?(oe(),we(k,{key:2,label:"视频封面",prop:"video_picture_url"},{default:B(()=>[M(Je,{modelValue:l.value.video_picture_url,"onUpdate:modelValue":u[6]||(u[6]=b=>l.value.video_picture_url=b),limit:1,accept:"png, jpg, jpeg","max-size":10,cropper:{aspectRatio:NaN},uploader:{action:`${S(Ye).knowledge}course/file/manage/`},"before-upload":b=>We(b,"image",10,l.value.video_picture_url?[l.value.video_picture_url]:[])},null,8,["modelValue","uploader","before-upload"]),u[18]||(u[18]=ne("div",{class:"helper-text"},"限上传png、jpg、jpeg文件,且不超过10M",-1))]),_:1,__:[18]})):Te("",!0),l.value.content_type==S(J).live?(oe(),we(k,{key:3,label:"直播地址",prop:"live_url"},{default:B(()=>[M(Je,{modelValue:l.value.live_url,"onUpdate:modelValue":u[7]||(u[7]=b=>l.value.live_url=b),limit:1,accept:"png, jpg, jpeg","max-size":10,cropper:{aspectRatio:NaN},uploader:{action:`${S(Ye).knowledge}course/file/manage/`},"before-upload":b=>We(b,"image",10,l.value.live_url?[l.value.live_url]:[])},null,8,["modelValue","uploader","before-upload"]),u[19]||(u[19]=ne("div",{class:"helper-text"},"带直播地址/二维码的介绍图片",-1)),u[20]||(u[20]=ne("div",{class:"helper-text"},"限上传png、jpg、jpeg文件,且不超过10M",-1))]),_:1,__:[19,20]})):Te("",!0),l.value.content_type==S(J).live?(oe(),we(k,{key:4,label:"直播时间",prop:"live_time"},{default:B(()=>[M(vt,{modelValue:l.value.live_time,"onUpdate:modelValue":u[8]||(u[8]=b=>l.value.live_time=b),type:"datetime",placeholder:"请选择直播时间",format:"YYYY-MM-DD HH:mm","value-format":"YYYY-MM-DD HH:mm"},null,8,["modelValue"])]),_:1})):Te("",!0),l.value.content_type==S(J).live?(oe(),we(k,{key:5,label:"直播回放",prop:"live_video_url"},{default:B(()=>[M(Be,{class:"curriculum-file-uploader",modelValue:l.value.live_video_url,"onUpdate:modelValue":u[9]||(u[9]=b=>l.value.live_video_url=b),limit:1,accept:"mp4, 3gp, m3u8","max-size":500,uploader:{action:`${S(Ye).knowledge}course/file/manage/`},button:{text:"视频上传",disabled:!!l.value.live_video_url},"before-upload":b=>We(b,"video",500,l.value.live_video_url?[l.value.live_video_url]:[]),onSuccess:pe,onRemove:ge},null,8,["modelValue","uploader","button","before-upload"]),u[21]||(u[21]=ne("div",{class:"helper-text"},"限上传mp4、3gp、m3u8文件,且不超过500M",-1))]),_:1,__:[21]})):Te("",!0),M(k,{label:"课件",prop:"course_files"},{default:B(()=>[M(Be,{class:"curriculum-file-uploader",modelValue:l.value.course_files,"onUpdate:modelValue":u[10]||(u[10]=b=>l.value.course_files=b),limit:10,accept:"png, jpg, jpeg, pdf, doc, docx, ppt, pptx, xls, xlsx, rar, zip","max-size":50,multiple:"",uploader:{action:`${S(Ye).knowledge}course/file/manage/`},button:{disabled:l.value.course_files.length>=10},"before-upload":b=>We(b,"document",50,l.value.course_files,10)},null,8,["modelValue","uploader","button","before-upload"]),u[22]||(u[22]=ne("div",{class:"helper-text"},"限上传png、jpg、jpeg、pdf、doc、docx、ppt、pptx、xls、xlsx、rar、zip文件,单个文件不能超过50MB",-1))]),_:1,__:[22]}),M(k,{label:"教案",prop:"course_plan"},{default:B(()=>[M(ht,{modelValue:l.value.course_plan,"onUpdate:modelValue":u[11]||(u[11]=b=>l.value.course_plan=b),toolbarConfig:{excludeKeys:["insertVideo","group-video"]},uploader:{type:"form",action:`${S(Ye).knowledge}course/file/manage/`,buildUrl:b=>b.url}},null,8,["modelValue","uploader"])]),_:1}),M(k,{label:"",prop:""},{default:B(()=>[M(Ze,{position:"bottom",offset:50},{default:B(()=>[ne("div",Ma,[M(h,{type:"primary",onClick:S(qo)},{default:B(()=>u[23]||(u[23]=[Ke("保存")])),_:1,__:[23]},8,["onClick"])])]),_:1})]),_:1})]),_:1},8,["model","rules"])):Te("",!0)])),[[Vt,V.value]])])],4)}}});export{ja as default};