import{I as _}from"./IdnodeGrid-U6EqXqja.js";import{I as h}from"./IdnodeConfigForm-BL6DOswR.js";import{M as w}from"./MasterDetailLayout-oilsSeUU.js";import{I as A}from"./IdnodePickClassDialog-CA1mKQhx.js";import{A as P}from"./ActionMenu-B3aKIJFu.js";import{u as S,a as x,b as I}from"./useMasterDetailActions-7f-vDWd7.js";import{d as D,u as V,w as E,o as f,e as v,f as d,g as p,P as M,t as R,h as s,r as g,k as b,_ as B}from"./index-D92x6h1h.js";import"./DataGrid-CbtTsx8d.js";import"./index-BG9mM10J.js";import"./index-7HNOjfAo.js";import"./localDay-CoEbUe3O.js";import"./SearchInput-DBHWpJgW.js";import"./useGridLayout-DCIiMD42.js";import"./CollapsibleSection.vue_vue_type_style_index_0_lang-Cq2AVc9p.js";import"./sliders-horizontal-Am8f4Xsv.js";import"./useStaleDataRecovery-BuNK-94T.js";const z={class:"stream-profiles"},N={key:1,class:"stream-profiles__empty"},T=D({__name:"ConfigStreamProfilesView",setup(U){const{t:e}=V(),i=g(null),a=g(null);E(i,l=>{l===null&&(a.value=null)});const m=b(()=>{const l=a.value;if(!l)return!1;const o=l.params;if(!Array.isArray(o))return!1;for(const t of o){if(typeof t!="object"||t===null)continue;const n=t;if(n.id==="name")return n.rdonly===!0}return!1}),r=S({selected:i,createEndpoint:"profile/create",successMessage:e("Profile created. Edit name + settings on the right."),noUuidErrorMessage:e("Server returned no profile uuid.")}),c=x({selected:i,createEndpoint:"profile/create"}),u=I({selected:i,confirmText:e("Do you really want to delete this stream profile?")}),k=b(()=>[{id:"add",label:e("Add"),onClick:r.onAddClick},{id:"clone",label:c.inflight.value?e("Cloning…"):e("Clone"),disabled:!i.value||c.inflight.value,onClick:c.run},{id:"delete",label:u.inflight.value?e("Deleting…"):e("Delete"),disabled:!i.value||u.inflight.value||m.value,tooltip:m.value?e("Built-in profiles cannot be deleted"):void 0,onClick:u.run}]),y=[{field:"text",label:e("Name"),sortable:!0,filterType:"string",width:280,minVisible:"phone",phoneRole:"primary"}];function C(l,o){const t=l.uuid;typeof t=="string"?(a.value=l,o(t)):(a.value=null,o(null))}return(l,o)=>(f(),v("div",z,[d(w,{"selected-uuid":i.value,"onUpdate:selectedUuid":o[0]||(o[0]=t=>i.value=t),"storage-key":"config-stream-profiles","default-detail-fraction":35},{master:p(({select:t})=>[d(_,{endpoint:"idnode/load","help-page":"class/profile","entity-class":"profile",columns:y,"extra-params":{class:"profile"},"store-key":"config-stream-profiles","default-sort":{key:"text",dir:"ASC"},"virtual-scroller-options":{itemSize:36,lazy:!1},"count-label":s(e)("profiles"),"client-side-filter":"",selectable:"single",class:"stream-profiles__grid",onRowClick:n=>C(n,t)},{toolbarActions:p(()=>[d(P,{actions:k.value},null,8,["actions"])]),_:1},8,["count-label","onRowClick"])]),detail:p(({selectedUuid:t})=>[t?(f(),M(h,{key:0,uuid:t},null,8,["uuid"])):(f(),v("p",N,R(s(e)("Select a profile on the left to view and edit its configuration.")),1))]),_:1},8,["selected-uuid"]),d(A,{visible:s(r).pickerVisible.value,"builders-endpoint":"profile/builders",title:s(e)("Add Stream Profile"),label:s(e)("Profile type"),onPick:s(r).onClassPicked,onClose:o[1]||(o[1]=t=>s(r).pickerVisible.value=!1)},null,8,["visible","title","label","onPick"])]))}}),te=B(T,[["__scopeId","data-v-edad3393"]]);export{te as default};
