home-atom 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/.vite/manifest.json +33 -33
- package/dist/client/_next/static/chunks/{app-top-nav-Dh0jEt8u.js → app-top-nav-Co7RIixU.js} +1 -1
- package/dist/client/_next/static/chunks/{index-hn3AiVww.js → index-BUxxgh38.js} +3 -3
- package/dist/client/_next/static/chunks/{layout-segment-context-DRM8YCgm.js → layout-segment-context-D_cL7vkY.js} +1 -1
- package/dist/client/_next/static/chunks/manage-profiles-modal-CWi3qgd4.js +1 -0
- package/dist/client/_next/static/chunks/netflix-browser-BrXQctI5.js +2 -0
- package/dist/client/_next/static/chunks/playback-activity-66FeikYZ.js +1 -0
- package/dist/client/_next/static/chunks/playback-activity-track-switcher-BzvHiv7c.js +1 -0
- package/dist/client/_next/static/chunks/{step-forward-CV8I5pPb.js → provider-registry-CWHfJn3B.js} +1 -1
- package/dist/client/_next/static/chunks/spotify-app-CJimeMR0.js +1 -0
- package/dist/client/_next/static/chunks/storefront-CCeanBPs.js +1 -0
- package/dist/client/_next/static/css/index.8o3Y-jts.css +1 -0
- package/dist/client/_next/static/css/layout.D2NsWbhP.css +1 -0
- package/dist/client/_next/static/css/layout.D4D5fsiD.css +1 -0
- package/dist/client/_next/static/css/manage-profiles-modal.BOKESpxI.css +1 -0
- package/dist/client/vinext-client-entry-manifest.json +1 -1
- package/dist/server/BUILD_ID +1 -1
- package/dist/server/__vite_rsc_assets_manifest.js +35 -35
- package/dist/server/_next/static/{app-page-cache-DcrtN14Y.js → app-page-cache-CQaSjBaF.js} +1 -1
- package/dist/server/_next/static/{app-page-cache-render-DoCquoNb.js → app-page-cache-render-Dty3aMiv.js} +1 -1
- package/dist/server/_next/static/{app-route-handler-dispatch-Be2YIqVp.js → app-route-handler-dispatch-DCSrhGNV.js} +1 -1
- package/dist/server/_next/static/{cache-headers-BQ-QuzWN.js → cache-headers-lY59goLh.js} +1 -1
- package/dist/server/_next/static/css/index.8o3Y-jts.css +1 -0
- package/dist/server/_next/static/css/layout.D2NsWbhP.css +1 -0
- package/dist/server/_next/static/css/layout.D4D5fsiD.css +1 -0
- package/dist/server/_next/static/database-D79CeUrn.js +161 -0
- package/dist/server/_next/static/{db-BE1J0NNS.js → db-x8J3Vuoa.js} +1 -1
- package/dist/server/_next/static/{downloader-DgnjNL5T.js → downloader-0G-gq1D-.js} +3 -3
- package/dist/server/_next/static/episode-sync-Ct5CeY25.js +1 -0
- package/dist/server/_next/static/{isr-decision-D1zHgPSI.js → isr-decision-BOA4L6nr.js} +1 -1
- package/dist/server/_next/static/netflix-page-Cpp2PgD1.js +1 -0
- package/dist/server/_next/static/{page-Cs-erYTy.js → page-BvzzZVuW.js} +1 -1
- package/dist/server/_next/static/{page-DlBGATQp.js → page-C27wjUYW.js} +1 -1
- package/dist/server/_next/static/{page-DlRXyzSQ.js → page-Rnpx_OjW.js} +1 -1
- package/dist/server/_next/static/{providers-B3YELr_F.js → providers-DwLUa_U_.js} +13 -13
- package/dist/server/_next/static/{providers-CMBIwNGs.js → providers-_uOQh6hB.js} +1 -1
- package/dist/server/_next/static/{request-profile-B1yGQ0l6.js → request-profile-ClcH0i0T.js} +1 -1
- package/dist/server/_next/static/route-4xkmbpc4.js +1 -0
- package/dist/server/_next/static/{route-CeVsDcbj2.js → route-B0L_rsrg2.js} +1 -1
- package/dist/server/_next/static/{route-xtz48fti.js → route-B6q-wR2F.js} +1 -1
- package/dist/server/_next/static/{route-DXTJyFWD.js → route-B6zrlXB5.js} +1 -1
- package/dist/server/_next/static/{route-CNNiXZoM2.js → route-B99Pvusz2.js} +1 -1
- package/dist/server/_next/static/route-B9YeBtG6.js +1 -0
- package/dist/server/_next/static/route-BHbJ9hFI2.js +1 -0
- package/dist/server/_next/static/{route-mzLdjDCs2.js → route-BR3Y_0V42.js} +1 -1
- package/dist/server/_next/static/{route-Cim7D4XQ.js → route-BaGo5TEW.js} +1 -1
- package/dist/server/_next/static/{route-DslPFTAK.js → route-BczKcyvV.js} +1 -1
- package/dist/server/_next/static/{route-B0WNLJZp.js → route-BiSvZr_s.js} +1 -1
- package/dist/server/_next/static/{route-Dbs39TkC.js → route-Bj7s6WXI.js} +1 -1
- package/dist/server/_next/static/{route-vD15s2A8.js → route-CGH08Y8C.js} +1 -1
- package/dist/server/_next/static/{route-CkH7Cg-p.js → route-CJmc17Dq.js} +1 -1
- package/dist/server/_next/static/{route-C74RA7va.js → route-CLvr0Ue3.js} +1 -1
- package/dist/server/_next/static/route-CUaIuP8a.js +1 -0
- package/dist/server/_next/static/{route-BPcAdbz_.js → route-CcrNbScT.js} +1 -1
- package/dist/server/_next/static/route-CiOFTfyw2.js +1 -0
- package/dist/server/_next/static/route-Cn7l9eYT.js +1 -0
- package/dist/server/_next/static/route-CnKXQb5r2.js +1 -0
- package/dist/server/_next/static/{route-CVPPmUto.js → route-D93PQ3NI2.js} +1 -1
- package/dist/server/_next/static/{route-D_G2SOlz.js → route-D9ZD1_5T.js} +1 -1
- package/dist/server/_next/static/{route-DAyF4BHS.js → route-DWPhX9kT2.js} +1 -1
- package/dist/server/_next/static/route-DihT2xS82.js +1 -0
- package/dist/server/_next/static/route-Dn-sYYEs.js +1 -0
- package/dist/server/_next/static/route-DpzLCx1V.js +1 -0
- package/dist/server/_next/static/route-Dswz7MvP2.js +1 -0
- package/dist/server/_next/static/route-Dwk0kt8B.js +1 -0
- package/dist/server/_next/static/route-DxLQx9eD.js +1 -0
- package/dist/server/_next/static/{route-zazqen-A2.js → route-FwNLcs2r2.js} +1 -1
- package/dist/server/_next/static/route-GmbSJZjk2.js +1 -0
- package/dist/server/_next/static/route-iUxcDN2r.js +1 -0
- package/dist/server/_next/static/{route-UWQN8uYr.js → route-j61HPczh.js} +1 -1
- package/dist/server/_next/static/{route-CHJzaQu2.js → route-qJ1EJhxJ.js} +1 -1
- package/dist/server/_next/static/{route-BWk9YK7r.js → route-sNW0pw7C.js} +1 -1
- package/dist/server/_next/static/{seed-cache-oCd9Lfdw.js → seed-cache-DsYPqBld.js} +1 -1
- package/dist/server/_next/static/{server-CS40XqUP.js → server-DwVU6UyP.js} +1 -1
- package/dist/server/_next/static/storage-fxaUbjG1.js +322 -0
- package/dist/server/_next/static/streamer-DUAWx_Tm.js +2 -0
- package/dist/server/_next/static/{subtitles-DYBlMnha.js → subtitles-4c0GFlaW.js} +1 -1
- package/dist/server/_next/static/{title-progress-CQBrSxvN.js → title-progress-BTypVYBz.js} +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/prerendered-routes/404.html +2 -2
- package/dist/server/prerendered-routes/index.html +2 -2
- package/dist/server/prerendered-routes/index.rsc +2 -2
- package/dist/server/ssr/__vite_rsc_assets_manifest.js +35 -35
- package/dist/server/ssr/_next/static/css/refresh-cw.BOKESpxI.css +1 -0
- package/dist/server/ssr/_next/static/minimize-gPI5ytrc.js +1 -0
- package/dist/server/ssr/_next/static/netflix-browser-CXJEizJ6.js +2 -0
- package/dist/server/ssr/_next/static/{pin-BQre-tQY.js → pin-DiZl7z2n.js} +1 -1
- package/dist/server/ssr/_next/static/playback-activity-AIsC-eO5.js +1 -0
- package/dist/server/ssr/_next/static/refresh-cw-DNvHlOAy.js +1 -0
- package/dist/server/ssr/_next/static/spotify-app-xyDH0rho.js +1 -0
- package/dist/server/ssr/_next/static/storefront-DMeL08z3.js +1 -0
- package/dist/server/ssr/index.js +1 -1
- package/dist/server/ssr/vinext-client-assets.js +1 -1
- package/dist/server/ssr/vinext-server.json +1 -1
- package/dist/server/vinext-client-assets.js +1 -1
- package/dist/server/vinext-prerender-paths.json +1 -1
- package/dist/server/vinext-prerender.json +16 -1
- package/dist/server/vinext-server.json +1 -1
- package/package.json +4 -2
- package/dist/client/_next/static/chunks/manage-profiles-modal-Doi6QM4e.js +0 -1
- package/dist/client/_next/static/chunks/netflix-browser-L_Vb9wXK.js +0 -2
- package/dist/client/_next/static/chunks/playback-activity-Dug3BRYr.js +0 -1
- package/dist/client/_next/static/chunks/playback-activity-track-switcher-CbO6kl8K.js +0 -1
- package/dist/client/_next/static/chunks/spotify-app-f93K4FG_.js +0 -1
- package/dist/client/_next/static/chunks/storefront-C_nmcuvH.js +0 -1
- package/dist/client/_next/static/css/index.BGXy8e6j.css +0 -1
- package/dist/client/_next/static/css/layout.AKSLtSR6.css +0 -1
- package/dist/client/_next/static/css/layout.D8T68cCD.css +0 -1
- package/dist/client/_next/static/css/manage-profiles-modal.BAVyxRRR.css +0 -1
- package/dist/server/_next/static/css/index.BGXy8e6j.css +0 -1
- package/dist/server/_next/static/css/layout.AKSLtSR6.css +0 -1
- package/dist/server/_next/static/css/layout.D8T68cCD.css +0 -1
- package/dist/server/_next/static/database-BNnYfHmT.js +0 -114
- package/dist/server/_next/static/netflix-page-BRbORN1F.js +0 -1
- package/dist/server/_next/static/route-96DdgJBs.js +0 -1
- package/dist/server/_next/static/route-BBmE0xf12.js +0 -1
- package/dist/server/_next/static/route-BdG5ojMj2.js +0 -1
- package/dist/server/_next/static/route-BovNctFc.js +0 -1
- package/dist/server/_next/static/route-C2LuSjoh.js +0 -1
- package/dist/server/_next/static/route-CCUsQ7AG.js +0 -1
- package/dist/server/_next/static/route-CN6VdJwN.js +0 -1
- package/dist/server/_next/static/route-CjUCKwSj2.js +0 -1
- package/dist/server/_next/static/route-Cn40NftM.js +0 -1
- package/dist/server/_next/static/route-DWAMZHLa.js +0 -1
- package/dist/server/_next/static/route-DiT9UYUd.js +0 -1
- package/dist/server/_next/static/route-jMq6H_yh.js +0 -1
- package/dist/server/_next/static/storage-D1zF0J_t.js +0 -288
- package/dist/server/_next/static/streamer-B1PRR-dj.js +0 -2
- package/dist/server/ssr/_next/static/css/refresh-cw.BAVyxRRR.css +0 -1
- package/dist/server/ssr/_next/static/minimize-C9JLgte-.js +0 -1
- package/dist/server/ssr/_next/static/netflix-browser-CMAehdwi.js +0 -2
- package/dist/server/ssr/_next/static/playback-activity-D5TYX2Ae.js +0 -1
- package/dist/server/ssr/_next/static/refresh-cw-CWdWHjqY.js +0 -1
- package/dist/server/ssr/_next/static/spotify-app-CE-RaTjZ.js +0 -1
- package/dist/server/ssr/_next/static/storefront-C5NNzPMa.js +0 -1
- /package/dist/client/_next/static/{e1ce9af7-d770-43d6-845a-511443f19971 → 7c810a6d-59fd-41d6-b465-cf61efaea04f}/_buildManifest.js +0 -0
- /package/dist/client/_next/static/{e1ce9af7-d770-43d6-845a-511443f19971 → 7c810a6d-59fd-41d6-b465-cf61efaea04f}/_ssgManifest.js +0 -0
- /package/dist/server/_next/static/{layout-Ds3pFa6r.js → layout-D1iejeee.js} +0 -0
- /package/dist/server/_next/static/{layout-ClEWbCcj.js → layout-DpOw0OgX.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./chevron-left-CkBJG8E2.js";import{t as n}from"./house-l1u9dUbj.js";import{_ as r,a as i,c as a,d as o,i as s,l as c,n as l,o as u,p as d,r as f,s as ee,t as p,u as te,v as ne}from"./pin-BQre-tQY.js";import{a as m,c as h,d as g,f as _,h as re,i as v,m as ie,n as y,p as b,r as ae,s as oe,t as x}from"./refresh-cw-CWdWHjqY.js";import{a as S,c as se,i as ce,l as le,n as ue,o as de,r as fe,s as pe,t as me,u as he}from"./playback-activity-D5TYX2Ae.js";import{Fragment as ge,jsx as C,jsxs as w}from"react/jsx-runtime";import{useCallback as T,useEffect as E,useMemo as D,useRef as O,useState as k}from"react";var A=e(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),_e=e(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),ve=e(`compass`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z`,key:`9ktpf1`}]]),ye=e(`library`,[[`path`,{d:`m16 6 4 14`,key:`ji33uf`}],[`path`,{d:`M12 6v14`,key:`1n7gus`}],[`path`,{d:`M8 8v12`,key:`1gg7y9`}],[`path`,{d:`M4 4v16`,key:`6qkkli`}]]),be=e(`list-music`,[[`path`,{d:`M16 5H3`,key:`m91uny`}],[`path`,{d:`M11 12H3`,key:`51ecnj`}],[`path`,{d:`M11 19H3`,key:`zflm78`}],[`path`,{d:`M21 16V5`,key:`yxg4q8`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}]]),xe=e(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),Se=e(`monitor-speaker`,[[`path`,{d:`M5.5 20H8`,key:`1k40s5`}],[`path`,{d:`M17 9h.01`,key:`1j24nn`}],[`rect`,{width:`10`,height:`16`,x:`12`,y:`4`,rx:`2`,key:`ixliua`}],[`path`,{d:`M8 6H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h4`,key:`1mp6e1`}],[`circle`,{cx:`17`,cy:`15`,r:`1`,key:`tqvash`}]]),j=e(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Ce=e(`repeat-2`,[[`path`,{d:`m2 9 3-3 3 3`,key:`1ltn5i`}],[`path`,{d:`M13 18H7a2 2 0 0 1-2-2V6`,key:`1r6tfw`}],[`path`,{d:`m22 15-3 3-3-3`,key:`4rnwn2`}],[`path`,{d:`M11 6h6a2 2 0 0 1 2 2v10`,key:`2f72bc`}]]),we=e(`shuffle`,[[`path`,{d:`m18 14 4 4-4 4`,key:`10pe0f`}],[`path`,{d:`m18 2 4 4-4 4`,key:`pucp1d`}],[`path`,{d:`M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22`,key:`1ailkh`}],[`path`,{d:`M2 6h1.972a4 4 0 0 1 3.6 2.2`,key:`km57vx`}],[`path`,{d:`M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45`,key:`os18l9`}]]);function M({palette:e,title:t,className:n=``,imageUrl:r,rounded:i=!1}){let a={"--cover-from":e.from,"--cover-to":e.to,"--cover-accent":e.accent,backgroundImage:r?`url(${JSON.stringify(r)})`:void 0};return w(`div`,{"aria-label":`${t} cover`,className:`coverArt ${r?`coverArtHasImage`:``} ${i?`coverArtRound`:``} ${n}`,role:`img`,style:a,children:[C(`span`,{className:`coverOrb coverOrbOne`}),C(`span`,{className:`coverOrb coverOrbTwo`}),C(`span`,{className:`coverLine`}),C(`span`,{className:`coverGlyph`,"aria-hidden":`true`,children:e.glyph}),C(`span`,{className:`coverNoise`})]})}function Te(e){return e.replace(/[<>&"']/g,e=>{switch(e){case`<`:return`<`;case`>`:return`>`;case`&`:return`&`;case`"`:return`"`;default:return`'`}})}function Ee(e){if(e.imageUrl)return e.imageUrl;let t=[`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 540">`,`<defs>`,`<linearGradient id="g" x1="0" y1="0" x2="1" y2="1">`,`<stop stop-color="${Te(e.palette.from)}"/>`,`<stop offset="1" stop-color="${Te(e.palette.to)}"/>`,`</linearGradient>`,`</defs>`,`<rect width="960" height="540" fill="url(#g)"/>`,`<circle cx="760" cy="95" r="250" fill="${Te(e.palette.accent)}" opacity=".18"/>`,`<circle cx="190" cy="485" r="225" fill="#000" opacity=".2"/>`,`<text x="480" y="315" fill="${Te(e.palette.accent)}" font-family="Arial,sans-serif" font-size="150" font-weight="700" text-anchor="middle">${Te(e.palette.glyph)}</text>`,`</svg>`].join(``);return`data:image/svg+xml,${encodeURIComponent(t)}`}function N(e,t){return{service:`spotify`,sessionId:t.id,profileId:t.profileId,titleId:e.track.id,title:e.track.title||`Untitled track`,artist:e.track.artist||`Unknown artist`,album:e.track.album||`Unknown album`,provider:e.track.provider||`Spotify Atom`,artwork:Ee(e.track),currentTime:Math.max(0,e.currentTime),duration:Math.max(0,e.duration),paused:!e.isPlaying,muted:e.volume<=0,volume:Math.max(0,Math.min(1,e.volume/100)),machineName:fe(),deviceType:ce(),updatedAt:Date.now()}}function De(e){let t=O(e),n=O(null),r=D(()=>e.active&&e.profileId?{id:ue(),profileId:e.profileId}:null,[e.active,e.profileId]);E(()=>{t.current=e},[e]),E(()=>{if(!r)return;let e=!1,i=0,a=null,o=new Set,s=new AbortController,c=()=>{let n=t.current;if(e||!n.active||n.profileId!==r.profileId)return;let i=new AbortController;o.add(i),fetch(`/api/netflix/activity`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({activity:N(n,r)}),cache:`no-store`,signal:i.signal}).catch(()=>{}).finally(()=>{o.delete(i)})};n.current=c;let l=e=>{let n=t.current;switch(e.type){case`set-paused`:n.onSetPaused(e.paused);break;case`seek-relative`:n.onSeek(n.currentTime+e.seconds);break;case`seek-to`:n.onSeek(e.seconds);break;case`set-muted`:n.onSetMuted(e.muted);break;case`set-volume`:n.onSetVolume(e.volume);break;case`previous-track`:n.onPrevious();break;case`next-track`:n.onNext();break;case`switch-track`:n.onSelectTrack(e.trackId);break;case`switch-playlist`:n.onSelectPlaylist(e.playlistId);break;case`next-episode`:case`select-episode`:case`switch-title`:case`set-captions`:case`set-subtitle-font-size`:case`set-subtitle-font-color`:case`set-subtitle-background`:case`reset-subtitle-position`:break}window.requestAnimationFrame(c)},u=async()=>{if(!(e||s.signal.aborted)){try{let e=await fetch(`/api/netflix/activity/${encodeURIComponent(r.id)}/commands?after=${encodeURIComponent(i)}&profileId=${encodeURIComponent(r.profileId)}`,{cache:`no-store`,signal:s.signal});if(e.ok){let t=await e.json();if(typeof t==`object`&&t&&!Array.isArray(t)){let e=t,n=Array.isArray(e.commands)?e.commands:[];for(let e of n){if(typeof e!=`object`||!e||Array.isArray(e))continue;let t=e;if(typeof t.id!=`number`||!Number.isSafeInteger(t.id)||t.id<=i||t.sessionId!==r.id)continue;let n={kind:`command`,sessionId:r.id,command:t.command};!S(n)||n.kind!==`command`||(l(n.command),i=t.id)}typeof e.cursor==`number`&&Number.isSafeInteger(e.cursor)&&e.cursor>=i&&(i=e.cursor)}}}catch{}!e&&!s.signal.aborted&&(a=window.setTimeout(()=>void u(),Math.min(500,me)))}},d=()=>{if(!e){e=!0,s.abort();for(let e of o)e.abort();o.clear(),fetch(`/api/netflix/activity`,{method:`DELETE`,headers:{"content-type":`application/json`},body:JSON.stringify({sessionId:r.id,profileId:r.profileId}),cache:`no-store`,keepalive:!0}).catch(()=>{})}};window.addEventListener(`pagehide`,d),c();let f=window.setInterval(c,me);return u(),()=>{window.clearInterval(f),a!==null&&window.clearTimeout(a),window.removeEventListener(`pagehide`,d),n.current===c&&(n.current=null),d()}},[r]),E(()=>{n.current?.()},[e.track.id,e.currentTime,e.duration,e.isPlaying,e.volume])}function Oe(e){return e.kind===`track`?`track:${e.track.id}`:`playlist:${e.playlist.id}`}var ke=[{id:`zing-mp3`,name:`Zing MP3`,homeUrl:`https://zingmp3.vn/`,lastSyncedAt:null,itemCount:0,syncStatus:`idle`,error:null},{id:`tiktok`,name:`TikTok`,homeUrl:`https://www.tiktok.com/`,lastSyncedAt:null,itemCount:0,syncStatus:`idle`,error:null},{id:`youtube`,name:`YouTube`,homeUrl:`https://www.youtube.com/`,lastSyncedAt:null,itemCount:0,syncStatus:`idle`,error:null},{id:`nhac-cua-tui`,name:`NhacCuaTui`,homeUrl:`https://www.nhaccuatui.com/`,lastSyncedAt:null,itemCount:0,syncStatus:`idle`,error:null}];async function P(e,t){let n=t?.method?.toUpperCase()??`GET`,r=await fetch(e,{cache:`no-store`,...t,headers:{Accept:`application/json`,...n!==`GET`&&n!==`HEAD`?{"X-Spotify-Atom-Request":`1`}:{},...t?.headers}}),i=await r.json().catch(()=>null);if(!r.ok){let e=i?.error||i?.message||`Request failed with status ${r.status}`;throw Error(e)}if(!i)throw Error(`The server returned an empty response.`);return i}function F(e,t){return t?`${e}${e.includes(`?`)?`&`:`?`}profileId=${encodeURIComponent(t)}`:e}function Ae(e){let t=e.provider.toLowerCase(),n=f.chromaticWeather;return t.includes(`zing`)?n=f.neonPulse:t.includes(`tiktok`)?n=f.parallelStreets:t.includes(`youtube`)?n=f.stillFrames:t.includes(`nhac`)&&(n=f.blueHour),{...e,durationSec:Number.isFinite(e.durationSec)?e.durationSec:0,imageUrl:e.imageUrl??void 0,palette:n}}function je(e){let t=e.totalTracks>0&&e.availableTracks>=e.totalTracks;return{id:e.id,title:e.title,description:t?e.description:`${e.availableTracks} of ${e.totalTracks} songs ready`,curator:e.curator,trackIds:e.trackIds,palette:f.stillFrames,imageUrl:e.imageUrl??void 0,provider:e.provider,sourceUrl:e.sourceUrl,totalTracks:e.totalTracks,availableTracks:e.availableTracks}}function Me(e){if(e===null||!Number.isFinite(e)||e<=0)return``;let t=[`B`,`KB`,`MB`,`GB`],n=Math.min(Math.floor(Math.log(e)/Math.log(1024)),t.length-1),r=e/1024**n;return`${r>=10||n===0?r.toFixed(0):r.toFixed(1)} ${t[n]}`}function Ne(e){if(e.status===`completed`)return 100;let t=e.totalBytes!==null&&e.totalBytes>0?e.bytesDownloaded/e.totalBytes*100:0;return Math.round(Math.min(100,Math.max(0,Math.max(e.progress||0,t))))}function Pe(e){switch(e){case`queued`:return`Queued`;case`fetching`:return`Fetching details`;case`downloading`:return`Downloading`;case`completed`:return`Ready to play`;case`failed`:return`Download failed`}}function Fe(e){if(!e)return`Not synced yet`;let t=new Date(e);return Number.isNaN(t.getTime())?`Previously synced`:`Synced ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`}).format(t)}`}function Ie(e){try{return new URL(e).hostname.replace(/^www\./,``)}catch{return e}}function Le(e){let t=Number.isFinite(e)?Math.max(0,e):0;return`${Math.floor(t/60)}:${Math.floor(t%60).toString().padStart(2,`0`)}`}function Re(){return w(`span`,{className:`spotifyMark`,"aria-hidden":`true`,children:[C(`span`,{}),C(`span`,{}),C(`span`,{})]})}function I({autoFocus:e=!1,buttonRef:t,label:n,children:r,className:i=``,pressed:a,expanded:o,controls:s,hasPopup:c,onClick:l}){return C(`button`,{"aria-controls":s,"aria-expanded":o,"aria-haspopup":c,"aria-label":n,"aria-pressed":a,autoFocus:e,className:`iconButton ${a?`isActive`:``} ${i}`,onClick:l,ref:t,title:n,type:`button`,children:r})}function ze({playing:e,label:t,size:n=`normal`,onClick:r}){return C(`button`,{"aria-label":t,className:`playButton playButton-${n}`,onClick:r,type:`button`,children:C(e?m:b,{fill:`currentColor`})})}function Be({item:e,active:t,onSelect:n}){return w(`button`,{className:`libraryRow ${t?`libraryRowActive`:``}`,onClick:n,type:`button`,children:[C(M,{className:`libraryCover`,imageUrl:e.imageUrl,palette:e.palette,rounded:e.kind===`artist`,title:e.title}),w(`span`,{className:`libraryRowText`,children:[C(`span`,{className:`libraryRowTitle`,children:e.title}),w(`span`,{className:`libraryRowMeta`,children:[e.pinned?C(p,{"aria-hidden":`true`,fill:`currentColor`,size:12}):null,e.subtitle]})]}),C(j,{"aria-hidden":`true`,className:`libraryRowMore`,size:19})]})}function Ve({playlist:e,active:t,playing:n,onPlay:r}){return w(`article`,{className:`playlistCard ${t?`playlistCardActive`:``}`,children:[w(`div`,{className:`playlistCardArt`,children:[C(M,{imageUrl:e.imageUrl,palette:e.palette,title:e.title}),C(ze,{label:`${n&&t?`Pause`:`Play`} ${e.title}`,onClick:e=>{e.stopPropagation(),r()},playing:n&&t}),t&&n?w(`span`,{className:`playingBadge`,children:[C(`span`,{}),C(`span`,{}),C(`span`,{})]}):null]}),w(`button`,{className:`cardCopy`,onClick:r,type:`button`,children:[C(`span`,{className:`playlistCardTitle`,children:e.title}),C(`span`,{className:`playlistCardDescription`,children:e.description})]})]})}function He({track:e,active:t,playing:n,liked:i,onSelect:a,onLike:o}){return w(`div`,{className:`trackResult ${t?`trackResultActive`:``}`,children:[w(`button`,{"aria-label":`${n&&t?`Pause`:`Play`} ${e.title}`,className:`trackResultMain`,onClick:a,type:`button`,children:[w(`span`,{className:`trackResultArtWrap`,children:[C(M,{className:`trackResultArt`,imageUrl:e.imageUrl,palette:e.palette,title:e.title}),C(`span`,{className:`trackResultPlay`,children:C(n&&t?m:b,{fill:`currentColor`,size:18})})]}),w(`span`,{className:`trackResultCopy`,children:[C(`span`,{className:`trackResultTitle`,children:e.title}),C(`span`,{children:e.artist})]})]}),C(`span`,{className:`trackResultAlbum`,children:e.album}),C(I,{className:`trackResultLike`,label:`${i?`Remove`:`Add`} ${e.title} ${i?`from`:`to`} Liked Songs`,onClick:o,pressed:i,children:C(r,{fill:i?`currentColor`:`none`,size:18})}),C(`span`,{className:`trackResultDuration`,children:Le(e.durationSec)}),C(I,{label:`More options for ${e.title}`,children:C(j,{size:19})})]})}function Ue({providers:e,syncingProviderIds:t,providerError:n,musicUrl:r,addMusicError:i,addingMusic:a,onClose:s,onMusicUrlChange:c,onAddMusic:l,onSync:u}){return w(`div`,{"aria-label":`Music sources`,className:`headerPopover sourcePopover`,id:`source-popover`,role:`dialog`,children:[w(`div`,{className:`popoverHeader`,children:[w(`div`,{children:[C(`span`,{className:`popoverEyebrow`,children:`YOUR MUSIC`}),C(`h2`,{children:`Sources`})]}),C(I,{label:`Close music sources`,onClick:s,children:C(g,{size:18})})]}),n?w(`div`,{className:`popoverError`,role:`alert`,children:[C(o,{size:16}),C(`span`,{children:n})]}):null,C(`div`,{className:`providerList`,children:e.map(e=>{let n=t.has(e.id)||e.syncStatus.toLowerCase()===`syncing`;return w(`article`,{className:`providerRow`,children:[C(`span`,{className:`providerMark providerMark--${e.id}`,"aria-hidden":`true`,children:e.name.slice(0,1).toUpperCase()}),w(`div`,{className:`providerCopy`,children:[w(`a`,{href:e.homeUrl,rel:`noreferrer`,target:`_blank`,children:[C(`strong`,{children:e.name}),C(pe,{size:13})]}),w(`span`,{children:[Fe(e.lastSyncedAt),` · `,e.itemCount,` `,e.itemCount===1?`item`:`items`]}),e.error?C(`span`,{className:`providerError`,children:e.error}):null]}),w(`button`,{"aria-label":`Sync ${e.name}`,className:`syncProviderButton`,disabled:n,onClick:()=>u(e),type:`button`,children:[n?C(h,{"aria-hidden":`true`,className:`spin`,size:17}):C(x,{"aria-hidden":`true`,size:17}),C(`span`,{children:n?`Syncing`:`Sync`})]})]},e.id)})}),w(`form`,{className:`addMusicForm`,onSubmit:l,children:[w(`div`,{className:`addMusicHeading`,children:[C(`span`,{className:`addMusicIcon`,children:C(de,{size:17})}),w(`div`,{children:[C(`strong`,{children:`Add music`}),C(`span`,{children:`Paste a song or YouTube playlist link.`})]})]}),C(`label`,{htmlFor:`music-source-url`,children:`Music link`}),w(`div`,{className:`musicUrlControl`,children:[C(`input`,{autoComplete:`url`,id:`music-source-url`,onChange:e=>c(e.target.value),placeholder:`Paste a Zing MP3, TikTok, YouTube, or NCT link`,required:!0,type:`url`,value:r}),w(`button`,{disabled:a||!r.trim(),type:`submit`,children:[a?C(h,{"aria-hidden":`true`,className:`spin`,size:17}):C(oe,{"aria-hidden":`true`,size:17}),C(`span`,{children:a?`Adding`:`Add`})]})]}),i?C(`span`,{className:`fieldError`,role:`alert`,children:i}):null]})]})}function We({downloads:e,error:t,currentTrackId:n,isPlaying:r,onClose:i,onPlay:a}){let s=e.filter(e=>e.status!==`completed`&&e.status!==`failed`).length;return w(`div`,{"aria-label":`Music downloads`,className:`headerPopover downloadsPopover`,id:`downloads-popover`,role:`dialog`,children:[w(`div`,{className:`popoverHeader`,children:[w(`div`,{children:[C(`span`,{className:`popoverEyebrow`,children:`OFFLINE MUSIC`}),C(`h2`,{children:`Downloads`})]}),w(`div`,{className:`downloadHeaderActions`,children:[s?w(`span`,{className:`activeDownloadCount`,children:[C(h,{"aria-hidden":`true`,className:`spin`,size:13}),s,` active`]}):null,C(I,{label:`Close downloads`,onClick:i,children:C(g,{size:18})})]})]}),t?w(`div`,{className:`popoverError`,role:`alert`,children:[C(o,{size:16}),C(`span`,{children:t})]}):null,C(`div`,{"aria-live":`polite`,className:`downloadList`,children:e.length?e.map(e=>{let t=e.track?Ae(e.track):null,i=e.status===`completed`&&!!t?.audioUrl&&!!e.track,s=t?.id===n,c=Ne(e),l=Me(e.bytesDownloaded),u=Me(e.totalBytes);return w(`article`,{className:`downloadRow ${e.status===`failed`?`downloadRowFailed`:``}`,children:[w(`button`,{"aria-label":i?`${s&&r?`Pause`:`Play`} ${t?.title}`:`Music is not ready to play`,className:`downloadArtworkButton ${i?`downloadArtworkPlayable`:``} ${s?`downloadArtworkActive`:``}`,disabled:!i,onClick:()=>e.track&&a(e.track),type:`button`,children:[C(M,{className:`downloadArtwork`,imageUrl:t?.imageUrl,palette:t?.palette??f.deepFocus,title:t?.title??`Preparing music`}),C(`span`,{className:`downloadPlayOverlay`,"aria-hidden":`true`,children:s&&r?C(m,{fill:`currentColor`,size:20}):i?C(b,{fill:`currentColor`,size:20}):e.status===`failed`?C(o,{size:18}):C(h,{className:`spin`,size:18})})]}),w(`div`,{className:`downloadCopy`,children:[w(`div`,{className:`downloadTitleRow`,children:[C(`strong`,{children:t?.title??Ie(e.sourceUrl)}),e.status===`completed`?C(A,{"aria-label":`Download complete`,className:`downloadCompleteIcon`,size:16}):null]}),C(`span`,{children:t?.artist??(e.status===`fetching`?`Reading song information`:Pe(e.status))}),w(`div`,{className:`downloadProgressMeta`,children:[C(`span`,{children:Pe(e.status)}),w(`span`,{children:[l,l&&u?` / ${u}`:``,!l&&e.status!==`failed`?`${c}%`:``]})]}),C(`span`,{"aria-label":`${c}% downloaded`,className:`downloadProgressTrack`,role:`progressbar`,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":c,children:C(`span`,{style:{width:`${c}%`}})}),e.error?C(`span`,{className:`downloadError`,children:e.error}):null]})]},e.id)}):w(`div`,{className:`emptyDownloads`,children:[C(`span`,{children:C(se,{size:23})}),C(`strong`,{children:`No downloads yet`}),C(`p`,{children:`Add a song or playlist from Sources and its progress will appear here.`})]})})]})}function Ge({initialProfiles:e=[],initialActiveProfile:i=null}){let[o,c]=k(`home`),[d,f]=k(ee[0].id),[p,h]=k(u[0].id),[v,y]=k(!1),[ae,x]=k(0),[S,ce]=k(74),[ue,de]=k(74),[fe,pe]=k(!1),[me,ge]=k(!1),[A,_e]=k(``),[ve,Se]=k(``),[j,Ce]=k(`all`),[we,Te]=k(!0),[N,Me]=k(()=>new Set([`neon-skyline`,`blue-hour`,`satellite-hearts`])),[Ne,Pe]=k([]),[Fe,Ie]=k([]),[Le,ze]=k([]),[Ve,He]=k(ke),[Ge,Je]=k([]),[Qe,$e]=k(``),[et,tt]=k(``),[L,R]=k(!1),[z,B]=k(!1),[nt,rt]=k(!1),[it,at]=k(!1),[ot,st]=k(!1),[ct,lt]=k(``),[ut,dt]=k(e),[V,ft]=k(i),[pt,mt]=k(!1),[ht,gt]=k(``),[_t,vt]=k(``),[yt,bt]=k(!1),[xt,St]=k(()=>new Set),[Ct,wt]=k(null),Tt=O(null),Et=O(null),Dt=O(null),Ot=O(null),kt=O(null),H=O(ae),At=O(null),jt=O(null),Mt=O(``),Nt=O(0),Pt=O(!1),U=O(i?.id??null),W=D(()=>{let e=new Set(Ne.map(e=>e.id));return[...Ne,...ee.filter(t=>!e.has(t.id))]},[Ne]),G=D(()=>{let e=new Set(Fe.map(e=>e.id));return[...Fe,...u.filter(t=>!e.has(t.id))]},[Fe]),K=W.find(e=>e.id===d)??ee[0],Ft=G.find(e=>e.id===p)??u[0],q=D(()=>{let e=Ft.trackIds.map(e=>W.find(t=>t.id===e)).filter(e=>!!e);return e.length?e:W},[W,Ft.trackIds]),It=D(()=>{let e=q.findIndex(e=>e.id===K.id);return e<0?q:[...q.slice(e+1),...q.slice(0,e)]},[K.id,q]),J=Ct?.trackId===K.id&&Ct.duration>0?Ct.duration:K.durationSec,Lt=Ge.filter(e=>e.status!==`completed`&&e.status!==`failed`).length,Y=T(e=>{lt(e),jt.current&&clearTimeout(jt.current),jt.current=setTimeout(()=>lt(``),2400)},[]),Rt=T(()=>{rt(!1),window.requestAnimationFrame(()=>Dt.current?.focus())},[]),zt=T(()=>{st(!1),at(!1),window.requestAnimationFrame(()=>Ot.current?.focus())},[]),X=T(e=>{let t=U.current;if(!t)return;let n=Date.now(),r=Oe(e);ze(t=>[{...e,playedAt:n},...t.filter(e=>Oe(e)!==r)].slice(0,10)),P(F(`/api/spotify/recently-played`,t),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({item:e,profileId:t})}).catch(()=>{})},[]),Bt=T(e=>{if(U.current===e)return;U.current=e;let t=Et.current;t&&(t.pause(),t.removeAttribute(`src`),delete t.dataset.trackId,t.load()),Mt.current=``,y(!1),mt(!1),at(!1),st(!1),x(0),H.current=0,wt(null),f(ee[0].id),h(u[0].id),Pe([]),Ie([]),ze([]),He(ke),Je([]),$e(``),tt(``),St(new Set),bt(!1),vt(``)},[]),Vt=T(async e=>{let t=Nt.current;try{let n=await P(`/api/netflix/profiles`,{signal:e});if(Pt.current||t!==Nt.current)return;let r=Array.isArray(n.profiles)?n.profiles:[],i=n.activeProfile&&r.some(e=>e.id===n.activeProfile?.id)?n.activeProfile:r[0]??null;Bt(i?.id??null),dt(r),ft(i)}catch{}},[Bt]),Ht=T(async e=>{Pt.current=!0,Nt.current+=1;try{let t=await P(`/api/netflix/profiles/${encodeURIComponent(e.id)}/select`,{method:`POST`});Nt.current+=1;let n=t.activeProfile??e;Bt(n.id),ft(n)}finally{Pt.current=!1}},[Bt]),Ut=T(async(e,t)=>{Nt.current+=1,Bt(t.id),dt(e),ft(t)},[Bt]),Wt=T(async e=>{let t=e??null;try{let n=await P(F(`/api/spotify/providers`,e));if(U.current!==t)return;He(n.providers.length?n.providers:ke),$e(``)}catch(e){if(U.current!==t)return;$e(e instanceof Error?e.message:`Could not load music sources.`)}},[]),Gt=T(async e=>{let t=e??null;try{let n=await P(F(`/api/spotify/downloads`,e));if(U.current!==t)return;Je([...n.downloads].sort((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime())),tt(``)}catch(e){if(U.current!==t)return;tt(e instanceof Error?e.message:`Could not load downloads.`)}},[]),Kt=T(async e=>{let t=e??null;try{let n=await P(F(`/api/spotify/tracks`,e));if(U.current!==t)return;Pe(n.tracks.map(Ae))}catch{}},[]),qt=T(async e=>{let t=e??null;try{let n=await P(F(`/api/spotify/playlists`,e));if(U.current!==t)return;Ie(n.playlists.map(je))}catch{}},[]),Jt=T(async e=>{let t=e??null;try{let n=await P(F(`/api/spotify/recently-played`,e));if(U.current!==t)return;ze(Array.isArray(n.items)?n.items.slice(0,10):[])}catch{}},[]);E(()=>{let e=V?.id,t=window.setTimeout(()=>{Wt(e),Gt(e),Kt(e),qt(e),Jt(e)},0),n=window.setInterval(()=>{Gt(e)},1600),r=window.setInterval(()=>{Kt(e),qt(e),Jt(e)},3e3),i=window.setInterval(()=>{Wt(e)},6e3);return()=>{window.clearTimeout(t),window.clearInterval(n),window.clearInterval(r),window.clearInterval(i)}},[V?.id,Gt,Wt,Jt,qt,Kt]),E(()=>{let t=new AbortController,n=()=>void Vt(t.signal),r=()=>{document.visibilityState===`visible`&&n()},a=window.setInterval(n,3e3);if(window.addEventListener(`focus`,n),document.addEventListener(`visibilitychange`,r),!e.length||!i){let e=window.requestAnimationFrame(n);return()=>{t.abort(),window.cancelAnimationFrame(e),window.clearInterval(a),window.removeEventListener(`focus`,n),document.removeEventListener(`visibilitychange`,r)}}return()=>{t.abort(),window.clearInterval(a),window.removeEventListener(`focus`,n),document.removeEventListener(`visibilitychange`,r)}},[i,e.length,Vt]);let Z=T((e,t)=>{let n=Et.current;if(!(!n||!e.audioUrl)){if((n.dataset.trackId!==e.id||n.getAttribute(`src`)!==e.audioUrl)&&(n.src=e.audioUrl,n.dataset.trackId=e.id,Mt.current=``,n.load()),!t){n.pause();return}n.play().catch(()=>{y(!1),Y(`This downloaded track could not be played.`)})}},[Y]),Yt=T((e,t=!0)=>{if(e.id===d&&t){let t=!v;y(t),t&&(mt(!0),X({kind:`track`,track:e})),Z(e,t);return}f(e.id),H.current=0,x(0),y(t),t&&(mt(!0),X({kind:`track`,track:e})),Z(e,t)},[d,v,X,Z]),Xt=T(e=>{let t=W.find(t=>t.id===e.trackIds[0]);if(!t){Y(`${e.title} has no playable songs yet`);return}let n=e.id===p,r=e.trackIds.includes(d),i=!(n&&r&&v);mt(!0),h(e.id),i&&X({kind:`playlist`,playlist:{id:e.id,title:e.title,description:e.description,curator:e.curator,trackCount:e.totalTracks??e.trackIds.length,imageUrl:e.imageUrl,palette:e.palette,provider:e.provider}}),n&&r?y(e=>!e):(f(t.id),H.current=0,x(0),y(!0))},[W,p,d,v,X,Y]),Q=T(()=>{q.length&&(f(e=>{let t=q.findIndex(t=>t.id===e),n=t>=0?(t+1)%q.length:0;if(fe&&q.length>1)do n=Math.floor(Math.random()*q.length);while(n===t);return q[n]?.id??e}),H.current=0,x(0))},[q,fe]),Zt=T(e=>{let t=Math.max(0,Math.min(e,J||e));H.current=t,x(t);let n=Et.current;K.audioUrl&&n?.dataset.trackId===K.id&&(n.currentTime=t)},[K.audioUrl,K.id,J]),Qt=T(()=>{if(H.current>4){Zt(0);return}q.length&&(f(e=>{let t=q.findIndex(t=>t.id===e),n=(Math.max(0,t)-1+q.length)%q.length;return q[n]?.id??e}),H.current=0,x(0))},[Zt,q]);E(()=>{if(!v||K.audioUrl)return;let e=window.setInterval(()=>{x(e=>{if(e+1>=K.durationSec)return H.current=K.durationSec,window.setTimeout(()=>{me?(H.current=0,x(0)):Q()},0),K.durationSec;let t=e+1;return H.current=t,t})},1e3);return()=>window.clearInterval(e)},[K.audioUrl,K.durationSec,Q,v,me]),E(()=>{let e=Et.current;e&&(e.volume=S/100)},[S]),E(()=>{let e=Et.current;if(e){if(!K.audioUrl){e.dataset.trackId&&(e.pause(),e.removeAttribute(`src`),delete e.dataset.trackId,e.load());return}(e.dataset.trackId!==K.id||e.getAttribute(`src`)!==K.audioUrl)&&(e.src=K.audioUrl,e.dataset.trackId=K.id,Mt.current=``,e.load()),v&&e.paused?e.play().catch(()=>{y(!1),Y(`This downloaded track could not be played.`)}):!v&&!e.paused&&e.pause()}},[K.audioUrl,K.id,v,Y]);let $t=T(()=>{let e=!v;y(e),e&&mt(!0),Z(K,e)},[K,v,Z]),en=T(e=>{y(!e),Z(K,!e)},[K,Z]),tn=T(e=>{ce(t=>e?(t>0&&de(t),0):t>0?t:ue||74)},[ue]),nn=T(e=>{let t=Math.max(0,Math.min(100,Math.round(e*100)));ce(t),t>0&&de(t)},[]),rn=T(e=>{let t=W.find(t=>t.id===e);t&&(f(t.id),H.current=0,x(0),y(!0),mt(!0),X({kind:`track`,track:t}),Z(t,!0))},[W,X,Z]),an=T(e=>{let t=G.find(t=>t.id===e);t&&Xt(t)},[G,Xt]);De({active:pt,profileId:V?.id??``,track:K,currentTime:ae,duration:J,isPlaying:v,volume:S,onSetPaused:en,onSeek:Zt,onSetMuted:tn,onSetVolume:nn,onPrevious:Qt,onNext:Q,onSelectTrack:rn,onSelectPlaylist:an});let on=T(e=>{switch(e.type){case`set-paused`:en(e.paused);break;case`seek-relative`:Zt(H.current+e.seconds);break;case`seek-to`:Zt(e.seconds);break;case`set-muted`:tn(e.muted);break;case`set-volume`:nn(e.volume);break;case`previous-track`:Qt();break;case`next-track`:Q();break;case`switch-track`:rn(e.trackId);break;case`switch-playlist`:an(e.playlistId);break;case`next-episode`:case`select-episode`:case`switch-title`:case`set-captions`:case`set-subtitle-font-size`:case`set-subtitle-font-color`:case`set-subtitle-background`:case`reset-subtitle-position`:break}},[Q,Qt,Zt,an,rn,tn,en,nn]);E(()=>{let e=e=>{let t=e.target,n=t?.tagName===`INPUT`||t?.tagName===`TEXTAREA`||t?.isContentEditable;if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`)e.preventDefault(),c(`search`),window.requestAnimationFrame(()=>Tt.current?.focus());else if(e.key===`Escape`){if(it){zt();return}let e=L||z||nt;R(!1),B(!1),nt?Rt():rt(!1),!e&&A&&_e(``)}else e.code===`Space`&&!n&&(e.preventDefault(),$t())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[Rt,zt,z,it,A,nt,L,$t]),E(()=>{if(!it)return;let e=window.requestAnimationFrame(()=>kt.current?.focus());return()=>window.cancelAnimationFrame(e)},[it]),E(()=>{if(!L&&!z)return;let e=e=>{e.target instanceof Node&&!At.current?.contains(e.target)&&(R(!1),B(!1))};return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[z,L]),E(()=>()=>{jt.current&&clearTimeout(jt.current)},[]);let sn=D(()=>{let e=Fe.map(e=>{let t=e.totalTracks??e.trackIds.length,n=e.availableTracks??e.trackIds.length;return{id:`library-${e.id}`,title:e.title,subtitle:n>=t?`Playlist · ${t} ${t===1?`song`:`songs`}`:`Playlist · ${n} of ${t} ready`,kind:`playlist`,palette:e.palette,imageUrl:e.imageUrl,playlistId:e.id}});return[s[0],...e,...s.slice(1)]},[Fe]),cn=D(()=>{let e=ve.trim().toLowerCase(),t=sn.filter(t=>{let n=j===`all`||t.kind===j||j===`playlist`&&t.kind===`collection`,r=!e||`${t.title} ${t.subtitle}`.toLowerCase().includes(e);return n&&r});return we?t:[...t].reverse()},[sn,j,we,ve]),ln=A.trim().toLowerCase(),un=D(()=>ln?W.filter(e=>`${e.title} ${e.artist} ${e.album}`.toLowerCase().includes(ln)):[],[W,ln]),dn=D(()=>ln?G.filter(e=>`${e.title} ${e.description}`.toLowerCase().includes(ln)):[],[G,ln]),fn=D(()=>Le.map(e=>{if(e.kind===`track`){let t=W.find(t=>t.id===e.track.id);return t?{kind:`track`,track:t}:null}let t=G.find(t=>t.id===e.playlist.id);return t?{kind:`playlist`,playlist:t}:null}).filter(e=>e!==null).slice(0,10),[G,W,Le]),pn=e=>{Me(t=>{let n=new Set(t),r=W.find(t=>t.id===e);return n.has(e)?(n.delete(e),Y(`Removed ${r?.title??`track`} from Liked Songs`)):(n.add(e),Y(`Added ${r?.title??`track`} to Liked Songs`)),n})},mn=e=>{if(e.playlistId){let t=G.find(t=>t.id===e.playlistId);if(t){Xt(t),Y(`Playing ${t.title}`);return}}if(e.id===`liked-songs`){Yt(W.find(e=>N.has(e.id))??ee[0]),Y(`Playing Liked Songs`);return}let t=W.find(t=>`${t.artist} ${t.album}`.includes(e.title));t&&(Yt(t),Y(`Playing ${e.title}`))},hn=async e=>{let t=V?.id??null;St(t=>new Set(t).add(e.id)),He(t=>t.map(t=>t.id===e.id?{...t,syncStatus:`syncing`,error:null}:t));try{let n=await P(F(`/api/spotify/providers/${encodeURIComponent(e.id)}/sync`,t),{method:`POST`});if(U.current!==t)return;He(t=>t.map(t=>t.id===e.id?n.provider:t)),$e(``),Y(`${e.name} is synced`),Kt(t)}catch(n){if(U.current!==t)return;let r=n instanceof Error?n.message:`Could not sync ${e.name}.`;He(t=>t.map(t=>t.id===e.id?{...t,syncStatus:`failed`,error:r}:t)),Y(`Could not sync ${e.name}`)}finally{U.current===t&&St(t=>{let n=new Set(t);return n.delete(e.id),n})}},gn=async e=>{e.preventDefault();let t=V?.id??null,n=ht.trim();vt(``);try{let e=new URL(n);if(e.protocol!==`https:`&&e.protocol!==`http:`)throw Error(`Enter a valid http or https music link.`)}catch{vt(`Enter a valid music link.`);return}bt(!0);try{let e=await P(`/api/spotify/music`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({url:n,profileId:t})});if(U.current!==t)return;if(e.download){let t=e.download;Je(e=>[t,...e.filter(e=>e.id!==t.id)])}if(e.playlist){let t=je(e.playlist);Ie(e=>[t,...e.filter(e=>e.id!==t.id)])}if(!e.download&&!e.playlist)throw Error(`The server did not create a download or playlist.`);gt(``),R(!1),B(!0),Y(e.playlist?`${e.playlist.title} added to Your Library`:`Music added to downloads`),Gt(t),qt(t),Kt(t)}catch(e){if(U.current!==t)return;vt(e instanceof Error?e.message:`Could not add this music link.`)}finally{U.current===t&&bt(!1)}},_n=e=>{let t=Ae(e);Pe(e=>[t,...e.filter(e=>e.id!==t.id)]),Yt(t)},$=e=>{c(e),R(!1),B(!1),e===`search`&&window.requestAnimationFrame(()=>Tt.current?.focus())},vn=J>0?Math.min(100,ae/J*100):0,yn={"--range-progress":`${vn}%`},bn={"--range-progress":`${S}%`},xn={service:`spotify`,sessionId:`mobile-now-playing`,profileId:V?.id??`local-profile`,titleId:K.id,title:K.title,artist:K.artist,album:K.album,provider:K.provider??`Spotify Atom`,artwork:Ee(K),currentTime:ae,duration:J,paused:!v,muted:S<=0,volume:S/100,deviceType:`phone`,updatedAt:0};return w(`div`,{className:`spotifyApp`,children:[w(`aside`,{className:`sidebar`,children:[w(`div`,{className:`sidebarTop`,children:[w(`button`,{className:`brand`,onClick:()=>$(`home`),type:`button`,children:[C(Re,{}),C(`span`,{children:`Spotify`})]}),w(`div`,{className:`sidebarPrimaryNav`,children:[w(`button`,{className:o===`home`?`sidebarNavActive`:``,onClick:()=>$(`home`),type:`button`,children:[C(n,{fill:o===`home`?`currentColor`:`none`,size:24}),`Home`]}),w(`button`,{className:o===`search`?`sidebarNavActive`:``,onClick:()=>$(`search`),type:`button`,children:[C(_,{size:24}),`Search`]})]})]}),w(`section`,{className:`libraryPanel`,children:[w(`div`,{className:`libraryHeader`,children:[w(`button`,{onClick:()=>$(`library`),type:`button`,children:[C(ye,{size:23}),C(`span`,{children:`Your Library`})]}),w(`div`,{children:[C(I,{label:`Create playlist or folder`,onClick:()=>Y(`Your new playlist is ready to name`),children:C(oe,{size:20})}),C(I,{label:`Expand your library`,onClick:()=>$(`library`),children:C(ne,{size:20})})]})]}),C(`div`,{className:`filterChips`,"aria-label":`Library filters`,children:[`all`,`playlist`,`artist`,`album`].map(e=>C(`button`,{className:j===e?`chipActive`:``,onClick:()=>Ce(e),type:`button`,children:e===`all`?`All`:e===`playlist`?`Playlists`:`${e[0].toUpperCase()}${e.slice(1)}s`},e))}),w(`div`,{className:`libraryTools`,children:[w(`label`,{children:[C(_,{"aria-hidden":`true`,size:17}),C(`input`,{"aria-label":`Search in Your Library`,onChange:e=>Se(e.target.value),placeholder:`Search in Your Library`,value:ve}),ve?C(`button`,{"aria-label":`Clear library search`,onClick:()=>Se(``),type:`button`,children:C(g,{size:15})}):null]}),w(`button`,{className:`recentsButton`,onClick:()=>Te(e=>!e),type:`button`,children:[we?`Recents`:`Oldest`,C(be,{size:17})]})]}),w(`div`,{className:`libraryList`,children:[cn.map(e=>C(Be,{active:!!(e.playlistId&&e.playlistId===p),item:e,onSelect:()=>mn(e)},e.id)),cn.length?null:w(`div`,{className:`emptyLibrary`,children:[C(_,{size:24}),C(`strong`,{children:`No matches found`}),C(`span`,{children:`Try another search or filter.`})]})]})]})]}),w(`main`,{className:`mainPanel`,children:[w(`header`,{className:`topBar`,children:[w(`div`,{className:`historyButtons`,children:[C(I,{label:`Go back`,onClick:()=>$(`home`),children:C(t,{size:25})}),C(I,{label:`Go forward`,children:C(ie,{size:25})})]}),w(`div`,{className:`globalSearch ${o===`search`?`searchEmphasis`:``}`,children:[C(_,{"aria-hidden":`true`,size:21}),C(`input`,{onChange:e=>{_e(e.target.value),e.target.value&&c(`search`)},onFocus:()=>c(`search`),placeholder:`What do you want to play?`,ref:Tt,value:A}),A?C(`button`,{"aria-label":`Clear search`,className:`clearSearch`,onClick:()=>_e(``),type:`button`,children:C(g,{size:18})}):C(`kbd`,{children:`⌘ K`})]}),w(`div`,{className:`topActions`,ref:At,children:[C(`button`,{className:`explorePremium`,onClick:()=>Y(`Premium looks good on you`),type:`button`,children:`Explore Premium`}),w(`button`,{className:`installButton`,onClick:()=>Y(`Spotify is ready in your browser`),type:`button`,children:[C(se,{size:16}),`Install App`]}),w(`div`,{className:`headerPopoverWrap`,children:[C(I,{className:`sourceActionButton`,controls:`source-popover`,expanded:L,hasPopup:`dialog`,label:`Music sources`,onClick:()=>{let e=!L;R(e),B(!1),rt(!1),e&&Wt(V?.id)},children:C(le,{size:19})}),L?C(Ue,{addMusicError:_t,addingMusic:yt,musicUrl:ht,onAddMusic:gn,onClose:()=>R(!1),onMusicUrlChange:e=>{gt(e),_t&&vt(``)},onSync:e=>{hn(e)},providerError:Qe,providers:Ve,syncingProviderIds:xt}):null]}),w(`div`,{className:`headerPopoverWrap`,children:[w(I,{className:`downloadsActionButton`,controls:`downloads-popover`,expanded:z,hasPopup:`dialog`,label:Lt?`Downloads, ${Lt} active`:`Downloads`,onClick:()=>{let e=!z;B(e),R(!1),rt(!1),e&&(Gt(V?.id),Kt(V?.id))},children:[C(se,{size:19}),Lt?C(`span`,{className:`downloadActionBadge`,"aria-hidden":`true`,children:Lt>9?`9+`:Lt}):null]}),z?C(We,{currentTrackId:d,downloads:Ge,error:et,isPlaying:v,onClose:()=>B(!1),onPlay:_n}):null]}),C(I,{label:`What’s New`,onClick:()=>{R(!1),B(!1)},children:C(he,{size:19})}),V?C(`div`,{className:`sharedProfileAction`,onFocus:()=>{R(!1),B(!1)},onPointerDown:()=>{R(!1),B(!1)},children:C(te,{profiles:ut,activeProfile:V,onSelectProfile:Ht,onProfilesChanged:Ut})}):null]})]}),w(`div`,{className:`mainScroll`,children:[o===`home`?C(Ke,{currentPlaylistId:p,isPlaying:v,onPlayPlaylist:Xt,onShowSearch:()=>$(`search`)}):null,o===`search`?C(qe,{currentPlaylistId:p,currentTrackId:d,isPlaying:v,likedTracks:N,matchingPlaylists:dn,matchingTracks:un,normalizedQuery:ln,onLike:pn,onPlayPlaylist:Xt,onSelectTrack:Yt,query:A,recentItems:fn,setQuery:_e}):null,o===`library`?C(Ye,{availableTracks:W,currentPlaylistId:p,currentTrackId:d,filteredLibrary:cn,isPlaying:v,likedTracks:N,onOpenItem:mn,onSelectTrack:Yt}):null,w(`footer`,{className:`contentFooter`,children:[w(`div`,{children:[C(`strong`,{children:`Spotify Atom`}),C(`span`,{children:`A Next.js listening experience.`})]}),C(`span`,{children:`Fictional artists and demo content`})]})]}),nt?C(Xe,{currentTrack:K,onClose:Rt,onSelectTrack:Yt,playlistTitle:Ft.title,tracks:It}):null]}),C(`audio`,{"aria-hidden":`true`,className:`audioEngine`,onEnded:e=>{me?(e.currentTarget.currentTime=0,e.currentTarget.play().catch(()=>{y(!1),Y(`This downloaded track could not be replayed.`)})):Q()},onError:e=>{let t=e.currentTarget.dataset.trackId;t&&t===K.id&&Mt.current!==t&&(Mt.current=t,y(!1),Y(`The downloaded audio file is unavailable.`))},onLoadedMetadata:e=>{let t=e.currentTarget.duration;Number.isFinite(t)&&t>0&&wt({trackId:e.currentTarget.dataset.trackId??K.id,duration:t})},onTimeUpdate:e=>{if(e.currentTarget.dataset.trackId===K.id){let t=e.currentTarget.currentTime;H.current=t,x(t)}},preload:`metadata`,ref:Et}),C(Ze,{currentTrack:K,duration:J,elapsed:ae,isPlaying:v,liked:N.has(K.id),onLike:()=>pn(K.id),onNext:Q,onPrevious:Qt,onSeek:Zt,onTogglePlay:$t,onToggleQueue:()=>{rt(e=>!e),R(!1),B(!1)},onVolumeChange:e=>{ce(e),e>0&&de(e)},progressStyle:yn,queueButtonRef:Dt,queueOpen:nt,repeat:me,setRepeat:ge,setShuffle:pe,shuffle:fe,showToast:Y,volume:S,volumeStyle:bn,toggleMute:()=>{S>0?(de(S),ce(0)):ce(ue||74)}}),w(`div`,{className:`mobilePlayer`,children:[C(`span`,{className:`mobilePlayerProgress`,style:{width:`${vn}%`}}),C(M,{className:`mobilePlayerArt`,imageUrl:K.imageUrl,palette:K.palette,title:K.title}),w(`button`,{className:`mobilePlayerCopy`,onClick:()=>Y(`${K.title} · ${K.artist}`),type:`button`,children:[C(`strong`,{children:K.title}),C(`span`,{children:K.artist})]}),C(I,{label:`${N.has(K.id)?`Remove from`:`Add to`} Liked Songs`,onClick:()=>pn(K.id),pressed:N.has(K.id),children:C(r,{fill:N.has(K.id)?`currentColor`:`none`,size:21})}),C(I,{className:`mobilePlayToggle`,label:v?`Pause`:`Play`,onClick:$t,children:C(v?m:b,{fill:`currentColor`,size:25})}),C(I,{buttonRef:Ot,className:`mobileExpandToggle`,controls:`mobile-expanded-player`,expanded:it,hasPopup:`dialog`,label:`Expand player`,onClick:()=>{at(!0),R(!1),B(!1)},children:C(xe,{size:21})})]}),it?C(`div`,{className:`mobileExpandedPlayerBackdrop`,onClick:zt,children:w(`section`,{"aria-label":`Now playing ${K.title}`,"aria-modal":`true`,className:`mobileExpandedPlayer`,id:`mobile-expanded-player`,onClick:e=>e.stopPropagation(),role:`dialog`,children:[w(`header`,{className:`mobileExpandedPlayerHeader`,children:[w(`div`,{children:[C(`span`,{children:`Spotify activity`}),C(`h2`,{children:`Now playing`})]}),C(I,{autoFocus:!0,buttonRef:kt,label:`Close expanded player`,onClick:zt,children:C(g,{size:20})})]}),C(a,{activity:xn,onCommand:on,onSearchToggle:()=>st(e=>!e),searchOpen:ot,tabLabel:`This device`})]})}):null,ot?C(l,{activity:xn,onClose:()=>st(!1),onSelectPlaylist:async e=>{an(e.id)},onSelectTrack:async e=>{rn(e.id)}}):null,w(`nav`,{className:`mobileNav`,"aria-label":`Main navigation`,children:[w(`button`,{className:o===`home`?`mobileNavActive`:``,onClick:()=>$(`home`),type:`button`,children:[C(n,{fill:o===`home`?`currentColor`:`none`,size:24}),C(`span`,{children:`Home`})]}),w(`button`,{className:o===`search`?`mobileNavActive`:``,onClick:()=>$(`search`),type:`button`,children:[C(_,{size:24}),C(`span`,{children:`Search`})]}),w(`button`,{className:o===`library`?`mobileNavActive`:``,onClick:()=>$(`library`),type:`button`,children:[C(ye,{size:24}),C(`span`,{children:`Your Library`})]})]}),w(`div`,{"aria-atomic":`true`,"aria-live":`polite`,className:`toast ${ct?`toastVisible`:``}`,children:[C(re,{size:18}),ct]})]})}function Ke({currentPlaylistId:e,isPlaying:t,onPlayPlaylist:n,onShowSearch:r}){let a=u.find(e=>e.id===`discover-weekly`)??u[0],o=u.slice(4,10);return w(`div`,{className:`homeView`,children:[w(`section`,{className:`hero`,children:[C(`div`,{className:`heroGlow`}),w(`div`,{className:`heroCopy`,children:[w(`span`,{className:`heroEyebrow`,children:[C(d,{size:15}),`MADE FOR YOU`]}),C(`h1`,{children:`Soundtrack your every move.`}),C(`p`,{children:`New discoveries, old favorites, and the right music for right now.`}),w(`div`,{className:`heroActions`,children:[w(`button`,{className:`primaryButton`,onClick:()=>n(a),type:`button`,children:[e===a.id&&t?C(m,{fill:`currentColor`,size:19}):C(b,{fill:`currentColor`,size:19}),e===a.id&&t?`Pause your mix`:`Play your mix`]}),w(`button`,{className:`secondaryButton`,onClick:r,type:`button`,children:[C(ve,{size:19}),`Explore music`]})]})]}),w(`div`,{className:`heroArt`,"aria-hidden":`true`,children:[C(M,{className:`heroCover heroCoverBack`,palette:u[1].palette,title:u[1].title}),C(M,{className:`heroCover heroCoverMiddle`,palette:u[3].palette,title:u[3].title}),C(M,{className:`heroCover heroCoverFront`,palette:u[0].palette,title:u[0].title})]})]}),w(`section`,{className:`quickSection`,children:[C(`div`,{className:`sectionTitleRow compactTitleRow`,children:w(`div`,{children:[C(`span`,{className:`sectionEyebrow`,children:`PICK UP WHERE YOU LEFT OFF`}),C(`h2`,{children:`Good evening`})]})}),C(`div`,{className:`quickGrid`,children:o.map(r=>{let i=r.id===e;return w(`button`,{className:`quickTile ${i?`quickTileActive`:``}`,onClick:()=>n(r),type:`button`,children:[C(M,{className:`quickTileArt`,palette:r.palette,title:r.title}),C(`strong`,{children:r.title}),C(`span`,{className:`quickTilePlay`,"aria-hidden":`true`,children:C(i&&t?m:b,{fill:`currentColor`,size:19})})]},r.id)})})]}),i.map(r=>{let i=r.playlistIds.map(e=>u.find(t=>t.id===e)).filter(e=>!!e);return w(`section`,{className:`shelfSection`,children:[w(`div`,{className:`sectionTitleRow`,children:[w(`div`,{children:[C(`h2`,{children:r.title}),r.description?C(`p`,{children:r.description}):null]}),C(`button`,{type:`button`,children:`Show all`})]}),C(`div`,{className:`playlistGrid`,children:i.map(r=>C(Ve,{active:r.id===e,onPlay:()=>n(r),playing:t,playlist:r},r.id))})]},r.id)})]})}function qe({currentPlaylistId:e,currentTrackId:t,isPlaying:n,likedTracks:r,matchingPlaylists:i,matchingTracks:a,normalizedQuery:o,onLike:s,onPlayPlaylist:c,onSelectTrack:l,query:u,recentItems:d,setQuery:f}){return w(`div`,{className:`searchView`,children:[w(`div`,{className:`pageHeading`,children:[C(`span`,{className:`sectionEyebrow`,children:`FIND YOUR NEXT FAVORITE`}),C(`h1`,{children:`Search`}),C(`p`,{children:`Artists, songs, albums, playlists, and everything in between.`})]}),w(`label`,{className:`mobileSearchInput`,children:[C(_,{size:21}),C(`input`,{onChange:e=>f(e.target.value),placeholder:`What do you want to play?`,value:u}),u?C(`button`,{"aria-label":`Clear search`,onClick:()=>f(``),type:`button`,children:C(g,{size:19})}):null]}),o?C(`div`,{className:`searchResults`,children:a.length||i.length?w(ge,{children:[w(`section`,{className:`topResultSection`,children:[C(`div`,{className:`sectionTitleRow`,children:C(`h2`,{children:`Top result`})}),w(`div`,{className:`topResultLayout`,children:[a[0]?w(`button`,{className:`topResultCard`,onClick:()=>l(a[0]),type:`button`,children:[C(M,{className:`topResultArt`,imageUrl:a[0].imageUrl,palette:a[0].palette,title:a[0].title}),C(`strong`,{children:a[0].title}),w(`span`,{children:[`Song · `,C(`b`,{children:a[0].artist})]}),C(`span`,{className:`topResultPlay`,children:t===a[0].id&&n?C(m,{fill:`currentColor`,size:26}):C(b,{fill:`currentColor`,size:26})})]}):i[0]?w(`button`,{className:`topResultCard`,onClick:()=>c(i[0]),type:`button`,children:[C(M,{className:`topResultArt`,imageUrl:i[0].imageUrl,palette:i[0].palette,title:i[0].title}),C(`strong`,{children:i[0].title}),w(`span`,{children:[`Playlist · `,i[0].curator]}),C(`span`,{className:`topResultPlay`,children:C(b,{fill:`currentColor`,size:26})})]}):null,w(`div`,{className:`songResults`,children:[C(`div`,{className:`sectionTitleRow`,children:C(`h2`,{children:`Songs`})}),a.slice(0,4).map(e=>C(He,{active:e.id===t,liked:r.has(e.id),onLike:()=>s(e.id),onSelect:()=>l(e),playing:n,track:e},e.id))]})]})]}),i.length?w(`section`,{className:`shelfSection searchPlaylistSection`,children:[C(`div`,{className:`sectionTitleRow`,children:C(`h2`,{children:`Playlists`})}),C(`div`,{className:`playlistGrid`,children:i.slice(0,5).map(e=>C(Ve,{active:!1,onPlay:()=>c(e),playing:n,playlist:e},e.id))})]}):null]}):w(`div`,{className:`noResults`,children:[C(`span`,{children:C(_,{size:28})}),w(`h2`,{children:[`No results found for “`,u,`”`]}),C(`p`,{children:`Check the spelling or try fewer words.`})]})}):w(`section`,{"aria-labelledby":`search-recent-heading`,className:`searchRecentSection`,children:[C(`div`,{className:`sectionTitleRow`,children:w(`div`,{children:[C(`h2`,{id:`search-recent-heading`,children:`Recently played`}),C(`p`,{children:`Your latest songs and playlists.`})]})}),d.length?C(`div`,{className:`recentSearchGrid`,children:d.map(r=>C(Je,{active:r.kind===`track`?r.track.id===t:r.playlist.id===e,item:r,onPlay:()=>{r.kind===`track`?l(r.track):c(r.playlist)},playing:n},r.kind===`track`?`track:${r.track.id}`:`playlist:${r.playlist.id}`))}):w(`div`,{className:`searchRecentEmpty`,role:`status`,children:[C(_e,{"aria-hidden":`true`,size:27}),w(`div`,{children:[C(`strong`,{children:`Nothing played yet`}),C(`p`,{children:`Play a song or playlist and it will appear here.`})]})]})]})]})}function Je({active:e,item:t,onPlay:n,playing:r}){let i=t.kind===`track`?t.track:t.playlist,a=e&&r;return w(`button`,{"aria-label":`${a?`Pause`:`Play`} ${i.title}`,className:`recentSearchCard ${e?`recentSearchCardActive`:``}`,onClick:n,type:`button`,children:[w(`span`,{className:`recentSearchArt`,children:[C(M,{imageUrl:i.imageUrl,palette:i.palette,title:i.title}),C(`span`,{className:`recentSearchPlay`,"aria-hidden":`true`,children:C(a?m:b,{fill:`currentColor`,size:20})})]}),w(`span`,{className:`recentSearchCopy`,children:[C(`strong`,{children:i.title}),C(`span`,{children:t.kind===`track`?`Song · ${t.track.artist}`:`Playlist · ${t.playlist.curator}`})]})]})}function Ye({availableTracks:e,currentPlaylistId:t,currentTrackId:n,filteredLibrary:i,isPlaying:a,likedTracks:o,onOpenItem:s,onSelectTrack:c}){let l=e.filter(e=>o.has(e.id));return w(`div`,{className:`fullLibraryView`,children:[w(`div`,{className:`pageHeading libraryPageHeading`,children:[C(`span`,{className:`sectionEyebrow`,children:`SAVED FOR LATER`}),C(`h1`,{children:`Your Library`}),C(`p`,{children:`Playlists, artists, albums, and the songs you never skip.`})]}),w(`section`,{className:`libraryCollectionGrid`,children:[w(`button`,{className:`likedCollection`,onClick:()=>l[0]&&c(l[0]),type:`button`,children:[C(`span`,{className:`likedTrackNames`,children:l.slice(0,3).map(e=>w(`span`,{children:[C(`b`,{children:e.title}),` `,w(`span`,{children:[`· `,e.artist]})]},e.id))}),C(`strong`,{children:`Liked Songs`}),w(`span`,{children:[l.length,` songs`]}),C(`span`,{className:`likedCollectionPlay`,children:l.some(e=>e.id===n)&&a?C(m,{fill:`currentColor`,size:24}):C(b,{fill:`currentColor`,size:24})})]}),i.filter(e=>e.id!==`liked-songs`).slice(0,5).map(e=>w(`button`,{className:`libraryCollectionCard ${e.playlistId===t?`libraryCollectionActive`:``}`,onClick:()=>s(e),type:`button`,children:[C(M,{className:`libraryCollectionArt`,imageUrl:e.imageUrl,palette:e.palette,rounded:e.kind===`artist`,title:e.title}),C(`strong`,{children:e.title}),C(`span`,{children:e.subtitle})]},e.id))]}),w(`section`,{className:`shelfSection likedTracksSection`,children:[w(`div`,{className:`sectionTitleRow`,children:[w(`div`,{children:[C(`h2`,{children:`Your liked songs`}),C(`p`,{children:`The tracks at the heart of your library.`})]}),C(_e,{size:20})]}),C(`div`,{className:`likedTracksTable`,children:l.map((e,t)=>w(`button`,{className:e.id===n?`likedTrackActive`:``,onClick:()=>c(e),type:`button`,children:[C(`span`,{className:`likedTrackNumber`,children:e.id===n&&a?w(`span`,{className:`miniEqualizer`,children:[C(`i`,{}),C(`i`,{}),C(`i`,{})]}):t+1}),C(M,{className:`likedTrackArt`,imageUrl:e.imageUrl,palette:e.palette,title:e.title}),w(`span`,{className:`likedTrackCopy`,children:[C(`strong`,{children:e.title}),C(`span`,{children:e.artist})]}),C(`span`,{className:`likedTrackAlbum`,children:e.album}),C(r,{"aria-hidden":`true`,fill:`currentColor`,size:17}),C(`span`,{children:Le(e.durationSec)})]},e.id))})]})]})}function Xe({currentTrack:e,onClose:t,onSelectTrack:n,playlistTitle:r,tracks:i}){return w(`aside`,{"aria-labelledby":`queue-heading`,className:`queuePanel`,id:`queue-panel`,role:`dialog`,children:[w(`header`,{className:`queueHeader`,children:[C(`h2`,{id:`queue-heading`,children:`Queue`}),C(I,{autoFocus:!0,label:`Close queue`,onClick:t,children:C(g,{size:20})})]}),w(`div`,{className:`queueScroll`,children:[w(`section`,{"aria-labelledby":`queue-now-playing`,children:[C(`h3`,{id:`queue-now-playing`,children:`Now playing`}),w(`div`,{className:`queueTrack queueTrackCurrent`,children:[C(M,{className:`queueTrackArt`,imageUrl:e.imageUrl,palette:e.palette,title:e.title}),w(`span`,{className:`queueTrackCopy`,children:[C(`strong`,{children:e.title}),C(`span`,{children:e.artist})]})]})]}),w(`section`,{className:`queueNext`,"aria-labelledby":`queue-next-heading`,children:[w(`h3`,{id:`queue-next-heading`,children:[`Next from: `,r]}),i.length?C(`div`,{className:`queueTrackList`,children:i.map(e=>w(`button`,{className:`queueTrack`,onClick:()=>n(e),type:`button`,children:[C(M,{className:`queueTrackArt`,imageUrl:e.imageUrl,palette:e.palette,title:e.title}),w(`span`,{className:`queueTrackCopy`,children:[C(`strong`,{children:e.title}),C(`span`,{children:e.artist})]})]},e.id))}):C(`p`,{className:`queueEmpty`,children:`There are no more songs in this queue.`})]})]})]})}function Ze({currentTrack:e,duration:t,elapsed:n,isPlaying:i,liked:a,onLike:o,onNext:s,onPrevious:l,onSeek:u,onTogglePlay:d,onToggleQueue:f,onVolumeChange:ee,progressStyle:p,queueButtonRef:te,queueOpen:ne,repeat:m,setRepeat:h,setShuffle:g,shuffle:_,showToast:re,toggleMute:ie,volume:b,volumeStyle:oe}){return w(`footer`,{className:`desktopPlayer`,children:[w(`div`,{className:`playerTrack`,children:[C(M,{className:`playerCover`,imageUrl:e.imageUrl,palette:e.palette,title:e.title}),w(`div`,{className:`playerTrackCopy`,children:[C(`strong`,{children:e.title}),C(`span`,{children:e.artist})]}),C(I,{label:`${a?`Remove from`:`Add to`} Liked Songs`,onClick:o,pressed:a,children:C(r,{fill:a?`currentColor`:`none`,size:19})}),C(I,{label:`Open Now Playing view`,onClick:()=>re(`Now Playing view is already in focus`),children:C(xe,{size:17})})]}),w(`div`,{className:`playerCenter`,children:[w(`div`,{className:`transportControls`,children:[C(I,{label:`Turn shuffle ${_?`off`:`on`}`,onClick:()=>g(!_),pressed:_,children:C(we,{size:18})}),C(I,{label:`Previous`,onClick:l,children:C(c,{fill:`currentColor`,size:19})}),C(ze,{label:i?`Pause`:`Play`,onClick:d,playing:i,size:`small`}),C(I,{label:`Next`,onClick:s,children:C(v,{fill:`currentColor`,size:19})}),C(I,{label:`Turn repeat ${m?`off`:`on`}`,onClick:()=>h(!m),pressed:m,children:C(Ce,{size:18})})]}),w(`div`,{className:`progressRow`,children:[C(`span`,{children:Le(n)}),C(`input`,{"aria-label":`Seek playback position`,className:`range`,max:t,min:0,onChange:e=>u(Number(e.target.value)),onKeyDown:e=>{e.key===`Home`?u(0):e.key===`End`&&u(t)},style:p,type:`range`,value:Math.min(n,t)}),C(`span`,{children:Le(t)})]})]}),w(`div`,{className:`playerTools`,children:[C(I,{label:`Now Playing view`,children:C(be,{size:18})}),C(I,{className:`playerQueueButton`,controls:`queue-panel`,expanded:ne,hasPopup:`dialog`,label:`Queue`,onClick:f,pressed:ne,buttonRef:te,children:C(be,{size:18})}),C(I,{label:`Connect to a device`,onClick:()=>re(`Listening on this web browser`),children:C(Se,{size:18})}),C(I,{label:b===0?`Unmute`:`Mute`,onClick:ie,children:C(b===0?y:ae,{size:20})}),C(`input`,{"aria-label":`Volume`,className:`range volumeRange`,max:100,min:0,onChange:e=>ee(Number(e.target.value)),style:oe,type:`range`,value:b}),C(I,{label:`Full screen`,children:C(xe,{size:17})})]})]})}export{Ge as SpotifyApp};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./navigation-BCDRWdBm.js";import{n as t,t as n}from"./chevron-left-CkBJG8E2.js";import{a as r,c as i,i as a,l as o,n as s,o as c,r as l,s as u,t as d}from"./minimize-C9JLgte-.js";import{_ as f,c as p,d as m,f as h,g,h as _,m as v,n as y,p as b,t as x,u as S,v as ee}from"./pin-BQre-tQY.js";import{a as te,c as C,d as w,f as T,h as E,i as D,m as O,n as ne,p as k,r as A,t as re,u as j}from"./refresh-cw-CWdWHjqY.js";import{Fragment as M,jsx as N,jsxs as P}from"react/jsx-runtime";import{useCallback as F,useEffect as I,useMemo as ie,useRef as L,useState as R}from"react";import{createPortal as ae}from"react-dom";var oe=t(`book-open`,[[`path`,{d:`M12 5v16`,key:`1f6ucr`}],[`path`,{d:`M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z`,key:`1fyvmf`}]]),se=t(`brain-circuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),ce=t(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),z=t(`camera`,[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),B=t(`car-front`,[[`path`,{d:`m21 8-2 2-1.5-3.7A2 2 0 0 0 15.646 5H8.4a2 2 0 0 0-1.903 1.257L5 10 3 8`,key:`1imjwt`}],[`path`,{d:`M7 14h.01`,key:`1qa3f1`}],[`path`,{d:`M17 14h.01`,key:`7oqj8z`}],[`rect`,{width:`18`,height:`8`,x:`3`,y:`10`,rx:`2`,key:`a7itu8`}],[`path`,{d:`M5 18v2`,key:`ppbyun`}],[`path`,{d:`M19 18v2`,key:`gy7782`}]]),le=t(`cloud-sun`,[[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}],[`path`,{d:`M15.947 12.65a4 4 0 0 0-5.925-4.128`,key:`dpwdj0`}],[`path`,{d:`M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z`,key:`s09mg5`}]]),ue=t(`earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),de=t(`headphones`,[[`path`,{d:`M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3`,key:`1xhozi`}]]),V=t(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),fe=t(`leaf`,[[`path`,{d:`M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z`,key:`nnexq3`}],[`path`,{d:`M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12`,key:`mt58a7`}]]),H=t(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),pe=t(`music-2`,[[`circle`,{cx:`8`,cy:`18`,r:`4`,key:`1fc0mg`}],[`path`,{d:`M12 18V2l7 4`,key:`g04rme`}]]),me=t(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),he=t(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ge=t(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]),_e=t(`tv`,[[`path`,{d:`m17 2-5 5-5-5`,key:`16satq`}],[`rect`,{width:`20`,height:`15`,x:`2`,y:`7`,rx:`2`,key:`1e6viu`}]]),ve=t(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),ye=t(`watch`,[[`path`,{d:`M12 10v2.2l1.6 1`,key:`n3r21l`}],[`path`,{d:`m16.13 7.66-.81-4.05a2 2 0 0 0-2-1.61h-2.68a2 2 0 0 0-2 1.61l-.78 4.05`,key:`18k57s`}],[`path`,{d:`m7.88 16.36.8 4a2 2 0 0 0 2 1.61h2.72a2 2 0 0 0 2-1.61l.81-4.05`,key:`16ny36`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}]]),be=t(`zap`,[[`path`,{d:`M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z`,key:`1v7up4`}]]),xe=t(`grid-3x3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),Se=t(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),Ce=t(`move`,[[`path`,{d:`M12 2v20`,key:`t6zp3m`}],[`path`,{d:`m15 19-3 3-3-3`,key:`11eu04`}],[`path`,{d:`m19 9 3 3-3 3`,key:`1mg7y2`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}],[`path`,{d:`m5 9-3 3 3 3`,key:`j64kie`}],[`path`,{d:`m9 5 3-3 3 3`,key:`l8vdw6`}]]);async function we(e,t){let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}),r=await n.json().catch(()=>({}));if(!n.ok||r.ok===!1)throw Error(r.error||`Computer input control failed`);return r}async function U(e,t,n){return we(`/api/keyboard`,{code:e,output:t,modifiers:n})}async function W(e){return we(`/api/trackpad`,e)}var G=e=>({code:`Key${e}`,label:e,output:e.toLowerCase()}),Te=[{code:`Escape`,label:`esc`,tone:`system`},{code:`F1`,label:`F1`,gap:!0},{code:`F2`,label:`F2`},{code:`F3`,label:`F3`},{code:`F4`,label:`F4`},{code:`F5`,label:`F5`,gap:!0},{code:`F6`,label:`F6`},{code:`F7`,label:`F7`},{code:`F8`,label:`F8`},{code:`F9`,label:`F9`,gap:!0},{code:`F10`,label:`F10`},{code:`F11`,label:`F11`},{code:`F12`,label:`F12`},{code:`PrintScreen`,label:`prt sc`,aria:`Print Screen`,gap:!0},{code:`ScrollLock`,label:`scr lk`,aria:`Scroll Lock`},{code:`Pause`,label:`pause`}],K=[[{code:`Backquote`,label:"`",shifted:`~`,output:"`"},{code:`Digit1`,label:`1`,shifted:`!`,output:`1`},{code:`Digit2`,label:`2`,shifted:`@`,output:`2`},{code:`Digit3`,label:`3`,shifted:`#`,output:`3`},{code:`Digit4`,label:`4`,shifted:`$`,output:`4`},{code:`Digit5`,label:`5`,shifted:`%`,output:`5`},{code:`Digit6`,label:`6`,shifted:`^`,output:`6`},{code:`Digit7`,label:`7`,shifted:`&`,output:`7`},{code:`Digit8`,label:`8`,shifted:`*`,output:`8`},{code:`Digit9`,label:`9`,shifted:`(`,output:`9`},{code:`Digit0`,label:`0`,shifted:`)`,output:`0`},{code:`Minus`,label:`-`,shifted:`_`,output:`-`},{code:`Equal`,label:`=`,shifted:`+`,output:`=`},{code:`Backspace`,label:`backspace`,width:2,tone:`modifier`}],[{code:`Tab`,label:`tab`,width:1.5,tone:`modifier`},...[`Q`,`W`,`E`,`R`,`T`,`Y`,`U`,`I`,`O`,`P`].map(G),{code:`BracketLeft`,label:`[`,shifted:`{`,output:`[`},{code:`BracketRight`,label:`]`,shifted:`}`,output:`]`},{code:`Backslash`,label:`\\`,shifted:`|`,output:`\\`,width:1.5}],[{code:`CapsLock`,label:`caps lock`,width:1.75,tone:`modifier`},...[`A`,`S`,`D`,`F`,`G`,`H`,`J`,`K`,`L`].map(G),{code:`Semicolon`,label:`;`,shifted:`:`,output:`;`},{code:`Quote`,label:`'`,shifted:`"`,output:`'`},{code:`Enter`,label:`enter`,width:2.25,tone:`accent`}],[{code:`ShiftLeft`,label:`shift`,width:2.25,tone:`modifier`},...[`Z`,`X`,`C`,`V`,`B`,`N`,`M`].map(G),{code:`Comma`,label:`,`,shifted:`<`,output:`,`},{code:`Period`,label:`.`,shifted:`>`,output:`.`},{code:`Slash`,label:`/`,shifted:`?`,output:`/`},{code:`ShiftRight`,label:`shift`,width:2.75,tone:`modifier`}],[{code:`ControlLeft`,label:`ctrl`,width:1.25,tone:`modifier`},{code:`MetaLeft`,label:`win`,width:1.25,tone:`modifier`},{code:`AltLeft`,label:`alt`,width:1.25,tone:`modifier`},{code:`Space`,label:``,output:` `,aria:`Space`,width:6.25},{code:`AltRight`,label:`alt`,width:1.25,tone:`modifier`},{code:`Fn`,label:`fn`,width:1.25,tone:`modifier`},{code:`ContextMenu`,label:`menu`,width:1.25,tone:`modifier`},{code:`ControlRight`,label:`ctrl`,width:1.25,tone:`modifier`}]],q=[{code:`Insert`,label:`insert`,tone:`system`},{code:`Home`,label:`home`,tone:`system`},{code:`PageUp`,label:`page up`,tone:`system`},{code:`Delete`,label:`delete`,tone:`system`},{code:`End`,label:`end`,tone:`system`},{code:`PageDown`,label:`page down`,tone:`system`}],Ee=[{code:`ArrowUp`,label:`↑`,aria:`Arrow Up`,area:`up`},{code:`ArrowLeft`,label:`←`,aria:`Arrow Left`,area:`left`},{code:`ArrowDown`,label:`↓`,aria:`Arrow Down`,area:`down`},{code:`ArrowRight`,label:`→`,aria:`Arrow Right`,area:`right`}],De=[{code:`NumLock`,label:`num lock`,tone:`modifier`,area:`num`},{code:`NumpadDivide`,label:`÷`,output:`/`,area:`divide`},{code:`NumpadMultiply`,label:`×`,output:`*`,area:`multiply`},{code:`NumpadSubtract`,label:`−`,output:`-`,area:`subtract`},{code:`Numpad7`,label:`7`,output:`7`,shifted:`home`,area:`seven`},{code:`Numpad8`,label:`8`,output:`8`,shifted:`↑`,area:`eight`},{code:`Numpad9`,label:`9`,output:`9`,shifted:`pg up`,area:`nine`},{code:`NumpadAdd`,label:`+`,output:`+`,tone:`system`,area:`add`},{code:`Numpad4`,label:`4`,output:`4`,shifted:`←`,area:`four`},{code:`Numpad5`,label:`5`,output:`5`,area:`five`},{code:`Numpad6`,label:`6`,output:`6`,shifted:`→`,area:`six`},{code:`Numpad1`,label:`1`,output:`1`,shifted:`end`,area:`one`},{code:`Numpad2`,label:`2`,output:`2`,shifted:`↓`,area:`two`},{code:`Numpad3`,label:`3`,output:`3`,shifted:`pg dn`,area:`three`},{code:`NumpadEnter`,label:`enter`,tone:`accent`,area:`enter`},{code:`Numpad0`,label:`0`,output:`0`,shifted:`insert`,area:`zero`},{code:`NumpadDecimal`,label:`.`,output:`.`,shifted:`delete`,area:`decimal`}],Oe=new Set([`CapsLock`,`NumLock`,`ShiftLeft`,`ShiftRight`,`ControlLeft`,`ControlRight`,`AltLeft`,`AltRight`,`MetaLeft`,`Fn`]);function J({item:e,active:t,onPress:n}){return P(`button`,{type:`button`,className:`kbapp-key kbapp-key--${e.tone??`default`}${t?` is-active`:``}${e.gap?` has-gap`:``}`,style:{"--kb-width":e.width??1,gridArea:e.area},"aria-label":e.aria??e.label,"aria-pressed":Oe.has(e.code)?t:void 0,"data-key-code":e.code,onPointerDown:e=>e.preventDefault(),onClick:()=>n(e),children:[e.shifted&&N(`small`,{children:e.shifted}),N(`span`,{children:e.label})]})}function ke({active:e,onPress:t}){return P(`div`,{className:`kbapp-navigation`,"aria-label":`Navigation keys`,children:[N(`div`,{className:`kbapp-nav-grid`,children:q.map(n=>N(J,{item:n,active:e.has(n.code),onPress:t},n.code))}),N(`div`,{className:`kbapp-arrow-grid`,children:Ee.map(n=>N(J,{item:n,active:e.has(n.code),onPress:t},n.code))})]})}function Ae({active:e,onPress:t}){return N(`div`,{className:`kbapp-numpad`,"aria-label":`Number pad`,children:De.map(n=>N(J,{item:n,active:e.has(n.code),onPress:t},n.code))})}function je({onAutomationError:e}){let t=L(null),n=L(!1),r=L({x:0,y:0}),i=L(!1),a=L({dx:0,dy:0}),o=L(null),s=1.8,c=.8,l=F(()=>{o.current=null;let{dx:t,dy:n}=a.current;a.current={dx:0,dy:0},!(Math.abs(t)<.5&&Math.abs(n)<.5)&&W({action:i.current?`scroll`:`move`,dx:t,dy:n}).catch(t=>{e(t instanceof Error?t.message:`Trackpad control failed`)})},[e]);I(()=>(W({action:`warmup`}).catch(t=>{e(t instanceof Error?t.message:`Trackpad control failed`)}),()=>{o.current!==null&&cancelAnimationFrame(o.current)}),[e]);let u=F(t=>{W({action:t}).catch(t=>{e(t instanceof Error?t.message:`Trackpad control failed`)})},[e]),d=F(e=>{e.preventDefault(),n.current=!0,r.current={x:e.clientX,y:e.clientY},i.current=e.shiftKey,e.target.setPointerCapture(e.pointerId)},[]),f=F(e=>{if(!n.current)return;let t=(e.clientX-r.current.x)*s,u=(e.clientY-r.current.y)*s;r.current={x:e.clientX,y:e.clientY},!(Math.abs(t)<.5&&Math.abs(u)<.5)&&(i.current?(a.current.dx+=t*c,a.current.dy+=u*c):(a.current.dx+=t,a.current.dy+=u),o.current===null&&(o.current=requestAnimationFrame(l)))},[l]),p=F(()=>{o.current!==null&&(cancelAnimationFrame(o.current),l()),n.current=!1,i.current=!1},[l]);return P(`div`,{className:`kbapp-trackpad-wrap`,children:[N(`div`,{ref:t,className:`kbapp-trackpad-surface`,"aria-label":`Trackpad surface — drag to move cursor`,role:`application`,onPointerDown:d,onPointerMove:f,onPointerUp:p,onPointerCancel:p,children:P(`div`,{className:`kbapp-trackpad-hint`,children:[N(Se,{}),N(`span`,{children:`Drag to move cursor`}),N(`small`,{children:`Hold Shift + drag to scroll`})]})}),P(`div`,{className:`kbapp-trackpad-buttons`,children:[N(`button`,{type:`button`,className:`kbapp-trackpad-btn kbapp-trackpad-btn--click`,onPointerDown:e=>e.preventDefault(),onClick:()=>u(`click`),children:`Click`}),N(`button`,{type:`button`,className:`kbapp-trackpad-btn kbapp-trackpad-btn--right`,onPointerDown:e=>e.preventDefault(),onClick:()=>u(`rightClick`),children:`Right click`}),N(`button`,{type:`button`,className:`kbapp-trackpad-btn kbapp-trackpad-btn--double`,onPointerDown:e=>e.preventDefault(),onClick:()=>u(`doubleClick`),children:`Double click`})]})]})}function Me({onClose:e}){let[t,n]=R(`full`),[r,i]=R(()=>new Set([`NumLock`])),[a,s]=R({key:`—`,code:`Waiting`}),[c,l]=R(null),[u,d]=R(``),f=L(new Map);I(()=>{document.body.classList.add(`modal-open`);let e=f.current,t=e=>{e.isTrusted&&(s({key:e.key===` `?`Space`:e.key,code:e.code}),i(t=>new Set(t).add(e.code)))},n=e=>{i(t=>{if(e.code===`CapsLock`||e.code===`NumLock`)return t;let n=new Set(t);return n.delete(e.code),n})};return window.addEventListener(`keydown`,t),window.addEventListener(`keyup`,n),()=>{document.body.classList.remove(`modal-open`),window.removeEventListener(`keydown`,t),window.removeEventListener(`keyup`,n),e.forEach(e=>window.clearTimeout(e))}},[]),I(()=>{let e=new AbortController;return fetch(`/api/keyboard`,{signal:e.signal}).then(async e=>{let t=await e.json();if(!e.ok||!t.platform||typeof t.platformLabel!=`string`||typeof t.supported!=`boolean`)throw Error(t.error||`Unable to detect the computer platform`);l({platform:t.platform,platformLabel:t.platformLabel,supported:t.supported}),t.supported||d(`Computer input control is not supported on ${t.platformLabel}. Use a macOS or Windows host.`)}).catch(t=>{e.signal.aborted||d(t instanceof Error?t.message:`Unable to detect the computer platform`)}),()=>e.abort()},[]);let p=F(e=>{let t=f.current.get(e);t&&window.clearTimeout(t),i(t=>new Set(t).add(e));let n=window.setTimeout(()=>{i(t=>{let n=new Set(t);return n.delete(e),n})},140);f.current.set(e,n)},[]),h=F(e=>{if(Oe.has(e.code)){i(t=>{let n=new Set(t);return n.has(e.code)?n.delete(e.code):n.add(e.code),n}),s({key:e.label||e.code,code:e.code});return}let t=r.has(`ShiftLeft`)||r.has(`ShiftRight`),n=r.has(`CapsLock`),a=e.code.startsWith(`Key`),o=e.output;a&&o?o=t===n?o:o.toUpperCase():t&&e.shifted&&(o=e.shifted);let c=o===` `?`Space`:o??e.code.replace(/Left|Right/,``);s({key:c,code:e.code});let l=[];for(let e of[`ShiftLeft`,`ShiftRight`,`ControlLeft`,`ControlRight`,`AltLeft`,`AltRight`,`MetaLeft`])r.has(e)&&l.push(e);U(e.code,o,l).catch(e=>{d(e instanceof Error?e.message:`Keyboard control failed`)}),p(e.code),t&&i(e=>{let t=new Set(e);return t.delete(`ShiftLeft`),t.delete(`ShiftRight`),t})},[r,p]),g=c?.platform===`macos`?K.map(e=>e.map(e=>e.code===`MetaLeft`?{...e,label:`cmd`}:e)):K,_=F(e=>{d(e)},[]);return P(`div`,{className:`kbapp-layer`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`keyboard-app-title`,children:[P(`header`,{className:`kbapp-header`,children:[P(`button`,{type:`button`,className:`kbapp-back`,onClick:e,children:[N(o,{}),N(`span`,{children:`App store`})]}),P(`div`,{className:`kbapp-brand`,children:[N(`span`,{children:N(V,{})}),P(`div`,{children:[N(`strong`,{id:`keyboard-app-title`,children:`Keyboard, trackpad`}),N(`small`,{children:c?`${c.platformLabel} input control`:`Detecting computer`})]})]}),N(`button`,{type:`button`,className:`kbapp-close`,onClick:e,"aria-label":`Close app`,children:N(w,{})})]}),N(`main`,{className:`kbapp-main`,children:P(`section`,{className:`kbapp-workspace`,children:[u&&P(`div`,{className:`kbapp-alert`,role:`status`,children:[N(m,{}),N(`span`,{children:u}),N(`button`,{type:`button`,onClick:()=>d(``),"aria-label":`Dismiss input control message`,children:N(w,{})})]}),P(`div`,{className:`kbapp-toolbar`,children:[P(`div`,{className:`kbapp-tabs`,role:`tablist`,"aria-label":`Input modes`,children:[P(`button`,{type:`button`,role:`tab`,"aria-selected":t===`full`,className:t===`full`?`active`:``,onClick:()=>n(`full`),children:[N(V,{}),` Full keyboard`]}),P(`button`,{type:`button`,role:`tab`,"aria-selected":t===`trackpad`,className:t===`trackpad`?`active`:``,onClick:()=>n(`trackpad`),children:[N(Se,{}),` Trackpad`]}),P(`button`,{type:`button`,role:`tab`,"aria-selected":t===`numpad`,className:t===`numpad`?`active`:``,onClick:()=>n(`numpad`),children:[N(xe,{}),` Numpad`]}),P(`button`,{type:`button`,role:`tab`,"aria-selected":t===`navigation`,className:t===`navigation`?`active`:``,onClick:()=>n(`navigation`),children:[N(Ce,{}),` Navigation`]})]}),t!==`trackpad`&&P(`dl`,{className:`kbapp-status`,children:[P(`div`,{children:[N(`dt`,{children:`Last key`}),N(`dd`,{children:a.key})]}),P(`div`,{children:[N(`dt`,{children:`Key code`}),N(`dd`,{children:N(`code`,{children:a.code})})]})]})]}),t===`trackpad`?N(`div`,{className:`kbapp-trackpad-panel`,children:N(je,{onAutomationError:_})}):P(`div`,{className:`kbapp-board-shell kbapp-board-shell--${t}`,role:`tabpanel`,children:[P(`div`,{className:`kbapp-board-top`,children:[N(`span`,{children:`KEYBOARD / WEB`}),N(`i`,{className:r.has(`CapsLock`)?`on`:``}),N(`i`,{className:r.has(`NumLock`)?`on`:``})]}),t===`full`&&P(M,{children:[N(`div`,{className:`kbapp-function-row`,children:Te.map(e=>N(J,{item:e,active:r.has(e.code),onPress:h},e.code))}),P(`div`,{className:`kbapp-zones`,children:[N(`div`,{className:`kbapp-alpha`,children:g.map((e,t)=>N(`div`,{className:`kbapp-row`,children:e.map(e=>N(J,{item:e,active:r.has(e.code),onPress:h},e.code))},t))}),N(ke,{active:r,onPress:h}),N(Ae,{active:r,onPress:h})]})]}),t===`numpad`&&P(`div`,{className:`kbapp-focused`,children:[P(`div`,{className:`kbapp-focused-copy`,children:[N(`span`,{children:`Focused template`}),N(`strong`,{children:`Number pad`}),N(`p`,{children:`Numbers and operators, without the clutter.`})]}),N(Ae,{active:r,onPress:h})]}),t===`navigation`&&P(`div`,{className:`kbapp-focused`,children:[P(`div`,{className:`kbapp-focused-copy`,children:[N(`span`,{children:`Focused template`}),N(`strong`,{children:`Navigation`}),N(`p`,{children:`Move through text with precision.`})]}),N(ke,{active:r,onPress:h})]})]})]})})]})}var Ne=t(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]);function Pe({type:e}){switch(e){case`phone`:return N(v,{"aria-hidden":`true`});case`tablet`:return N(h,{"aria-hidden":`true`});case`laptop`:return N(g,{"aria-hidden":`true`});case`desktop`:return N(_,{"aria-hidden":`true`});default:return N(_,{"aria-hidden":`true`})}}function Fe(e,t){let n={...e,updatedAt:Date.now()};switch(t.type){case`set-paused`:return{...n,paused:t.paused};case`seek-relative`:return{...n,currentTime:Math.max(0,Math.min(e.duration,e.currentTime+t.seconds))};case`seek-to`:return{...n,currentTime:Math.max(0,Math.min(e.duration,t.seconds))};case`set-muted`:return{...n,muted:t.muted};case`set-volume`:return{...n,volume:Math.max(0,Math.min(1,t.volume)),muted:t.volume<=0};case`previous-track`:case`next-track`:case`switch-track`:case`switch-playlist`:return n;case`next-episode`:{if(e.service===`spotify`)return n;let t={...e,updatedAt:n.updatedAt},r=e.episodes.findIndex(t=>t.season===e.seasonNumber&&t.number===e.episodeNumber),i=e.episodes[r+1];return i?{...t,seasonNumber:i.season,episodeNumber:i.number,episodeTitle:i.title,currentTime:0,paused:!1}:t}case`select-episode`:{if(e.service===`spotify`)return n;let r={...e,updatedAt:n.updatedAt},i=e.episodes.find(e=>e.number===t.episodeNumber);return i?{...r,seasonNumber:i.season,episodeNumber:i.number,episodeTitle:i.title,currentTime:0,paused:!1}:r}case`switch-title`:return n;case`set-captions`:return e.service===`spotify`?n:{...e,updatedAt:n.updatedAt,subtitles:{...e.subtitles,captionsOn:t.enabled}};case`set-subtitle-font-size`:return e.service===`spotify`?n:{...e,updatedAt:n.updatedAt,subtitles:{...e.subtitles,fontSize:t.fontSize}};case`set-subtitle-font-color`:return e.service===`spotify`?n:{...e,updatedAt:n.updatedAt,subtitles:{...e.subtitles,fontColor:t.color}};case`set-subtitle-background`:return e.service===`spotify`?n:{...e,updatedAt:n.updatedAt,subtitles:{...e.subtitles,backgroundColor:t.background}};case`reset-subtitle-position`:return n}}function Y(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n?`${n}:${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:`${r}:${String(i).padStart(2,`0`)}`}function Ie(e){return e.sourceProvider===`phimhdcss`?`PhimHDC`:e.sourceProvider===`fsharetv`?`FshareTV`:`Netflix`}function Le({activity:e,onClose:t,onSelect:n}){let r=L(null),[i,a]=R(``),[o,s]=R([]),[c,l]=R(!0),[u,d]=R(``),[f,p]=R(null),m=i.trim(),h=`activity-movies-${e.sessionId}`;I(()=>{let e=document.activeElement instanceof HTMLElement?document.activeElement:null;return r.current?.focus(),()=>{e?.isConnected&&e.focus()}},[]),I(()=>{let t=new AbortController,n=i.trim(),r=window.setTimeout(()=>{l(!0),d(``),fetch(`/api/netflix/activity/titles?profileId=${encodeURIComponent(e.profileId)}&q=${encodeURIComponent(n)}`,{cache:`no-store`,signal:t.signal}).then(async t=>{let n=await t.json();if(!t.ok)throw Error(n.error||`Movies could not be loaded.`);s((Array.isArray(n.titles)?n.titles:[]).filter(t=>t.id!==e.titleId)),n.failedProviders?.length&&d(`Some movie sources could not be searched.`)}).catch(e=>{t.signal.aborted||(s([]),d(e instanceof Error?e.message:`Movies could not be loaded.`))}).finally(()=>{t.signal.aborted||l(!1)})},n?300:0);return()=>{window.clearTimeout(r),t.abort()}},[e.profileId,e.titleId,i]);let g=async e=>{p(e.id),d(``);try{await n(e),t()}catch(e){d(e instanceof Error?e.message:`The movie could not be switched.`),p(null)}};return ae(N(`div`,{className:`activity-movie-search-overlay`,onMouseDown:e=>{e.target===e.currentTarget&&t()},onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),t())},children:P(`div`,{className:`activity-movie-search`,id:h,role:`dialog`,"aria-label":`Search another movie for ${e.title}`,children:[P(`div`,{className:`activity-movie-search__header`,children:[P(`div`,{children:[N(`h3`,{children:`Switch movie`}),P(`span`,{className:`activity-movie-search__now`,children:[`Now playing: `,e.title]})]}),N(`button`,{type:`button`,onClick:t,"aria-label":`Close movie search`,children:N(w,{})})]}),P(`div`,{className:`activity-movie-search__field`,children:[N(T,{"aria-hidden":`true`}),N(`input`,{ref:r,type:`search`,value:i,onChange:e=>{a(e.currentTarget.value),l(!0),d(``)},placeholder:`Search movies and series`,"aria-label":`Search another movie for ${e.title}`,autoComplete:`off`}),i&&N(`button`,{type:`button`,onClick:()=>{a(``),l(!0),d(``),r.current?.focus()},"aria-label":`Clear movie search`,children:N(w,{})})]}),N(`div`,{className:`activity-movie-search__heading`,children:N(`strong`,{children:m?`Search results`:`Recently watched`})}),N(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:f?`Switching from ${e.title}…`:c?m?`Searching for ${m}…`:`Loading recently watched movies…`:`${o.length} ${m?`search`:`recent`} ${o.length===1?`result`:`results`}.`}),u&&N(`p`,{className:`activity-movie-search__notice`,role:`alert`,children:u}),c?P(`div`,{className:`activity-movie-search__empty`,children:[N(C,{className:`spin`,"aria-hidden":`true`}),N(`span`,{children:m?`Searching for “${m}”…`:`Loading recently watched movies…`})]}):o.length?N(`div`,{className:`activity-movie-search__results`,"aria-label":m?`Movie search results`:`Recently watched movies`,children:o.map(e=>P(`button`,{type:`button`,onClick:()=>void g(e),disabled:f!==null,"aria-label":`Switch to ${e.title}`,children:[P(`span`,{className:`activity-movie-search__art`,children:[N(`img`,{src:e.backdropImage,alt:``}),f===e.id&&N(C,{className:`spin`,"aria-hidden":`true`})]}),P(`span`,{className:`activity-movie-search__copy`,children:[N(`strong`,{children:e.title}),P(`small`,{children:[e.year,N(`span`,{"aria-hidden":`true`,children:` · `}),Ie(e)]})]})]},`${e.sourceProvider??`catalog`}:${e.id}`))}):P(`div`,{className:`activity-movie-search__empty`,children:[N(T,{"aria-hidden":`true`}),N(`span`,{children:m?`No movies found for “${m}”.`:`No other recently watched movies yet.`})]})]})}),document.body)}function Re({activity:e,tabLabel:t,editorOpen:n,searchOpen:i,onEditorToggle:o,onSearchToggle:s,onCommand:d}){let[f,p]=R(null),m=Math.max(1,Math.round(e.duration)),h=Math.max(0,Math.min(m,Math.round(f??e.currentTime))),g=e.duration>0?Math.max(0,Math.min(100,h/e.duration*100)):0,_=Math.round(e.volume*100),v=e.episodes.findIndex(t=>t.season===e.seasonNumber&&t.number===e.episodeNumber),y=v>=0&&v<e.episodes.length-1,b=`${e.title}, season ${e.seasonNumber}, episode ${e.episodeNumber}`,x=t=>{let n=Math.max(0,Math.min(e.duration,Math.round(t)));p(null),d({type:`seek-to`,seconds:n})},[S,ee]=R(null),[C,w]=R(null);I(()=>{let t=new AbortController;return fetch(`/api/netflix/markers?titleId=${encodeURIComponent(e.titleId)}`,{cache:`no-store`,signal:t.signal}).then(async e=>{if(!e.ok)return;let n=await e.json();if(!t.signal.aborted)for(let e of n.markers??[])e.markerType===`intro`?ee(e.timeSeconds):e.markerType===`outro`&&w(e.timeSeconds)}).catch(()=>{}),()=>t.abort()},[e.titleId]);let E=S!==null&&h>=0&&h<=S&&!e.paused,O=C!==null&&h>=C&&e.duration>0&&!e.paused&&y;return P(`article`,{className:`activity-card`,"aria-label":`${e.title} playback in ${t}`,style:{"--activity-artwork":`url("${e.artwork}")`},children:[P(`div`,{className:`activity-card__art`,children:[P(`div`,{className:`activity-card__source`,children:[N(`span`,{className:`activity-netflix-mark`,"aria-label":`Netflix`,children:`N`}),P(`span`,{className:`activity-live`,children:[N(`i`,{"aria-hidden":`true`}),N(Pe,{type:e.deviceType}),t]})]}),P(`div`,{className:`activity-card__copy`,children:[N(`span`,{children:`Now watching`}),N(`h3`,{children:e.title}),P(`p`,{children:[`S`,e.seasonNumber,`:E`,e.episodeNumber,N(`span`,{"aria-hidden":`true`,children:` · `}),e.episodeTitle]})]})]}),P(`div`,{className:`activity-card__remote`,children:[N(`input`,{className:`activity-progress`,type:`range`,min:0,max:m,step:1,value:h,disabled:e.duration<=0,"aria-label":`${e.title} progress`,"aria-valuetext":`${Y(h)} of ${Y(e.duration)}`,title:`Seek ${e.title}`,style:{"--activity-progress":`${g}%`},onChange:e=>p(Number(e.currentTarget.value)),onPointerUp:e=>x(Number(e.currentTarget.value)),onPointerCancel:()=>p(null),onKeyUp:e=>{(e.key===`ArrowLeft`||e.key===`ArrowRight`||e.key===`ArrowUp`||e.key===`ArrowDown`||e.key===`Home`||e.key===`End`||e.key===`PageUp`||e.key===`PageDown`)&&x(Number(e.currentTarget.value))},onBlur:e=>{f!==null&&x(Number(e.currentTarget.value))}}),P(`div`,{className:`activity-time`,children:[N(`time`,{children:Y(h)}),N(`span`,{children:Y(e.duration)})]}),(E||O)&&P(`div`,{className:`activity-marker-actions`,children:[E&&P(`button`,{type:`button`,className:`activity-skip-intro`,onClick:()=>d({type:`seek-to`,seconds:S}),"aria-label":`Skip intro of ${e.title}`,children:[N(D,{}),`Skip Intro`]}),O&&P(`button`,{type:`button`,className:`activity-next-episode-prompt`,onClick:()=>d({type:`next-episode`}),"aria-label":`Next episode of ${e.title}`,children:[N(l,{}),`Next Episode`]})]}),P(`div`,{className:`activity-controls`,role:`group`,"aria-label":`Controls for ${b}`,children:[N(`button`,{type:`button`,onClick:()=>d({type:`set-paused`,paused:!e.paused}),"aria-label":`${e.paused?`Play`:`Pause`} ${e.title}`,children:e.paused?N(k,{fill:`currentColor`}):N(te,{fill:`currentColor`})}),P(`button`,{className:`activity-ten-second`,type:`button`,onClick:()=>d({type:`seek-relative`,seconds:-10}),"aria-label":`Rewind ${e.title} 10 seconds`,children:[N(r,{}),N(`span`,{children:`10`})]}),P(`button`,{className:`activity-ten-second`,type:`button`,onClick:()=>d({type:`seek-relative`,seconds:10}),"aria-label":`Forward ${e.title} 10 seconds`,children:[N(a,{}),N(`span`,{children:`10`})]}),P(`div`,{className:`activity-volume`,children:[N(`button`,{type:`button`,onClick:()=>d({type:`set-muted`,muted:!e.muted}),"aria-label":`${e.muted?`Unmute`:`Mute`} ${e.title}`,"aria-pressed":e.muted,children:e.muted?N(ne,{}):N(A,{})}),N(`input`,{type:`range`,min:0,max:100,step:1,value:_,style:{"--activity-volume":`${_}%`},onChange:e=>d({type:`set-volume`,volume:Number(e.currentTarget.value)/100}),"aria-label":`Volume for ${e.title}`,"aria-valuetext":e.muted?`Muted, level ${_}%`:`${_}%`})]}),N(`button`,{type:`button`,onClick:()=>d({type:`next-episode`}),"aria-label":`Next episode of ${e.title}`,disabled:!y,children:N(l,{})}),P(`label`,{className:`activity-episode-picker`,children:[N(c,{"aria-hidden":`true`}),P(`span`,{className:`sr-only`,children:[`Choose episode for `,e.title]}),N(`select`,{value:e.episodeNumber,onChange:e=>d({type:`select-episode`,episodeNumber:Number(e.currentTarget.value)}),"aria-label":`Choose episode for ${e.title}`,children:e.episodes.map((e,t)=>P(`option`,{value:e.number,children:[`S`,e.season,`:E`,e.number,` · `,e.title]},`${e.season}-${e.number}-${t}`))})]}),N(`button`,{className:n?`is-active`:``,type:`button`,onClick:o,"aria-label":`Edit subtitles for ${e.title}`,"aria-expanded":n,"aria-controls":`activity-subtitles-${e.sessionId}`,children:N(u,{})}),N(`button`,{className:i?`is-active`:``,type:`button`,onClick:s,"aria-label":`Switch ${e.title} to another movie`,"aria-expanded":i,"aria-controls":`activity-movies-${e.sessionId}`,children:N(T,{})})]}),n&&P(`div`,{className:`activity-subtitle-editor`,id:`activity-subtitles-${e.sessionId}`,children:[P(`div`,{className:`activity-subtitle-editor__heading`,children:[P(`span`,{children:[N(Ne,{"aria-hidden":`true`}),`Subtitle appearance`]}),N(`button`,{type:`button`,className:`activity-caption-toggle`,"aria-pressed":e.subtitles.captionsOn,"aria-label":e.subtitles.available?`${e.subtitles.captionsOn?`Turn off`:`Turn on`} subtitles for ${e.title}`:`Subtitles unavailable for ${e.title}`,disabled:!e.subtitles.available,onClick:()=>d({type:`set-captions`,enabled:!e.subtitles.captionsOn}),children:e.subtitles.available?e.subtitles.captionsOn?`On`:`Off`:`Unavailable`})]}),P(`label`,{className:`activity-subtitle-size`,children:[N(`span`,{children:`Size`}),N(`input`,{type:`range`,min:18,max:64,step:2,value:e.subtitles.fontSize,onChange:e=>d({type:`set-subtitle-font-size`,fontSize:Number(e.currentTarget.value)}),"aria-label":`Subtitle size for ${e.title}`}),P(`output`,{children:[e.subtitles.fontSize,`px`]})]}),P(`label`,{className:`activity-subtitle-color`,children:[N(`span`,{children:`Text`}),N(`input`,{type:`color`,value:e.subtitles.fontColor,onChange:e=>d({type:`set-subtitle-font-color`,color:e.currentTarget.value}),"aria-label":`Subtitle text color for ${e.title}`})]}),P(`label`,{className:`activity-subtitle-background`,children:[N(`span`,{children:`Background`}),P(`select`,{value:e.subtitles.backgroundColor,onChange:e=>d({type:`set-subtitle-background`,background:e.currentTarget.value}),"aria-label":`Subtitle background for ${e.title}`,children:[N(`option`,{value:`transparent`,children:`None`}),N(`option`,{value:`rgba(0,0,0,0.75)`,children:`Dark`}),N(`option`,{value:`rgba(0,0,0,0.5)`,children:`Semi-dark`}),N(`option`,{value:`rgba(0,0,0,0.3)`,children:`Light`}),N(`option`,{value:`rgba(0,0,0,1)`,children:`Solid black`})]})]}),N(`button`,{className:`activity-reset-position`,type:`button`,onClick:()=>d({type:`reset-subtitle-position`}),children:`Reset position`})]})]})]})}function ze({profiles:e,activeProfileId:t}){let[n,r]=R([]),[i,a]=R({}),[o,s]=R(null),[c,l]=R(null),u=F(async e=>{if(!t){a({}),r([]);return}try{let n=await fetch(`/api/netflix/activity?profileId=${encodeURIComponent(t)}`,{cache:`no-store`,signal:e});if(!n.ok)return;let i=await n.json(),o=Array.isArray(i.activities)?i.activities.filter(e=>e.profileId===t):[],c=o.map(e=>e.sessionId),u=new Set(c);r(e=>[...e.filter(e=>u.has(e)),...c.filter(t=>!e.includes(t))]),a(Object.fromEntries(o.map(e=>[e.sessionId,e]))),s(e=>e&&!u.has(e)?null:e),l(e=>e&&!u.has(e)?null:e)}catch{}},[t]);I(()=>{let e=new AbortController,t=()=>void u(e.signal),n=()=>{document.visibilityState===`visible`&&t()},r=window.requestAnimationFrame(t),i=window.setInterval(t,1e3);return window.addEventListener(`focus`,t),document.addEventListener(`visibilitychange`,n),()=>{e.abort(),window.cancelAnimationFrame(r),window.clearInterval(i),window.removeEventListener(`focus`,t),document.removeEventListener(`visibilitychange`,n)}},[u]);let d=ie(()=>Object.values(i).sort((e,t)=>n.indexOf(e.sessionId)-n.indexOf(t.sessionId)),[i,n]),f=e.find(e=>e.id===t),m=F((e,t)=>{let n=i[e]?.profileId;n&&(a(n=>{let r=n[e];return r?{...n,[e]:Fe(r,t)}:n}),fetch(`/api/netflix/activity/${encodeURIComponent(e)}/commands?profileId=${encodeURIComponent(n)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({command:t})}).catch(()=>{}))},[i]),h=F(async(e,t)=>{let n=i[e]?.profileId;if(!n)throw Error(`Playback profile is unavailable.`);let r=t;if(t.sourceProvider&&t.sourceUrl&&!t.canStream&&!t.playbackPath){let e=await fetch(`/api/netflix/movies/import`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({url:t.sourceUrl,mode:`stream`,profileId:n})}),i=await e.json();if(!e.ok||!i.title)throw Error(i.error||`Movie details could not be loaded.`);r=i.title}let a=await fetch(`/api/netflix/activity/${encodeURIComponent(e)}/commands?profileId=${encodeURIComponent(n)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({command:{type:`switch-title`,titleId:r.id}})}),o=await a.json();if(!a.ok)throw Error(o.error||`The movie could not be switched.`)},[i]),g=F(async(e,t)=>{let n=i[e]?.profileId;if(!n)throw Error(`Playback profile is unavailable.`);let r=await fetch(`/api/netflix/activity/${encodeURIComponent(e)}/commands?profileId=${encodeURIComponent(n)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({command:{type:`switch-track`,trackId:t.id}})}),a=await r.json();if(!r.ok)throw Error(a.error||`The track could not be switched.`)},[i]),_=F(async(e,t)=>{let n=i[e]?.profileId;if(!n)throw Error(`Playback profile is unavailable.`);let r=await fetch(`/api/netflix/activity/${encodeURIComponent(e)}/commands?profileId=${encodeURIComponent(n)}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({command:{type:`switch-playlist`,playlistId:t.id}})}),a=await r.json();if(!r.ok)throw Error(a.error||`The playlist could not be switched.`)},[i]);return P(`section`,{className:`store-container activity-section`,"aria-labelledby":`activity-heading`,children:[N(`div`,{className:`activity-heading`,children:P(`div`,{children:[N(`h2`,{id:`activity-heading`,children:`Activity`}),P(`p`,{children:[`Control Netflix and Spotify playing on your other devices`,f?` for ${f.name}`:``,`.`]})]})}),d.length>0&&P(`p`,{className:`sr-only`,role:`status`,children:[d.length,` active playback`,` `,d.length===1?`session`:`sessions`,`.`]}),c&&i[c]?i[c].service===`spotify`?N(y,{activity:i[c],onClose:()=>l(null),onSelectTrack:e=>g(c,e),onSelectPlaylist:e=>_(c,e)}):N(Le,{activity:i[c],onClose:()=>l(null),onSelect:e=>h(c,e)}):null,d.length?N(`div`,{className:`activity-list`,children:d.map((e,t)=>e.service===`spotify`?N(p,{activity:e,tabLabel:e.machineName||`Player ${t+1}`,searchOpen:c===e.sessionId,onSearchToggle:()=>{let t=c!==e.sessionId;l(t?e.sessionId:null),t&&s(null)},onCommand:t=>m(e.sessionId,t)},e.sessionId):N(Re,{activity:e,tabLabel:e.machineName||`Player ${t+1}`,editorOpen:o===e.sessionId,searchOpen:c===e.sessionId,onEditorToggle:()=>{let t=o!==e.sessionId;s(t?e.sessionId:null),t&&l(null)},onSearchToggle:()=>{let t=c!==e.sessionId;l(t?e.sessionId:null),t&&s(null)},onCommand:t=>m(e.sessionId,t)},e.sessionId))}):P(`div`,{className:`activity-empty`,role:`status`,children:[N(`span`,{className:`activity-empty__icon`,"aria-hidden":`true`,children:N(k,{fill:`currentColor`})}),P(`span`,{children:[N(`strong`,{children:`Nothing playing right now`}),N(`small`,{children:`Start Netflix or Spotify on another device and it will appear here.`})]})]})]})}var Be=t(`monitor-off`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`M17 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 1.184-1.826`,key:`cv7jms`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`path`,{d:`M8.656 3H20a2 2 0 0 1 2 2v10a2 2 0 0 1-.293 1.042`,key:`z8ni2w`}]]),Ve=t(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),He=t(`unplug`,[[`path`,{d:`m19 5 3-3`,key:`yk6iyv`}],[`path`,{d:`m2 22 3-3`,key:`19mgm9`}],[`path`,{d:`M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z`,key:`goz73y`}],[`path`,{d:`M7.5 13.5 10 11`,key:`7xgeeb`}],[`path`,{d:`M10.5 16.5 13 14`,key:`10btkg`}],[`path`,{d:`m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z`,key:`1snsnr`}]]),Ue=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`);function We(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.id==`string`&&typeof t.label==`string`&&typeof t.width==`number`&&t.width>0&&typeof t.height==`number`&&t.height>0&&typeof t.pixelWidth==`number`&&t.pixelWidth>0&&typeof t.pixelHeight==`number`&&t.pixelHeight>0}function Ge(e){if(!e||typeof e!=`object`)return!1;let t=e;return(t.platform===`macos`||t.platform===`windows`||t.platform===`unsupported`)&&typeof t.platformLabel==`string`&&typeof t.hostName==`string`&&typeof t.supported==`boolean`&&Array.isArray(t.displays)&&t.displays.every(We)}async function X(e,t){if((e.headers.get(`content-type`)??``).includes(`json`)){let n=await e.json().catch(()=>null);return typeof n?.error==`string`&&n.error.trim()?n.error:t}return(await e.text().catch(()=>``)).trim()||t}function Ke({title:e,children:t}){let[n,r]=R(!0);return P(`section`,{className:`rsapp-settings-section`,children:[P(`button`,{type:`button`,className:`rsapp-settings-section__toggle`,"aria-expanded":n,onClick:()=>r(e=>!e),children:[N(`span`,{children:e}),N(j,{className:n?`is-open`:``,"aria-hidden":`true`})]}),n&&N(`div`,{className:`rsapp-settings-section__body`,children:t})]})}function qe({id:e,checked:t,title:n,description:r,onChange:i,disabled:a=!1}){return P(`label`,{className:`rsapp-setting${a?` is-disabled`:``}`,htmlFor:e,children:[N(`input`,{id:e,type:`checkbox`,checked:t,disabled:a,onChange:e=>i(e.target.checked)}),P(`span`,{className:`rsapp-setting__copy`,children:[N(`strong`,{children:n}),N(`small`,{children:r})]})]})}function Je({icon:e,title:t,description:n,action:r,onAction:i,busy:a=!1}){return P(`div`,{className:`rsapp-status-card`,role:`status`,"aria-live":`polite`,children:[N(`span`,{className:`rsapp-status-card__icon`,children:e}),N(`strong`,{children:t}),N(`p`,{children:n}),r&&i&&P(`button`,{type:`button`,onClick:i,children:[a?N(C,{className:`rsapp-spin`}):N(re,{}),r]})]})}function Ye({onClose:e}){let t=L(null),r=L(null),i=L(null),a=L(null),c=L(``),l=L(Promise.resolve()),u=L(null),f=L(null),p=L(null),[m,h]=R(`detecting`),[g,v]=R(null),[y,b]=R(``),[S,ee]=R(0),[te,T]=R(``),[E,D]=R(!1),[ne,k]=R(`idle`),[A,j]=R(``),[ae,oe]=R(0),[se,ce]=R(``),[z,B]=R(!0),[le,ue]=R(!0),[de,fe]=R(!1),[H,pe]=R(!0),[me,he]=R(!1),[ge,_e]=R(!1),[ve,ye]=R(!0),[be,xe]=R(5),[Ce,we]=R({width:0,height:0}),[U,W]=R(``),G=ie(()=>g?.displays.find(e=>e.id===te)??g?.displays[0]??null,[g,te]);I(()=>{let n=document.activeElement instanceof HTMLElement?document.activeElement:null,i=t.current;document.body.classList.add(`modal-open`),r.current?.focus();let a=t=>{if(t.defaultPrevented)return;if(t.key===`Escape`){if(document.fullscreenElement)return;t.preventDefault(),e();return}if(t.key!==`Tab`||!i)return;let n=Array.from(i.querySelectorAll(Ue)).filter(e=>!e.closest(`[inert]`)&&e.getAttribute(`aria-hidden`)!==`true`);if(!n.length){t.preventDefault();return}let r=n[0],a=n[n.length-1];t.shiftKey&&document.activeElement===r?(t.preventDefault(),a.focus()):!t.shiftKey&&document.activeElement===a?(t.preventDefault(),r.focus()):i.contains(document.activeElement)||(t.preventDefault(),r.focus())};return document.addEventListener(`keydown`,a),()=>{document.removeEventListener(`keydown`,a),document.body.classList.remove(`modal-open`),document.fullscreenElement===i&&document.exitFullscreen(),n?.focus()}},[e]),I(()=>{let e=()=>{fe(document.fullscreenElement===t.current)};return document.addEventListener(`fullscreenchange`,e),()=>document.removeEventListener(`fullscreenchange`,e)},[]),I(()=>{let e=i.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect();we({width:Math.max(0,t.width),height:Math.max(0,t.height)})};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),I(()=>{let e=new AbortController;return(async()=>{h(`detecting`),b(``),k(`idle`);try{let t=await fetch(`/api/remote-screen`,{cache:`no-store`,signal:e.signal});if(!t.ok)throw Error(await X(t,`Unable to inspect this computer's displays`));let n=await t.json();if(!Ge(n))throw Error(`The screen service returned an invalid response`);if(!n.supported)throw Error(`Remote screen control is not supported on ${n.platformLabel}.`);if(!n.displays.length)throw Error(`No active displays were found on this computer`);if(n.platform===`macos`&&n.permissions?.screenRecording===`denied`)throw Error(`Screen Recording permission is required. Allow the app running Home Atom in macOS System Settings, then try again.`);v(n),T(e=>n.displays.some(t=>t.id===e)?e:n.displays[0].id),h(`ready`),D(!0),n.platform===`macos`&&n.permissions?.accessibility===`denied`&&W(`Allow Accessibility for the app running Home Atom to enable pointer and keyboard control.`)}catch(t){if(e.signal.aborted)return;v(null),D(!1),h(`error`),b(t instanceof Error?t.message:`Unable to inspect this computer's displays`)}})(),()=>e.abort()},[S]),I(()=>{if(!G||m!==`ready`||!E)return;let e=!1,t=null,n=new AbortController,r=1e3/be,i=async()=>{let a=r;try{let t=new URLSearchParams({display:G.id,quality:ge?`high`:`balanced`,density:me?`high`:`standard`}),r=await fetch(`/api/remote-screen/frame?${t.toString()}`,{cache:`no-store`,signal:n.signal}),i=r.headers.get(`content-type`)??``;if(!r.ok||i.includes(`json`))throw Error(await X(r,`Unable to capture this display`));let a=await r.blob();if(!a.size)throw Error(`The screen service returned an empty frame`);let o=URL.createObjectURL(a),s=c.current;c.current=o,ce(o),s&&URL.revokeObjectURL(s),e||(k(`live`),j(``))}catch(t){if(n.signal.aborted||e)return;a=Math.max(1e3,r),k(`error`),j(t instanceof Error?t.message:`Unable to capture this display`)}finally{!e&&!n.signal.aborted&&(t=window.setTimeout(()=>void i(),a))}};return i(),()=>{e=!0,n.abort(),t!==null&&window.clearTimeout(t)}},[m,E,be,me,ge,G,ae]),I(()=>()=>{c.current&&URL.revokeObjectURL(c.current),p.current!==null&&window.cancelAnimationFrame(p.current)},[]),I(()=>{if(!U)return;let e=window.setTimeout(()=>W(``),4200);return()=>window.clearTimeout(e)},[U]);let Te=ie(()=>{if(!G)return{width:1,height:1};if(!H)return{width:G.width,height:G.height};let e=Math.max(1,Ce.width),t=Math.max(1,Ce.height),n=Math.min(e/G.width,t/G.height);return{width:Math.max(1,Math.floor(G.width*n)),height:Math.max(1,Math.floor(G.height*n))}},[H,G,Ce]),K=F(e=>{l.current=l.current.catch(()=>void 0).then(async()=>{let t=await fetch(`/api/remote-screen/control`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await X(t,`Computer control failed`))}).catch(e=>{W(e instanceof Error?e.message:`Computer control failed`)})},[]),q=F((e,t)=>{let n=a.current;if(!n||!G)return null;let r=n.getBoundingClientRect();return!r.width||!r.height?null:{x:Math.min(1,Math.max(0,(e-r.left)/r.width)),y:Math.min(1,Math.max(0,(t-r.top)/r.height))}},[G]),Ee=F(()=>{p.current=null;let e=f.current;f.current=null,!(!e||!G)&&K({action:`move`,displayId:G.id,...e})},[K,G]),De=e=>{if(!G||!E||e.button!==0)return;let t=q(e.clientX,e.clientY);t&&(e.preventDefault(),e.currentTarget.focus(),z&&!le&&B(!1),u.current=e.pointerId,e.currentTarget.setPointerCapture(e.pointerId),K({action:`down`,displayId:G.id,...t}))},Oe=e=>{if(!G||!E)return;let t=u.current===e.pointerId;if(!t&&e.pointerType===`touch`)return;let n=q(e.clientX,e.clientY);n&&(t&&e.preventDefault(),f.current=n,p.current===null&&(p.current=window.requestAnimationFrame(Ee)))},J=e=>{if(u.current!==e.pointerId||!G||!E)return;let t=q(e.clientX,e.clientY)??f.current??{x:0,y:0};e.preventDefault(),p.current!==null&&(window.cancelAnimationFrame(p.current),p.current=null,f.current=null),u.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId),K({action:`up`,displayId:G.id,...t})},ke=e=>{if(e.preventDefault(),!G||!E)return;let t=q(e.clientX,e.clientY);t&&K({action:`rightClick`,displayId:G.id,...t})},Ae=e=>{if(!G||!E)return;let t=q(e.clientX,e.clientY);t&&(e.preventDefault(),K({action:`scroll`,displayId:G.id,...t,dx:Math.max(-240,Math.min(240,e.deltaX)),dy:Math.max(-240,Math.min(240,e.deltaY))}))},je=async e=>{if(!E||!G||e.nativeEvent.isComposing||e.code.startsWith(`Shift`)||e.code.startsWith(`Control`)||e.code.startsWith(`Alt`)||e.code.startsWith(`Meta`))return;e.preventDefault();let t=[];e.shiftKey&&t.push(`ShiftLeft`),e.ctrlKey&&t.push(`ControlLeft`),e.altKey&&t.push(`AltLeft`),e.metaKey&&t.push(`MetaLeft`);try{let n=await fetch(`/api/keyboard`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({code:e.code,output:e.key.length===1?e.key:void 0,modifiers:t})});if(!n.ok)throw Error(await X(n,`Keyboard control failed`))}catch(e){W(e instanceof Error?e.message:`Keyboard control failed`)}},Me=async()=>{if(!g||g.platform===`unsupported`)return;let e=g.platform===`macos`;try{let t=await fetch(`/api/keyboard`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({code:`Escape`,modifiers:e?[`MetaLeft`,`AltLeft`]:[`ControlLeft`,`ShiftLeft`]})});if(!t.ok)throw Error(await X(t,`Unable to send the shortcut`));W(e?`Command + Option + Escape sent`:`Control + Shift + Escape sent`)}catch(e){W(e instanceof Error?e.message:`Unable to send the shortcut`)}},Ne=async()=>{try{document.fullscreenElement?await document.exitFullscreen():t.current&&(await t.current.requestFullscreen(),B(!1))}catch{W(`Full-screen mode is unavailable in this browser`)}},Pe=()=>{D(!0),k(`loading`),j(``),oe(e=>e+1)},Fe=(()=>{if(m===`detecting`)return N(Je,{icon:N(C,{className:`rsapp-spin`}),title:`Finding this computer’s displays`,description:`Checking the local macOS or Windows screen service.`});if(m===`error`)return N(Je,{icon:N(Be,{}),title:`Screen control unavailable`,description:y,action:`Try again`,onAction:()=>ee(e=>e+1)});if(!E)return N(Je,{icon:N(He,{}),title:`Screen sharing paused`,description:`Reconnect to view and control this computer again.`,action:`Reconnect`,onAction:Pe});if(ne===`error`){let e=g?.platform===`macos`&&/permission|record|denied|authoriz/i.test(A);return N(Je,{icon:N(Be,{}),title:e?`Screen Recording permission needed`:`The display is not available`,description:e?`${A} Allow Screen Recording for the app running Home Atom, then retry.`:A,action:`Retry capture`,onAction:()=>oe(e=>e+1)})}return ne===`live`?null:N(Je,{icon:N(C,{className:`rsapp-spin`}),title:`Opening ${G?.label??`display`}`,description:`Waiting for the first JPEG frame from this computer.`})})(),Y={width:`${Te.width}px`,height:`${Te.height}px`};return P(`div`,{ref:t,className:`rsapp-layer${z?` has-open-panel`:``}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`remote-screen-app-title`,children:[N(`h1`,{id:`remote-screen-app-title`,className:`rsapp-sr-only`,children:`Remote screen`}),P(`div`,{className:`rsapp-display-bar`,children:[N(`span`,{className:`rsapp-display-bar__mark`,"aria-hidden":`true`,children:N(_,{})}),P(`div`,{className:`rsapp-display-tabs`,role:`tablist`,"aria-label":`Displays on this computer`,children:[g?.displays.map(e=>{let t=G?.id===e.id;return P(`button`,{type:`button`,role:`tab`,id:`rsapp-display-${e.id}`,"aria-selected":t,"aria-controls":`rsapp-current-display`,className:t?`is-selected`:``,onClick:()=>{T(e.id),k(`loading`),j(``)},children:[N(_,{"aria-hidden":`true`}),N(`span`,{children:e.label}),P(`small`,{children:[e.width,`×`,e.height]})]},e.id)}),m===`detecting`&&P(`span`,{className:`rsapp-display-tabs__loading`,children:[N(C,{className:`rsapp-spin`}),`Detecting displays`]})]})]}),P(`main`,{ref:i,id:`rsapp-current-display`,className:`rsapp-stage${H?``:` is-native-size`}`,role:`tabpanel`,"aria-labelledby":G?`rsapp-display-${G.id}`:void 0,children:[N(`div`,{className:`rsapp-stage__sizer`,children:G&&N(`div`,{ref:a,className:`rsapp-screen${ve?` is-smooth`:` is-crisp`}${E?` is-connected`:``}`,style:Y,role:`application`,tabIndex:E?0:-1,"aria-label":`${G.label} remote desktop. Click to focus, then use the keyboard.`,onPointerDown:De,onPointerMove:Oe,onPointerUp:J,onPointerCancel:J,onContextMenu:ke,onWheel:Ae,onKeyDown:e=>void je(e),children:se&&N(`img`,{src:se,alt:``,draggable:!1})})}),Fe&&N(`div`,{className:`rsapp-stage__status`,children:Fe})]}),N(`button`,{type:`button`,className:`rsapp-panel-handle`,"aria-label":z?`Hide settings`:`Show settings`,"aria-expanded":z,onClick:()=>B(e=>!e),children:N(z?O:n,{})}),P(`aside`,{className:`rsapp-panel`,"aria-label":`Remote screen settings`,"aria-hidden":!z,inert:!z,children:[P(`header`,{className:`rsapp-panel__header`,children:[N(`button`,{ref:r,type:`button`,onClick:e,"aria-label":`Back to App store`,children:N(o,{})}),N(`button`,{type:`button`,"aria-label":le?`Unpin settings`:`Pin settings`,"aria-pressed":le,onClick:()=>ue(e=>!e),children:N(le?x:Ve,{})}),N(`button`,{type:`button`,"aria-label":`Hide settings`,onClick:()=>B(!1),children:N(w,{})})]}),P(`div`,{className:`rsapp-panel__actions`,children:[P(`button`,{type:`button`,onClick:()=>E?D(!1):Pe(),disabled:m!==`ready`,children:[N(E?Be:re,{}),N(`span`,{children:E?`Disconnect`:`Reconnect`})]}),P(`button`,{type:`button`,onClick:()=>void Ne(),children:[N(de?d:s,{}),N(`span`,{children:de?`Exit full-screen`:`Full-screen`})]})]}),P(`div`,{className:`rsapp-panel__scroll`,children:[P(Ke,{title:`Session options`,children:[N(qe,{id:`rsapp-scale-to-fit`,checked:H,title:`Scale to fit`,description:`Keep the whole local display visible`,onChange:pe}),N(qe,{id:`rsapp-high-density`,checked:me,title:`High-DPI mode`,description:`Request the display’s physical-pixel capture`,onChange:he}),N(qe,{id:`rsapp-resize-to-fit`,checked:!1,disabled:!0,title:`Resize to fit`,description:`${g?.hostName||`This computer`} keeps its current display resolution`,onChange:()=>void 0})]}),P(Ke,{title:`Video`,children:[P(`label`,{className:`rsapp-select-setting`,htmlFor:`rsapp-format`,children:[N(`strong`,{children:`Video codec`}),N(`select`,{id:`rsapp-format`,value:`jpeg`,disabled:!0,children:N(`option`,{value:`jpeg`,children:`JPEG`})}),N(`small`,{children:`The local screen service sends individual JPEG frames.`})]}),N(qe,{id:`rsapp-high-quality`,checked:ge,title:`High-quality color`,description:`Use a higher-quality JPEG for gradients and fine color`,onChange:_e}),P(`label`,{className:`rsapp-select-setting`,htmlFor:`rsapp-frame-rate`,children:[N(`strong`,{children:`Maximum frame rate`}),P(`select`,{id:`rsapp-frame-rate`,value:be,onChange:e=>xe(Number(e.target.value)),children:[N(`option`,{value:2,children:`2 FPS`}),N(`option`,{value:5,children:`5 FPS`}),N(`option`,{value:10,children:`10 FPS`})]}),N(`small`,{children:`Higher rates are more responsive but use more CPU and bandwidth.`})]}),N(qe,{id:`rsapp-smooth-scaling`,checked:ve,title:`Smooth scaling`,description:`Blend pixels when the display is shown at a smaller size`,onChange:ye})]}),P(Ke,{title:`Input controls`,children:[P(`div`,{className:`rsapp-input-help`,children:[N(Se,{"aria-hidden":`true`}),N(`span`,{children:`Click the desktop, then type. Drag, right-click, and wheel gestures are sent to this computer.`})]}),P(`button`,{type:`button`,className:`rsapp-shortcut`,disabled:!E||m!==`ready`,onClick:()=>void Me(),children:[N(V,{"aria-hidden":`true`}),P(`span`,{children:[`Press`,` `,g?.platform===`macos`?P(M,{children:[N(`kbd`,{children:`Cmd`}),` + `,N(`kbd`,{children:`Option`}),` + `,N(`kbd`,{children:`Esc`})]}):P(M,{children:[N(`kbd`,{children:`Ctrl`}),` + `,N(`kbd`,{children:`Shift`}),` + `,N(`kbd`,{children:`Esc`})]})]})]}),g?.platform===`windows`&&N(`p`,{className:`rsapp-secure-note`,children:`Windows reserves Ctrl + Alt + Del for the secure desktop, so a browser-hosted controller cannot send it.`})]})]})]}),U&&P(`div`,{className:`rsapp-toast`,role:`status`,children:[N(`span`,{children:U}),N(`button`,{type:`button`,"aria-label":`Dismiss message`,onClick:()=>W(``),children:N(w,{})})]})]})}var Xe={id:`keyboard`,name:`Keyboard, trackpad`,category:`Tools`,rating:`4.9`,icon:`keyboard`,gradient:`linear-gradient(145deg, #252b33 0%, #11151a 58%, #f06a4a 160%)`,description:`A complete interactive keyboard and trackpad that controls your computer remotely. Full keyboard, numpad, navigation, and precision trackpad — all in one app.`,size:`8.4 MB`,age:`Everyone`,featured:!0,launch:`keyboard`},Ze={id:`remote-screen`,name:`Remote Screen`,category:`Tools`,rating:`4.9`,icon:`monitor`,gradient:`linear-gradient(145deg, #eaf2ff 0%, #4f7bd9 52%, #182744 135%)`,description:`View and control this computer from another device with a responsive live screen, precise pointer input, and keyboard shortcuts for macOS and Windows.`,size:`10.8 MB`,age:`Everyone`,featured:!0,launch:`remote-screen`},Qe={id:`netflix`,name:`Netflix`,category:`Entertainment`,rating:`4.8`,icon:`netflix`,gradient:`linear-gradient(145deg, #241012 0%, #090909 64%, #e50914 180%)`,description:`Browse cinematic collections, search titles, build My List, and import movies into a local SQLite-backed library for playback at home.`,size:`36 MB`,age:`Teen`,featured:!0,route:`/netflix`},$e={id:`spotify`,name:`Spotify`,category:`Music & audio`,rating:`4.8`,icon:`spotify`,gradient:`linear-gradient(145deg, #30e978 0%, #169c4a 52%, #08180e 130%)`,description:`Explore playlists, search music, manage your library, and download supported tracks into a local SQLite-backed collection.`,size:`28 MB`,age:`Teen`,featured:!0,route:`/spotify`},Z={Phone:[Xe,Ze,Qe,$e,{id:`daylight`,name:`Daylight`,category:`Wellbeing & focus`,rating:`4.8`,icon:`sparkles`,gradient:`linear-gradient(145deg, #fff0b5 0%, #ffb774 52%, #ef6f6c 100%)`,description:`Make room for the things that matter with gentle routines, beautiful focus sessions, and a calmer daily rhythm.`,size:`24 MB`,age:`Everyone`,featured:!0},{id:`noted`,name:`Noted Calendar`,category:`Productivity`,rating:`4.6`,icon:`calendar`,gradient:`linear-gradient(145deg, #f8fafc 0%, #dce4ec 100%)`,description:`A thoughtfully simple calendar that brings tasks, notes, and your schedule into one peaceful view.`,size:`18 MB`,age:`Everyone`},{id:`sonora`,name:`Sonora`,category:`Music & audio`,rating:`4.7`,icon:`music`,gradient:`linear-gradient(145deg, #7457ff 0%, #4020c9 100%)`,description:`Find a new soundtrack for every mood with handpicked mixes and rich, room-filling sound.`,size:`42 MB`,age:`Teen`},{id:`sprout`,name:`Sprout Habit`,category:`Health & fitness`,rating:`4.5`,icon:`leaf`,gradient:`linear-gradient(145deg, #d9ffe8 0%, #46c985 100%)`,description:`Grow tiny habits into lasting change with friendly reminders and progress that feels rewarding.`,size:`16 MB`,age:`Everyone`},{id:`mindly`,name:`Mindly AI`,category:`Education`,rating:`4.8`,icon:`brain`,gradient:`linear-gradient(145deg, #d8f2ff 0%, #408bd5 100%)`,description:`Turn difficult ideas into visual explanations, quick quizzes, and learning plans built just for you.`,size:`31 MB`,age:`Everyone`},{id:`grain`,name:`Grain Camera`,category:`Photography`,rating:`4.4`,icon:`camera`,gradient:`linear-gradient(145deg, #ffd6de 0%, #c8466f 100%)`,description:`Capture warm, character-filled photos with tactile film controls and carefully made presets.`,size:`56 MB`,age:`Everyone`},{id:`circles`,name:`Circles`,category:`Social`,rating:`4.6`,icon:`message`,gradient:`linear-gradient(145deg, #baf5f0 0%, #0c978c 100%)`,description:`A friendly place for close-knit groups to share plans, photos, and the little moments in between.`,size:`38 MB`,age:`Teen`},{id:`kindred`,name:`Kindred`,category:`Lifestyle`,rating:`4.9`,icon:`heart`,gradient:`linear-gradient(145deg, #ffe5f3 0%, #dd6fa9 100%)`,description:`Keep the people you love close with shared memories, thoughtful prompts, and private spaces.`,size:`29 MB`,age:`Teen`}],Tablet:[Xe,Ze,Qe,$e,{id:`canvas`,name:`Canvas Studio`,category:`Art & design`,rating:`4.7`,icon:`palette`,gradient:`linear-gradient(145deg, #ffe2bc 0%, #ea6a47 100%)`,description:`A spacious digital studio with natural brushes, flexible layers, and powerful creative tools.`,size:`112 MB`,age:`Everyone`,featured:!0},{id:`folio`,name:`Folio Reader`,category:`Books & reference`,rating:`4.8`,icon:`book`,gradient:`linear-gradient(145deg, #d8efff 0%, #5f85e8 100%)`,description:`A beautiful home for books, essays, and PDFs, designed for comfortable long-form reading.`,size:`35 MB`,age:`Everyone`},{id:`orbit`,name:`Orbit Browser`,category:`Tools`,rating:`4.5`,icon:`globe`,gradient:`linear-gradient(145deg, #d7fff8 0%, #218e9f 100%)`,description:`Browse with focus using clean workspaces, synced tabs, and privacy that is easy to understand.`,size:`48 MB`,age:`Everyone`},{id:`tempo`,name:`Tempo Notes`,category:`Productivity`,rating:`4.6`,icon:`wand`,gradient:`linear-gradient(145deg, #ede2ff 0%, #8155cf 100%)`,description:`Sketch ideas, arrange research, and turn rough notes into polished plans on a limitless canvas.`,size:`27 MB`,age:`Everyone`},{id:`drift`,name:`Drift Weather`,category:`Weather`,rating:`4.7`,icon:`cloud`,gradient:`linear-gradient(145deg, #e1f5ff 0%, #4da4ed 100%)`,description:`Beautiful local forecasts, live rain maps, and clear answers for every plan you make.`,size:`22 MB`,age:`Everyone`},{id:`sonora-tablet`,name:`Sonora`,category:`Music & audio`,rating:`4.7`,icon:`headphones`,gradient:`linear-gradient(145deg, #7457ff 0%, #4020c9 100%)`,description:`Find a new soundtrack for every mood with handpicked mixes and rich, room-filling sound.`,size:`42 MB`,age:`Teen`}]},Q=[{id:`lumen`,name:`Lumen AI`,category:`Productivity`,rating:`4.8`,icon:`wand`,gradient:`linear-gradient(145deg, #f1d8ff 0%, #9844d2 100%)`,description:`Write, organize, and explore new ideas with an assistant that stays out of your way.`,size:`26 MB`,age:`Everyone`},{id:`echo`,name:`Echo Translate`,category:`Travel & local`,rating:`4.7`,icon:`globe`,gradient:`linear-gradient(145deg, #d5f7ff 0%, #2b86c8 100%)`,description:`Natural voice translation and useful local phrases for conversations wherever you go.`,size:`33 MB`,age:`Everyone`},{id:`clearspace`,name:`Clearspace`,category:`Tools`,rating:`4.6`,icon:`shield`,gradient:`linear-gradient(145deg, #dff9e8 0%, #3eaf6d 100%)`,description:`A private, thoughtful assistant that helps you tidy files, photos, and everyday digital clutter.`,size:`19 MB`,age:`Everyone`},{id:`storyloom`,name:`Storyloom`,category:`Entertainment`,rating:`4.9`,icon:`book`,gradient:`linear-gradient(145deg, #ffe3c0 0%, #ee8251 100%)`,description:`Create illustrated bedtime stories and imaginative adventures for the whole family.`,size:`44 MB`,age:`Everyone`},{id:`wave`,name:`Wave Studio`,category:`Music & audio`,rating:`4.5`,icon:`music`,gradient:`linear-gradient(145deg, #cfe8ff 0%, #3d55b8 100%)`,description:`Clean up recordings, shape your sound, and share studio-quality audio from anywhere.`,size:`51 MB`,age:`Everyone`},{id:`muse`,name:`Muse Camera`,category:`Photography`,rating:`4.7`,icon:`camera`,gradient:`linear-gradient(145deg, #fff0da 0%, #e58b3d 100%)`,description:`A pocket creative director for better portraits, lighting, and memorable compositions.`,size:`62 MB`,age:`Everyone`}],et=[Xe,Ze,Qe,$e,Q[0],Z.Phone.find(({id:e})=>e===`mindly`),Q[1]],tt={sparkles:b,calendar:ce,music:pe,leaf:fe,brain:se,camera:z,message:H,heart:f,book:oe,globe:ue,wand:ve,cloud:le,headphones:de,palette:me,shield:he,keyboard:V,monitor:_,play:k},nt=[{label:`Phone`,icon:v},{label:`Tablet`,icon:h},{label:`TV`,icon:_e},{label:`Chromebook`,icon:g},{label:`Watch`,icon:ye},{label:`Car`,icon:B},{label:`XR headset`,icon:_}],rt={keyboard:`/icons/keyboard.ico`,"remote-screen":`/icons/remote-screen.ico`},it=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex='-1'])`].join(`,`);function at(e,t,n,r){I(()=>{let i=e.current;if(!i)return;let a=r?.current??(document.activeElement instanceof HTMLElement?document.activeElement:null),o=Array.from(document.querySelectorAll(`.topbar, main, .site-footer`)),s=o.map(e=>e.inert);o.forEach(e=>{e.inert=!0}),document.body.classList.add(`modal-open`);let c=window.requestAnimationFrame(()=>{(n?.current??i.querySelector(it))?.focus()}),l=e=>{if(e.key===`Escape`){e.preventDefault(),t();return}if(e.key!==`Tab`)return;let n=Array.from(i.querySelectorAll(it)).filter(e=>!e.hidden);if(!n.length){e.preventDefault();return}let r=n[0],a=n[n.length-1];e.shiftKey&&document.activeElement===r?(e.preventDefault(),a.focus()):!e.shiftKey&&document.activeElement===a?(e.preventDefault(),r.focus()):i.contains(document.activeElement)||(e.preventDefault(),r.focus())};return document.addEventListener(`keydown`,l),()=>{window.cancelAnimationFrame(c),document.removeEventListener(`keydown`,l),o.forEach((e,t)=>{e.inert=s[t]}),document.body.classList.remove(`modal-open`),a?.focus()}},[n,t,r,e])}function ot(){return P(`div`,{className:`play-logo`,"aria-label":`Google Play`,children:[P(`svg`,{"aria-hidden":`true`,className:`play-mark`,viewBox:`0 0 40 44`,xmlns:`http://www.w3.org/2000/svg`,children:[N(`path`,{d:`M3.2 2.2 23 22 3.2 41.8A5.1 5.1 0 0 1 1 37.6V6.4c0-1.7.8-3.2 2.2-4.2Z`,fill:`#23c56e`}),N(`path`,{d:`m23 22 6.4-6.4 7.8 4.5c2.4 1.4 2.4 3.5 0 4.9l-7.8 4.5L23 22Z`,fill:`#ffc928`}),N(`path`,{d:`M3.2 2.2A5 5 0 0 1 8.5 2l20.9 12.1L23 22 3.2 2.2Z`,fill:`#45a6ff`}),N(`path`,{d:`M3.2 41.8 23 22l6.4 7.5L8.5 41.9c-2 1.1-3.8 1-5.3-.1Z`,fill:`#f34b4b`})]}),P(`span`,{children:[N(`span`,{className:`google-word`,children:`Google`}),` Play`]})]})}function $({app:e,small:t=!1}){let n=e.icon===`netflix`||e.icon===`spotify`?null:tt[e.icon];return P(`div`,{className:`app-icon${t?` app-icon--small`:``}`,style:{background:e.gradient},"aria-hidden":`true`,children:[n&&N(n,{strokeWidth:1.8}),e.icon===`netflix`&&N(`span`,{className:`netflix-icon-mark`,children:`N`}),e.icon===`spotify`&&P(`span`,{className:`spotify-icon-mark`,children:[N(`i`,{}),N(`i`,{}),N(`i`,{})]}),N(`span`,{className:`icon-shine`})]})}function st({value:e}){return P(`span`,{className:`rating`,children:[e,` `,N(ge,{"aria-hidden":`true`,size:10,fill:`currentColor`})]})}function ct({app:e,onOpen:t}){return P(`button`,{className:`app-card`,onClick:()=>t(e),type:`button`,children:[N($,{app:e}),N(`span`,{className:`app-card__name`,children:e.name}),N(`span`,{className:`app-card__category`,children:e.category}),N(st,{value:e.rating})]})}function lt({apps:e,onOpen:t,ariaLabel:n}){let r=L(null),i=e=>{r.current?.scrollBy({left:e*640,behavior:`smooth`})};return P(`div`,{className:`rail-shell`,children:[N(`button`,{className:`rail-arrow rail-arrow--left`,type:`button`,"aria-label":`Scroll ${n} left`,onClick:()=>i(-1),children:N(o,{size:20})}),N(`div`,{className:`app-rail`,ref:r,"aria-label":n,children:e.map(e=>N(ct,{app:e,onOpen:t},e.id))}),N(`button`,{className:`rail-arrow rail-arrow--right`,type:`button`,"aria-label":`Scroll ${n} right`,onClick:()=>i(1),children:N(ee,{size:20})})]})}function ut({variant:e,eyebrow:t,title:n,subtitle:r,app:i,onOpen:a}){return P(`article`,{className:`promo-card promo-card--${e}`,children:[P(`div`,{className:`promo-art`,"aria-hidden":`true`,children:[N(`span`,{className:`promo-orb promo-orb--one`}),N(`span`,{className:`promo-orb promo-orb--two`}),e===`green`&&P(M,{children:[N(`span`,{className:`field-line field-line--one`}),N(`span`,{className:`field-line field-line--two`}),N(`span`,{className:`field-ball`,children:`⚽`})]}),e===`plum`&&P(M,{children:[N(`span`,{className:`picnic-sun`}),N(`span`,{className:`picnic-blanket`}),N(`span`,{className:`picnic-item picnic-item--one`,children:`🍊`}),N(`span`,{className:`picnic-item picnic-item--two`,children:`🥤`})]}),e===`blue`&&P(M,{children:[N(`span`,{className:`score-ring`}),N(`span`,{className:`score-card`,children:`3–2`}),N(`span`,{className:`score-ball`,children:`⚽`})]})]}),N(`span`,{className:`promo-eyebrow`,children:t}),P(`div`,{className:`promo-copy`,children:[N(`h3`,{children:n}),N(`p`,{children:r})]}),P(`div`,{className:`promo-app`,children:[N($,{app:i,small:!0}),P(`span`,{children:[N(`strong`,{children:i.name}),N(`small`,{children:i.category})]}),N(`button`,{type:`button`,"aria-label":`View details for ${i.name}`,onClick:()=>a(i),children:`View`})]})]})}function dt({app:e,variant:t,onOpen:n}){return P(`button`,{className:`feature-card feature-card--${t}`,type:`button`,onClick:()=>n(e),children:[P(`span`,{className:`feature-card__badge`,children:[N(b,{size:14}),` AI-powered`]}),P(`span`,{className:`feature-card__art`,"aria-hidden":`true`,children:[P(`span`,{className:`feature-phone`,children:[N($,{app:e,small:!0}),N(`span`,{}),N(`span`,{}),N(`span`,{})]}),N(`span`,{className:`feature-spark feature-spark--one`,children:`✦`}),N(`span`,{className:`feature-spark feature-spark--two`,children:`✦`})]}),P(`span`,{className:`feature-card__copy`,children:[N(`strong`,{children:e.name}),N(`small`,{children:e.description})]})]})}function ft({app:e,onClose:t,onLaunch:n}){let[r,i]=R(`idle`),a=L(null),o=L(null),s=L(null);at(a,t,o),I(()=>()=>{s.current&&window.clearTimeout(s.current)},[]);let c=()=>{r===`idle`&&(i(`installing`),s.current=window.setTimeout(()=>i(`installed`),1100))},l=!!(e.launch||e.route);return N(`div`,{className:`modal-backdrop`,role:`presentation`,onMouseDown:t,children:P(`section`,{ref:a,className:`app-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`app-modal-title`,onMouseDown:e=>e.stopPropagation(),children:[N(`button`,{ref:o,className:`modal-close`,onClick:t,type:`button`,"aria-label":`Close`,children:N(w,{size:21})}),P(`div`,{className:`modal-hero`,children:[N($,{app:e}),P(`div`,{children:[N(`span`,{className:`modal-kicker`,children:`Featured app`}),N(`h2`,{id:`app-modal-title`,children:e.name}),N(`p`,{children:e.category})]})]}),P(`div`,{className:`modal-stats`,children:[P(`span`,{children:[P(`strong`,{children:[e.rating,` ★`]}),N(`small`,{children:`12K reviews`})]}),P(`span`,{children:[N(`strong`,{children:e.size}),N(`small`,{children:`Download size`})]}),P(`span`,{children:[N(`strong`,{children:e.age}),N(`small`,{children:`Content rating`})]})]}),P(`button`,{className:`install-button${l?` install-button--open`:` install-button--${r}`}`,onClick:l?()=>n(e):c,type:`button`,disabled:!l&&r!==`idle`,"aria-busy":!l&&r===`installing`,children:[l&&P(M,{children:[e.launch===`keyboard`?N(V,{size:18}):e.launch===`remote-screen`?N(_,{size:18}):N(k,{size:18,fill:`currentColor`}),` `,`Open app`]}),!l&&r===`idle`&&`Install`,!l&&r===`installing`&&N(`span`,{className:`installing-label`,children:`Installing`}),!l&&r===`installed`&&P(M,{children:[N(E,{size:18}),` Installed`]})]}),P(`div`,{className:`modal-gallery`,"aria-hidden":`true`,children:[N(`span`,{}),N(`span`,{}),N(`span`,{})]}),N(`h3`,{children:`About this app`}),N(`p`,{className:`modal-description`,children:e.description}),N(`p`,{className:`demo-note`,children:`This is an original demo listing created for the storefront recreation.`})]})})}function pt({query:e,results:t,onQueryChange:n,onClose:r,onSelect:i,restoreFocusRef:a}){let o=L(null),s=L(null);return at(o,r,s,a),P(`div`,{className:`search-layer`,role:`dialog`,"aria-modal":`true`,"aria-label":`Search Google Play`,ref:o,children:[P(`div`,{className:`search-panel`,children:[N(T,{"aria-hidden":`true`}),N(`input`,{ref:s,value:e,onChange:e=>n(e.target.value),placeholder:`Search apps & games`,"aria-label":`Search apps and games`}),N(`button`,{type:`button`,onClick:r,"aria-label":`Close search`,children:N(w,{})})]}),P(`div`,{className:`search-results`,children:[N(`span`,{className:`search-label`,"aria-live":`polite`,children:e?`${t.length} results`:`Popular searches`}),t.map(e=>P(`button`,{type:`button`,onClick:()=>i(e),children:[N($,{app:e,small:!0}),P(`span`,{children:[N(`strong`,{children:e.name}),N(`small`,{children:e.category})]}),N(O,{})]},e.id)),t.length===0&&N(`p`,{className:`empty-results`,children:`No matches yet. Try “music” or “productivity”.`})]})]})}function mt(){let t=e(),[n,r]=R(`Phone`),[a,o]=R([]),[s,c]=R(null),[l,u]=R(null),[d,p]=R(null),[m,h]=R(!1),[g,_]=R(``),[v,y]=R(``),b=L(null),x=Z[n]??Z.Phone.map(e=>e.launch?e:{...e,id:`${n.toLowerCase()}-${e.id}`}),te=ie(()=>{let e=[...Z.Phone,...Z.Tablet,...Q];return e.filter((t,n)=>e.findIndex(e=>e.name===t.name)===n)},[]),C=g.trim()?te.filter(e=>`${e.name} ${e.category}`.toLowerCase().includes(g.trim().toLowerCase())):te.slice(0,5),w=F(()=>{h(!1),_(``)},[]),E=F(()=>p(null),[]);I(()=>{if(!d)return;let e=document.createElement(`link`);return e.rel=`icon`,e.type=`image/x-icon`,e.href=rt[d],e.dataset.homeAtomAppIcon=d,document.head.appendChild(e),()=>e.remove()},[d]);let D=F(async e=>{try{let t=await fetch(`/api/netflix/profiles`,{cache:`no-store`,signal:e});if(!t.ok)return;let n=await t.json(),r=Array.isArray(n.profiles)?n.profiles:[],i=n.activeProfile&&r.some(e=>e.id===n.activeProfile?.id)?n.activeProfile:r[0]??null;o(r),c(i)}catch{}},[]),ne=F(async e=>{let t=await fetch(`/api/netflix/profiles/${encodeURIComponent(e.id)}/select`,{method:`POST`});if(!t.ok)throw Error(`Profile could not be selected.`);let n=await t.json();c(n.activeProfile??e)},[]),k=F(async(e,t)=>{o(e),c(t)},[]),A=(e=``)=>{b.current=document.activeElement instanceof HTMLElement?document.activeElement:null,_(e),h(!0)};return I(()=>{if(!v)return;let e=window.setTimeout(()=>y(``),2600);return()=>window.clearTimeout(e)},[v]),I(()=>{let e=new AbortController,t=()=>void D(e.signal),n=()=>{document.visibilityState===`visible`&&t()},r=window.requestAnimationFrame(t),i=window.setInterval(t,3e3);return window.addEventListener(`focus`,t),document.addEventListener(`visibilitychange`,n),()=>{e.abort(),window.cancelAnimationFrame(r),window.clearInterval(i),window.removeEventListener(`focus`,t),document.removeEventListener(`visibilitychange`,n)}},[D]),P(`div`,{className:`site-shell`,children:[N(`header`,{className:`topbar`,children:P(`div`,{className:`topbar__inner`,children:[N(`a`,{className:`brand-link`,href:`#top`,"aria-label":`Google Play home`,children:N(ot,{})}),N(`nav`,{className:`main-nav`,children:[`Games`,`Apps`,`Movies & TV`,`Books`,`Kids`].map(e=>N(`a`,{href:e===`Apps`?`#apps`:`#${e.toLowerCase().replaceAll(` `,`-`)}`,className:e===`Apps`?`active`:``,"aria-current":e===`Apps`?`page`:void 0,onClick:t=>{e!==`Apps`&&(t.preventDefault(),y(`${e} is outside this Apps storefront demo.`))},children:e},e))}),P(`div`,{className:`top-actions`,children:[N(`button`,{type:`button`,"aria-label":`Search`,onClick:()=>A(),children:N(T,{})}),N(`button`,{type:`button`,"aria-label":`Help`,onClick:()=>y(`Help Center preview — this storefront is a UI demo.`),children:N(i,{})}),s&&N(S,{profiles:a,activeProfile:s,onSelectProfile:ne,onProfilesChanged:k})]})]})}),m&&N(pt,{query:g,results:C,onQueryChange:_,onClose:w,onSelect:e=>{w(),window.setTimeout(()=>u(e),0)},restoreFocusRef:b}),P(`main`,{id:`top`,children:[N(`h1`,{className:`sr-only`,children:`Apps on Google Play`}),N(`section`,{className:`store-container device-section`,"aria-label":`Choose a device`,children:N(`div`,{className:`device-tabs`,children:nt.map(({label:e,icon:t})=>P(`button`,{type:`button`,className:n===e?`active`:``,"aria-pressed":n===e,onClick:()=>r(e),children:[N(t,{size:17}),e]},e))})}),N(ze,{profiles:a,activeProfileId:s?.id??``},s?.id??`no-netflix-profile`),P(`section`,{className:`store-container first-section`,id:`apps`,children:[P(`div`,{className:`section-heading`,children:[P(`div`,{children:[P(`h2`,{children:[`Discover apps for `,n.toLowerCase()]}),N(`p`,{children:`Fresh finds picked to make every day a little better`})]}),N(`button`,{className:`view-more`,type:`button`,"aria-label":`View more apps`,onClick:()=>A(),children:N(O,{})})]}),N(lt,{apps:x,ariaLabel:`Apps for ${n}`,onOpen:u})]}),P(`section`,{className:`store-container editorial-section`,children:[N(`div`,{className:`section-heading section-heading--simple`,children:P(`h2`,{children:[N(be,{size:23,fill:`currentColor`}),` Catch the buzz`]})}),P(`div`,{className:`promo-rail`,children:[N(ut,{variant:`green`,eyebrow:`Trending`,title:`Find your next pickup game`,subtitle:`Meet local players and get moving`,app:Z.Phone.find(({id:e})=>e===`sprout`),onOpen:u}),N(ut,{variant:`plum`,eyebrow:`Editor’s pick`,title:`The art of picnic-core`,subtitle:`Curate a softer kind of weekend`,app:Z.Phone.find(({id:e})=>e===`kindred`),onOpen:u}),N(ut,{variant:`blue`,eyebrow:`Live now`,title:`Score big on match day`,subtitle:`Follow every moment together`,app:Z.Phone.find(({id:e})=>e===`circles`),onOpen:u})]})]}),P(`section`,{className:`store-container ai-section`,children:[P(`div`,{className:`section-heading`,children:[P(`div`,{children:[N(`h2`,{children:`Do more with AI apps`}),N(`p`,{children:`Helpful tools for ideas, answers, and everyday tasks`})]}),N(`button`,{className:`view-more`,type:`button`,"aria-label":`View more AI apps`,onClick:()=>A(`AI`),children:N(O,{})})]}),N(`div`,{className:`feature-grid`,children:Q.slice(0,3).map((e,t)=>N(dt,{app:e,variant:t+1,onOpen:u},e.id))})]}),P(`section`,{className:`store-container charts-section`,children:[P(`div`,{className:`section-heading`,children:[P(`div`,{children:[N(`h2`,{children:`Popular apps`}),N(`p`,{children:`What everyone is downloading right now`})]}),N(`button`,{className:`view-more`,type:`button`,"aria-label":`View popular apps`,onClick:()=>A(),children:N(O,{})})]}),N(`div`,{className:`charts-grid`,children:et.map((e,t)=>P(`button`,{type:`button`,className:`chart-row`,onClick:()=>u(e),children:[N(`span`,{className:`chart-number`,children:t+1}),N($,{app:e,small:!0}),P(`span`,{className:`chart-copy`,children:[N(`strong`,{children:e.name}),N(`small`,{children:e.category}),N(st,{value:e.rating})]}),N(O,{size:18})]},`${e.id}-${t}`))})]}),N(`section`,{className:`store-container moments-section`,children:P(`div`,{className:`moments-banner`,children:[P(`div`,{className:`moments-copy`,children:[N(`span`,{className:`moments-kicker`,children:`Made for the moment`}),N(`h2`,{children:`Small apps. Big summer energy.`}),N(`p`,{children:`Plan a spontaneous day out, capture the good bits, and keep your favorite people in the loop.`}),P(`button`,{type:`button`,onClick:()=>u(Q[5]),children:[`Explore the collection `,N(ee,{size:18})]})]}),P(`div`,{className:`moments-art`,"aria-hidden":`true`,children:[N(`span`,{className:`sun-disc`}),N(`span`,{className:`postcard postcard--one`,children:N(z,{})}),N(`span`,{className:`postcard postcard--two`,children:N(f,{})}),N(`span`,{className:`postcard postcard--three`,children:N(pe,{})})]})]})}),P(`section`,{className:`store-container final-rail-section`,children:[P(`div`,{className:`section-heading`,children:[P(`div`,{children:[N(`h2`,{children:`Tools worth trying`}),N(`p`,{children:`Handy helpers, creative companions, and smart little upgrades`})]}),N(`button`,{className:`view-more`,type:`button`,"aria-label":`View more tools`,onClick:()=>A(`Tools`),children:N(O,{})})]}),N(lt,{apps:Q,ariaLabel:`Tools worth trying`,onOpen:u})]})]}),P(`footer`,{className:`site-footer`,children:[P(`div`,{className:`store-container footer-grid`,children:[P(`div`,{children:[N(`h3`,{children:`Google Play`}),N(`a`,{href:`#play-pass`,children:`Play Pass`}),N(`a`,{href:`#play-points`,children:`Play Points`}),N(`a`,{href:`#gift-cards`,children:`Gift cards`}),N(`a`,{href:`#redeem`,children:`Redeem`}),N(`a`,{href:`#refund`,children:`Refund policy`})]}),P(`div`,{children:[N(`h3`,{children:`Kids & family`}),N(`a`,{href:`#parent-guide`,children:`Parent Guide`}),N(`a`,{href:`#family-sharing`,children:`Family sharing`})]}),P(`div`,{className:`footer-note`,children:[N(ot,{}),N(`p`,{children:`A handcrafted interface study built with Next.js. Product names and listings are original demo content.`})]})]}),P(`div`,{className:`store-container footer-bottom`,children:[P(`div`,{children:[N(`a`,{href:`#terms`,children:`Terms of Service`}),N(`a`,{href:`#privacy`,children:`Privacy`}),N(`a`,{href:`#about`,children:`About Google Play`}),N(`a`,{href:`#developers`,children:`Developers`})]}),P(`button`,{type:`button`,onClick:()=>y(`Region selector preview — United States (English)`),children:[N(ue,{size:17}),` United States (English)`]})]})]}),l&&N(ft,{app:l,onClose:()=>u(null),onLaunch:e=>{u(null),e.route?t.push(e.route):e.launch&&p(e.launch)}}),d===`keyboard`&&N(Me,{onClose:E}),d===`remote-screen`&&N(Ye,{onClose:E}),N(`div`,{className:`notice-toast${v?` notice-toast--show`:``}`,role:`status`,children:v})]})}export{mt as Storefront};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|