From a294779f0006f7f821a7c0a19173b16eec4457d9 Mon Sep 17 00:00:00 2001 From: Scott Duffey Date: Sun, 21 Apr 2024 23:05:56 +0900 Subject: [PATCH] Update dist file --- dist/spicetify-playlist-labels.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/spicetify-playlist-labels.js b/dist/spicetify-playlist-labels.js index c59843a..8086109 100644 --- a/dist/spicetify-playlist-labels.js +++ b/dist/spicetify-playlist-labels.js @@ -1,3 +1,3 @@ -!async function(){for(;!Spicetify.React||!Spicetify.ReactDOM;)await new Promise(t=>setTimeout(t,10));var n,o,i,c,a,p,l,u,y,r,s,f,m,N,_,z,d,D,t,e,v,b,h,w,g,k,P,x,S,L,E,O,I,B;n=Object.create,o=Object.defineProperty,i=Object.defineProperties,c=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyDescriptors,p=Object.getOwnPropertyNames,l=Object.getOwnPropertySymbols,u=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,s=(t,e,i)=>e in t?o(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,f=(t,e)=>{for(var i in e=e||{})y.call(e,i)&&s(t,i,e[i]);if(l)for(var i of l(e))r.call(e,i)&&s(t,i,e[i]);return t},m=(t,e)=>i(t,a(e)),z=(N=(t,e)=>function(){return e||(0,t[p(t)[0]])((e={exports:{}}).exports,e),e.exports})({"external-global-plugin:react-dom"(t,e){e.exports=Spicetify.ReactDOM}}),d=(_=(t,e,i)=>{i=null!=t?n(u(t)):{};var a=!e&&t&&t.__esModule?i:o(i,"default",{value:t,enumerable:!0}),l=t,r=void 0,s=void 0;if(l&&"object"==typeof l||"function"==typeof l)for(let t of p(l))y.call(a,t)||t===r||o(a,t,{get:()=>l[t],enumerable:!(s=c(l,t))||s.enumerable});return a})(N({"external-global-plugin:react"(t,e){e.exports=Spicetify.React}})()),D=_(z()),b=[],h=[],k=g=!(w={}),S=0,L=1,E="56px",O=x=P=v=e=t=null,I=Promise.resolve(),B=async function(){for(;null==Spicetify||!Spicetify.showNotification;)await new Promise(t=>setTimeout(t,100));O=document.querySelector(".Root__main-view"),k=await JSON.parse(localStorage.getItem("spicetify-playlist-labels:show-all")||"false");const e=t=>{t.then(t=>{w=t,g=!0,H()})};await Spicetify.Platform.LibraryAPI.getEvents().addListener("update",t=>{I=I.then(()=>async function(){var t=await R(),e=await j(t),i=await T(t);const a=[];i.forEach(t=>{a[t.uri]=t.items});var i={},l=e.filter(t=>t.isRatedPlaylist),e=e.filter(t=>!t.isRatedPlaylist),r=(await G()).items;return A(i,l,a),M(i,r),A(i,e,a),(l={}).likedTracks=r,await C(t,l),localStorage.setItem("spicetify-playlist-labels:liked-tracks-count",""+r.length),i}()),e(I)}),await Spicetify.Platform.PlaylistAPI.getEvents().addListener("operation_complete",t=>{I=I.then(()=>async function(t){var e=await R(),i=await j(e),a=await T(e);const l=[];a.forEach(t=>{l[t.uri]=t.items});var a=await q(t),r=(l[t]=a,{}),s=i.filter(t=>t.isRatedPlaylist),i=i.filter(t=>!t.isRatedPlaylist),n=l.likedTracks,o={};return o[t]=a,await C(e,o),A(r,s,l),M(r,n),A(r,i,l),r}(t.data.uri)),e(I)});var t=`${Spicetify.SVGIcons.spotify}`,t=(new Spicetify.Playbar.Button("Show All Saved Playlists",t,t=>{t.active=k=!t.active,localStorage.setItem("spicetify-playlist-labels:show-all",JSON.stringify(k)),g=!0,H()},!1,k),w=await J(),v=new MutationObserver(()=>{H()}),new MutationObserver(async()=>{await W()}));await W(),t.observe(document.body,{childList:!0,subtree:!0}),new ResizeObserver(t=>{F()}).observe(O)},(async()=>{await B()})();async function q(t){return(await Spicetify.Platform.PlaylistAPI.getContents(t)).items}async function G(){return Spicetify.Platform.LibraryAPI.getTracks({limit:Number.MAX_SAFE_INTEGER})}function U(t){let a=[],l=[];return function e(i,t){"playlist"===i.type?(t?l:a).push(i):"folder"===i.type&&i.items&&i.items.forEach(t=>e(t,"Rated"==i.name))}(t,!1),[a,l]}async function V(){const[t,i]=U(await Spicetify.Platform.RootlistAPI.getContents()),a=(await async function(){let t=[];var e;let i="https://api.spotify.com/v1/me/playlists";for(;i;)e=await Spicetify.CosmosAsync.get(i),t=t.concat(e.items),i=e.next;return t}()).reduce((t,e)=>(t[e.uri]=e.snapshot_id,t),{});let e=[...t,...i];return e=e.map(e=>m(f({},e),{snapshotId:a[e.uri],isRatedPlaylist:i.some(t=>t.uri===e.uri)}))}async function R(){return new Promise((e,i)=>{var t=indexedDB.open("spicetify-playlist-labels",1);t.onerror=t=>{i(t)},t.onupgradeneeded=t=>{t=t.target.result;t.createObjectStore("playlists",{keyPath:"uri"}),t.createObjectStore("playlistItems",{keyPath:"uri"})},t.onsuccess=t=>{e(t.target.result)}})}async function j(t){return new Promise((e,i)=>{const a=t.transaction("playlists").objectStore("playlists").getAll();a.onsuccess=t=>{e(a.result)},a.onerror=t=>{i(t)}})}async function T(t){return new Promise((e,i)=>{const a=t.transaction("playlistItems").objectStore("playlistItems").getAll();a.onsuccess=t=>{e(a.result)},a.onerror=t=>{i(t)}})}async function C(t,l){return new Promise((e,i)=>{const a=t.transaction("playlistItems","readwrite").objectStore("playlistItems");Object.entries(l).forEach(([t,e])=>{a.put({uri:t,items:e})}),a.transaction.oncomplete=t=>{e()},a.transaction.onerror=t=>{i(t)}})}function A(a,t,e){t.forEach(i=>{e[i.uri].forEach(t=>{var e=t.uri;a[e]||(a[e]=[]),a[e].some(t=>t.uri===i.uri)||a[e].push({uri:i.uri,name:i.name,trackUid:t.uid,image:(null==(e=i.images[0])?void 0:e.url)||"",isOwnPlaylist:i.isOwnedBySelf,isLikedTracks:!1})})})}function M(i,t){t.forEach(t=>{var e=t.uri;i[e]||(i[e]=[]),i[e].some(t=>t.isLikedTracks)||i[e].push({uri:null,name:"Liked Songs",trackUid:t.uid,image:"https://misc.scdn.co/liked-songs/liked-songs-300.png",isOwnPlaylist:!0,isLikedTracks:!0})})}async function J(){var t=await R();const i=await j(t);var e=await T(t),a=await V();const l=[],r=(a.forEach(e=>{var t=i.find(t=>t.uri===e.uri);t&&t.snapshotId===e.snapshotId||l.push(e)}),[]);e.forEach(t=>{r[t.uri]=t.items});e=await Promise.all(l.map(t=>q(t.uri)));const s={},n=(e.forEach((t,e)=>{e=l[e].uri;s[e]=t}),{});a.forEach(t=>{t=t.uri;s[t]?n[t]=s[t]:n[t]=r[t]}),n.likedTracks=r.likedTracks;var e=JSON.parse(localStorage.getItem("spicetify-playlist-labels:liked-tracks-count")||"0"),o=await(await Spicetify.Platform.LibraryAPI.getTracks()).totalLength;let c=n.likedTracks;c&&e==o||(c=(c=await G()).items,n.likedTracks=c);var p,u,y,f,e={},m=a.filter(t=>t.isRatedPlaylist),d=a.filter(t=>!t.isRatedPlaylist);return A(e,m,n),M(e,c),A(e,d,n),p=t,await new Promise((e,i)=>{var t=p.transaction("playlists","readwrite").objectStore("playlists").clear();t.onsuccess=t=>{e()},t.onerror=t=>{i(t)}}),u=t,await new Promise((e,i)=>{var t=u.transaction("playlistItems","readwrite").objectStore("playlistItems").clear();t.onsuccess=t=>{e()},t.onerror=t=>{i(t)}}),y=t,f=a,await new Promise((e,i)=>{const a=y.transaction("playlists","readwrite").objectStore("playlists");f.forEach(t=>{a.put(t)}),a.transaction.oncomplete=t=>{e()},a.transaction.onerror=t=>{i(t)}}),await C(t,n),localStorage.setItem("spicetify-playlist-labels:liked-tracks-count",""+o),e}function $(t){return t.match(/spotify:playlist:(.*)/)[1]}function F(){if(O){let e=L;var l="56px"==E?44:32,r=O.getBoundingClientRect();let i=0,a=516;i<=r.width&&r.width<=a&&(e=1);for(let t=1;t<19;t++)i=517+l*(t-1),a=517+l*t,i<=r.width&&r.width<=a&&(e=t+1);i=517+18*l,(e=i<=r.width?20:e)!==L&&(L=e,document.documentElement.style.setProperty("--spicetify-playlist-labels-max-label-count",""+L),g=!0,H())}}function H(){var t;h=b,b=Array.from(document.querySelectorAll(".main-trackList-indexable")),h.length===b.length&&h.every((t,e)=>t===b[e])||(S=0);for(const e of b){for(const l of e.getElementsByClassName("main-trackList-trackListRow")){var a=getComputedStyle(l).getPropertyValue("--row-height");a!=E&&(E=a,document.documentElement.style.setProperty("--spicetify-playlist-labels-size",`calc(${E} * 0.5)`),F(),g=!0);a=l,t=void 0;const r=(a=Object.values(a))?(null==(t=null==(a=null==(a=null==(a=null==(a=null==(a=a[0])?void 0:a.pendingProps)?void 0:a.children[0])?void 0:a.props)?void 0:a.children)?void 0:a.props)?void 0:t.uri)||(null==(t=null==(t=null==(t=null==a?void 0:a.props)?void 0:t.children)?void 0:t.props)?void 0:t.uri)||(null==(t=null==(t=null==(t=null==(t=null==(t=null==a?void 0:a.props)?void 0:t.children)?void 0:t.props)?void 0:t.children)?void 0:t.props)?void 0:t.uri)||(null==(a=null==(t=a[0])?void 0:t.props)?void 0:a.uri):null;P===r&&Spicetify.Platform.History.location.pathname===x&&(l.click(),P=null);let e=(null!=(t=w[r])?t:[]).filter(t=>{if(!k&&!t.isOwnPlaylist)return!1;if(t.isLikedTracks){if("/collection/tracks"===Spicetify.Platform.History.location.pathname)return!1}else{t=$(t.uri);if(Spicetify.Platform.History.location.pathname==="/playlist/"+t)return!1}return!0}),i=(e.length>S&&(S=e.length,document.documentElement.style.setProperty("--spicetify-playlist-labels-label-count",""+S)),l.querySelector(".spicetify-playlist-labels"));if(g&&i&&(i.remove(),i=null),!i){a=l.querySelector(".main-trackList-rowSectionEnd");(i=document.createElement("div")).classList.add("spicetify-playlist-labels");let t="spicetify-playlist-labels-labels-container";e.length>L&&(t+=" spicetify-playlist-labels-overflow"),e=e.slice(0,L),D.default.render(d.default.createElement("div",{className:t},e.map(e=>{if(!k&&!e.isOwnPlaylist)return null;if(e.isLikedTracks){if("/collection/tracks"===Spicetify.Platform.History.location.pathname)return null}else{var t=$(e.uri);if(Spicetify.Platform.History.location.pathname==="/playlist/"+t)return null}return d.default.createElement(Spicetify.ReactComponent.TooltipWrapper,{label:e.name,placement:"top"},d.default.createElement("div",null,d.default.createElement(Spicetify.ReactComponent.RightClickMenu,{placement:"bottom-end",menu:e.isLikedTracks?null:d.default.createElement(Spicetify.ReactComponent.Menu,null,d.default.createElement(Spicetify.ReactComponent.MenuItem,{leadingIcon:d.default.createElement(Spicetify.ReactComponent.IconComponent,{dangerouslySetInnerHTML:{__html:''},iconSize:16,style:{color:"var(--text-subdued)"}}),onClick:t=>{t.stopPropagation(),async function(t,e){await Spicetify.Platform.PlaylistAPI.remove(t,[{uri:e,uid:""}])}(e.uri,r),w[r]=w[r].filter(t=>t.uri!==e.uri),g=!0,H()}},"Remove from ",e.name))},d.default.createElement("div",{className:"spicetify-playlist-labels-label-container",style:{cursor:"pointer"},onClick:t=>{t.stopPropagation();t=e.isLikedTracks?"/collection/tracks":null==(t=Spicetify.URI.fromString(e.uri))?void 0:t.toURLPath(!0);P=r,(x=t)&&Spicetify.Platform.History.push({pathname:t,search:"?uid="+e.trackUid})}},d.default.createElement("img",{src:e.image})))))})),i),a.insertBefore(i,a.firstChild)}}g=!1}}async function W(){t=e,(e=document.querySelector("main"))&&!e.isEqualNode(t)&&(t&&v.disconnect(),H(),v.observe(e,{childList:!0,subtree:!0}))}(async()=>{var t;document.getElementById("spicetifyDplaylistDlabels")||((t=document.createElement("style")).id="spicetifyDplaylistDlabels",t.textContent=String.raw` +!async function(){for(;!Spicetify.React||!Spicetify.ReactDOM;)await new Promise(t=>setTimeout(t,10));var n,o,i,c,a,p,l,u,y,r,s,d,f,t,H,N,m,_,e,v,w,b,h,g,k,P,x,S,L,E,O,I,R,z;n=Object.create,o=Object.defineProperty,i=Object.defineProperties,c=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyDescriptors,p=Object.getOwnPropertyNames,l=Object.getOwnPropertySymbols,u=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable,s=(t,e,i)=>e in t?o(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,d=(t,e)=>{for(var i in e=e||{})y.call(e,i)&&s(t,i,e[i]);if(l)for(var i of l(e))r.call(e,i)&&s(t,i,e[i]);return t},f=(t,e)=>i(t,a(e)),N=(t=(t,e)=>function(){return e||(0,t[p(t)[0]])((e={exports:{}}).exports,e),e.exports})({"external-global-plugin:react-dom"(t,e){e.exports=Spicetify.ReactDOM}}),m=(H=(t,e,i)=>{i=null!=t?n(u(t)):{};var a=!e&&t&&t.__esModule?i:o(i,"default",{value:t,enumerable:!0}),l=t,r=void 0,s=void 0;if(l&&"object"==typeof l||"function"==typeof l)for(let t of p(l))y.call(a,t)||t===r||o(a,t,{get:()=>l[t],enumerable:!(s=c(l,t))||s.enumerable});return a})(t({"external-global-plugin:react"(t,e){e.exports=Spicetify.React}})()),_=H(N()),b=[],h=[],P=k=!(g={}),L=0,E=1,O="56px",I=S=x=w=v=e=null,R=Promise.resolve(),z=async function(){for(;null==Spicetify||!Spicetify.showNotification;)await new Promise(t=>setTimeout(t,100));I=document.querySelector(".Root__main-view"),P=await JSON.parse(localStorage.getItem("spicetify-playlist-labels:show-all")||"false");const e=t=>{t.then(t=>{g=t,k=!0,M()})};await Spicetify.Platform.LibraryAPI.getEvents().addListener("update",t=>{R=R.then(()=>async function(){var t=await j(),e=await V(t),i=await A(t);const a=[];i.forEach(t=>{a[t.uri]=t.items});var i={},l=(e=e.sort((t,e)=>new Date(t.addedAt)-new Date(e.addedAt))).filter(t=>t.isRatedPlaylist),e=e.filter(t=>!t.isRatedPlaylist),r=(await q()).items;return C(i,l,a),D(i,r),C(i,e,a),(l={}).likedTracks=r,await T(t,l),localStorage.setItem("spicetify-playlist-labels:liked-tracks-count",""+r.length),i}()),e(R)}),await Spicetify.Platform.PlaylistAPI.getEvents().addListener("operation_complete",t=>{R=R.then(()=>async function(t){var e=await j();let i=await U();var a=await A(e);const l=[];a.forEach(t=>{l[t.uri]=t.items});var a=await B(t),r=(l[t]=a,{}),s=(i=i.sort((t,e)=>new Date(t.addedAt)-new Date(e.addedAt))).filter(t=>t.isRatedPlaylist),n=i.filter(t=>!t.isRatedPlaylist),o=l.likedTracks,c={};return c[t]=a,await J(e,i),await T(e,c),C(r,s,l),D(r,o),C(r,n,l),r}(t.data.uri)),e(R)});var t=`${Spicetify.SVGIcons.spotify}`,t=(new Spicetify.Playbar.Button("Show All Saved Playlists",t,t=>{t.active=P=!t.active,localStorage.setItem("spicetify-playlist-labels:show-all",JSON.stringify(P)),k=!0,M()},!1,P),g=await $(),w=new MutationObserver(()=>{M()}),new MutationObserver(async()=>{await X()}));await X(),t.observe(document.body,{childList:!0,subtree:!0}),new ResizeObserver(t=>{W()}).observe(I)},(async()=>{await z()})();async function B(t){return(await Spicetify.Platform.PlaylistAPI.getContents(t)).items}async function q(){return Spicetify.Platform.LibraryAPI.getTracks({limit:Number.MAX_SAFE_INTEGER})}function G(t){let a=[],l=[];return function e(i,t){"playlist"===i.type?(t?l:a).push(i):"folder"===i.type&&i.items&&i.items.forEach(t=>e(t,"Rated"==i.name))}(t,!1),[a,l]}async function U(){const[t,i]=G(await Spicetify.Platform.RootlistAPI.getContents()),a=(await async function(){let t=[];var e;let i="https://api.spotify.com/v1/me/playlists";for(;i;)e=await Spicetify.CosmosAsync.get(i),t=t.concat(e.items),i=e.next;return t}()).reduce((t,e)=>(t[e.uri]=e.snapshot_id,t),{});let e=[...t,...i];return e=e.map(e=>f(d({},e),{snapshotId:a[e.uri],isRatedPlaylist:i.some(t=>t.uri===e.uri)}))}async function j(){return new Promise((e,i)=>{var t=indexedDB.open("spicetify-playlist-labels",1);t.onerror=t=>{i(t)},t.onupgradeneeded=t=>{t=t.target.result;t.createObjectStore("playlists",{keyPath:"uri"}),t.createObjectStore("playlistItems",{keyPath:"uri"})},t.onsuccess=t=>{e(t.target.result)}})}async function V(t){return new Promise((e,i)=>{const a=t.transaction("playlists").objectStore("playlists").getAll();a.onsuccess=t=>{e(a.result)},a.onerror=t=>{i(t)}})}async function A(t){return new Promise((e,i)=>{const a=t.transaction("playlistItems").objectStore("playlistItems").getAll();a.onsuccess=t=>{e(a.result)},a.onerror=t=>{i(t)}})}async function J(t,l){return new Promise((e,i)=>{const a=t.transaction("playlists","readwrite").objectStore("playlists");l.forEach(t=>{a.put(t)}),a.transaction.oncomplete=t=>{e()},a.transaction.onerror=t=>{i(t)}})}async function T(t,l){return new Promise((e,i)=>{const a=t.transaction("playlistItems","readwrite").objectStore("playlistItems");Object.entries(l).forEach(([t,e])=>{a.put({uri:t,items:e})}),a.transaction.oncomplete=t=>{e()},a.transaction.onerror=t=>{i(t)}})}function C(a,t,e){t.forEach(i=>{e[i.uri].forEach(t=>{var e=t.uri;a[e]||(a[e]=[]),a[e].some(t=>t.uri===i.uri)||a[e].push({uri:i.uri,name:i.name,trackUid:t.uid,image:(null==(e=i.images[0])?void 0:e.url)||"",isOwnPlaylist:i.isOwnedBySelf,isLikedTracks:!1})})})}function D(i,t){t.forEach(t=>{var e=t.uri;i[e]||(i[e]=[]),i[e].some(t=>t.isLikedTracks)||i[e].push({uri:null,name:"Liked Songs",trackUid:t.uid,image:"https://misc.scdn.co/liked-songs/liked-songs-300.png",isOwnPlaylist:!0,isLikedTracks:!0})})}async function $(){var t=await j();const i=await V(t);var e=await A(t);let a=await U();const l=[],r=(a.forEach(e=>{var t=i.find(t=>t.uri===e.uri);t&&t.snapshotId===e.snapshotId||l.push(e)}),[]);e.forEach(t=>{r[t.uri]=t.items});e=await Promise.all(l.map(t=>B(t.uri)));const s={},n=(e.forEach((t,e)=>{e=l[e].uri;s[e]=t}),{});a.forEach(t=>{t=t.uri;s[t]?n[t]=s[t]:n[t]=r[t]}),n.likedTracks=r.likedTracks;var e=JSON.parse(localStorage.getItem("spicetify-playlist-labels:liked-tracks-count")||"0"),o=await(await Spicetify.Platform.LibraryAPI.getTracks()).totalLength;let c=n.likedTracks;c&&e==o||(c=(c=await q()).items,n.likedTracks=c);var p,u,e={},y=(a=a.sort((t,e)=>new Date(t.addedAt)-new Date(e.addedAt))).filter(t=>t.isRatedPlaylist),d=a.filter(t=>!t.isRatedPlaylist);return C(e,y,n),D(e,c),C(e,d,n),p=t,await new Promise((e,i)=>{var t=p.transaction("playlists","readwrite").objectStore("playlists").clear();t.onsuccess=t=>{e()},t.onerror=t=>{i(t)}}),u=t,await new Promise((e,i)=>{var t=u.transaction("playlistItems","readwrite").objectStore("playlistItems").clear();t.onsuccess=t=>{e()},t.onerror=t=>{i(t)}}),await J(t,a),await T(t,n),localStorage.setItem("spicetify-playlist-labels:liked-tracks-count",""+o),e}function F(t){return t.match(/spotify:playlist:(.*)/)[1]}function W(){if(I){let e=E;var l="56px"==O?44:32,r=I.getBoundingClientRect();let i=0,a=516;i<=r.width&&r.width<=a&&(e=1);for(let t=1;t<19;t++)i=517+l*(t-1),a=517+l*t,i<=r.width&&r.width<=a&&(e=t+1);i=517+18*l,(e=i<=r.width?20:e)!==E&&(E=e,document.documentElement.style.setProperty("--spicetify-playlist-labels-max-label-count",""+E),k=!0,M())}}function M(){var t;h=b,b=Array.from(document.querySelectorAll(".main-trackList-indexable")),h.length===b.length&&h.every((t,e)=>t===b[e])||(L=0);for(const e of b){for(const l of e.getElementsByClassName("main-trackList-trackListRow")){var a=getComputedStyle(l).getPropertyValue("--row-height");a!=O&&(O=a,document.documentElement.style.setProperty("--spicetify-playlist-labels-size",`calc(${O} * 0.5)`),W(),k=!0);a=l,t=void 0;const r=(a=Object.values(a))?(null==(t=null==(a=null==(a=null==(a=null==(a=null==(a=a[0])?void 0:a.pendingProps)?void 0:a.children[0])?void 0:a.props)?void 0:a.children)?void 0:a.props)?void 0:t.uri)||(null==(t=null==(t=null==(t=null==a?void 0:a.props)?void 0:t.children)?void 0:t.props)?void 0:t.uri)||(null==(t=null==(t=null==(t=null==(t=null==(t=null==a?void 0:a.props)?void 0:t.children)?void 0:t.props)?void 0:t.children)?void 0:t.props)?void 0:t.uri)||(null==(a=null==(t=a[0])?void 0:t.props)?void 0:a.uri):null;x===r&&Spicetify.Platform.History.location.pathname===S&&(l.click(),x=null);let e=(null!=(t=g[r])?t:[]).filter(t=>{if(!P&&!t.isOwnPlaylist)return!1;if(t.isLikedTracks){if("/collection/tracks"===Spicetify.Platform.History.location.pathname)return!1}else{t=F(t.uri);if(Spicetify.Platform.History.location.pathname==="/playlist/"+t)return!1}return!0}),i=(e.length>L&&(L=e.length,document.documentElement.style.setProperty("--spicetify-playlist-labels-label-count",""+L)),l.querySelector(".spicetify-playlist-labels"));if(k&&i&&(i.remove(),i=null),!i){a=l.querySelector(".main-trackList-rowSectionEnd");(i=document.createElement("div")).classList.add("spicetify-playlist-labels");let t="spicetify-playlist-labels-labels-container";e.length>E&&(t+=" spicetify-playlist-labels-overflow"),e=e.slice(0,E),_.default.render(m.default.createElement("div",{className:t},e.map(e=>{if(!P&&!e.isOwnPlaylist)return null;if(e.isLikedTracks){if("/collection/tracks"===Spicetify.Platform.History.location.pathname)return null}else{var t=F(e.uri);if(Spicetify.Platform.History.location.pathname==="/playlist/"+t)return null}return m.default.createElement(Spicetify.ReactComponent.TooltipWrapper,{label:e.name,placement:"top"},m.default.createElement("div",null,m.default.createElement(Spicetify.ReactComponent.RightClickMenu,{placement:"bottom-end",menu:e.isLikedTracks?null:m.default.createElement(Spicetify.ReactComponent.Menu,null,m.default.createElement(Spicetify.ReactComponent.MenuItem,{leadingIcon:m.default.createElement(Spicetify.ReactComponent.IconComponent,{dangerouslySetInnerHTML:{__html:''},iconSize:16,style:{color:"var(--text-subdued)"}}),onClick:t=>{t.stopPropagation(),async function(t,e){await Spicetify.Platform.PlaylistAPI.remove(t,[{uri:e,uid:""}])}(e.uri,r),g[r]=g[r].filter(t=>t.uri!==e.uri),k=!0,M()}},"Remove from ",e.name))},m.default.createElement("div",{className:"spicetify-playlist-labels-label-container",style:{cursor:"pointer"},onClick:t=>{t.stopPropagation();t=e.isLikedTracks?"/collection/tracks":null==(t=Spicetify.URI.fromString(e.uri))?void 0:t.toURLPath(!0);x=r,(S=t)&&Spicetify.Platform.History.push({pathname:t,search:"?uid="+e.trackUid})}},m.default.createElement("img",{src:e.image})))))})),i),a.insertBefore(i,a.firstChild)}}k=!1}}async function X(){e=v,(v=document.querySelector("main"))&&!v.isEqualNode(e)&&(e&&w.disconnect(),M(),w.observe(v,{childList:!0,subtree:!0}))}(async()=>{var t;document.getElementById("spicetifyDplaylistDlabels")||((t=document.createElement("style")).id="spicetifyDplaylistDlabels",t.textContent=String.raw` :root{--spicetify-playlist-labels-size:28px;--spicetify-playlist-labels-gap:6px;--spicetify-playlist-labels-container-max-width:calc((var(--spicetify-playlist-labels-size) + var(--spicetify-playlist-labels-gap)) * var(--spicetify-playlist-labels-max-label-count, 1) + 16px);--spicetify-playlist-labels-container-width:min(var(--spicetify-playlist-labels-container-max-width), calc(var(--spicetify-playlist-labels-size) * var(--spicetify-playlist-labels-label-count, 1) + var(--spicetify-playlist-labels-gap) * calc(var(--spicetify-playlist-labels-label-count, 1) - 1)))}.spicetify-playlist-labels-labels-container{width:var(--spicetify-playlist-labels-container-width);height:var(--row-height);align-items:center;display:flex;flex-direction:row-reverse;overflow:hidden;gap:var(--spicetify-playlist-labels-gap);justify-content:flex-start;max-width:var(--spicetify-playlist-labels-container-max-width)}.spicetify-playlist-labels-labels-container:after{content:"\22ef";display:none;color:var(--text-base)}.spicetify-playlist-labels-labels-container.spicetify-playlist-labels-overflow:after{display:block}.spicetify-playlist-labels-label-container{position:relative;height:calc(var(--row-height) * .5)}.spicetify-playlist-labels-label-container>img{width:calc(var(--row-height) * .5);height:100%;-o-object-fit:cover;object-fit:cover;border-radius:calc(var(--row-height) * .5 * .1)}.main-trackList-trackList.main-trackList-indexable[aria-colcount="4"] .main-trackList-trackListRowGrid{grid-template-columns:[index] var(--tracklist-index-column-width,16px) [first] minmax(120px,var(--col1,4fr)) [var1] minmax(120px,var(--col2,2fr)) [last] calc(120px + var(--spicetify-playlist-labels-container-width) + 12px)!important}.main-trackList-trackList.main-trackList-indexable[aria-colcount="5"] .main-trackList-trackListRowGrid{grid-template-columns:[index] var(--tracklist-index-column-width,16px) [first] minmax(120px,var(--col1,6fr)) [var1] minmax(120px,var(--col2,4fr)) [var2] minmax(120px,var(--col3,3fr)) [last] calc(120px + var(--spicetify-playlist-labels-container-width) + 12px)!important}.main-trackList-trackList.main-trackList-indexable[aria-colcount="6"] .main-trackList-trackListRowGrid{grid-template-columns:[index] var(--tracklist-index-column-width,16px) [first] minmax(120px,var(--col1,6fr)) [var1] minmax(120px,var(--col2,4fr)) [var2] minmax(120px,var(--col3,3fr)) [var3] minmax(120px,var(--col4,2fr)) [last] calc(120px + var(--spicetify-playlist-labels-container-width) + 12px)!important} `.trim(),document.head.appendChild(t))})()}(); \ No newline at end of file