!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s=(new e.Error).stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="ba9b4bb4-952f-4ec8-8088-d14f0d0f599f",e._sentryDebugIdIdentifier="sentry-dbid-ba9b4bb4-952f-4ec8-8088-d14f0d0f599f")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7222],{54851:(e,s,n)=>{n.d(s,{Ol:()=>a,SZ:()=>o,Zb:()=>i,aY:()=>d,ll:()=>c});var t=n(52676),l=n(75271),r=n(93177);let i=l.forwardRef((e,s)=>{let{className:n,...l}=e;return(0,t.jsx)("div",{ref:s,className:(0,r.cn)("rounded-xl border bg-card text-card-foreground shadow",n),...l})});i.displayName="Card";let a=l.forwardRef((e,s)=>{let{className:n,...l}=e;return(0,t.jsx)("div",{ref:s,className:(0,r.cn)("flex flex-col space-y-1.5 p-6",n),...l})});a.displayName="CardHeader";let c=l.forwardRef((e,s)=>{let{className:n,...l}=e;return(0,t.jsx)("h3",{ref:s,className:(0,r.cn)("font-semibold leading-none tracking-tight",n),...l})});c.displayName="CardTitle";let o=l.forwardRef((e,s)=>{let{className:n,...l}=e;return(0,t.jsx)("p",{ref:s,className:(0,r.cn)("text-sm text-muted-foreground",n),...l})});o.displayName="CardDescription";let d=l.forwardRef((e,s)=>{let{className:n,...l}=e;return(0,t.jsx)("div",{ref:s,className:(0,r.cn)("p-6 pt-0",n),...l})});d.displayName="CardContent",l.forwardRef((e,s)=>{let{className:n,...l}=e;return(0,t.jsx)("div",{ref:s,className:(0,r.cn)("flex items-center p-6 pt-0",n),...l})}).displayName="CardFooter"},56891:(e,s,n)=>{n.d(s,{N:()=>f,V:()=>m});var t=n(52676),l=n(75271),r=n(32762),i=n(59304),a=n(11489),c=n(44470),o=n(19826);let d=(0,l.createContext)(null),{Provider:u}=d,x=[{name:"Music",description:"Music Integration",icon:(0,t.jsx)(a.Xm1,{}),id:"music",needsSetup:!0,enabled:!1}];function m(e){let{children:s}=e,[n,a]=(0,l.useState)(x),d=(0,c.NL)(),{organization:m}=(0,i.a)(),f=null==m?void 0:m.id,{data:h=[],status:p,refetch:g}=(0,r.B)(f),{mutate:j}=(0,r.UU)(f),{showErrorSnackbar:v}=(0,o.ZP)();return(0,l.useLayoutEffect)(()=>{"success"===p&&a(e=>e.map(e=>h.some(s=>s.enabled&&s.name===e.name)?{...e,enabled:!0}:e))},[p]),(0,t.jsx)(u,{value:{userIntegrations:h,allIntegrations:n,integrationFetchStatus:p,getIntegrations(){g()},toggleIntegration:function(e){var s;a(s=>n.map(s=>s.name!==e.name?s:{...s,enabled:!e.enabled})),j({integration:e,id:null===(s=h.find(s=>s.name===e.name))||void 0===s?void 0:s.id},{onError(){v("Something went wrong"),a(n)},onSettled(e){let s=h.some(s=>s.id===(null==e?void 0:e.id));d.setQueryData(["integrations",f],s?h.map(s=>{if(s.id===(null==e?void 0:e.id))return{...s,enabled:e.enabled}}):[...h,e])}})}},children:s})}let f=()=>{let e=(0,l.useContext)(d);if(!e)throw"useIntegrations must be used within a IntegrationsProvider";return e}},46183:(e,s,n)=>{n.d(s,{O:()=>o,Z:()=>d});var t=n(52676),l=n(75271),r=n(32762),i=n(59304);let a=(0,l.createContext)(null),{Provider:c}=a;function o(e){let{children:s}=e,{organization:n}=(0,i.a)(),{status:l,data:a,refetch:o}=(0,r.qo)(null==n?void 0:n.id);return(0,t.jsx)(c,{value:{locations:null!=a?a:[],locationsFetchStatus:l,getLocations:o,getLocationNameById:e=>{var s;let n=(null!=a?a:[]).find(s=>s.id===e);return null!==(s=null==n?void 0:n.name)&&void 0!==s?s:"N/A"}},children:s})}let d=()=>{let e=(0,l.useContext)(a);if(!e)throw"useLocations must be used within a LocationsProvider";return e}},57222:(e,s,n)=>{n.r(s),n.d(s,{default:()=>eO});var t=n(52676),l=n(91067),r=n(78735),i=n(29450),a=n(44609),c=n(19826),o=n(64788),d=n(46183),u=n(75271);let x=0,m=function(e){var s;let[n,l]=(0,u.useState)(Array(null!==(s=e.totalDigits)&&void 0!==s?s:6).fill("")),[r,i]=(0,u.useState)(0),a=(0,u.useRef)(null),c=(e,s)=>{let{key:n}=e;x=s,"Backspace"===n&&i(x-1)},o=s=>{var t;let{target:r}=s,{value:a}=r,c=[...n];c[x]=a.substring(a.length-1),a?i(x+1):i(x-1),l(c),c.join("").length===(null!==(t=e.totalDigits)&&void 0!==t?t:6)&&e.onSubmit&&e.onSubmit(c.join(""))};return(0,u.useEffect)(()=>{var e;null===(e=a.current)||void 0===e||e.focus()},[r]),(0,t.jsx)("div",{className:"flex items-center justify-center gap-2",children:n.map((e,s)=>(0,t.jsx)("div",{className:"h-14 w-14",children:(0,t.jsx)("input",{ref:s===r?a:null,className:"input spin-button-none h-14 w-14 text-center font-bold uppercase",maxLength:1,onChange:o,onKeyDown:e=>c(e,s),value:n[s]})},s))})};var f=n(33115),h=n(89039),p=n(2989),g=n(71494),j=n.n(g),v=n(80510),y=n(41328),w=n(83228),N=n(94329);let b={web:[(0,t.jsxs)("div",{className:"flex h-full min-w-full flex-col items-center justify-center gap-2",children:[(0,t.jsx)(S,{children:(0,t.jsx)(a.WKS,{})}),(0,t.jsxs)("div",{className:"flex gap-2",children:["Go to ",(0,t.jsxs)(j(),{href:N.O.NEXT_PUBLIC_PLAYER_URL,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-blue-400",children:["player.signagestudio.io",(0,t.jsx)(a.jhj,{})]})]})," and enter the pairing code"]},"web_0")],android:[(0,t.jsx)(_,{step:'From the Android TV Home screen, scroll to "Apps." Select the Google Play Store app.',imageUrl:"https://i0.wp.com/www.alphr.com/wp-content/uploads/2021/11/Android-TV-How-to-Download-Apps-From-the-App-Store-2.png?resize=768%2C432&ssl=1"},"android_0"),(0,t.jsx)(_,{step:(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(a.vU7,{}),(0,t.jsx)("p",{children:"Search for"}),(0,t.jsx)("p",{className:"font-bold",children:"Signage Studio"}),(0,t.jsx)("p",{children:"and download it."})]}),imageUrl:"/dist/logo.svg"},"android_1")],lg:[(0,t.jsx)(_,{step:"Press the Home button on the remote until a menu appears at the bottom of your screen.",imageUrl:"https://www.digitaltrends.com/wp-content/uploads/2022/11/gxca.jpg?fit=720%2C720&p=1"},"lg_0"),(0,t.jsx)(_,{step:"Select the LG Content Store option. It typically appears on the left side of the menu. Open the Apps option at the top of your screen.",imageUrl:"https://www.digitaltrends.com/wp-content/uploads/2022/11/trgdf.jpg?fit=720%2C720&p=1"},"lg_1"),(0,t.jsx)(_,{step:(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(a.vU7,{}),(0,t.jsx)("p",{children:"Search for"}),(0,t.jsx)("p",{className:"font-bold",children:"Signage Studio"}),(0,t.jsx)("p",{children:"and download it."})]}),imageUrl:"/dist/logo.svg"},"lg_2"),(0,t.jsxs)("div",{className:"flex h-full min-w-full flex-col items-center justify-center gap-2 text-center text-sm text-gray-600 dark:text-gray-300",children:[(0,t.jsx)("p",{className:"font-semibold",children:"Turn Off Screensaver"}),(0,t.jsx)(S,{children:(0,t.jsx)(w.r3T,{})}),"You can turn off the screen saver by pressing the gear button on the remote control.",(0,t.jsx)("p",{children:"All Settings > General > Standby Mode > OFF."})]},"lg_3")],apple:[(0,t.jsxs)("div",{className:"flex h-full min-w-full flex-col items-center justify-center gap-2",children:[(0,t.jsx)(S,{children:(0,t.jsx)(y.m7B,{})}),"Apple"]},"apple_0"),(0,t.jsxs)("div",{className:"flex h-full min-w-full flex-col items-center justify-center gap-2",children:[(0,t.jsx)(S,{children:(0,t.jsx)(y.m7B,{})}),"Apple instruction 2"]},"apple_1")],fire:[(0,t.jsx)(_,{step:"Select the Find button on your Fire TV home screen.",imageUrl:"https://b2024479.smushcdn.com/2024479/wp-content/uploads/2022/01/how-to-download-apps-on-fire-tv-stick_1-min-scaled.jpg?lossy=1&strip=1&webp=1"},"fire_0"),(0,t.jsx)(_,{step:"Then select Search.",imageUrl:"https://b2024479.smushcdn.com/2024479/wp-content/uploads/2022/01/how-to-download-apps-on-fire-tv-stick_2-min-scaled.jpg?lossy=1&strip=1&webp=1"},"fire_1"),(0,t.jsx)(_,{step:(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)(a.vU7,{}),(0,t.jsx)("p",{children:"Search for"}),(0,t.jsx)("p",{className:"font-bold",children:"Signage Studio"}),(0,t.jsx)("p",{children:"and download it."})]}),imageUrl:"/dist/logo.svg"},"fire_2")],samsung:[(0,t.jsxs)("div",{className:"flex h-full min-w-full flex-col items-center justify-center gap-2",children:[(0,t.jsx)(S,{children:(0,t.jsx)(y.waO,{})}),"Open Samsung Store in your TV"]},"samsung_0"),(0,t.jsxs)("div",{className:"flex h-full min-w-full flex-col items-center justify-center gap-2",children:[(0,t.jsx)(S,{children:(0,t.jsx)(a.vU7,{})}),"Search for ",(0,t.jsx)("span",{className:"font-bold",children:"Signage Studio"})]},"samsung_1"),(0,t.jsxs)("div",{className:"flex h-full min-w-full flex-col items-center justify-center gap-2",children:[(0,t.jsx)(S,{children:(0,t.jsx)(a.uKn,{})}),"Download the app"]},"samsung_1")]};function S(e){let{children:s}=e;return(0,t.jsx)("div",{className:"rounded-full bg-accentColor bg-opacity-5 p-6 text-6xl text-accentColor dark:bg-darkAccentColor dark:bg-opacity-5 dark:text-darkAccentColor",children:s})}function _(e){let{step:s,imageUrl:n}=e;return(0,t.jsxs)("div",{className:"flex h-full min-w-full flex-col items-center justify-center gap-4 text-sm text-gray-600 dark:text-gray-300",children:[(0,t.jsx)("p",{className:"text-center",children:s}),n&&(0,t.jsx)("div",{className:"h-full flex-grow",children:(0,t.jsx)("img",{src:n,alt:"Step",className:"h-full max-h-56 rounded-lg"})})]})}let C=[{id:"apple",title:"Apple TV",icon:(0,t.jsx)(y.m7B,{})},{id:"android",title:"Android TV",icon:(0,t.jsx)(v.q2m,{})},{id:"samsung",title:"Samsung TV",icon:(0,t.jsx)(y.waO,{})},{id:"lg",title:"LG TV",icon:(0,t.jsx)(function(){return(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"none",viewBox:"0 0 78 78",children:(0,t.jsx)("path",{fill:"currentColor",fillRule:"evenodd",d:"M77.3 38.628c0 21.34-17.322 38.61-38.65 38.61C17.29 77.239 0 59.969 0 38.629S17.29 0 38.65 0C59.978 0 77.3 17.287 77.3 38.628ZM37.095 55.563V21.676H40.2v30.84h7.668v3.047H37.095ZM26.308 30.922a4.632 4.632 0 0 0 4.629-4.629c0-2.547-2.066-4.64-4.63-4.64-2.562 0-4.628 2.093-4.628 4.64a4.63 4.63 0 0 0 4.629 4.629ZM38.66 6.259c.367 0 1.135.025 1.539.045v3.01c-.379-.02-1.201-.02-1.54-.02-7.845 0-15.202 3.052-20.74 8.582-5.554 5.535-8.615 12.924-8.615 20.735 0 7.856 3.061 15.207 8.616 20.725 5.537 5.541 12.894 8.592 20.74 8.592 15.5 0 28.23-12.072 29.248-27.314.009-.052.012-.2.013-.316l.001-.147H47.898v-2.978h23.106v1.439c0 8.66-3.381 16.777-9.491 22.88-6.109 6.091-14.228 9.456-22.853 9.456-8.658 0-16.779-3.365-22.899-9.455-6.095-6.104-9.46-14.221-9.46-22.881 0-17.83 14.52-32.353 32.359-32.353Z",clipRule:"evenodd"})})},{})},{id:"fire",title:"Fire TV",icon:(0,t.jsx)(v.UpG,{})},{id:"web",title:"Web",icon:(0,t.jsx)(v.gtO,{})}];var k=n(83991);let I=function(e){var s,n,l,r,i;let[c,o]=(0,u.useState)(e.isPairAgain);if(c)return(0,t.jsxs)("div",{className:"flex h-full min-h-[550px] w-full flex-col items-center justify-center gap-2",children:[(0,t.jsx)("div",{className:"h-[350px] w-full py-4",children:(0,t.jsx)(f.Z,{items:b[null!==(r=null===(s=e.screenInfo)||void 0===s?void 0:s.screenType)&&void 0!==r?r:"web"]})}),(0,t.jsx)("div",{className:"text-center font-bold",children:"Enter Pairing code"}),(0,t.jsx)(m,{totalDigits:6,onSubmit:e.onPinChange}),(0,t.jsx)("div",{className:"text-center text-xs text-gray-400",children:"* Please enter the pairing code on the screen"}),(0,t.jsxs)("div",{className:"flex w-full flex-row items-center justify-between gap-4",children:[e.isPairAgain?(0,t.jsx)("div",{}):(0,t.jsxs)(k.z,{variant:"ghost",type:"button",disabled:"fetching"===e.screenCreateStatus,onClick:()=>{e.setSelectedPage(0)},children:[(0,t.jsx)(a.KYK,{}),"Previous"]}),(0,t.jsxs)(k.z,{type:"button",onClick:()=>{e.onSubmit()},disabled:"fetching"===e.screenCreateStatus,children:["fetching"===e.screenCreateStatus?(0,t.jsx)(h.Q,{}):(0,t.jsx)(a.$l_,{}),"Pair Now"]})]})]});let d=null===(n=C.find(s=>{var n;return s.id===(null===(n=e.screenInfo)||void 0===n?void 0:n.screenType)}))||void 0===n?void 0:n.title;return(0,t.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4",children:[(0,t.jsxs)("div",{className:"flex h-full w-full flex-1 flex-col items-center justify-center gap-4",children:[(0,t.jsx)("div",{className:"h-[350px] w-full py-4",children:(0,t.jsx)(f.Z,{items:b[null!==(i=null===(l=e.screenInfo)||void 0===l?void 0:l.screenType)&&void 0!==i?i:"web"]})}),(0,t.jsx)(p.Z,{}),(0,t.jsx)("p",{className:"text-center text-[0.8rem] text-gray-500 dark:text-gray-400",children:"Seeing your design on ".concat(d," is so cool, Do you want to pair your ").concat(d," now?")}),(0,t.jsxs)("div",{className:"flex gap-4",children:[(0,t.jsxs)(k.z,{variant:"outline",className:"w-48",disabled:"fetching"===e.screenCreateStatus,onClick:e.onPairLater,children:["fetching"===e.screenCreateStatus?(0,t.jsx)(h.Q,{}):(0,t.jsx)(a.oKj,{}),"Pair Later"]}),(0,t.jsx)("div",{className:"h-12",children:(0,t.jsx)(p.p,{message:"OR"})}),(0,t.jsxs)(k.z,{className:"w-48",variant:"filled",onClick:()=>{o(!0)},disabled:"fetching"===e.screenCreateStatus,children:["fetching"===e.screenCreateStatus?(0,t.jsx)(h.Q,{}):(0,t.jsx)(a.$l_,{}),"Pair Now"]})]})]}),(0,t.jsxs)(k.z,{variant:"ghost",type:"button",disabled:"fetching"===e.screenCreateStatus,onClick:()=>{e.setSelectedPage(0)},children:[(0,t.jsx)(a.KYK,{}),"Previous"]})]})};var P=n(66992),A=n(91396),T=n(66483),O=n(11489);let L=function(e){var s,n;let{screen:l,onSubmitted:r,locations:i,initialScreenInfo:o,screenCreateStatus:d}=e,{register:x,handleSubmit:m,formState:{errors:f}}=(0,P.cI)(),[p,g]=(0,u.useState)(),[v,y]=(0,u.useState)(),{showErrorSnackbar:w}=(0,c.ZP)();(0,u.useEffect)(()=>{if(l||o){var e;let s=o?i.find(e=>e.id===o.locationId):i.find(e=>e.id===(null==l?void 0:l.location_id));s&&y(s),g(null!==(e=null==o?void 0:o.screenType)&&void 0!==e?e:null==l?void 0:l.screen_type)}},[i,l,o]);let b=async e=>{p?r({name:e.screenName,locationId:null==v?void 0:v.id,screenType:p}):w("Please select a screen type")};return(0,t.jsxs)("form",{onSubmit:m(b),className:"flex h-full flex-col items-center justify-center gap-8 pt-8",children:[(0,t.jsxs)("div",{className:"w-full",children:[(0,t.jsx)(T.Z,{leadingIcon:(0,t.jsx)(O.hRw,{}),defaultValue:null!==(n=null!==(s=null==o?void 0:o.name)&&void 0!==s?s:null==l?void 0:l.name)&&void 0!==n?n:"",placeholder:"Screen Name",...x("screenName",{required:!0})}),f.screenName&&(0,t.jsx)("span",{className:"input-field-error pt-2",children:"Screen name is required"})]}),i.length>0&&(0,t.jsx)("div",{className:"w-full",children:(0,t.jsx)(A.Z,{label:"Location :",optionRender:e=>e.name,selectedRender:e=>e.name,selected:v,options:i,onChange:e=>{e&&y(e)}})}),!l&&(0,t.jsx)("div",{className:"grid w-full grid-cols-3 flex-wrap justify-center gap-2",children:C.sort((e,s)=>e.title.localeCompare(s.title)).map((e,s)=>(0,t.jsxs)("button",{type:"button",disabled:"apple"===e.id,onClick:()=>g(e.id),className:"".concat(e.id===p?"border-accentColor bg-accentColor bg-opacity-10 text-accentColor dark:border-darkAccentColor dark:bg-darkAccentColor dark:bg-opacity-10 dark:text-darkAccentColor":"border-lightCard bg-lightCard hover:text-accentColor dark:border-darkCard dark:bg-darkCard dark:hover:text-darkAccentColor"," flex flex-col items-center justify-center gap-4 rounded-md border-2 px-8 py-4 transition-all disabled:cursor-not-allowed"),children:[(0,t.jsx)("div",{className:"text-7xl",children:e.icon}),(0,t.jsx)("div",{className:"text-xs",children:e.title})]},"device_type_".concat(s)))}),(0,t.jsxs)("p",{className:"text-center text-xs text-gray-500",children:["Don’t have your TV screen ready yet? You can use your"," ",(0,t.jsx)("span",{className:"font-medium italic text-accentColor dark:text-darkAccentColor",children:(0,t.jsx)(j(),{href:N.O.NEXT_PUBLIC_PLAYER_URL,target:"_blank",rel:"noopener noreferrer",children:"browser"})})," ","as a screen instead."]}),(0,t.jsxs)(k.z,{className:"w-36",type:"submit",disabled:"fetching"===d,children:["fetching"===d?(0,t.jsx)(h.Q,{}):(0,t.jsx)(t.Fragment,{children:l?(0,t.jsx)(a.ZO5,{}):(0,t.jsx)(a.hdK,{})}),l?"Update":"Next"]})]},"screen_info_form")};var R=n(17041),Z=n(93160),z=n(67469);let E=(0,u.createContext)(null),{Provider:U}=E;function F(e){var s,n,l;let{children:r,props:i}=e,a=(0,u.useMemo)(()=>new Z.Z(N.O.NEXT_PUBLIC_WS_URL+"/"+N.O.NEXT_PUBLIC_WS_PAIRING_NAMESPACE+"/public/websocket"),[]),{showErrorSnackbar:d,showSuccessSnackbar:x}=(0,c.ZP)(),[m,f]=(0,u.useState)(null),[h,p]=(0,u.useState)(i.screen?{...i.screen,name:null!==(l=null===(s=i.screen)||void 0===s?void 0:s.name)&&void 0!==l?l:"",screenType:null===(n=i.screen)||void 0===n?void 0:n.screen_type}:void 0),[g,j]=(0,u.useState)("idle"),v=async()=>{if(!m){d("Please enter a pin");return}j("fetching");try{a.emit("joinRoomIfPresent",{roomId:m.toLowerCase()},async e=>{if(e)a.emit("requestDeviceId",{roomId:m.toLowerCase()});else{j("error"),d("Looks ike you entered a wrong pin");return}})}catch(e){d("Error creating screen"),j("error")}};async function y(){if(!(null==h?void 0:h.screenType))return;j("fetching");let{data:e,error:s}=await R.OQ.from("screen").insert({name:null==h?void 0:h.name,org_id:i.org_id,location_id:null==h?void 0:h.locationId,screen_type:null==h?void 0:h.screenType,deleted:!1,is_paired:!1}).select(o.AG).returns();if(s){j("error"),d("Error creating screen");return}j("success"),x("Screen added successfully"),i.onSuccess(e[0])}async function w(e){if("fetching"===g||!i.screen)return;j("fetching");let{data:s,error:n}=await R.OQ.from("screen").update({name:null==e?void 0:e.name,location_id:null==e?void 0:e.locationId,screen_type:null==e?void 0:e.screenType}).match({id:i.screen.id}).select(o.AG).returns();if(!s||n){j("error"),d("Error ".concat(i.screen?"updating":"creating"," screen"));return}j("success"),x("Screen ".concat(i.screen?"updated":"added"," successfully")),a.close(),i.onSuccess(s[0])}return(0,u.useEffect)(()=>{a.onMessage=async e=>{try{let t=JSON.parse(e.data);if("deviceIdRecievedFromScreen"===t.event){var s,n;let{deviceId:e,width:l,height:r}=t.data;if(!h||"fetching"===g)return;j("fetching");let{data:c}=await R.OQ.auth.getSession();if(!c.session)return;fetch(z.w.createScreen,{method:"POST",body:JSON.stringify({screenId:null===(s=i.screen)||void 0===s?void 0:s.id,name:null==h?void 0:h.name,deviceId:e,locationId:null==h?void 0:h.locationId,screenType:null==h?void 0:h.screenType,width:l,height:r,org_id:i.org_id}),headers:{"Content-Type":"application/json",Authorization:"Bearer ".concat(null===(n=c.session)||void 0===n?void 0:n.access_token)}}).then(e=>e.json()).then(e=>{var s;a.emit("sendOrgIdAndDeviceIdToRoomIfPresent",{roomId:null!==(s=null==m?void 0:m.toLowerCase())&&void 0!==s?s:"",orgId:i.org_id,deviceId:e[0].id},async s=>{if(s)j("success"),x("Screen ".concat(i.screen?"updated":"added"," successfully")),a.close(),i.onSuccess(e[0]);else{j("error"),d("Error creating screen");return}})}).catch(()=>{j("error"),d("Error ".concat(i.screen?"updating":"creating"," screen"))})}}catch(e){}}},[h,m]),(0,t.jsx)(U,{value:{socket:a,inputPin:m,setInputPin:f,screenInfo:h,setScreenInfo:p,screenCreateStatus:g,setScreenCreateStatus:j,onSubmit:v,updateScreen:w,onPairLater:y},children:r})}let M=()=>{let e=(0,u.useContext)(E);if(!e)throw"useAddScreen must be used within a AddScreenProvider";return e};function D(e){let{inputPin:s,setInputPin:n,screenInfo:l,setScreenInfo:r,screenCreateStatus:i,onSubmit:a,updateScreen:c,onPairLater:o}=M();(0,u.useEffect)(()=>{s&&"fetching"!==i&&a()},[s]);let[d,x]=(0,u.useState)(e.isPairAgain?1:0),[m,h]=(0,u.useState)(e.isFirstScreen);return(0,t.jsxs)("div",{className:"flex h-full w-full flex-col",children:[(0,t.jsx)("h1",{className:"text-lg font-medium leading-6 text-gray-900 dark:text-gray-100",children:1===d?"Pair Screen":e.screen?"Edit Screen":e.isFirstScreen?"Let’s add your first screen":"Add Screen"}),(0,t.jsx)("div",{className:"h-full w-full flex-1",style:{minHeight:e.screen&&0===d?"100px":"550px"},children:m?(0,t.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2",children:[(0,t.jsxs)(k.z,{variant:"filled",onClick:()=>{h(!1)},children:[(0,t.jsx)(O.hRw,{}),"I have a TV screen ready to pair"]}),(0,t.jsx)(p.Z,{message:"OR"}),(0,t.jsx)(V,{})]}):(0,t.jsx)(f.Z,{hideButtons:!0,hideProgress:!0,selectedIndex:d,items:[(0,t.jsx)(L,{screenCreateStatus:i,locations:e.locations,screen:e.screen,initialScreenInfo:e.isFirstScreen?{name:"My First Screen"}:l,onSubmitted:s=>{e.screen?c(s):(r(s),x(1))}},"info_page"),(0,t.jsx)(I,{onPinChange:n,screenInfo:l,onSubmit:a,screenCreateStatus:i,setSelectedPage:x,onPairLater:o,isPairAgain:e.isPairAgain},"pair_page")]})})]})}let B=function(e){return(0,t.jsx)(F,{props:e,children:(0,t.jsx)(D,{...e})})};function V(){let{showAllScreens:e}=(0,o.OP)();return(0,t.jsxs)(k.z,{variant:"outline",onClick:()=>{e(),window.open(N.O.NEXT_PUBLIC_PLAYER_URL,"_blank")},children:[(0,t.jsx)(O.hRw,{}),"I will use a browser for now"]})}var q=n(59304),K=n(51994),Q=n(22899),G=n(18403),Y=n(62841),H=n(59331),X=n(81842),W=n(79746),J=n(98439),$=n(44470),ee=n(5762),es=n(87620);function en(e){let{onClose:s}=e,[n,l]=(0,u.useState)(1),{showSuccessSnackbar:r,showErrorSnackbar:i,openDialog:a}=(0,c.ZP)(),{subscription:o,planProperties:d,addOn:x}=(0,W.q)(),{user:m,organization:f}=(0,q.a)(),h=(0,$.NL)(),{mutate:p,status:g}=(0,ee.D)({mutationFn:async e=>{var s,n;let{subscription:t,addOnProperties:l,addOn:r,totalScreens:i}=e,a=null==f?void 0:f.id;if(!m||!a||!(null==t?void 0:t.planId))return;let{data:c}=await R.OQ.auth.getSession(),o={"Content-Type":"application/json",Authorization:"Bearer ".concat(null===(s=c.session)||void 0===s?void 0:s.access_token),"user-id":null!==(n=null==m?void 0:m.id)&&void 0!==n?n:"","business-id":null!=a?a:""},d={...null!=r?r:{},businessId:a,planId:null==t?void 0:t.planId,subscriptionId:t.id,userId:null==m?void 0:m.id,properties:JSON.stringify({...null!=l?l:{},entitled_screens:i})},u=await fetch(r?z.w.updateAddOn:z.w.createAddOn,{method:"POST",body:JSON.stringify({addOn:d}),headers:o});return await u.json()},onSuccess(){r("Screens added successfully."),s()},onError(){i("Something went wrong.")},onSettled(e){(null==e?void 0:e.success)&&h.setQueryData(["addOn"],()=>e)}});function j(e){return o?"".concat(e.toLocaleString("en-US",{style:"currency",maximumFractionDigits:0,currency:o.plan.currency})):""}if(o&&d.addon_screen_cost)return(0,t.jsxs)("div",{className:"flex flex-col gap-2 pt-4",children:[(0,t.jsx)(J.__,{children:"How many screens would you like to add?"}),(0,t.jsxs)("div",{className:"flex items-end justify-center gap-2 py-4",children:[(0,t.jsx)(k.z,{disabled:1===n,onClick:()=>{l(e=>e-1)},children:(0,t.jsx)(es.DLL,{})}),(0,t.jsx)("p",{className:"w-12 rounded-sm bg-muted p-2 text-center text-sm font-medium",children:n}),(0,t.jsx)(k.z,{onClick:()=>{l(e=>e+1)},children:(0,t.jsx)(es.PgY,{})}),(0,t.jsxs)("p",{className:"text-xs",children:["at ",(0,t.jsx)(et,{children:j(d.addon_screen_cost)})," ",(0,t.jsx)("span",{className:"text-xs font-medium text-gray-400",children:"per month per screen"})]})]}),(0,t.jsxs)("p",{className:"text-sm",children:["The monthly cost will increase from"," ",(0,t.jsx)(et,{children:j(o.amount)})," to"," ",(0,t.jsx)(et,{children:j(o.amount+n*d.addon_screen_cost)})]}),(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2 pt-4",children:[(0,t.jsx)(k.z,{variant:"ghost",size:"sm",onClick:s,disabled:"pending"===g,children:"Cancel"}),(0,t.jsx)(k.z,{onClick:()=>{(null==d?void 0:d.addon_screen_cost)&&a({title:"Are you sure you want to add ".concat(n," screens?"),description:"This will increase your monthly subscription cost from ".concat(j(o.amount)," to ").concat(j(o.amount+n*d.addon_screen_cost)),dialogType:"confirm",onConfirm:async()=>{var e,s;let t={...d,entitled_screens:(null!==(e=d.entitled_screens)&&void 0!==e?e:0)+n};delete t.features,delete t.addon_screen_cost,p({addOnProperties:t,subscription:o,addOn:x,totalScreens:(null!==(s=d.entitled_screens)&&void 0!==s?s:0)+n})}})},disabled:"pending"===g,children:"Proceed"})]})]})}function et(e){let{children:s}=e;return(0,t.jsx)("span",{className:"text-xl font-medium text-primary",children:s})}var el=n(32762),er=n(67393);let ei=(0,u.createContext)(null),{Provider:ea}=ei;function ec(e){var s;let{children:n}=e,{organization:l}=(0,q.a)(),[r,i]=(0,u.useReducer)((e,s)=>(localStorage.setItem("music_access_token",s),s),null!==(s=localStorage.getItem("music_access_token"))&&void 0!==s?s:""),a=el.GZ.registerNewListener(),c=el.GZ.requestAccessToken(),{mutateAsync:o}=el.GZ.refreshAccessToken();function d(e){let{access_token:s,refresh_token:n}=e;i(s),localStorage.setItem("music_refresh_token",n)}return(0,u.useEffect)(()=>{!function(){if(!r){var e;a.mutate({identifier:null!==(e=null==l?void 0:l.id)&&void 0!==e?e:"",redirect:window.location.href},{onSuccess(e){let{auth_url:s,auth_code:n}=e;c.mutate(n,{onSuccess:d,onError(e){console.error(e)}})},onError(e){console.error(e)}})}}()},[]),(0,t.jsx)(ea,{value:{accessToken:r,refreshAccessToken:function(){var e;o(null!==(e=localStorage.getItem("music_refresh_token"))&&void 0!==e?e:"",{onSuccess:d,onError(e){console.error(e)}})}},children:n})}let eo=()=>{let e=(0,u.useContext)(ei);if(!e)throw"useMusicAuth must be used within a MusicAuthProvider";return e};var ed=n(39841);let eu=(0,u.createContext)(null),{Provider:ex}=eu;function em(e){let{children:s}=e,{organization:n}=(0,q.a)(),{accessToken:l,refreshAccessToken:r}=eo(),{data:i=[],status:a,refetch:c,error:o}=el.Z4.channels(l,null==n?void 0:n.id);return(0,u.useEffect)(()=>{o instanceof ed.E&&r()},[o]),(0,t.jsx)(ex,{value:{musicChannels:i,musicFetchStatus:a,refetchMusic:c},children:s})}let ef=()=>{let e=(0,u.useContext)(eu);if(!e)throw"useMusic must be used within a MusicProvider";return e};var eh=n(54851),ep=n(36702),eg=n(93177);let ej=u.forwardRef((e,s)=>{let{className:n,children:l,...r}=e;return(0,t.jsxs)(ep.fC,{ref:s,className:(0,eg.cn)("relative overflow-hidden",n),...r,children:[(0,t.jsx)(ep.l_,{className:"h-full w-full rounded-[inherit]",children:l}),(0,t.jsx)(ev,{}),(0,t.jsx)(ep.Ns,{})]})});ej.displayName=ep.fC.displayName;let ev=u.forwardRef((e,s)=>{let{className:n,orientation:l="vertical",...r}=e;return(0,t.jsx)(ep.gb,{ref:s,orientation:l,className:(0,eg.cn)("flex touch-none select-none transition-colors","vertical"===l&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===l&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",n),...r,children:(0,t.jsx)(ep.q4,{className:"relative flex-1 rounded-full bg-border"})})});ev.displayName=ep.gb.displayName;var ey=n(60027);function ew(e){let{children:s,highlightText:n,minLength:l=1,className:r,...i}=e;if(!n||n.length<l)return s;let a=RegExp(n.replaceAll(/[.*+?^${}()|[\]\\]/g,"\\$&"),"gi");return(0,t.jsx)("div",{dangerouslySetInnerHTML:{__html:s.replaceAll(a,e=>{let s=(0,t.jsx)("span",{className:(0,eg.cn)("bg-yellow-700",r),...i,children:e});return(0,ey.renderToString)(s)})}})}function eN(e){let{organization:s}=(0,q.a)();return(null==s?void 0:s.id)&&(0,t.jsx)(ec,{children:(0,t.jsx)(em,{children:(0,t.jsx)(eb,{...e})})})}function eb(e){let{musicFetchStatus:s,refetchMusic:n}=ef();return(0,t.jsx)(X.Z,{queryFetchStatus:s,onRetry:n,loadingProps:e,children:(0,t.jsx)(eS,{...e})})}function eS(e){let{className:s,screenId:n,initialMusic:l}=e,{emitEvent:r,updateScreenPlaying:i}=(0,o.OP)(),{accessToken:c}=eo(),{organization:d}=(0,q.a)(),{musicChannels:x}=ef(),[m,f]=(0,u.useState)(""),[p,g]=(0,u.useState)(l?x.filter(e=>l.some(s=>"success"===s.status&&s.name===e.name)):[]),j=(0,u.useMemo)(()=>m?x.filter(e=>JSON.stringify(Object.values(e)).toLowerCase().includes(m.toLowerCase())):x,[x,m]),{refetch:v,isLoading:y}=el.Z4.nowPlayingLazyList(c,p,null==d?void 0:d.id);return(0,t.jsxs)(ej,{className:s,children:[(0,t.jsx)("div",{className:"sticky top-0 z-10 p-4",children:(0,t.jsxs)("div",{className:"flex flex-row",children:[(0,t.jsx)("div",{className:"w-full"}),(0,t.jsx)(T.Z,{value:m,onChange:e=>{f(e.target.value)},placeholder:"Search for playlist",className:"backdrop-blur-md max-w-sm",inputClassName:"max-w-sm dark:bg-background/25",leadingIcon:(0,t.jsx)(O.jRj,{})}),(0,t.jsx)("div",{className:"w-full"})]})}),(0,t.jsxs)("div",{className:"container mx-auto p-4",children:[0===j.length&&(0,t.jsxs)("div",{className:"flex h-[65vh] w-full flex-col items-center justify-center gap-8 bg-background",children:[(0,t.jsx)("div",{className:"rounded-full bg-accentColor bg-opacity-10 p-8 text-8xl text-accentColor dark:bg-darkAccentColor dark:bg-opacity-10 dark:text-darkAccentColor",children:(0,t.jsx)(O.Xm1,{})}),(0,t.jsx)("h1",{className:"text-lg font-semibold",children:"No music channels found."}),(0,t.jsxs)(k.z,{onClick:()=>f(""),children:[(0,t.jsx)(a.FU5,{}),"Clear search"]})]}),(0,t.jsx)("div",{className:"grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:j.map(e=>{let s=p.some(s=>s.id===e.id);return(0,t.jsx)("button",{onClick:()=>{s?g(s=>s.filter(s=>s.id!==e.id)):g(s=>[...s,e])},children:(0,t.jsx)(e_,{channel:e,isSelected:s,highlightText:m})},e.id)})})]}),n&&p.length>0&&(0,t.jsx)("div",{className:"sticky bottom-0 z-10",children:(0,t.jsxs)("div",{className:"flex flex-row",children:[(0,t.jsx)("div",{className:"w-full"}),(0,t.jsxs)(k.z,{disabled:y,className:"w-full py-8 text-xl",variant:"filled",size:"lg",onClick:async()=>{let{data:e}=await v();(0,er.wQ)({eventtype:"MusicChanged",name:"MusicChanged",payload:{screenId:n,musicInfos:e}}),r("musicChanged",n,e),i({screenId:n,musicInfos:e,opt:{type:"music"}})},children:["Play selected playlists",y&&(0,t.jsx)(h.Q,{}),!y&&(0,t.jsx)(O.KCr,{className:"size-5"})]}),(0,t.jsx)("div",{className:"w-full"})]})})]})}function e_(e){let{channel:s,highlightText:n,isSelected:l}=e;return(0,t.jsxs)(eh.Zb,{className:"h-full transition-all duration-300 hover:shadow-lg hover:-translate-y-1",children:[(0,t.jsx)(eh.Ol,{children:(0,t.jsxs)(eh.ll,{className:"flex items-center gap-2",children:[(0,t.jsx)(O.Xm1,{className:"h-5 w-5"}),(0,t.jsx)("h1",{className:"w-full",children:(0,t.jsx)(ew,{highlightText:n,children:s.name})}),l&&(0,t.jsx)("div",{className:"rounded-full bg-primary p-1 text-foreground",children:(0,t.jsx)(O.UgA,{className:"text-background"})})]})}),(0,t.jsx)(eh.aY,{children:(0,t.jsx)(ej,{className:"h-32",children:(0,t.jsx)(eh.SZ,{children:(0,t.jsx)(ew,{highlightText:n,children:s.description})})})})]})}var eC=n(56891);function ek(){let{profileFetchStatus:e,organization:s,getProfile:n}=(0,q.a)();return(0,t.jsx)(X.Z,{queryFetchStatus:e,onRetry:n,children:(0,t.jsx)(t.Fragment,{children:(null==s?void 0:s.id)&&(0,t.jsx)(d.O,{children:(0,t.jsx)(eC.V,{children:(0,t.jsx)(c.Tu,{children:(0,t.jsx)(eI,{org_id:s.id})})})})})})}function eI(e){let{org_id:s}=e,{openDialog:n,openLoadingOverlay:l,closeDialog:r,showSuccessSnackbar:x,showErrorSnackbar:m}=(0,c.ZP)(),{user:f}=(0,q.a)(),{userIntegrations:h}=(0,eC.N)(),{screens:p,screensFetchStatus:g,getScreens:v,setContentSelectorScreen:y,emitEvent:w}=(0,o.OP)(),{locations:b}=(0,d.Z)(),S=(0,u.useMemo)(()=>[{accessorKey:"name",cell:e=>(null==f?void 0:f.id)===e.row.original.id?(0,t.jsxs)("div",{className:"flex w-40 items-center justify-center gap-2 rounded-full bg-primary py-1.5 text-sm text-primary-foreground",children:[(0,t.jsx)(O.hRw,{}),"Default Screen"]}):e.getValue(),header:()=>(0,t.jsx)("span",{children:"Name"})},{accessorFn:e=>null===e.width||null===e.height?"-":"".concat(e.width,"x").concat(e.height),id:"dimensions",cell:e=>e.getValue(),header:()=>(0,t.jsx)("span",{children:"Size"})},{accessorKey:"screen_type",cell:e=>{let s=e.row.original,n=C.find(e=>e.id===s.screen_type);return(0,t.jsx)("div",{className:"flex",children:(0,t.jsx)("div",{className:"rounded-full bg-accentColor bg-opacity-5 px-4 py-2 text-xs text-accentColor dark:bg-darkAccentColor dark:bg-opacity-5 dark:text-darkAccentColor",children:null==n?void 0:n.title})})},header:()=>(0,t.jsx)("span",{children:"Screen Type"})},{id:"now_playing",header:()=>(0,t.jsx)("span",{children:"Now Playing"}),cell:e=>{var s,l,r,i,c;let o,d;let u=e.row.original;return u.music_infos&&(d=u.music_infos),u.asset_id?o={id:u.asset_id,type:"asset",label:null==u?void 0:null===(s=u.asset)||void 0===s?void 0:s.name}:u.layout_id?o={id:u.layout_id,type:"layout",label:null==u?void 0:null===(l=u.layout)||void 0===l?void 0:l.name}:u.playlist_id?o={id:u.playlist_id,type:"playlist",label:null==u?void 0:null===(r=u.playlists)||void 0===r?void 0:r.name}:u.template_id&&(o={id:u.template_id,type:"template",label:null==u?void 0:null===(i=u.template)||void 0===i?void 0:i.name}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsx)(k.z,{size:"sm",variant:"outline",onClick:()=>{y(u)},children:o?(c=o,(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("div",{className:"flex h-6 w-6 items-center justify-center",children:["asset"===c.type&&(0,t.jsx)("img",{className:"h-full w-full rounded-sm object-cover",src:(0,G.Z)(c.id,"small"),alt:"Img"}),"layout"===c.type&&(0,t.jsx)(Y.K5B,{}),"playlist"===c.type&&(0,t.jsx)(a.nY0,{}),"template"===c.type&&(0,t.jsx)(Y.K5B,{})]}),(0,t.jsx)("p",{className:"max-w-[100px] flex-1 truncate",children:c.label})]})):(0,t.jsx)(t.Fragment,{children:"Select content"})}),h.some(e=>e.enabled&&"Music"===e.name)&&(0,t.jsxs)(k.z,{size:"sm",variant:"outline",onClick:()=>{var e,s;e=u.id,s=d,n({showActions:!1,customContent:(0,t.jsx)(eN,{className:"h-[80vh]",screenId:e,initialMusic:s}),maxWidth:"70vw"})},children:[(0,t.jsx)(O.Xm1,{className:"pr-2 size-6"}),(null==d?void 0:d.length)?(0,t.jsx)(eA,{children:d.map(e=>"success"===e.status?e.name:"").join(" | ")}):(0,t.jsx)(t.Fragment,{children:"Select music"})]})]})}},{id:"controls",header:()=>(0,t.jsx)("div",{className:"inline-flex w-full items-center justify-end",children:"Actions"}),cell:e=>{let s=e.row.original;return(null==f?void 0:f.id)===s.id?(0,t.jsx)("div",{className:"flex items-center justify-end gap-2",children:(0,t.jsxs)(k.z,{size:"sm",variant:"secondary",onClick:()=>{window.open(N.O.NEXT_PUBLIC_PLAYER_URL,"_blank")},children:[(0,t.jsx)(a.Bj5,{}),"Open Screen"]})}):(0,t.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[!s.is_paired&&(0,t.jsxs)(k.z,{size:"sm",variant:"secondary",onClick:()=>{L(s,!0)},children:[(0,t.jsx)(a.$l_,{}),"Pair Now"]}),s.is_paired&&(0,t.jsx)(eT,{screenId:s.id}),(0,t.jsx)(eP,{screen:s,openDeleteScreenDialog:R,openScreenAddDialog:L})]})}}],[p]),{table:_}=(0,Q.x)({data:p,columns:S}),{planProperties:I,subscription:P}=(0,W.q)(),{mutate:A}=(0,el.Wc)(),{log:T}=(0,er.ZP)();function L(e,l){n({showActions:!1,customContent:(0,t.jsx)(B,{screen:e,isPairAgain:l,locations:b,org_id:s,onSuccess:s=>{e||T({name:"ScreenCreated",eventtype:"Action",payload:{screenId:s.id}}),r(),v(),y(s)}})})}function R(e){n({title:"Unpair Screen?",dialogType:"confirm",onConfirm:async()=>{l(),A({screenId:e,orgId:s},{onSuccess(){w("screenChanged",e,{new:{deleted:!0}}),x("Screen unpaired successfully"),r(),v()},onError(){m("Something went wrong"),r(),v()}})}})}return(0,t.jsx)(X.Z,{queryFetchStatus:g,onRetry:v,children:(0,t.jsx)(t.Fragment,{children:function(){var e,l;if(0===p.length)return(0,t.jsx)("div",{className:"flex h-full w-full flex-col items-center justify-center",children:(0,t.jsx)("div",{className:"w-[550px]",children:(0,t.jsx)(B,{locations:b,isFirstScreen:!0,org_id:s,onSuccess:e=>{r(),v(),y(e)}})})});let o=null!==(l=null!==(e=I.max_screens)&&void 0!==e?e:I.entitled_screens)&&void 0!==l?l:0;return(0,t.jsxs)("div",{className:"flex h-full w-full flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex gap-2 text-xl font-semibold",children:[(0,t.jsx)("h1",{children:"Screens"}),(I.max_screens||I.entitled_screens)&&(0,t.jsxs)("div",{className:"flex items-center gap-2 rounded-full px-3 py-1 text-xs font-medium ".concat(p.length-1>=o?"bg-red-500/10 text-red-500":"bg-primary/20  text-primary"),children:[(0,t.jsx)("p",{children:"".concat(p.length-1>=o?"No more screens available":"".concat(Math.abs(p.length-1-o)," screens available")," ")}),(0,t.jsx)("div",{className:"tooltip tooltip-bottom","data-tip":"Total screens available: ".concat(o),children:(0,t.jsx)(a.I5p,{})})]})]}),(0,t.jsxs)(k.z,{onClick:()=>{var e,s,l,i;let a=p.length-1;I.max_screens&&a>=(null!==(e=I.max_screens)&&void 0!==e?e:0)?n({title:"Max Screens Reached",customContent:(0,t.jsxs)("div",{className:"flex flex-col gap-2 pt-2",children:[(0,t.jsxs)("p",{children:[null==P?void 0:null===(l=P.plan)||void 0===l?void 0:l.name," only allows upto"," ",null!==(i=I.max_screens)&&void 0!==i?i:p.length-1," ","screens. Please upgrade your plan."]}),(0,t.jsx)("div",{className:"flex w-full items-center justify-end",children:(0,t.jsx)(k.z,{asChild:!0,children:(0,t.jsx)(j(),{href:"/change_plan",children:"Upgrade Options"})})})]})}):I.entitled_screens&&I.addon_screen_cost&&a>=(null!==(s=I.entitled_screens)&&void 0!==s?s:0)?n({title:"Max Screens Reached",showActions:!1,customContent:(0,t.jsx)(c.Tu,{children:(0,t.jsx)(en,{onClose:r})})}):L(void 0)},children:[(0,t.jsx)(i.lcq,{}),"Add Screen"]})]}),(0,t.jsx)(t.Fragment,{children:p.length>0?(0,t.jsx)(Q.Z,{table:_,totalRows:p.length}):(0,t.jsx)(K.Z,{message:"No Screens added yet."})})]})}()})})}function eP(e){let{screen:s,openDeleteScreenDialog:n,openScreenAddDialog:l}=e,{onlineStatus:r,emitEvent:i}=(0,o.OP)();return(0,t.jsx)(H.Z,{menuItems:[{items:[s.is_paired&&r[s.id]&&{icon:(0,t.jsx)(a.zq9,{}),title:"Restart",onClick(){i("restart",s.id)}},{icon:(0,t.jsx)(a.zmo,{}),title:"Edit",onClick(){l(s)}},{icon:(0,t.jsx)(a.Qw4,{}),title:"Unpair",onClick(){n(s.id)}}].filter(Boolean)}]})}function eA(e){let{children:s,className:n,...l}=e;return(0,t.jsx)("div",{className:(0,eg.cn)("max-w-36",n,"overflow-hidden"),children:(0,t.jsx)("h1",{className:(0,eg.cn)("text-sm max-w-36",n,"whitespace-nowrap animate-marquee"),...l,children:s})})}function eT(e){let{screenId:s}=e,{onlineStatus:n}=(0,o.OP)(),l=n[s];return(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 rounded-full bg-muted px-3 py-1 text-xs",children:[(0,t.jsx)("div",{className:"h-3 w-3 rounded-full ".concat(l?"bg-green-500":"bg-red-500")}),l?"Online":"Offline"]})}let eO=function(){return(0,t.jsxs)("div",{children:[(0,t.jsx)(l.Z,{title:"Screens"}),(0,t.jsx)(r.Z,{children:(0,t.jsx)(ek,{})})]})}}}]);