1import{r as a,j as e}from"./vendor-react-72e4a099.js";import{u as T,d as C,f as E,B as S,F as L,I as A}from"./Toast-43ee7788.js";import{C as h,a as k}from"./Display-48adcc24.js";import{C as B}from"./Controls-5a18fd37.js";import{e as x}from"./api-d8a57490.js";import{p as D}from"./format-5039f022.js";import{SettingsHead as F}from"./SettingsLayout-14516db3.js";import{s as j}from"./sceneTemplates-a017d524.js";import{L as I}from"./layout-template-dfe5c440.js";import{P as R}from"./pencil-line-6bfa5da3.js";import{T as $}from"./trash-2-7a739e24.js";import"./createLucideIcon-581cd729.js";import"./eye-5711d0dd.js";import"./x-b9f3d093.js";import"./circle-check-63b159d4.js";import"./circle-alert-67975319.js";import"./buildLifecycle-a44b0e05.js";import"./chevron-down-888c3b30.js";import"./check-083433f7.js";import"./copy-34f4069e.js";import"./CabinetContext-31fc5321.js";/* empty css *//* empty css */import"./user-2d8f405f.js";import"./video-a08888e9.js";import"./palette-a7aa7952.js";import"./plug-1e9df63e.js";import"./credit-card-a31de76a.js";function M(i){try{return new Date(i).toLocaleDateString("ru-RU",{day:"numeric",month:"long",year:"numeric"})}catch{return""}}function us(){const i=T(),[c,m]=a.useState(null),[f,g]=a.useState(null),[d,t]=a.useState(null),[o,y]=a.useState(""),[v,N]=a.useState(!1),[r,u]=a.useState(null),p=a.useCallback(async()=>{g(null);try{const s=await j.list();m(Array.isArray(s==null?void 0:s.items)?s.items:[])}catch(s){g(x(s,"Ðе ÑдалоÑÑ Ð·Ð°Ð³ÑÑзиÑÑ ÑаблонÑ"))}},[]);a.useEffect(()=>{p()},[p]);const b=async()=>{if(!(!d||!o.trim()||v)){N(!0);try{const s=await j.rename(d.id,o.trim());m(n=>(n||[]).map(l=>l.id===s.id?s:l)),t(null),i.success("Шаблон пеÑеименован")}catch(s){i.error(x(s,"Ðе ÑдалоÑÑ Ð¿ÐµÑеименоваÑÑ"))}finally{N(!1)}}},w=async s=>{try{await j.remove(s.id),m(n=>(n||[]).filter(l=>
1l.id!==s.id)),i.success(`Шаблон «${s.name}» ÑдалÑн`)}catch(n){i.error(x(n,"Ðе ÑдалоÑÑ ÑдалиÑÑ Ñаблон"))}};return e.jsxs(e.Fragment,{children:[e.jsx(F,{title:"Ð¨Ð°Ð±Ð»Ð¾Ð½Ñ ÑÑен",subtitle:"Ðапки ÑÑен из ÑÑÑдии â ÑÑÐ¾Ð±Ñ Ð½Ð°ÑÑÑоиÑÑ Ð¾Ð´Ð¸Ð½ Ñаз и иÑполÑзоваÑÑ Ð² дÑÑгиÑ
ÑÑиÑаÑ
"}),e.jsxs(h,{className:"sn-a-tpl-how",children:[e.jsx(I,{className:"sn-i","aria-hidden":"true"}),e.jsxs("div",{children:[e.jsx("b",{children:"Ðак ÑÑо ÑабоÑаеÑ"}),e.jsx("span",{children:"Ð ÑÑÑдии Ñ Ð¿Ð°Ð¿ÐºÐ¸ ÑÑен нажмиÑе «â¦Â» â «СоÑ
ÑаниÑÑ ÐºÐ°Ðº Ñаблон». РдÑÑгой ÑÑÑдии: «СÑенÑ» â «ШаблонÑ» â «ÐобавиÑÑ» â Ñаблон пÑидÑÑ Ð¾ÑделÑной папкой Ñ Ñеми же макеÑами, ÑоÑмой меÑÑ, Ñоном и гÑаÑикой. ÐÑдей и ÑÐ°Ð¹Ð»Ñ ÑÑиÑа Ñаблон не пеÑеноÑиÑ."})]})]}),f?e.jsxs("p",{className:"sn-error",role:"alert",children:[f," ",e.jsx("button",{type:"button",className:"sn-e-linkbtn",onClick:()=>void p(),children:"ÐовÑоÑиÑÑ"})]}):c===null?e.jsxs("div",{className:"sn-a-tpl-list",children:[e.jsx(k,{height:76}),e.jsx(k,{height:76})]}):c.length===0?e.jsxs(h,{className:"sn-a-tpl-empty",children:[e.jsx("b",{children:"Шаблонов пока неÑ"}),e.jsx("span",{children:"СоÑ
ÑаниÑе пеÑвÑÑ Ð¿Ð°Ð¿ÐºÑ ÑÑен из ÑÑÑдии â она поÑвиÑÑÑ Ð·Ð´ÐµÑÑ."})]}):e.jsx("div",{className:"sn-a-tpl-list","data-testid":"cabinet-scene-templates",children:c.map(s=>e.jsxs(h,{className:"sn-a-tpl","data-template":s.name,children:[e.jsxs("div",{className:"sn-a-tpl-main",children:[e.jsx("b",{children:s.name}),e.jsxs("span",{className:"sn-a-muted",children:[s.sceneCount," ",D(s.sceneCount,"ÑÑена","ÑÑенÑ","ÑÑен")," · папка «",s.folderName,"» · ",s.mine?"вÑ":s.ownerName||"команда"," · ",M(s.updatedAt)]}),e.jsx("span",{className:"sn-a-tpl-scenes",children:s.scenes.map(n=>e.jsx("span",{className:"sn-a-tpl-chip",children:n.name},n.id))})]}),s.canManage&&e.jsxs("div",{className:"sn-a-tpl-acts",children:[e.jsx(C,{label:`ÐеÑеименоваÑÑ Â«${s.name}»`,size:"sm",onClick:()=>{t(s),y(s.name)},children:e.jsx(R,{className:"sn-i sn-i-16"})}),e.jsx(C,{label:`УдалиÑÑ Â«${s.name}»`,size:"sm",onClick:()=>u(s),children:e.jsx($,{className:"sn-i sn-i-16"})})]})]},s.id))}),e.jsx(E,{open:!!d,onClose:()=>t(null),width:440,title:"ÐеÑеименоваÑÑ Ñаблон",footer:e.jsxs(e.Fragment,{children:[e.jsx(S,{variant:"quiet",onClick:()=>t(null),children:"ÐÑмена"}),e.jsx(S,{variant:"primary",loading:v,disabled:!o.trim(),onClick:()=>void b(),children:"СоÑ
ÑаниÑÑ"})]}),children:e.jsx(L,{label:"Ðазвание Ñаблона",children:e.jsx(A,{value:o,onChange:s=>y(s.target.value.slice(0,60)),onKeyDown:s=>{s.key==="Enter"&&b()},"aria-label":"Ðазвание Ñаблона","data-autofocus":!0})})}),e.jsx(B,{open:!!r,onClose:()=>u(null),onConfirm:()=>{r&&w(r),u(null)},title:r?`УдалиÑÑ Ñаблон «${r.name}»?`:"",description:"СÑенÑ, Ñже добавленнÑе в ÑÑÑдии, оÑÑанÑÑÑÑ â пÑопадÑÑ ÑолÑко Ñаблон.",confirmLabel:"УдалиÑÑ Ñаблон"})]})}export{us 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.