1import{F as T,m as _,n as k}from"./c-el-form-item-lGG0C5Mp.js";import{aR as $,cx as w,cC as F,cD as A,cE as B,cF as I,bm as D,a_ as c,bc as N,cn as y,cy as U,c9 as R,ca as S,aV as b,b2 as E,b3 as a,bg as s,aW as z,bt as L,c1 as M,b1 as O,bR as C}from"./c-index-C7aDQtMU.js";const W=$({name:"AddToCollectionDialog",components:{ElDialog:I,ElForm:k,ElFormItem:_,ElInput:B,ElSelect:A,ElOption:F,ElButton:w,FormErrors:T},props:{modelValue:{type:Boolean,default:!1},sectionId:{type:Number,default:null}},emits:["update:modelValue","added"],setup(e,{emit:l}){const i=c(!1),r=c(null),p=c([]),n=c({title:"",tags:[]}),u=N({get:()=>e.modelValue,set:t=>l("update:modelValue",t)}),m=async()=>{try{const{data:t}=await y.get("admin/section-collection"),f=Array.isArray(t)?t:(t==null?void 0:t.data)??[],d=new Set;f.forEach(g=>(g.tags||[]).forEach(o=>d.add(o))),p.value=Array.from(d).sort()}catch{}};return D(()=>e.modelValue,t=>{t&&m()}),{visible:u,loading:i,errors:r,form:n,suggestedTags:p,reset:()=>{n.value={title:"",tags:[]},r.value=null},submit:async()=>{if(e.sectionId){i.value=!0,r.value=null;try{await y.post("admin/section-collection",{section_id:e.sectionId,title:n.value.title||void 0,tags:n.value.tags.length?n.value.tags:void 0}),U.success("СекÑÐ¸Ñ Ð´Ð¾Ð±Ð°Ð²Ð»ÐµÐ½Ð° в коллекÑиÑ"),l("added",e.sectionId),u.value=!1}catch(t){r.value=t}finally{i.value=!1}}}}}});function j(e,l,i,r,p,n){const u=B,m=_,v=F,V=A,t=k,f=S("FormErrors"),d=w,g=I;return b(),E(g,{modelValue:e.visible,"onUpdate:modelValue":l[4]||(l[4]=o=>e.visible=o),title:"ÐобавиÑÑ Ð² коллекÑиÑ",width:"440px","close-on-click-modal":!1,onClose:e.reset},{footer:a(()=>[s(d,{onClick:l[3]||(l[3]=o=>e.visible=!1),disabled:e.loading},{default:a(()=>[...l[6]||(l[6]=[C("ÐÑмена",-1)])]),_:1},8,["disabled"]),s(d,{type:"primary",loading:e.loading,onClick:e.submit},{default:a(()=>[...l[7]||(l[7]=[C(" ÐобавиÑÑ Ð² коллекÑÐ¸Ñ ",-1)])]),_:1},8,["loading","onClick"])]),default:a(()=>[s(t,{"label-position":"top",disabled:e.loading},{default:a(()=>[s(m,{label:"Ðазвание ÑекÑии"},{default:a(()=>[s(u,{modelValue:e.form.title,"onUpdate:modelValue":l[0]||(l[0]=o=>e.form.title=o),placeholder:"ÐведиÑе название...",clearable:""},null,8,["modelValue"])]),_:1}),s(m,{label:"Теги"},{default:a(()=>[s(V,{modelValue:e.form.tags,"onUpdate:modelValue":l[1]||(l[1]=o=>e.form.tags=o),multiple:"",filterable:"","allow-create":"","default-first-option":"",placeholder:"ÐобавÑÑе Ñеги...",style:{width:"100%"}},{default:a(()=>[(b(!0),z(L,null,M(e.suggestedTags,o=>(b(),E(v,{key:o,label:o,value:o},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),l[5]||(l[5]=O("div",{style:{"font-size":"11px",color:"var(--el-text-color-secondary)","margin-top":"4px"}}," ÐведиÑе Ñег и нажмиÑе Enter ÑÑÐ¾Ð±Ñ ÑоздаÑÑ Ð½Ð¾Ð²Ñй ",-1))]),_:1})]),_:1},8,["disabled"]),s(f,{modelValue:e.errors,"onUpdate:modelValue":l[2]||(l[2]=o=>e.errors=o)},null,8,["modelValue"])]),_:1},8,["modelValue","onClose"])}const H=R(W,[["render",j]]);export{H as A};
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.