1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[31450],{76702:function(e,t,i){i.d(t,{Z:function(){return o}});var l=i(57437),n=i(31691),a=i(78693),r=i(46387),s=i(33145);function o({label:e,showLock:t=!0}){let i=(0,n.Z)();return(0,l.jsxs)(a.Z,{sx:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"7px 8px",borderRadius:"999px",background:"linear-gradient(90deg, #007AFF 0%, #6F41E7 100%)",flexShrink:0},children:[t&&(0,l.jsx)(s.default,{src:"/ai-web/icon/i_lock.svg",alt:"",width:12,height:12,style:{filter:"brightness(0) invert(1)"}}),(0,l.jsx)(r.Z,{sx:{fontSize:"12px",fontWeight:600,lineHeight:1,whiteSpace:"nowrap",color:i.palette.Static.White},children:e})]})}},15532:function(e,t,i){i.d(t,{Fu:function(){return n},gh:function(){return a}});let l=["ìì´ì í¸ ëª¨ë","Agent Mode"],n=e=>l.includes(e.trim()),a=e=>e?.some(n)??!1},31450:function(e,t,i){i.r(t);var l=i(57437),n=i(2265),a=i(31691),r=i(52472),s=i(78693),o=i(46387),d=i(78357),c=i(67865),p=i(15366),x=i(99376),u=i(33145),h=i(30748),f=i(9260),g=i(75186),m=i(5911),b=i(1167),y=i(92501);let _=n.memo(function({onClose:e,onCloseAll:t,onSelect:i,disableBackgroundClose:_=!1}){let{user:j}=(0,c.SE)(),{t:k}=(0,p.bU)(),v=(0,a.Z)(),w=(0,x.useRouter)(),Z=null;try{Z=(0,b.IL)()}catch(e){}let S=Z?.setCurrentModel,C=Z?.setIsNotUpdateDefaultModelVersion,I=Z?.setIsNotUpdateDefaultOption,N=Z?.currentModel,E=Z?.selectedModelVersion,R=Z?.setSelectedModelVersion,A=Z?.setSelectedOption,[L,W]=(0,n.useState)(!1),[D,z]=(0,n.useState)(null),[M,F]=(0,n.useState)([]),[H,T]=(0,n.use
1State)(!1),[O,P]=(0,n.useState)(null),[B,$]=(0,n.useState)(null),[U,V]=(0,n.useState)([]),[Y,q]=(0,n.useState)(!0),[G,K]=(0,n.useState)(!1),[J,Q]=(0,n.useState)([]),X=[k("nav_models"),k("nav_mini_agent")],ee=[k("filter_image_generation"),k("filter_video_generation")],et=()=>{let e=localStorage.getItem("agentModelModalSelectedTab");if(null===e)return 0;let t=parseInt(e,10);return Number.isNaN(t)||t<0||t>=X.length?0:t},[ei,el]=(0,n.useState)(()=>et()),[en,ea]=(0,n.useState)(!1),[er,es]=(0,n.useState)("NOT_STARTED"),eo=()=>{let e=localStorage.getItem("agentModelModalSelectedSubTab");return null!==e?parseInt(e,10):0},[ed,ec]=(0,n.useState)(()=>eo()),ep=(0,n.useCallback)(e=>{ec(e),localStorage.setItem("agentModelModalSelectedSubTab",e.toString())},[]);(0,n.useCallback)(e=>{el(e),W(!1),localStorage.setItem("agentModelModalSelectedTab",e.toString())},[]);let ex=(0,n.useMemo)(()=>J.filter(e=>"image"===e.outputType&&144051!==e.filterId),[J]),eu=(0,n.useMemo)(()=>J.filter(e=>"video"===e.outputType&&144051!==e.filterId),[J]),[eh,ef]=(0,n.useState)(new Set),[eg,em]=(0,n.use
1State)(new Set),eb=(0,n.useRef)(null),ey=(0,n.useRef)(new Map);(0,n.useEffect)(()=>{(async()=>{try{q(!0);let e=await (0,d.myZ)(j?.token??""),t=await e.json();V(t),t.length>0&&P(t[0])}catch(e){console.error("ì¹´í
ê³ ë¦¬ ë¡ë© ì¤í¨:",e),g.ZP.error("ì¹´í
ê³ ë¦¬ë¥¼ ë¶ë¬ì¤ëë° ì¤í¨íìµëë¤.")}finally{q(!1)}})()},[j?.token]),(0,n.useEffect)(()=>{O&&(async()=>{try{K(!0);let e=await (0,d.qEz)(j?.token??"",O.id,0),t=await e.json();$(t)}catch(e){console.error("미ë ìì´ì í¸ ë¡ë© ì¤í¨:",e),g.ZP.error("미ë ìì´ì í¸ë¥¼ ë¶ë¬ì¤ëë° ì¤í¨íìµëë¤.")}finally{K(!1)}})()},[O,j?.token]),(0,n.useEffect)(()=>{1!==ei&&(async()=>{try{let e=await (0,f.AJ)(async()=>{let e=await (0,d.JtD)();return await e.json()});Q(e)}catch(e){if((0,f.Nn)())return;console.error("íí° ëª©ë¡ ë¡ë© ì¤í¨:",e),g.ZP.error("íí° ëª©ë¡ì ë¶ë¬ì¤ëë° ì¤í¨íìµëë¤.")}})()},[ei]),(0,n.useCallback)(e=>{C?.(!1),S?.(e),t()},[S,t,C]);let e_=(0,n.useCallback)(async e=>{z(e),W(!0),T(!0);try{let t=await (0,d.qwM)(e.filterId,void 0,j?.token??""),i=await t.json();F(i)}catch(e){console.error("ë²ì ëª©ë¡ ë¡ë© ì¤í¨:",e),F([])}finally{T(!1)}},[j?.token]),ej=(0,n.useCallback)((e,i)=>{let l=i.businessEmailVerification;if("NOT_STARTED"===l||"PENDING"===l){es(l),ea(!0);return}C?.(!0),I?.(!0),S?.(null),A?.(null),R?.(null),S?.(e),setTimeout(()=>R?.(i),0),t()},[C,I,S,A,R,t]);(0,n.useEffect)(()=>{if(B&&B.items.length>0){let e=new Set;for(let t=0;t<Math.min(2,B.items.length);t++)e.add(t);ef(e)}},[B]),(0,n.useEffect)(()=>{if(!eb.current||!B||0===B.items.length)return;let e=new IntersectionObserver(e=>{let t=new Set(eh),i=!1;if(e.forEach(e=>{let l=parseInt(e.target.getAttribute("data-index")||"0");e.isIntersecting&&!t.has(l)&&(t.add(l),i=!0)}),t.size>4){let i=Array.from(t),l=e.filter(e=>e.isIntersecting).map(e=>parseInt(e.target.getAttribute("data-index")||"0")),n=new Set([...l,...i.filter(e=>!l.includes(e))].slice(0,4));n.size===t.size&&Array.from(n).every(e=>t.has(e))||ef(n)}else i&&ef(t)},{root:eb.current,rootMargin:"10px",threshold:.1}),t=setTimeout(()=>{ey.current.forEach(t=>{e.observe(t)})},100);return()=>{clearTimeout(t),e.disconnect()}},[B?.items.length]);let ek=(0,n.useCallback)(e=>{em(t=>new Set([...Array.from(t),e]))},[]),ev=(0,n.useCallback)(e=>{em(t=>{let i=new Set(t);return i.delete(e),i})},[]),ew=(0,n.useCallback)((e,t)=>{e&&eh.has(t)&&setTimeout(()=>{e.play().catch(()=>{})},100)},[eh]),eZ=(0,n.useCallback)(async e=>{try{w.push(`/mini-agent/${(0,h.Te)(e.key)}?from=toolbar`),i?.(e),t()}catch(e){console.error("미ë ìì´ì í¸ ì í ì¤ ì¤ë¥ ë°ì:",e),g.ZP.error("미ë ìì´ì í¸ë¥¼ ì ííëë° ì¤í¨íìµëë¤.")}},[i,w,t]),eS=e=>O?.id===e.id;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(r.Z,{open:!0,onClose:_?void 0:t,disableAutoFocus:!0,disableEnforceFocus:!0,style:{zIndex:1400},children:(0,l.jsx)(s.Z,{className:"mini-agent-modal",sx:{width:"100%",display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column",position:"fixed",bottom:0,left:0,right:0,borderRadius:"20px 20px 0 0",isolation:"isolate",zIndex:1400},children:(0,l.jsxs)(s.Z,{sx:{width:"100%",height:"480px",display:"flex",flexDirection:"column",background:"light"===v.palette.mode?"rgba(255, 255, 255, 1)":"rgba(23, 23, 25, 1)",backdropFilter:"blur(80px)",isolation:"isolate",border:`1px solid ${v.palette.Border.Normal}`,borderRadius:"20px 20px 0 0",zIndex:9999,boxShadow:"0px -4px 20px rgba(0, 0, 0, 0.1)"},children:[(0,l.jsx)(s.Z,{sx:{width:"40px",height:"4px",backgroundColor:v.palette.Border.Normal,borderRadius:"2px",margin:"8px auto"}}),1===ei&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(s.Z,{className:"remove-scrollbar",sx:{display:"flex",flexDirection:"row",gap:"16px",padding:"0px 16px 12px 16px",overflowX:"auto",flexWrap:"nowrap",scrollbarWidth:"none",msOverflowStyle:"none","&::-webkit-scrollbar":{display:"none"}},children:Y?(0,l.jsx)(l.Fragment,{children:Array.from({length:3}).map((e,t)=>(0,l.jsx)(s.Z,{sx:{width:"60px",height:"16px",backgroundColor:v.palette.Container.Normal,borderRadius:"4px",animation:"pulse 1.5s ease-in-out infinite","@keyframes pulse":{"0%":{opacity:.6},"50%":{opacity:1},"100%":{opacity:.6}}}},t))}):U.map(e=>(0,l.jsx)(s.Z,{sx:{padding:"6px 0px",cursor:"pointer",borderBottom:eS(e)?`2px s
1olid ${v.palette.Label.Normal}`:"none",flex:"0 0 auto"},onClick:()=>P(e),children:(0,l.jsx)(o.Z,{variant:"b3",sx:{fontSize:"13px"},color:eS(e)?v.palette.Label.Normal:v.palette.Label.Alternative,children:e.name})},e.id))}),(0,l.jsx)(s.Z,{ref:eb,className:"remove-scrollbar",sx:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:"14px",overflowY:"auto",maxHeight:"calc(480px - 174px)",padding:"10px 16px"},children:G?(0,l.jsx)(l.Fragment,{children:Array.from({length:4}).map((e,t)=>(0,l.jsxs)(s.Z,{sx:{display:"flex",flexDirection:"column",gap:"8px"},children:[(0,l.jsx)(s.Z,{sx:{width:"100%",aspectRatio:"1/1",backgroundColor:v.palette.Container.Normal,borderRadius:"16px",animation:"pulse 1.5s ease-in-out infinite","@keyframes pulse":{"0%":{opacity:.6},"50%":{opacity:1},"100%":{opacity:.6}}}}),(0,l.jsx)(s.Z,{sx:{width:"80%",height:"14px",backgroundColor:v.palette.Container.Normal,borderRadius:"4px",animation:"pulse 1.5s ease-in-out infinite"}})]},t))}):B&&B.items.length>0?B.items.map((e,t)=>{let i=eh.has(t);return(0,l.jsxs)(s.Z,{ref:e=>{e?ey.current.set(t,e):ey.current.delete(t)}
1,"data-index":t,sx:{display:"flex",flexDirection:"column",alignItems:"center",cursor:"pointer",borderRadius:"20px",opacity:1,position:"relative"},onClick:()=>void eZ(e),children:[e.sampleOutputUrl&&i?(0,l.jsx)("video",{ref:e=>ew(e,t),style:{width:"100%",aspectRatio:"1/1",objectFit:"cover",borderRadius:"16px",maxWidth:"100%",border:`1px solid ${v.palette.Border.Normal}`},autoPlay:!0,loop:!0,muted:!0,playsInline:!0,preload:"metadata",poster:e.thumbnailImageUrl??"",onLoadStart:()=>ek(t),onLoadedData:()=>ev(t),onCanPlay:e=>{e.currentTarget.play().catch(()=>{})},children:(0,l.jsx)("source",{src:e.sampleOutputUrl??"",type:"video/mp4"})}):(0,l.jsx)(s.Z,{sx:{width:"100%",aspectRatio:"1/1",backgroundImage:`url(${e.thumbnailImageUrl??""})`,backgroundSize:"cover",backgroundPosition:"center",borderRadius:"16px",border:`1px solid ${v.palette.Border.Normal}`}}),(0,l.jsx)(s.Z,{sx:{display:"flex",width:"100%",maxWidth:"100%",gap:"4px",padding:"8px 4px",boxSizing:"border-box"},children:(0,l.jsx)(o.Z,{variant:"t4",color:v.palette.Label.Normal,sx:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",fontSize:"13px"},children:e.title})})]},e.id)}):(0,l.jsx)(s.Z,{sx:{gridColumn:"1 / -1",display:"flex",alignItems:"center",justifyContent:"center",padding:"40px 20px"},children:(0,l.jsx)(o.Z,{variant:"b3",color:v.palette.Label.Assistive,children:k("no_mini_agents")})})})]}),0===ei&&(0,l.jsx)(l.Fragment,{children:L&&D?(0,l.jsxs)(s.Z,{sx:{display:"flex",flexDirection:"column",width:"100%",overflowY:"auto",maxHeight:"calc(480px - 60px)"},children:[(0,l.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",padding:"14px 20px",position:"relative"},children:[(0,l.jsx)(s.Z,{sx:{cursor:"pointer",display:"flex",alignItems:"center",position:"absolute",left:"20px"},onClick:()=>W(!1),children:(0,l.jsx)(u.default,{src:"/ai-web/icon/i_chevron_left_b.svg",alt:"",width:24,height:24,style:{filter:"dark"===v.palette.mode?"invert(1)":"none"}})}),(0,l.jsx)(o.Z,{variant:"t3",color:v.palette.Label.Normal,sx:{width:"100%",textAlign:"center",fontWeight:600},children:D.title})]}),(0,l.jsx)(s.Z,{className:"remove-scrollbar",sx:{display:"flex",flexDirection:"column",overflowY:"auto",width:"100%"},children:H?(0,l.jsx)(s.Z,{sx:{display:"flex",flexDirection:"column",padding:"0 20px"},children:Array.from({length:3}).map((e,t)=>(0,l.jsxs)(s.Z,{sx:{display:"flex",flexDirection:"column",gap:"6px",padding:"16px 0",borderBottom:t<2?`1px solid ${v.palette.Border.Normal}`:"none"},children:[(0,l.jsx)(s.Z,{sx:{width:"120px",height:"16px",backgroundColor:v.palette.Container.Normal,borderRadius:"4px",animation:"pulse 1.5s ease-in-out infinite","@keyframes pulse":{"0%":{opacity:.6},"50%":{opacity:1},"100%":{opacity:.6}}}}),(0,l.jsx)(s.Z,{sx:{width:"160px",height:"13px",backgroundColor:v.palette.Container.Normal,borderRadius:"4px",animation:"pulse 1.5s ease-in-out infinite"}}),(0,l.jsx)(s.Z,{sx:{width:"80px",height:"12px",backgroundColor:v.palette.Container.Normal,borderRadius:"4px",animation:"pulse 1.5s ease-in-out infinite"}})]},t))}):M.map((e,t)=>{let i={...e.modelVersion,businessEmailVerification:e.businessEmailVerification??null},n=N?.filterId===D.filterId&&E?.title===i.title;return(0,l.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",cursor:"pointer",borderBottom:t<M.length-1?`1px solid ${v.palette.Border.Normal}`:"none"},onClick:()=>ej(D,i),children:[(0,l.jsxs)(s.Z,{sx:{display:"flex",flexDirection:"column",gap:"2px",flex:1,minWidth:0},children:[(0,l.jsx)(o.Z,{variant:"t3_alt",color:v.palette.Label.Normal,sx:{fontWeight:600},children:i.title}),i.subtitle&&(0,l.jsx)(o.Z,{variant:"b3",color:v.palette.Label.Alternative,children:i.subtitle}),i.creditsLabel&&(0,l.jsx)(o.Z,{variant:"c2_alt1",color:v.palette.Label.Alternative,children:i.creditsLabel})]}),"PENDING"===i.businessEmailVerification?(0,l.jsxs)(s.Z,{sx:{display:"flex",alignItems:"center",gap:"2px",flexShrink:0},children:[(0,l.jsx)(u.default,{src:"/ai-web/icon/i_clock_purple.svg",alt:"",width:16,height:16}),(0,l.jsx)(o.Z,{variant:"b4",sx:{color:v.palette.ETC.Purple},children:k("business_email_pending_label")})]}):n&&(0,l.jsx)(u.default,{src:"/ai-web/icon/i_check_b.svg",alt:"",width:20,height:20,style:{flexShrink:0,filter:"dark"===v.palette.mode?"invert(1)":"none"}})]},`${i.type??""}-${t}`)})})]}):(0,l.jsxs)(s.Z,{sx:{padding:"4px 0px 10px",display:"flex",flexDirection:"column",gap:"10px",width:"100%",overflowY:"auto",maxHeight:"calc(480px - 60px)"},children:[(0,l.jsx)(s.Z,{sx:{padding:"0px 14px"},children:(0,l.jsx)(s.Z,{sx:{backgroundColor:v.palette.Container.Alternative,borderRadius:"999px",padding:"4px",width:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:ee.map((e,t)=>(0,l.jsx)(s.Z,{sx:{backgroundColor:ed===t?v.palette.Static.White:"transparent",borderRadius:"999px",padding:"8px",flex:1,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer"},onClick:()=>ep(t),children:(0,l.jsx)(o.Z,{variant:"t5",color:ed===t?"dark"===v.palette.mode?v.palette.Static.Black:v.palette.Label.Normal:v.palette.Label.Alternative,children:e})},e))})}
1),(0,l.jsx)(s.Z,{className:"remove-scrollbar",sx:{display:"flex",flexDirection:"column",gap:"0px",overflowY:"auto",width:"100%"},children:0===ed?(0,l.jsx)(s.Z,{children:ex.map(e=>(0,l.jsx)(m.Z,{model:e,hideAgentModeBadge:!0,handleSelectModel:()=>void e_(e),isSelected:N?.filterId===e.filterId},e.filterId))}):(0,l.jsx)(s.Z,{children:eu.map(e=>(0,l.jsx)(m.Z,{model:e,hideAgentModeBadge:!0,handleSelectModel:()=>void e_(e),isSelected:N?.filterId===e.filterId},e.filterId))})})]})})]})})}),(0,l.jsx)(y.Z,{isOpen:en,initialStatus:er,onClose:()=>ea(!1),onVerified:()=>{D&&e_(D),Z?.refetchFilterCapabilities()}})]})});t.default=_},5911:function(e,t,i){i.d(t,{Z:function(){return p}});var l=i(57437),n=i(78693),a=i(46387),r=i(33145),s=i(31691),o=i(15366),d=i(15532),c=i(76702);function p({model:e,handleSelectModel:t,isSelected:i,hideChevron:p,onMouseEnter:x,onMouseLeave:u,lockedAgentMode:h=!1,hideAgentModeBadge:f=!1,leading:g,variant:m="default"}){let b=(0,s.Z)(),{t:y}=(0,o.bU)(),_="symbol"===m,j="dark"===b.palette.mode;return(0,l.jsxs)(n.Z,{"data-home-model-row":!0,role:"button",tabIndex:0,onKeyDown:e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),t())},sx:{width:"100%",display:"flex",alignItems:"center",cursor:"pointer",..._?{gap:"14px",padding:"11px 14px",borderRadius:"14px",...i&&{backgroundColor:j?"rgba(26, 136, 255, 0.16)":"rgba(0, 122, 255, 0.09)"},"&:hover":{backgroundColor:i?j?"rgba(26, 136, 255, 0.22)":"rgba(0, 122, 255, 0.13)":j?"rgba(255, 255, 255, 0.06)":"rgba(0, 0, 0, 0.04)"},'&:hover [data-gen-symbol-tone="asset"] img, &:hover [data-gen-symbol-tone="brand"] img':{filter:"none"}}:{gap:"10px",padding:"16px 12px",borderBottom:`1px solid ${b.palette.Border.Normal}`,"&:hover":{backgroundColor:b.palette.Container.Normal}}},onClick:t,onMouseEnter:x,onMouseLeave:u,children:[g??(0,l.jsx)(n.Z,{sx:{width:36,height:36,borderRadius:"999px",overflow:"hidden",position:"relative",flexShrink:0,border:`1px solid ${b.palette.Border.Strong}`},children:(0,l.jsx)(r.default,{src:e.thumbnailUrl??"",alt:e.title??"",fill:!0,style:{objectFit:"cover"}})}),(0,l.jsxs)(n.Z,{sx:{display:"flex",flexDirection:"column",gap:"2px",flex:1,minWidth:0,opacity:h?.5:1},children:[(0,l.jsx)(a.Z,{"data-home-model-title":!0,variant:"t5",color:b.palette.Label.Normal,sx:_&&i?{fontWeight:700}:void 0,children:e.title}),e.subtitle&&(0,l.jsx)(a.Z,{"data-home-model-description":!0,variant:"c2_alt1",sx:{color:b.palette.Label.Neutral}
1,children:e.subtitle}),e.creditsLabel&&(0,l.jsx)(a.Z,{"data-home-model-description":!0,variant:"c3_alt",sx:{color:b.palette.Label.Alternative},children:e.creditsLabel})]}),(0,l.jsxs)(n.Z,{sx:{display:"flex",alignItems:"center",gap:"4px",flexShrink:0},children:[e.isNew&&(0,l.jsx)(n.Z,{"data-carat-new-badge":!0,sx:{backgroundColor:b.palette.Primary.Alternative,borderRadius:"6px",padding:"3px 4px",display:"flex",alignItems:"center"},children:(0,l.jsx)(a.Z,{variant:"c2_alt1",sx:{color:b.palette.Static.White,lineHeight:1,fontWeight:700},children:y("badge_new")})}),e.badges&&e.badges.length>0&&e.badges.filter(e=>!(f&&(0,d.Fu)(e))).map((e,t)=>(0,d.Fu)(e)?(0,l.jsx)(c.Z,{label:e,showLock:h},t):(0,l.jsx)(n.Z,{sx:{backgroundColor:b.palette.Primary.Normal,borderRadius:"6px",padding:"3px 4px",display:"flex",alignItems:"center",gap:"2px"},children:(0,l.jsx)(a.Z,{variant:"c2_alt1",sx:{fontWeight:700,color:b.palette.Static.White,lineHeight:1},children:e})},t)),i&&(_?(0,l.jsx)(r.default,{src:"/ai-web/icon/i_check_blue.svg",alt:"",width:20,height:20,style:{flexShrink:0}}):(0,l.jsx)(r.default,{src:"/ai-web/icon/i_check_b.svg",alt:"",width:20,height:20,style:{flexShrink:0,filter:"dark"===b.palette.mode?"invert(1)":"none"}})),!p&&(0,l.jsx)(r.default,{src:"/ai-web/icon/i_chevron_rightb.svg",alt:"",width:16,height:16,style:{flexShrink:0,filter:"dark"===b.palette.mode?"invert(1)":"none"}})]})]})}i(2265)},92501:function(e,t,i){i.d(t,{Z:function(){return _}});var l=i(57437),n=i(2265),a=i(4810),r=i.n(a),s=i(33145),o=i(78693),d=i(46387),c=i(75186),p=i(22965),x=i(15366),u=i(67865),h=i(78357),f=i(59491),g=i(75029),m=i(70542);let b={overlay:{backgroundColor:"rgba(0, 0, 0, 0.4)",backdropFilter:"blur(40px)",WebkitBackdropFilter:"blur(40px)",zIndex:1500,width:"100%",height:"calc(100vh + env(safe-area-inset-bottom) + 50px)",minHeight:"calc(100vh + env(safe-area-inset-bottom) + 50px)",position:"fixed",top:"0",left:"0",right:"0",bottom:"calc(-1 * env(safe-area-inset-bottom))"},content:{width:"100%",top:"0",left:"0",right:"0",bottom:"0",border:"none",background:"transparent",padding:"0",overflow:"hidden",display:"flex",justifyContent:"center",alignItems:"center",height:"100vh",minHeight:"100vh"}},y=e=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e.trim());function _({isOpen:e,initialStatus:t,onClose:i,onVerified:a}){let s=m.$_,{t:d}=(0,x.bU)(),{user:_}=(0,u.SE)(),{isMobile:k}=(0,f.ZP)(),w=(0,n.useRef)(null),[Z,S]=(0,n.useState)("PENDING"===t?"sent":"input"),[C,I]=(0,n.useState)(""),[N,E]=(0,n.useState)(!0),[R,A]=(0,n.use
1State)(null),[L,W]=(0,n.useState)(!1),[D,z]=(0,n.useState)(null);(0,n.useEffect)(()=>{e&&S("PENDING"===t?"sent":"input")},[e,t]),(0,n.useEffect)(()=>{e&&("input"===Z?p.default.track("seedance_bizemail_view"):"sent"===Z&&p.default.track("seedance_bizemail_sent"))},[e,Z]);let M=(0,n.useRef)(i),F=(0,n.useRef)(a);(0,n.useEffect)(()=>{M.current=i},[i]),(0,n.useEffect)(()=>{F.current=a},[a]),(0,n.useEffect)(()=>{if(!e||"sent"!==Z||!_?.token)return;let t=!1,i=async()=>{try{let e=await (0,h.vhx)(_.token),i=await e.json();if(t)return;i.businessEmail&&z(i.businessEmail),"VERIFIED"===i.status&&(F.current?.(),M.current())}catch{}};i();let l=setInterval(i,5e3);return()=>{t=!0,clearInterval(l)}},[e,Z,_?.token]),(0,n.useEffect)(()=>{e||(I(""),E(!0),A(null),W(!1),z(null))},[e]);let H=(0,n.useCallback)(e=>{I(e.target.value),R&&A(null)},[R]),T=(0,n.useCallback)(e=>{switch(e){case"INVALID_EMAIL_FORMAT":return{inline:d("business_email_invalid_format")};case"FREE_EMAIL_DOMAIN":return{inline:d("business_email_free_domain")};case"EMAIL_ALREADY_IN_USE":return{inline:d("business_email_already_in_use")};case"TOO_MANY_REQUESTS":return{toast:d("business_email_too_many_requests")};case"ALREADY_VERIFIED":return{inline:d("business_email_already_verified"),verified:!0};default:return{inline:d("business_email_send_failed")}}},[d]),O=(0,n.useCallback)(async(e,t=!1)=>{if(_?.token){W(!0);try{let l=await (0,h._bB)(_.token,e);if(!l.ok){let e;try{e=(await l.json()).error}catch{}p.default.track("seedance_bizemail_bnt",{error_type:e??"UNKNOWN"});let t=T(e);t.inline?A(t.inline):t.toast&&c.ZP.error(t.toast),t.verified&&(a?.(),i());return}p.default.track("seedance_bizemail_bnt"),z(e),S("sent"),A(null),t&&c.ZP.success(d("toast_consent_resent"))}catch(e){p.default.track("seedance_bizemail_bnt",{error_type:"NETWORK_ERROR"}),c.ZP.error(d("business_email_send_failed"))}finally{W(!1)}}},[_?.token,T,a,i,d]),P=(0,n.useCallback)(()=>{if(!L){if(!N){p.default.track("seedance_bizemail_bnt",{error_type:"CONSENT_REQUIRED"}),c.ZP.dismiss(),c.ZP.error(d("business_email_consent_required"));return}if(!y(C)){p.default.track("seedance_bizemail_bnt",{error_type:"INVALID_EMAIL_FORMAT"}),A(d("business_email_invalid_format"));return}O(C.trim())}},[N,C,L,O,d]),B=(0,n.useCallback)(()=>{!L&&D&&O(D,!0)},[L,D,O]),$=(0,n.useCallback)(()=>{S("input"),z(null),I(""),A(null)},[]),U="dark"===s.palette.mode;return(0,l.jsx)(r(),{isOpen:e,onRequestClose:i,style:b,shouldCloseOnOverlayClick:!0,children:(0,l.jsx)(g.default,{mode:"dark",children:(0,l.jsx)(o.Z,{ref:w,sx:{width:{xs:"90%",sm:"580px"},maxWidth:"580px",minHeight:k?"auto":"723px",backgroundColor:s.palette.Background.Normal,borderRadius:"24px",overflow:"hidden",display:"flex",flexDirection:"column",position:"relative"},children:"input"===Z?(0,l.jsx)(j,{theme:s,t:d,isDark:U,email:C,errorMessage:R,agreed:N,isLoading:L,onChangeEmail:H,onToggleAgreed:()=>E(e=>!e),onContinue:P,onClose:i}):(0,l.jsx)(v,{theme:s,t:d,isDark:U,sentEmail:D,isLoading:L,onResend:B,onChangeEmail:$,onClose:i})})})})}function j({theme:e,t,isDark:i,email:n,errorMessage:a,agreed:r,isLoading:c,onChangeEmail:p,onToggleAgreed:x,onContinue:u,onClose:h}){let f=!!a;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(o.Z,{sx:{position:"relative",width:"100%",aspectRatio:"580 / 340",flexShrink:0,backgroundColor:"#000",overflow:"hidden"},children:[(0,l.jsx)("video",{src:"https://assets.carat-api.im/home/verify_seedance2_0.mp4",autoPlay:!0,loop:!0,muted:!0,playsInline:!0,poster:"https://assets.carat-api.im/home/verify_seedance2_0_thumbnail.jpg",style:{width:"100%",height:"100%",objectFit:"cover"}}),(0,l.jsxs)(o.Z,{sx:{position:"absolute",top:"14px",left:"50%",transform:"translateX(-50%)",display:"flex",alignItems:"center",gap:"8px",padding:"6px 12px 6px 8px",borderRadius:"999px",backgroundColor:"#00000066",backdropFilter:"blur(20px)",WebkitBackdropFilter:"blur(20px)"},children:[(0,l.jsx)(o.Z,{sx:{width:"20px",height:"20px",borderRadius:"50%",overflow:"hidden",flexShrink:0},children:(0,l.jsx)("img",{src:"https://assets.carat-api.im/gen-ai/Bytedance.jpg",alt:"",width:20,height:20,style:{width:"100%",height:"100%",objectFit:"cover"}})}),(0,l.jsx)(d.Z,{sx:{fontSize:"16px",fontWeight:500,lineHeight:"24px",color:e.palette.Static.White,whiteSpace:"nowrap"},children:t("business_email_modal_top_title")})]}),(0,l.jsx)(o.Z,{onClick:h,sx:{position:"absolute",top:"14px",right:"14px",width:"24px",height:"24px",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,l.jsx)(s.default,{src:"/ai-web/icon/i_close_w.svg",alt:"close",width:20,height:20})})]}),(0,l.jsxs)(o.Z,{sx:{padding:"0 32px 32px 32px",display:"flex",flexDirection:"column",gap:"30px",flex:1,minHeight:0},children:[(0,l.jsxs)(o.Z,{sx:{display:"flex",flexDirection:"column",gap:"6px",marginTop:"30px"},children:[(0,l.jsx)(d.Z,{sx:{fontSize:"32px",fontWeight:700,lineHeight:"45px",color:e.palette.Label.Normal,whiteSpace:"pre-line",textAlign:"center"},children:t("business_email_modal_title")}),(0,l.jsx)(d.Z,{sx:{fontSize:"14px",fontWeight:400,lineHeight:"20px",color:e.palette.Primary.Normal,whiteSpace:"pre-line",textAlign:"center"},children:t("business_email_modal_description")})]}),(0,l.jsxs)(o.Z,{sx:{display:"flex",flexDirection:"column",gap:"8px"},children:[(0,l.jsx)(d.Z,{sx:{fontSize:"14px",fontWeight:500,color:e.palette.Label.Normal},children:t("business_email_input_label")}),(0,l.jsx)(o.Z,{sx:{display:"flex",alignItems:"center",gap:"10px",padding:"14px",borderRadius:"14px",backgroundColor:e.palette.Container.Normal,border:`1px solid ${f?e.palette.Status.Negative:"transparent"}`,transition:"border-color 0.15s"},children:(0,l.jsx)("input",{type:"email",value:n,placeholder:t("business_email_placeholder"),onChange:p,style:{flex:1,background:"transparent",border:"none",outline:"none",fontSize:"16px",fontWeight:400,lineHeight:"24px",color:e.palette.Label.Normal,fontFamily:"inherit"}})}),f?(0,l.jsx)(d.Z,{sx:{fontSize:"12px",fontWeight:400,lineHeight:"16px",color:e.palette.Status.Negative},children:a}):(0,l.jsx)(d.Z,{sx:{fontSize:"12px",fontWeight:400,lineHeight:"16px",color:e.palette.Label.Alternative},children:t("business_email_input_helper")})]}),(0,l.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"12px",marginTop:"auto"},children:[(0,l.jsx)(o.Z,{sx:{display:"flex",flexDirection:"column",gap:"8px",flex:1,minWidth:0},children:(0,l.jsx)(k,{theme:e,isDark:i,checked:r,onToggle:x,label:t("business_email_consent"),href:"https://carat.notion.site/33a9512d47028187986aec2b1d56c757?source=copy_link"})}),(()=>{let i=!!n&&!c&&r;return(0,l.jsx)(o.Z,{onClick:()=>{i&&u()},sx:{flexShrink:0,padding:"14px 20px",borderRadius:"999px",backgroundColor:i?e.palette.Primary.Normal:e.palette.Primary.Alternative,color:e.palette.Static.White,cursor:i?"pointer":"not-allowed",opacity:i?1:.5,transition:"background-color 0.15s, opacity 0.15s"},children:(0,l.jsx)(d.Z,{sx:{fontSize:"17px",fontWeight:600,lineHeight:"20px",color:e.palette.Static.White,whiteSpace:"nowrap"},children:t("business_email_continue")})})})()]})]})]})}function k({theme:e,isDark:t,checked:i,onToggle:n,label:a,href:r}){return(0,l.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:"6px",minWidth:0},children:[(0,l.jsx)(o.Z,{onClick:n,sx:{width:"20px",height:"20px",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0,cursor:"pointer"},children:(0,l.jsx)(s.default,{src:"/ai-web/icon/i_check_b.svg",alt:"",width:20,height:20,style:{filter:i?"brightness(0) saturate(100%) invert(36%) sepia(99%) saturate(2476%) hue-rotate(202deg) brightness(101%) contrast(101%)":t?"invert(60%)":"opacity(0.35)"}})}),(0,l.jsxs)(o.Z,{component:"a",href:r,target:"_blank",rel:"noopener noreferrer",sx:{dis
1play:"flex",alignItems:"center",gap:"10px",minWidth:0,textDecoration:"none",cursor:"pointer"},children:[(0,l.jsx)(d.Z,{sx:{fontSize:"14px",fontWeight:500,lineHeight:"17px",color:i?e.palette.Label.Normal:e.palette.Label.Alternative,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:a}),(0,l.jsx)(s.default,{src:"/ai-web/icon/i_chevron_rightb.svg",alt:"",width:16,height:16,style:{flexShrink:0,filter:t?"invert(1)":"opacity(0.3)"}})]})]})}function v({theme:e,t,isDark:i,sentEmail:n,isLoading:a,onResend:r,onChangeEmail:c,onClose:p}){return(0,l.jsxs)(o.Z,{sx:{flex:1,minHeight:0,display:"flex",flexDirection:"column",position:"relative"},children:[(0,l.jsxs)(o.Z,{sx:{flexShrink:0,padding:"32px 32px 0 32px",display:"flex",alignItems:"center",justifyContent:"center",position:"relative",minHeight:"24px"},children:[(0,l.jsx)(d.Z,{sx:{fontSize:"16px",fontWeight:500,lineHeight:"24px",color:e.palette.Label.Normal},children:t("business_email_modal_top_title")}),(0,l.jsx)(o.Z,{onClick:p,sx:{position:"absolute",right:"32px",top:"32px",cursor:"pointer",width:"24px",height:"24px",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,l.jsx)(s.default,{src:"/ai-web/icon/i_close_s.svg",alt:"close",width:20,height:20,style:{filter:i?"invert(1)":"none"}})})]}),(0,l.jsxs)(o.Z,{sx:{flex:1,minHeight:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"24px",padding:"0 32px"},children:[(0,l.jsx)(o.Z,{sx:{width:"80px",height:"80px",borderRadius:"50%",backgroundColor:"rgba(111, 65, 231, 0.10)",display:"flex",alignItems:"center",justifyContent:"center"},children:(0,l.jsx)(s.default,{src:"/ai-web/icon/i_clock_purple.svg",alt:"",width:36,height:36})}),(0,l.jsxs)(o.Z,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:"8px"},children:[(0,l.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:"6px"},children:[(0,l.jsx)(s.default,{src:"/ai-web/icon/i_check_b.svg",alt:"",width:20,height:20,style:{filter:i?"invert(1)":"none"}}),(0,l.jsx)(d.Z,{sx:{fontSize:"14px",fontWeight:400,lineHeight:"20px",color:e.palette.Label.Normal},children:t("business_email_sent_caption")})]}),(0,l.jsx)(d.Z,{sx:{fontSize:"24px",fontWeight:700,lineHeight:"34px",color:e.palette.Label.Normal,whiteSpace:"pre-line",textAlign:"center"},children:t("business_email_sent_title")}),(0,l.jsx)(d.Z,{sx:{fontSize:"14px",fontWeight:400,lineHeight:"20px",color:e.palette.Label.Alternative,textAlign:"center"},children:t("business_email_sent_description")})]}),(0,l.jsxs)(o.Z,{sx:{width:"342px",maxWidth:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:"8px",padding:"20px",borderRadius:"14px",backgroundColor:e.palette.Container.Normal},children:[(0,l.jsx)(d.Z,{sx:{fontSize:"13px",fontWeight:400,lineHeight:"19px",color:e.palette.Label.Alternative,flexShrink:0},children:t("business_email_sent_label")}),(0,l.jsxs)(o.Z,{sx:{display:"flex",alignItems:"center",gap:"6px",minWidth:0},children:[(0,l.jsx)(d.Z,{sx:{fontSize:"14px",fontWeight:500,lineHeight:"17px",color:e.palette.Label.Normal,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:n||""}),(0,l.jsx)(o.Z,{sx:{flexShrink:0,padding:"5px 8px",borderRadius:"999px",backgroundColor:"rgba(111, 65, 231, 0.10)"},children:(0,l.jsx)(d.Z,{sx:{fontSize:"12px",fontWeight:600,lineHeight:"14px",color:"#6F41E7"},children:t("business_email_pending_badge")})})]})]})]}),(0,l.jsxs)(o.Z,{sx:{flexShrink:0,padding:"0 32px 32px 32px",display:"flex",flexDirection:"column",alignItems:"center",gap:"12px"},children:[(0,l.jsx)(o.Z,{onClick:r,sx:{padding:"14px 24px",borderRadius:"999px",border:`1px solid ${e.palette.Border.Strong}`,backgroundColor:"transparent",display:"flex",alignItems:"center",justifyContent:"center",cursor:a?"not-allowed":"pointer",opacity:a?.5:1,transition:"opacity 0.15s"},children:(0,l.jsx)(d.Z,{sx:{fontSize:"17px",fontWeight:600,lineHeight:"20px",color:e.palette.Label.Normal},children:t("business_email_resend")})}),(0,l.jsx)(d.Z,{onClick:c,sx:{fontSize:"14px",fontWeight:400,lineHeight:"17px",color:e.palette.Label.Alternative,cursor:"pointer","&:hover":{color:e.palette.Label.Normal}},children:t("business_email_change")})]})]})}}}]);
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.