1import{R as e,u as t,r as i}from"./index.Dcq7Tn10.js";import{c as a,d as s,c8 as r,bx as l,i as o,v as n,F as m,c9 as c,ca as u,cb as d,cc as y,o as p,B as f,T as g}from"./main.BpO2XlP_.js";import{u as j,a as b,b as h}from"./useOptimisticPlaylistReorder.D90oF5uF.js";import{S as v,u as I}from"./StaticTextContext.BQ4R1SSr.js";import{c as x,P}from"./connect.B8_DVB94.js";import{B as w}from"./index.Bmi_K17R.js";import{L as E,a as T}from"./index.BLxSAvaS.js";import{P as S}from"./index.BRjSlZ6w.js";import{C as k}from"./index.Bx08yXgA.js";import{I as C}from"./InfiniteScroll.XkBR5C2H.js";import{w as L}from"./withCommunityErrorBoundary.B4K_C19W.js";import{u as _}from"./useRequireAuth.qQyCXW3X.js";import{u as O}from"./usePrimaryAppLanguage.gOrciDQ5.js";import{u as M}from"./useIsMobile.BBl5kiAm.js";import{M as R,C as N}from"./MobileBreakpointContext.DOrk82xA.js";import{a as K,c as F,d as B}from"./CommunityProfileCarousels.FzlhQguD.js";import{e as H}from"./content-utils.CbF-PudU.js";import{u as D}from"./use-latest.Cp9nep0_.js";import{F as G}from"./query.CttESOpP.js";import{c as z,a as W}from"./cache-updaters.DP7skJHm.js";import{u as q}from"./usePostHogEvent.D2sNDrod.js";import{u as A}from"./useQuery.DAn0LDAH.js";import{u as Q}from"./useMutation.BOttLjft.js";import"./staticTextEn.UPMVf61n.js";import"./staticTextEs.DJF2PufX.js";import"./staticTextDe.DGaNPAXM.js";import"./staticTextFr.CRVsglAw.js";import"./withIcon.DvSZpKgo.js";import"./index.C7Lrg5UE.js";import"./reportCommunityBoundaryError.CfowstBn.js";import"./index.Btbzzceh.js";import"./Row.WSDJADOH.js";import"./index.D7gSPFUi.js";import"./index.CnyCmNWu.js";import"./Tile.v2Graphql.BfrTqBp0.js";import"./Tile.v2Info.Dt11F_q-.js";import"./index.NlzaB8YT.js";import"./index.CieSfI8y.js";import"./index.DcJ0qRRN.js";import"./selectors.CVQy6HCL.js";import"./index.TfHq0YND.js";import"./utils.SUlfOncg.js";import"./_createCompounder.Cx_OY_wF.js";import"./index.i7WhFuy7.js";import"./index.BWccFfdn.js";import"./index.4A-evH4t.js";import"./PlayOutline.CWDI68lA.js";import"./index.BXEGjshX.js";import"./hooks.BW7_Y6Tu.js";import"./useLazyQuery.-sEQ1kMb.js";import"./useIsomorphicLayoutEffect.CDczTpja.js";import"./useWarnRemovedOption.Os8in3ZX.js";import"./index.DVx9YhLC.js";import"./PlaylistAddRemove.D5vH46Pg.js";import"./index.BmicQs6a.js";import"./index.DQqBGCRP.js";import"./index.CUBfiwVy.js";import"./index.BJGsL28j.js";import"./index.C9DA71Y7.js";import"./useHistory.CiRcRjQx.js";import"./index.CfF8IUYf.js";import"./index.BbMe_jcQ.js";import"./index.DFMPbZro.js";import"./index.Dzq8B4Cs.js";import"./index.DD0KifXd.js";import"./index.CZge7TZQ.js";import"./Close.CMDH8pQC.js";function U(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function J(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{},a=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),a.forEach(function(t){U(e,t,i[t])})}return e}function V(e,t){if(null==e)return{};var i,a,s,r={};if("undefined"!=typeof Reflect&&Reflect.ownKeys){for(i=Reflect.ownKeys(Object(e)),s=0;s<i.length;s++)a=i[s],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a]);return r}if(r=function(e,t){if(null==e)return{};var i,a,s={},r=Object.getOwnPropertyNames(e);for(a=0;a<r.length;a++)i=r[a],t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(s[i]=e[i]);return s}(e,t),Object.getOwnPropertySymbols)for(i=Object.getOwnPropertySymbols(e),s=0;s<i.length;s++)a=i[s],t.indexOf(a)>=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a]);return r}const $={"/watch-later":{playlistType:"default",titleKey:"watchLater",emptyTextKey:"emptyWatchLater",dataSource:"playlist"},"/favorites":{playlistType:"favorites",titleKey:"favorites",emptyTextKey:"emptyFavorites",dataSource:"playlist"},"/currently-watching":{titleKey:"currentlyWatching",emptyTextKey:"emptyCurrentlyWatching",dataSource:"inProgress"},"/watch-history":{titleKey:"watchHistory",emptyTextKey:"emptyWatchHistory",dataSource:"watchHistory"}},Y=/^\/playlist\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/i;const Z=24;function X({location:a}){var s;const{enabled:v}=r(),{isLoggedIn:x}=_(),P=O(),L=t(l),R=L.get("jwt")||"",N=L.get("uuid")||"",U=o(),[J,V]=i.useState(!1),X=D(J),[ee,te]=i.useState(Z),[ie,ae]=i.useState(!1),se=i.useRef(!1),[re,le]=i.useState(a.pathname);a.pathname!==re&&(le(a.pathname),te(Z));const oe=i.useCallback(()=>{const e=!X.current;V(!X.current),e&&te(Z)},[]),ne=M(768),me=M(1280);let ce="large";ne?ce="small":me&&(ce="medium");const ue=function(e){const t=e.match(Y);return t?{dataSource:"playlist",emptyTextKey:"noEpisodesYet",customPlaylistId:t[1]}:$[e]||$["/watch-later"]}(a.pathname),de="playlist"===ue.dataSource,ye="inProgress"===ue.dataSource,pe="watchHistory"===ue.dataSource,{targetId:fe,resolving:ge,resolvedPlaylistName:je}=j({enabled:de,isLoggedIn:x,playlistType:ue.playlistType,customPlaylistId:ue.customPlaylistId,jwt:R}),{data:be,loading:he,refetch:ve}=A(c,{variables:{playlistIds:fe?[fe]:[],language:[P,"_primary"]},skip:!de||!x||!fe,fetchPolicy:m,errorPolicy:n,context:{jwt:R}}),Ie=ge||!!fe&&he,xe=i.useMemo(()=>{var e;return de&&fe&&be&&((null===(e=be.playlistList)||void 0===e?void 0:e.playlists)||[]).find(e=>e.id===fe)||null},[de,fe,be]),Pe=i.useMemo(()=>xe?H(xe.playlistItems||[],{dedupe:!1,pivotEpisodesToSeries:!1,requireNavigablePath:!0}):[],[xe]),we=i.useRef(null),Ee=D(ve),Te=i.useCallback(()=>{we.current&&clearTimeout(we.current),we.current=setTimeout(()=>{we.current=null,Ee.current()},250)},[Ee]);i.useEffect(()=>()=>{we.current&&clearTimeout(we.current)},[]);const[Se]=Q(u,{context:{jwt:R}}),[ke]=Q(d,{context:{jwt:R}}),Ce=i.useCallback(async({moving:e,destPosition:t,fromIndex:i,toIndex:a,visibleItems:s})=>{if(!xe)return;const r=e.playlistItemContentId,l=e.playlistItemContentType||"video",o=[...s];o.splice(i,1),o.splice(a,0,e);const n=o.map(e=>String(e.id)),m=U.cache.identify({__typename:"Playlist",id:xe.id});await ke({variables:{playlistItemId:e.id,contentId:r,contentType:l,playlistPosition:t,playlistId:xe.id,playlistType:xe.playlistType},update:e=>{z({entityId:m,field:"playlistItems",orderedItemIds:n})(e)}}),Te()},[xe,ke,Te,U]),{visibleItems:Le,handleReorder:_e,reorderInFlight:Oe}=b({baseItems:Pe,resetDeps:[a.pathname,J],clearMode:"immediate",validateItems:e=>Boolean(e.playlistItemContentId),commit:Ce}),Me=i.useCallback(async e=>{if(!xe)return;const t=e,i=t.playlistItemContentId,a=t.playlistItemContentType||"video",s=t.
1id;if(i&&s)try{await Se({variables:{contentId:i,contentType:a,playlistId:xe.id,playlistType:xe.playlistType},update:e=>{W({entityId:e.identify({__typename:"Playlist",id:xe.id}),field:"playlistItems",countField:"itemCount",countLocation:"sibling",match:(e,t)=>String(t("id",e))===String(s)})(e)}})}catch(r){}},[xe,Se]),{data:Re,loading:Ne}=A(y,{variables:{language:P,contentLanguage:[P,"_primary"]},skip:!ye||!x,fetchPolicy:m,errorPolicy:n,context:{jwt:R}}),Ke=ye?null==Re||null===(s=Re.userProfileCurrent)||void 0===s?void 0:s.inProgress:void 0,{items:Fe}=K(Ke,P,R),[Be]=Q(G,{context:{jwt:R}}),He=i.useCallback(async e=>{var t;const i=e,a=Number(e.contentId),s=i.bundledEpisodeContentIds;let r;r=s&&s.length>0?s.filter(e=>Number.isFinite(e)&&e>0):Number.isFinite(a)&&a>0?[a]:[];const l=null!==(t=i.mediaId)&&void 0!==t?t:i.id,o=i.bundledEpisodeMediaIds;let n;if(n=o&&o.length>0?o:null!=l?[String(l)]:[],0===r.length)return;if(0===(await Promise.allSettled(r.map(e=>Be({variables:{videoId:e,hiddenByUser:!0}})))).filter(e=>"fulfilled"===e.status).length)return;if(!N)return;const m=U.cache.identify({__typename:"UserProfile",uuid:N});if(!m)return;const c=new Set(n.map(String));W({entityId:m,field:"inProgress",match:(e,t)=>c.has(String(t("mediaId",e)))})(U.cache)},[Be,N,U]),{watchHistoryItems:De,watchHistoryLoading:Ge,onRemoveWatchHistoryItem:ze,loadMore:We,lastBatchSize:qe,isLoadingMore:Ae}=h({language:P,jwt:R,isLoggedIn:x&&pe,limit:24}),Qe=i.useCallback(async e=>{await ze(e)},[ze]),Ue=q("community_playlist_viewed"),Je=i.useRef(!1),Ve=ue.customPlaylistId||ue.playlistType||ue.dataSource,$e=ue.customPlaylistId?"custom":"system",Ye="system"===$e||!!xe;i.useEffect(()=>{Je.current||x&&Ve&&("custom"===$e&&Ie||(Je.current=!0,Ue(Ve,$e,Ye)))},[x,Ve,$e,Ye,Ie,Ue]);let Ze,Xe=[],et=!1;de?(Xe=Le,et=Ie,Ze=Me):ye?(Xe=Fe,et=Ne,Ze=He):pe&&(Xe=De,et=Ge,Ze=Qe);const tt=de&&!!fe&&!xe?[]:Xe,it=(ye||de)&&!J&&tt.length>ee,at=it?ee:tt.length,st=D(tt.length),rt=i.useCallback(()=>{se.current||(se.current=!0,ae(!0),te(e=>Math.min(e+Z,st.current)))},[]);i.useLayoutEffect(()=>{se.current=!1,ie&&ae(!1)},[ee,ie]);const lt=I({keys:["playlist"]}),ot=I({keys:[ue.titleKey||""]}),nt=I({keys:[ue.emptyTextKey]}),mt=I({keys:["backToLibrary"]}),ct=I({keys:["editPlaylistLabel"]}),ut=I({keys:["doneEditingLabel"]}),dt=I({keys:["moveEarlierInPlaylist"]}),yt=I({keys:["moveLaterInPlaylist"]}),pt=I({keys:["removeFromPlaylist"]}),ft=I({keys:["confirmRemoveFromPlaylist"]}),gt=I({keys:["dragRoleDescription"]}),jt=I({keys:["dragLifted"]}),bt=I({keys:["dragGrabbed"]}),ht=I({keys:["dragMovedInPlaylist"]}),vt=I({keys:["dragDropped"]}),It=I({keys:["dragCancelled"]});if(!v||!x)return null;let xt;xt=ue.customPlaylistId?je||lt:ot;const Pt={earlierLabel:dt,laterLabel:yt,removeLabel:pt,confirmLabel:ft,dragRoleDescription:gt,dragLifted:jt,dragGrabbed:bt,dragMovedInPlaylist:ht,dragDropped:vt,dragCancelled:It};return e.createElement("div",{className:"system-playlist-full-view"},e.createElement("div",{className:"system-playlist-full-view__header"},e.createElement("div",{className:"system-playlist-full-view__back"},e.createElement(w,{className:"system-playlist-full-view__back-button",url:"/playlist/default"},mt)),e.createElement(p,{className:"system-playlist-full-view__title"},xt),e.createElement("div",{className:"system-playlist-full-view__edit-action"},tt.length>0?e.createElement(f,{type:g.GHOST,className:"system-playlist-full-view__edit-button",onClick:oe,"aria-label":J?ut:ct},J?e.createElement(k,null):e.createElement(S,null)):null)),et&&0===tt.length?e.createElement(F,{count:8,showSeriesLabel:ye}):null,tt.length>0?e.createElement(B,{key:null!=fe?fe:a.pathname,items:tt,initialCount:at,seeMoreLabel:"",hideToggle:!0,editMode:J,onRemoveItem:Ze,onReorderItem:de?_e:void 0,reorderDisabled:Oe,editToolbarSize:ce,editToolbarLabels:Pt,autoScrollMaxStepPx:30,autoScrollEdgePx:120}):null,it?e.createElement(C,{onLoadMore:rt,currentCount:ee,lastBatchSize:Z,limit:Z,loading:ie}):null,pe?e.createElement(e.Fragment,null,e.createElement(C,{onLoadMore:We,currentCount:Xe.length,lastBatchSize:qe,limit:24,loading:Ae}),Ae?e.createElement("div",{className:"system-playlist-full-view__loading-more","data-infinite-scroll-spinner":"true"},e.createElement(E,{visible:!0,icon:T})):null):null,et||0!==tt.length?null:e.createElement("div",{className:"system-playlist-full-view__empty"},e.createElement("p",null,nt)))}const ee=a(s({storeKey:"communityMyLibraryPage"}),x({seoType:P,storeBranch:"",storeKey:"communityMyLibraryPage"}))(function(t){let{staticText:i}=t,a=V(t,["staticText"]);return e.createElement(R,{breakpoints:N},e.createElement(v,{staticText:i},e.createElement(X,J({},a))))});function te(t){return e.createElement(ee,J({},t))}te.displayName="SystemPlaylistFullView";const ie=L(te);export{ie as default}; 2//# sourceMappingURL=index.BTgwCigO.js.map
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.