From 4193f5d5bcb940b845dcbbd5a4c9629185cfa9c7 Mon Sep 17 00:00:00 2001 From: Soufiane Sakhi Date: Sun, 16 Jul 2023 17:24:21 +0200 Subject: [PATCH] v2.9.0: Export, import and delete saved routes --- playlist-editor/src/App.svelte | 2 + .../src/components/PlaylistEditor.svelte | 6 +- playlist-editor/src/components/Sidebar.svelte | 1 + .../src/services/storage-service.ts | 40 +++++++++- playlist-editor/src/types/model.d.ts | 6 ++ playlist-editor/src/types/services.d.ts | 6 ++ playlist-editor/src/views/Manage.svelte | 77 +++++++++++++++++++ src/editor/bundle.css | 2 +- src/editor/main.js | 2 +- src/editor/storage-service.js | 2 +- src/manifest.json | 4 +- 11 files changed, 139 insertions(+), 9 deletions(-) create mode 100644 playlist-editor/src/views/Manage.svelte diff --git a/playlist-editor/src/App.svelte b/playlist-editor/src/App.svelte index 4e69262..9bb9894 100644 --- a/playlist-editor/src/App.svelte +++ b/playlist-editor/src/App.svelte @@ -4,6 +4,7 @@ import New from "./views/New.svelte"; import Recent from "./views/Recent.svelte"; import Saved from "./views/Saved.svelte"; + import Manage from "./views/Manage.svelte"; const routes = { "/": Recent, @@ -12,6 +13,7 @@ "/saved": Saved, "/editor": PlaylistEditor, "/playlist-builder": PlaylistEditor, + "/manage": Manage, "*": Recent, }; diff --git a/playlist-editor/src/components/PlaylistEditor.svelte b/playlist-editor/src/components/PlaylistEditor.svelte index 49a82c8..1bc278a 100644 --- a/playlist-editor/src/components/PlaylistEditor.svelte +++ b/playlist-editor/src/components/PlaylistEditor.svelte @@ -34,7 +34,7 @@ const isPlaylistBuilder = location.hash.startsWith("#/playlist-builder"); let loading = true; let dataLoaded = false; - let videos = []; + let videos = [] as Video[]; async function loadPageVideos(page) { loading = true; @@ -70,7 +70,7 @@ const defaultPageSize = 50; let currentPage = 1; let pageSize = defaultPageSize; - $: paginatedVideos = paginate({ items: videos, pageSize, currentPage }); + $: paginatedVideos = paginate({ items: videos, pageSize, currentPage }) as Video[]; async function updatePaginationPage(e) { currentPage = e.detail.page; @@ -240,7 +240,7 @@ acc[videoId] = video; } return acc; - }, {}); + }, {} as Video[]); const uniqueVideos = Object.values(videosMap); const duplicatesCount = videos.length - uniqueVideos.length; diff --git a/playlist-editor/src/components/Sidebar.svelte b/playlist-editor/src/components/Sidebar.svelte index ff57111..209b58a 100644 --- a/playlist-editor/src/components/Sidebar.svelte +++ b/playlist-editor/src/components/Sidebar.svelte @@ -13,6 +13,7 @@ > New playlist Saved playlists + Manage playlists diff --git a/src/editor/bundle.css b/src/editor/bundle.css index 1ceb46f..a4ffea1 100644 --- a/src/editor/bundle.css +++ b/src/editor/bundle.css @@ -1 +1 @@ -h2.svelte-1qyroo4.svelte-1qyroo4{display:flex;justify-content:center;width:100%;font-size:24px}.edit-title-input.svelte-1qyroo4.svelte-1qyroo4{width:100%;text-align:center;margin:0;margin-right:5px;padding:0;font-weight:bold}.edit-title-btn{margin-left:20px}.platlist-btns.svelte-1qyroo4.svelte-1qyroo4{display:flex;padding:0px 20px 20px}.platlist-btns.svelte-1qyroo4>*{margin-left:10px}.list.svelte-1qyroo4.svelte-1qyroo4{width:100%;background-color:white;border-radius:4px;box-shadow:0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1)}.list.svelte-1qyroo4>div.svelte-1qyroo4:not(:last-child){border-bottom:1px solid #dbdbdb}textarea.svelte-1qyroo4.svelte-1qyroo4{min-width:30rem;height:50vh}textarea + *{margin-left:1rem}.pagination.svelte-1qyroo4.svelte-1qyroo4{display:flex;align-items:center;justify-content:center}.pagination.svelte-1qyroo4 select.svelte-1qyroo4{margin:0.5rem}.fab.svelte-ixha0v.svelte-ixha0v{display:flex;align-items:center;justify-content:center;width:40px;height:40px;line-height:40px;color:white;border-radius:50%;box-shadow:0 6px 10px 0 #666;transition:all 0.1s ease-in-out;cursor:pointer}.fab.svelte-ixha0v.svelte-ixha0v:hover{box-shadow:0 6px 14px 0 #666;transform:scale(1.05)}.fab.svelte-ixha0v:hover .tooltip.svelte-ixha0v{visibility:visible}.tooltip.svelte-ixha0v.svelte-ixha0v{visibility:hidden;width:120px;opacity:0.8;color:#fff;text-align:center;border-radius:6px;padding:5px;line-height:initial;position:absolute;z-index:1;bottom:125%;left:50%;margin-left:-60px}.loading-modal.svelte-vts1wm.svelte-vts1wm{display:flex;justify-content:center;align-items:center;position:fixed;left:0;top:0;width:100%;height:100%;z-index:1;overflow:auto;background-color:rgba(0, 0, 0, 0.5)}svg.svelte-vts1wm path.svelte-vts1wm{fill:#ccffff}.modal.svelte-tis5cv{display:flex;justify-content:center;align-items:center;position:fixed;left:0;top:0;width:100%;height:100%;z-index:1;overflow:auto;background-color:rgba(0, 0, 0, 0.5)}.modal-content.svelte-tis5cv{display:flex;justify-content:center;align-items:center;background-color:#fefefe;padding:20px;border:1px solid #888;width:80%}.modal.svelte-tis5cv:hover{cursor:pointer}.modal-content.svelte-tis5cv:hover{cursor:auto}.playlist-video.svelte-189upy5.svelte-189upy5{display:flex;padding:0.5em 1em;cursor:pointer}.playlist-video.svelte-189upy5.svelte-189upy5:hover{background-color:#eeeeee}.playlist-video.is-active.svelte-189upy5.svelte-189upy5{background-color:#3273dc;color:#fff}img.svelte-189upy5.svelte-189upy5{width:120px;height:65px;object-fit:cover}.video-details.svelte-189upy5.svelte-189upy5{flex-grow:1;display:flex;flex-direction:column;justify-content:space-around;padding:0.5em;font-size:16px}.video-details.svelte-189upy5>span.svelte-189upy5{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.video-title.svelte-189upy5.svelte-189upy5{font-weight:bold;width:50vw}.video-btns.svelte-189upy5.svelte-189upy5{display:flex;justify-content:center;align-items:center;margin-left:10px}.sidenav.svelte-l6y9si.svelte-l6y9si{height:100%;position:fixed;z-index:1;top:0;left:0;background-color:rgb(255, 82, 82);padding:1rem 0.2rem}.sidenav.svelte-l6y9si a.svelte-l6y9si{padding:1rem 0.5rem;margin-bottom:0.2rem;text-decoration:none;font-size:1.2rem;line-height:1.2rem;color:#ffffff;display:block}.sidenav.svelte-l6y9si a.svelte-l6y9si:hover{background-color:rgb(255, 154, 154)}.sidenav.svelte-l6y9si a.active.svelte-l6y9si{background-color:rgb(255, 221, 221);color:rgb(74, 75, 105);box-shadow:inset 0px 0px 0.2rem #c1c1c1}.sidenav.svelte-l6y9si a.svelte-l6y9si:hover,.sidenav.svelte-l6y9si a.active.svelte-l6y9si{border-radius:0.5rem}.btn.svelte-s5f6cg{display:flex;align-items:center;justify-content:center;width:40px;height:40px;line-height:40px;border-radius:50%;cursor:pointer}.btn.svelte-s5f6cg:hover{box-shadow:0 6px 14px 0 #666}.selector.svelte-zqv7c1{display:flex;justify-content:flex-start;flex-wrap:wrap;padding:10px}.preview.svelte-j52w8t{display:flex;flex-direction:column;cursor:pointer;padding:10px}.preview.svelte-j52w8t:hover{background-color:#eeeeee}.preview-img{width:80px;height:45px;padding:0;margin:0;float:left}.preview-count{width:160px;height:90px;font-size:20px;padding:0;margin:0;float:left}img.svelte-j52w8t{object-fit:cover}.preview-title.svelte-j52w8t{font-weight:bold;width:160px;word-wrap:break-word;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.playlist-count.svelte-1yak261{display:flex;flex-direction:column;justify-content:center;text-align:center;background-color:black;color:white}.light-pagination-nav.svelte-s5ru8s .pagination-nav{display:flex;justify-content:center;background:#FFF;border-radius:3px;box-shadow:0 1px 2px rgba(0, 0, 0, 0.3)}.light-pagination-nav.svelte-s5ru8s .option{padding:10px;display:flex;align-items:center;justify-content:center;transition:0.2s all ease-out;user-select:none;color:hsl(200, 90%, 10%)}.light-pagination-nav.svelte-s5ru8s .option.number,.light-pagination-nav.svelte-s5ru8s .option.ellipsis{padding:10px 15px}.light-pagination-nav.svelte-s5ru8s .option:hover{background:rgba(0, 0, 0, 0.1);cursor:pointer}.light-pagination-nav.svelte-s5ru8s .option.active{color:hsl(200, 70%, 50%)}.dark-pagination-nav.svelte-1tvwpem .pagination-nav{display:flex;justify-content:center;background:hsl(200, 80%, 5%);border-radius:3px;box-shadow:0 1px 2px rgba(0, 0, 0, 0.3)}.dark-pagination-nav.svelte-1tvwpem .option{padding:10px;display:flex;align-items:center;justify-content:center;transition:0.2s all ease-out;user-select:none;color:hsl(200, 90%, 90%)}.dark-pagination-nav.svelte-1tvwpem .option svg path{fill:hsl(200, 90%, 90%)}.dark-pagination-nav.svelte-1tvwpem .option:first-child{border-radius:3px 0 0 3px}.dark-pagination-nav.svelte-1tvwpem .option:last-child{border-radius:0 3px 3px 0}.dark-pagination-nav.svelte-1tvwpem .option.number,.dark-pagination-nav.svelte-1tvwpem .option.ellipsis{padding:10px 15px}.dark-pagination-nav.svelte-1tvwpem .option:hover{background:#000;cursor:pointer}.dark-pagination-nav.svelte-1tvwpem .option.active{color:hsl(200, 100%, 50%)} \ No newline at end of file +h2.svelte-1qyroo4.svelte-1qyroo4{display:flex;justify-content:center;width:100%;font-size:24px}.edit-title-input.svelte-1qyroo4.svelte-1qyroo4{width:100%;text-align:center;margin:0;margin-right:5px;padding:0;font-weight:bold}.edit-title-btn{margin-left:20px}.platlist-btns.svelte-1qyroo4.svelte-1qyroo4{display:flex;padding:0px 20px 20px}.platlist-btns.svelte-1qyroo4>*{margin-left:10px}.list.svelte-1qyroo4.svelte-1qyroo4{width:100%;background-color:white;border-radius:4px;box-shadow:0 2px 3px rgba(10, 10, 10, 0.1), 0 0 0 1px rgba(10, 10, 10, 0.1)}.list.svelte-1qyroo4>div.svelte-1qyroo4:not(:last-child){border-bottom:1px solid #dbdbdb}textarea.svelte-1qyroo4.svelte-1qyroo4{min-width:30rem;height:50vh}textarea + *{margin-left:1rem}.pagination.svelte-1qyroo4.svelte-1qyroo4{display:flex;align-items:center;justify-content:center}.pagination.svelte-1qyroo4 select.svelte-1qyroo4{margin:0.5rem}.selector.svelte-zqv7c1{display:flex;justify-content:flex-start;flex-wrap:wrap;padding:10px}.sidenav.svelte-l6y9si.svelte-l6y9si{height:100%;position:fixed;z-index:1;top:0;left:0;background-color:rgb(255, 82, 82);padding:1rem 0.2rem}.sidenav.svelte-l6y9si a.svelte-l6y9si{padding:1rem 0.5rem;margin-bottom:0.2rem;text-decoration:none;font-size:1.2rem;line-height:1.2rem;color:#ffffff;display:block}.sidenav.svelte-l6y9si a.svelte-l6y9si:hover{background-color:rgb(255, 154, 154)}.sidenav.svelte-l6y9si a.active.svelte-l6y9si{background-color:rgb(255, 221, 221);color:rgb(74, 75, 105);box-shadow:inset 0px 0px 0.2rem #c1c1c1}.sidenav.svelte-l6y9si a.svelte-l6y9si:hover,.sidenav.svelte-l6y9si a.active.svelte-l6y9si{border-radius:0.5rem}.fab.svelte-ixha0v.svelte-ixha0v{display:flex;align-items:center;justify-content:center;width:40px;height:40px;line-height:40px;color:white;border-radius:50%;box-shadow:0 6px 10px 0 #666;transition:all 0.1s ease-in-out;cursor:pointer}.fab.svelte-ixha0v.svelte-ixha0v:hover{box-shadow:0 6px 14px 0 #666;transform:scale(1.05)}.fab.svelte-ixha0v:hover .tooltip.svelte-ixha0v{visibility:visible}.tooltip.svelte-ixha0v.svelte-ixha0v{visibility:hidden;width:120px;opacity:0.8;color:#fff;text-align:center;border-radius:6px;padding:5px;line-height:initial;position:absolute;z-index:1;bottom:125%;left:50%;margin-left:-60px}.modal.svelte-tis5cv{display:flex;justify-content:center;align-items:center;position:fixed;left:0;top:0;width:100%;height:100%;z-index:1;overflow:auto;background-color:rgba(0, 0, 0, 0.5)}.modal-content.svelte-tis5cv{display:flex;justify-content:center;align-items:center;background-color:#fefefe;padding:20px;border:1px solid #888;width:80%}.modal.svelte-tis5cv:hover{cursor:pointer}.modal-content.svelte-tis5cv:hover{cursor:auto}.btn.svelte-s5f6cg{display:flex;align-items:center;justify-content:center;width:40px;height:40px;line-height:40px;border-radius:50%;cursor:pointer}.btn.svelte-s5f6cg:hover{box-shadow:0 6px 14px 0 #666}.loading-modal.svelte-vts1wm.svelte-vts1wm{display:flex;justify-content:center;align-items:center;position:fixed;left:0;top:0;width:100%;height:100%;z-index:1;overflow:auto;background-color:rgba(0, 0, 0, 0.5)}svg.svelte-vts1wm path.svelte-vts1wm{fill:#ccffff}.playlist-video.svelte-189upy5.svelte-189upy5{display:flex;padding:0.5em 1em;cursor:pointer}.playlist-video.svelte-189upy5.svelte-189upy5:hover{background-color:#eeeeee}.playlist-video.is-active.svelte-189upy5.svelte-189upy5{background-color:#3273dc;color:#fff}img.svelte-189upy5.svelte-189upy5{width:120px;height:65px;object-fit:cover}.video-details.svelte-189upy5.svelte-189upy5{flex-grow:1;display:flex;flex-direction:column;justify-content:space-around;padding:0.5em;font-size:16px}.video-details.svelte-189upy5>span.svelte-189upy5{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.video-title.svelte-189upy5.svelte-189upy5{font-weight:bold;width:50vw}.video-btns.svelte-189upy5.svelte-189upy5{display:flex;justify-content:center;align-items:center;margin-left:10px}.preview.svelte-j52w8t{display:flex;flex-direction:column;cursor:pointer;padding:10px}.preview.svelte-j52w8t:hover{background-color:#eeeeee}.preview-img{width:80px;height:45px;padding:0;margin:0;float:left}.preview-count{width:160px;height:90px;font-size:20px;padding:0;margin:0;float:left}img.svelte-j52w8t{object-fit:cover}.preview-title.svelte-j52w8t{font-weight:bold;width:160px;word-wrap:break-word;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.playlist-count.svelte-1yak261{display:flex;flex-direction:column;justify-content:center;text-align:center;background-color:black;color:white}.light-pagination-nav.svelte-s5ru8s .pagination-nav{display:flex;justify-content:center;background:#FFF;border-radius:3px;box-shadow:0 1px 2px rgba(0, 0, 0, 0.3)}.light-pagination-nav.svelte-s5ru8s .option{padding:10px;display:flex;align-items:center;justify-content:center;transition:0.2s all ease-out;user-select:none;color:hsl(200, 90%, 10%)}.light-pagination-nav.svelte-s5ru8s .option.number,.light-pagination-nav.svelte-s5ru8s .option.ellipsis{padding:10px 15px}.light-pagination-nav.svelte-s5ru8s .option:hover{background:rgba(0, 0, 0, 0.1);cursor:pointer}.light-pagination-nav.svelte-s5ru8s .option.active{color:hsl(200, 70%, 50%)}.dark-pagination-nav.svelte-1tvwpem .pagination-nav{display:flex;justify-content:center;background:hsl(200, 80%, 5%);border-radius:3px;box-shadow:0 1px 2px rgba(0, 0, 0, 0.3)}.dark-pagination-nav.svelte-1tvwpem .option{padding:10px;display:flex;align-items:center;justify-content:center;transition:0.2s all ease-out;user-select:none;color:hsl(200, 90%, 90%)}.dark-pagination-nav.svelte-1tvwpem .option svg path{fill:hsl(200, 90%, 90%)}.dark-pagination-nav.svelte-1tvwpem .option:first-child{border-radius:3px 0 0 3px}.dark-pagination-nav.svelte-1tvwpem .option:last-child{border-radius:0 3px 3px 0}.dark-pagination-nav.svelte-1tvwpem .option.number,.dark-pagination-nav.svelte-1tvwpem .option.ellipsis{padding:10px 15px}.dark-pagination-nav.svelte-1tvwpem .option:hover{background:#000;cursor:pointer}.dark-pagination-nav.svelte-1tvwpem .option.active{color:hsl(200, 100%, 50%)} \ No newline at end of file diff --git a/src/editor/main.js b/src/editor/main.js index cf0f70a..f9506cd 100644 --- a/src/editor/main.js +++ b/src/editor/main.js @@ -1 +1 @@ -function t(){}const e=t=>t;function n(t,e){for(const n in e)t[n]=e[n];return t}function o(t){return t()}function l(){return Object.create(null)}function i(t){t.forEach(o)}function r(t){return"function"==typeof t}function s(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function c(t,e,n,o){if(t){const l=u(t,e,n,o);return t[0](l)}}function u(t,e,o,l){return t[1]&&l?n(o.ctx.slice(),t[1](l(e))):o.ctx}function a(t,e,n,o,l,i,r){const s=function(t,e,n,o){if(t[2]&&o){const l=t[2](o(n));if(void 0===e.dirty)return l;if("object"==typeof l){const t=[],n=Math.max(e.dirty.length,l.length);for(let o=0;owindow.performance.now():()=>Date.now(),m=d?t=>requestAnimationFrame(t):t;const $=new Set;function h(t){$.forEach((e=>{e.c(t)||($.delete(e),e.f())})),0!==$.size&&m(h)}function g(t,e){t.appendChild(e)}function v(t,e,n){t.insertBefore(e,n||null)}function y(t){t.parentNode.removeChild(t)}function w(t,e){for(let n=0;nt.removeEventListener(e,n,o)}function C(t){return function(e){return e.preventDefault(),t.call(this,e)}}function L(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function S(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function V(t,e){t.value=null==e?"":e}function T(t,e,n,o){t.style.setProperty(e,n,o?"important":"")}function H(t,e){for(let n=0;nt.indexOf(e)<0:t=>-1===t.indexOf("__svelte")),l=n.length-o.length;l&&(t.style.animation=o.join(", "),O-=l,O||m((()=>{O||(A.forEach((t=>{const e=t.__svelte_stylesheet;let n=e.cssRules.length;for(;n--;)e.deleteRule(n);t.__svelte_rules={}})),A.clear())})))}function N(n,o,l,i){if(!o)return t;const r=n.getBoundingClientRect();if(o.left===r.left&&o.right===r.right&&o.top===r.top&&o.bottom===r.bottom)return t;const{delay:s=0,duration:c=300,easing:u=e,start:a=p()+s,end:f=a+c,tick:d=t,css:g}=l(n,{from:o,to:r},i);let v,y=!0,w=!1;function x(){g&&j(n,v),y=!1}return function(t){let e;0===$.size&&m(h),new Promise((n=>{$.add(e={c:t,f:n})}))}((t=>{if(!w&&t>=a&&(w=!0),w&&t>=f&&(d(1,0),x()),!y)return!1;if(w){const e=0+1*u((t-a)/c);d(e,1-e)}return!0})),g&&(v=function(t,e,n,o,l,i,r,s=0){const c=16.666/o;let u="{\n";for(let t=0;t<=1;t+=c){const o=e+(n-e)*i(t);u+=100*t+`%{${r(o,1-o)}}\n`}const a=u+`100% {${r(n,1-n)}}\n}`,f=`__svelte_${function(t){let e=5381,n=t.length;for(;n--;)e=(e<<5)-e^t.charCodeAt(n);return e>>>0}(a)}_${s}`,d=t.ownerDocument;A.add(d);const p=d.__svelte_stylesheet||(d.__svelte_stylesheet=d.head.appendChild(b("style")).sheet),m=d.__svelte_rules||(d.__svelte_rules={});m[f]||(m[f]=!0,p.insertRule(`@keyframes ${f} ${a}`,p.cssRules.length));const $=t.style.animation||"";return t.style.animation=`${$?`${$}, `:""}${f} ${o}ms linear ${l}ms 1 both`,O+=1,f}(n,0,1,c,s,u,g)),s||(w=!0),d(0,1),x}function R(t){const e=getComputedStyle(t);if("absolute"!==e.position&&"fixed"!==e.position){const{width:n,height:o}=e,l=t.getBoundingClientRect();t.style.position="absolute",t.style.width=n,t.style.height=o,function(t,e){const n=t.getBoundingClientRect();if(e.left!==n.left||e.top!==n.top){const o=getComputedStyle(t),l="none"===o.transform?"":o.transform;t.style.transform=`${l} translate(${e.left-n.left}px, ${e.top-n.top}px)`}}(t,l)}}function z(t){I=t}function B(){if(!I)throw new Error("Function called outside component initialization");return I}function q(){const t=B();return(e,n)=>{const o=t.$$.callbacks[e];if(o){const l=function(t,e){const n=document.createEvent("CustomEvent");return n.initCustomEvent(t,!1,!1,e),n}(e,n);o.slice().forEach((e=>{e.call(t,l)}))}}}function U(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach((t=>t(e)))}const Z=[],G=[],D=[],X=[],W=Promise.resolve();let Y=!1;function F(){Y||(Y=!0,W.then(et))}function J(){return F(),W}function K(t){D.push(t)}let Q=!1;const tt=new Set;function et(){if(!Q){Q=!0;do{for(let t=0;t{ot.delete(t),o&&(n&&t.d(1),o())})),t.o(e)}}function ut(t,e){const n=e.token={};function o(t,o,l,i){if(e.token!==n)return;e.resolved=i;let r=e.ctx;void 0!==l&&(r=r.slice(),r[l]=i);const s=t&&(e.current=t)(r);let c=!1;e.block&&(e.blocks?e.blocks.forEach(((t,n)=>{n!==o&&t&&(it(),ct(t,1,1,(()=>{e.blocks[n]===t&&(e.blocks[n]=null)})),rt())})):e.block.d(1),s.c(),st(s,1),s.m(e.mount(),e.anchor),c=!0),e.block=s,e.blocks&&(e.blocks[o]=s),c&&et()}if((l=t)&&"object"==typeof l&&"function"==typeof l.then){const n=B();if(t.then((t=>{z(n),o(e.then,1,e.value,t),z(null)}),(t=>{if(z(n),o(e.catch,2,e.error,t),z(null),!e.hasCatch)throw t})),e.current!==e.pending)return o(e.pending,0),!0}else{if(e.current!==e.then)return o(e.then,1,e.value,t),!0;e.resolved=t}var l}function at(t,e){ct(t,1,1,(()=>{e.delete(t.key)}))}function ft(t,e){t.f(),at(t,e)}function dt(t,e,n,o,l,i,r,s,c,u,a,f){let d=t.length,p=i.length,m=d;const $={};for(;m--;)$[t[m].key]=m;const h=[],g=new Map,v=new Map;for(m=p;m--;){const t=f(l,i,m),s=n(t);let c=r.get(s);c?o&&c.p(t,e):(c=u(s,t),c.c()),g.set(s,h[m]=c),s in $&&v.set(s,Math.abs(m-$[s]))}const y=new Set,w=new Set;function b(t){st(t,1),t.m(s,a),r.set(t.key,t),a=t.first,p--}for(;d&&p;){const e=h[p-1],n=t[d-1],o=e.key,l=n.key;e===n?(a=e.first,d--,p--):g.has(l)?!r.has(o)||y.has(o)?b(e):w.has(l)?d--:v.get(o)>v.get(l)?(w.add(o),b(e)):(y.add(l),d--):(c(n,r),d--)}for(;d--;){const e=t[d];g.has(e.key)||c(e,r)}for(;p;)b(h[p-1]);return h}function pt(t,e){const n={},o={},l={$$scope:1};let i=t.length;for(;i--;){const r=t[i],s=e[i];if(s){for(const t in r)t in s||(o[t]=1);for(const t in s)l[t]||(n[t]=s[t],l[t]=1);t[i]=s}else for(const t in r)l[t]=1}for(const t in o)t in n||(n[t]=void 0);return n}function mt(t){return"object"==typeof t&&null!==t?t:{}}function $t(t){t&&t.c()}function ht(t,e,n,l){const{fragment:s,on_mount:c,on_destroy:u,after_update:a}=t.$$;s&&s.m(e,n),l||K((()=>{const e=c.map(o).filter(r);u?u.push(...e):i(e),t.$$.on_mount=[]})),a.forEach(K)}function gt(t,e){const n=t.$$;null!==n.fragment&&(i(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function vt(e,n,o,r,s,c,u=[-1]){const a=I;z(e);const f=e.$$={fragment:null,ctx:null,props:c,update:t,not_equal:s,bound:l(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(a?a.$$.context:[]),callbacks:l(),dirty:u,skip_bound:!1};let d=!1;if(f.ctx=o?o(e,n.props||{},((t,n,...o)=>{const l=o.length?o[0]:n;return f.ctx&&s(f.ctx[t],f.ctx[t]=l)&&(!f.skip_bound&&f.bound[t]&&f.bound[t](l),d&&function(t,e){-1===t.$$.dirty[0]&&(Z.push(t),F(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const wt=[];function bt(t,e){return{subscribe:xt(t,e).subscribe}}function xt(e,n=t){let o;const l=[];function i(t){if(s(e,t)&&(e=t,o)){const t=!wt.length;for(let t=0;t{const t=l.indexOf(c);-1!==t&&l.splice(t,1),0===l.length&&(o(),o=null)}}}}function kt(e,n,o){const l=!Array.isArray(e),s=l?[e]:e,c=n.length<2;return bt(o,(e=>{let o=!1;const u=[];let a=0,f=t;const d=()=>{if(a)return;f();const o=n(l?u[0]:u,e);c?e(o):f=r(o)?o:t},p=s.map(((e,n)=>function(e,...n){if(null==e)return t;const o=e.subscribe(...n);return o.unsubscribe?()=>o.unsubscribe():o}(e,(t=>{u[n]=t,a&=~(1<{a|=1<{gt(t,1)})),rt()}r?(e=new r(s()),e.$on("routeEvent",t[7]),$t(e.$$.fragment),st(e.$$.fragment,1),ht(e,o.parentNode,o)):e=null}else r&&e.$set(l)},i(t){l||(e&&st(e.$$.fragment,t),l=!0)},o(t){e&&ct(e.$$.fragment,t),l=!1},d(t){t&&y(o),e&>(e,t)}}}function Pt(t){let e,o,l;const i=[{params:t[1]},t[2]];var r=t[0];function s(t){let e={};for(let t=0;t{gt(t,1)})),rt()}r?(e=new r(s()),e.$on("routeEvent",t[6]),$t(e.$$.fragment),st(e.$$.fragment,1),ht(e,o.parentNode,o)):e=null}else r&&e.$set(l)},i(t){l||(e&&st(e.$$.fragment,t),l=!0)},o(t){e&&ct(e.$$.fragment,t),l=!1},d(t){t&&y(o),e&>(e,t)}}}function Et(t){let e,n,o,l;const i=[Pt,_t],r=[];function s(t,e){return t[1]?0:1}return e=s(t),n=r[e]=i[e](t),{c(){n.c(),o=P()},m(t,n){r[e].m(t,n),v(t,o,n),l=!0},p(t,[l]){let c=e;e=s(t),e===c?r[e].p(t,l):(it(),ct(r[c],1,1,(()=>{r[c]=null})),rt(),n=r[e],n?n.p(t,l):(n=r[e]=i[e](t),n.c()),st(n,1),n.m(o.parentNode,o))},i(t){l||(st(n),l=!0)},o(t){ct(n),l=!1},d(t){r[e].d(t),t&&y(o)}}}function Ct(){const t=window.location.href.indexOf("#/");let e=t>-1?window.location.href.substr(t+1):"/";const n=e.indexOf("?");let o="";return n>-1&&(o=e.substr(n+1),e=e.substr(0,n)),{location:e,querystring:o}}const Lt=bt(null,(function(t){t(Ct());const e=()=>{t(Ct())};return window.addEventListener("hashchange",e,!1),function(){window.removeEventListener("hashchange",e,!1)}}));async function St(t){if(!t||t.length<1||"/"!=t.charAt(0)&&0!==t.indexOf("#/"))throw Error("Invalid parameter location");await J();const e=("#"==t.charAt(0)?"":"#")+t;try{window.history.replaceState(void 0,void 0,e)}catch(t){console.warn("Caught exception while replacing the current page. If you're running this in the Svelte REPL, please note that the `replace` method might not work in this environment.")}window.dispatchEvent(new Event("hashchange"))}function Vt(t,e,n){let{routes:o={}}=e,{prefix:l=""}=e,{restoreScrollState:i=!1}=e;class r{constructor(t,e){if(!e||"function"!=typeof e&&("object"!=typeof e||!0!==e._sveltesparouter))throw Error("Invalid component object");if(!t||"string"==typeof t&&(t.length<1||"/"!=t.charAt(0)&&"*"!=t.charAt(0))||"object"==typeof t&&!(t instanceof RegExp))throw Error('Invalid value for "path" argument - strings must start with / or *');const{pattern:n,keys:o}=function(t,e){if(t instanceof RegExp)return{keys:!1,pattern:t};var n,o,l,i,r=[],s="",c=t.split("/");for(c[0]||c.shift();l=c.shift();)"*"===(n=l[0])?(r.push("wild"),s+="/(.*)"):":"===n?(o=l.indexOf("?",1),i=l.indexOf(".",1),r.push(l.substring(1,~o?o:~i?i:l.length)),s+=~o&&!~i?"(?:/([^/]+?))?":"/([^/]+?)",~i&&(s+=(~o?"?":"")+"\\"+l.substring(i))):s+="/"+l;return{keys:r,pattern:new RegExp("^"+s+(e?"(?=$|/)":"/?$"),"i")}}(t);this.path=t,"object"==typeof e&&!0===e._sveltesparouter?(this.component=e.component,this.conditions=e.conditions||[],this.userData=e.userData,this.props=e.props||{}):(this.component=()=>Promise.resolve(e),this.conditions=[],this.props={}),this._pattern=n,this._keys=o}match(t){if(l)if("string"==typeof l){if(!t.startsWith(l))return null;t=t.substr(l.length)||"/"}else if(l instanceof RegExp){const e=t.match(l);if(!e||!e[0])return null;t=t.substr(e[0].length)||"/"}const e=this._pattern.exec(t);if(null===e)return null;if(!1===this._keys)return e;const n={};let o=0;for(;o{s.push(new r(e,t))})):Object.keys(o).forEach((t=>{s.push(new r(t,o[t]))}));let c=null,u=null,a={};const f=q();async function d(t,e){await J(),f(t,e)}let p=null;var m;i&&(window.addEventListener("popstate",(t=>{p=t.state&&t.state.scrollY?t.state:null})),m=()=>{p?window.scrollTo(p.scrollX,p.scrollY):window.scrollTo(0,0)},B().$$.after_update.push(m));let $=null,h=null;return Lt.subscribe((async t=>{$=t;let e=0;for(;e{"routes"in t&&n(3,o=t.routes),"prefix"in t&&n(4,l=t.prefix),"restoreScrollState"in t&&n(5,i=t.restoreScrollState)},t.$$.update=()=>{32&t.$$.dirty&&(history.scrollRestoration=i?"manual":"auto")},[c,u,a,o,l,i,function(e){U(t,e)},function(e){U(t,e)}]}kt(Lt,(t=>t.location)),kt(Lt,(t=>t.querystring));class Tt extends yt{constructor(t){super(),vt(this,t,Vt,Et,s,{routes:3,prefix:4,restoreScrollState:5})}}function Ht(t){const e=t-1;return e*e*e+1}function Mt(t){return 1===t?t:1-Math.pow(2,-10*t)}function At(t){let e,n;return{c(){e=b("span"),n=k(t[0]),L(e,"class","tooltip svelte-ixha0v"),T(e,"background-color",t[1])},m(t,o){v(t,e,o),g(e,n)},p(t,o){1&o&&S(n,t[0]),2&o&&T(e,"background-color",t[1])},d(t){t&&y(e)}}}function It(t){let e,n,o,l,i;const r=t[3].default,s=c(r,t,t[2],null);let u=!!t[0]&&At(t);return{c(){e=b("div"),s&&s.c(),n=_(),u&&u.c(),L(e,"class","fab svelte-ixha0v"),T(e,"background-color",t[1])},m(r,c){v(r,e,c),s&&s.m(e,null),g(e,n),u&&u.m(e,null),o=!0,l||(i=E(e,"click",t[4]),l=!0)},p(t,[n]){s&&s.p&&4&n&&a(s,r,t,t[2],n,null,null),t[0]?u?u.p(t,n):(u=At(t),u.c(),u.m(e,null)):u&&(u.d(1),u=null),(!o||2&n)&&T(e,"background-color",t[1])},i(t){o||(st(s,t),o=!0)},o(t){ct(s,t),o=!1},d(t){t&&y(e),s&&s.d(t),u&&u.d(),l=!1,i()}}}function Ot(t,e,n){let{$$slots:o={},$$scope:l}=e,{title:i=""}=e,{bgcolor:r="#007bff"}=e;return t.$$set=t=>{"title"in t&&n(0,i=t.title),"bgcolor"in t&&n(1,r=t.bgcolor),"$$scope"in t&&n(2,l=t.$$scope)},[i,r,l,o,function(e){U(t,e)}]}class jt extends yt{constructor(t){super(),vt(this,t,Ot,It,s,{title:0,bgcolor:1})}}function Nt(e){let n,o;return{c(){n=x("svg"),o=x("path"),L(o,"fill","currentColor"),L(o,"d","M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"),T(n,"width","24px"),T(n,"height","24px"),L(n,"viewBox","0 0 24 24")},m(t,e){v(t,n,e),g(n,o)},p:t,i:t,o:t,d(t){t&&y(n)}}}class Rt extends yt{constructor(t){super(),vt(this,t,null,Nt,s,{})}}function zt(e){let n,o;return{c(){n=x("svg"),o=x("path"),L(o,"fill","currentColor"),L(o,"d","M4 7H2V21C2 22.1 2.9 23 4 23H18V21H4M20 3H16.8C16.4 1.8 15.3 1 14 1C12.7 1 11.6 1.8 11.2 3H8C6.9 3 6 3.9 6 5V17C6 18.1 6.9 19 8 19H20C21.1 19 22 18.1 22 17V5C22 3.9 21.1 3 20 3M14 3C14.6 3 15 3.5 15 4C15 4.5 14.5 5 14 5C13.5 5 13 4.5 13 4C13 3.5 13.4 3 14 3Z"),T(n,"width","24px"),T(n,"height","24px"),L(n,"viewBox","0 0 24 24")},m(t,e){v(t,n,e),g(n,o)},p:t,i:t,o:t,d(t){t&&y(n)}}}class Bt extends yt{constructor(t){super(),vt(this,t,null,zt,s,{})}}function qt(e){let n,o;return{c(){n=x("svg"),o=x("path"),L(o,"fill","currentColor"),L(o,"d","M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"),T(n,"width","24px"),T(n,"height","24px"),L(n,"viewBox","0 0 24 24")},m(t,e){v(t,n,e),g(n,o)},p:t,i:t,o:t,d(t){t&&y(n)}}}class Ut extends yt{constructor(t){super(),vt(this,t,null,qt,s,{})}}function Zt(e){let n,o;return{c(){n=x("svg"),o=x("path"),L(o,"fill","currentColor"),L(o,"d","M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z"),T(n,"width","24px"),T(n,"height","24px"),L(n,"viewBox","0 0 24 24")},m(t,e){v(t,n,e),g(n,o)},p:t,i:t,o:t,d(t){t&&y(n)}}}class Gt extends yt{constructor(t){super(),vt(this,t,null,Zt,s,{})}}function Dt(e){let n,o;return{c(){n=x("svg"),o=x("path"),L(o,"fill","currentColor"),L(o,"d","M19,9H2V11H19V9M19,5H2V7H19V5M2,15H15V13H2V15M17,13V19L22,16L17,13Z"),T(n,"width","24px"),T(n,"height","24px"),L(n,"viewBox","0 0 24 24")},m(t,e){v(t,n,e),g(n,o)},p:t,i:t,o:t,d(t){t&&y(n)}}}class Xt extends yt{constructor(t){super(),vt(this,t,null,Dt,s,{})}}function Wt(e){let n,o;return{c(){n=x("svg"),o=x("path"),L(o,"fill","currentColor"),L(o,"d","M2,16H10V14H2M18,14V10H16V14H12V16H16V20H18V16H22V14M14,6H2V8H14M14,10H2V12H14V10Z"),T(n,"width","24px"),T(n,"height","24px"),L(n,"viewBox","0 0 24 24")},m(t,e){v(t,n,e),g(n,o)},p:t,i:t,o:t,d(t){t&&y(n)}}}class Yt extends yt{constructor(t){super(),vt(this,t,null,Wt,s,{})}}function Ft(e){let n,o;return{c(){n=x("svg"),o=x("path"),L(o,"fill","currentColor"),L(o,"d","M19,11H15V15H13V11H9V9H13V5H15V9H19M20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16V4A2,2 0 0,0 20,2M4,6H2V20A2,2 0 0,0 4,22H18V20H4V6Z"),T(n,"width","24px"),T(n,"height","24px"),L(n,"viewBox","0 0 24 24")},m(t,e){v(t,n,e),g(n,o)},p:t,i:t,o:t,d(t){t&&y(n)}}}class Jt extends yt{constructor(t){super(),vt(this,t,null,Ft,s,{})}}function Kt(e){let n,o,l;return{c(){n=x("svg"),o=x("path"),l=x("path"),L(o,"fill","currentColor"),L(o,"d","M 6.164062,0 3.0644531,4.8320311 0,9.6855465 4.0312497,9.7597654 V 23.999999 H 7.9902341 V 9.8183594 L 12,9.8632814 9.1015622,4.921875 Z"),L(l,"fill","currentColor"),L(l,"d","M 16.03125,0 V 14.240234 L 12,14.314452 l 3.064452,4.853517 3.09961,4.83203 2.937499,-4.921874 2.898438,-4.941406 -4.009765,0.04492 V 0 Z"),T(n,"width","24px"),T(n,"height","24px"),L(n,"viewBox","0 0 24 24")},m(t,e){v(t,n,e),g(n,o),g(n,l)},p:t,i:t,o:t,d(t){t&&y(n)}}}class Qt extends yt{constructor(t){super(),vt(this,t,null,Kt,s,{})}}function te(e){let n,o;return{c(){n=x("svg"),o=x("path"),L(o,"fill","currentColor"),L(o,"d","M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z"),T(n,"width","24px"),T(n,"height","24px"),L(n,"viewBox","0 0 24 24")},m(t,e){v(t,n,e),g(n,o)},p:t,i:t,o:t,d(t){t&&y(n)}}}class ee extends yt{constructor(t){super(),vt(this,t,null,te,s,{})}}function ne(e){let n;return{c(){n=b("div"),n.innerHTML='',L(n,"class","loading-modal svelte-vts1wm")},m(t,e){v(t,n,e)},p:t,i:t,o:t,d(t){t&&y(n)}}}class oe extends yt{constructor(t){super(),vt(this,t,null,ne,s,{})}}function le(t){let e,n,o,l,i;const r=t[3].default,s=c(r,t,t[2],null);return{c(){e=b("div"),n=b("div"),s&&s.c(),L(n,"class","modal-content svelte-tis5cv"),L(e,"class","modal svelte-tis5cv")},m(r,c){v(r,e,c),g(e,n),s&&s.m(n,null),o=!0,l||(i=E(e,"click",t[1]),l=!0)},p(t,e){s&&s.p&&4&e&&a(s,r,t,t[2],e,null,null)},i(t){o||(st(s,t),o=!0)},o(t){ct(s,t),o=!1},d(t){t&&y(e),s&&s.d(t),l=!1,i()}}}function ie(t){let e,n,o=t[0]&&le(t);return{c(){o&&o.c(),e=P()},m(t,l){o&&o.m(t,l),v(t,e,l),n=!0},p(t,[n]){t[0]?o?(o.p(t,n),1&n&&st(o,1)):(o=le(t),o.c(),st(o,1),o.m(e.parentNode,e)):o&&(it(),ct(o,1,1,(()=>{o=null})),rt())},i(t){n||(st(o),n=!0)},o(t){ct(o),n=!1},d(t){o&&o.d(t),t&&y(e)}}}function re(t,e,n){let{$$slots:o={},$$scope:l}=e,{display:i=!1}=e;return t.$$set=t=>{"display"in t&&n(0,i=t.display),"$$scope"in t&&n(2,l=t.$$scope)},[i,function(t){t.target.classList.contains("modal")&&n(0,i=!1)},l,o]}class se extends yt{constructor(t){super(),vt(this,t,re,ie,s,{display:0})}}function ce(e){let n,o;return{c(){n=x("svg"),o=x("path"),L(o,"fill","currentColor"),L(o,"d","M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z"),T(n,"width","24px"),T(n,"height","24px"),L(n,"viewBox","0 0 24 24")},m(t,e){v(t,n,e),g(n,o)},p:t,i:t,o:t,d(t){t&&y(n)}}}class ue extends yt{constructor(t){super(),vt(this,t,null,ce,s,{})}}function ae(t){let e,n,o,l,i;const r=t[2].default,s=c(r,t,t[1],null);return{c(){e=b("div"),s&&s.c(),L(e,"class",n="btn "+t[0]+" svelte-s5f6cg")},m(n,r){v(n,e,r),s&&s.m(e,null),o=!0,l||(i=E(e,"click",t[3]),l=!0)},p(t,[l]){s&&s.p&&2&l&&a(s,r,t,t[1],l,null,null),(!o||1&l&&n!==(n="btn "+t[0]+" svelte-s5f6cg"))&&L(e,"class",n)},i(t){o||(st(s,t),o=!0)},o(t){ct(s,t),o=!1},d(t){t&&y(e),s&&s.d(t),l=!1,i()}}}function fe(t,e,n){let{$$slots:o={},$$scope:l}=e,{className:i=""}=e;return t.$$set=t=>{"className"in t&&n(0,i=t.className),"$$scope"in t&&n(1,l=t.$$scope)},[i,l,o,function(e){U(t,e)}]}class de extends yt{constructor(t){super(),vt(this,t,fe,ae,s,{className:0})}}function pe(t){let e,n,o,l,i;return{c(){e=b("img"),L(e,"alt",n=t[0].title),e.src!==(o=t[0].thumbnailUrl)&&L(e,"src",o),L(e,"class","svelte-189upy5")},m(n,o){v(n,e,o),l||(i=E(e,"click",C(t[3])),l=!0)},p(t,l){1&l&&n!==(n=t[0].title)&&L(e,"alt",n),1&l&&e.src!==(o=t[0].thumbnailUrl)&&L(e,"src",o)},d(t){t&&y(e),l=!1,i()}}}function me(t){let e,n;return e=new ue({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function $e(t){let e,n,o,l,i,r,s,c,u,a,f,d,p=t[0].title+"",m=t[0].channel+"",$=!t[2]&&pe(t);return f=new de({props:{$$slots:{default:[me]},$$scope:{ctx:t}}}),f.$on("click",t[4]),{c(){e=b("div"),$&&$.c(),n=_(),o=b("div"),l=b("span"),i=k(p),r=_(),s=b("span"),c=k(m),u=_(),a=b("div"),$t(f.$$.fragment),L(l,"class","video-title svelte-189upy5"),L(s,"class","svelte-189upy5"),L(o,"class","video-details svelte-189upy5"),L(a,"class","video-btns svelte-189upy5"),L(e,"class","playlist-video svelte-189upy5"),M(e,"is-active",t[1])},m(t,p){v(t,e,p),$&&$.m(e,null),g(e,n),g(e,o),g(o,l),g(l,i),g(o,r),g(o,s),g(s,c),g(e,u),g(e,a),ht(f,a,null),d=!0},p(t,[o]){t[2]?$&&($.d(1),$=null):$?$.p(t,o):($=pe(t),$.c(),$.m(e,n)),(!d||1&o)&&p!==(p=t[0].title+"")&&S(i,p),(!d||1&o)&&m!==(m=t[0].channel+"")&&S(c,m);const l={};64&o&&(l.$$scope={dirty:o,ctx:t}),f.$set(l),2&o&&M(e,"is-active",t[1])},i(t){d||(st(f.$$.fragment,t),d=!0)},o(t){ct(f.$$.fragment,t),d=!1},d(t){t&&y(e),$&&$.d(),gt(f)}}}function he(t,e,n){let{video:o}=e,{active:l}=e,{disableThumbnails:i=!1}=e;const r=q();return t.$$set=t=>{"video"in t&&n(0,o=t.video),"active"in t&&n(1,l=t.active),"disableThumbnails"in t&&n(2,i=t.disableThumbnails)},[o,l,i,function(){window.open(o.url,"_blank")},function(t){r("delete",o)}]}class ge extends yt{constructor(t){super(),vt(this,t,he,$e,s,{video:0,active:1,disableThumbnails:2})}}function ve(e){let n,o,l,i,r,s;return{c(){n=b("div"),o=b("a"),o.textContent="Recently created playlists",l=_(),i=b("a"),i.textContent="New playlist",r=_(),s=b("a"),s.textContent="Saved playlists",L(o,"href","#/recent"),L(o,"class","svelte-l6y9si"),M(o,"active",ye("recent","#",".html")),L(i,"href","#/new"),L(i,"class","svelte-l6y9si"),M(i,"active",ye("new")),L(s,"href","#/saved"),L(s,"class","svelte-l6y9si"),M(s,"active",ye("saved")),L(n,"class","sidenav svelte-l6y9si")},m(t,e){v(t,n,e),g(n,o),g(n,l),g(n,i),g(n,r),g(n,s)},p:t,i:t,o:t,d(t){t&&y(n)}}}function ye(...t){return t.some((t=>location.href.endsWith(t)||location.href.endsWith(t+"/")))}class we extends yt{constructor(t){super(),vt(this,t,null,ve,s,{})}}const be="ELLIPSIS";function xe({totalItems:t,pageSize:e,currentPage:n,limit:o=null,showStepOptions:l=!1}){const i=Math.ceil(t/e),r=function({limit:t}){return 2*t+3+2}({limit:o});let s=o&&i>r?function({totalPages:t,limit:e,currentPage:n}){const o=2*e+2,l=1+o,i=t-o,r=l+2;if(n<=l-e)return Array(r).fill(null).map(((e,n)=>n===r-1?{type:"number",value:t}:n===r-2?{type:"symbol",symbol:be,value:l+1}:{type:"number",value:n+1}));if(n>=i+e)return Array(r).fill(null).map(((t,e)=>0===e?{type:"number",value:1}:1===e?{type:"symbol",symbol:be,value:i-1}:{type:"number",value:i+e-2}));if(n>=l-e&&n<=i+e)return Array(r).fill(null).map(((o,l)=>0===l?{type:"number",value:1}:1===l?{type:"symbol",symbol:be,value:n-e+(l-2)}:l===r-1?{type:"number",value:t}:l===r-2?{type:"symbol",symbol:be,value:n+e+1}:{type:"number",value:n-e+(l-2)}))}({totalPages:i,limit:o,currentPage:n}):function({totalPages:t}){return new Array(t).fill(null).map(((t,e)=>({type:"number",value:e+1})))}({totalPages:i});return l?function({options:t,currentPage:e,totalPages:n}){return[{type:"symbol",symbol:"PREVIOUS_PAGE",value:e<=1?1:e-1},...t,{type:"symbol",symbol:"NEXT_PAGE",value:e>=n?n:e+1}]}({options:s,currentPage:n,totalPages:i}):s}function ke(t,e,n){const o=t.slice();return o[12]=e[n],o}const _e=t=>({}),Pe=t=>({}),Ee=t=>({}),Ce=t=>({}),Le=t=>({}),Se=t=>({}),Ve=t=>({value:2&t}),Te=t=>({value:t[12].value});function He(t){let e;const n=t[9].next,o=c(n,t,t[8],Pe),l=o||function(t){let e,n;return{c(){e=x("svg"),n=x("path"),L(n,"fill","#000000"),L(n,"d","M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"),T(e,"width","24px"),T(e,"height","24px"),L(e,"viewBox","0 0 24 24")},m(t,o){v(t,e,o),g(e,n)},d(t){t&&y(e)}}}();return{c(){l&&l.c()},m(t,n){l&&l.m(t,n),e=!0},p(t,e){o&&o.p&&256&e&&a(o,n,t,t[8],e,_e,Pe)},i(t){e||(st(l,t),e=!0)},o(t){ct(l,t),e=!1},d(t){l&&l.d(t)}}}function Me(t){let e;const n=t[9].prev,o=c(n,t,t[8],Ce),l=o||function(t){let e,n;return{c(){e=x("svg"),n=x("path"),L(n,"fill","#000000"),L(n,"d","M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z"),T(e,"width","24px"),T(e,"height","24px"),L(e,"viewBox","0 0 24 24")},m(t,o){v(t,e,o),g(e,n)},d(t){t&&y(e)}}}();return{c(){l&&l.c()},m(t,n){l&&l.m(t,n),e=!0},p(t,e){o&&o.p&&256&e&&a(o,n,t,t[8],e,Ee,Ce)},i(t){e||(st(l,t),e=!0)},o(t){ct(l,t),e=!1},d(t){l&&l.d(t)}}}function Ae(t){let e;const n=t[9].ellipsis,o=c(n,t,t[8],Se),l=o||function(t){let e;return{c(){e=b("span"),e.textContent="..."},m(t,n){v(t,e,n)},d(t){t&&y(e)}}}();return{c(){l&&l.c()},m(t,n){l&&l.m(t,n),e=!0},p(t,e){o&&o.p&&256&e&&a(o,n,t,t[8],e,Le,Se)},i(t){e||(st(l,t),e=!0)},o(t){ct(l,t),e=!1},d(t){l&&l.d(t)}}}function Ie(t){let e;const n=t[9].number,o=c(n,t,t[8],Te),l=o||function(t){let e,n,o=t[12].value+"";return{c(){e=b("span"),n=k(o)},m(t,o){v(t,e,o),g(e,n)},p(t,e){2&e&&o!==(o=t[12].value+"")&&S(n,o)},d(t){t&&y(e)}}}(t);return{c(){l&&l.c()},m(t,n){l&&l.m(t,n),e=!0},p(t,e){o?o.p&&258&e&&a(o,n,t,t[8],e,Ve,Te):l&&l.p&&2&e&&l.p(t,e)},i(t){e||(st(l,t),e=!0)},o(t){ct(l,t),e=!1},d(t){l&&l.d(t)}}}function Oe(t){let e,n,o,l,i,r,s;const c=[Ie,Ae,Me,He],u=[];function a(t,e){return"number"===t[12].type?0:"symbol"===t[12].type&&t[12].symbol===be?1:"symbol"===t[12].type&&"PREVIOUS_PAGE"===t[12].symbol?2:"symbol"===t[12].type&&"NEXT_PAGE"===t[12].symbol?3:-1}function f(){return t[10](t[12])}return~(n=a(t))&&(o=u[n]=c[n](t)),{c(){e=b("span"),o&&o.c(),l=_(),L(e,"class","option"),M(e,"number","number"===t[12].type),M(e,"prev","symbol"===t[12].type&&"PREVIOUS_PAGE"===t[12].symbol),M(e,"next","symbol"===t[12].type&&"NEXT_PAGE"===t[12].symbol),M(e,"disabled","symbol"===t[12].type&&"NEXT_PAGE"===t[12].symbol&&t[0]>=t[2]||"symbol"===t[12].type&&"PREVIOUS_PAGE"===t[12].symbol&&t[0]<=1),M(e,"ellipsis","symbol"===t[12].type&&t[12].symbol===be),M(e,"active","number"===t[12].type&&t[12].value===t[0])},m(t,o){v(t,e,o),~n&&u[n].m(e,null),g(e,l),i=!0,r||(s=E(e,"click",f),r=!0)},p(i,r){let s=n;n=a(t=i),n===s?~n&&u[n].p(t,r):(o&&(it(),ct(u[s],1,1,(()=>{u[s]=null})),rt()),~n?(o=u[n],o?o.p(t,r):(o=u[n]=c[n](t),o.c()),st(o,1),o.m(e,l)):o=null),2&r&&M(e,"number","number"===t[12].type),2&r&&M(e,"prev","symbol"===t[12].type&&"PREVIOUS_PAGE"===t[12].symbol),2&r&&M(e,"next","symbol"===t[12].type&&"NEXT_PAGE"===t[12].symbol),7&r&&M(e,"disabled","symbol"===t[12].type&&"NEXT_PAGE"===t[12].symbol&&t[0]>=t[2]||"symbol"===t[12].type&&"PREVIOUS_PAGE"===t[12].symbol&&t[0]<=1),2&r&&M(e,"ellipsis","symbol"===t[12].type&&t[12].symbol===be),3&r&&M(e,"active","number"===t[12].type&&t[12].value===t[0])},i(t){i||(st(o),i=!0)},o(t){ct(o),i=!1},d(t){t&&y(e),~n&&u[n].d(),r=!1,s()}}}function je(t){let e,n,o=t[1],l=[];for(let e=0;ect(l[t],1,1,(()=>{l[t]=null}));return{c(){e=b("div");for(let t=0;t{"totalItems"in t&&n(4,c=t.totalItems),"pageSize"in t&&n(5,u=t.pageSize),"currentPage"in t&&n(0,a=t.currentPage),"limit"in t&&n(6,f=t.limit),"showStepOptions"in t&&n(7,d=t.showStepOptions),"$$scope"in t&&n(8,r=t.$$scope)},t.$$.update=()=>{241&t.$$.dirty&&n(1,o=xe({totalItems:c,pageSize:u,currentPage:a,limit:f,showStepOptions:d})),48&t.$$.dirty&&n(2,l=Math.ceil(c/u))},[a,o,l,p,c,u,f,d,r,i,t=>p(t)]}class Re extends yt{constructor(t){super(),vt(this,t,Ne,je,s,{totalItems:4,pageSize:5,currentPage:0,limit:6,showStepOptions:7})}}function ze(t){let e,o,l;const i=[t[0]];let r={};for(let t=0;t{o(0,e=n(n({},e),f(t)))},[e=f(e),function(e){U(t,e)}]}class qe extends yt{constructor(t){super(),vt(this,t,Be,ze,s,{})}}function Ue(e){let n,o,l,i;return{c(){n=x("svg"),o=x("path"),l=x("path"),i=x("path"),L(o,"d","m436 40h-317c-29 0-53 23-53 52v370h53v-370h317v-52zm79 105h-291c-29 0-52 24-52 53v370c0 29 23 52 52 52h291c29 0 53-23 53-52v-370c0-29-24-53-53-53zm0 423h-291v-370h291v370z"),L(l,"d","m634 27-500 500"),L(l,"stroke","currentColor"),L(l,"stroke-linejoin","round"),L(l,"stroke-width","30"),L(i,"d","m134 27 500 500"),L(i,"stroke","currentColor"),L(i,"stroke-linejoin","round"),L(i,"stroke-width","30"),L(n,"width","6.61mm"),L(n,"height","6.61mm"),L(n,"fill","currentColor"),L(n,"viewBox","0 0 661 661")},m(t,e){v(t,n,e),g(n,o),g(n,l),g(n,i)},p:t,i:t,o:t,d(t){t&&y(n)}}}class Ze extends yt{constructor(t){super(),vt(this,t,null,Ue,s,{})}}function Ge(t,e,n){const o=t.slice();return o[58]=e[n],o}function De(t,e,n){const o=t.slice();return o[61]=e[n],o[63]=n,o}function Xe(t){let e,n,o,l,i,r,s,c;return o=new de({props:{$$slots:{default:[Ye]},$$scope:{ctx:t}}}),o.$on("click",t[38]),i=new de({props:{$$slots:{default:[Fe]},$$scope:{ctx:t}}}),i.$on("click",t[37]),{c(){e=b("input"),n=_(),$t(o.$$.fragment),l=_(),$t(i.$$.fragment),L(e,"class","edit-title-input svelte-1qyroo4"),L(e,"type","text")},m(u,a){v(u,e,a),V(e,t[1].title),v(u,n,a),ht(o,u,a),v(u,l,a),ht(i,u,a),r=!0,s||(c=E(e,"input",t[41]),s=!0)},p(t,n){2&n[0]&&e.value!==t[1].title&&V(e,t[1].title);const l={};4&n[2]&&(l.$$scope={dirty:n,ctx:t}),o.$set(l);const r={};4&n[2]&&(r.$$scope={dirty:n,ctx:t}),i.$set(r)},i(t){r||(st(o.$$.fragment,t),st(i.$$.fragment,t),r=!0)},o(t){ct(o.$$.fragment,t),ct(i.$$.fragment,t),r=!1},d(t){t&&y(e),t&&y(n),gt(o,t),t&&y(l),gt(i,t),s=!1,c()}}}function We(t){let e,n,o,l,i,r=t[1]?.title+"";return l=new de({props:{className:"edit-title-btn",$$slots:{default:[Je]},$$scope:{ctx:t}}}),l.$on("click",t[36]),{c(){e=b("div"),n=k(r),o=_(),$t(l.$$.fragment),T(e,"line-height","40px")},m(t,r){v(t,e,r),g(e,n),v(t,o,r),ht(l,t,r),i=!0},p(t,e){(!i||2&e[0])&&r!==(r=t[1]?.title+"")&&S(n,r);const o={};4&e[2]&&(o.$$scope={dirty:e,ctx:t}),l.$set(o)},i(t){i||(st(l.$$.fragment,t),i=!0)},o(t){ct(l.$$.fragment,t),i=!1},d(t){t&&y(e),t&&y(o),gt(l,t)}}}function Ye(t){let e,n;return e=new Rt({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function Fe(t){let e,n;return e=new Ut({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function Je(t){let e,n;return e=new Gt({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function Ke(t){let e,n,o,l,i,r,s,c,u,a,f,d,p,m,$,h=[],w=new Map,x=t[2].length>0&&Qe(t);o=new jt({props:{title:"Add video",$$slots:{default:[en]},$$scope:{ctx:t}}}),o.$on("click",t[25]),i=new jt({props:{title:"Import videos",$$slots:{default:[nn]},$$scope:{ctx:t}}}),i.$on("click",t[28]);let k=t[2].length>0&&on(t),P=!t[17]&&!t[18]&&function(t){let e,n;return e=new jt({props:{title:"Delete the playlist",bgcolor:"#dc3545",$$slots:{default:[fn]},$$scope:{ctx:t}}}),e.$on("click",t[34]),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},p(t,n){const o={};4&n[2]&&(o.$$scope={dirty:n,ctx:t}),e.$set(o)},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}(t),E=t[16];const C=t=>t[61].id;for(let e=0;et[4]?0:t[2].length>0?1:-1}~(d=H(t))&&(p=T[d]=V[d](t));let M=t[2].length>0&&hn(t);return{c(){e=b("div"),x&&x.c(),n=_(),$t(o.$$.fragment),l=_(),$t(i.$$.fragment),r=_(),k&&k.c(),s=_(),P&&P.c(),c=_(),u=b("div");for(let t=0;t0?x?(x.p(t,l),4&l[0]&&st(x,1)):(x=Qe(t),x.c(),st(x,1),x.m(e,n)):x&&(it(),ct(x,1,1,(()=>{x=null})),rt());const r={};4&l[2]&&(r.$$scope={dirty:l,ctx:t}),o.$set(r);const c={};if(4&l[2]&&(c.$$scope={dirty:l,ctx:t}),i.$set(c),t[2].length>0?k?(k.p(t,l),4&l[0]&&st(k,1)):(k=on(t),k.c(),st(k,1),k.m(e,s)):k&&(it(),ct(k,1,1,(()=>{k=null})),rt()),t[17]||t[18]||P.p(t,l),29458688&l[0]){E=t[16],it();for(let t=0;t{T[$]=null})),rt()),~d?(p=T[d],p?p.p(t,l):(p=T[d]=V[d](t),p.c()),st(p,1),p.m(f,m)):p=null),t[2].length>0?M?M.p(t,l):(M=hn(t),M.c(),M.m(f,null)):M&&(M.d(1),M=null)},i(t){if(!$){st(x),st(o.$$.fragment,t),st(i.$$.fragment,t),st(k),st(P);for(let t=0;t1&&rn(t),c=t[18]&&function(t){let e,n;return e=new jt({props:{title:"Clear the playlist builder",bgcolor:"#dc3545",$$slots:{default:[un]},$$scope:{ctx:t}}}),e.$on("click",t[33]),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},p(t,n){const o={};4&n[2]&&(o.$$scope={dirty:n,ctx:t}),e.$set(o)},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}(t);return i=new jt({props:{title:"Save the playlist",bgcolor:"#28a745",$$slots:{default:[an]},$$scope:{ctx:t}}}),i.$on("click",t[32]),{c(){$t(e.$$.fragment),n=_(),s&&s.c(),o=_(),c&&c.c(),l=_(),$t(i.$$.fragment)},m(t,u){ht(e,t,u),v(t,n,u),s&&s.m(t,u),v(t,o,u),c&&c.m(t,u),v(t,l,u),ht(i,t,u),r=!0},p(t,n){const l={};4&n[2]&&(l.$$scope={dirty:n,ctx:t}),e.$set(l),t[2].length>1?s?(s.p(t,n),4&n[0]&&st(s,1)):(s=rn(t),s.c(),st(s,1),s.m(o.parentNode,o)):s&&(it(),ct(s,1,1,(()=>{s=null})),rt()),t[18]&&c.p(t,n);const r={};4&n[2]&&(r.$$scope={dirty:n,ctx:t}),i.$set(r)},i(t){r||(st(e.$$.fragment,t),st(s),st(c),st(i.$$.fragment,t),r=!0)},o(t){ct(e.$$.fragment,t),ct(s),ct(c),ct(i.$$.fragment,t),r=!1},d(t){gt(e,t),t&&y(n),s&&s.d(t),t&&y(o),c&&c.d(t),t&&y(l),gt(i,t)}}}function ln(t){let e,n;return e=new Bt({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function rn(t){let e,n,o,l;return e=new jt({props:{title:"Reverse order",$$slots:{default:[sn]},$$scope:{ctx:t}}}),e.$on("click",t[30]),o=new jt({props:{title:"Remove duplicates",$$slots:{default:[cn]},$$scope:{ctx:t}}}),o.$on("click",t[31]),{c(){$t(e.$$.fragment),n=_(),$t(o.$$.fragment)},m(t,i){ht(e,t,i),v(t,n,i),ht(o,t,i),l=!0},p(t,n){const l={};4&n[2]&&(l.$$scope={dirty:n,ctx:t}),e.$set(l);const i={};4&n[2]&&(i.$$scope={dirty:n,ctx:t}),o.$set(i)},i(t){l||(st(e.$$.fragment,t),st(o.$$.fragment,t),l=!0)},o(t){ct(e.$$.fragment,t),ct(o.$$.fragment,t),l=!1},d(t){gt(e,t),t&&y(n),gt(o,t)}}}function sn(t){let e,n;return e=new Qt({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function cn(t){let e,n;return e=new Ze({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function un(t){let e,n;return e=new Ut({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function an(t){let e,n;return e=new ee({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function fn(t){let e,n;return e=new Ut({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function dn(t){let e;return{c(){e=b("p"),e.textContent="The playlist is empty",T(e,"text-align","center")},m(t,n){v(t,e,n)},d(t){t&&y(e)}}}function pn(e,n){let o,l,r,s,c,u,a=t;function f(...t){return n[42](n[63],...t)}function d(){return n[43](n[63])}function p(...t){return n[44](n[63],...t)}return l=new ge({props:{video:n[61],disableThumbnails:n[15],active:n[8]===n[63]}}),l.$on("delete",n[24]),{key:e,first:null,c(){o=b("div"),$t(l.$$.fragment),L(o,"draggable",!0),L(o,"class","svelte-1qyroo4"),this.first=o},m(t,e){v(t,o,e),ht(l,o,null),s=!0,c||(u=[E(o,"dragstart",f),E(o,"dragenter",d),E(o,"dragover",C(n[40])),E(o,"drop",C(p))],c=!0)},p(t,e){n=t;const o={};65536&e[0]&&(o.video=n[61]),32768&e[0]&&(o.disableThumbnails=n[15]),65792&e[0]&&(o.active=n[8]===n[63]),l.$set(o)},r(){r=o.getBoundingClientRect()},f(){R(o),a()},a(){a(),a=N(o,r,n[39],{})},i(t){s||(st(l.$$.fragment,t),s=!0)},o(t){ct(l.$$.fragment,t),s=!1},d(t){t&&y(o),gt(l),c=!1,i(u)}}}function mn(e){let n;return{c(){n=b("span"),n.textContent="Page size:"},m(t,e){v(t,n,e)},p:t,i:t,o:t,d(t){t&&y(n)}}}function $n(t){let e,n;return e=new qe({props:{totalItems:t[2].length,pageSize:t[4],currentPage:t[3],limit:1,showStepOptions:!0}}),e.$on("setPage",t[20]),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},p(t,n){const o={};4&n[0]&&(o.totalItems=t[2].length),16&n[0]&&(o.pageSize=t[4]),8&n[0]&&(o.currentPage=t[3]),e.$set(o)},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function hn(t){let e,n,o,l=t[19],r=[];for(let e=0;et[45].call(e)))},m(l,i){v(l,e,i);for(let t=0;t{r[c]=null})),rt()),~e?(n=r[e],n?n.p(t,l):(n=r[e]=i[e](t),n.c()),st(n,1),n.m(o.parentNode,o)):n=null)},i(t){l||(st(n),l=!0)},o(t){ct(n),l=!1},d(t){~e&&r[e].d(t),t&&y(o)}}}function kn(t){let e,n;return e=new oe({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function _n(t){let e,n,o,l,i,r,s,c,u,a,f,d,p;e=new we({});const m=[We,Xe],$=[];function h(t,e){return t[0]?1:0}i=h(t),r=$[i]=m[i](t);let w=(t[7]||!t[6])&&Ke(t);function x(e){t[49](e)}let k={$$slots:{default:[xn]},$$scope:{ctx:t}};void 0!==t[9]&&(k.display=t[9]),u=new se({props:k}),G.push((()=>function(t,e,n){const o=t.$$.props[e];void 0!==o&&(t.$$.bound[o]=n,n(t.$$.ctx[o]))}(u,"display",x)));let E=t[6]&&kn();return{c(){$t(e.$$.fragment),n=_(),o=b("main"),l=b("h2"),r.c(),s=_(),w&&w.c(),c=_(),$t(u.$$.fragment),f=_(),E&&E.c(),d=P(),L(l,"class","svelte-1qyroo4")},m(t,r){ht(e,t,r),v(t,n,r),v(t,o,r),g(o,l),$[i].m(l,null),g(o,s),w&&w.m(o,null),v(t,c,r),ht(u,t,r),v(t,f,r),E&&E.m(t,r),v(t,d,r),p=!0},p(t,e){let n=i;i=h(t),i===n?$[i].p(t,e):(it(),ct($[n],1,1,(()=>{$[n]=null})),rt(),r=$[i],r?r.p(t,e):(r=$[i]=m[i](t),r.c()),st(r,1),r.m(l,null)),t[7]||!t[6]?w?(w.p(t,e),192&e[0]&&st(w,1)):(w=Ke(t),w.c(),st(w,1),w.m(o,null)):w&&(it(),ct(w,1,1,(()=>{w=null})),rt());const s={};var c;31776&e[0]|4&e[2]&&(s.$$scope={dirty:e,ctx:t}),!a&&512&e[0]&&(a=!0,s.display=t[9],c=()=>a=!1,X.push(c)),u.$set(s),t[6]?E?64&e[0]&&st(E,1):(E=kn(),E.c(),st(E,1),E.m(d.parentNode,d)):E&&(it(),ct(E,1,1,(()=>{E=null})),rt())},i(t){p||(st(e.$$.fragment,t),st(r),st(w),st(u.$$.fragment,t),st(E),p=!0)},o(t){ct(e.$$.fragment,t),ct(r),ct(w),ct(u.$$.fragment,t),ct(E),p=!1},d(t){gt(e,t),t&&y(n),t&&y(o),$[i].d(),w&&w.d(),t&&y(c),gt(u,t),t&&y(f),E&&E.d(t),t&&y(d)}}}function Pn(t,e,n){let o;var l,i,s=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(l,i){function r(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?l(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,s)}c((o=o.apply(t,e||[])).next())}))};const c=window.videoService;var u;!function(t){t[t.Export=0]="Export",t[t.Import=1]="Import"}(u||(u={}));let{editingTitle:a=!1}=e,{playlist:f=(null===(l=history.state)||void 0===l?void 0:l.playlist)}=e;const d=(null===(i=history.state)||void 0===i?void 0:i.previousPage)||"/",p=location.hash.startsWith("#/new"),m=location.hash.startsWith("#/playlist-builder");let $=!0,h=!1,g=[];function v(t){return s(this,void 0,void 0,(function*(){n(6,$=!0);let e=[];for(let n=(t-1)*b;n0){const t=e.map((t=>g[t].videoId));console.debug("Loading videos",t);const o=yield Promise.all(t.map((t=>c.fetchVideo(t)))),l=[...g];o.forEach(((t,n)=>l[e[n]]=t)),n(2,g=[...l])}n(6,$=!1)}))}const y=[10,20,50];let w=1,b=50;!function(){s(this,void 0,void 0,(function*(){if(m){const t=yield browser.runtime.sendMessage({cmd:"get-playlist-builder"});n(1,f=yield c.generatePlaylist(t))}else{const t=new URL(document.URL),e=t.searchParams.get("id"),o=t.searchParams.get("saved");if(e)n(1,f=o?yield window.getPlaylist(e):yield window.getRecentPlaylist(e)),history.replaceState({playlist:f},"",t.pathname+t.hash);else{const e=t.searchParams.get("videoIds");e&&(n(1,f=yield c.generatePlaylist(e.split(","))),history.replaceState({playlist:f},"",t.pathname+t.hash))}}f?(n(4,b=yield window.fetchObject("page-size",50)),yield Promise.all(f.videos.map((t=>c.fetchVideo(t,!0)))).then((t=>s(this,void 0,void 0,(function*(){n(2,g=[...t]),yield v(w),n(6,$=!1),n(7,h=!0)}))))):St("/")}))}();let x,k,_,P=-1,E=!1,C="",L="",S="",V=!0;window.getSettings().then((t=>{n(15,V=t.disableThumbnails)}));const T=(t,e)=>{t.dataTransfer.dropEffect="move";const o=parseInt(t.dataTransfer.getData("text/plain")),l=g;o<(e=(w-1)*b+e)?(l.splice(e+1,0,l[o]),l.splice(o,1)):(l.splice(e,0,l[o]),l.splice(o+1,1)),n(2,g=l),n(8,P=-1)},H=(t,e)=>{t.dataTransfer.effectAllowed="move",t.dataTransfer.dropEffect="move";const n=(w-1)*b+e;t.dataTransfer.setData("text/plain",n)};function M(){return s(this,void 0,void 0,(function*(){if(m){const t=g.map((t=>t.videoId.toString()));yield browser.runtime.sendMessage({cmd:"update-playlist-builder",playlistBuilder:t})}}))}function A(){x=null,n(0,a=!1)}return t.$$set=t=>{"editingTitle"in t&&n(0,a=t.editingTitle),"playlist"in t&&n(1,f=t.playlist)},t.$$.update=()=>{28&t.$$.dirty[0]&&n(16,o=function({items:t,pageSize:e,currentPage:n}){return t.slice((n-1)*e,(n-1)*e+e)}({items:g,pageSize:b,currentPage:w}))},[a,f,g,w,b,u,$,h,P,E,k,C,L,S,_,V,o,p,m,y,function(t){return s(this,void 0,void 0,(function*(){n(3,w=t.detail.page),yield v(w)}))},function(){return s(this,void 0,void 0,(function*(){n(3,w=1),window.storeObject("page-size",b),yield v(w)}))},T,H,function(t){return s(this,void 0,void 0,(function*(){n(2,g=g.filter((e=>e.id!==t.detail.id))),1==o.length&&w>1&&n(3,w-=1),v(w),yield M()}))},function(){return s(this,void 0,void 0,(function*(){const t=prompt("YouTube url");if(!t)return;const e=c.parseYoutubeId(t);if(e){const t=yield c.fetchVideo(e);n(2,g=[...g,t]),yield M()}else alert("Invalid YouTube url")}))},function(){return s(this,void 0,void 0,(function*(){n(6,$=!0);let t=yield Promise.all(c.parseYoutubeIds(C).map((t=>c.fetchVideo(t))));t=t.filter((t=>null!=t)),n(2,g=[...g,...t]),yield M(),n(11,C=""),n(9,E=!1),n(6,$=!1),setTimeout((()=>alert(`Imported ${t.length} videos`)),100)}))},function(){return s(this,void 0,void 0,(function*(){_.select(),_.setSelectionRange(0,99999),document.execCommand("copy"),n(13,S="Copied !"),setTimeout((()=>n(13,S="")),2e3)}))},function(){return s(this,void 0,void 0,(function*(){n(9,E=!0),n(10,k=u.Import)}))},function(){n(9,E=!0),n(12,L=g.map((t=>t.url)).join("\n")),n(10,k=u.Export)},function(){return s(this,void 0,void 0,(function*(){let t=new Array(g.length);for(let e=0;e{const n=e.videoId.toString();return t[n]||(t[n]=e),t}),{}),e=Object.values(t),o=g.length-e.length;o>0?(n(2,g=e),v(w),yield M(),setTimeout((()=>alert(`Removed ${o} duplicates`)),200)):alert("No duplicates found")}))},function(){return s(this,void 0,void 0,(function*(){const t=g.map((t=>t.videoId.toString()));n(1,f=Object.assign(Object.assign({},f),{videos:t}));const e=yield window.savePlaylist(f);n(1,f=Object.assign(Object.assign({},f),{id:e})),m&&(yield browser.runtime.sendMessage({cmd:"clear-playlist-builder"})),alert("Playlist saved"),yield St("/saved")}))},function(){return s(this,void 0,void 0,(function*(){m&&(n(2,g=[]),yield browser.runtime.sendMessage({cmd:"clear-playlist-builder"}))}))},function(){return s(this,void 0,void 0,(function*(){confirm("The playlist is about to be deleted")&&(yield window.removePlaylist(f),yield St(d))}))},function(){const t=g.map((t=>t.videoId.toString()));n(6,$=!0),c.openPlaylist(t).finally((()=>n(6,$=!1)))},function(){x=f.title,n(0,a=!0)},function(){n(1,f.title=x,f),A()},A,(t,e,n)=>function(t,e,n={}){const o=getComputedStyle(t),l="none"===o.transform?"":o.transform,i=e.from.width/t.clientWidth,s=e.from.height/t.clientHeight,c=(e.from.left-e.to.left)/i,u=(e.from.top-e.to.top)/s,a=Math.sqrt(c*c+u*u),{delay:f=0,duration:d=(t=>120*Math.sqrt(t)),easing:p=Ht}=n;return{delay:f,duration:r(d)?d(a):d,easing:p,css:(t,e)=>`transform: ${l} translate(${e*c}px, ${e*u}px);`}}(t,e,{duration:1e3,easing:Mt}),function(e){U(t,e)},function(){f.title=this.value,n(1,f)},(t,e)=>H(e,t),t=>n(8,P=t),(t,e)=>T(e,t),function(){b=function(t){const e=t.querySelector(":checked")||t.options[0];return e&&e.__value}(this),n(4,b),n(19,y)},function(){L=this.value,n(12,L)},function(t){G[t?"unshift":"push"]((()=>{_=t,n(14,_)}))},function(){C=this.value,n(11,C)},function(t){E=t,n(9,E)}]}class En extends yt{constructor(t){super(),vt(this,t,Pn,_n,s,{editingTitle:0,playlist:1},[-1,-1,-1])}}function Cn(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Ln(e){let n,o;return n=new En({props:{playlist:e[3],editingTitle:!0}}),{c(){$t(n.$$.fragment)},m(t,e){ht(n,t,e),o=!0},p:t,i(t){o||(st(n.$$.fragment,t),o=!0)},o(t){ct(n.$$.fragment,t),o=!1},d(t){gt(n,t)}}}function Sn(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Vn(t){let e,n,o={ctx:t,current:null,token:null,hasCatch:!1,pending:Sn,then:Ln,catch:Cn,value:3,blocks:[,,,]};return ut(t[0],o),{c(){e=P(),o.block.c()},m(t,l){v(t,e,l),o.block.m(t,o.anchor=l),o.mount=()=>e.parentNode,o.anchor=e,n=!0},p(e,[n]){{const l=(t=e).slice();l[3]=o.resolved,o.block.p(l,n)}},i(t){n||(st(o.block),n=!0)},o(t){for(let t=0;t<3;t+=1){ct(o.blocks[t])}n=!1},d(t){t&&y(e),o.block.d(t),o.token=null,o=null}}}function Tn(t){var e=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(l,i){function r(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?l(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,s)}c((o=o.apply(t,e||[])).next())}))};return[function(){return e(this,void 0,void 0,(function*(){let t=yield window.videoService.generatePlaylist();return Object.assign(Object.assign({},t),{title:"Playlist title"})}))}()]}class Hn extends yt{constructor(t){super(),vt(this,t,Tn,Vn,s,{})}}function Mn(e){let n,o,l,i,r,s,c=e[0].videos.length+"";return{c(){n=b("div"),o=b("span"),l=k("("),i=k(c),r=k(")"),L(n,"class",s="playlist-count "+e[1]+" svelte-1yak261")},m(t,e){v(t,n,e),g(n,o),g(o,l),g(o,i),g(o,r)},p(t,[e]){1&e&&c!==(c=t[0].videos.length+"")&&S(i,c),2&e&&s!==(s="playlist-count "+t[1]+" svelte-1yak261")&&L(n,"class",s)},i:t,o:t,d(t){t&&y(n)}}}function An(t,e,n){let{playlist:o}=e,{className:l=""}=e;return t.$$set=t=>{"playlist"in t&&n(0,o=t.playlist),"className"in t&&n(1,l=t.className)},[o,l]}class In extends yt{constructor(t){super(),vt(this,t,An,Mn,s,{playlist:0,className:1})}}function On(t){let e,n;return e=new In({props:{playlist:t[0],className:"preview-count"}}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},p(t,n){const o={};1&n&&(o.playlist=t[0]),e.$set(o)},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function jn(t){let e,n,o,l,i,r,s,c,u,a,f,d,p;return d=new In({props:{playlist:t[0],className:"preview-img"}}),{c(){e=b("div"),n=b("img"),l=_(),i=b("img"),s=_(),c=b("div"),u=b("img"),f=_(),$t(d.$$.fragment),L(n,"class","preview-img svelte-j52w8t"),L(n,"alt","Playlist Video Thumbail 1"),n.src!==(o=t[2].getVideoThumbnailUrl(t[3][0]))&&L(n,"src",o),L(i,"class","preview-img svelte-j52w8t"),L(i,"alt","Playlist Video Thumbail 2"),i.src!==(r=t[2].getVideoThumbnailUrl(t[3][1]))&&L(i,"src",r),L(e,"class","preview-row"),L(u,"class","preview-img svelte-j52w8t"),L(u,"alt","Playlist Video Thumbail 3"),u.src!==(a=t[2].getVideoThumbnailUrl(t[3][2]))&&L(u,"src",a),L(c,"class","preview-row")},m(t,o){v(t,e,o),g(e,n),g(e,l),g(e,i),v(t,s,o),v(t,c,o),g(c,u),g(c,f),ht(d,c,null),p=!0},p(t,e){const n={};1&e&&(n.playlist=t[0]),d.$set(n)},i(t){p||(st(d.$$.fragment,t),p=!0)},o(t){ct(d.$$.fragment,t),p=!1},d(t){t&&y(e),t&&y(s),t&&y(c),gt(d)}}}function Nn(t){let e,n,o,l,i,r,s,c,u,a=t[0].title+"";const f=[jn,On],d=[];function p(t,e){return t[1]?1:0}return n=p(t),o=d[n]=f[n](t),{c(){e=b("div"),o.c(),l=_(),i=b("span"),r=k(a),L(i,"class","preview-title svelte-j52w8t"),L(e,"class","preview svelte-j52w8t")},m(o,a){v(o,e,a),d[n].m(e,null),g(e,l),g(e,i),g(i,r),s=!0,c||(u=E(e,"click",C(t[4])),c=!0)},p(t,[i]){let c=n;n=p(t),n===c?d[n].p(t,i):(it(),ct(d[c],1,1,(()=>{d[c]=null})),rt(),o=d[n],o?o.p(t,i):(o=d[n]=f[n](t),o.c()),st(o,1),o.m(e,l)),(!s||1&i)&&a!==(a=t[0].title+"")&&S(r,a)},i(t){s||(st(o),s=!0)},o(t){ct(o),s=!1},d(t){t&&y(e),d[n].d(),c=!1,u()}}}function Rn(t,e,n){var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(l,i){function r(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?l(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,s)}c((o=o.apply(t,e||[])).next())}))};const l=window.videoService;let{playlist:i}=e,{disableThumbnails:r=!1}=e;const s=i.videos;return t.$$set=t=>{"playlist"in t&&n(0,i=t.playlist),"disableThumbnails"in t&&n(1,r=t.disableThumbnails)},[i,r,l,s,function(){return o(this,void 0,void 0,(function*(){l.openPlaylistEditor(i)}))}]}class zn extends yt{constructor(t){super(),vt(this,t,Rn,Nn,s,{playlist:0,disableThumbnails:1})}}function Bn(t,e,n){const o=t.slice();return o[2]=e[n],o}function qn(t){let e;return{c(){e=b("p"),e.textContent="No playlist found",T(e,"text-align","center")},m(t,n){v(t,e,n)},d(t){t&&y(e)}}}function Un(t,e){let n,o,l;return o=new zn({props:{playlist:e[2],disableThumbnails:e[1]}}),{key:t,first:null,c(){n=P(),$t(o.$$.fragment),this.first=n},m(t,e){v(t,n,e),ht(o,t,e),l=!0},p(t,n){e=t;const l={};1&n&&(l.playlist=e[2]),2&n&&(l.disableThumbnails=e[1]),o.$set(l)},i(t){l||(st(o.$$.fragment,t),l=!0)},o(t){ct(o.$$.fragment,t),l=!1},d(t){t&&y(n),gt(o,t)}}}function Zn(t){let e,n,o=[],l=new Map,i=t[0];const r=t=>t[2].id;for(let e=0;e{n(1,l=t.disableThumbnails)})),t.$$set=t=>{"playlists"in t&&n(0,o=t.playlists)},[o,l]}class Dn extends yt{constructor(t){super(),vt(this,t,Gn,Zn,s,{playlists:0})}}function Xn(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Wn(e){let n,o;return n=new Dn({props:{playlists:e[1]}}),{c(){$t(n.$$.fragment)},m(t,e){ht(n,t,e),o=!0},p:t,i(t){o||(st(n.$$.fragment,t),o=!0)},o(t){ct(n.$$.fragment,t),o=!1},d(t){gt(n,t)}}}function Yn(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Fn(t){let e,n,o,l;e=new we({});let i={ctx:t,current:null,token:null,hasCatch:!1,pending:Yn,then:Wn,catch:Xn,value:1,blocks:[,,,]};return ut(t[0],i),{c(){$t(e.$$.fragment),n=_(),o=b("main"),i.block.c()},m(t,r){ht(e,t,r),v(t,n,r),v(t,o,r),i.block.m(o,i.anchor=null),i.mount=()=>o,i.anchor=null,l=!0},p(e,[n]){{const o=(t=e).slice();o[1]=i.resolved,i.block.p(o,n)}},i(t){l||(st(e.$$.fragment,t),st(i.block),l=!0)},o(t){ct(e.$$.fragment,t);for(let t=0;t<3;t+=1){ct(i.blocks[t])}l=!1},d(t){gt(e,t),t&&y(n),t&&y(o),i.block.d(),i.token=null,i=null}}}function Jn(t){return[window.getRecentPlaylists()]}class Kn extends yt{constructor(t){super(),vt(this,t,Jn,Fn,s,{})}}function Qn(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function to(e){let n,o;return n=new Dn({props:{playlists:e[1]}}),{c(){$t(n.$$.fragment)},m(t,e){ht(n,t,e),o=!0},p:t,i(t){o||(st(n.$$.fragment,t),o=!0)},o(t){ct(n.$$.fragment,t),o=!1},d(t){gt(n,t)}}}function eo(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function no(t){let e,n,o,l;e=new we({});let i={ctx:t,current:null,token:null,hasCatch:!1,pending:eo,then:to,catch:Qn,value:1,blocks:[,,,]};return ut(t[0],i),{c(){$t(e.$$.fragment),n=_(),o=b("main"),i.block.c()},m(t,r){ht(e,t,r),v(t,n,r),v(t,o,r),i.block.m(o,i.anchor=null),i.mount=()=>o,i.anchor=null,l=!0},p(e,[n]){{const o=(t=e).slice();o[1]=i.resolved,i.block.p(o,n)}},i(t){l||(st(e.$$.fragment,t),st(i.block),l=!0)},o(t){ct(e.$$.fragment,t);for(let t=0;t<3;t+=1){ct(i.blocks[t])}l=!1},d(t){gt(e,t),t&&y(n),t&&y(o),i.block.d(),i.token=null,i=null}}}function oo(t){return[window.getPlaylists()]}class lo extends yt{constructor(t){super(),vt(this,t,oo,no,s,{})}}function io(e){let n,o;return n=new Tt({props:{routes:e[0]}}),{c(){$t(n.$$.fragment)},m(t,e){ht(n,t,e),o=!0},p:t,i(t){o||(st(n.$$.fragment,t),o=!0)},o(t){ct(n.$$.fragment,t),o=!1},d(t){gt(n,t)}}}function ro(t){return[{"/":Kn,"/recent":Kn,"/new":Hn,"/saved":lo,"/editor":En,"/playlist-builder":En,"*":Kn}]}window.savePlaylist||(import("./storage-service.js"),import("./video-service.js"));const so=new class extends yt{constructor(t){super(),vt(this,t,ro,io,s,{})}}({target:document.body});export default so; +function t(){}const e=t=>t;function n(t,e){for(const n in e)t[n]=e[n];return t}function o(t){return t()}function l(){return Object.create(null)}function i(t){t.forEach(o)}function r(t){return"function"==typeof t}function s(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}function c(t,e,n,o){if(t){const l=a(t,e,n,o);return t[0](l)}}function a(t,e,o,l){return t[1]&&l?n(o.ctx.slice(),t[1](l(e))):o.ctx}function u(t,e,n,o,l,i,r){const s=function(t,e,n,o){if(t[2]&&o){const l=t[2](o(n));if(void 0===e.dirty)return l;if("object"==typeof l){const t=[],n=Math.max(e.dirty.length,l.length);for(let o=0;owindow.performance.now():()=>Date.now(),m=d?t=>requestAnimationFrame(t):t;const $=new Set;function h(t){$.forEach((e=>{e.c(t)||($.delete(e),e.f())})),0!==$.size&&m(h)}function g(t,e){t.appendChild(e)}function v(t,e,n){t.insertBefore(e,n||null)}function y(t){t.parentNode.removeChild(t)}function w(t,e){for(let n=0;nt.removeEventListener(e,n,o)}function C(t){return function(e){return e.preventDefault(),t.call(this,e)}}function S(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function L(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function V(t,e){t.value=null==e?"":e}function T(t,e,n,o){t.style.setProperty(e,n,o?"important":"")}function M(t,e){for(let n=0;nt.indexOf(e)<0:t=>-1===t.indexOf("__svelte")),l=n.length-o.length;l&&(t.style.animation=o.join(", "),O-=l,O||m((()=>{O||(A.forEach((t=>{const e=t.__svelte_stylesheet;let n=e.cssRules.length;for(;n--;)e.deleteRule(n);t.__svelte_rules={}})),A.clear())})))}function N(n,o,l,i){if(!o)return t;const r=n.getBoundingClientRect();if(o.left===r.left&&o.right===r.right&&o.top===r.top&&o.bottom===r.bottom)return t;const{delay:s=0,duration:c=300,easing:a=e,start:u=p()+s,end:f=u+c,tick:d=t,css:g}=l(n,{from:o,to:r},i);let v,y=!0,w=!1;function x(){g&&j(n,v),y=!1}return function(t){let e;0===$.size&&m(h),new Promise((n=>{$.add(e={c:t,f:n})}))}((t=>{if(!w&&t>=u&&(w=!0),w&&t>=f&&(d(1,0),x()),!y)return!1;if(w){const e=0+1*a((t-u)/c);d(e,1-e)}return!0})),g&&(v=function(t,e,n,o,l,i,r,s=0){const c=16.666/o;let a="{\n";for(let t=0;t<=1;t+=c){const o=e+(n-e)*i(t);a+=100*t+`%{${r(o,1-o)}}\n`}const u=a+`100% {${r(n,1-n)}}\n}`,f=`__svelte_${function(t){let e=5381,n=t.length;for(;n--;)e=(e<<5)-e^t.charCodeAt(n);return e>>>0}(u)}_${s}`,d=t.ownerDocument;A.add(d);const p=d.__svelte_stylesheet||(d.__svelte_stylesheet=d.head.appendChild(b("style")).sheet),m=d.__svelte_rules||(d.__svelte_rules={});m[f]||(m[f]=!0,p.insertRule(`@keyframes ${f} ${u}`,p.cssRules.length));const $=t.style.animation||"";return t.style.animation=`${$?`${$}, `:""}${f} ${o}ms linear ${l}ms 1 both`,O+=1,f}(n,0,1,c,s,a,g)),s||(w=!0),d(0,1),x}function R(t){const e=getComputedStyle(t);if("absolute"!==e.position&&"fixed"!==e.position){const{width:n,height:o}=e,l=t.getBoundingClientRect();t.style.position="absolute",t.style.width=n,t.style.height=o,function(t,e){const n=t.getBoundingClientRect();if(e.left!==n.left||e.top!==n.top){const o=getComputedStyle(t),l="none"===o.transform?"":o.transform;t.style.transform=`${l} translate(${e.left-n.left}px, ${e.top-n.top}px)`}}(t,l)}}function z(t){I=t}function B(){if(!I)throw new Error("Function called outside component initialization");return I}function q(){const t=B();return(e,n)=>{const o=t.$$.callbacks[e];if(o){const l=function(t,e){const n=document.createEvent("CustomEvent");return n.initCustomEvent(t,!1,!1,e),n}(e,n);o.slice().forEach((e=>{e.call(t,l)}))}}}function U(t,e){const n=t.$$.callbacks[e.type];n&&n.slice().forEach((t=>t(e)))}const Z=[],G=[],D=[],X=[],W=Promise.resolve();let Y=!1;function F(){Y||(Y=!0,W.then(et))}function J(){return F(),W}function K(t){D.push(t)}let Q=!1;const tt=new Set;function et(){if(!Q){Q=!0;do{for(let t=0;t{ot.delete(t),o&&(n&&t.d(1),o())})),t.o(e)}}function at(t,e){const n=e.token={};function o(t,o,l,i){if(e.token!==n)return;e.resolved=i;let r=e.ctx;void 0!==l&&(r=r.slice(),r[l]=i);const s=t&&(e.current=t)(r);let c=!1;e.block&&(e.blocks?e.blocks.forEach(((t,n)=>{n!==o&&t&&(it(),ct(t,1,1,(()=>{e.blocks[n]===t&&(e.blocks[n]=null)})),rt())})):e.block.d(1),s.c(),st(s,1),s.m(e.mount(),e.anchor),c=!0),e.block=s,e.blocks&&(e.blocks[o]=s),c&&et()}if((l=t)&&"object"==typeof l&&"function"==typeof l.then){const n=B();if(t.then((t=>{z(n),o(e.then,1,e.value,t),z(null)}),(t=>{if(z(n),o(e.catch,2,e.error,t),z(null),!e.hasCatch)throw t})),e.current!==e.pending)return o(e.pending,0),!0}else{if(e.current!==e.then)return o(e.then,1,e.value,t),!0;e.resolved=t}var l}function ut(t,e){ct(t,1,1,(()=>{e.delete(t.key)}))}function ft(t,e){t.f(),ut(t,e)}function dt(t,e,n,o,l,i,r,s,c,a,u,f){let d=t.length,p=i.length,m=d;const $={};for(;m--;)$[t[m].key]=m;const h=[],g=new Map,v=new Map;for(m=p;m--;){const t=f(l,i,m),s=n(t);let c=r.get(s);c?o&&c.p(t,e):(c=a(s,t),c.c()),g.set(s,h[m]=c),s in $&&v.set(s,Math.abs(m-$[s]))}const y=new Set,w=new Set;function b(t){st(t,1),t.m(s,u),r.set(t.key,t),u=t.first,p--}for(;d&&p;){const e=h[p-1],n=t[d-1],o=e.key,l=n.key;e===n?(u=e.first,d--,p--):g.has(l)?!r.has(o)||y.has(o)?b(e):w.has(l)?d--:v.get(o)>v.get(l)?(w.add(o),b(e)):(y.add(l),d--):(c(n,r),d--)}for(;d--;){const e=t[d];g.has(e.key)||c(e,r)}for(;p;)b(h[p-1]);return h}function pt(t,e){const n={},o={},l={$$scope:1};let i=t.length;for(;i--;){const r=t[i],s=e[i];if(s){for(const t in r)t in s||(o[t]=1);for(const t in s)l[t]||(n[t]=s[t],l[t]=1);t[i]=s}else for(const t in r)l[t]=1}for(const t in o)t in n||(n[t]=void 0);return n}function mt(t){return"object"==typeof t&&null!==t?t:{}}function $t(t){t&&t.c()}function ht(t,e,n,l){const{fragment:s,on_mount:c,on_destroy:a,after_update:u}=t.$$;s&&s.m(e,n),l||K((()=>{const e=c.map(o).filter(r);a?a.push(...e):i(e),t.$$.on_mount=[]})),u.forEach(K)}function gt(t,e){const n=t.$$;null!==n.fragment&&(i(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function vt(e,n,o,r,s,c,a=[-1]){const u=I;z(e);const f=e.$$={fragment:null,ctx:null,props:c,update:t,not_equal:s,bound:l(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(u?u.$$.context:[]),callbacks:l(),dirty:a,skip_bound:!1};let d=!1;if(f.ctx=o?o(e,n.props||{},((t,n,...o)=>{const l=o.length?o[0]:n;return f.ctx&&s(f.ctx[t],f.ctx[t]=l)&&(!f.skip_bound&&f.bound[t]&&f.bound[t](l),d&&function(t,e){-1===t.$$.dirty[0]&&(Z.push(t),F(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const t=n.indexOf(e);-1!==t&&n.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const wt=[];function bt(t,e){return{subscribe:xt(t,e).subscribe}}function xt(e,n=t){let o;const l=[];function i(t){if(s(e,t)&&(e=t,o)){const t=!wt.length;for(let t=0;t{const t=l.indexOf(c);-1!==t&&l.splice(t,1),0===l.length&&(o(),o=null)}}}}function kt(e,n,o){const l=!Array.isArray(e),s=l?[e]:e,c=n.length<2;return bt(o,(e=>{let o=!1;const a=[];let u=0,f=t;const d=()=>{if(u)return;f();const o=n(l?a[0]:a,e);c?e(o):f=r(o)?o:t},p=s.map(((e,n)=>function(e,...n){if(null==e)return t;const o=e.subscribe(...n);return o.unsubscribe?()=>o.unsubscribe():o}(e,(t=>{a[n]=t,u&=~(1<{u|=1<{gt(t,1)})),rt()}r?(e=new r(s()),e.$on("routeEvent",t[7]),$t(e.$$.fragment),st(e.$$.fragment,1),ht(e,o.parentNode,o)):e=null}else r&&e.$set(l)},i(t){l||(e&&st(e.$$.fragment,t),l=!0)},o(t){e&&ct(e.$$.fragment,t),l=!1},d(t){t&&y(o),e&>(e,t)}}}function _t(t){let e,o,l;const i=[{params:t[1]},t[2]];var r=t[0];function s(t){let e={};for(let t=0;t{gt(t,1)})),rt()}r?(e=new r(s()),e.$on("routeEvent",t[6]),$t(e.$$.fragment),st(e.$$.fragment,1),ht(e,o.parentNode,o)):e=null}else r&&e.$set(l)},i(t){l||(e&&st(e.$$.fragment,t),l=!0)},o(t){e&&ct(e.$$.fragment,t),l=!1},d(t){t&&y(o),e&>(e,t)}}}function Et(t){let e,n,o,l;const i=[_t,Pt],r=[];function s(t,e){return t[1]?0:1}return e=s(t),n=r[e]=i[e](t),{c(){n.c(),o=_()},m(t,n){r[e].m(t,n),v(t,o,n),l=!0},p(t,[l]){let c=e;e=s(t),e===c?r[e].p(t,l):(it(),ct(r[c],1,1,(()=>{r[c]=null})),rt(),n=r[e],n?n.p(t,l):(n=r[e]=i[e](t),n.c()),st(n,1),n.m(o.parentNode,o))},i(t){l||(st(n),l=!0)},o(t){ct(n),l=!1},d(t){r[e].d(t),t&&y(o)}}}function Ct(){const t=window.location.href.indexOf("#/");let e=t>-1?window.location.href.substr(t+1):"/";const n=e.indexOf("?");let o="";return n>-1&&(o=e.substr(n+1),e=e.substr(0,n)),{location:e,querystring:o}}const St=bt(null,(function(t){t(Ct());const e=()=>{t(Ct())};return window.addEventListener("hashchange",e,!1),function(){window.removeEventListener("hashchange",e,!1)}}));async function Lt(t){if(!t||t.length<1||"/"!=t.charAt(0)&&0!==t.indexOf("#/"))throw Error("Invalid parameter location");await J();const e=("#"==t.charAt(0)?"":"#")+t;try{window.history.replaceState(void 0,void 0,e)}catch(t){console.warn("Caught exception while replacing the current page. If you're running this in the Svelte REPL, please note that the `replace` method might not work in this environment.")}window.dispatchEvent(new Event("hashchange"))}function Vt(t,e,n){let{routes:o={}}=e,{prefix:l=""}=e,{restoreScrollState:i=!1}=e;class r{constructor(t,e){if(!e||"function"!=typeof e&&("object"!=typeof e||!0!==e._sveltesparouter))throw Error("Invalid component object");if(!t||"string"==typeof t&&(t.length<1||"/"!=t.charAt(0)&&"*"!=t.charAt(0))||"object"==typeof t&&!(t instanceof RegExp))throw Error('Invalid value for "path" argument - strings must start with / or *');const{pattern:n,keys:o}=function(t,e){if(t instanceof RegExp)return{keys:!1,pattern:t};var n,o,l,i,r=[],s="",c=t.split("/");for(c[0]||c.shift();l=c.shift();)"*"===(n=l[0])?(r.push("wild"),s+="/(.*)"):":"===n?(o=l.indexOf("?",1),i=l.indexOf(".",1),r.push(l.substring(1,~o?o:~i?i:l.length)),s+=~o&&!~i?"(?:/([^/]+?))?":"/([^/]+?)",~i&&(s+=(~o?"?":"")+"\\"+l.substring(i))):s+="/"+l;return{keys:r,pattern:new RegExp("^"+s+(e?"(?=$|/)":"/?$"),"i")}}(t);this.path=t,"object"==typeof e&&!0===e._sveltesparouter?(this.component=e.component,this.conditions=e.conditions||[],this.userData=e.userData,this.props=e.props||{}):(this.component=()=>Promise.resolve(e),this.conditions=[],this.props={}),this._pattern=n,this._keys=o}match(t){if(l)if("string"==typeof l){if(!t.startsWith(l))return null;t=t.substr(l.length)||"/"}else if(l instanceof RegExp){const e=t.match(l);if(!e||!e[0])return null;t=t.substr(e[0].length)||"/"}const e=this._pattern.exec(t);if(null===e)return null;if(!1===this._keys)return e;const n={};let o=0;for(;o{s.push(new r(e,t))})):Object.keys(o).forEach((t=>{s.push(new r(t,o[t]))}));let c=null,a=null,u={};const f=q();async function d(t,e){await J(),f(t,e)}let p=null;var m;i&&(window.addEventListener("popstate",(t=>{p=t.state&&t.state.scrollY?t.state:null})),m=()=>{p?window.scrollTo(p.scrollX,p.scrollY):window.scrollTo(0,0)},B().$$.after_update.push(m));let $=null,h=null;return St.subscribe((async t=>{$=t;let e=0;for(;e{"routes"in t&&n(3,o=t.routes),"prefix"in t&&n(4,l=t.prefix),"restoreScrollState"in t&&n(5,i=t.restoreScrollState)},t.$$.update=()=>{32&t.$$.dirty&&(history.scrollRestoration=i?"manual":"auto")},[c,a,u,o,l,i,function(e){U(t,e)},function(e){U(t,e)}]}kt(St,(t=>t.location)),kt(St,(t=>t.querystring));class Tt extends yt{constructor(t){super(),vt(this,t,Vt,Et,s,{routes:3,prefix:4,restoreScrollState:5})}}function Mt(t){const e=t-1;return e*e*e+1}function Ht(t){return 1===t?t:1-Math.pow(2,-10*t)}function At(t){let e,n;return{c(){e=b("span"),n=k(t[0]),S(e,"class","tooltip svelte-ixha0v"),T(e,"background-color",t[1])},m(t,o){v(t,e,o),g(e,n)},p(t,o){1&o&&L(n,t[0]),2&o&&T(e,"background-color",t[1])},d(t){t&&y(e)}}}function It(t){let e,n,o,l,i;const r=t[3].default,s=c(r,t,t[2],null);let a=!!t[0]&&At(t);return{c(){e=b("div"),s&&s.c(),n=P(),a&&a.c(),S(e,"class","fab svelte-ixha0v"),T(e,"background-color",t[1])},m(r,c){v(r,e,c),s&&s.m(e,null),g(e,n),a&&a.m(e,null),o=!0,l||(i=E(e,"click",t[4]),l=!0)},p(t,[n]){s&&s.p&&4&n&&u(s,r,t,t[2],n,null,null),t[0]?a?a.p(t,n):(a=At(t),a.c(),a.m(e,null)):a&&(a.d(1),a=null),(!o||2&n)&&T(e,"background-color",t[1])},i(t){o||(st(s,t),o=!0)},o(t){ct(s,t),o=!1},d(t){t&&y(e),s&&s.d(t),a&&a.d(),l=!1,i()}}}function Ot(t,e,n){let{$$slots:o={},$$scope:l}=e,{title:i=""}=e,{bgcolor:r="#007bff"}=e;return t.$$set=t=>{"title"in t&&n(0,i=t.title),"bgcolor"in t&&n(1,r=t.bgcolor),"$$scope"in t&&n(2,l=t.$$scope)},[i,r,l,o,function(e){U(t,e)}]}class jt extends yt{constructor(t){super(),vt(this,t,Ot,It,s,{title:0,bgcolor:1})}}function Nt(e){let n,o;return{c(){n=x("svg"),o=x("path"),S(o,"fill","currentColor"),S(o,"d","M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z"),T(n,"width","24px"),T(n,"height","24px"),S(n,"viewBox","0 0 24 24")},m(t,e){v(t,n,e),g(n,o)},p:t,i:t,o:t,d(t){t&&y(n)}}}class Rt extends yt{constructor(t){super(),vt(this,t,null,Nt,s,{})}}function zt(e){let n,o;return{c(){n=x("svg"),o=x("path"),S(o,"fill","currentColor"),S(o,"d","M4 7H2V21C2 22.1 2.9 23 4 23H18V21H4M20 3H16.8C16.4 1.8 15.3 1 14 1C12.7 1 11.6 1.8 11.2 3H8C6.9 3 6 3.9 6 5V17C6 18.1 6.9 19 8 19H20C21.1 19 22 18.1 22 17V5C22 3.9 21.1 3 20 3M14 3C14.6 3 15 3.5 15 4C15 4.5 14.5 5 14 5C13.5 5 13 4.5 13 4C13 3.5 13.4 3 14 3Z"),T(n,"width","24px"),T(n,"height","24px"),S(n,"viewBox","0 0 24 24")},m(t,e){v(t,n,e),g(n,o)},p:t,i:t,o:t,d(t){t&&y(n)}}}class Bt extends yt{constructor(t){super(),vt(this,t,null,zt,s,{})}}function qt(e){let n,o;return{c(){n=x("svg"),o=x("path"),S(o,"fill","currentColor"),S(o,"d","M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"),T(n,"width","24px"),T(n,"height","24px"),S(n,"viewBox","0 0 24 24")},m(t,e){v(t,n,e),g(n,o)},p:t,i:t,o:t,d(t){t&&y(n)}}}class Ut extends yt{constructor(t){super(),vt(this,t,null,qt,s,{})}}function Zt(e){let n,o;return{c(){n=x("svg"),o=x("path"),S(o,"fill","currentColor"),S(o,"d","M20.71,7.04C21.1,6.65 21.1,6 20.71,5.63L18.37,3.29C18,2.9 17.35,2.9 16.96,3.29L15.12,5.12L18.87,8.87M3,17.25V21H6.75L17.81,9.93L14.06,6.18L3,17.25Z"),T(n,"width","24px"),T(n,"height","24px"),S(n,"viewBox","0 0 24 24")},m(t,e){v(t,n,e),g(n,o)},p:t,i:t,o:t,d(t){t&&y(n)}}}class Gt extends yt{constructor(t){super(),vt(this,t,null,Zt,s,{})}}function Dt(e){let n,o;return{c(){n=x("svg"),o=x("path"),S(o,"fill","currentColor"),S(o,"d","M19,9H2V11H19V9M19,5H2V7H19V5M2,15H15V13H2V15M17,13V19L22,16L17,13Z"),T(n,"width","24px"),T(n,"height","24px"),S(n,"viewBox","0 0 24 24")},m(t,e){v(t,n,e),g(n,o)},p:t,i:t,o:t,d(t){t&&y(n)}}}class Xt extends yt{constructor(t){super(),vt(this,t,null,Dt,s,{})}}function Wt(e){let n,o;return{c(){n=x("svg"),o=x("path"),S(o,"fill","currentColor"),S(o,"d","M2,16H10V14H2M18,14V10H16V14H12V16H16V20H18V16H22V14M14,6H2V8H14M14,10H2V12H14V10Z"),T(n,"width","24px"),T(n,"height","24px"),S(n,"viewBox","0 0 24 24")},m(t,e){v(t,n,e),g(n,o)},p:t,i:t,o:t,d(t){t&&y(n)}}}class Yt extends yt{constructor(t){super(),vt(this,t,null,Wt,s,{})}}function Ft(e){let n,o;return{c(){n=x("svg"),o=x("path"),S(o,"fill","currentColor"),S(o,"d","M19,11H15V15H13V11H9V9H13V5H15V9H19M20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16V4A2,2 0 0,0 20,2M4,6H2V20A2,2 0 0,0 4,22H18V20H4V6Z"),T(n,"width","24px"),T(n,"height","24px"),S(n,"viewBox","0 0 24 24")},m(t,e){v(t,n,e),g(n,o)},p:t,i:t,o:t,d(t){t&&y(n)}}}class Jt extends yt{constructor(t){super(),vt(this,t,null,Ft,s,{})}}function Kt(e){let n,o,l;return{c(){n=x("svg"),o=x("path"),l=x("path"),S(o,"fill","currentColor"),S(o,"d","M 6.164062,0 3.0644531,4.8320311 0,9.6855465 4.0312497,9.7597654 V 23.999999 H 7.9902341 V 9.8183594 L 12,9.8632814 9.1015622,4.921875 Z"),S(l,"fill","currentColor"),S(l,"d","M 16.03125,0 V 14.240234 L 12,14.314452 l 3.064452,4.853517 3.09961,4.83203 2.937499,-4.921874 2.898438,-4.941406 -4.009765,0.04492 V 0 Z"),T(n,"width","24px"),T(n,"height","24px"),S(n,"viewBox","0 0 24 24")},m(t,e){v(t,n,e),g(n,o),g(n,l)},p:t,i:t,o:t,d(t){t&&y(n)}}}class Qt extends yt{constructor(t){super(),vt(this,t,null,Kt,s,{})}}function te(e){let n,o;return{c(){n=x("svg"),o=x("path"),S(o,"fill","currentColor"),S(o,"d","M15,9H5V5H15M12,19A3,3 0 0,1 9,16A3,3 0 0,1 12,13A3,3 0 0,1 15,16A3,3 0 0,1 12,19M17,3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V7L17,3Z"),T(n,"width","24px"),T(n,"height","24px"),S(n,"viewBox","0 0 24 24")},m(t,e){v(t,n,e),g(n,o)},p:t,i:t,o:t,d(t){t&&y(n)}}}class ee extends yt{constructor(t){super(),vt(this,t,null,te,s,{})}}function ne(e){let n;return{c(){n=b("div"),n.innerHTML='',S(n,"class","loading-modal svelte-vts1wm")},m(t,e){v(t,n,e)},p:t,i:t,o:t,d(t){t&&y(n)}}}class oe extends yt{constructor(t){super(),vt(this,t,null,ne,s,{})}}function le(t){let e,n,o,l,i;const r=t[3].default,s=c(r,t,t[2],null);return{c(){e=b("div"),n=b("div"),s&&s.c(),S(n,"class","modal-content svelte-tis5cv"),S(e,"class","modal svelte-tis5cv")},m(r,c){v(r,e,c),g(e,n),s&&s.m(n,null),o=!0,l||(i=E(e,"click",t[1]),l=!0)},p(t,e){s&&s.p&&4&e&&u(s,r,t,t[2],e,null,null)},i(t){o||(st(s,t),o=!0)},o(t){ct(s,t),o=!1},d(t){t&&y(e),s&&s.d(t),l=!1,i()}}}function ie(t){let e,n,o=t[0]&&le(t);return{c(){o&&o.c(),e=_()},m(t,l){o&&o.m(t,l),v(t,e,l),n=!0},p(t,[n]){t[0]?o?(o.p(t,n),1&n&&st(o,1)):(o=le(t),o.c(),st(o,1),o.m(e.parentNode,e)):o&&(it(),ct(o,1,1,(()=>{o=null})),rt())},i(t){n||(st(o),n=!0)},o(t){ct(o),n=!1},d(t){o&&o.d(t),t&&y(e)}}}function re(t,e,n){let{$$slots:o={},$$scope:l}=e,{display:i=!1}=e;return t.$$set=t=>{"display"in t&&n(0,i=t.display),"$$scope"in t&&n(2,l=t.$$scope)},[i,function(t){t.target.classList.contains("modal")&&n(0,i=!1)},l,o]}class se extends yt{constructor(t){super(),vt(this,t,re,ie,s,{display:0})}}function ce(e){let n,o;return{c(){n=x("svg"),o=x("path"),S(o,"fill","currentColor"),S(o,"d","M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z"),T(n,"width","24px"),T(n,"height","24px"),S(n,"viewBox","0 0 24 24")},m(t,e){v(t,n,e),g(n,o)},p:t,i:t,o:t,d(t){t&&y(n)}}}class ae extends yt{constructor(t){super(),vt(this,t,null,ce,s,{})}}function ue(t){let e,n,o,l,i;const r=t[2].default,s=c(r,t,t[1],null);return{c(){e=b("div"),s&&s.c(),S(e,"class",n="btn "+t[0]+" svelte-s5f6cg")},m(n,r){v(n,e,r),s&&s.m(e,null),o=!0,l||(i=E(e,"click",t[3]),l=!0)},p(t,[l]){s&&s.p&&2&l&&u(s,r,t,t[1],l,null,null),(!o||1&l&&n!==(n="btn "+t[0]+" svelte-s5f6cg"))&&S(e,"class",n)},i(t){o||(st(s,t),o=!0)},o(t){ct(s,t),o=!1},d(t){t&&y(e),s&&s.d(t),l=!1,i()}}}function fe(t,e,n){let{$$slots:o={},$$scope:l}=e,{className:i=""}=e;return t.$$set=t=>{"className"in t&&n(0,i=t.className),"$$scope"in t&&n(1,l=t.$$scope)},[i,l,o,function(e){U(t,e)}]}class de extends yt{constructor(t){super(),vt(this,t,fe,ue,s,{className:0})}}function pe(t){let e,n,o,l,i;return{c(){e=b("img"),S(e,"alt",n=t[0].title),e.src!==(o=t[0].thumbnailUrl)&&S(e,"src",o),S(e,"class","svelte-189upy5")},m(n,o){v(n,e,o),l||(i=E(e,"click",C(t[3])),l=!0)},p(t,l){1&l&&n!==(n=t[0].title)&&S(e,"alt",n),1&l&&e.src!==(o=t[0].thumbnailUrl)&&S(e,"src",o)},d(t){t&&y(e),l=!1,i()}}}function me(t){let e,n;return e=new ae({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function $e(t){let e,n,o,l,i,r,s,c,a,u,f,d,p=t[0].title+"",m=t[0].channel+"",$=!t[2]&&pe(t);return f=new de({props:{$$slots:{default:[me]},$$scope:{ctx:t}}}),f.$on("click",t[4]),{c(){e=b("div"),$&&$.c(),n=P(),o=b("div"),l=b("span"),i=k(p),r=P(),s=b("span"),c=k(m),a=P(),u=b("div"),$t(f.$$.fragment),S(l,"class","video-title svelte-189upy5"),S(s,"class","svelte-189upy5"),S(o,"class","video-details svelte-189upy5"),S(u,"class","video-btns svelte-189upy5"),S(e,"class","playlist-video svelte-189upy5"),H(e,"is-active",t[1])},m(t,p){v(t,e,p),$&&$.m(e,null),g(e,n),g(e,o),g(o,l),g(l,i),g(o,r),g(o,s),g(s,c),g(e,a),g(e,u),ht(f,u,null),d=!0},p(t,[o]){t[2]?$&&($.d(1),$=null):$?$.p(t,o):($=pe(t),$.c(),$.m(e,n)),(!d||1&o)&&p!==(p=t[0].title+"")&&L(i,p),(!d||1&o)&&m!==(m=t[0].channel+"")&&L(c,m);const l={};64&o&&(l.$$scope={dirty:o,ctx:t}),f.$set(l),2&o&&H(e,"is-active",t[1])},i(t){d||(st(f.$$.fragment,t),d=!0)},o(t){ct(f.$$.fragment,t),d=!1},d(t){t&&y(e),$&&$.d(),gt(f)}}}function he(t,e,n){let{video:o}=e,{active:l}=e,{disableThumbnails:i=!1}=e;const r=q();return t.$$set=t=>{"video"in t&&n(0,o=t.video),"active"in t&&n(1,l=t.active),"disableThumbnails"in t&&n(2,i=t.disableThumbnails)},[o,l,i,function(){window.open(o.url,"_blank")},function(t){r("delete",o)}]}class ge extends yt{constructor(t){super(),vt(this,t,he,$e,s,{video:0,active:1,disableThumbnails:2})}}function ve(e){let n,o,l,i,r,s,c,a;return{c(){n=b("div"),o=b("a"),o.textContent="Recently created playlists",l=P(),i=b("a"),i.textContent="New playlist",r=P(),s=b("a"),s.textContent="Saved playlists",c=P(),a=b("a"),a.textContent="Manage playlists",S(o,"href","#/recent"),S(o,"class","svelte-l6y9si"),H(o,"active",ye("recent","#",".html")),S(i,"href","#/new"),S(i,"class","svelte-l6y9si"),H(i,"active",ye("new")),S(s,"href","#/saved"),S(s,"class","svelte-l6y9si"),H(s,"active",ye("saved")),S(a,"href","#/manage"),S(a,"class","svelte-l6y9si"),H(a,"active",ye("settings")),S(n,"class","sidenav svelte-l6y9si")},m(t,e){v(t,n,e),g(n,o),g(n,l),g(n,i),g(n,r),g(n,s),g(n,c),g(n,a)},p:t,i:t,o:t,d(t){t&&y(n)}}}function ye(...t){return t.some((t=>location.href.endsWith(t)||location.href.endsWith(t+"/")))}class we extends yt{constructor(t){super(),vt(this,t,null,ve,s,{})}}const be="ELLIPSIS";function xe({totalItems:t,pageSize:e,currentPage:n,limit:o=null,showStepOptions:l=!1}){const i=Math.ceil(t/e),r=function({limit:t}){return 2*t+3+2}({limit:o});let s=o&&i>r?function({totalPages:t,limit:e,currentPage:n}){const o=2*e+2,l=1+o,i=t-o,r=l+2;if(n<=l-e)return Array(r).fill(null).map(((e,n)=>n===r-1?{type:"number",value:t}:n===r-2?{type:"symbol",symbol:be,value:l+1}:{type:"number",value:n+1}));if(n>=i+e)return Array(r).fill(null).map(((t,e)=>0===e?{type:"number",value:1}:1===e?{type:"symbol",symbol:be,value:i-1}:{type:"number",value:i+e-2}));if(n>=l-e&&n<=i+e)return Array(r).fill(null).map(((o,l)=>0===l?{type:"number",value:1}:1===l?{type:"symbol",symbol:be,value:n-e+(l-2)}:l===r-1?{type:"number",value:t}:l===r-2?{type:"symbol",symbol:be,value:n+e+1}:{type:"number",value:n-e+(l-2)}))}({totalPages:i,limit:o,currentPage:n}):function({totalPages:t}){return new Array(t).fill(null).map(((t,e)=>({type:"number",value:e+1})))}({totalPages:i});return l?function({options:t,currentPage:e,totalPages:n}){return[{type:"symbol",symbol:"PREVIOUS_PAGE",value:e<=1?1:e-1},...t,{type:"symbol",symbol:"NEXT_PAGE",value:e>=n?n:e+1}]}({options:s,currentPage:n,totalPages:i}):s}function ke(t,e,n){const o=t.slice();return o[12]=e[n],o}const Pe=t=>({}),_e=t=>({}),Ee=t=>({}),Ce=t=>({}),Se=t=>({}),Le=t=>({}),Ve=t=>({value:2&t}),Te=t=>({value:t[12].value});function Me(t){let e;const n=t[9].next,o=c(n,t,t[8],_e),l=o||function(t){let e,n;return{c(){e=x("svg"),n=x("path"),S(n,"fill","#000000"),S(n,"d","M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"),T(e,"width","24px"),T(e,"height","24px"),S(e,"viewBox","0 0 24 24")},m(t,o){v(t,e,o),g(e,n)},d(t){t&&y(e)}}}();return{c(){l&&l.c()},m(t,n){l&&l.m(t,n),e=!0},p(t,e){o&&o.p&&256&e&&u(o,n,t,t[8],e,Pe,_e)},i(t){e||(st(l,t),e=!0)},o(t){ct(l,t),e=!1},d(t){l&&l.d(t)}}}function He(t){let e;const n=t[9].prev,o=c(n,t,t[8],Ce),l=o||function(t){let e,n;return{c(){e=x("svg"),n=x("path"),S(n,"fill","#000000"),S(n,"d","M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z"),T(e,"width","24px"),T(e,"height","24px"),S(e,"viewBox","0 0 24 24")},m(t,o){v(t,e,o),g(e,n)},d(t){t&&y(e)}}}();return{c(){l&&l.c()},m(t,n){l&&l.m(t,n),e=!0},p(t,e){o&&o.p&&256&e&&u(o,n,t,t[8],e,Ee,Ce)},i(t){e||(st(l,t),e=!0)},o(t){ct(l,t),e=!1},d(t){l&&l.d(t)}}}function Ae(t){let e;const n=t[9].ellipsis,o=c(n,t,t[8],Le),l=o||function(t){let e;return{c(){e=b("span"),e.textContent="..."},m(t,n){v(t,e,n)},d(t){t&&y(e)}}}();return{c(){l&&l.c()},m(t,n){l&&l.m(t,n),e=!0},p(t,e){o&&o.p&&256&e&&u(o,n,t,t[8],e,Se,Le)},i(t){e||(st(l,t),e=!0)},o(t){ct(l,t),e=!1},d(t){l&&l.d(t)}}}function Ie(t){let e;const n=t[9].number,o=c(n,t,t[8],Te),l=o||function(t){let e,n,o=t[12].value+"";return{c(){e=b("span"),n=k(o)},m(t,o){v(t,e,o),g(e,n)},p(t,e){2&e&&o!==(o=t[12].value+"")&&L(n,o)},d(t){t&&y(e)}}}(t);return{c(){l&&l.c()},m(t,n){l&&l.m(t,n),e=!0},p(t,e){o?o.p&&258&e&&u(o,n,t,t[8],e,Ve,Te):l&&l.p&&2&e&&l.p(t,e)},i(t){e||(st(l,t),e=!0)},o(t){ct(l,t),e=!1},d(t){l&&l.d(t)}}}function Oe(t){let e,n,o,l,i,r,s;const c=[Ie,Ae,He,Me],a=[];function u(t,e){return"number"===t[12].type?0:"symbol"===t[12].type&&t[12].symbol===be?1:"symbol"===t[12].type&&"PREVIOUS_PAGE"===t[12].symbol?2:"symbol"===t[12].type&&"NEXT_PAGE"===t[12].symbol?3:-1}function f(){return t[10](t[12])}return~(n=u(t))&&(o=a[n]=c[n](t)),{c(){e=b("span"),o&&o.c(),l=P(),S(e,"class","option"),H(e,"number","number"===t[12].type),H(e,"prev","symbol"===t[12].type&&"PREVIOUS_PAGE"===t[12].symbol),H(e,"next","symbol"===t[12].type&&"NEXT_PAGE"===t[12].symbol),H(e,"disabled","symbol"===t[12].type&&"NEXT_PAGE"===t[12].symbol&&t[0]>=t[2]||"symbol"===t[12].type&&"PREVIOUS_PAGE"===t[12].symbol&&t[0]<=1),H(e,"ellipsis","symbol"===t[12].type&&t[12].symbol===be),H(e,"active","number"===t[12].type&&t[12].value===t[0])},m(t,o){v(t,e,o),~n&&a[n].m(e,null),g(e,l),i=!0,r||(s=E(e,"click",f),r=!0)},p(i,r){let s=n;n=u(t=i),n===s?~n&&a[n].p(t,r):(o&&(it(),ct(a[s],1,1,(()=>{a[s]=null})),rt()),~n?(o=a[n],o?o.p(t,r):(o=a[n]=c[n](t),o.c()),st(o,1),o.m(e,l)):o=null),2&r&&H(e,"number","number"===t[12].type),2&r&&H(e,"prev","symbol"===t[12].type&&"PREVIOUS_PAGE"===t[12].symbol),2&r&&H(e,"next","symbol"===t[12].type&&"NEXT_PAGE"===t[12].symbol),7&r&&H(e,"disabled","symbol"===t[12].type&&"NEXT_PAGE"===t[12].symbol&&t[0]>=t[2]||"symbol"===t[12].type&&"PREVIOUS_PAGE"===t[12].symbol&&t[0]<=1),2&r&&H(e,"ellipsis","symbol"===t[12].type&&t[12].symbol===be),3&r&&H(e,"active","number"===t[12].type&&t[12].value===t[0])},i(t){i||(st(o),i=!0)},o(t){ct(o),i=!1},d(t){t&&y(e),~n&&a[n].d(),r=!1,s()}}}function je(t){let e,n,o=t[1],l=[];for(let e=0;ect(l[t],1,1,(()=>{l[t]=null}));return{c(){e=b("div");for(let t=0;t{"totalItems"in t&&n(4,c=t.totalItems),"pageSize"in t&&n(5,a=t.pageSize),"currentPage"in t&&n(0,u=t.currentPage),"limit"in t&&n(6,f=t.limit),"showStepOptions"in t&&n(7,d=t.showStepOptions),"$$scope"in t&&n(8,r=t.$$scope)},t.$$.update=()=>{241&t.$$.dirty&&n(1,o=xe({totalItems:c,pageSize:a,currentPage:u,limit:f,showStepOptions:d})),48&t.$$.dirty&&n(2,l=Math.ceil(c/a))},[u,o,l,p,c,a,f,d,r,i,t=>p(t)]}class Re extends yt{constructor(t){super(),vt(this,t,Ne,je,s,{totalItems:4,pageSize:5,currentPage:0,limit:6,showStepOptions:7})}}function ze(t){let e,o,l;const i=[t[0]];let r={};for(let t=0;t{o(0,e=n(n({},e),f(t)))},[e=f(e),function(e){U(t,e)}]}class qe extends yt{constructor(t){super(),vt(this,t,Be,ze,s,{})}}function Ue(e){let n,o,l,i;return{c(){n=x("svg"),o=x("path"),l=x("path"),i=x("path"),S(o,"d","m436 40h-317c-29 0-53 23-53 52v370h53v-370h317v-52zm79 105h-291c-29 0-52 24-52 53v370c0 29 23 52 52 52h291c29 0 53-23 53-52v-370c0-29-24-53-53-53zm0 423h-291v-370h291v370z"),S(l,"d","m634 27-500 500"),S(l,"stroke","currentColor"),S(l,"stroke-linejoin","round"),S(l,"stroke-width","30"),S(i,"d","m134 27 500 500"),S(i,"stroke","currentColor"),S(i,"stroke-linejoin","round"),S(i,"stroke-width","30"),S(n,"width","6.61mm"),S(n,"height","6.61mm"),S(n,"fill","currentColor"),S(n,"viewBox","0 0 661 661")},m(t,e){v(t,n,e),g(n,o),g(n,l),g(n,i)},p:t,i:t,o:t,d(t){t&&y(n)}}}class Ze extends yt{constructor(t){super(),vt(this,t,null,Ue,s,{})}}function Ge(t,e,n){const o=t.slice();return o[58]=e[n],o}function De(t,e,n){const o=t.slice();return o[61]=e[n],o[63]=n,o}function Xe(t){let e,n,o,l,i,r,s,c;return o=new de({props:{$$slots:{default:[Ye]},$$scope:{ctx:t}}}),o.$on("click",t[38]),i=new de({props:{$$slots:{default:[Fe]},$$scope:{ctx:t}}}),i.$on("click",t[37]),{c(){e=b("input"),n=P(),$t(o.$$.fragment),l=P(),$t(i.$$.fragment),S(e,"class","edit-title-input svelte-1qyroo4"),S(e,"type","text")},m(a,u){v(a,e,u),V(e,t[1].title),v(a,n,u),ht(o,a,u),v(a,l,u),ht(i,a,u),r=!0,s||(c=E(e,"input",t[41]),s=!0)},p(t,n){2&n[0]&&e.value!==t[1].title&&V(e,t[1].title);const l={};4&n[2]&&(l.$$scope={dirty:n,ctx:t}),o.$set(l);const r={};4&n[2]&&(r.$$scope={dirty:n,ctx:t}),i.$set(r)},i(t){r||(st(o.$$.fragment,t),st(i.$$.fragment,t),r=!0)},o(t){ct(o.$$.fragment,t),ct(i.$$.fragment,t),r=!1},d(t){t&&y(e),t&&y(n),gt(o,t),t&&y(l),gt(i,t),s=!1,c()}}}function We(t){let e,n,o,l,i,r=t[1]?.title+"";return l=new de({props:{className:"edit-title-btn",$$slots:{default:[Je]},$$scope:{ctx:t}}}),l.$on("click",t[36]),{c(){e=b("div"),n=k(r),o=P(),$t(l.$$.fragment),T(e,"line-height","40px")},m(t,r){v(t,e,r),g(e,n),v(t,o,r),ht(l,t,r),i=!0},p(t,e){(!i||2&e[0])&&r!==(r=t[1]?.title+"")&&L(n,r);const o={};4&e[2]&&(o.$$scope={dirty:e,ctx:t}),l.$set(o)},i(t){i||(st(l.$$.fragment,t),i=!0)},o(t){ct(l.$$.fragment,t),i=!1},d(t){t&&y(e),t&&y(o),gt(l,t)}}}function Ye(t){let e,n;return e=new Rt({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function Fe(t){let e,n;return e=new Ut({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function Je(t){let e,n;return e=new Gt({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function Ke(t){let e,n,o,l,i,r,s,c,a,u,f,d,p,m,$,h=[],w=new Map,x=t[2].length>0&&Qe(t);o=new jt({props:{title:"Add video",$$slots:{default:[en]},$$scope:{ctx:t}}}),o.$on("click",t[25]),i=new jt({props:{title:"Import videos",$$slots:{default:[nn]},$$scope:{ctx:t}}}),i.$on("click",t[28]);let k=t[2].length>0&&on(t),_=!t[17]&&!t[18]&&function(t){let e,n;return e=new jt({props:{title:"Delete the playlist",bgcolor:"#dc3545",$$slots:{default:[fn]},$$scope:{ctx:t}}}),e.$on("click",t[34]),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},p(t,n){const o={};4&n[2]&&(o.$$scope={dirty:n,ctx:t}),e.$set(o)},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}(t),E=t[16];const C=t=>t[61].id;for(let e=0;et[4]?0:t[2].length>0?1:-1}~(d=M(t))&&(p=T[d]=V[d](t));let H=t[2].length>0&&hn(t);return{c(){e=b("div"),x&&x.c(),n=P(),$t(o.$$.fragment),l=P(),$t(i.$$.fragment),r=P(),k&&k.c(),s=P(),_&&_.c(),c=P(),a=b("div");for(let t=0;t0?x?(x.p(t,l),4&l[0]&&st(x,1)):(x=Qe(t),x.c(),st(x,1),x.m(e,n)):x&&(it(),ct(x,1,1,(()=>{x=null})),rt());const r={};4&l[2]&&(r.$$scope={dirty:l,ctx:t}),o.$set(r);const c={};if(4&l[2]&&(c.$$scope={dirty:l,ctx:t}),i.$set(c),t[2].length>0?k?(k.p(t,l),4&l[0]&&st(k,1)):(k=on(t),k.c(),st(k,1),k.m(e,s)):k&&(it(),ct(k,1,1,(()=>{k=null})),rt()),t[17]||t[18]||_.p(t,l),29458688&l[0]){E=t[16],it();for(let t=0;t{T[$]=null})),rt()),~d?(p=T[d],p?p.p(t,l):(p=T[d]=V[d](t),p.c()),st(p,1),p.m(f,m)):p=null),t[2].length>0?H?H.p(t,l):(H=hn(t),H.c(),H.m(f,null)):H&&(H.d(1),H=null)},i(t){if(!$){st(x),st(o.$$.fragment,t),st(i.$$.fragment,t),st(k),st(_);for(let t=0;t1&&rn(t),c=t[18]&&function(t){let e,n;return e=new jt({props:{title:"Clear the playlist builder",bgcolor:"#dc3545",$$slots:{default:[an]},$$scope:{ctx:t}}}),e.$on("click",t[33]),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},p(t,n){const o={};4&n[2]&&(o.$$scope={dirty:n,ctx:t}),e.$set(o)},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}(t);return i=new jt({props:{title:"Save the playlist",bgcolor:"#28a745",$$slots:{default:[un]},$$scope:{ctx:t}}}),i.$on("click",t[32]),{c(){$t(e.$$.fragment),n=P(),s&&s.c(),o=P(),c&&c.c(),l=P(),$t(i.$$.fragment)},m(t,a){ht(e,t,a),v(t,n,a),s&&s.m(t,a),v(t,o,a),c&&c.m(t,a),v(t,l,a),ht(i,t,a),r=!0},p(t,n){const l={};4&n[2]&&(l.$$scope={dirty:n,ctx:t}),e.$set(l),t[2].length>1?s?(s.p(t,n),4&n[0]&&st(s,1)):(s=rn(t),s.c(),st(s,1),s.m(o.parentNode,o)):s&&(it(),ct(s,1,1,(()=>{s=null})),rt()),t[18]&&c.p(t,n);const r={};4&n[2]&&(r.$$scope={dirty:n,ctx:t}),i.$set(r)},i(t){r||(st(e.$$.fragment,t),st(s),st(c),st(i.$$.fragment,t),r=!0)},o(t){ct(e.$$.fragment,t),ct(s),ct(c),ct(i.$$.fragment,t),r=!1},d(t){gt(e,t),t&&y(n),s&&s.d(t),t&&y(o),c&&c.d(t),t&&y(l),gt(i,t)}}}function ln(t){let e,n;return e=new Bt({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function rn(t){let e,n,o,l;return e=new jt({props:{title:"Reverse order",$$slots:{default:[sn]},$$scope:{ctx:t}}}),e.$on("click",t[30]),o=new jt({props:{title:"Remove duplicates",$$slots:{default:[cn]},$$scope:{ctx:t}}}),o.$on("click",t[31]),{c(){$t(e.$$.fragment),n=P(),$t(o.$$.fragment)},m(t,i){ht(e,t,i),v(t,n,i),ht(o,t,i),l=!0},p(t,n){const l={};4&n[2]&&(l.$$scope={dirty:n,ctx:t}),e.$set(l);const i={};4&n[2]&&(i.$$scope={dirty:n,ctx:t}),o.$set(i)},i(t){l||(st(e.$$.fragment,t),st(o.$$.fragment,t),l=!0)},o(t){ct(e.$$.fragment,t),ct(o.$$.fragment,t),l=!1},d(t){gt(e,t),t&&y(n),gt(o,t)}}}function sn(t){let e,n;return e=new Qt({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function cn(t){let e,n;return e=new Ze({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function an(t){let e,n;return e=new Ut({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function un(t){let e,n;return e=new ee({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function fn(t){let e,n;return e=new Ut({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function dn(t){let e;return{c(){e=b("p"),e.textContent="The playlist is empty",T(e,"text-align","center")},m(t,n){v(t,e,n)},d(t){t&&y(e)}}}function pn(e,n){let o,l,r,s,c,a,u=t;function f(...t){return n[42](n[63],...t)}function d(){return n[43](n[63])}function p(...t){return n[44](n[63],...t)}return l=new ge({props:{video:n[61],disableThumbnails:n[15],active:n[8]===n[63]}}),l.$on("delete",n[24]),{key:e,first:null,c(){o=b("div"),$t(l.$$.fragment),S(o,"draggable",!0),S(o,"class","svelte-1qyroo4"),this.first=o},m(t,e){v(t,o,e),ht(l,o,null),s=!0,c||(a=[E(o,"dragstart",f),E(o,"dragenter",d),E(o,"dragover",C(n[40])),E(o,"drop",C(p))],c=!0)},p(t,e){n=t;const o={};65536&e[0]&&(o.video=n[61]),32768&e[0]&&(o.disableThumbnails=n[15]),65792&e[0]&&(o.active=n[8]===n[63]),l.$set(o)},r(){r=o.getBoundingClientRect()},f(){R(o),u()},a(){u(),u=N(o,r,n[39],{})},i(t){s||(st(l.$$.fragment,t),s=!0)},o(t){ct(l.$$.fragment,t),s=!1},d(t){t&&y(o),gt(l),c=!1,i(a)}}}function mn(e){let n;return{c(){n=b("span"),n.textContent="Page size:"},m(t,e){v(t,n,e)},p:t,i:t,o:t,d(t){t&&y(n)}}}function $n(t){let e,n;return e=new qe({props:{totalItems:t[2].length,pageSize:t[4],currentPage:t[3],limit:1,showStepOptions:!0}}),e.$on("setPage",t[20]),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},p(t,n){const o={};4&n[0]&&(o.totalItems=t[2].length),16&n[0]&&(o.pageSize=t[4]),8&n[0]&&(o.currentPage=t[3]),e.$set(o)},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function hn(t){let e,n,o,l=t[19],r=[];for(let e=0;et[45].call(e)))},m(l,i){v(l,e,i);for(let t=0;t{r[c]=null})),rt()),~e?(n=r[e],n?n.p(t,l):(n=r[e]=i[e](t),n.c()),st(n,1),n.m(o.parentNode,o)):n=null)},i(t){l||(st(n),l=!0)},o(t){ct(n),l=!1},d(t){~e&&r[e].d(t),t&&y(o)}}}function kn(t){let e,n;return e=new oe({}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function Pn(t){let e,n,o,l,i,r,s,c,a,u,f,d,p;e=new we({});const m=[We,Xe],$=[];function h(t,e){return t[0]?1:0}i=h(t),r=$[i]=m[i](t);let w=(t[7]||!t[6])&&Ke(t);function x(e){t[49](e)}let k={$$slots:{default:[xn]},$$scope:{ctx:t}};void 0!==t[9]&&(k.display=t[9]),a=new se({props:k}),G.push((()=>function(t,e,n){const o=t.$$.props[e];void 0!==o&&(t.$$.bound[o]=n,n(t.$$.ctx[o]))}(a,"display",x)));let E=t[6]&&kn();return{c(){$t(e.$$.fragment),n=P(),o=b("main"),l=b("h2"),r.c(),s=P(),w&&w.c(),c=P(),$t(a.$$.fragment),f=P(),E&&E.c(),d=_(),S(l,"class","svelte-1qyroo4")},m(t,r){ht(e,t,r),v(t,n,r),v(t,o,r),g(o,l),$[i].m(l,null),g(o,s),w&&w.m(o,null),v(t,c,r),ht(a,t,r),v(t,f,r),E&&E.m(t,r),v(t,d,r),p=!0},p(t,e){let n=i;i=h(t),i===n?$[i].p(t,e):(it(),ct($[n],1,1,(()=>{$[n]=null})),rt(),r=$[i],r?r.p(t,e):(r=$[i]=m[i](t),r.c()),st(r,1),r.m(l,null)),t[7]||!t[6]?w?(w.p(t,e),192&e[0]&&st(w,1)):(w=Ke(t),w.c(),st(w,1),w.m(o,null)):w&&(it(),ct(w,1,1,(()=>{w=null})),rt());const s={};var c;31776&e[0]|4&e[2]&&(s.$$scope={dirty:e,ctx:t}),!u&&512&e[0]&&(u=!0,s.display=t[9],c=()=>u=!1,X.push(c)),a.$set(s),t[6]?E?64&e[0]&&st(E,1):(E=kn(),E.c(),st(E,1),E.m(d.parentNode,d)):E&&(it(),ct(E,1,1,(()=>{E=null})),rt())},i(t){p||(st(e.$$.fragment,t),st(r),st(w),st(a.$$.fragment,t),st(E),p=!0)},o(t){ct(e.$$.fragment,t),ct(r),ct(w),ct(a.$$.fragment,t),ct(E),p=!1},d(t){gt(e,t),t&&y(n),t&&y(o),$[i].d(),w&&w.d(),t&&y(c),gt(a,t),t&&y(f),E&&E.d(t),t&&y(d)}}}function _n(t,e,n){let o;var l,i,s=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(l,i){function r(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?l(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,s)}c((o=o.apply(t,e||[])).next())}))};const c=window.videoService;var a;!function(t){t[t.Export=0]="Export",t[t.Import=1]="Import"}(a||(a={}));let{editingTitle:u=!1}=e,{playlist:f=(null===(l=history.state)||void 0===l?void 0:l.playlist)}=e;const d=(null===(i=history.state)||void 0===i?void 0:i.previousPage)||"/",p=location.hash.startsWith("#/new"),m=location.hash.startsWith("#/playlist-builder");let $=!0,h=!1,g=[];function v(t){return s(this,void 0,void 0,(function*(){n(6,$=!0);let e=[];for(let n=(t-1)*b;n0){const t=e.map((t=>g[t].videoId));console.debug("Loading videos",t);const o=yield Promise.all(t.map((t=>c.fetchVideo(t)))),l=[...g];o.forEach(((t,n)=>l[e[n]]=t)),n(2,g=[...l])}n(6,$=!1)}))}const y=[10,20,50];let w=1,b=50;!function(){s(this,void 0,void 0,(function*(){if(m){const t=yield browser.runtime.sendMessage({cmd:"get-playlist-builder"});n(1,f=yield c.generatePlaylist(t))}else{const t=new URL(document.URL),e=t.searchParams.get("id"),o=t.searchParams.get("saved");if(e)n(1,f=o?yield window.getPlaylist(e):yield window.getRecentPlaylist(e)),history.replaceState({playlist:f},"",t.pathname+t.hash);else{const e=t.searchParams.get("videoIds");e&&(n(1,f=yield c.generatePlaylist(e.split(","))),history.replaceState({playlist:f},"",t.pathname+t.hash))}}f?(n(4,b=yield window.fetchObject("page-size",50)),yield Promise.all(f.videos.map((t=>c.fetchVideo(t,!0)))).then((t=>s(this,void 0,void 0,(function*(){n(2,g=[...t]),yield v(w),n(6,$=!1),n(7,h=!0)}))))):Lt("/")}))}();let x,k,P,_=-1,E=!1,C="",S="",L="",V=!0;window.getSettings().then((t=>{n(15,V=t.disableThumbnails)}));const T=(t,e)=>{t.dataTransfer.dropEffect="move";const o=parseInt(t.dataTransfer.getData("text/plain")),l=g;o<(e=(w-1)*b+e)?(l.splice(e+1,0,l[o]),l.splice(o,1)):(l.splice(e,0,l[o]),l.splice(o+1,1)),n(2,g=l),n(8,_=-1)},M=(t,e)=>{t.dataTransfer.effectAllowed="move",t.dataTransfer.dropEffect="move";const n=(w-1)*b+e;t.dataTransfer.setData("text/plain",n)};function H(){return s(this,void 0,void 0,(function*(){if(m){const t=g.map((t=>t.videoId.toString()));yield browser.runtime.sendMessage({cmd:"update-playlist-builder",playlistBuilder:t})}}))}function A(){x=null,n(0,u=!1)}return t.$$set=t=>{"editingTitle"in t&&n(0,u=t.editingTitle),"playlist"in t&&n(1,f=t.playlist)},t.$$.update=()=>{28&t.$$.dirty[0]&&n(16,o=function({items:t,pageSize:e,currentPage:n}){return t.slice((n-1)*e,(n-1)*e+e)}({items:g,pageSize:b,currentPage:w}))},[u,f,g,w,b,a,$,h,_,E,k,C,S,L,P,V,o,p,m,y,function(t){return s(this,void 0,void 0,(function*(){n(3,w=t.detail.page),yield v(w)}))},function(){return s(this,void 0,void 0,(function*(){n(3,w=1),window.storeObject("page-size",b),yield v(w)}))},T,M,function(t){return s(this,void 0,void 0,(function*(){n(2,g=g.filter((e=>e.id!==t.detail.id))),1==o.length&&w>1&&n(3,w-=1),v(w),yield H()}))},function(){return s(this,void 0,void 0,(function*(){const t=prompt("YouTube url");if(!t)return;const e=c.parseYoutubeId(t);if(e){const t=yield c.fetchVideo(e);n(2,g=[...g,t]),yield H()}else alert("Invalid YouTube url")}))},function(){return s(this,void 0,void 0,(function*(){n(6,$=!0);let t=yield Promise.all(c.parseYoutubeIds(C).map((t=>c.fetchVideo(t))));t=t.filter((t=>null!=t)),n(2,g=[...g,...t]),yield H(),n(11,C=""),n(9,E=!1),n(6,$=!1),setTimeout((()=>alert(`Imported ${t.length} videos`)),100)}))},function(){return s(this,void 0,void 0,(function*(){P.select(),P.setSelectionRange(0,99999),document.execCommand("copy"),n(13,L="Copied !"),setTimeout((()=>n(13,L="")),2e3)}))},function(){return s(this,void 0,void 0,(function*(){n(9,E=!0),n(10,k=a.Import)}))},function(){n(9,E=!0),n(12,S=g.map((t=>t.url)).join("\n")),n(10,k=a.Export)},function(){return s(this,void 0,void 0,(function*(){let t=new Array(g.length);for(let e=0;e{const n=e.videoId.toString();return t[n]||(t[n]=e),t}),{}),e=Object.values(t),o=g.length-e.length;o>0?(n(2,g=e),v(w),yield H(),setTimeout((()=>alert(`Removed ${o} duplicates`)),200)):alert("No duplicates found")}))},function(){return s(this,void 0,void 0,(function*(){const t=g.map((t=>t.videoId.toString()));n(1,f=Object.assign(Object.assign({},f),{videos:t}));const e=yield window.savePlaylist(f);n(1,f=Object.assign(Object.assign({},f),{id:e})),m&&(yield browser.runtime.sendMessage({cmd:"clear-playlist-builder"})),alert("Playlist saved"),yield Lt("/saved")}))},function(){return s(this,void 0,void 0,(function*(){m&&(n(2,g=[]),yield browser.runtime.sendMessage({cmd:"clear-playlist-builder"}))}))},function(){return s(this,void 0,void 0,(function*(){confirm("The playlist is about to be deleted")&&(yield window.removePlaylist(f),yield Lt(d))}))},function(){const t=g.map((t=>t.videoId.toString()));n(6,$=!0),c.openPlaylist(t).finally((()=>n(6,$=!1)))},function(){x=f.title,n(0,u=!0)},function(){n(1,f.title=x,f),A()},A,(t,e,n)=>function(t,e,n={}){const o=getComputedStyle(t),l="none"===o.transform?"":o.transform,i=e.from.width/t.clientWidth,s=e.from.height/t.clientHeight,c=(e.from.left-e.to.left)/i,a=(e.from.top-e.to.top)/s,u=Math.sqrt(c*c+a*a),{delay:f=0,duration:d=(t=>120*Math.sqrt(t)),easing:p=Mt}=n;return{delay:f,duration:r(d)?d(u):d,easing:p,css:(t,e)=>`transform: ${l} translate(${e*c}px, ${e*a}px);`}}(t,e,{duration:1e3,easing:Ht}),function(e){U(t,e)},function(){f.title=this.value,n(1,f)},(t,e)=>M(e,t),t=>n(8,_=t),(t,e)=>T(e,t),function(){b=function(t){const e=t.querySelector(":checked")||t.options[0];return e&&e.__value}(this),n(4,b),n(19,y)},function(){S=this.value,n(12,S)},function(t){G[t?"unshift":"push"]((()=>{P=t,n(14,P)}))},function(){C=this.value,n(11,C)},function(t){E=t,n(9,E)}]}class En extends yt{constructor(t){super(),vt(this,t,_n,Pn,s,{editingTitle:0,playlist:1},[-1,-1,-1])}}function Cn(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Sn(e){let n,o;return n=new En({props:{playlist:e[3],editingTitle:!0}}),{c(){$t(n.$$.fragment)},m(t,e){ht(n,t,e),o=!0},p:t,i(t){o||(st(n.$$.fragment,t),o=!0)},o(t){ct(n.$$.fragment,t),o=!1},d(t){gt(n,t)}}}function Ln(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Vn(t){let e,n,o={ctx:t,current:null,token:null,hasCatch:!1,pending:Ln,then:Sn,catch:Cn,value:3,blocks:[,,,]};return at(t[0],o),{c(){e=_(),o.block.c()},m(t,l){v(t,e,l),o.block.m(t,o.anchor=l),o.mount=()=>e.parentNode,o.anchor=e,n=!0},p(e,[n]){{const l=(t=e).slice();l[3]=o.resolved,o.block.p(l,n)}},i(t){n||(st(o.block),n=!0)},o(t){for(let t=0;t<3;t+=1){ct(o.blocks[t])}n=!1},d(t){t&&y(e),o.block.d(t),o.token=null,o=null}}}function Tn(t){var e=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(l,i){function r(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?l(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,s)}c((o=o.apply(t,e||[])).next())}))};return[function(){return e(this,void 0,void 0,(function*(){let t=yield window.videoService.generatePlaylist();return Object.assign(Object.assign({},t),{title:"Playlist title"})}))}()]}class Mn extends yt{constructor(t){super(),vt(this,t,Tn,Vn,s,{})}}function Hn(e){let n,o,l,i,r,s,c=e[0].videos.length+"";return{c(){n=b("div"),o=b("span"),l=k("("),i=k(c),r=k(")"),S(n,"class",s="playlist-count "+e[1]+" svelte-1yak261")},m(t,e){v(t,n,e),g(n,o),g(o,l),g(o,i),g(o,r)},p(t,[e]){1&e&&c!==(c=t[0].videos.length+"")&&L(i,c),2&e&&s!==(s="playlist-count "+t[1]+" svelte-1yak261")&&S(n,"class",s)},i:t,o:t,d(t){t&&y(n)}}}function An(t,e,n){let{playlist:o}=e,{className:l=""}=e;return t.$$set=t=>{"playlist"in t&&n(0,o=t.playlist),"className"in t&&n(1,l=t.className)},[o,l]}class In extends yt{constructor(t){super(),vt(this,t,An,Hn,s,{playlist:0,className:1})}}function On(t){let e,n;return e=new In({props:{playlist:t[0],className:"preview-count"}}),{c(){$t(e.$$.fragment)},m(t,o){ht(e,t,o),n=!0},p(t,n){const o={};1&n&&(o.playlist=t[0]),e.$set(o)},i(t){n||(st(e.$$.fragment,t),n=!0)},o(t){ct(e.$$.fragment,t),n=!1},d(t){gt(e,t)}}}function jn(t){let e,n,o,l,i,r,s,c,a,u,f,d,p;return d=new In({props:{playlist:t[0],className:"preview-img"}}),{c(){e=b("div"),n=b("img"),l=P(),i=b("img"),s=P(),c=b("div"),a=b("img"),f=P(),$t(d.$$.fragment),S(n,"class","preview-img svelte-j52w8t"),S(n,"alt","Playlist Video Thumbail 1"),n.src!==(o=t[2].getVideoThumbnailUrl(t[3][0]))&&S(n,"src",o),S(i,"class","preview-img svelte-j52w8t"),S(i,"alt","Playlist Video Thumbail 2"),i.src!==(r=t[2].getVideoThumbnailUrl(t[3][1]))&&S(i,"src",r),S(e,"class","preview-row"),S(a,"class","preview-img svelte-j52w8t"),S(a,"alt","Playlist Video Thumbail 3"),a.src!==(u=t[2].getVideoThumbnailUrl(t[3][2]))&&S(a,"src",u),S(c,"class","preview-row")},m(t,o){v(t,e,o),g(e,n),g(e,l),g(e,i),v(t,s,o),v(t,c,o),g(c,a),g(c,f),ht(d,c,null),p=!0},p(t,e){const n={};1&e&&(n.playlist=t[0]),d.$set(n)},i(t){p||(st(d.$$.fragment,t),p=!0)},o(t){ct(d.$$.fragment,t),p=!1},d(t){t&&y(e),t&&y(s),t&&y(c),gt(d)}}}function Nn(t){let e,n,o,l,i,r,s,c,a,u=t[0].title+"";const f=[jn,On],d=[];function p(t,e){return t[1]?1:0}return n=p(t),o=d[n]=f[n](t),{c(){e=b("div"),o.c(),l=P(),i=b("span"),r=k(u),S(i,"class","preview-title svelte-j52w8t"),S(e,"class","preview svelte-j52w8t")},m(o,u){v(o,e,u),d[n].m(e,null),g(e,l),g(e,i),g(i,r),s=!0,c||(a=E(e,"click",C(t[4])),c=!0)},p(t,[i]){let c=n;n=p(t),n===c?d[n].p(t,i):(it(),ct(d[c],1,1,(()=>{d[c]=null})),rt(),o=d[n],o?o.p(t,i):(o=d[n]=f[n](t),o.c()),st(o,1),o.m(e,l)),(!s||1&i)&&u!==(u=t[0].title+"")&&L(r,u)},i(t){s||(st(o),s=!0)},o(t){ct(o),s=!1},d(t){t&&y(e),d[n].d(),c=!1,a()}}}function Rn(t,e,n){var o=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(l,i){function r(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?l(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,s)}c((o=o.apply(t,e||[])).next())}))};const l=window.videoService;let{playlist:i}=e,{disableThumbnails:r=!1}=e;const s=i.videos;return t.$$set=t=>{"playlist"in t&&n(0,i=t.playlist),"disableThumbnails"in t&&n(1,r=t.disableThumbnails)},[i,r,l,s,function(){return o(this,void 0,void 0,(function*(){l.openPlaylistEditor(i)}))}]}class zn extends yt{constructor(t){super(),vt(this,t,Rn,Nn,s,{playlist:0,disableThumbnails:1})}}function Bn(t,e,n){const o=t.slice();return o[2]=e[n],o}function qn(t){let e;return{c(){e=b("p"),e.textContent="No playlist found",T(e,"text-align","center")},m(t,n){v(t,e,n)},d(t){t&&y(e)}}}function Un(t,e){let n,o,l;return o=new zn({props:{playlist:e[2],disableThumbnails:e[1]}}),{key:t,first:null,c(){n=_(),$t(o.$$.fragment),this.first=n},m(t,e){v(t,n,e),ht(o,t,e),l=!0},p(t,n){e=t;const l={};1&n&&(l.playlist=e[2]),2&n&&(l.disableThumbnails=e[1]),o.$set(l)},i(t){l||(st(o.$$.fragment,t),l=!0)},o(t){ct(o.$$.fragment,t),l=!1},d(t){t&&y(n),gt(o,t)}}}function Zn(t){let e,n,o=[],l=new Map,i=t[0];const r=t=>t[2].id;for(let e=0;e{n(1,l=t.disableThumbnails)})),t.$$set=t=>{"playlists"in t&&n(0,o=t.playlists)},[o,l]}class Dn extends yt{constructor(t){super(),vt(this,t,Gn,Zn,s,{playlists:0})}}function Xn(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Wn(e){let n,o;return n=new Dn({props:{playlists:e[1]}}),{c(){$t(n.$$.fragment)},m(t,e){ht(n,t,e),o=!0},p:t,i(t){o||(st(n.$$.fragment,t),o=!0)},o(t){ct(n.$$.fragment,t),o=!1},d(t){gt(n,t)}}}function Yn(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function Fn(t){let e,n,o,l;e=new we({});let i={ctx:t,current:null,token:null,hasCatch:!1,pending:Yn,then:Wn,catch:Xn,value:1,blocks:[,,,]};return at(t[0],i),{c(){$t(e.$$.fragment),n=P(),o=b("main"),i.block.c()},m(t,r){ht(e,t,r),v(t,n,r),v(t,o,r),i.block.m(o,i.anchor=null),i.mount=()=>o,i.anchor=null,l=!0},p(e,[n]){{const o=(t=e).slice();o[1]=i.resolved,i.block.p(o,n)}},i(t){l||(st(e.$$.fragment,t),st(i.block),l=!0)},o(t){ct(e.$$.fragment,t);for(let t=0;t<3;t+=1){ct(i.blocks[t])}l=!1},d(t){gt(e,t),t&&y(n),t&&y(o),i.block.d(),i.token=null,i=null}}}function Jn(t){return[window.getRecentPlaylists()]}class Kn extends yt{constructor(t){super(),vt(this,t,Jn,Fn,s,{})}}function Qn(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function to(e){let n,o;return n=new Dn({props:{playlists:e[1]}}),{c(){$t(n.$$.fragment)},m(t,e){ht(n,t,e),o=!0},p:t,i(t){o||(st(n.$$.fragment,t),o=!0)},o(t){ct(n.$$.fragment,t),o=!1},d(t){gt(n,t)}}}function eo(e){return{c:t,m:t,p:t,i:t,o:t,d:t}}function no(t){let e,n,o,l;e=new we({});let i={ctx:t,current:null,token:null,hasCatch:!1,pending:eo,then:to,catch:Qn,value:1,blocks:[,,,]};return at(t[0],i),{c(){$t(e.$$.fragment),n=P(),o=b("main"),i.block.c()},m(t,r){ht(e,t,r),v(t,n,r),v(t,o,r),i.block.m(o,i.anchor=null),i.mount=()=>o,i.anchor=null,l=!0},p(e,[n]){{const o=(t=e).slice();o[1]=i.resolved,i.block.p(o,n)}},i(t){l||(st(e.$$.fragment,t),st(i.block),l=!0)},o(t){ct(e.$$.fragment,t);for(let t=0;t<3;t+=1){ct(i.blocks[t])}l=!1},d(t){gt(e,t),t&&y(n),t&&y(o),i.block.d(),i.token=null,i=null}}}function oo(t){return[window.getPlaylists()]}class lo extends yt{constructor(t){super(),vt(this,t,oo,no,s,{})}}function io(e){let n,o,l,r,s,c,a,u,f,d,p,m,$;return n=new we({}),{c(){$t(n.$$.fragment),o=P(),l=b("main"),r=b("button"),r.textContent="Export saved playlists",s=P(),c=b("button"),c.textContent="Import saved playlists",a=P(),u=b("button"),u.textContent="Delete all saved playlists",f=P(),d=b("input"),T(c,"margin-top","1rem"),T(u,"margin-top","1rem"),T(l,"padding","5rem"),S(d,"id","ImportSavedPlaylists"),T(d,"visibility","hidden"),S(d,"type","file")},m(t,i){ht(n,t,i),v(t,o,i),v(t,l,i),g(l,r),g(l,s),g(l,c),g(l,a),g(l,u),v(t,f,i),v(t,d,i),p=!0,m||($=[E(r,"click",e[0]),E(c,"click",e[2]),E(u,"click",e[1])],m=!0)},p:t,i(t){p||(st(n.$$.fragment,t),p=!0)},o(t){ct(n.$$.fragment,t),p=!1},d(t){gt(n,t),t&&y(o),t&&y(l),t&&y(f),t&&y(d),m=!1,i($)}}}function ro(t){var e=this&&this.__awaiter||function(t,e,n,o){return new(n||(n=Promise))((function(l,i){function r(t){try{c(o.next(t))}catch(t){i(t)}}function s(t){try{c(o.throw(t))}catch(t){i(t)}}function c(t){var e;t.done?l(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(r,s)}c((o=o.apply(t,e||[])).next())}))};return[function(){return e(this,void 0,void 0,(function*(){const t=(yield window.getPlaylists()).map((({title:t,videos:e,timestamp:n})=>({title:t,videos:e,timestamp:n})));var e,n,o,l,i;e=JSON.stringify(t),n="saved-playlists.json",o=new Blob([e],{type:"application/json"}),l=window.URL.createObjectURL(o),(i=document.createElement("a")).download=n||"export.json",i.href=l,i.onclick=function(){i.remove()},i.style.display="none",document.body.appendChild(i),i.click()}))},function(){return e(this,void 0,void 0,(function*(){confirm("All the saved playlists are about to be deleted")&&(yield window.removeSavedPlaylists(),alert("All saved playlists were successfully removed"))}))},function(){return e(this,void 0,void 0,(function*(){const t=document.getElementById("ImportSavedPlaylists");t.onchange=()=>{let n=new FileReader;n.onload=()=>e(this,void 0,void 0,(function*(){try{let t=JSON.parse(n.result);yield window.importPlaylists(t),alert("The playlists were successfully imported")}catch(t){console.log(t),alert("The file is incorrectly formatted")}t.value=null}));const o=t.files[0];n.readAsText(o)},t.click()}))}]}class so extends yt{constructor(t){super(),vt(this,t,ro,io,s,{})}}function co(e){let n,o;return n=new Tt({props:{routes:e[0]}}),{c(){$t(n.$$.fragment)},m(t,e){ht(n,t,e),o=!0},p:t,i(t){o||(st(n.$$.fragment,t),o=!0)},o(t){ct(n.$$.fragment,t),o=!1},d(t){gt(n,t)}}}function ao(t){return[{"/":Kn,"/recent":Kn,"/new":Mn,"/saved":lo,"/editor":En,"/playlist-builder":En,"/manage":so,"*":Kn}]}window.savePlaylist||(import("./storage-service.js"),import("./video-service.js"));const uo=new class extends yt{constructor(t){super(),vt(this,t,ao,co,s,{})}}({target:document.body});export default uo; diff --git a/src/editor/storage-service.js b/src/editor/storage-service.js index 92b2628..6189a51 100644 --- a/src/editor/storage-service.js +++ b/src/editor/storage-service.js @@ -1 +1 @@ -function t(t){const e=Object.assign({},t);return delete e.loadedVideos,e}if(window.saveRecentPlaylist=async e=>(localStorage.setItem("playlist_"+e.id,JSON.stringify(t(e))),e.id),window.getRecentPlaylists=async()=>{const t=Object.assign({},localStorage);return Object.keys(t).filter((t=>t.startsWith("playlist_"))).map((e=>JSON.parse(t[e])))},window.getRecentPlaylist=async t=>{const e=localStorage.getItem("playlist_"+t);return JSON.parse(e)},window.savePlaylist=async e=>{let s=e.id;return e.saved||(s=await window.generatePlaylistId()),e=Object.assign(Object.assign({},e),{id:s,timestamp:Date.now()}),await window.storeObject("playlist_"+s,t(e)),s},window.removePlaylist=async t=>{if(t.saved)return window.removeObject("playlist_"+t.id);localStorage.removeItem("playlist_"+t.id)},window.getPlaylists=async()=>{const t=await window.fetchAllObjects();return Object.keys(t).filter((t=>t.startsWith("playlist_"))).map((e=>{const s=JSON.parse(t[e]);return s.saved=!0,s}))},window.getPlaylist=async t=>{const e=await window.fetchObject("playlist_"+t,null);if(!e)return null;const s=JSON.parse(e);return s.saved=!0,s},"undefined"!=typeof browser){const t=browser.storage.sync;window.fetchObject=async(e,s)=>{const a=await t.get(e);return a&&null!=a[e]?a[e]:s},window.fetchAllObjects=async()=>t.get(null),window.storeObject=async(e,s)=>{const a={};return a[e]=s?JSON.stringify(s):null,t.set(a)},window.removeObject=async e=>t.remove(e);const e="PlaylistIdCounter";window.generatePlaylistId=async()=>{const s=await t.get(e);let a=s[e]||0;return a++,s[e]=a,t.set(s),a}}else window.location.protocol.startsWith("http")&&(window.fetchObject=async(t,e)=>{const s=localStorage.getItem(t);return s&&JSON.parse(s)||e},window.fetchAllObjects=async()=>Object.assign({},localStorage),window.storeObject=async(t,e)=>{localStorage.setItem(t,e?JSON.stringify(e):null)},window.removeObject=async t=>{localStorage.removeItem(t)},window.generatePlaylistId=async()=>Date.now().toString());const e={openPlaylistEditorAfterCreation:!1,openPlaylistPage:!1,closeAfterCombine:!1,disableThumbnails:!1,openPlaylistBuilderAfterAdd:!1,defaultEditorPage:"/recent",createdPlaylistStorage:"recent"};window.getSettings=async()=>{const t=Object.assign({},e);return await Promise.all(Object.keys(e).map((async s=>{const a=await window.fetchObject(s,e[s]);t[s]=a}))),t}; +function t(t){const e=Object.assign({},t);return delete e.loadedVideos,e}if(window.saveRecentPlaylist=async e=>(localStorage.setItem("playlist_"+e.id,JSON.stringify(t(e))),e.id),window.getRecentPlaylists=async()=>{const t=Object.assign({},localStorage);return Object.keys(t).filter((t=>t.startsWith("playlist_"))).map((e=>JSON.parse(t[e])))},window.getRecentPlaylist=async t=>{const e=localStorage.getItem("playlist_"+t);return JSON.parse(e)},window.savePlaylist=async e=>{let a=e.id;return e.saved||(a=await window.generatePlaylistId()),e=Object.assign(Object.assign({},e),{id:a,timestamp:Date.now()}),await window.storeObject("playlist_"+a,t(e)),a},window.importPlaylists=async e=>{const a=await window.generatePlaylistIds(e.length),s=e.map((t=>Object.assign(Object.assign({},t),{id:a.shift()})));await Promise.all(s.map((e=>window.storeObject("playlist_"+e.id,t(e)))))},window.removePlaylist=async t=>{if(t.saved)return window.removeObject("playlist_"+t.id);localStorage.removeItem("playlist_"+t.id)},window.removeSavedPlaylists=async()=>{const t=(await window.getPlaylists()).map((({id:t})=>t));await Promise.all(t.map((t=>window.removeObject("playlist_"+t))))},window.getPlaylists=async()=>{const t=await window.fetchAllObjects();return Object.keys(t).filter((t=>t.startsWith("playlist_"))).map((e=>{const a=JSON.parse(t[e]);return a.saved=!0,a}))},window.getPlaylist=async t=>{const e=await window.fetchObject("playlist_"+t,null);if(!e)return null;const a=JSON.parse(e);return a.saved=!0,a},"undefined"!=typeof browser){const t=browser.storage.sync;window.fetchObject=async(e,a)=>{const s=await t.get(e);return s&&null!=s[e]?s[e]:a},window.fetchAllObjects=async()=>t.get(null),window.storeObject=async(e,a)=>{const s={};return s[e]=a?JSON.stringify(a):null,t.set(s)},window.removeObject=async e=>t.remove(e);const e="PlaylistIdCounter";window.generatePlaylistId=async()=>{const a=await t.get(e);let s=a[e]||0;return s++,a[e]=s,t.set(a),s},window.generatePlaylistIds=async a=>{const s=await t.get(e);let n=s[e]||0;n++;const i=[...Array(a).keys()].map((t=>t+n));return s[e]=i[i.length-1],t.set(s),i}}else window.location.protocol.startsWith("http")&&(window.fetchObject=async(t,e)=>{const a=localStorage.getItem(t);return a&&JSON.parse(a)||e},window.fetchAllObjects=async()=>Object.assign({},localStorage),window.storeObject=async(t,e)=>{localStorage.setItem(t,e?JSON.stringify(e):null)},window.removeObject=async t=>{localStorage.removeItem(t)},window.generatePlaylistId=async()=>Date.now().toString(),window.generatePlaylistIds=async t=>{const e=Date.now();return[...Array(t).keys()].map((t=>(t+e).toString()))},window.removeSavedPlaylists=async()=>{});const e={openPlaylistEditorAfterCreation:!1,openPlaylistPage:!1,closeAfterCombine:!1,disableThumbnails:!1,openPlaylistBuilderAfterAdd:!1,defaultEditorPage:"/recent",createdPlaylistStorage:"recent"};window.getSettings=async()=>{const t=Object.assign({},e);return await Promise.all(Object.keys(e).map((async a=>{const s=await window.fetchObject(a,e[a]);t[a]=s}))),t}; diff --git a/src/manifest.json b/src/manifest.json index 2b60a83..988b42d 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { "name": "YouTube Playlist Helper", - "description": "Generate YouTube playlists from various sources (links lists, bookmarks, ...)", - "version": "2.8.0", + "description": "YouTube playlist editor and generator", + "version": "2.9.0", "manifest_version": 2, "icons": { "48": "icons/icon_48.png",