import{A as S}from"./save-BiBE8Men.js";import{L as E}from"./DateField.vue_vue_type_style_index_0_lang-BFhdkW_K.js";import{T as z}from"./trash-2-z3Bhtg-8.js";import{v as n,x as a,l as t,p as h,z as b,B as _,D as d,F as w,y as C,s as v,k as p,A as $,E as L,N as k,K as B,L as D,q as T,V as x,X as A,C as N,r as q}from"./x-CuOWXDIc.js";const M={class:"submenu"},V={class:"submenu__inner"},U={class:"submenu__left"},X=["href"],F={class:"submenu__title"},K={key:0,class:"submenu__divider"},P={key:1,class:"submenu__tabs"},R=["onClick"],W={class:"submenu__right"},j={class:"submenu__controls"},G=["disabled"],H={key:1,class:"submenu__dirty-dot"},te={__name:"SubMenu",props:{backUrl:{type:String,required:!0},title:{type:String,required:!0},tabs:{type:Array,default:()=>[]},activeTab:{type:String,default:null},isDirty:{type:Boolean,default:!1},isSaving:{type:Boolean,default:!1}},emits:["tab-change","save","delete"],setup(e,{emit:y}){const u=y;function l(i){return i==null?0:typeof i=="function"?i():i}return(i,o)=>(n(),a("div",M,[t("div",V,[t("div",U,[t("a",{href:e.backUrl,class:"submenu__back"},[h(b(S),{class:"icon-4"})],8,X),t("span",F,_(e.title),1),e.tabs.length?(n(),a("div",K)):d("",!0),e.tabs.length?(n(),a("div",P,[(n(!0),a(w,null,C(e.tabs,s=>(n(),a("button",{key:s.key,type:"button",class:v(["submenu__tab",e.activeTab===s.key?"submenu__tab--active":"submenu__tab--inactive"]),onClick:r=>u("tab-change",s.key)},[(n(),p($(s.icon),{class:"icon-3h"})),L(" "+_(s.label)+" ",1),l(s.count)>0?(n(),a("span",{key:0,class:v(["submenu__tab-count",e.activeTab===s.key?"submenu__tab-count--active":"submenu__tab-count--inactive"])},_(l(s.count)),3)):d("",!0)],10,R))),128))])):d("",!0)]),t("div",W,[t("div",j,[k(i.$slots,"controls")]),t("button",{type:"button",class:"btn btn-primary btn-sm",disabled:e.isSaving,onClick:o[0]||(o[0]=s=>u("save"))},[e.isSaving?(n(),p(b(E),{key:0,class:"icon-3h icon-spin"})):d("",!0),o[2]||(o[2]=t("span",{class:"submenu__save-label"},"Сохранить",-1)),e.isDirty&&!e.isSaving?(n(),a("span",H)):d("",!0)],8,G),t("button",{type:"button",class:"submenu__delete-btn",title:"Удалить",onClick:o[1]||(o[1]=s=>u("delete"))},[h(b(z),{class:"icon-4"})])])])]))}},I={class:"edit-side-panel__header"},J={class:"edit-side-panel__title"},O={class:"edit-side-panel__body"},se={__name:"EditSidePanel",props:{open:{type:Boolean,default:!1},title:{type:String,default:""},width:{type:Number,default:300},side:{type:String,default:"left",validator:e=>["left","right"].includes(e)}},emits:["close","resize","resize-start","resize-end"],setup(e,{emit:y}){const u=e,l=y,i=q(!1);function o(r){r.preventDefault(),i.value=!0,l("resize-start"),document.querySelectorAll("iframe").forEach(c=>{c.style.pointerEvents="none"});function m(c){const g=u.side==="left"?c.clientX:window.innerWidth-c.clientX;l("resize",g)}function f(){i.value=!1,l("resize-end"),document.querySelectorAll("iframe").forEach(c=>{c.style.pointerEvents=""}),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",f)}document.addEventListener("mousemove",m),document.addEventListener("mouseup",f)}function s(r){r.key==="Escape"&&u.open&&l("close")}return B(()=>document.addEventListener("keydown",s)),D(()=>document.removeEventListener("keydown",s)),(r,m)=>(n(),p(N,{name:e.side==="left"?"edit-side-panel-left":"edit-side-panel-right"},{default:T(()=>[e.open?(n(),a("div",{key:0,class:v(["edit-side-panel",`edit-side-panel--${e.side}`,{"edit-side-panel--no-select":i.value}])},[e.side==="right"?(n(),a("div",{key:0,class:v(["edit-side-panel__resizer",{"edit-side-panel__resizer--active":i.value}]),onMousedown:o},null,34)):d("",!0),t("div",{class:"edit-side-panel__content",style:x({width:`${e.width}px`})},[t("div",I,[t("h3",J,_(e.title),1),t("button",{type:"button",class:"btn btn-empty btn-xs edit-side-panel__close",title:"Закрыть (Esc)",onClick:m[0]||(m[0]=f=>l("close"))},[h(b(A),{class:"icon-3h"})])]),t("div",O,[k(r.$slots,"default")])],4),e.side==="left"?(n(),a("div",{key:1,class:v(["edit-side-panel__resizer",{"edit-side-panel__resizer--active":i.value}]),onMousedown:o},null,34)):d("",!0)],2)):d("",!0)]),_:3},8,["name"]))}};export{te as _,se as a};
