Build 542549stable
Module 382003
8,193 characters · in 038b14169e8f1b05.jsDependencies
Lazily required by (0)none
Requires (43)
Source Raw
function(e,t,s){s.d(t,{A:()=>es});var n=s(627968),l=s(64700),i=s(17928),a=s(192308),o=s(452027),r=s(212245),c=s(287809),d=s(927578),u=s(285918),m=s(912630),x=s(965162),p=s(413339),g=s(952572),A=s(503698),j=s.n(A),f=s(990078),N=s(939249),_=s(834730),h=s(782134),E=s(777666),O=s(403581),I=s(750943),v=s(373495),C=s(428678),k=s(635739),S=s(442433),y=s(964486),T=s(793574),b=s(688810),D=s(607470),U=s(421838),B=s(891540),M=s(738011),P=s(174459),L=s(486020),w=s(935208),G=s(498559),R=s(577718),V=s(652215),H=s(897513),F=s(339984),W=s(788868),K=s(375708),z=s(941531);function J(e){let{icon:t,onClick:s,text:l,children:i,className:a,selected:o=!1,disabled:r=!1,onMouseLeave:c,onBlur:d}=e;return(0,n.jsxs)(N.D,{className:j()(a,z.gf,{[z.JI]:o,[z.A7]:r}),onMouseLeave:c,onBlur:d,onClick:r?void 0:s,children:[o?(0,n.jsx)("div",{className:z.SH}):null,(0,n.jsxs)("div",{className:z.kV,children:[i,(0,n.jsxs)("div",{className:z.fP,children:[(0,n.jsx)(t,{className:z.ob,color:"currentColor",size:"custom",width:18,height:18}),(0,n.jsx)(_.E,{className:z.V7,color:"none",variant:"text-sm/normal",children:l})]})]})]})}function Q(e){let{option:t,source:s,isAnimated:i}=e,[a,o]=l.useState(!1);if(l.useEffect(()=>{new Image().src=s},[s]),!i||null==t)return(0,n.jsx)("div",{className:z.PQ,style:{backgroundImage:`url(${s})`}});let r=(0,L.Bo)({userId:t.user_id,assetId:t.id,assetHash:t.asset,size:720,canAnimate:!1});return(0,n.jsx)("img",{onMouseMove:()=>o(!0),onMouseLeave:()=>o(!1),className:z.PQ,src:a?s:r,alt:t.id})}function Z(e){let{option:t,source:a,selected:o=!1,onSelectOption:c,isAnimatedImage:d,isVideo:u,hotspotLocation:m}=e,p=(0,r.p)(),{analyticsLocations:g}=(0,b.Ay)(T.A.VIDEO_BACKGROUND_IMAGE_OPTION),A=(0,i.bG)([B.A],()=>null!=m&&B.A.hasHotspot(m)),f=l.useCallback(e=>{if(!(0,M.u)(e))throw e},[]),_=u?(0,n.jsx)(D.A,{className:z.PQ,src:a,loop:!0,playOnHover:!0,muted:!0,onPlayError:f}):(0,n.jsx)(Q,{isAnimated:d,option:(0,x.d1)(t)?t:void 0,source:a});function O(){null!=m&&A&&(U.sF(m),P.default.track(V.HAw.PREMIUM_UPSELL_VIEWED,{type:W.e.ANIMATED_VIDEO_BACKGROUND_NEW_PRESET,location:p.location,location_stack:g}))}return(0,n.jsxs)(N.D,{className:j()(z.gf,{[z.JI]:o}),onClick:()=>c(t),onContextMenu:e=>(0,S.L3)(e,async()=>{let{default:e}=await s.e("22305").then(s.bind(s,5752));return s=>(0,n.jsx)(e,{...s,backgroundOption:t,optionIsInUse:o})}),children:[o?(0,n.jsx)("div",{className:z.SH}):null,(0,n.jsx)("div",{onFocus:O,onMouseEnter:O,className:z.kV,children:_}),u||d?(0,n.jsx)("div",{className:z.uZ,children:(0,n.jsx)(h.u,{size:"xxs",color:"currentColor"})}):null,A&&(0,n.jsx)(E.Lp,{text:K.intl.string(K.t.y2b7CA),className:z.$5})]})}function $(){return(0,n.jsxs)("div",{className:z.j1,children:[(0,n.jsx)(O.t,{size:"md",color:"currentColor",className:z.eo}),(0,n.jsx)(_.E,{variant:"text-sm/normal",children:K.intl.string(K.t["T+yRY3"])})]})}function Y(e){let{onClick:t,tooltipText:s,disabled:l=!1}=e,a=(0,i.bG)([B.A],()=>B.A.hasHotspot(H._.ANIMATED_VIDEO_BG_CUSTOM_TOOLTIP_NEW));function o(){U.sF(H._.ANIMATED_VIDEO_BG_CUSTOM_TOOLTIP_NEW)}let r=a?K.intl.string(K.t["5TUJOv"]):s;return(0,n.jsx)(f.m,{text:r,children:(0,n.jsxs)("div",{className:z.$g,children:[(0,n.jsxs)(J,{className:z.__invalid_backgroundOptionBlurred,disabled:l,icon:I.X,onClick:t,onMouseLeave:o,onBlur:o,text:(0,n.jsxs)("div",{className:z.Us,children:[(0,n.jsx)(O.t,{size:"md",color:"currentColor",className:z.PK}),(0,n.jsx)("div",{className:z.kr,children:K.intl.string(K.t["1t7U8W"])})]}),children:[(0,n.jsx)("div",{className:z.eD}),(0,n.jsx)("div",{className:z.G5})]}),a&&(0,n.jsx)(E.Lp,{text:K.intl.string(K.t.y2b7CA),className:z.$5})]})})}function q(e){let{onClick:t}=e,s=(0,r.p)(),{analyticsLocations:l}=(0,b.Ay)(T.A.VIDEO_BACKGROUND_CUSTOM_UPSELL);return(0,y.Ay)(()=>{P.default.track(V.HAw.PREMIUM_UPSELL_VIEWED,{type:W.e.VIDEO_BACKGROUNDS_INLINE,location:s.location,location_stack:l})}),(0,n.jsx)(Y,{onClick:t,tooltipText:K.intl.string(K.t["IqE0T/"])})}function X(e){let{onAddBackgroundImage:t,disabled:l}=e,i=(0,v.k)(),o=l?K.intl.formatToPlainString(K.t.ykGFeD,{maxCustomBackgrounds:25}):K.intl.string(K.t.Qx0tFc),r=[{name:K.intl.string(K.t["Sp2NF+"]),extensions:["jpg","jpeg","png","gif","mp4"]}];return(0,n.jsx)(Y,{disabled:l,onClick:function(){(0,a.openModalLazy)(async()=>{let{default:e}=await Promise.all([s.e("42754"),s.e("60060"),s.e("80797"),s.e("63232"),s.e("62680"),s.e("21825"),s.e("33902"),s.e("50015"),s.e("47017"),s.e("1555"),s.e("44695"),s.e("99999"),s.e("11527"),s.e("63070"),s.e("76170"),s.e("29666"),s.e("93513"),s.e("47011"),s.e("79149"),s.e("90017"),s.e("99150"),s.e("60987")]).then(s.bind(s,902550));return s=>(0,n.jsx)(e,{maxFileSizeBytes:R.G9,onComplete:e=>{let{imageUri:s,file:n,isFromTenor:l}=e;return t(s,n,l)},uploadType:F.HL.VIDEO_BACKGROUND,filters:r,modalTitle:K.intl.string(K.t.yG2pUi),imageSpecifications:K.intl.string(K.t["72OaxN"]),uploadOptionTitle:K.intl.string(K.t.xsW8u6),showUpsellHeader:!0,...s})},{contextKey:i})},tooltipText:o})}function ee(e){let{canUseCustomBackgrounds:t,customBackgroundOptions:s,selectedOption:i,onSelectOption:a,onUpsellClick:o,onAddBackgroundImage:r}=e,c=l.useMemo(()=>s.sort((e,t)=>null==e.last_used||null==t.last_used?w.default.compare(t.id,e.id):new Date(t.last_used).getTime()-new Date(e.last_used).getTime()),[s]),d=c.length>=25,{analyticsLocations:u}=(0,b.Ay)(T.A.VIDEO_BACKGROUND_OPTIONS),m=Object.values((0,G.A)()).sort((e,t)=>R.sl[e.id]-R.sl[t.id]);return(0,n.jsx)(b.f5,{value:u,children:(0,n.jsxs)("div",{className:z.to,children:[(0,n.jsx)(J,{selected:null==i,icon:C.K,onClick:()=>a(null),text:K.intl.string(K.t.fUdMeO)}),(0,n.jsx)(J,{selected:"blur"===i,icon:k.f,onClick:()=>a("blur"),text:K.intl.string(K.t.LhSyL8),children:(0,n.jsx)("div",{className:z.LJ})}),t?(0,n.jsx)(X,{onAddBackgroundImage:r,disabled:d}):(0,n.jsx)(q,{onClick:o}),c.map(e=>{let t=(0,L.Bo)({userId:e.user_id,assetId:e.id,assetHash:e.asset,size:720});return null==t?null:(0,n.jsx)(f.m,{__unsupportedReactNodeAsText:(0,n.jsx)($,{}),"aria-label":K.intl.string(K.t["T+yRY3"]),children:(0,n.jsx)(Z,{option:e,source:t,selected:(0,x.d1)(i)&&i.id===e.id,onSelectOption:a,isVideo:(0,L.q6)(e.asset),isAnimatedImage:(0,L.VI)(e.asset)},e.id)},e.id)}),m.map(e=>{let t=!0===e.isVideo;return(0,n.jsx)(f.m,{text:e.name,"aria-label":e.name,children:(0,n.jsx)(Z,{option:e.id,source:e.source,selected:i===e.id,onSelectOption:a,isVideo:t,isAnimatedImage:!1,hotspotLocation:e.hotspotLocation},e.id)},e.id)})]})})}var et=s(693591);function es(e){let{onLearnMore:t,selectedBackgroundOption:A,onSelectBackgroundOption:j,currentDeviceId:f,className:N}=e,_=(0,i.bG)([c.default],()=>c.default.getCurrentUser()),[h,E]=l.useState(null),O=(0,g.A)(),I=d.Ay.canUseCustomBackgrounds(_);l.useEffect(()=>{(0,u.HR)()},[]);let v=(0,i.cf)([m.A],()=>I?m.A.videoFilterAssets:{}),C=l.useMemo(()=>Object.values(v).filter(e=>e.type===R.yZ.BACKGROUND),[v]),k=(0,r.p)(),S={isVideoBackgroundSupported:O,onSelectBackgroundOption:j,selectedBackgroundOption:A},y=l.useRef(S);l.useEffect(()=>{y.current=S}),l.useEffect(()=>{let{isVideoBackgroundSupported:e,onSelectBackgroundOption:t,selectedBackgroundOption:s}=y.current;e?(0,p.S1)(s,f,{track:!1}).catch(()=>t(null)):null!=s&&t(null)},[f]);let T=e=>{j(e),(0,p.S1)(e,f,{location:k.location}).then(()=>E(null)).catch(()=>{E(K.intl.string(K.t.ejrSLe)),(0,p.S1)(null,f,{location:k.location})})};return O?(0,n.jsx)("div",{className:N,children:(0,n.jsx)(o.D,{label:K.intl.string(K.t.lZTUPs),errorMessage:h,children:(0,n.jsx)(ee,{canUseCustomBackgrounds:I,customBackgroundOptions:C,selectedOption:A,onSelectOption:T,onUpsellClick:()=>{(0,a.openModalLazy)(async()=>{let{default:e}=await Promise.all([s.e("80797"),s.e("2125"),s.e("62680"),s.e("21825"),s.e("98125"),s.e("76640"),s.e("14879"),s.e("46270"),s.e("86949"),s.e("1555"),s.e("38835"),s.e("99657"),s.e("62168"),s.e("66901"),s.e("40716")]).then(s.bind(s,629959));return s=>(0,n.jsx)(e,{...s,onLearnMore:t,analyticsSource:{...k.location,object:V.ZSU.BUTTON_CTA}})})},onAddBackgroundImage:function(e,t){let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return new Promise(async n=>{try{let n=await (0,u.F9)(e,R.yZ.BACKGROUND);T(n),(0,x.D1)(n,t.type===et.a.MP4,s),E(null)}catch(e){E(e.message)}n()})}})})}):null}}