"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[1287],{55988:(e,t,o)=>{o.d(t,{_K:()=>f,z3:()=>g});var n=o(56070),i=o(26325),a=o(45297),s=o(57431),l=o(89049),r=o(44630),c=o(91286),d=o(31209),u=o(7892),h=function(e,t,o,n){return new(o||(o=Promise))((function(i,a){function s(e){try{r(n.next(e))}catch(e){a(e)}}function l(e){try{r(n.throw(e))}catch(e){a(e)}}function r(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(s,l)}r((n=n.apply(e,t||[])).next())}))};const p=(0,u.p)("collectionCandidateAtom@tiktok/webapp-desktop",l.hA);p.debugLabel="collectionCandidateAtom@tiktok/webapp-desktop";const{useAtomService:f,useServiceState:m,useServiceDispatchers:g}=(0,d.i)(p,((e,t)=>({getCandidates(){return h(this,void 0,void 0,(function*(){const{user:o}=(0,s.x)();if(o){t(p,(e=>Object.assign(Object.assign({},e),{loading:!0})));try{const s=(0,r.bv)(e,p,{secUid:o.secUid}),l=yield function(e){return h(this,void 0,void 0,(function*(){return n.h.get("/api/collection/candidate/item_list/",{query:e,baseUrlType:2,headers:{[i.nk]:n.h.csrfToken}})}))}(Object.assign(Object.assign({},s),{appId:a.xE,scene:155}));(0,c.Tj)(e,t,p,"collection",l,{disableReportMore:!0})}catch(e){(0,c.e_)(t,p)}}}))},resetCandidates(){t(p,Object.assign({},l.hA))}})))},23303:(e,t,o)=>{o.d(t,{l:()=>I});var n=o(2787),i=o(40099),a=o(30543),s=o(58542),l=o(25616),r=o(32125),c=o(24834),d=o(92866),u=o(3797),h=o(21765);const p=(0,n.Y)(u.C,{size:72}),f=(0,i.memo)((function({listInfo:{statusCode:e},detailInfo:{reset:t,loadMore:o}}){const a=(0,i.useCallback)((()=>{t(),o()}),[t,o]);return(0,n.Y)(h.QW,{statusCode:e,iconElement:p,onRefresh:a})})),m=(0,i.memo)((function(){const e=(0,l.s)(),t=(0,i.useMemo)((()=>({title:e("collectionsProfilePage_collectionPage_emptyModal_header"),desc:e("collectionsProfilePage_collectionPage_emptyModal_desc")})),[e]);return(0,n.Y)(h.LL,{iconElement:p,emptyTip:t})}));var g=o(10745),x=o(86415),v=o(8154),w=o(41952);const y=(0,i.memo)((function({detailInfo:{loadMore:e},listInfo:{list:t,loading:o,hasMore:a,statusCode:s},listKey:l}){const r=(0,i.useRef)(null),c=(0,i.useCallback)((()=>{return t=this,n=void 0,l=function*(){!o&&a&&0===s&&(yield e())},new((i=void 0)||(i=Promise))((function(e,o){function a(e){try{r(l.next(e))}catch(e){o(e)}}function s(e){try{r(l.throw(e))}catch(e){o(e)}}function r(t){var o;t.done?e(t.value):(o=t.value,o instanceof i?o:new i((function(e){e(o)}))).then(a,s)}r((l=l.apply(t,n||[])).next())}));var t,n,i,l}),[o,a,s,e]);return(0,g.O9)({onHitBottom:c,elemRef:r,bottomThreshold:200}),(0,n.Y)(w.Gi,{ref:r,children:(0,n.Y)(x.Z,{pageType:121,itemList:[],itemListKey:l,loading:o,onHitBottom:()=>{},children:t.map((e=>(0,n.Y)(v.l,{itemId:e},e)))})})}));function b(){return(0,n.Y)(w.Gi,{children:(0,n.Y)(d.C,{isUser:!0})})}const C=(0,i.memo)((function({loadMore:e,reset:t,listState:o}){const a=(0,i.useMemo)((()=>({statusCode:o.statusCode,loadMore:e,reset:t})),[o.statusCode,e,t]);return(0,i.useEffect)((()=>{0===o.statusCode&&o.hasMore&&0===o.list.length&&e()}),[e,o.hasMore,o.list.length,o.statusCode]),(0,n.Y)(c.s6,{Error:f,Empty:m,List:y,Skeleton:b,detailInfo:a,listInfo:o,listKey:"collection"})}));var k=o(17446),T=o(55988),_=o(62186),P=o(65530);const M=_.default.div` padding: 0 12px 24px 12px; display: flex; flex-direction: column; gap: 24px; & > div:first-of-type { height: 475px; width: ${456}px; ${P.ph} { grid-gap: ${12}px; grid-template-columns: repeat(${3}, 1fr) !important; // could be improved with container query once supported div[data-e2e='collection-selector-footer'] { padding: 67px 8px 8px; & > svg:first-of-type { width: 13px; height: 13px; } & > span:first-of-type { font-size: 12px; line-height: 12px; } } } } & > button { margin: 0 12px; } `,j=_.default.div` position: relative; display: flex; align-items: center; justify-content: center; height: 52px; padding: 8px 8px 4px 8px; & > .leading { width: 88px; flex-shrink: 0; display: flex; align-items: center; justify-content: flex-start; } & > .title { flex: 1; text-align: center; font-size: 17px; font-weight: 700; color: ${e=>e.theme.colors.UIText1}; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } & > .trailing { width: 88px; flex-shrink: 0; display: flex; align-items: center; justify-content: flex-end; } `,I=(0,i.memo)((function({isFromCreateCollection:e,open:t,onOpenChange:o,onCommit:c,onPrev:d,loading:u}){const h=(0,l.s)(),[p,f]=(0,T._K)((e=>e),r.bN),m=(0,k.Xq)(),g=(0,i.useMemo)((()=>0!==p.list.length||e?0===m.size&&e?(0,n.Y)(s.I05,{variant:"secondary",label:h("live_done"),onClick:c,loading:u}):(0,n.Y)(s.I05,{label:h("collectionsProfilePage_favoritesPage_selectVideosModal_btn2",{d_numOfVideos:m.size}),disabled:0===m.size,onClick:c,loading:u}):(0,n.Y)(s.I05,{variant:"secondary",label:h("Close"),onClick:()=>o(!1),loading:u})),[h,m.size,e,c,u,p.list.length,o]),x=(0,i.useCallback)((t=>{"Escape"===t.key?o(!1):"Enter"===t.key&&(p.list.length>0||e)&&c()}),[p.list.length,e,c,o]);return(0,i.useEffect)((()=>{if(t)return document.addEventListener("keydown",x,!0),()=>{document.removeEventListener("keydown",x,!0)}}),[x,t]),(0,n.FD)(s.nOL,{width:"large",style:{maxWidth:"480px",zIndex:3001},open:t,onOpenChange:o,outsidePressDismiss:0===m.size,children:[(0,n.FD)(j,{children:[(0,n.Y)("div",{className:"leading",children:d&&(0,n.Y)(s.PH3,{icon:(0,n.Y)(s.VMf,{autoMirror:!0}),onClick:d})}),(0,n.Y)("div",{className:"title",children:h("collectionsProfilePage_favoritesPage_selectVideosModal_header")}),(0,n.Y)("div",{className:"trailing",children:(0,n.Y)(s.PH3,{"aria-label":"close",icon:(0,n.Y)(a.g,{}),onClick:()=>o(!1)})})]}),(0,n.FD)(M,{children:[(0,n.Y)(C,{listState:p,loadMore:f.getCandidates,reset:f.resetCandidates}),g]})]})}))},73174:(e,t,o)=>{o.d(t,{l:()=>d});var n=o(40099),i=o(50299),a=o(87934),s=o(25616),l=o(16891),r=o(28086),c=function(e,t,o,n){return new(o||(o=Promise))((function(i,a){function s(e){try{r(n.next(e))}catch(e){a(e)}}function l(e){try{r(n.throw(e))}catch(e){a(e)}}function r(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(s,l)}r((n=n.apply(e,t||[])).next())}))};function d({onSuccess:e,enterMethod:t,playModeForTea:o}){const d=(0,s.s)(),u=(0,i.Z)(),[{isFetching:h},p]=(0,r.I)(a.m,{resetStateBeforeDispatch:!0}),f=(0,n.useCallback)((({statusCode:n,collectionId:i,selectedVideosToAdd:a})=>{if(0===n){l.f.sendEvent("add_vids_to_collection",{enter_method:t,play_mode:o});const n=1===a.size?d("collectionsProfilePage_collectionsPage_topSection_addToastSingular"):d("collectionsProfilePage_collectionsPage_topSection_addToastPlural",{d_numOfVideos:a.size});u({success:!0,message:n}),e(i)}else u({success:!1,message:d("Sorry, something wrong with the server, please try again.")})}),[u,d,t,e,o]);return[h,(0,n.useCallback)(((e,t)=>c(this,void 0,void 0,(function*(){t.size>0&&(yield p({collectionId:e,commitIds:[...t].join(",")},(({statusCode:o})=>f({statusCode:o,collectionId:e,selectedVideosToAdd:t}))))}))),[p,f])]}},17446:(e,t,o)=>{o.d(t,{B6:()=>a,Xq:()=>s,fi:()=>r});var n=o(31209);const i=(0,o(7892).p)("selectorAtom@tiktok/webapp-desktop",new Set),{useAtomService:a,useServiceState:s,useServiceDispatchers:l,getStaticApi:r}=(0,n.i)(i,((e,t)=>({toggle(e){t(i,(t=>{const o=new Set(t);return t.has(e)?o.delete(e):o.add(e),o}))},set(e){t(i,new Set(e))},clear(){t(i,new Set)}})))},8154:(e,t,o)=>{o.d(t,{l:()=>g});var n=o(2787),i=o(40099),a=o(58542),s=o(60484),l=o(53438),r=o(31344),c=o(60072),d=o(77170),u=o(32125),h=o(63185),p=o(80635),f=o(17446),m=o(41952);const g=(0,i.memo)((function({itemId:e,isOverlay:t}){const[o,g]=(0,f.B6)((t=>t.has(e))),x=(0,c.F3)((t=>t[e]),u.bN),{video:{cover:v,zoomCover:w},desc:y}=(0,i.useMemo)((()=>(0,s.L$)(x)),[x]),{playCount:b}=(0,d.D)(x),C=(0,i.useMemo)((()=>({zoomCover:w,cover:v,quality:"480"})),[w,v]),k=(0,l.mx)(x),T=k||!t,_=(0,i.useCallback)((()=>{g.toggle(e)}),[g,e]),P=(0,i.useCallback)((e=>{e.preventDefault(),e.stopPropagation(),_()}),[_]),M=(0,i.useCallback)((e=>{13!==e.keyCode&&32!==e.keyCode||_()}),[_]),j=(0,s.D1)(null!=b?b:0),{ratio:I}=r.f.compact;return(0,n.Y)(m.xO,{isOverlay:t,onClick:P,onKeyDown:M,children:(0,n.FD)(p.w,{e2eTag:"collection-item",ratio:I,borderRadius:"4px",onKeyDown:M,children:[(0,n.FD)(h.NR,{children:[(0,n.Y)(m.xl,{label:"",checked:o,onChange:_}),T&&(0,n.Y)(m.zj,{video:C,alt:y,hidePhotoIcon:t&&k})]}),!t&&(0,n.FD)(m.xk,{"data-e2e":"collection-selector-footer",children:[(0,n.Y)(a.bt4,{}),(0,n.Y)("span",{children:j})]})]})})}))},41952:(e,t,o)=>{o.d(t,{Gi:()=>c,xO:()=>h,xk:()=>u,xl:()=>d,zj:()=>p});var n=o(62186),i=o(58542),a=o(32545),s=o(92060),l=o(63185),r=o(56999);const c=n.default.div` overflow: auto; scroll-behavior: smooth; scrollbar-width: none; scrollbar-color: transparent transparent; &::-webkit-scrollbar { display: none; width: 0; } &::-webkit-scrollbar-track { background: transparent; } &::-webkit-scrollbar-thumb { background-color: transparent; } `,d=(0,n.default)(i.h$y)` position: absolute; top: ${8}px; inset-inline-end: ${8}px; pointer-events: none; z-index: 1; & > .TUXCheckboxStandalone--circle > .TUXCheckboxStandalone-indicator { border-radius: 50%; border: 2.26px solid ${e=>e.theme.colors.ConstTextInverse}; } & > .TUXCheckbox-labelContainer { display: none; } `,u=(0,n.default)(s.xk)` display: flex; align-items: center; height: unset; color: ${e=>e.theme.colors.ConstTextInverse}; gap: 4px; padding: 67px 13px 8px; pointer-events: none; & > svg:first-of-type { width: 18px; height: 18px; } & > span:first-of-type { font-size: 16px; font-weight: 500; } `,h=(0,n.default)(l.iP,{target:"e18o3lv10"})((({isOverlay:e})=>[e&&{position:"absolute",top:0,zIndex:1,height:"100%",width:"100%",[`${r.h9}`]:{visibility:"hidden"}}]),"label:DivSelectorItemContainer;"),p=(0,n.default)(a.x)` clip-path: ${e=>e.hidePhotoIcon?"circle(14px at calc(100% - 20px) 20px)":"none"}; pointer-events: ${e=>e.hidePhotoIcon?"none":"auto"}; `},3797:(e,t,o)=>{o.d(t,{C:()=>s});var n=o(18047),i=o(52837),a=o(40099),s=(0,i.r)((function(e){return a.createElement("svg",(0,n._)({fill:"currentColor"},e,{viewBox:"0 0 72 72",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",className:e.className}),a.createElement("path",{d:"M14.32 10.1c-.82 1.6-.82 3.7-.82 7.9v43.9c0 2.29 0 3.43.47 4.04.42.53 1.04.85 1.72.87.77.02 1.7-.66 3.54-2.01l15.35-11.26c.51-.37.77-.56 1.04-.63.25-.07.5-.07.76 0 .27.07.53.26 1.04.63L52.77 64.8c1.85 1.35 2.77 2.03 3.54 2 .68-.01 1.3-.33 1.72-.86.47-.6.47-1.75.47-4.04V18c0-4.2 0-6.3-.82-7.9a7.5 7.5 0 0 0-3.28-3.28C52.8 6 50.7 6 46.5 6h-21c-4.2 0-6.3 0-7.9.82a7.5 7.5 0 0 0-3.28 3.28ZM46.5 9c2.15 0 3.58 0 4.68.1 1.07.08 1.55.23 1.86.39a4.5 4.5 0 0 1 1.97 1.97c.16.3.31.8.4 1.86.09 1.1.09 2.53.09 4.68v45.07l-.95-.69-15.36-11.26-.1-.07A5.82 5.82 0 0 0 37.13 50a4.5 4.5 0 0 0-2.26 0c-.88.23-1.61.78-1.96 1.05l-.1.07-15.36 11.26-.95.7V18c0-2.15 0-3.58.1-4.68.08-1.07.23-1.55.39-1.86a4.5 4.5 0 0 1 1.97-1.97c.3-.16.8-.31 1.86-.4C21.92 9 23.35 9 25.5 9h21Z"}))}))},78448:(e,t,o)=>{o.d(t,{A:()=>s,R:()=>l});var n=o(18047),i=o(52837),a=o(40099);function s(e){return a.createElement("svg",(0,n._)({fill:"currentColor"},e,{viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",className:e.className}),a.createElement("path",{d:"M24 46a22 22 0 1 1 0-44 22 22 0 0 1 0 44Zm-.59-11.72 11.18-17.66a1 1 0 0 0-.3-1.38l-1.95-1.23a1 1 0 0 0-1.38.3l-9.65 15.25-5.6-6.33a1 1 0 0 0-1.41-.09l-1.72 1.53a1 1 0 0 0-.09 1.41l7.5 8.47a2.15 2.15 0 0 0 3.42-.27Z"}))}var l=(0,i.r)(s)},58180:(e,t,o)=>{o.d(t,{k:()=>b});var n=o(24643),i=o(40099),a=o(58542),s=o(25616),l=o(50299),r=o(26325),c=o(56070),d=o(62186);const u=d.default.div` padding: 0 24px 24px 24px; display: flex; flex-direction: column; gap: ${e=>e.hasMakePublic?"20px":"4px"}; `,h=d.default.div` color: ${a.Tj4.UIText3}; font-size: 12px; line-height: 15.6px; margin-top: 4px; font-weight: 400; `,p=d.default.div` display: flex; flex-direction: column; gap: 0px; `,f=d.default.div` margin-bottom: 8px; `,m=d.default.span` font-size: 16px; line-height: 20.8px; font-weight: 500; `,g=d.default.span` color: ${e=>e.hasError?a.Tj4.UITextDanger:a.Tj4.UIText3}; font-size: 14px; line-height: 18.2px; font-weight: 400; `,x=d.default.div` display: flex; align-items: center; font-size: 13px; line-height: 19.5px; font-weight: 500; word-wrap: break-word; color: ${a.Tj4.UITextDanger}; min-height: 19.5px; margin-top: 4px; & > svg { margin-right: 4px; } `,v=(0,d.default)(a.OVK)` align-items: center !important; & > .TUXSwitch-labelContainer { padding-top: 0 !important; & > .TUXSwitch-label { font-weight: 500 !important; font-size: 16px !important; } } `,w=(0,d.default)(a.DBO)` margin-top: 8px; margin-bottom: 4px; & .TUXModalNavBar-title { font-weight: 700; } `;var y=function(e,t,o,n){return new(o||(o=Promise))((function(i,a){function s(e){try{r(n.next(e))}catch(e){a(e)}}function l(e){try{r(n.throw(e))}catch(e){a(e)}}function r(e){var t;e.done?i(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(s,l)}r((n=n.apply(e,t||[])).next())}))};const b=(0,i.memo)((function({open:e,onOpenChange:t,name:o,onNameChange:d,isPublic:b,onIsPublicChange:C,nextText:k,onNext:T,loading:_}){const P=(0,s.s)(),M=(0,l.Z)(),[j,I]=(0,i.useState)(!1),[S,E]=(0,i.useState)(!1),O=(0,i.useMemo)((()=>o.length>30),[o.length]),z=(0,i.useMemo)((()=>o.trim().length>0&&!O),[o,O]),U=_||S,D=(0,i.useMemo)((()=>O?P("collectionsProfilePage_favoritesPage_newModal_errorMessage"):j?P("yproject_playlist_name_toast",{name:o}):void 0),[P,o,O,j]),L=(0,i.useCallback)((()=>y(this,void 0,void 0,(function*(){let e;E(!0),d(o.trim());try{e=yield function(e){return t=this,o=void 0,i=function*(){return c.h.get("/api/playlist/name_check",{query:{name:e},baseUrlType:2,headers:{[r.nk]:c.h.csrfToken}})},new((n=void 0)||(n=Promise))((function(e,a){function s(e){try{r(i.next(e))}catch(e){a(e)}}function l(e){try{r(i.throw(e))}catch(e){a(e)}}function r(t){var o;t.done?e(t.value):(o=t.value,o instanceof n?o:new n((function(e){e(o)}))).then(s,l)}r((i=i.apply(t,o||[])).next())}));var t,o,n,i}(o.trim())}catch(t){e={statusCode:-1,isValid:!1}}const{statusCode:t,isValid:n}=e;0===t?(n?(I(!1),T()):I(!0),E(!1)):M({success:!1,message:P("Sorry, something wrong with the server, please try again.")})}))),[P,M,d,T,o]),Y=(0,i.useCallback)((e=>y(this,void 0,void 0,(function*(){z&&"Enter"===e.key&&(yield L())}))),[z,L]);return(0,i.useEffect)((()=>{I(!1)}),[o]),(0,i.useEffect)((()=>{if(e)return document.addEventListener("keydown",Y,!0),()=>{document.removeEventListener("keydown",Y,!0)}}),[Y,e]),(0,n.jsxs)(a.nOL,{open:e,onOpenChange:t,"data-e2e":"collection-create-modal",style:{zIndex:3001},children:[(0,n.jsx)(w,{title:P("collectionsProfilePage_favoritesPage_newModal_header")}),(0,n.jsxs)(u,{hasMakePublic:void 0!==b,children:[(0,n.jsxs)(p,{children:[(0,n.jsxs)("div",{children:[(0,n.jsxs)(f,{children:[(0,n.jsxs)(m,{children:[P("collection_name_header")," "]}),(0,n.jsxs)(g,{hasError:Boolean(O),children:["(",o.length,"/",30,")"]})]}),(0,n.jsx)(a.ZPA,{ref:t=>{e&&t&&t.focus()},hideLabel:!0,label:P("collection_name_header"),placeholder:P("collection_name_description"),value:o,onChange:d,disabled:U}),(0,n.jsx)(x,{children:D?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.Om6,{size:"13px"}),D]}):null})]}),void 0!==b&&C&&(0,n.jsxs)("div",{children:[(0,n.jsx)(v,{label:P("make_public_toggle"),labelPosition:"before",disabled:U,checked:b,onChange:C}),(0,n.jsx)(h,{children:P("make_public_toggle_description")})]})]}),(0,n.jsx)(a.I05,{disabled:!z,label:null!=k?k:P("Next"),variant:"primary",onClick:L,loading:U})]})]})}))},50299:(e,t,o)=>{o.d(t,{Z:()=>p});var n=o(24643),i=o(40099),a=o(67518),s=o(78448),l=o(59131),r=o(58542),c=o(25616),d=o(23237),u=o(26290);const h=o(62186).default.div` &.dark > .TUXBottomToast, &.dark > .TUXTopToast, & > .TUXBottomToast[data-tux-color-scheme='dark'], & > .TUXTopToast[data-tux-color-scheme='dark'] { background-color: rgba(56, 56, 56, 0.95) !important; } `;function p(e="top",t){var o,p;const f=(0,c.s)(),{showToast:m,dismissToast:g,toastList:x}=(0,d.n)(e),{isDark:v}=(0,a.u)(),w=(0,i.useRef)(-1),y=null!==(o=null==t?void 0:t.theme)&&void 0!==o?o:"default",b=null!==(p=null==t?void 0:t.durationMs)&&void 0!==p?p:3e3,C=(0,i.useCallback)((({success:t,message:o,trailing:a})=>{const c=t||o?o:f("Sorry, something wrong with the server, please try again."),d=(0,i.isValidElement)(c)?c:(0,n.jsx)(u.F.P1,{weight:"medium",children:c}),p=t?(0,n.jsx)(s.R,{color:"UIText1"}):(0,n.jsx)(l.O,{color:"UIText1"}),g="dark"===y||"top"===e?{"data-tux-color-scheme":"dark"}:void 0;return x.forEach((e=>e.dismiss())),w.current=m((0,n.jsx)(h,{className:"dark"===y||v?"dark":"",children:a?(0,n.jsx)(r.qaZ,Object.assign({leading:p,content:d,trailing:a},g)):(0,n.jsx)(r.Mzi,Object.assign({leading:p,content:d},g))}),{durationMs:b,hasToastComponent:!1}),w.current}),[b,v,e,m,f,x]),k=(0,i.useCallback)((()=>{w.current>-1&&(g(w.current),w.current=-1)}),[g]),T=C;return T.showToast=C,T.dismissToast=k,T}},23237:(e,t,o)=>{o.d(t,{n:()=>a});var n=o(40099),i=o(58542);const a=e=>{const t=(0,n.useContext)(i.eU);if(!t)throw Error("ToastContext is undefined when calling useGlobalTUXToast. Make sure to wrap your app with TUXProvider.");const o=`GLOBAL-${e.toUpperCase()}`,a=t.getToasts(o);return{id:o,showToast:(e,{durationMs:n,hasToastComponent:i=!0}={hasToastComponent:!0})=>t.addToast(o,{content:e,hasToastComponent:i},n),showToastSingleMode:(e,{durationMs:n,hasToastComponent:i=!0}={hasToastComponent:!0})=>t.addToastSingleMode(o,{content:e,hasToastComponent:i},n),dismissToast:e=>t.removeToast(e),toastList:a}}}}]);