1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/swiper-react-DcF17yCe.js","assets/react-vendor-DJtAp8P_.js","assets/SessionPlannerMobile-85wkJ1ZS.js","assets/mui-DvP2hOwX.js","assets/mui-styles-C9F12l22.js","assets/babel-helpers-D2wBBc1I.js","assets/app-DT7WuczB.js","assets/index-CyS3LFy6.js","assets/apollo-DL0KWP0Y.js","assets/index-CV9OfG1C.css","assets/dayjs-CFxoC4n5.js","assets/app-Cg4Kd3Rp.css","assets/moment-Bj79pgB5.js","assets/Modal-BzPnYVEi.js","assets/Button-C4goEOKP.js","assets/mutation--iSLlBrt.js","assets/query-CcmDMjHA.js","assets/imageOptimization-zUL1CBPb.js","assets/index.esm-CWqXbt53.js","assets/_baseClone-DByvJCmO.js","assets/_baseAssignValue-CjtYt4eh.js","assets/cloneDeep-mVQ3twB2.js","assets/Search-BEYvHCFs.js","assets/lodash-icp7yO-G.js","assets/merge-TfBrBrIh.js","assets/isArrayLikeObject-CcVCHQro.js","assets/map-BI8CQ8np.js","assets/browser-B3fhYDhb.js","assets/_arrayIncludes-DFQcso6E.js","assets/_baseIndexOf-DqPIyCu4.js","assets/hello-pangea-dnd-1bhs5THC.js","assets/some-YFJAbcVi.js","assets/values-DeBIqcD0.js","assets/index-B79atc36.js","assets/_baseDifference-BHjDay7E.js","assets/omit-BaIHraq0.js","assets/index-bEsv4Yks.js","assets/mui-x-DMY3qA32.js","assets/s3FileHandler-Bp64keCt.js","assets/compact-DZdspzxW.js","assets/swiper-react-CGdrHBuS.css"])))=>i.map(i=>d[i]); 2import{j as e,a as r}from"./react-vendor-DJtAp8P_.js";import{bu as P,aX as Ee,bi as rt,bm as ot}from"./index-CyS3LFy6.js";import{aX as nt,aR as Oe}from"./query-CcmDMjHA.js";import{bG as at}from"./mutation--iSLlBrt.js";import{s as lt}from"./search-DNkl80Xk.js";import{c as Ue,bk as it,a4 as ct,v as Ge,_ as dt,g as pt,F as ut,u as Te,d as mt,ac as xt,S as je}from"./app-DT7WuczB.js";import{E as ht}from"./EngineRoomBreadcrumbV2-DyOCPLFM.js";import{r as bt}from"./imageUrl-gCnBcCAn.js";import{M as ft,u as gt}from"./MediaCardV2-CVjrjZCx.js";import{a as yt,b as vt,c as jt}from"./popover-DQmY_bgT.js";import"./swiper-react-DcF17yCe.js";import{E as St}from"./ellipsis-vertical-EfBRlYg5.js";import{C as wt}from"./chevron-left-hHkvU2-n.js";import{C as Nt}from"./chevron-right-Bx281FLM.js";import{u as $e,n as Ct}from"./apollo-DL0KWP0Y.js";import{C as Pt}from"./index-BHFF4lkW.js";import{U as kt}from"./index-Dg9Ob-9g.js";import{M as At,A as Et}from"./AddPlaylistModalV2-CK13cVBA.js";import{D as Ot,S as Tt}from"./index-BYpyTL8r.js";import{A as It}from"./AddPracticeToSessionModalGate-BB6n61YO.js";import{u as Mt}from"./useCollectionsPracticeTypeMap-Diyla1H4.js";import{T as _t}from"./TrailerModal-CVX4TgKw.js";import{M as Ie,L as Rt}from"./index-qaHslVcQ.js";import{C as Dt}from"./chevron-down-D9vZfud1.js";import{P as Me}from"./plus-jTnJ9Ylg.js";import{A as Lt}from"./arrow-up-down-Cyob2fWI.js";import"./mui-styles-C9F12l22.js";import"./babel-helpers-D2wBBc1I.js";import"./dayjs-CFxoC4n5.js";import"./footballize-CKQT9bi3.js";import"./plainText-DBpeJa6y.js";import"./useHoverTrailerV2-C_vNBnFz.js";import"./index-DFAqAA9H.js";import"./imageOptimization-zUL1CBPb.js";import"./ellipsis-BPffiR7H.js";import"./play-CBxhfLg4.js";import"./calendar-range-BRkGfDrQ.js";import"./folder-plus-BuJChPs4.js";import"./list-plus-jbEUR6Jd.js";import"./check-njpSxvzl.js";import"./heart-SY2Qtxi5.js";import"./bookmark-D81rgROb.js";import"./star-DNcD-a5x.js";import"./index-C53T7JDS.js";import"./floating-ui.dom-CpqR1Q5s.js";import"./SessionPlannerMobile-85wkJ1ZS.js";import"./mui-DvP2hOwX.js";import"./moment-Bj79pgB5.js";import"./Modal-BzPnYVEi.js";import"./Button-C4goEOKP.js";import"./index.esm-CWqXbt53.js";import"./_baseClone-DByvJCmO.js";import"./_baseAssignValue-CjtYt4eh.js";import"./cloneDeep-mVQ3twB2.js";import"./Search-BEYvHCFs.js";import"./lodash-icp7yO-G.js";import"./merge-TfBrBrIh.js";import"./isArrayLikeObject-CcVCHQro.js";import"./map-BI8CQ8np.js";import"./browser-B3fhYDhb.js";import"./_arrayIncludes-DFQcso6E.js";import"./_baseIndexOf-DqPIyCu4.js";import"./hello-pangea-dnd-1bhs5THC.js";import"./some-YFJAbcVi.js";import"./values-DeBIqcD0.js";import"./index-B79atc36.js";import"./_baseDifference-BHjDay7E.js";import"./omit-BaIHraq0.js";import"./index-bEsv4Yks.js";import"./mui-x-DMY3qA32.js";import"./s3FileHandler-Bp64keCt.js";import"./compact-DZdspzxW.js";import"./triangle-alert-BdPscC9S.js";
2import"./trash-2-B3r-aJQU.js";import"./arrow-up-right-BHTble7A.js";import"./index-CvVUxn0l.js";import"./AvatarImgC-DLZ8EYiW.js";import"./seededSessionFill-BljGszd4.js";import"./index-CrwW5ro-.js";import"./subMonths-CpZP7vPB.js";import"./sessionSections-a-lprBoU.js";import"./index-Cor9x_UP.js";import"./checkbox-BCFY1QRf.js";import"./input-CuTRSUQZ.js";import"./editable-input-BbmoAFqJ.js";import"./label-DlgL8a7V.js";import"./arrow-right-CPcr9UUY.js";import"./funnel-CHKnj2yC.js";import"./arrow-left-D2QUTCdL.js";try{let n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},b=new n.Error().stack;b&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[b]="46355343-6d63-44d6-a4bd-20ce6213e3d8",n._sentryDebugIdIdentifier="sentry-dbid-46355343-6d63-44d6-a4bd-20ce6213e3d8")}catch{}function _e({tabs:n,activeValue:b,onChange:l,isPhone:d=!1,className:I}){return d?e.jsx("div",{role:"tablist","aria-label":"Playlist visibility",className:P("flex items-center gap-2 overflow-x-auto -mx-4 px-4 pb-1",I),children:n.map(i=>{const y=i.value===b;return e.jsxs("button",{type:"button",role:"tab","aria-selected":y,onClick:()=>l(i.value),className:P("box-border inline-flex flex-shrink-0 cursor-pointer items-center gap-2 whitespace-nowrap rounded-full border-solid px-4 py-1.5","font-head text-[11px] uppercase tracking-wide12 transition-colors","outline-none focus-visible:ring-[3px] focus-visible:ring-accent-2",y?"bg-fg text-bg border border-fg":"border border-hairline bg-card text-muted hover:bg-card-hi hover:text-fg"),children:[e.jsx("span",{children:i.label}),typeof i.count=="number"&&e.jsx("span",{className:P("font-mono text-[10px] leading-none",y?"text-bg/80":"text-subtle"),children:i.count})]},i.value)})}):e.jsx("div",{role:"tablist","aria-label":"Playlist visibility",className:P("flex items-end gap-7 border-b border-hairline",I),children:n.map(i=>{const y=i.value===b;return e.jsxs("button",{type:"button",role:"tab","aria-selected":y,onClick:()=>l(i.value),className:P("box-border cursor-pointer bg-transparent border-0 px-0 pb-2.5 -mb-px inline-flex items-baseline gap-2","font-head text-[13px] uppercase tracking-wide12 transition-colors","outline-none focus-visible:ring-2 focus-visible:ring-accent-2 focus-visible:rounded-[2px]",y?"text-fg border-b-2 border-solid border-accent":"text-muted hover:text-fg border-b-2 border-solid border-transparent"),children:[e.jsx("span",{children:i.label}),typeof i.count=="number"&&e.jsx("span",{className:P("font-mono text-[11px] leading-none",y?"text-accent":"text-subtle"),children:i.count})]},i.value)})})}const Vt=r.lazy(()=>dt(()=>import("./swiper-react-DcF17yCe.js").then(n=>n.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40]))),Bt={coach:{label:"Personal",className:"border-hairline text-muted"},club:{label:"Club",className:"border-accent-2 text-accent-2"},shared:{label:"Shared",className:"border-accent text-accent"}},Re={dots:!1,infinite:!1,touchMove:!0,touchThreshold:100,speed:500,slidesToShow:1,slidesToScroll:1,variableWidth:!0,arrows:!1};function Ut({playlistId:n,title:b,videoCount:l,permission:d,user:I,isOwnPlaylist:i,cardMenuItems:y,onView:v,onCardWatchTrailer:W,onCardAddToSession:L,onCardAddToPlaylist:we,onCardAddToGoogleCalendar:j,onCardAddToAppleCalendar:k,slidesToShow:h}){var pe,Z,J,ee;const E=$e(),re=r.useRef(null),Y=(ee=(J=(Z=(pe=Ue().userRolesPermissions)==null?void 0:pe.permissions)==null?void 0:Z.engineRoom)==null?void 0:J.weeklySeasonPlans)==null?void 0:ee.add,[O,V]=r.useState([]),[N,B]=r.useState(!0),[z,oe]=r.useState(!1),A=r.useRef(null),[U,ne]=r.useState({overflows:!1,height:0});r.useEffect(()=>{const s=A.current;if(!s)return;const c=()=>{const m=Array.from(s.querySelectorAll("[data-playlist-card]")),T=s.querySelector(".slick-list"),ue=m.reduce((C,R)=>C+R.getBoundingClientRect().width,0),te=Math.max(0,...m.map(C=>{var R;return((R=C.firstElementChild)==null?void 0:R.getBoundingClientRect().height)??0})),$=ue>((T==null?void 0:T.clientWidth)??s.clientWidth)+1;ne(C=>C.overflows===$&&C.height===te?C:{overflows:$,height:te})},p=new ResizeObserver(c);p.observe(s);const f=()=>{s.querySelectorAll("[data-playlist-card]").forEach(m=>p.observe(m)),c()},u=new MutationObserver(f);return u.observe(s,{childList:!0,subtree:!0}),f(),()=>{p.disconnect(),u.disconnect()}},[O]);const ae=!N&&O.length>0&&(U.overflows||l>O.length),X=r.useRef({x:0,y:0}),M=r.useRef(!1),xe=r.useCallback(s=>{X.current={x:s.clientX,y:s.clientY},M.current=!1},[]),le=r.useCallback(s=>{const c=Math.abs(s.clientX-X.current.x),p=Math.abs(s.clientY-X.current.y);M.current=c>5||p>5},[]),H=r.useCallback(s=>()=>
2{M.current||s()},[]);r.useEffect(()=>{let s=!1;return(async()=>{var p,f,u;B(!0);try{const m=await E.query({query:nt,variables:{getPlaylistVideosInput:{id:n,limit:10,offset:0}},fetchPolicy:"no-cache"}),T=((u=(f=(p=m==null?void 0:m.data)==null?void 0:p.getPlaylistVideos)==null?void 0:f.data)==null?void 0:u.rows)??[];s||V(T)}catch{s||V([])}finally{s||B(!1)}})(),()=>{s=!0}},[E,n,l]);const ie=r.useMemo(()=>typeof h=="number"?{...Re,slidesToShow:h}:Re,[h]),ce=`${I.username??""} ${I.lastname??""}`.trim()||"Unknown",G=bt(I.profile_image)??null,[g,S]=r.useState(!1),he=!!G&&!g,_=Bt[d],be=s=>()=>{oe(!1),s.onClick()},K=s=>{var f,u;const c=s.content_type==="collection"?s.id:((u=(f=s.videos)==null?void 0:f[0])==null?void 0:u.id)??s.id,p=Ge(s.title,c,s.id,s.content_type);window.location.href=`/collections?${p}`},Q=r.useCallback(s=>c=>{s(c)},[]),de=r.useCallback(s=>{const c=s,p=Array.isArray(c.categories)?c.categories.map(m=>m.id):[],f=it(p,s.content_type??"video",Y),u=p.map(Number).some(m=>m===Ee.WEEK_PLANS_46||m===Ee.SEASON_PLANS);return{showAddToSession:f,isSeasonOrWeek:u}},[Y]);return e.jsxs("section",{className:"bg-card border border-solid border-hairline rounded-[8px] overflow-hidden mb-5",children:[e.jsxs("header",{className:"flex items-start gap-3 px-5 pt-4 pb-3",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("button",{type:"button",onClick:v,className:"bg-transparent border-0 p-0 m-0 cursor-pointer text-left",children:e.jsx("h3",{className:P("font-head font-bold uppercase text-fg leading-tight m-0","text-[20px] md:text-[24px]","line-clamp-2 min-h-[2.5em]","hover:text-accent transition-colors"),children:b})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 mt-2",children:[e.jsx("span",{className:P("box-border inline-flex items-center font-mono text-[10px] uppercase tracking-wide12 px-2 py-0.5 rounded-[2px] border border-solid",_.className),children:_.label}),e.jsxs("span",{className:"inline-flex items-center gap-1.5 bg-card-hi border border-solid border-hairline rounded-full pl-0.5 pr-2 py-0.5",children:[he?e.jsx("img",{src:G??"",alt:"",className:"w-4 h-4 rounded-full object-cover",onError:()=>S(!0)}):e.jsx("span",{className:"w-4 h-4 rounded-full bg-bg-raised border border-solid border-hairline flex items-center justify-center font-mono text-[8px] text-subtle",children:ct(ce)}),e.jsx("span",{className:"font-body text-[11.5px] text-fg",children:ce})]}),e.jsxs("span",{className:"font-mono text-[10.5px] text-subtle",children:[l," ",l===1?"video":"videos"]})]})]}),ae&&e.jsx("button",{type:"button",onClick:v,className:"shrink-0 bg-transparent border-0 text-accent-2 cursor-pointer font-body text-sm py-2",children:"View all â"}),y.length>0&&e.jsxs(yt,{open:z,onOpenChange:oe,children:[e.jsx(vt,{asChild:!0,children:e.jsx("button",{type:"button",className:"box-border w-8 h-8 inline-flex items-center justify-center rounded-[2px] border border-solid border-transparent bg-transparent text-fg hover:bg-card-hi cursor-pointer flex-shrink-0","aria-label":"Playlist actions",children:e.jsx(St,{className:"w-4 h-4"})})}),e.jsx(jt,{align:"end",className:"w-[200px] p-1 bg-card-hi border-solid border border-tt-border",children:y.map(s=>e.jsx("button",{type:"button",onClick:be(s),className:P("box-border w-full text-left bg-transparent border-0 cursor-pointer px-3 py-2 rounded-[2px] hover:bg-card transition-colors","font-body text-[13px]",s.destructive?"text-accent":"text-fg"),children:s.label},s.label))})]})]}),e.jsx("div",{className:"h-px bg-hairline"}),e.jsxs("div",{ref:A,className:"relative px-1 py-3",onMouseDown:xe,onMouseUp:le,children:[!N&&O.length===0&&e.jsx("p",{className:"px-4 py-6 text-muted font-body text-sm",children:"No videos in this playlist yet"}),U.overflows&&e.jsx($t,{sliderRef:re}),e.jsx(r.Suspense,{fallback:e.jsx("div",{className:"h-[200px] flex items-center justify-center text-muted",children:"Loadingâ¦"}),children:e.jsxs(Vt,{ref:s=>re.current=s,...ie,children:[O.map((s,c)=>{const{showAddToSession:p,isSeasonOrWeek:f}=de(s);return e.jsx("div",{"data-playlist-card":!0,className:"px-1",children:e.jsx(ft,{item:s,index:c,onOpen:H(()=>K(s)),onPlayTrailer:Q(W),onPlayClick:H(()=>K(s)),onAddToSession:p?Q(u=>{L(u)}):void 0,onAddToPlaylist:Q(we)})},s.id)}),ae&&e.jsx("div",{className:"px-1",children:e.jsx(Gt,{onClick:H(v),height:U.height,count:l})},"see-all")]})})]}),e.jsxs("span",{className:"sr-only",children:[j.name,k.name,String(i)]})]})}function Gt({onClick:n,height:b,count:l}){return e.jsx("button",{type:"button",onClick:n,style:{height:b||void 0},className:"box-border w-[82vw] max-w-[340px] sm:w-[300px] sm:max-w-none bg-bg-raised border border-solid border-hairline rounded-[8px] flex items-center justify-center cursor-pointer hover:bg-card-hi transition-colors",children:e.jsxs("span",{className:"font-mono text-[11px] uppercase tracking-wide12 text-accent-2",children:["See all · ",l," items â"]})})}function $t({sliderRef:n}){const b=()=>{var d;return(d=n.current)==null?void 0:d.slickPrev()},l=()=>{var d;return(d=n.current)==null?void 0:d.slickNext()};return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button","aria-label":"Scroll back",onClick:b,className:"hidden md:flex absolute left-0 top-0 bottom-0 z-10 w-16 items-center justify-start pl-1 cursor-pointer bg-gradient-to-r from-card to-transparent border-0 outline-none",children:e.jsx(wt,{className:"w-5 h-5 text-fg"})}),e.jsx("button",{type:"button","aria-label":"Scroll forward",onClick:l,className:"hidden md:flex absolute right-0 top-0 bottom-0 z-10 w-16 items-center justify-end pr-1 cursor-pointer bg-gradient-to-l from-card to-transparent border-0 outline-none",children:e.jsx(Nt,{className:"w-5 h-5 text-fg"})})]})}const De={personal:"coach",club:"club",shared:"shared"},Le=[{value:"personal",label:"Personal"},{value:"club",label:"Club"},{value:"shared",label:"Shared"}],Ve=[{value:"created_at",label:"New to Old"},{value:"title",label:"A to Z"}],Be=10;function Nr(){var Ce,Pe,ke,Ae;const n=rt(),b=ot(),l=gt(),d=$e(),I=pt(),[i]=ut(),[y]=Ct(at),v=Ue(),W=Te(t=>t.user.userPermission),{isReadOnlyMode:L}=mt(),j=(Pe=(Ce=v.userRolesPermissions)==null?void 0:Ce.permissions)==null?void 0:Pe.engineRoom,k=r.useMemo(()=>{const t=window.location.pathname.split("/")[2];return t==="club"||t==="shared"?t:"personal"},[b]),h=Te(t=>{var o,a;return((a=(o=t.search)==null?void 0:o.engineRoom)==null?void 0:a.playlist)??""}),[E,re]=r.useState("created_at"),[F,Y]=r.useState("DESC"),[O,V]=r.useState(0),[N,B]=r.useState([]),[z,oe]=r.useState(0),[A,U]=r.useState(!1),[ne,ae]=r.useState({personal:null,club:null,shared:null}),[X,M]=r.useState(!1),[xe,le]=r.useState(!1),[H,ie]=r.useState(!1),[ce,G]=r.useState(!1),[g,S]=r.useState(null),[he,_]=r.useState(!1),[be,K]=r.useState(!1),[Q,de]=r.useState(null),[pe,Z]=r.useState(!1),[J,ee]=r.useState(!1),[s,c]=r.useState(null),p=Mt((s==null?void 0:s.id)!=null?[s.id]:[],J),[f,u]=r.useState(!1),m=r.useRef(null),[T,ue]=r.useState(!1);r.useEffect(()=>{if(!f)return;const t=o=>{var a;(a=m.current)!=null&&a.contains(o.target)||u(!1)};return document.addEventListener("mousedown",t),()=>document.removeEventListener("mousedown",t)},[f]);const te=r.useRef(null),$=r.useCallback(async()=>{var t,o;U(!0);try{const a=await d.query({query:Oe,variables:{getPlaylistsInput:{limit:Be,offset:O*Be,searchQuery:h,sortBy:E,sortOrder:F,category:De[k]}},fetchPolicy:"no-cache"}),x=(o=(t=a==null?void 0:a.data)==null?void 0:t.getPlaylists)==null?void 0:o.data,w=(x==null?void 0:x.rows)??[];B(D=>O===0?w:[...D,...w]),oe((x==null?void 0:x.count)??0)}catch{}finally{U(!1)}},[d,O,h,E,F,k]),C=r.useCallback(async()=>{const t=async w=>{var D,se,q;try{const ve=await d.query({query:Oe,variables:{getPlaylistsInput:{limit:1,offset:0,searchQuery:"",sortBy:"created_at",sortOrder:"DESC",category:De[w]}},fetchPolicy:"no-cache"});return((q=(se=(D=ve==null?void 0:ve.data)==null?void 0:D.getPlaylists)==null?void 0:se.data)==null?void 0:q.count)??0}catch{return 0}}
2,[o,a,x]=await Promise.all([t("personal"),t("club"),t("shared")]);ae({personal:o,club:a,shared:x})},[d]);r.useEffect(()=>{$()},[$]),r.useEffect(()=>{C()},[C]),r.useEffect(()=>{V(0),B([])},[k,h,E,F]),r.useEffect(()=>{const t=te.current;if(!t)return;const o=new IntersectionObserver(a=>{var x;(x=a[0])!=null&&x.isIntersecting&&!A&&z>N.length&&V(w=>w+1)},{rootMargin:"0px",threshold:1});return o.observe(t),()=>o.disconnect()},[A,z,N.length]);const R=t=>{n(`/playlists/${t}`)},fe=t=>{I(lt({key:"playlist",value:t}))},qe=t=>{u(!1),E===t?Y(o=>o==="ASC"?"DESC":"ASC"):(re(t),Y("DESC"))},ge=((W==null?void 0:W.planId)??0)<3,ye=()=>{ge?_(!0):(S(null),M(!0))},me=()=>{V(0),B([]),$(),C()},We=async()=>{if(g)try{const{data:t}=await y({variables:{deletePlaylistsInput:{ids:[g.id]}}}),o=t==null?void 0:t.deletePlaylists;o!=null&&o.success?(i({msg:o.message||"Playlist deleted",variant:"success"}),G(!1),S(null),me()):i({msg:(o==null?void 0:o.message)||"Could not delete playlist",variant:"error"})}catch{i({msg:"Could not delete playlist",variant:"error"})}},Fe=r.useCallback(t=>{var w,D,se;const o=(v==null?void 0:v.id)===((w=t.User)==null?void 0:w.id),a=[{name:"View",onClick:()=>n(`/playlists/${t.id}`)},{name:"Manage",onClick:()=>{S(t),M(!0)}}];return(((D=j==null?void 0:j.clubPlaylists)==null?void 0:D.add)==="yes"||((se=j==null?void 0:j.sharedPlaylists)==null?void 0:se.add)==="yes"||o)&&a.push({name:"Share",onClick:()=>{S(t),le(!0)}}),a.push({name:"Duplicate",onClick:()=>{S(t),ie(!0)}}),a.push({name:"Delete",destructive:!0,onClick:()=>{S(t),G(!0)}}),(o?a:xt(a,(j==null?void 0:j.clubPlaylists)??{})).map(q=>({label:q.name,onClick:q.onClick,destructive:q.destructive}))},[v,j,n]),Ye=t=>{ge?_(!0):(c(t),ee(!0))},ze=t=>{ge?_(!0):(c(t),Z(!0))},Xe=t=>{de(t),K(!0)},He=t=>{const o=t.title??"Playlist video",a=new Date().toISOString().replace(/[-:]|\.\d{3}/g,""),x=`https://www.google.com/calendar/render?action=TEMPLATE&text=${encodeURIComponent(o)}&dates=${a}/${a}`;window.open(x,"_blank")},Ke=t=>{},Qe=k==="shared"&&N.length===0&&!A,Ze=k!=="shared"&&N.length===0&&!A&&!h,Je=N.length===0&&!A&&!!h&&k!=="shared",Ne=f?e.jsx("ul",{className:"absolute right-0 mt-1.5 min-w-[200px] bg-card-hi border border-solid border-tt-border rounded-[2px] shadow-lg z-20 list-none pl-0 m-0",children:Ve.map(t=>{const o=t.value===E;return e.jsx("li",{className:"list-none",children:e.jsx("button",{type:"button",onClick:()=>qe(t.value),className:P("box-border w-full text-left bg-transparent border-0 px-3 py-2 cursor-pointer hover:bg-bg-raised",o?"text-accent":"text-fg"),children:e.jsx("span",{className:"font-body text-[12.5px]",children:t.label})})},t.value)})}):null,et=e.jsxs("div",{className:"relative",ref:m,children:[e.jsxs("button",{type:"button",onClick:()=>u(t=>!t),className:"box-border h-8 bg-card border border-solid border-hairline rounded-[3px] px-3 inline-flex items-center gap-2 cursor-pointer hover:border-fg",children:[e.jsx("span",{className:"font-mono text-[9.5px] uppercase tracking-wide10 text-subtle",children:"Sort"}),e.jsxs("span",{className:"font-mono text-[10.5px] uppercase tracking-wide8 text-fg",children:[(ke=Ve.find(t=>t.value===E))==null?void 0:ke.label," · ",F]}),e.jsx(Dt,{className:"w-3 h-3 text-subtle"})]}),Ne]}),tt=e.jsxs("div",{className:"relative shrink-0",ref:m,children:[e.jsx("button",{type:"button","aria-label":"Sort",onClick:()=>u(t=>!t),className:Ie,children:e.jsx(Lt,{className:"h-3.5 w-3.5"})}),Ne]}),st=e.jsx("button",{type:"button","aria-label":"Search playlists","aria-expanded":T||h.length>0,onClick:()=>ue(t=>!t),className:P(Ie,"shrink-0",(T||h.length>0)&&"border-accent-2 text-accent-2"),children:e.jsx(je,{className:"h-3.5 w-3.5"})});return e.jsxs("div",{className:"er-v2 min-h-screen bg-bg text-fg font-body",children:[l?e.jsx(Rt,{title:"Playlists",onBack:()=>n("/engine-room/home"),backLabel:"Back to Engine Room",count:e.jsxs("span",{className:"font-mono text-[14px] tracking-wide6 text-fg",children:["(",z,")"]}),primaryAction:L?void 0:e.jsxs("button",{type:"button",onClick:ye,className:"h-8 px-3 inline-flex items-center gap-1.5 rounded-[2px] font-head text-[11px] font-bold uppercase tracking-wide10 bg-accent text-bg hover:brightness-110",children:[e.jsx(Me,{className:"h-3.5 w-3.5"})," Create"]})}):e.jsxs("div",{className:"px-4 md:px-8 pt-6 md:pt-8 pb-2",children:[e.jsx(ht,{trail:[{label:"Engine Room",href:"/engine-room/home"},{label:"Playlists"}]}),e.jsxs("div",{className:"mt-2 flex items-end justify-between flex-wrap gap-3",children:[e.jsx("h1",{className:"font-head font-bold uppercase text-[40px] md:text-[56px] leading-none m-0 text-fg",children:"Playlists"}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2 bg-card border border-solid border-hairline rounded-[3px] px-3 py-2 min-w-[200px]",children:[e.jsx(je,{className:"w-3.5 h-3.5 text-subtle"}),e.jsx("input",{type:"text",value:h,onChange:t=>fe(t.target.value),placeholder:"Search playlists",className:"flex-1 bg-transparent border-0 outline-none font-body text-[13px] text-fg placeholder:text-subtle"})]}),et,!L&&e.jsxs("button",{type:"button",onClick:ye,className:"box-border bg-accent text-bg border-0 rounded-[3px] px-4 py-2 inline-flex items-center gap-2 cursor-pointer hover:brightness-110",children:[e.jsx(Me,{className:"w-3.5 h-3.5"}),e.jsx("span",{className:"font-head text-[12px] uppercase tracking-wide4",children:"Create Playlist"})]})]})]})]}),l?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 px-5 pt-2",children:[e.jsx("div",{className:"min-w-0 flex-1 overflow-x-auto",children:e.jsx(_e,{tabs:Le.map(t=>({...t,count:ne[t.value]})),activeValue:k,onChange:R,isPhone:!0})}),st,tt]}),(T||h.length>0)&&e.jsx("div",{className:"px-5 pt-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(je,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-subtle","aria-hidden":!0}
2),e.jsx("input",{type:"search",autoFocus:!0,value:h,onChange:t=>fe(t.target.value),onBlur:()=>{h||ue(!1)},placeholder:"Search playlistsâ¦","aria-label":"Search playlists",className:"h-8 w-full rounded-[2px] border border-hairline bg-bg pl-8 pr-3 font-body text-[12px] text-fg placeholder:text-subtle focus:outline-none focus-visible:border-accent-2 focus-visible:ring-[3px] focus-visible:ring-focus"})]})})]}):e.jsx("div",{className:"px-4 md:px-8 pt-2",children:e.jsx(_e,{tabs:Le.map(t=>({...t,count:ne[t.value]})),activeValue:k,onChange:R,isPhone:l})}),e.jsxs("div",{className:"px-4 md:px-8 py-5",children:[N.length===0&&A&&e.jsx(e.Fragment,{children:[0,1,2].map(t=>e.jsx("div",{className:"mb-5 h-[280px] bg-card border border-solid border-hairline rounded-[8px] animate-pulse"},t))}),N.map(t=>{var o;return e.jsx(Ut,{playlistId:t.id,title:t.title,videoCount:t.videoCount,permission:t.permission,user:t.User??{},isOwnPlaylist:(v==null?void 0:v.id)===((o=t.User)==null?void 0:o.id),cardMenuItems:Fe(t),onView:()=>n(`/playlists/${t.id}`),onCardWatchTrailer:Xe,onCardAddToSession:Ye,onCardAddToPlaylist:ze,onCardAddToGoogleCalendar:He,onCardAddToAppleCalendar:Ke},t.id)}),Qe&&e.jsx(Se,{title:"No Playlists Shared",hint:"When a coach shares a playlist with you, it'll land here."}),Ze&&e.jsx(Se,{title:"No Playlists Added Yet",hint:"Build your first playlist from the library.",ctaLabel:L?void 0:"Create Playlist",onCta:L?void 0:ye}),Je&&e.jsx(Se,{title:`No playlists match "${h}"`,hint:"Try a different search.",ctaLabel:"Clear search",onCta:()=>fe("")}),e.jsx("div",{ref:te,className:"h-4"}),A&&N.length>0&&e.jsx("div",{className:"py-4 text-center font-mono text-[11px] text-muted",children:"Loading moreâ¦"})]}),e.jsx(At,{open:X,onClose:()=>{M(!1),S(null)},playlist:g,onSuccess:me}),e.jsx(Ot,{open:H,onClose:()=>{ie(!1),S(null)},source:g,onSuccess:me}),e.jsx(Tt,{open:xe,onClose:()=>{le(!1),S(null)},playlist:g,onSuccess:me}),e.jsx(Pt,{open:ce,handleClose:()=>{G(!1),S(null)},handleDelete:We,title:"Delete this playlist?",actionBtnTitle:"Delete Playlist",subjectName:g==null?void 0:g.title,warning:g?`"${g.title}" and its ${g.videoCount} videos will be removed for everyone it's shared with. This can't be undone.`:void 0}),e.jsx(kt,{open:he,onClose:()=>_(!1),triggerReason:"feature-locked",context:"engine-room",currentPlanLabel:"Starter",featureName:"Playlists"}),e.jsx(_t,{open:be,item:Q,onClose:()=>{K(!1),de(null)},onOpenDetail:t=>{var x,w;const o=t.content_type==="collection"?t.id:((w=(x=t.videos)==null?void 0:x[0])==null?void 0:w.id)??t.id,a=Ge(t.title,o,t.id,t.content_type);n(`/collections?${a}`)}}),e.jsx(Et,{open:pe,onClose:()=>{Z(!1),c(null)},collectionIds:s?[s.id]:[]}),e.jsx(It,{open:J,handleClose:()=>{ee(!1),c(null)},videoIds:((Ae=s==null?void 0:s.videos)==null?void 0:Ae.map(t=>t.id))??[],workflow:"ENGINE_ROOM",practiceTypeByVideoId:p})]})}function Se({title:n,hint:b,ctaLabel:l,onCta:d}){return e.jsxs("div",{className:"border border-dashed border-tt-border rounded-[3px] px-7 py-12 flex flex-col items-start gap-3",children:[e.jsx("span",{className:"font-mono text-[10px] uppercase tracking-wide12 text-subtle",children:"NO SIGNAL"}),e.jsx("h3",{className:"font-head font-bold uppercase text-fg leading-none m-0",style:{fontSize:"28px"},children:n}),e.jsx("p",{className:"font-body text-[13.5px] text-muted max-w-[420px]",children:b}),l&&d&&e.jsxs("button",{type:"button",onClick:d,className:"mt-2 box-border px-4 py-2 bg-accent-2 text-bg border-0 font-head font-bold uppercase text-[13px] tracking-wide10 rounded-[2px] cursor-pointer hover:brightness-110",children:[l," â"]})]})}export{Nr as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.