MOON
Server: Apache
System: Linux server1.studioinfinity.com.br 2.6.32-954.3.5.lve1.4.90.el6.x86_64 #1 SMP Tue Feb 21 12:26:30 UTC 2023 x86_64
User: artinside (517)
PHP: 7.4.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/netdata/usr/share/netdata/web/v3/5060.df1c5389716eb7866ad0.chunk.js
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{};e.SENTRY_RELEASE={id:"8b1701d6db299c2b7259bc89c3ef365137725d5e"};var t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="df6546d0-0025-479f-8999-6264913965ff",e._sentryDebugIdIdentifier="sentry-dbid-df6546d0-0025-479f-8999-6264913965ff")}catch(e){}}(),(globalThis.webpackChunkcloud_frontend=globalThis.webpackChunkcloud_frontend||[]).push([[5060],{22959(e,t,n){n.r(t),n.d(t,{default:()=>Te});var l=n(96540),a=n(38429),o=n(6304),s=n(41579),r=n(67294),i=n(76667),d=n(32788),c=n(29263),h=n(47410),u=n(16866),x=n(19186),p=n(24609),m=n(5907),g=n(82418),b=n(38757),y=n(882);const f=y.default.img.withConfig({displayName:"styled__Illustration",componentId:"sc-1yhntgl-0"})(["margin:0 auto;"]),j=(0,y.default)(a.Text).withConfig({displayName:"styled__StyledText",componentId:"sc-1yhntgl-1"})(["display:block;"]),w=y.default.div.withConfig({displayName:"styled__TextHeader",componentId:"sc-1yhntgl-2"})(["margin-bottom:",";font-weight:700;"],(0,a.getSizeBy)(2)),C=y.default.div.withConfig({displayName:"styled__StaticCheckmarks",componentId:"sc-1yhntgl-3"})(["margin-top:",";margin-bottom:",";"],(0,a.getSizeBy)(2),(0,a.getSizeBy)(5)),v=y.default.div.withConfig({displayName:"styled__CheckmarkLine",componentId:"sc-1yhntgl-4"})(["display:flex;align-items:center;"]),k=(0,y.default)(a.Icon).withConfig({displayName:"styled__StyledIcon",componentId:"sc-1yhntgl-5"})(["margin-right:4px;height:18px;> use{fill:",";}"],(0,a.getColor)("primary")),T=(0,y.default)(k).withConfig({displayName:"styled__HelpIcon",componentId:"sc-1yhntgl-6"})(["vertical-align:middle;"]),D=y.default.div.withConfig({displayName:"styled__LearnMoreSection",componentId:"sc-1yhntgl-7"})(["margin-top:",";"],(0,a.getSizeBy)(4)),A=y.default.a.withConfig({displayName:"styled__Link",componentId:"sc-1yhntgl-8"})(["text-decoration:underline;color:",";&:visited{color:",";}"],(0,a.getColor)("success"),(0,a.getColor)("success"));var I=n(74848);const S=e=>{let{onClose:t}=e;const n=(0,i.Zp)(),[o,s]=(0,l.useState)(!1),[r,y]=(0,l.useState)(""),{id:S,slug:F}=(0,p.ap)(),M=(0,x.ID)(),B=(0,x.QW)(),L=(0,l.useCallback)(e=>{let{slug:l}=e;t(),n(`/spaces/${F}/rooms/${B}/dashboards/${l}`)},[F,B]),_=(0,m.Dn)(S,M,{onSuccess:L}),P=(0,l.useCallback)(()=>_({name:r}),[r]),$=r.length>0;return(0,I.jsxs)(d.GO,{onClose:t,children:[(0,I.jsx)(c.z,{onClose:t,title:"New Dashboard",children:(0,I.jsx)(a.Button,{label:"Add",icon:"plus",onClick:P,"data-testid":"addNewDashboardModal-add-button"})}),(0,I.jsx)(h.U,{children:"Create new Dashboard"}),(0,I.jsxs)(d.Yv,{children:[(0,I.jsx)(b.A,{value:r,label:"Name",onChange:e=>{y(e.target.value)},isValid:o,setIsValid:s,isDirty:$,instantFeedback:"all",onKeyDown:e=>e.keyCode===u.I7&&o&&P,"data-testid":"addNewDashboardModal-dashboardName-input",containerStyles:{flex:{grow:0,shrink:0},margin:[0,0,4,0]}}),(0,I.jsxs)(j,{children:[(0,I.jsx)(w,{children:"What can you do with Dashboards?"}),"Combine all the metrics that matter to you, from all the nodes that matter to you, into one clean interface that helps you visually detect anomalies as they\u2019re happening. Building a new dashboard will only take a few minutes, and the metrics are always real-time."]}),(0,I.jsxs)(C,{children:[(0,I.jsxs)(v,{children:[(0,I.jsx)(k,{name:"check"}),(0,I.jsx)(a.Text,{children:"Add charts from your infrastructure"})]}),(0,I.jsxs)(v,{children:[(0,I.jsx)(k,{name:"check"}),(0,I.jsx)(a.Text,{children:"Group information in a meaningful way"})]}),(0,I.jsxs)(D,{children:[(0,I.jsx)(T,{name:"help"}),(0,I.jsx)(a.Text,{children:"Learn more about Dashboards"})," ",(0,I.jsx)(A,{href:"https://learn.netdata.cloud/docs/dashboards-and-charts/",target:"_blank",rel:"noopener noreferrer",children:"In our documentation"})]})]}),(0,I.jsx)(f,{src:g.$})]})]})};var F=n(63474),M=n(63950),B=n.n(M),L=(n(74423),n(98992),n(81454),n(37550),n(51262)),_=n(39175);const P=e=>{let{handleOpenAddDashboardModal:t,hasPermissionToAddDashboard:n,hasPermissionToDeleteDashboard:a,refetch:o,duplicateDashboard:s}=e;const i=(0,x.GJ)(),d=(0,x.XA)("name"),c=(0,m.Ts)(),h=(0,r.q)(),u=(0,l.useMemo)(()=>h.some(e=>e===_.LA),[h]),{hasLimitations:p,maxDashboards:g}=(0,L.A)(),b=n&&!(p&&h.length-(u?1:0)>=g),y=async(e,t)=>{const n=(Array.isArray(e)?e:[e]).map(e=>{let{id:t}=e;return t});await c({ids:n},{onSuccess:()=>t.toggleAllRowsSelected(!1)}),o()},f=(0,l.useMemo)(()=>({duplicate:{icon:"copy",handleAction:e=>s(e.id),tooltipText:"Duplicate dashboard",confirmLabel:"Duplicate",confirmationMessage:e=>`A new dashboard named "Copy of ${e.name}" will be created in this room with the same layout and card configuration. Node selections will be reset so you can configure them for the new dashboard.`,confirmationTitle:e=>`Duplicate ${e.name}`,declineLabel:"Cancel",isDisabled:()=>!b,disabledTooltipText:n?`Your plan does not allow you to create more than ${g} dashboards.`:"You don't have permission to create dashboards"},delete:{confirmLabel:"Yes, delete",confirmationMessage:e=>(0,I.jsxs)(I.Fragment,{children:["You are about to delete ",(0,I.jsx)("strong",{children:e.name})," from ",(0,I.jsx)("strong",{children:d}),".",(0,I.jsx)("br",{}),"Are you sure you want to continue?"]}),confirmationTitle:e=>`Delete ${e.name}`,declineLabel:"Cancel",handleAction:y,tooltipText:"Delete dashboard",isDisabled:e=>!a||i&&e.id===_.LA,disabledTooltipText:a?"Local dashboard cannot be deleted":"Only admins can delete"}}),[a,b,s,g,n]),j=(0,l.useMemo)(()=>({addEntry:{handleAction:t,isVisible:n,tooltipText:"Create dashboard",disabledTooltipText:`Your plan does not allow you to create more than ${g} dashboards.`,disabled:p&&h.length-(u?1:0)>=g},delete:{confirmLabel:"Yes, delete",confirmationMessage:(e,t)=>(0,I.jsxs)(I.Fragment,{children:["You are about to delete"," ",(0,I.jsx)("strong",{children:t.length>1?`${t.length} dashboards`:t[0].name})," ","from ",(0,I.jsx)("strong",{children:d}),".",(0,I.jsx)("br",{}),"Are you sure you want to continue?"]}),confirmationTitle:()=>"Delete",disabledTooltipText:"Delete is disabled because you haven't selected dashboards",declineLabel:"Cancel",handleAction:y,tooltipText:"Delete dashboards",isVisible:a}}));return{rowActions:a||b?f:[],bulkActions:[n,a].some(Boolean)?j:[]}};var $=n(96957),E=n(45087);const N=e=>{let t=new Date(e);t=t.getTime()===t.getTime()?t:new Date;const[,n,l,a]=t.toDateString().split(" ");return`${n} ${l}, ${a}`};var R=n(79748);const O=e=>{let{name:t}=e;return(0,I.jsxs)(a.Flex,{width:"300px",column:!0,gap:1,children:[(0,I.jsx)(a.Text,{strong:!0,children:"Locked!"}),(0,I.jsxs)(a.Text,{children:["The dashboard ",(0,I.jsx)(a.Text,{strong:!0,children:t})," is locked."]}),(0,I.jsx)(a.Text,{children:"Your plan is limited to 1 dashboard. You can delete some dashboards or upgrade your plan for no limitations."})]})},U=e=>{let{getValue:t,row:n}=e;const l="notAvailable"==n?.original?.state,o=t();return l?(0,I.jsx)(E.A,{content:(0,I.jsx)(O,{name:o}),align:"bottom",isBasic:!0,children:(0,I.jsxs)(a.Flex,{alignItems:"center",children:[(0,I.jsx)(a.Text,{children:o}),(0,I.jsx)(a.Icon,{name:"padlock",height:"12px",color:"text"})]})}):(0,I.jsx)(R.A,{as:"Link",to:n.original.slug,children:o})};var V=n(99728),z=n(57738);const Y=e=>{let{refetch:t,handleOpenAddDashboardModal:n}=e;const[,o]=(0,l.useState)(),s=(0,r.q)(),i=(0,$.Sf)(s),d=(0,V.JT)("dashboard:Create"),c=(0,V.JT)("dashboard:Delete"),h=(0,z.L)(),u=(0,l.useMemo)(()=>[{id:"name",accessorKey:"name",header:"Name",cell:U},{id:"updatedAt",accessorKey:"updatedAt",header:"Last modified",cell:e=>{let{getValue:t}=e;return(0,I.jsx)(a.TextSmall,{children:N(t())})},sortingFn:"datetime"},{id:"createdAt",accessorKey:"createdAt",header:"Created",cell:e=>{let{getValue:t}=e;return(0,I.jsx)(a.TextSmall,{children:N(t())})},sortingFn:"datetime"}],[]),{rowActions:x,bulkActions:p}=P({dashboards:i,handleOpenAddDashboardModal:n,hasPermissionToAddDashboard:d,hasPermissionToDeleteDashboard:c,refetch:t,duplicateDashboard:h}),m=(0,l.useCallback)((e,t,n)=>{const l=n?.toLowerCase?.(),a=e.getValue("name")?.toLowerCase?.(),o=`${N(e.getValue("updatedAt"))?.toLowerCase?.()}`,s=`${N(e.getValue("createdAt"))?.toLowerCase?.()}`;return a.includes(l)||o.includes(l)||s.includes(l)},[]);return{rowActions:x,bulkActions:p,data:i,enableSelection:c,columns:u,enableSorting:!0,globalFilterFn:m,setGlobalFilter:o}},G=[{id:"updatedAt",desc:!0}],H=e=>{let{refetch:t=B(),handleOpenAddDashboardModal:n}=e;const{enableSelection:l,columns:o,data:s,rowActions:r,bulkActions:i,enableSorting:d,globalFilterFn:c,setGlobalFilter:h}=Y({refetch:t,handleOpenAddDashboardModal:n});return(0,I.jsx)(a.Table,{rowActions:r,enableSelection:l,data:s,dataColumns:o,bulkActions:i,enableSorting:d,globalFilterFn:c,onSearch:h,testPrefixCallback:e=>e.name,sortBy:G,title:"Dashboards"})};var K=n(60908),q=n(1011),J=n(63928),W=n(591),Q=n(54148);const Z=function(){let{onSuccess:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=(0,J.yK)({onSuccess:e});return(0,l.useCallback)(function(){let{name:e,entries:n=[],transition:l=Q.Ez,loop:a=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const o=Date.now();return t({type:Q.Zg,scope:Q.CA,entity:Q.w0,name:e||"Untitled playlist",path:Q.Bb,value:{entries:n,transition:l,loop:a,createdAt:o,updatedAt:o}})},[t])};n(8872);const X=e=>{let{onPlay:t,onEdit:n,onTvUrl:l,onDuplicate:o,onDelete:s}=e;return(0,I.jsxs)(a.Flex,{gap:1,children:[(0,I.jsx)(a.Button,{onClick:t,children:"Play"}),(0,I.jsx)(a.Button,{flavour:"hollow",onClick:n,children:"Edit"}),(0,I.jsx)(a.Button,{flavour:"hollow",onClick:l,children:"TV URL"}),(0,I.jsx)(a.Button,{flavour:"hollow",onClick:o,children:"Duplicate"}),(0,I.jsx)(a.Button,{flavour:"hollow",onClick:s,children:"Delete"})]})},ee=e=>{let{playlist:t,onPlay:n,onEdit:l,onTvUrl:o,onDuplicate:s,onDelete:r}=e;const i=t.entries.reduce((e,t)=>e+t.durationMs,0);return(0,I.jsxs)(a.Flex,{padding:[2,3],gap:3,alignItems:"center",border:!0,round:!0,justifyContent:"between",children:[(0,I.jsx)(a.Text,{strong:!0,children:t.name}),(0,I.jsxs)(a.Flex,{gap:4,alignItems:"center",children:[(0,I.jsxs)(a.TextSmall,{color:"textLite",children:[t.entries.length," entries"]}),(0,I.jsx)(a.TextSmall,{color:"textLite",children:(d=i,`${Math.round(d/1e3)}s`)}),(0,I.jsx)(X,{onPlay:n,onEdit:l,onTvUrl:o,onDuplicate:s,onDelete:r})]})]});var d},te=e=>{let{onCreate:t}=e;return(0,I.jsxs)(a.Flex,{flex:"1",column:!0,alignItems:"center",justifyContent:"center",gap:2,children:[(0,I.jsx)(a.H3,{children:"No playlists yet"}),(0,I.jsx)(a.Text,{children:"Create a playlist to cycle through dashboards on a NOC wall or presentation."}),(0,I.jsx)(a.Button,{onClick:t,children:"New playlist"})]})};n(54520),n(25509),n(65223),n(60321),n(41927),n(11632),n(64377),n(66771),n(12516),n(68931),n(52514),n(35694),n(52774),n(49536),n(21926),n(94483),n(16215);const ne=e=>{let{addedDashboardIds:t,onAdd:n}=e;const[o,s]=(0,l.useState)(""),i=(0,r.q)(),d=(0,$.Sf)(i),c=(0,l.useMemo)(()=>new Set(t),[t]),h=d.filter(e=>e?.name?.toLowerCase().includes(o.toLowerCase()));return(0,I.jsxs)(a.Flex,{column:!0,gap:2,flex:"1",padding:[2],height:"100%",overflow:"hidden",children:[(0,I.jsx)(a.TextInput,{placeholder:"Search dashboards\u2026",value:o,onChange:e=>s(e.target.value)}),(0,I.jsx)(a.Flex,{column:!0,flex:"1",overflow:{vertical:"auto"},children:h.map(e=>{const t=c.has(e.id);return(0,I.jsxs)(a.Flex,{padding:[1.25,2],cursor:t?"not-allowed":"pointer",opacity:t?.5:1,onClick:()=>!t&&n(e.id),gap:2,alignItems:"center",justifyContent:"between",_hover:t?void 0:{background:"secondaryHighlight"},children:[(0,I.jsx)(a.Text,{children:e.name}),t&&(0,I.jsx)(a.TextSmall,{color:"textLite",children:"Added"})]},e.id)})})]})};n(72577);var le=n(43375),ae=n(43627),oe=n(74979);const se=36e5,re=864e5,ie=e=>{if(!e)return"default";const t=Math.abs(e.after);return t<se?`${Math.round(t/6e4)}m`:t<re?`${Math.round(t/se)}h`:`${Math.round(t/re)}d`},de=e=>{let{entry:t,index:n,isOnly:l,onEdit:o,onRemove:s}=e;const r=(0,$.fz)(t.dashboardId),{attributes:i,listeners:d,setNodeRef:c,transform:h,transition:u}=(0,ae.gl)({id:t.id}),x={transform:oe.Ks.Transform.toString(h),transition:u};return(0,I.jsx)("div",{ref:c,style:x,...i,children:(0,I.jsxs)(a.Flex,{gap:3,padding:[2,3],alignItems:"center",justifyContent:"between",background:"elementBackground",border:{side:"all",color:"border"},round:!0,cursor:"pointer",onClick:o,_hover:{background:"secondaryHighlight"},children:[(0,I.jsxs)(a.Flex,{gap:2,alignItems:"center",flex:"1",overflow:"hidden",children:[!l&&(0,I.jsx)(a.Icon,{name:"nav_dots",color:"textLite",cursor:"grab",size:"small",...d,onClick:e=>e.stopPropagation()}),(0,I.jsx)(a.TextSmall,{color:"textLite",children:n+1}),(0,I.jsx)(a.Text,{truncate:!0,children:r?.name||t.dashboardId})]}),(0,I.jsxs)(a.Flex,{gap:2,alignItems:"center",children:[(0,I.jsxs)(a.Pill,{flavour:"neutral",size:"small",children:[Math.round(t.durationMs/1e3),"s"]}),(0,I.jsx)(a.Pill,{flavour:"neutral",size:"small",children:t.mode}),(0,I.jsx)(a.Pill,{flavour:"neutral",size:"small",children:ie(t.timeRange)})]}),!l&&(0,I.jsx)(a.IconButton,{icon:"x",flavour:"borderless",tooltip:"Remove",onClick:e=>{e.stopPropagation(),s()}})]})})};const ce=n(71336).AE.map(e=>({label:e.period,value:{after:1e3*e.value,before:0}})),he=e=>{let{entry:t,onChange:n,onClose:l}=e;const o=e=>n({...t,...e});return(0,I.jsxs)(a.Flex,{column:!0,gap:3,padding:[3],background:"elementBackground",border:!0,round:!0,width:{max:"640px"},children:[(0,I.jsx)(a.TextInput,{label:"Duration (seconds)",type:"number",value:Math.round(t.durationMs/1e3),onChange:e=>o({durationMs:1e3*Math.max(1,Number(e.target.value))})}),(0,I.jsxs)(a.Flex,{column:!0,gap:1,children:[(0,I.jsx)(a.Text,{strong:!0,children:"Playback"}),(0,I.jsx)(a.Flex,{gap:1,children:["static","scroll"].map(e=>(0,I.jsx)(a.Button,{flavour:t.mode===e?"default":"hollow",onClick:()=>o({mode:e}),children:"static"===e?"Static":"Scroll"},e))})]}),(0,I.jsxs)(a.Flex,{column:!0,gap:1,children:[(0,I.jsx)(a.Text,{strong:!0,children:"Time range"}),(0,I.jsx)(a.Flex,{gap:1,flexWrap:!0,width:"100%",children:ce.map(e=>{return(0,I.jsx)(a.Button,{flavour:(n=t.timeRange,l=e.value,n&&l&&n.after===l.after&&n.before===l.before?"default":"hollow"),margin:[0,0,1,0],onClick:()=>o({timeRange:e.value}),children:e.label},e.label);var n,l})})]}),(0,I.jsx)(a.Box,{children:(0,I.jsx)(a.Button,{onClick:l,children:"Done"})})]})},ue=e=>{let{draft:t,onChange:n}=e;const[o,s]=(0,l.useState)(null),r=(0,le.FR)((0,le.MS)(le.AN),(0,le.MS)(le.uN,{coordinateGetter:ae.JR})),i=(0,l.useCallback)(e=>{const{active:l,over:a}=e;if(l?.id&&a?.id&&l.id!==a.id){const e=t.entries.map(e=>e.id),o=e.indexOf(l.id),s=e.indexOf(a.id);n({...t,entries:(0,ae.be)(t.entries,o,s)})}},[t,n]),d=t.entries.find(e=>e.id===o);return(0,I.jsxs)(a.Flex,{column:!0,gap:3,flex:"1",padding:[2],height:"100%",overflow:"hidden",children:[(0,I.jsx)(a.TextInput,{value:t.name,onChange:e=>n({...t,name:e.target.value}),placeholder:"Playlist name"}),(0,I.jsxs)(a.Flex,{gap:2,alignItems:"center",children:[(0,I.jsx)(a.Text,{children:"Transition:"}),Q.iH.map(e=>(0,I.jsx)(a.Button,{flavour:t.transition===e?"default":"hollow",onClick:()=>n({...t,transition:e}),children:e},e))]}),(0,I.jsx)(a.Flex,{gap:2,alignItems:"center",children:(0,I.jsx)(a.Checkbox,{checked:t.loop,onChange:e=>n({...t,loop:e.target.checked}),label:"Loop"})}),(0,I.jsxs)(a.Flex,{column:!0,flex:"1",overflow:{vertical:"auto"},gap:2,children:[(0,I.jsx)(le.Mp,{sensors:r,collisionDetection:le.fp,onDragEnd:i,children:(0,I.jsx)(ae.gB,{items:t.entries.map(e=>e.id),strategy:ae._G,children:(0,I.jsx)(a.Flex,{column:!0,gap:1,children:t.entries.map((e,l)=>(0,I.jsx)(de,{entry:e,index:l,isOnly:1===t.entries.length,onEdit:()=>s(e.id),onRemove:()=>{return l=e.id,n({...t,entries:t.entries.filter(e=>e.id!==l)});var l}},e.id))})})}),d&&(0,I.jsx)(he,{entry:d,onChange:e=>n({...t,entries:t.entries.map(t=>t.id===e.id?e:t)}),onClose:()=>s(null)})]})]})},xe=e=>e?{name:e.name,transition:e.transition,loop:e.loop,entries:e.entries}:{name:"",transition:Q.Ez,loop:!0,entries:[]},pe=e=>{let{mode:t,playlist:n,onSave:o,onClose:s}=e;const[r,i]=(0,l.useState)(()=>xe(n)),[d,c]=(0,l.useState)(!1),h=(0,l.useCallback)(e=>{i(t=>({...t,entries:[...t.entries,{id:(0,q.A)(),dashboardId:e,durationMs:Q.lR,mode:Q.hO,timeRange:Q.sV}]}))},[]),u=r.name.trim()&&r.entries.length>0&&!d;return(0,I.jsx)(a.Modal,{backdropProps:{backdropBlur:!0},onClickOutside:s,onEsc:s,children:(0,I.jsxs)(a.ModalContent,{width:"1000px",height:"80vh",children:[(0,I.jsxs)(a.ModalHeader,{children:["create"===t?"New playlist":"Edit playlist",(0,I.jsx)(a.ModalCloseButton,{onClose:s})]}),(0,I.jsx)(a.ModalBody,{height:"100%",overflow:"hidden",children:(0,I.jsxs)(a.Flex,{gap:3,width:"100%",height:"100%",overflow:"hidden",children:[(0,I.jsx)(a.Flex,{width:{base:"40%"},height:"100%",overflow:"hidden",children:(0,I.jsx)(ne,{addedDashboardIds:r.entries.map(e=>e.dashboardId),onAdd:h})}),(0,I.jsx)(a.Flex,{width:{base:"60%"},height:"100%",overflow:"hidden",children:(0,I.jsx)(ue,{draft:r,onChange:i})})]})}),(0,I.jsxs)(a.ModalFooter,{gap:2,children:[(0,I.jsx)(a.Button,{flavour:"hollow",onClick:s,children:"Cancel"}),(0,I.jsx)(a.Button,{onClick:async()=>{c(!0);try{await o(r),s()}finally{c(!1)}},disabled:!u,children:d?"Saving\u2026":"Save"})]})]})})};var me=n(67916),ge=n(12273),be=n(81214);const ye=e=>{let{playlistId:t,spaceId:n,roomId:o,onClose:s}=e;const[r,i]=(0,l.useState)(!1),[d,c]=(0,l.useState)(null),[h,u]=(0,l.useState)(!1);return(0,I.jsx)(a.Modal,{backdropProps:{backdropBlur:!0},onClickOutside:s,onEsc:s,children:(0,I.jsxs)(a.ModalContent,{width:"600px",children:[(0,I.jsxs)(a.ModalHeader,{children:["Playlist TV URL",(0,I.jsx)(a.ModalCloseButton,{onClose:s})]}),(0,I.jsx)(a.ModalBody,{column:!0,gap:4,children:d?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(ge.FU,{children:d}),(0,I.jsx)(a.Flex,{alignItems:"center",background:"warningBackground",gap:4,padding:[3,3],round:!0,children:(0,I.jsx)(a.Text,{color:"warning",children:"This URL contains a unique access token. Share only with trusted users."})})]}):(0,I.jsx)(a.Text,{children:"Create a shareable TV-mode URL for this playlist. A new access token will be created automatically."})}),(0,I.jsxs)(a.ModalFooter,{gap:2,children:[(0,I.jsx)(a.Button,{flavour:"hollow",onClick:s,children:"Cancel"}),d?(0,I.jsx)(a.Button,{onClick:async()=>{if(d)try{await(0,be.A)(d)&&(u(!0),setTimeout(()=>u(!1),2e3))}catch(e){console.error("Failed to copy URL:",e)}},children:h?"Copied!":"Copy URL"}):(0,I.jsx)(a.Button,{onClick:async()=>{i(!0);try{const{data:e}=await(0,me.Ey)({description:`TV Mode - Playlist ${t}`,scope:"scope:all"});c(((e,t,n,l)=>{const a=window.location.origin,o=new URLSearchParams(location.search).get("agent");return`${a}/webviews/playlists/${t}?space_id=${n}&room_id=${l}${o?`&agent=${o}`:""}#token=${e}`})(e.token,t,n,o))}catch(e){console.error("Failed to create token:",e)}finally{i(!1)}},disabled:r,children:r?"Generating...":"Generate a new URL"})]})]})})};var fe=n(68453);const je=e=>{let{playlistId:t,onClose:n}=e;const o=(0,p.vt)(),s=(0,x.ID)(),r=(0,W.W9)(t),i=(0,l.useRef)(null);return(0,l.useEffect)(()=>{const e=i.current;return e?.requestFullscreen&&e.requestFullscreen().catch(()=>{}),()=>{document.fullscreenElement&&document.exitFullscreen().catch(()=>{})}},[]),(0,I.jsx)(a.Layer,{full:!0,backdrop:!0,onEsc:n,children:(0,I.jsx)(a.Flex,{ref:i,flex:"1",width:"100vw",height:"100vh",background:"mainBackground",position:"relative",children:(0,I.jsx)(fe.A,{playlist:r,spaceId:o,roomId:s,mode:"layer",onClose:n})})})},we=e=>{let{playlist:t,onPlay:n,onEdit:a,onTvUrl:o,onDuplicate:s}=e;const r=(e=>{const t=(0,W.yp)(e),n=(0,J.xS)(e);return(0,l.useCallback)(function(){let{name:l,entries:a,transition:o,loop:s}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!t)return Promise.resolve();const r=Date.now();return n({id:e,type:Q.Zg,entity:Q.w0,scope:Q.CA,name:l??t.name,path:Q.Bb,value:{entries:a??t.value.entries,transition:o??t.value.transition,loop:s??t.value.loop,createdAt:t.value.createdAt,updatedAt:r}})},[e,t,n])})(t.playlistId),i=(e=>{const t=(0,W.yp)(e),n=(0,J.z2)(e);return(0,l.useCallback)(()=>t?n(e):Promise.resolve(),[e,t,n])})(t.playlistId);return(0,I.jsx)(ee,{playlist:t,onPlay:n,onEdit:()=>a(t,r),onTvUrl:o,onDuplicate:s,onDelete:()=>i()})},Ce=()=>{const e=(0,W.ng)(),t=(0,p.vt)(),n=(0,x.ID)(),[o,s]=(0,l.useState)(null),[r,i]=(0,l.useState)(null),[d,c]=(0,l.useState)(null),h=Z(),u=(()=>{const e=Z();return(0,l.useCallback)(t=>e({name:`${t.name} (copy)`,entries:t.entries.map(e=>({...e,id:(0,q.A)()})),transition:t.transition,loop:t.loop}),[e])})(),m=()=>s({mode:"create",playlist:null,updater:null}),g=(e,t)=>s({mode:"edit",playlist:e,updater:t});return e.length||o?(0,I.jsxs)(a.Flex,{column:!0,gap:2,flex:"1",padding:[3,3],children:[(0,I.jsxs)(a.Flex,{justifyContent:"between",alignItems:"center",children:[(0,I.jsx)(a.H3,{children:"Playlists"}),(0,I.jsx)(a.Button,{onClick:m,children:"+ New playlist"})]}),(0,I.jsx)(a.Flex,{column:!0,gap:1,children:e.map(e=>(0,I.jsx)(we,{playlist:e,onPlay:()=>i(e.playlistId),onEdit:g,onTvUrl:()=>c(e),onDuplicate:()=>u(e)},e.playlistId))}),o&&(0,I.jsx)(pe,{mode:o.mode,playlist:o.playlist,onSave:async e=>{"create"===o.mode?await h(e):await o.updater(e)},onClose:()=>s(null)}),r&&(0,I.jsx)(je,{playlistId:r,onClose:()=>i(null)}),d&&(0,I.jsx)(ye,{playlistId:d.playlistId,spaceId:t,roomId:n,onClose:()=>c(null)})]}):(0,I.jsx)(te,{onCreate:m})},ve=()=>{(0,s.A)();return(0,r.RQ)()?(0,I.jsx)(K.Ay,{feature:"DashboardPlaylists",children:(0,I.jsx)(a.Flex,{width:"100%",height:"100%",flex:"1",column:!0,padding:[3,3,0],overflow:"hidden",children:(0,I.jsx)(Ce,{})})}):(0,I.jsx)(F.Ki,{})};var ke=n(78152);const Te=()=>{const e=(0,s.A)(),[t,n]=(0,l.useState)(0),[i,,d,c]=(0,o.A)(!1);return(0,r.RQ)()?(0,I.jsx)(K.Ay,{feature:"DashboardOverview",children:(0,I.jsxs)(a.Flex,{position:"relative",width:"100%",height:"100%",flex:"1",column:!0,padding:[3,3,0],overflow:"hidden",children:[ke.Cx?(0,I.jsxs)(a.Tabs,{selected:t,onChange:n,height:"100%",gap:2,noDefaultBorder:!0,children:[(0,I.jsx)(a.Tab,{label:(0,I.jsx)(a.Text,{children:"Dashboards"}),padding:[2,4],children:(0,I.jsx)(H,{refetch:e,handleOpenAddDashboardModal:d})}),(0,I.jsx)(a.Tab,{label:(0,I.jsx)(a.Text,{children:"Playlists"}),padding:[2,4],children:(0,I.jsx)(ve,{})})]}):(0,I.jsx)(H,{refetch:e,handleOpenAddDashboardModal:d}),i&&(0,I.jsx)(S,{onClose:c})]})}):(0,I.jsx)(F.Ki,{})}},47154(e,t,n){var l=n(66118);l.t1.register(...l.$L)}}]);