1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5726],{60768:function(){},95032:function(e,t,r){"use strict";r.d(t,{CO:function(){return s},Ev:function(){return o},H$:function(){return l},Tb:function(){return a},ri:function(){return n}});var i=r(77804);r(88661);let l=()=>(0,i.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",children:[(0,i.jsx)("path",{d:"M41.157 14.3582V44.1098C41.157 44.8457 40.5617 45.441 39.8258 45.441H9.00078C8.43828 45.441 7.98828 44.9863 7.98828 44.4285V4.20039C7.98828 3.78789 8.32109 3.45508 8.73359 3.45508H29.5039C29.5461 3.45508 29.5695 3.50664 29.5414 3.53945C29.5227 3.5582 29.5227 3.59102 29.5461 3.60977L41.1477 14.3254C41.1477 14.3348 41.157 14.3488 41.157 14.3582Z",fill:"var(--hl_text_06)"}),(0,i.jsx)("path",{d:"M29.5082 13.641V3.45508L41.1566 14.3395H30.2066C29.8223 14.3395 29.5082 14.0254 29.5082 13.641ZM19.0363 17.1098H8.8082C6.0707 17.1098 3.85352 14.8926 3.85352 12.1551C3.85352 9.41758 6.0707 7.20039 8.8082 7.20039H19.0363C21.7738 7.20039 23.991 9.41758 23.991 12.1551C23.9957 14.8926 21.7738 17.1098 19.0363 17.1098Z",fill:"#E52020"}),(0,i.jsx)("path",{d:"M21.507 36.2295C20.532 36.2295 19.7492 35.9389 19.1773 35.367C18.282 34.4717 18.2773 33.206 18.2773 33.0842C18.2914 32.0342 18.6148 31.2185 19.2477 30.6514C20.1523 29.8404 21.3617 29.8779 21.5961 29.892H26.0961C27.118 29.892 27.9055 29.6014 28.4352 29.0295C28.9273 28.4951 29.1289 27.792 29.2133 27.2951C29.3023 26.7514 29.2742 26.3342 29.2742 26.3295V26.2732C29.2742 25.2748 28.9648 24.5248 28.3273 23.9857C27.4367 23.2264 26.0586 23.0154 25.0555 22.9685C24.4648 22.9404 23.9398 22.9685 23.5695 23.0014V28.2842H22.2664V21.867L22.8148 21.7779C22.9836 21.7498 26.9727 21.1217 29.1711 22.992C30.0992 23.7795 30.5727 24.8764 30.5773 26.2498C30.5961 26.531 30.6711 28.5279 29.4008 29.9107C28.618 30.7639 27.507 31.1951 26.1055 31.1951H21.5445L21.5211 31.1904C21.4742 31.1857 20.6586 31.1389 20.1195 31.6264C19.7773 31.9404 19.5992 32.4326 19.5898 33.0982V33.1029C19.5898 33.1498 19.5992 33.942 20.1148 34.4482C20.4477 34.7764 20.9492 34.9357 21.6008 34.9217H22.0695L22.0461 32.967L23.3492 32.9529L23.3914 36.2248H21.6195C21.5773 36.2295 21.5398 36.2295 21.507 36.2295Z",fill:"#E82B29"}),(0,i.jsx)("path",{d:"M11.0582 10.4199C10.8051 10.1996 10.4488 10.0918 9.99883 10.0918H8.77539V14.2168H9.47383V12.7449H9.89102C10.327 12.759 10.702 12.6371 10.9926 12.384C11.2879 12.1262 11.4426 11.7887 11.4426 11.3762C11.4473 10.9637 11.316 10.6449 11.0582 10.4199ZM9.47852 10.7246H9.90977C10.4676 10.7246 10.7254 10.9355 10.7254 11.3902C10.7254 11.6246 10.6551 11.798 10.5145 11.9199C10.3691 12.0418 10.1488 12.1074 9.86289 12.1074H9.4832V10.7246H9.47852ZM15.202 10.6355C14.7848 10.2746 14.2598 10.0918 13.6363 10.0918H12.4082V14.2168H13.5941C14.2457 14.2168 14.7848 14.0246 15.202 13.6402C15.6191 13.2559 15.8301 12.7402 15.8301 12.1074C15.8348 11.4934 15.6238 11.0012 15.202 10.6355ZM13.1113 10.7293H13.6176C14.0676 10.7293 14.4332 10.8465 14.7051 11.0762C14.9723 11.3059 15.1082 11.6527 15.1082 12.1121C15.1082 12.5762 14.977 12.9371 14.7145 13.1902C14.452 13.4434 14.077 13.5746 13.5988 13.5746H13.116V10.7293H13.1113ZM19.0691 10.7293V10.0918H16.8379V14.2121H17.5363V12.4965H18.9566V11.859H17.5363V10.7293H19.0691Z",fill:"white"})]}),n=e=>{let{className:t}=e;return(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",className:t,children:(0,i.jsx)("path",{d:"M16 11H11V16C11 16.2652 10.8946 16.5196 10.7071 16.7071C10.5196 16.8946 10.2652 17 10 17C9.73478 17 9.48043 16.8946 9.29289 16.7071C9.10536 16.5196 9 16.2652 9 16V11H4C3.73478 11 3.48043 10.8946 3.29289 10.7071C3.10536 10.5196 3 10.2652 3 10C3 9.73478 3.10536 9.48043 3.29289 9.29289C3.48043 9.10536 3.73478 9 4 9H9V4C9 3.73478 9.10536 3.48043 9.29289 3.29289C9.48043 3.10536 9.73478 3 10 3C10.2652 3 10.5196 3.10536 10.7071 3.29289C10.8946 3.48043 11 3.73478 11 4V9H16C16.2652 9 16.5196 9.10536 16.7071 9.29289C16.8946 9.48043 17 9.73478 17 10C17 10.2652 16.8946 10.5196 16.7071 10.7071C16.5196 10.8946 16.2652 11 16 11Z",fill:"currentColor"})})},a=()=>(0,i.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"8",he
1ight:"8",viewBox:"0 0 8 8",fill:"none",className:"h-3 w-3",children:[(0,i.jsx)("g",{clipPath:"url(#clip0_8747_32234)",children:(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.46466 0.465027C0.269398 0.66029 0.269398 0.976872 0.46466 1.17213L3.29372 4.0012L0.465857 6.82906C0.270595 7.02432 0.270595 7.34091 0.465858 7.53617C0.66112 7.73143 0.977702 7.73143 1.17296 7.53617L4.00083 4.7083L6.82862 7.53609C7.02388 7.73136 7.34047 7.73136 7.53573 7.53609C7.73099 7.34083 7.73099 7.02425 7.53573 6.82899L4.70794 4.0012L7.53693 1.17221C7.73219 0.976948 7.73219 0.660365 7.53693 0.465103C7.34166 0.269841 7.02508 0.269841 6.82982 0.465103L4.00083 3.29409L1.17177 0.465027C0.976505 0.269765 0.659922 0.269765 0.46466 0.465027Z",fill:"currentColor"})}),(0,i.jsx)("defs",{children:(0,i.jsx)("clipPath",{id:"clip0_8747_32234",children:(0,i.jsx)("rect",{width:"8",height:"8",fill:"white"})})})]}),s=e=>{let{className:t}=e;return(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"144",height:"145",viewBox:"0 0 144 145",fill:"none",className:t,children:(0,i.jsx)("path",{d:"M25.7872 142.6H10C5.58172 142.6 2 139.018 2 134.6V118.813M118.213 142.6H134C138.418 142.6 142 139.018 142 134.6V118.813M26.7872 2.59998H10C5.58172 2.59998 2 6.1817 2 10.6V26.3872M118.213 2.59998H134C138.418 2.59998 142 6.1817 142 10.6V26.3872",stroke:"currentColor",strokeWidth:"4"})})},o=e=>{let{className:t}=e;return(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"148",height:"149",viewBox:"0 0 148 149",fill:"none",className:t,children:(0,i.jsx)("path",{d:"M26.4669 147H10C5.58173 147 2 143.418 2 139V122.363M121.533 147H138C142.418 147 146 143.418 146 139V122.363M27.4954 2H10C5.58173 2 2 5.58172 2 10V26.6368M121.533 2H138C142.418 2 146 5.58172 146 10V26.6368",stroke:"currentColor",strokeWidth:"4"})})}},15584:function(e,t,r){"use strict";r.d(t,{Z:function(){return d}});var i=r(11719),l=r(77804),n=r(88661),a=r(27879),s=r(26015),o=r(21764),c=e=>(0,l.jsx)(o.Z,(0,s._)((0,i._)({},e),{overlayClassName:"web-base-popover ".concat(e.overlayClassName," "),children:e.children})),u=e=>{var t;let{open:r,defaultOpen:a}=e,c=(0,n.useRef)(!1),u=(0,n.useMemo)(()=>"boolean"==typeof(null==e?void 0:e.open),[r]),[d,h]=(0,n.useState)(!1),p=(0,n.useMemo)(()=>u?r:d,[r,d,u]),m=t=>{if(u){var r;null==e||null===(r=e.onOpenChange)||void 0===r||r.call(e,t)}else h(t)};(0,n.useEffect)(()=>{!u&&a&&h(a)},[u,a]);let f=e=>{c.current||m(e),c.current=!1};return(0,l.jsx)(o.Z,(0,s._)((0,i._)({},e),{open:p,trigger:"click",onOpenChange:e=>{f(e)},overlayClassName:"web-base-popover ".concat(null!==(t=null==e?void 0:e.overlayClassName)&&void 0!==t?t:""," "),children:(0,l.jsx)("div",{className:"inline-block",onTouchStart:e=>{e&&e.stopPropagation(),c.current=!0,m(!p)},children:e.children})}))},d=e=>{let{isTouchSupported:t=!1}=(0,a.qr)();return t?(0,l.jsx)(u,(0,i._)({},e)):(0,l.jsx)(c,(0,i._)({},e))}},24271:function(e,t,r){"use strict";r.d(t,{z:function(){return n}});var i=r(11719),l=r(77804);r(88661);let n=e=>{let{src:t,colorClassName:r="bg-hl_brand_btn",width:n=16,height:a=16,className:s="",alt:o="icon",style:c}=e;return(0,l.jsx)("div",{className:"".concat(r," ").concat(s),style:(0,i._)({width:"".concat(n,"px"),height:"".concat(a,"px"),WebkitMaskImage:"url(".concat(t,")"),maskImage:"url(".concat(t,")"),WebkitMaskSize:"contain",maskSize:"contain",WebkitMaskRepeat:"no-repeat",maskRepeat:"no-repeat",WebkitMaskPosition:"center",maskPosition:"center"},c),role:"img","aria-label":o})};t.Z=n},30390:function(e,t,r){"use strict";r.d(t,{d:function(){return m}});var i=r(77804),l=r(88661),n=r(46153),a=r(21764),s=r(53202),o=r(96637),c=r(54491),u=r(94183);let d={padding:4,backgroundColor:"var(--hl_bg_03)",borderRadius:12,overflow:"hidden",boxShadow:"var(--hl_shadow_popover, 0 10px 20px rgba(0,0,0,0.16), -0.6px -0.6px 1.2px rgba(95,95,96,0.20) inset, 0.6px 0.6px 0.6px rgba(95,95,96,0.20) inset)"},h={padding:0,background:"transparent",boxShadow:"none"},p=(e,t,r,l)=>{let{assetFileType:n,url:a,coverUrl:c,name:d,duration:h}=e;switch(n){case o.d.Image:return(0,i.jsx)("div",{className:"group relative cursor-zoom-in overflow-hidden rounded-[12px]",style:{width:140,height:140},onClick:t,children:(0,i.jsx)("img",{src:a,alt:d,className:"h-full w-full object-cover transition-transform duration-200 group-hover:scale-105"})});case o.d.Video:return(0,i.jsx)(u.t,{videoUrl:a,coverUrl:c||a,name:d,duration:h,onExpand:r});case o.d.Audio:return(0,i.jsx)(s.z,{audioUrl:a,name:d,coverUrl:c,autoPlay:!0,width:250,onExpand:l});default:return null}},m=e=>{let{data:t,placement:r="top",children:s}=e,u=(0,n.I0)(),m=(0,l.useCallback)(()=>{u((0,c.cm)(t.url))},[u,t.url]),f=(0,l.useCallback)(()=>{u((0,c.hT)({url:t.url,poster:t.coverUrl||t.url}))},[u,t.url,t.coverUrl]),v=(0,l.useCallback)(()=>{var e;u((0,c.v)({url:t.url,name:t.name,duration:null!==(e=t.duration)&&void 0!==e?e:0,coverUrl:t.coverUrl}))},[u,t.url,t.name,t.duration,t.coverUrl]),g=p(t,m,f,v),x=t.assetFileType===o.d.Audio?h:d;return g?(0,i.jsx)(a.Z,{content:g,trigger:"hover",placement:r,arrow:!1,mouseEnterDelay:.3,mouseLeaveDelay:.1,destroyTooltipOnHide:!0,overlayInnerStyle:x,children:(0,i.jsx)("span",{className:"asset-mention-trigger hover:bg-hl_bg_05 inline-flex rounded-[6px] py-[2px]",children:s})}):(0,i.jsx)(i.Fragment,{children:s})}},41256:function(e,t,r){"use strict";r.d(t,{Z:function(){return C}});
1var i=r(77804),l=r(88661),n=r(59607),a=r.n(n),s=r(28733),o=r(21764),c=r(46153),u=r(76106),d=r(82756),h=r(88370),p=r(11679),m=r(94662);let f="QUICK_AT_RED_DOT_TRIGGER_COUNT",v="IMG_AT_REF_TOOLTIP_SHOWN",g=e=>{var t;let r=(0,c.I0)(),i=(0,c.v9)(t=>{var r,i,l,n;return(0,u.CN)(t.modelDomain,null!==(i=null!==(r=null==e?void 0:e.modelId)&&void 0!==r?r:t.create.currentCreateModelId)&&void 0!==i?i:void 0,null!==(l=null==e?void 0:e.modelMode)&&void 0!==l?l:t.dataConfig.modelMode,null!==(n=null==e?void 0:e.workSpace)&&void 0!==n?n:t.create.workSpace)}),n=(0,c.v9)(t=>{var r,i;return(null==e||!e.uploadedImages)&&(null!==(i=null===(r=t.create.createTabsData[t.create.workSpace])||void 0===r?void 0:r.uploadedImages)&&void 0!==i?i:[]).some(e=>e.status===d.Z0.success)}),a=(null==e?void 0:e.uploadedImages)?e.uploadedImages.some(e=>e.status===d.Z0.success):n,s=i&&a,[o,g]=(0,l.useState)(()=>{var e;return Number(null!==(e=h.storage.getItem(f))&&void 0!==e?e:0)}),x=(0,l.useCallback)(()=>{g(e=>{if(e>=3)return e;let t=e+1;return h.storage.setItem(f,String(t)),t})},[]),_=(0,c.v9)(e=>e.assetMention.isOpen),C=(0,c.v9)(e=>e.assetMention.triggerPoint),w=(0,l.useRef)(!1),b=(0,l.useRef)(!1);(0,l.useEffect)(()=>{!w.current&&_&&(b.current?b.current=!1:x()),w.current=_},[_,x]);let y=(0,l.useRef)(null),k=(0,l.useRef)(null),R=(0,l.useCallback)(()=>{y.current=setTimeout(x,1e3)},[x]),M=(0,l.useCallback)(()=>{y.current&&(clearTimeout(y.current),y.current=null)},[]);(0,l.useEffect)(()=>()=>{y.current&&clearTimeout(y.current)},[]);let j=(0,l.useCallback)(()=>{var e;y.current&&(clearTimeout(y.current),y.current=null),x();let t=null===(e=k.current)||void 0===e?void 0:e.getBoundingClientRect();t&&(b.current=!0,r((0,p.t1)({anchorPoint:{x:t.left+16,xWithAt:t.left,yTop:t.top,yBottom:t.bottom}})))},[r,x]),S=(0,c.v9)(e=>
1e.create.workSpace),E=(0,c.v9)(e=>e.modelDomain.imageRefButtonTooltip),N=(null!==(t=null==e?void 0:e.workSpace)&&void 0!==t?t:S)===m.Ro.image,[D,T]=(0,l.useState)(()=>!h.storage.getItem(v));return{isVisible:s,showRedDot:s&&o<3,isMenuOpen:_&&!C,buttonRef:k,handleClick:j,handleMouseEnter:R,handleMouseLeave:M,showRefTooltip:D&&N&&!!E,refButtonTooltip:E,dismissRefTooltip:(0,l.useCallback)(()=>{h.storage.setItem(v,"1"),T(!1)},[])}};var x=r(4707),_=r(38583),C=l.memo(e=>{let{uploadedImages:t,modelId:r,workSpace:l,modelMode:n}=e,c=(0,s.T)(),{isVisible:u,showRedDot:d,isMenuOpen:h,buttonRef:p,handleClick:m,handleMouseEnter:f,handleMouseLeave:v,showRefTooltip:C,refButtonTooltip:w,dismissRefTooltip:b}=g({uploadedImages:t,modelId:r,workSpace:l,modelMode:n});if(!u)return null;let y=(0,i.jsxs)("div",{ref:p,className:a()("relative ml-[-4px] flex h-8 w-8 cursor-pointer select-none items-center justify-center rounded-[10px] transition-all",h?"bg-hl_bg_05":"hover:bg-hl_bg_05"),onClick:m,onMouseEnter:f,onMouseLeave:v,children:[(0,i.jsx)("span",{className:"text-hl_text_02 text-[16px] font-normal leading-none",children:"@"}),d&&(0,i.jsx)("span",{className:"bg-hl_brand_00 absolute right-[2px] top-[2px] h-2 w-2 rounded-full"})]});return C&&w?(0,i.jsx)(o.Z,{open:!0,trigger:["click"],placement:"topRight",align:{offset:[20,-8]},arrow:!1,zIndex:1200,getPopupContainer:()=>document.body,destroyTooltipOnHide:!0,overlayInnerStyle:{padding:0,background:"transparent",boxShadow:"none"},onOpenChange:e=>{e||b()},content:(0,i.jsx)(_.Z,{title:c(w.titile),desc:c(w.desc),arrowPlacement:"bottom",arrowPosition:"right",onClose:b}),children:y}):(0,i.jsx)(x.Z,{overlayClassName:"max-w-[300px] new-icon-hover-tooltip",title:c("quick_at_tip"),placement:"top",arrow:!1,getPopupContainer:e=>e.closest("#video-create-input"),children:y})})},35828:function(e,t,r){"use strict";r.d(t,{f:function(){return u}});var i=r(77804),l=r(88661),n=r(28733),a=r(4159);let s=()=>(0,i.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"text-hl_text_00 opacity-40",children:[(0,i.jsxs)("g",{clipPath:"url(#h3-all-reference-cost-tooltip-info-icon)",children:[(0,i.jsx)("circle",{cx:"8",cy:"8",r:"6.52",stroke:"currentColor",strokeWidth:"1.36"}),(0,i.jsx)("path",{d:"M9 5C9 5.55228 8.55228 6 8 6C7.44772 6 7 5.55228 7 5C7 4.44772 7.44772 4 8 4C8.55228 4 9 4.44772 9 5Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M8 7.6001V11.2001",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})]}),(0,i.jsx)("defs",{children:(0,i.jsx)("clipPath",{id:"h3-all-reference-cost-tooltip-info-icon",children:(0,i.jsx)("rect",{width:"16",height:"16",fill:"white"})})})]}),o=e=>{let{label:t,value:r,topBorder:l=!1,bottomBorder:n=!1}=e;return(0,i.jsxs)("div",{className:"grid min-h-8 shrink-0 grid-cols-[112px_minmax(0,1fr)] gap-2 ".concat(l?"border-hl_white_08 border-t-[0.5px]":""," ").concat(n?"border-hl_white_08 border-b-[0.5px]":""),children:[(0,i.jsx)("span",{className:"border-hl_white_08 text-hl_text_01 cl_hl_H9_M flex min-w-0 items-center whitespace-nowrap border-r-[0.5px]",children:t}),(0,i.jsx)("span",{className:"text-hl_text_02 cl_hl_H9_R flex min-w-0 items-center whitespace-normal break-words py-1",children:r})]})},c=e=>{let{costBreakdown:t}=e,r=(0,n.T)(),l=r("h3_all_reference_credits_per_second",{cost:(0,a.tX)(t.unitCostByDuration)});return(0,i.jsxs)("div",{className:"h3-all-reference-price-details bg-hl_bg_03 flex w-[288px] flex-col gap-2 rounded-xl px-4 py-3",children:[(0,i.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,i.jsx)("div",{className:"cl_hl_H7_SB text-hl_text_00",children:r("h3_all_reference_price_details_title")}),(0,i.jsx)(o,{label:r("h3_all_reference_generated_video_label"),value:l,topBorder:!0,bottomBorder:!0})]}),(0,i.jsxs)("div",{className:"flex flex-col",children:[(0,i.jsx)("div",{className:"border-hl_white_08 text-hl_text_03 cl_hl_H9_M flex h-8 shrink-0 items-center whitespace-nowrap border-y-[0.5px]",children:(0,i.jsx)("span",{className:"w-[112px] shrink-0",children:r("h3_all_reference_input_media_label")})}),(0,i.jsx)(o,{label:r("h3_all_reference_input_video_label"),value:l,bottomBorder:!0}),(0,i.jsx)(o,{label:r("h3_all_reference_input_audio_label"),value:r("h3_all_reference_free"),bottomBorder:!0}),(0,i.jsx)(o,{label:r("h3_all_reference_input_image_label"),value:r("h3_all_reference_input_image_pricing",{freeCount:5,cost:3})})]})]})},u=e=>{let{estimatedCost:t,costBreakdown:r,createQuantity:o}=e,u=(0,n.T)(),[d,h]=(0,l.useState)(!1),p=r.generatedDuration*o,m=(r.inputVideoCost+r.extraImageCost)*o;return(0,i.jsxs)("div",{className:"relative w-[300px] p-4",onMouseLeave:()=>h(!1),children:[d&&(0,i.jsx)("div",{className:"absolute bottom-full left-1/2 z-10 mb-1 -translate-x-1/2",children:(0,i.jsx)(c,{costBreakdown:r})}),(0,i.jsxs)("div",{className:"flex items-center gap-1",children:[(0,i.jsx)("span",{className:"text-hl_text_00 cl_hl_H7_SB",children:u("h3_all_reference_estimated_cost",{cost:(0,a.tX)(t)})}),(0,i.jsx)("span",{className:"text-hl_text_02 flex cursor-help",onMouseEnter:()=>h(!0),children:(0,i.jsx)(s,{})})]}),(0,i.jsx)("div",{className:"text-hl_text_02 cl_hl_H9_R mt-3",children:u("h3_all_reference_generated_video_cost",{duration:p,cost:(0,a.tX)(r.unitCostByDuration)})}),(0,i.jsx)("div",{className:"text-hl_text_02 cl_hl_H9_R mt-2",children:u("h3_all_reference_input_media_cost",{cost:(0,a.tX)(m)})})]})}},47996:function(e,t,r){"use strict";r.d(t,{A:function(){return _}});var i=r(77804),l=r(88661),n=r(46153),a=r(28733),s=r(29266),o=r(41767),c=r(6
17768),u=r(15584),d=r(13197),h=r(21217),p=r(28344),m=r(98609),f=r(83574),v=r(73342),g=r(71459),x=r(93340);let _=[{key:h.O.ALL_REFERENCE,label:"creation_input_func_all_reference",icon:(0,i.jsx)(d.HK,{})},{key:h.O.START_END_FRAME,label:"creation_input_func_start_end_frame",icon:(0,i.jsx)(o.Z,{size:16})},{key:h.O.IMAGE_REFERENCE,label:"creation_input_func_multi_ref_video",icon:(0,i.jsx)(d.Si,{})},{key:h.O.SUBJECT_REFERENCE,label:"creation_input_func_subject_ref_video",icon:(0,i.jsx)(d.um,{})},{key:h.O.EXTEND,label:"h3_creation_extend_title",icon:(0,i.jsx)(d.Qe,{})}];t.Z=e=>{var t;let{modeOptions:r,onModeChange:o,placement:d}=e,h=(0,n.v9)(e=>e.create.workSpace),C=(0,n.v9)(e=>e.dataConfig.modelMode),w=(0,n.v9)(e=>e.modelDomain),{parentEntity:b}=(0,f.ZP)(),{updateVideoModelStore:y}=(0,p.Y)(),{checkAndExecute:k}=(0,v.L)(),[R,M]=(0,l.useState)(!1),j=(0,a.T)(),S=null!=r?r:_,E=(0,l.useMemo)(()=>w.loadingState.hasVideoModelInfo?S.filter(e=>(0,m.Iw)(w,{workSpace:h,modelMode:e.key}).some(e=>!e.disabled)):S,[w,h]),N=(0,l.useMemo)(()=>E.find(e=>e.key===C),[E,C]);(0,s.GM)(R,()=>M(!1));let D=e=>{let t=(0,m.If)(w,{currentModelKey:null==b?void 0:b.modelKey,workSpace:h,modelMode:e,useLocalCache:!0});if(null==t?void 0:t.activeModelId){var r;y({modelId:t.activeModelId,needVerify:!0,editorTabKey:null===(r=t.activeModel)||void 0===r?void 0:r.type,targetModelMode:e}),null==o||o(e)}},T=e=>{var t,r;if(e===C){M(!1);return}M(!1),k(e,()=>D(e),void 0,g.qM.ModeSwitch),(0,x.I)({id:"mode_select_click",model_mode_key:e,model_mode_name:j(null!==(r=null===(t=S.find(t=>t.key===e))||void 0===t?void 0:t.label)&&void 0!==r?r:"")})};return(0,i.jsx)(u.Z,{open:R,onOpenChange:M,arrow:!1,placement:d||"topLeft",trigger:["click"],content:(0,i.jsx)("div",{className:"bg-hl_bg_03 border-hl_white_08 flex min-w-[180px] flex-col gap-1 rounded-xl border p-1",style:{boxShadow:"0px 4px 20px 0px rgba(0, 0, 0, 0.10)",backdropFilter:"blur(25px)"},children:E.map(e=>(0,i.jsx)("button",{type:"button",className:"text-hl_text_02 hover:bg-hl_bg_06 w-full rounded-lg px-3 py-2 \n text-left text-[13px] transition-colors ".concat(e.key===C?"bg-hl_bg_06 text-hl_text_00":""),onClick:()=>T(e.key),children:(0,i.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2",children:[(0,i.jsx)("span",{className:"text-hl_text_02",children:e.icon}),(0,i.jsx)("span",{children:j(e.label)})]}),e.key===C&&(0,i.jsx)(c.Z,{size:16,color:"text-hl_text_02"})]})},e.key))}),overlayClassName:"model-selection-options pb-[0px] sm:pb-[6px]",children:(0,i.jsxs)("div",{className:"".concat(R?"bg-hl_bg_05 text-hl_text_00":" hover:bg-hl_bg_05 text-hl_text_02"," border-hl_line_01 hover:bg-hl_bg_05 flex h-8 cursor-pointer items-center gap-1 \n whitespace-nowrap rounded-[10px] border px-2 py-1 text-[13px] transition-all"),children:[(0,i.jsx)("span",{children:null==N?void 0:N.icon}),(0,i.jsx)("span",{children:j(null!==(t=null==N?void 0:N.label)&&void 0!==t?t:"")})]})})}},97315:function(e,t,r){"use strict";var i=r(77804);r(88661);var l=r(28733),n=r(6578);t.Z=e=>{let{tag:t,isActive:r,onClick:a}=e,s=(0,l.T)(),o=s.has(t.tagName)?s(t.tagName):t.tagId;return(0,i.jsxs)("button",{onClick:a,className:"".concat("flex shrink-0 items-center rounded-lg border border-solid px-2 py-1 text-[12px] leading-5"," transition-colors ").concat(r?"border-hl_line_01 bg-hl_text_00 text-hl_text_05":"border-hl_line_01 text-hl_text_02 hover:bg-hl_bg_05"),children:[(0,i.jsx)("span",{className:"inline-flex items-center overflow-hidden transition-all duration-200 ease-in-out ".concat(r?"mr-1 max-w-[12px] opacity-100":"max-w-0 opacity-0"),children:(0,i.jsx)(n.D3,{})}),o]})}},34575:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var i=r(77804),l=r(88661),n=r(28733),a=r(4707),s=r(13197);function o(e){let{modelControlItem:t,showTip:r=!1,showCount:o=!0}=e,{isShow:c,displayText:u}=(0,l.useMemo)(()=>{var e;let r=null==t?void 0:t.freeInfo;return null!==(e=null==t?void 0:t.hasFreeTag)&&void 0!==e&&e?{isShow:!0,displayText:o?" ".concat(r):""}:{isShow:!1,displayText:""}}
1,[null==t?void 0:t.freeInfo,null==t?void 0:t.hasFreeTag,o]),d=(0,n.T)();return c?(0,i.jsxs)("div",{className:"bg-hl_alpha_12 relative ml-1 flex items-center justify-center gap-1 whitespace-nowrap rounded-[4px] px-1.5 py-0.5",children:[(0,i.jsxs)("span",{className:"text-hl_brand_01 text-9-h10-label-sb",children:[d("model_free_trial"),u]}),r&&(0,i.jsx)(a.Z,{title:d("model_free_trial_dec"),overlayClassName:"new-icon-hover-tooltip",arrow:!1,children:(0,i.jsx)("span",{className:"text-hl_brand_01 cursor-pointer hover:opacity-90",children:(0,i.jsx)(s.Qf,{className:"h-2.5 w-2.5"})})})]}):null}},24075:function(e,t,r){"use strict";r.d(t,{p:function(){return p}});var i=r(77804);r(88661);var l=r(33619),n=r(12936),a=r(28733),s=r(13197),o=r(16610),c=r(79694),u=r(5352),d=r(34575);let{Paragraph:h}=l.default,p=e=>{var t,r,l,p;let{model:m,entity:f,isSelected:v=!1,disabled:g=!1,onClick:x,showFreeCount:_=!0,showFreeTip:C=!1}=e,w=(0,a.T)(),{isDark:b}=(0,o.Z)(),y=null==m?void 0:m.addition,k=null==m?void 0:m.hasFreeCount,R=null!==(r=null==m?void 0:m.parentEntity)&&void 0!==r?r:f,M=(null==y?void 0:y.upgrade)&&!k;return(0,i.jsxs)("div",{onClick:g?void 0:x,className:"hover:bg-hl_bg_05 flex items-center rounded-lg px-2 py-2 ".concat(g?"cursor-not-allowed opacity-50":"cursor-pointer"),children:[(0,i.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,i.jsxs)("div",{className:"flex items-center",children:[(null==R?void 0:R.icon)&&(0,i.jsx)("div",{className:"border-hl_line_01 mr-2 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border",children:(0,i.jsx)(n.default,{src:b?null==R?void 0:R.icon:null!==(l=null==R?void 0:R.iconLight)&&void 0!==l?l:null==R?void 0:R.icon,width:20,height:20,alt:"".concat(null==R?void 0:R.name," model icon"),className:"h-5 w-5 object-cover"})}),(0,i.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,i.jsxs)("span",{className:"flex flex-row items-center",children:[(0,i.jsx)("div",{className:"font-500 text-hl_text_00 min-w-[36px] truncate text-[13px] leading-[25px]",children:null==R?void 0:R.name}),(null==R?void 0:R.tag)&&(0,i.jsx)(c.x,{tag:null==R?void 0:R.tag,tagGradientText:null==R?void 0:R.tagGradientText,tagClassName:null==R?void 0:R.tagClassName}),M&&(0,i.jsx)(c.l,{text:w("upgrade_button")}),m&&(0,i.jsx)(d.Z,{modelControlItem:m,showCount:_,showTip:C})]}),(null==R?void 0:R.desc)&&(0,i.jsx)(h,{className:"text-hl_text_02 mb-0 text-[12px] font-normal leading-[16px]",ellipsis:{rows:2},children:w(null==R?void 0:R.desc)})]})]}),(null==R?void 0:R.tagList)&&(null==R?void 0:null===(t=R.tagList)||void 0===t?void 0:t.length)>0&&(0,i.jsx)("div",{className:"my-1 h-4 pl-10",children:(0,i.jsx)(u.K,{tagList:null!==(p=null==R?void 0:R.tagList)&&void 0!==p?p:[]})})]}),v&&(0,i.jsx)("span",{className:"shrink-0",children:(0,i.jsx)(s.Ol,{})})]})}},79694:function(e,t,r){"use strict";r.d(t,{x:function(){return s},l:function(){return a}});var i=r(77804);r(88661);let l=e=>{let{text:t,icon:r,containerClassName:l="bg-hl_alpha_30 rounded h-4 px-[6px] py-1 gap-[2px]",textClassName:n="text-hl_brand_00 text-[10px] font-semibold leading-[12px]",onClick:a}=e;return(0,i.jsxs)("div",{className:"flex items-center whitespace-nowrap ".concat(l," ").concat(a?"cursor-pointer":""),onClick:a,children:[r&&(0,i.jsx)("div",{className:n,children:r}),(0,i.jsx)("span",{className:n,children:t})]})},n=()=>(0,i.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{d:"M5.57715 2.0293C5.78384 1.70632 6.25812 1.70795 6.46289 2.03223L8.10156 4.62793L9.8252 3.41602C10.2075 3.14729 10.7243 3.47443 10.6426 3.93359L9.74805 8.96387C9.61967 9.68552 8.99031 10.2118 8.25488 10.2119H3.52637C2.7661 10.2117 2.12364 9.65047 2.02344 8.89941L1.35645 3.90234C1.2962 3.45077 1.80429 3.14459 2.17773 3.40723L3.91602 4.62988L5.57715 2.0293ZM6.07617 5.00977C6.0541 4.93573 5.94885 4.93575 5.92676 5.00977L5.56445 6.22559C5.55688 6.25088 5.53706 6.27096 5.51172 6.27832L4.27734 6.63184C4.20228 6.65337 4.20229 6.7597 4.27734 6.78125L5.51172 7.13574C5.53704 7.14314 5.55691 7.16319 5.56445 7.18848L5.92676 8.40332C5.94883 8.47736 6.0541 8.47736 6.07617 8.40332L6.43848 7.18848C6.44604 7.1631 6.46577 7.14307 6.4912
11 7.13574L7.72559 6.78125C7.80032 6.75954 7.80041 6.65344 7.72559 6.63184L6.49121 6.27832C6.46578 6.27102 6.44609 6.25091 6.43848 6.22559L6.07617 5.00977Z",fill:"currentColor"})});function a(e){let{text:t}=e;return(0,i.jsx)(l,{text:t,icon:(0,i.jsx)(n,{}),containerClassName:"bg-hl_alpha_12 rounded h-4 px-[6px] py-1 gap-[2px] ml-1",textClassName:"text-hl_brand_01 text-9-h10-label-sb"})}function s(e){let{tag:t,tagGradientText:r,tagClassName:n}=e;return r?(0,i.jsx)(l,{text:t,containerClassName:"bg-hl_brand_00 rounded px-[6px] py-0.5 gap-[2px] ml-1",textClassName:"text-hl_text_06 text-9-h10-label-sb"}):(0,i.jsx)("span",{className:"".concat(n||"bg-hl_text_00 text-hl_text_05"," ").concat("ml-1 rounded px-1 py-[2px] text-9-h10-label-sb"),children:t})}},5352:function(e,t,r){"use strict";r.d(t,{K:function(){return o}});var i=r(77804),l=r(88661),n=r(79736),a=r(28733),s=r(56108);function o(e){let{tagList:t,className:r="",tagClassName:o="bg-hl_bg_06 text-hl_text_01 rounded-[4px] font-[400] px-2 py-[2px] text-[9px] leading-[12px] whitespace-nowrap",maxWidth:c}=e,u=(0,a.T)(),d=(0,l.useRef)(null),[h,p]=(0,l.useState)(t),[m,f]=(0,l.useState)(!1),v=(0,l.useCallback)(e=>"key"===e.type?u(e.value):e.value,[u]);if((0,l.useEffect)(()=>{p(t),f(!1)},[t]),(0,l.useEffect)(()=>{if(!(null==t?void 0:t.length)){p([]),f(!1);return}let e=setTimeout(()=>{if(!d.current)return;let e=c||d.current.clientWidth;if(0===e){p(t),f(!1);return}let r=document.createElement("div");r.style.cssText="\n position: absolute;\n visibility: hidden;\n display: flex;\n flex-wrap: nowrap;\n gap: 4px;\n white-space: nowrap;\n ",document.body.appendChild(r);let i=[],l=0;for(let e=0;e<t.length;e++){let n=document.createElement("span");n.className=o,n.textContent=v(t[e]),r.appendChild(n);let a=n.offsetWidth;i.push(a),l+=a,e>0&&(l+=4),r.removeChild(n)}if(l<=e){p(t),f(!1),document.body.removeChild(r);return}let n=document.createElement("span");n.className=o,n.textContent="...",r.appendChild(n);let a=n.offsetWidth;r.removeChild(n),document.body.removeChild(r);let s=0,u=-1;for(let r=0;r<t.length;r++){let l=i[r],n=r>0?4:0,o=s+n+l;if(r===t.length-1){o<=e&&(u=r);break}if(o+4+a<=e)s+=n+l,u=r;else break}u>=0?(p(t.slice(0,u+1)),f(u<t.length-1)):(p([]),f(!0))},100);return()=>clearTimeout(e)},[t,o,c,v]),!(null==t?void 0:t.length))return null;let g=(m?t.slice(h.length):[]).map(e=>v(e)).join("ã");return(0,i.jsxs)("div",{ref:d,className:"flex min-h-[16px] flex-nowrap items-center ".concat(r),children:[h.length>0&&h.map((e,t)=>(0,i.jsx)("span",{className:"".concat(o," mr-1"),children:v(e)},t)),m&&g&&(0,i.jsx)(n.Z,{title:g,placement:"top",overlayClassName:"tag-list-tooltip",arrow:!1,children:(0,i.jsx)("span",{className:"".concat(o," cursor-pointer"),children:(0,i.jsx)(s.nX,{className:"h-3 w-3"})})})]})}},78166:function(e,t,r){"use strict";r.d(t,{Z:function(){return x},g:function(){return g}});var i=r(77804),l=r(88661),n=r(79736),a=r(56108),s=r(59607),o=r.n(s),c=r(28733),u=r(29266),d=r(36983),h=r(4707),p=r(94662),m=r(242),f=e=>{let{value:t,selected:r,modalCanUse:a,enabled:s=!0,onClick:f,settingType:v,showDot:g=!1,size:x="S",onUpgrade:_,disabledTooltip:C,hideDisabledTooltip:w=!1,hoverTooltip:b}=e,y=(0,c.T)(),[k,R]=(0,l.useState)(!1);(0,u.GM)(k,()=>R(!1));let M=!s,j=(0,i.jsxs)("div",{className:o()("relative flex flex-1 items-center justify-center rounded-[6px] transition-all","S"===x?"h-8":"h-[44px] flex-col gap-[2px] py-[7px]",{"text-hl_text_04 cursor-not-allowed":M,"bg-hl_bg_07 text-hl_text_00 cursor-pointer":!M&&r,"text-hl_text_02 hover:text-hl_text_00 cursor-pointer":!M&&!r&&a,"text-hl_text_02 cursor-pointer":!M&&!a}),onClick:M?void 0:f,children:[(0,i.jsx)("div",{className:o()("flex items-center justify-center text-[11px] font-medium leading-[14px] tracking-[0.44px]","L"===x&&"flex-col gap-[2px]"),children:t}),!a&&(0,i.jsx)(d.Bf,{className:"text-hl_brand_01 ml-[2px] h-4 w-4"}),g&&(0,i.jsx)("div",{className:"ml-[1px] mt-[1px] h-[20px]",children:(0,i.jsx)("div",{className:"bg-hl_error_fill h-1 w-1 rounded-full"})})]});return M?w?j:(0,i.jsx)(n.Z,{arrow:!1,title:y(C||"toast_restrict_10s_1080p"),overlayClassName:"max-w-[400px] new-icon-hover-tooltip",children:j}):M||a?b?(0,i.jsx)(h.Z,{title:y(b),placement:"top",arrow:!1,children:j}):j:(0,i.jsx)(n.Z,{arrow:!1,open:k,align:{offset:[0,-10]},destroyTooltipOnHide:!0,onOpenChange:R,rootClassName:"video-setting-tooltip",title:(0,i.jsx)(m.Z,{settingType:v,onClick:()=>{R(!1),null==_||_()}}),overlayClassName:"".concat(v===p.gm.RESOLUTION?"w-[356px]":"w-[320px]"," max-w-[400px]"),overlayInnerStyle:{backgroundColor:"var(--hl_bg_03)",padding:"0px",borderRadius:"16px"},children:j})};let v=e=>{var t;return!(null===(t=e.addition)||void 0===t?void 0:t.upgrade)};function g(e){let t=e.length;if(t<=10)return[{items:e,placeholders:0}];let r=Math.ceil(t/10),i=Math.ceil(t/r),l=[],n=0;for(let a=0;a<r;a++){let s=a===r-1?t-n:i;l.push({items:e.slice(n,n+s),placeholders:i-s}),n+=s}return l}var x=e=>{let{title:t,options:r,tooltipContent:l,selectedValue:s,onSelect:o,valueFormatter:c,settingType:u,shouldShowDot:d,isOptionEnabled:h=()=>!0,size:p="S",onUpgrade:m,disabledTooltip:x,getDisabledTooltip:_,getHideDisabledTooltip:C,getHoverTooltip:w,enableMultiRow:b=!1}=e;if(!r||0===r.length)return null;let y=b?g(r):[{items:r,placeholders:0}];return(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"text-hl_text_03 mb-2 flex items-center",children:[(0,i.jsx)("span",{className:"text-[12px] leading-4 tracking-[0.48px]",children:t}),l?(0,i.jsx)(n.Z,{arrow:!1,align:{offset:[0,-10]},title:(0,i.jsx)(e=>{let{title:t,content:r}=e;return(0,i.jsxs)("div",{className:"relative w-80 w-full px-3 py-3",children:[(0,i.jsx)("div",{className:"h-5 text-[13px] font-[500] leading-5 text-white",children:t}),(0,i.jsx)("div",{className:"absolute left-0 top-12 h-[1px] w-full bg-white opacity-[0.04]"}),(0,i.jsx)("div",{className:"text-hl_text_01 mt-[30px] text-[12px] leading-[18px]",children:r})]})},{title:t,content:l}),overlayClassName:"max-w-[320px]",overlayInnerStyle:{backgroundColor:"var(--hl_text_04)",padding:"0px",borderRadius:"16px"},children:(0,i.jsx)("div",{className:"text-hl_text_02 ml-1 h-3 w-3 cursor-pointer",children:(0,i.jsx)(a.fW,{className:"h-full w-full"})})}):null]}),(0,i.jsx)("div",{className:"bg-hl_bg_05 flex flex-col gap-[2px] rounded-[8px] p-[2px]",children:y.map(e=>{var r;return(0,i.jsxs)("div",{className:"flex gap-[2px]",children:[e.items.map(e=>{var r,l;return(0,i.jsx)(f,{value:c(e),selected:s===e.value,modalCanUse:v(e),enabled:h(e),onClick:()=>o(e),settingType:u,showDot:d(u,e.value),size:p,onUpgrade:m,disabledTooltip:null!==(r=null==_?void 0:_(e))&&void 0!==r?r:x,hideDisabledTooltip:null!==(l=null==C?void 0:C(e))&&void 0!==l&&l,hoverTooltip:null==w?void 0:w(e)},"".concat(t.toLowerCase(),"-").concat(e.value))}),Array.from({length:e.placeholders}).map((e,t)=>(0,i.jsx)("div",{className:"flex flex-1 rounded-[6px]","aria-hidden":"true"},"placeholder-".concat(t)))]},"row-".concat(null===(r=e.items[0])||void 0===r?void 0:r.value))})})]})}},242:function(e,t,r){"use strict";var i=r(77804),l=r(88661),n=r(94662),a=r(28733),s=r(77269),o=r(85474),c=r(8772),u=r(36983);let d=s.a1?"https://cdn.hailuoai.video/web-assets/videos/resolution-0801.mp4":"https://cdn.hailuoai.com/web-assets/videos/resolution-0801.mp4",h=s.a1?"https://cdn.hailuoai.video/web-assets/videos/resolution-0801.mp4":"https://cdn.hailuoai.com/web-assets/videos/resolution-0801.mp4";t.Z=e=>{let{settingType:t,onClick:r}=e,s=(0,a.T)(),p=(0,l.useCallback)(e=>{e.stopPropagation(),r()},[r]);return t===n.gm.MODE||t===n.gm.DURATION||t===n.gm.RATIO?(0,i.jsxs)("div",{className:"relative w-full",children:[(0,i.jsxs)("div",{className:"text-hl_brand_01 flex items-center px-3 py-3 text-[13px] font-[500]",children:[(0,i.jsx)(u.Bf,{className:"text-hl_brand_01"}),(0,i.jsx)("span",{className:"ml-1.5",children:s("premium_benef
1its_popup_title")})]}),(0,i.jsx)("div",{className:"bg-hl_white_04 h-[1px] w-full"}),(0,i.jsxs)("div",{className:"px-3 py-3",children:[(0,i.jsx)("div",{className:"text-hl_text_00 text-[12px] leading-[18px]",children:t===n.gm.MODE?s("premium_benefits_popup_faster"):t===n.gm.DURATION?s("premium_benefits_popup_longer"):t===n.gm.RATIO?s("veo_3_1_upgrade_body"):void 0}),(0,i.jsx)("div",{className:"group/button option-upgrade-btn mt-3 flex h-8 cursor-pointer items-center justify-center text-[13px] font-[500]",onClick:p,children:s("upgrade_now_text")})]})]}):t===n.gm.RESOLUTION?(0,i.jsxs)("div",{className:"relative w-full overflow-hidden px-5 pb-4 pt-5",children:[(0,i.jsx)("div",{className:"flex h-5 items-center",children:(0,i.jsx)("span",{className:"text-hl_brand_01 whitespace-nowrap text-[15px] font-[500] leading-5",children:s("high_resolution_benefit")})}),(0,i.jsx)("div",{className:"leading-4.5 h-4.5 text-hl_text_03 mt-2 flex items-center whitespace-nowrap text-[12px]",children:s("premium_feature_explanation")}),(0,i.jsx)("div",{className:"border-w08 relative mt-4 h-[176px] w-[314px] overflow-hidden rounded-xl border-[1px] border-solid",children:(0,i.jsx)(o.e9,{url:d,state:c.d.play,controls:!1,cover:h,containerClassName:"h-[176px] w-[314px] z-1 overflow-hidden",videoElementClassName:"h-[176px] w-[314px] object-cover"})}),(0,i.jsx)("div",{className:"group/button option-upgrade-btn mt-4 flex h-[36px] cursor-pointer items-center justify-center text-[14px] font-[500]",onClick:p,children:s("subscribe_button")})]}):null}},99419:function(e,t,r){"use strict";r.d(t,{k:function(){return eR},Z:function(){return eM}});var i=r(11719),l=r(77804),n=r(88661),a=r(53561),s=r(37635),o=r(59183),c=r(9016),u=r(59607),d=r.n(u),h=r(46153),p=r(42919),m=r.n(p),f=r(15630),v=r(93340);let g=e=>t=>o.W_.isElement(t)&&t.type===f.GH.CAMERA&&t.data.id===e,x=(e,t)=>{o.YR.insertNodes(e,{type:f.GH.CAMERA,children:[{text:""}],data:t,isEditing:!0,isDeleting:!1})},_=(e,t)=>{o.YR.removeNodes(e,{at:[],match:g(t)})},C=(e,t)=>{w(e,t.id);let[r]=o.ML.nodes(e,{at:[],match:g(t.id)});r?o.YR.setNodes(e,{data:t,isEditing:!0},{at:[],match:g(t.id)}):x(e,t)},w=(e,t)=>{o.YR.setNodes(e,{isEditing:void 0},{at:[],match:e=>o.W_.isElement(e)&&e.type===f.GH.CAMERA&&!0===e.isEditing&&e.data.id!==t})},b=(e,t)=>{o.YR.setNodes(e,{isDeleting:!0},{at:[],match:e=>e===t})},y=e=>{o.YR.setNodes(e,{isDeleting:void 0},{at:[],match:e=>f.y1.confirmable(e)&&!0===e.isDeleting})},k=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{[...e.children].forEach(t=>e.apply({type:"remove_node",path:[0],node:t})),t.nodes&&(o.NB.isNode(t.nodes)?[t.nodes]:t.nodes).forEach((t,r)=>e.apply({type:"insert_node",path:[r],node:t}));let r=t.at&&o.E9.isPoint(t.at)?t.at:o.ML.end(e,[]);r&&o.YR.select(e,r)}catch(e){(0,v.I)({id:"slate_editor_error",function:"resetNodes",message:e.message})}};var R=r(36825),M=r(83574),j=r(98682),S=r(73959),E=r(21217),N=(e,t)=>{var r,i,l;let a=(0,S.s)(),s=(0,j.Z)(),c=null!==(r=null==t?void 0:t.promptStruct)&&void 0!==r?r:a,u=t?t.pendingPromptStruct:s.pendingPromptStruct,d=null!==(i=null==t?void 0:t.syncPromptValue)&&void 0!==i?i:s.syncPromptValue,p=null!==(l=null==t?void 0:t.onPromptReplaced)&&void 0!==l?l:s.onPromptReplaced,{currentModelEntity:g}=(0,M.ZP)(),x=!!g,_=!!(null==g?void 0:g.enableCamera)&&g.mode!==E.O.EXTEND,C=!t,w=s.cameraBackup,N=s.saveCameraBackup,D=s.removeCameraBackup,T=(0,h.v9)(e=>
1e.create.workSpace),A=(0,n.useRef)(!1),P=(0,n.useRef)(0),L=(0,n.useRef)(0),I=(0,n.useRef)(c);I.current=c;let F=(0,n.useMemo)(()=>m()(e=>{d(e)},100),[d]);(0,n.useEffect)(()=>()=>{F.flush()},[F]),(0,n.useEffect)(()=>{if(e.isRejectingOperation){p(),e.isRejectingOperation=!1;return}if(u){var t,r,i,l,n,a,s,o,c,d,h,m;let f=I.current,g=null!==(a=null===(t=f.text)||void 0===t?void 0:t.trim())&&void 0!==a?a:"",x=null!==(s=null===(r=u.text)||void 0===r?void 0:r.trim())&&void 0!==s?s:"",_=null!==(o=null===(l=e.promptStruct)||void 0===l?void 0:null===(i=l.text)||void 0===i?void 0:i.trim())&&void 0!==o?o:"";if(g===x&&_===x)p(),A.current=!1,P.current=0;else if(u.text!==(null===(n=e.promptStruct)||void 0===n?void 0:n.text)&&!A.current){let t=Date.now();if(t-L.current>1e3&&(P.current=0),P.current>=3){(0,v.I)({id:"prompt_sync_infinite_loop_detected",prompt_text_length:null!==(h=null===(c=f.text)||void 0===c?void 0:c.length)&&void 0!==h?h:0,pending_text_length:null!==(m=null===(d=u.text)||void 0===d?void 0:d.length)&&void 0!==m?m:0,retry_count:P.current}),p(),A.current=!1,P.current=0;return}A.current=!0,P.current++,L.current=t,e.skipLengthCheck=!0;try{k(e,{nodes:u.value})}finally{e.skipLengthCheck=!1}}}else A.current=!1,P.current=0},[u,p]);let H=(0,n.useRef)(u);H.current=u;let O=(0,n.useRef)(T);return(0,n.useEffect)(()=>{if(!C)return;let t=O.current;if(O.current=T,t!==T&&!u){e.skipLengthCheck=!0;try{k(e,{nodes:c.value})}finally{e.skipLengthCheck=!1}e.promptStruct=c}},[T]),(0,n.useEffect)(()=>{if(C&&x){if(!_){if((0,R.o0)(c)){N(c);let t=(0,R.ev)(c);e.skipLengthCheck=!0;try{k(e,{nodes:t.value})}finally{e.skipLengthCheck=!1}e.promptStruct=t,d(t)}return}if(w){var t,r,i,l;let n=null!==(i=null===(t=(0,R.ev)(w).text)||void 0===t?void 0:t.trim())&&void 0!==i?i:"";if((null!==(l=null===(r=c.text)||void 0===r?void 0:r.trim())&&void 0!==l?l:"")===n){e.skipLengthCheck=!0;try{k(e,{nodes:w.value})}finally{e.skipLengthCheck=!1}e.promptStruct=w,d(w)}D()}}},[C,x,_,c,w,e,d,N,D]),{promptStruct:u||c,onEditChange:(0,n.useCallback)(t=>{let r=(0,R.XZ)(t);e.promptStruct=r,F(r),H.current&&p(),A.current=!1,P.current=0},[F,p]),onKeyDown:(0,n.useCallback)(t=>{if("Backspace"===t.key){let r=e.selection;if(r&&o.e6.isCollapsed(r)){let[i]=o.e6.edges(r),l=o.ML.before(e,i,{distance:1,voids:!0});if(l){let r=o.ML.node(e,l.path.slice(0,2));if(r){let[i]=r;if(f.y1.confirmable(i)&&!i.isDeleting){b(e,i),t.preventDefault();return}}}}}else"ArrowRight"===t.key&&y(e)},[])}},D=r(19914),T=e=>{let t=(0,h.I0)(),r=(0,h.v9)(e=>e.templateConfig.editingCameraMark);return(0,n.useEffect)(()=>{r?r.motions.length>0?C(e,r):_(e,r.id):w(e)},[r]),{finishEditCameraMark:(0,n.useCallback)(()=>{t((0,D.j0)())},[])}},A=r(47493),P=r(26015),L=r(5243),I=r(28406),F=r(77269),H=r(71596),O=r(41673);let U=(e,t)=>{if(e.length<=t)return e;let r=e.slice(0,t);return r.endsWith("\r")&&(r=r.slice(0,-1)),r},B=!F.BB,V=e=>function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];if(!B)return};var Z=e=>{let{isVoid:t,isInline:r,apply:l,splitNodes:n,insertNodes:a,insertText:s,insertData:c}=e;e.instanceId=(0,L.x0)(10);let u=V(e.instanceId);u("created");let d=!1,h=!1,p=()=>{if(d){if(h)return;h=!0}H.Z.warn((0,O.getTranslation)("toast_char_limit_warn")),(0,v.I)({id:"word_limit_toast_view"})},m=t=>{u("applyAndReverse",t);try{e.isRejectingOperation=!0,l(t),l(o.OX.inverse(t))}catch(e){console.error("withPromptMarks applyAndReverse error",e)}};return e.apply=t=>{if(e.skipLengthCheck){try{l(t)}catch(e){console.error("withPromptMarks apply (skipLengthCheck) error",e)}return}let r=(0,I.xl)()+1,n=(0,R.Zp)(e);if(u("pre-apply",t),"insert_text"===t.type){if(y(e),r<=n){m(t),p();return}let i=r-n;i<t.text.length&&(t.text=t.text.slice(0,i),p())}else if("insert_node"===t.type){if(y(e),(0,R.Zp)(t.node)+n>r){let e=r-n;if(e>1&&o.W_.isElement(t.node)&&t.node.type===f.GH.PARAGRAPH&&1===t.node.children.length&&o.xv.isText(t.node.children[0]))t.node=(0,P._)((0,i._)({},t.node),{children:[{text:t.node.children[0].text.slice(0,e-1)}]}),p();else{m(t),p();return}}}else if("split_node"===t.type){if(y(e),r<n){m(t),p();return}}else"set_selection"===t.type&&y(e);try{l(t)}catch(e){console.error("withPromptMarks apply error",e)}},e.splitNodes=t=>{let r=(0,I.xl)()+1,i=(0,R.Zp)(e);if(u("splitNodes",t,i),r<i){p();return}try{n(t)}catch(e){console.error("withPromptMarks splitNodes error",e)}},e.insertText=(e,t)=>
1{try{s(e,t)}catch(e){console.error("withPromptMarks insertText error",e)}},e.insertNodes=(e,t)=>{try{a(e,t)}catch(e){console.error("withPromptMarks insertNodes error",e)}},e.isInline=e=>e.type===f.GH.CAMERA||e.type===f.GH.ASSET_MENTION||r(e),e.isVoid=e=>e.type===f.GH.CAMERA||e.type===f.GH.ASSET_MENTION||t(e),e.insertData=t=>{let r=t.getData("text/plain");if(!r){c(t);return}let i=r.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),l=(0,I.xl)()+1-(0,R.Zp)(e);if(l<=0){p();return}if(i.length<=l){c(t);return}d=!0,h=!1;try{U(i,l).split("\n").forEach((t,r)=>{r>0&&o.YR.splitNodes(e,{always:!0}),t&&o.ML.insertText(e,t)}),p()}catch(e){console.error("withPromptMarks insertData error",e)}finally{d=!1,h=!1}},e},W=r(5401),G=r(11679),q=r(76106),X=r(82756),K=r(28037);let z=function(e){var t,r,i,l,n,a,s;let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:W.h.getState(),c=null==e?void 0:null===(t=e.getAtContext)||void 0===t?void 0:t.call(e);return!!(0,q.CN)(o.modelDomain,null!==(l=null!==(i=null==c?void 0:c.modelId)&&void 0!==i?i:o.create.currentCreateModelId)&&void 0!==l?l:void 0,null!==(n=null==c?void 0:c.modelMode)&&void 0!==n?n:o.dataConfig.modelMode,null!==(a=null==c?void 0:c.workSpace)&&void 0!==a?a:o.create.workSpace)&&((null==e?void 0:e.getUploadedAssets)?e.getUploadedAssets():null!==(s=null===(r=o.create.createTabsData[o.create.workSpace])||void 0===r?void 0:r.uploadedImages)&&void 0!==s?s:[]).some(e=>e.status===X.Z0.success)},Y=e=>{let t;let{selection:r}=e;if(!r||!o.e6.isCollapsed(r))return null;let i=r.anchor,l=o.ML.before(e,i,{unit:"character"});if(!l)return null;try{t=o.ML.string(e,o.ML.range(e,l,i))}catch(e){return null}return"@"!==t?null:{triggerPoint:i}},Q=()=>{let e=window.getSelection();if(!e||0===e.rangeCount)return null;let t=e.getRangeAt(0).getBoundingClientRect();if(0===t.width&&0===t.height&&0===t.top)return null;let r=t.left;try{let{anchorNode:t,anchorOffset:i}=e;if((null==t?void 0:t.nodeType)===Node.TEXT_NODE&&i>0){let e=document.createRange();e.setStart(t,i-1),e.setEnd(t,i);let l=e.getBoundingClientRect();l.width>0&&(r=l.left)}}catch(e){}return{x:t.left,xWithAt:r,yTop:t.top,yBottom:t.bottom}},J=e=>{let t=W.h.getState();if(t.assetMention.isOpen)return;let r=Y(e);if(!r||!z(e,t))return;let i=Q();i&&W.h.dispatch((0,G.t1)({anchorPoint:i,triggerPoint:r.triggerPoint,isReopenedByFocus:!0}))},$=e=>{let{insertText:t,deleteBackward:r,onChange:i,insertData:l}=e;return e.insertText=(r,i)=>{if(" "===r&&W.h.getState().assetMention.isOpen){W.h.dispatch((0,G.De)()),t(r,i);return}if("@"===r&&z(e)){t(r,i);let{selection:l}=e;if(l&&o.e6.isCollapsed(l)){let e=l.anchor;requestAnimationFrame(()=>{let t=Q();t&&W.h.dispatch((0,G.t1)({anchorPoint:t,triggerPoint:e}))})}return}t(r,i)},e.deleteBackward=t=>{let{isOpen:i}=W.h.getState().assetMention;if(i){let{selection:i}=e;if(i&&o.e6.isCollapsed(i)){let[l]=o.e6.edges(i),n=o.ML.before(e,l,{unit:"character"});if(n){let i=o.ML.range(e,n,l);if("@"===o.ML.string(e,i)){W.h.dispatch((0,G.De)()),r(t);return}}}}r(t)},e.insertData=t=>{let r=t.getData("application/x-slate-fragment");if(r)try{var i,n;let t=JSON.parse(decodeURIComponent(window.atob(r))),l=W.h.getState(),a=e.getUploadedAssets?e.getUploadedAssets():null!==(n=null===(i=l.create.createTabsData[l.create.workSpace])||void 0===i?void 0:i.uploadedImages)&&void 0!==n?n:[],s=(0,K.xb)(t,a);o.YR.insertFragment(e,s);return}catch(e){console.error("[withAssetMention] insertData filter error",e)}l(t)},e.onChange=t=>{let r=[...e.operations];null==i||i(t);let{isOpen:l,triggerPoint:n,isReopenedByFocus:a,anchorPoint:s}=W.h.getState().assetMention;if(l){if(!n){W.h.dispatch((0,G.De)());return}let{selection:t}=e;if(!t||!o.e6.isCollapsed(t)){W.h.dispatch((0,G.De)());return}let i=t.anchor;if(o.E9.isBefore(i,n)){W.h.dispatch((0,G.De)());return}if(a){if(r.every(e=>"set_selection"===e.type)){o.E9.equals(i,n)||W.h.dispatch((0,G.De)());return}if(!s){console.error("[withAssetMention] anchorPoint is null while isOpen=true, closing menu"),W.h.dispatch((0,G.De)());return}W.h.dispatch((0,G.t1)({anchorPoint:s,triggerPoint:n,isReopenedByFocus:!1}))}try{let t=o.ML.string(e,{anchor:n,focus:i}
1);W.h.dispatch((0,G.J7)(t))}catch(e){W.h.dispatch((0,G.De)())}return}r.length>0&&r.every(e=>"set_selection"===e.type||"remove_text"===e.type)&&requestAnimationFrame(()=>J(e))},e};var ee=r(8220),et=r(49598);let er=()=>{let e=document.querySelectorAll("#".concat(I.xh));null==e||e.forEach(e=>{e.blur()})};var ei=r(20826),el=e=>{let{attributes:t,element:r}=e,{data:n,isDeleting:a,isEditing:o}=r,c=(0,s.vt)(),{editCameraCompose:u}=(0,et.j)(),p=(0,h.I0)(),m=(0,h.v9)(e=>e.create.currentCreateTabKey);return 0===n.motions.length?null:(0,l.jsx)("span",{contentEditable:!1,onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onTouchStart:e=>{e.preventDefault(),e.stopPropagation()},className:d()("camera-mark-span inline-block",{selecting:!a&&!o&&c}),children:(0,l.jsx)("span",(0,P._)((0,i._)({},t),{onClick:e=>{e.preventDefault(),e.stopPropagation(),u(n),p((0,D.uA)(ee.E.CAMERA)),(0,v.I)({id:"camera_movement_label_click",camera_movement:n.motions.map(e=>e.id).join(","),function:m}),er()},contentEditable:!1,className:d()("camera-mark-span-inner inline-block cursor-pointer select-none",{editing:o,deleting:a}),children:(0,ei.Ae)(n)}))})},en=r(30390),ea=r(96637),es=r(6578),eo=r(28733);let ec=()=>(0,l.jsx)("span",{contentEditable:!1,className:"text-[0px]",children:String.fromCodePoint(160)});var eu=e=>{let{attributes:t,children:r,element:n}=e,{data:a,isDeleting:o}=n,c=(0,s.vt)(),u=a.coverUrl||a.url,h=a.assetFileType===ea.d.Audio,p=a.variant===f.q4.VideoExtend,m=(0,eo.T)();return(0,l.jsxs)("span",(0,P._)((0,i._)({},t),{contentEditable:!1,className:d()("asset-mention-tag inline-flex h-[24px] -translate-y-[1px] select-none items-center rounded-[6px] px-[6px] align-middle leading-[0]","text-hl_text_02 hover:bg-hl_bg_05 cursor-default",{"bg-hl_bg_05":c||o}),children:[(0,l.jsx)(ec,{}),(0,l.jsx)(en.d,{data:a,children:(0,l.jsxs)("span",{className:"inline-flex items-center gap-1",children:[p&&(0,l.jsx)("span",{className:"truncate text-[14px] font-normal leading-[20px]",children:m("h3_creation_extend_title")}),u&&(0,l.jsxs)("span",{className:"relative inline-flex h-[16px] w-[16px] flex-shrink-0",children:[(0,l.jsx)("img",{src:u,alt:"asset-".concat(a.name),className:"h-full w-full rounded-[4px] object-cover",draggable:!1}),h&&(0,l.jsx)("span",{className:"absolute inset-0 flex items-center justify-center",children:(0,l.jsx)(es.GG,{className:"h-[8px] w-[8px]"})})]}),(0,l.jsx)("span",{className:"truncate text-[14px] font-normal leading-[20px]",children:a.name})]})}),r,(0,l.jsx)(ec,{})]}))},ed=e=>{let{attributes:t,children:r,element:n}=e;switch(n.type){case f.GH.CAMERA:return(0,l.jsx)(el,(0,i._)({},e));case f.GH.ASSET_MENTION:return(0,l.jsx)(eu,(0,i._)({},e));default:return(0,l.jsx)("p",(0,P._)((0,i._)({},t),{children:r}))}},eh=e=>{let{attributes:t,children:r,leaf:n}=e;return(0,l.jsx)("span",(0,P._)((0,i._)({className:""===n.text?"pl-[0.1px]":null},t),{children:r}))};class ep extends n.Component{static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,t){(0,v.I)({id:"slate_editor_error",function:"ErrorBoundary",message:e.message}),o.YR.deselect(this.props.editor)}render(){return this.state.hasError&&this.props.fallback?this.props.fallback:this.props.children}constructor(e){super(e),this.state={hasError:!1}}}var em=r(21764),ef=r(27879),ev=r(60821),eg=r(15484);let ex=null,e_=e=>{ex=e},eC=e=>{ex===e&&(ex=null)};var ew=(e,t)=>{let r=(0,h.I0)(),i=(0,h.v9)(e=>e.assetMention.isOpen),l=(0,h.v9)(e=>e.assetMention.selectedIndex),a=(0,h.v9)(e=>e.assetMention.triggerPoint),c=(0,n.useCallback)((t,i)=>{try{let r={type:f.GH.ASSET_MENTION,data:(0,K.db)(t,i),children:[{text:""}]};if(a){var l;let{selection:t}=e;if(!t)return;let i=null!==(l=o.ML.before(e,a,{unit:"character"}))&&void 0!==l?l:a;o.YR.delete(e,{at:{anchor:i,focus:t.anchor}}),o.YR.insertNodes(e,r)}else s.F3.focus(e),e.selection||o.YR.select(e,o.ML.end(e,[])),o.YR.insertNodes(e,r);if(e.selection){let t=o.ML.after(e,e.selection);t&&o.YR.select(e,t)}s.F3.focus(e)}catch(e){console.error("insertAssetMentionNode error",e)}finally{r((0,G.De)())}},[e,a,r]),u=(0,n.useCallback)(e=>{if(i)switch(e.key){case"ArrowDown":{e.preventDefault();let i=l<t-1?l+1:l;r((0,G.Q6)(i));break}case"ArrowUp":{e.preventDefault();let t=l>0?l-1:0;r((0,G.Q6)(t));break}case"Enter":case"Tab":e.preventDefault(),e.stopPropagation();break;case"Escape":e.preventDefault(),r((0,G.De)())}},[i,l,t,r]);return(0,n.useEffect)(()=>
1{if(i)return document.addEventListener("keydown",u,!0),()=>{document.removeEventListener("keydown",u,!0)}},[i,u]),{insertAssetMentionNode:c}},eb=e=>{let{item:t,displayName:r,isActive:i,onMouseEnter:n,onMouseLeave:a,onClick:s}=e,o=r||t.name||t.uuid,c=t.coverUrl||t.url,u="durationMs"in t?t.durationMs:void 0,h="duration"in t?t.duration:void 0,p=u?u/1e3:null!=h?h:0,m=t.assetFileType===ea.d.Audio;return(0,l.jsxs)("div",{className:d()("flex cursor-pointer items-center rounded-[8px] p-2 transition-colors",i?"bg-hl_bg_05":"hover:bg-hl_bg_05"),onMouseEnter:n,onMouseLeave:a,onMouseDown:e=>{e.preventDefault(),s()},children:[(0,l.jsxs)("div",{className:"bg-hl_bg_03 relative h-8 w-8 flex-shrink-0 overflow-hidden rounded-[8px]",children:[c?(0,l.jsx)("img",{src:c,alt:"asset-".concat(o),className:"h-full w-full object-cover",draggable:!1}):(0,l.jsx)("div",{className:"bg-hl_bg_03 h-full w-full"}),m&&(0,l.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,l.jsx)(es.GG,{className:"h-4 w-4"})}),p>0&&(0,l.jsx)("div",{className:"absolute bottom-0 left-0 right-0 flex items-center justify-center px-[2px] pb-[2px] pt-[1px]",children:(0,l.jsx)("span",{className:"text-[8px] leading-[10px] text-white [text-shadow:0_1px_1px_rgba(0,0,0,0.5)]",children:"".concat((Math.round(10*p)/10).toFixed(1),"s")})})]}),(0,l.jsx)("span",{className:"text-hl_text_00 truncate pl-[6px] text-[14px] font-normal",children:o})]})},ey=e=>{let{editor:t,uploadedImages:r,onHoverPreviewChange:s}=e,o=(0,h.I0)(),c=(0,eo.T)(),u=(0,h.v9)(e=>e.assetMention.isOpen),d=(0,h.v9)(e=>e.assetMention.searchQuery),p=(0,h.v9)(e=>e.assetMention.selectedIndex),m=(0,h.v9)(e=>e.assetMention.anchorPoint),[,f]=(0,n.useState)(null),v=(0,n.useRef)(null),g=(0,n.useMemo)(()=>(0,K.Co)(r,c),[r,c]),x=(0,n.useMemo)(()=>{let e=r.filter(e=>e.status===X.Z0.success);if(!d.trim())return e;let t=d.toLowerCase();return e.filter(e=>(g.get(e.uuid)||e.name||e.uuid).toLowerCase().includes(t))},[r,d,g]);(0,n.useEffect)(()=>{u&&d.length>0&&0===x.length&&o((0,G.De)())},[u,d,x.length,o]);let{insertAssetMentionNode:_}=ew(t,x.length),C=(0,n.useCallback)((e,t)=>{f(e),o((0,G.Q6)(t));let r=g.get(e.uuid)||e.name||e.uuid;null==s||s(r)},[o,s,g]),w=(0,n.useCallback)(()=>{f(null),null==s||s(null)},[s]),b=(0,n.useCallback)(e=>{let t=g.get(e.uuid);_(e,t),f(null),null==s||s(null)},[_,s,g]);(0,n.useEffect)(()=>{if(!u)return;let e=e=>{if("Enter"===e.key||"Tab"===e.key){let t=x[p];t&&(e.preventDefault(),e.stopPropagation(),b(t))}};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}},[u,p,x,b]),(0,n.useEffect)(()=>{if(!u)return;let e=e=>{v.current&&!v.current.contains(e.target)&&o((0,G.De)())},t=setTimeout(()=>{document.addEventListener("mousedown",e,!0)},0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e,!0)}},[u,o]),(0,n.useEffect)(()=>{if(!u)return;let e=e=>{v.current&&v.current.contains(e.target)||o((0,G.De)())};return window.addEventListener("scroll",e,!0),()=>{window.removeEventListener("scroll",e,!0)}},[u,o]),(0,n.useEffect)(()=>{var e;if(!u)return;let t=null===(e=v.current)||void 0===e?void 0:e.children[p];null==t||t.scrollIntoView({block:"nearest"});let r=x[p];if(!r){null==s||s(null);return}let i=g.get(r.uuid)||r.name||r.uuid;null==s||s(i)},[u,p,x,g,s]);let y=(0,n.useMemo)(()=>{if(!m)return{display:"none"};let{x:e,yTop:t,yBottom:r}=m,l=window.innerHeight-r,n=x.length>5;return(0,i._)((0,P._)((0,i._)({position:"fixed",left:e-16},l<256?{bottom:window.innerHeight-t+2}:{top:r+2}),{zIndex:999,minWidth:192,borderRadius:12,border:"1px solid var(--hl_line_02)",background:"var(--hl_bg_03)",boxShadow:"0 4px 20px 0 rgba(0, 0, 0, 0.10)",backdropFilter:"blur(25px)",WebkitBackdropFilter:"blur(25px)",padding:"4px"}),n?{maxHeight:248,overflowY:"auto",scrollbarWidth:"none"}:{overflow:"hidden"})},[m,x.length]);return u&&0!==x.length?(0,a.createPortal)((0,l.jsx)("div",{ref:v,style:y,onMouseDown:e=>e.preventDefault(),children:x.map((e,t)=>(0,l.jsx)(eb,{item:e,displayName:g.get(e.uuid),isActive:t===p,onMouseEnter:()=>C(e,t),onMouseLeave:w,onClick:()=>b(e)},e.uuid))}),document.body):null};r(38585);let ek=(e,t)=>{let r=t.startContainer.parentElement;if(!r)return;let i=r.closest(".overflow-y-auto");if(!i)return;let l=t.getBoundingClientRect(),n=i.getBoundingClientRect(),a=l.top-n.top,s=l.bottom-n.top,o=i.clientHeight;if(a>=0&&s<=o)return;let c=0;a<0?c=a:s>o&&(c=s-o),i.scrollTo({top:i.scrollTop+c,behavior:"instant"})},eR=e=>{let{className:t,placeholder:r,onCompositionStart:u,onCompositionEnd:p,onSelectionChange:m,compact:f=!1,onSubmit:v,storeAdapter:g,externalUploadedImages:x,externalAtContext:_}=e,C=(0,n.useMemo)(()=>
1$(Z((0,c.VC)((0,s.BU)((0,o.Jh)())))),[]),w=(0,n.useRef)(x);w.current=x,(0,n.useEffect)(()=>{x&&(C.getUploadedAssets=()=>{var e;return null!==(e=w.current)&&void 0!==e?e:[]})},[C,!!x]);let b=(0,n.useRef)(_);b.current=_,(0,n.useEffect)(()=>{void 0!==_&&(C.getAtContext=()=>{var e;return null!==(e=b.current)&&void 0!==e?e:{}})},[C,void 0!==_]),(0,n.useEffect)(()=>(e_(C),()=>{eC(C)}),[C]);let y=(0,n.useCallback)(e=>(0,l.jsx)(ed,(0,i._)({},e)),[]),k=(0,n.useCallback)(e=>(0,l.jsx)(eh,(0,i._)({},e)),[]),R=(0,n.useRef)(!1),M=(0,n.useRef)(!1),{promptStruct:j,onEditChange:S,onKeyDown:E}=N(C,g),{finishEditCameraMark:D}=T(C),P=(0,A.i)(),L=null!=x?x:P.uploadedImages,[F,H]=(0,n.useState)(null),O=(0,h.v9)(e=>e.assetMention.anchorPoint),U=(0,h.v9)(e=>e.assetMention.searchQuery),B=(0,h.v9)(e=>e.assetMention.isOpen),V=(0,h.v9)(e=>e.assetMention.triggerPoint),W=(0,n.useMemo)(()=>F&&O&&!U?{left:O.xWithAt,text:"@".concat(F)}:null,[F,U,O]),G=(0,n.useCallback)(()=>{M.current=!0,null==u||u()},[u]),q=(0,n.useCallback)(()=>{M.current=!1,null==p||p()},[p]),X=(0,n.useCallback)(e=>{if(!M.current){if(B&&("Enter"===e.key||"Tab"===e.key)){e.preventDefault();return}if("Enter"===e.key){(e.shiftKey||e.metaKey||e.ctrlKey)&&(e.preventDefault(),null==v||v());return}E(e)}},[E,v,B]),K=(0,n.useCallback)(e=>{let t=C.operations.some(e=>"set_selection"!==e.type),r=C.operations.some(e=>"set_selection"===e.type);(r||R.current)&&(null==m||m(),R.current=r),t&&S(e)},[C,S,m]),z=(0,n.useCallback)(()=>{D(),requestAnimationFrame(()=>J(C))},[C,D]),Y=(0,n.useCallback)(e=>{var t,r;let i=Array.from(null!==(r=null===(t=e.dataTransfer)||void 0===t?void 0:t.types)&&void 0!==r?r:[]);(i.includes("Files")||i.includes("text/uri-list"))&&e.preventDefault()},[]);return(0,l.jsxs)("div",{className:f?"h-[24px] overflow-hidden relative prompt-input-compact":"h-full overflow-y-auto",content:"notranslate",translate:"no",children:[(0,l.jsx)(s.mH,{editor:C,initialValue:j.value,onChange:K,children:(0,l.jsx)(ep,{editor:C,children:(0,l.jsx)(s.CX,{id:I.xh,renderElement:y,renderLeaf:k,onKeyDown:X,onCompositionStart:G,onCompositionEnd:q,onFocus:z,onDrop:Y,placeholder:r,className:d()("border-none outline-none",t),scrollSelectionIntoView:ek})})}),(0,l.jsx)(ey,{editor:C,uploadedImages:L,onHoverPreviewChange:V?H:void 0}),W&&O&&"undefined"!=typeof document&&(0,a.createPortal)((0,l.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none select-none rounded-[6px] px-[6px] text-[14px] font-normal",style:{position:"fixed",left:W.left,top:O.yTop,height:O.yBottom-O.yTop,lineHeight:"".concat(O.yBottom-O.yTop,"px"),whiteSpace:"nowrap",zIndex:9998,background:"var(--hl_bg_04)"},children:W.text.startsWith("@")?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("span",{className:"text-hl_text_01",children:"@"}),(0,l.jsx)("span",{className:"text-hl_text_03",children:W.text.slice(1)})]}):(0,l.jsx)("span",{className:"text-hl_text_03",children:W.text})}),document.body)]})};var eM=n.memo(e=>{let[t,r]=(0,n.useState)(""),[a,s]=(0,n.useState)({left:0,top:0}),o=(0,n.useRef)(null),c=(0,n.useRef)(null),u=(0,n.useRef)(null),d=(0,eo.T)(),{isTouchSupported:p}=(0,ef.qr)(),f=(0,h.I0)(),{startCameraCompose:g}=(0,et.j)(),{currentModelEntity:x}=(0,M.ZP)(),_=(null==x?void 0:x.enablePreset)===!0,C=!!t&&_,w=(0,n.useCallback)(()=>{var e,t;let i=window.getSelection();if(!i||0===i.toString().trim().length)return r(""),!1;let l=i.getRangeAt(0).getBoundingClientRect(),n=null===(e=o.current)||void 0===e?void 0:e.getBoundingClientRect();return n&&l.top>=n.top-10&&l.bottom<=n.bottom+50&&l.left>=n.left-10&&l.right<=n.right+10?(s({left:l.left+l.width/2-n.left,top:l.bottom-n.top+6}),r((null===(t=i.toString())||void 0===t?void 0:t.replace(/\n+/g,"\n"))||""),!0):(r(""),!1)},[]),b=(0,n.useRef)(m()(()=>{w()},200));(0,n.useEffect)(()=>(b.current=m()(()=>{w()},200),()=>{b.current.cancel()}),[w]);let y=(0,n.useCallback)(()=>{b.current()},[]);(0,n.useEffect)(()=>{if(!C)return;let e=e=>{var t,i;let l=e.target;(null===(t=u.current)||void 0===t||!t.contains(l))&&((null===(i=o.current)||void 0===i?void 0:i.contains(l))||r(""))},t=setTimeout(()=>{document.addEventListener("mousedown",e,!0)},0);return()=>{clearTimeout(t),document.removeEventListener("mousedown",e,!0)}},[C]),(0,n.useEffect)(()=>
1{if(!C)return;let e=e=>{"Escape"===e.key&&r("")};return document.addEventListener("keydown",e),()=>{document.removeEventListener("keydown",e)}},[C]);let k=(0,n.useCallback)(()=>{if((0,v.I)({id:"content_add_to_preset_click"}),!(0,ev.Xx)())return r(""),(0,ev.Mo)("create"),!1;requestAnimationFrame(()=>{f((0,D.uA)(ee.E.PRESET)),f((0,D.$3)(eg.p.PERSONAL)),g(),f((0,D.xo)({title:"",prompt:t})),r("")})},[t,f,g]),R=(0,P._)((0,i._)({},e),{onSelectionChange:y});return p?(0,l.jsx)(eR,(0,i._)({},e)):(0,l.jsxs)("div",{ref:o,className:"relative h-full w-full overflow-hidden",children:[(0,l.jsx)(eR,(0,i._)({},R)),C&&(0,l.jsx)("div",{ref:c,style:{position:"absolute",left:"".concat(a.left,"px"),top:"".concat(a.top,"px"),zIndex:1e3,transform:"translateX(-50%)"},children:(0,l.jsx)(em.Z,{content:()=>(0,l.jsxs)("div",{ref:u,className:"text-hl_text_00 relative flex cursor-pointer items-center justify-center text-[13px] font-normal leading-6",onClick:k,children:[(0,l.jsx)(es._g,{}),(0,l.jsx)("span",{className:"ml-1",children:d("hover_add_presets")})]}),open:C,placement:"bottom",arrow:!1,overlayClassName:"selection-menu-popover",children:(0,l.jsx)("div",{style:{width:1,height:1}})})})]})})},49598:function(e,t,r){"use strict";r.d(t,{h:function(){return s},j:function(){return o}});var i=r(88661),l=r(46153),n=r(19914),a=r(20826);let s=()=>{let e=(0,l.I0)(),t=(0,l.v9)(e=>e.templateConfig.showCameraPanel),r=(0,l.v9)(e=>e.templateConfig.editingCameraMark),s=(0,i.useCallback)((t,i)=>{if(!(null==t?void 0:t.id)){console.error("updateCameraMark error: editingCameraMark is null",r);return}let l=i(t);e((0,n.fb)(l))},[]),o=(0,i.useCallback)(e=>{s(r,t=>(0,a.$u)(t,e))},[r]),c=(0,i.useCallback)(e=>{s(r,t=>(0,a.l)(t,e))},[r]);return{isCameraPanelOpen:t,editingCameraMark:r,updateMotions:o,updateTemplate:c}},o=()=>{let e=(0,l.I0)();return{startCameraCompose:(0,i.useCallback)(()=>{let t=(0,a.kL)();e((0,n.hd)(t))},[]),editCameraCompose:(0,i.useCallback)(t=>{e((0,n.hd)(t))},[]),exitCameraCompose:(0,i.useCallback)(()=>{e((0,n.Jp)())},[])}}},2136:function(e,t,r){"use strict";r.d(t,{v:function(){return s}});var i=r(11719),l=r(46153),n=r(34426),a=r(94662);let s=()=>{let e=(0,l.I0)(),t=(0,l.v9)(e=>e.global.newSettingShowDot),r=(0,l.v9)(e=>e.user.userID),s=(e,t)=>"video_setting_dot_viewed_".concat(r||"guest","_").concat(e,"_").concat(t),o=(e,t)=>{try{let r=s(e,t);return"true"===localStorage.getItem(r)}catch(e){return!1}},c=(e,t)=>{try{let r=s(e,t);localStorage.setItem(r,"true")}catch(e){console.warn("Failed to save dot view cache:",e)}},u=e=>{switch(e){case a.gm.RESOLUTION:return"resolutions";case a.gm.DURATION:return"durations";case a.gm.RATIO:return"aspectRatios";default:return null}},d=(r,l)=>{let a=u(r);a&&t[a]===l&&(o(r,l)||(c(r,l),setTimeout(()=>{let r=(0,i._)({},t);r[a]=null,e((0,n.WH)(r))},2e3)))};return{shouldShowDot:(e,r)=>{let i=u(e);return!!i&&t[i]===r&&!o(e,r)},handleDotExposure:d,triggerAllDotExposure:()=>{[a.gm.RESOLUTION,a.gm.DURATION,a.gm.MODE,a.gm.RATIO].forEach(e=>{let r=u(e);r&&null!==t[r]&&d(e,t[r])})},clearDotCache:(e,t)=>{try{if(void 0!==e&&void 0!==t){let r=s(e,t);localStorage.removeItem(r)}else{let e="video_setting_dot_viewed_".concat(r||"guest","_");Object.keys(localStorage).forEach(t=>{t.startsWith(e)&&localStorage.removeItem(t)})}}catch(e){console.warn("Failed to clear dot cache:",e)}},newSettingShowDot:t}}},31337:function(e,t,r){"use strict";r.d(t,{B:function(){return h}});var i=r(11719),l=r(88661),n=r(46153),a=r(38438),s=r(83130),o=r(83574),c=r(95885),u=r(94662),d=r(96637);function h(e){var t,r;let h=(0,n.I0)(),p=(0,n.v9)(e=>e.create.createTabsData[e.create.workSpace].videoSettings),m=(0,n.v9)(e=>e.create.createTabsData[e.create.workSpace].uploadedImages),f=(0,n.v9)(e=>e.home.videoSettings),v=null!==(t=null==e?void 0:e.videoSettings)&&void 0!==t?t:(null==e?void 0:e.useHomeSlice)?f:p,g=null!==(r=null==e?void 0:e.uploadedImages)&&void 0!==r?r:m,{parameter:x,costs:_,parentEntity:C,currentModelEntity:w}=(0,o.ZP)({modelId:null==e?void 0:e.modelId,videoSettings:v,uploadedImages:g}),b=null==C?void 0:C.category,y=b===u.Ro.video,k=b===u.Ro.image,R=(0,l.useMemo)(()=>[d.d.Video,d.d.Image,d.d.Audio].find(e=>g.some(t=>t.assetFileType===e)),[g]),M="string"==typeof(null==w?void 0:w.mode)?w.mode:void 0,j=(0,l.useMemo)(()=>y&&x?(0,c.eF)(x,_,M?{referenceMode:M,assetFileType:R}:void 0):null,[x,_,y,M,R]),S=(0,l.useMemo)(()=>k&&x?(0,c.ai)(x,_):null,[x,_,k]);(0,l.useEffect)(()=>
1{if(y&&x&&(!(null==v?void 0:v.resolution)||(null==v?void 0:v.duration)===void 0)){let t=(0,c.RB)(x);h(((null==e?void 0:e.useHomeSlice)?s.Dx:a.Dx)((0,i._)({},v,t.resolution&&{resolution:t.resolution},void 0!==t.duration&&{duration:t.duration})))}},[x,y]);let{enabledResolutions:E,enabledDurations:N}=(0,l.useMemo)(()=>y&&j?(0,c.TI)(j,null==v?void 0:v.resolution,null==v?void 0:v.duration):k&&S?{enabledResolutions:S.enabledResolutions,enabledDurations:null}:{enabledResolutions:null,enabledDurations:null},[j,S,y,k,null==v?void 0:v.resolution,null==v?void 0:v.duration]);return{enabledResolutions:E,enabledDurations:N,isResolutionEnabled:e=>null===E||E.has(e),isDurationEnabled:e=>null===N||N.has(e)}}},73342:function(e,t,r){"use strict";r.d(t,{L:function(){return d}});var i=r(88661),l=r(46153),n=r(88370),a=r(77269),s=r(82983),o=r(21217),c=r(54466),u=r(71459);let d=()=>{let e=(0,l.I0)(),t=(0,l.v9)(e=>e.create.workSpace),r=(0,i.useCallback)(function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:u.qM.LocalUpload,i=null!=e?e:o.O.SUBJECT_REFERENCE;if(!(0,u.kf)(i,a.Xy,r))return!1;let l=(0,u.rh)(t,i);return!!l&&!n.storage.getItem(l)},[t]),d=(0,i.useCallback)(function(t,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:o.O.SUBJECT_REFERENCE;(0,c.j2)(t,r),e((0,s.FY)(i)),e((0,s.tj)(!0))},[e]),h=(0,i.useCallback)(function(e,t,i){let l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:u.qM.LocalUpload;return r(e,l)?(d(t,i,e),!0):(t(),!1)},[r,d]);return{needS2VInstruction:r,showS2VInstruction:d,checkAndExecute:h}}},71459:function(e,t,r){"use strict";r.d(t,{Eb:function(){return o},bX:function(){return c},kf:function(){return d},qM:function(){return l},rh:function(){return h}});var i,l,n=r(10322),a=r(21217),s=r(44155);(i=l||(l={})).ModeSwitch="mode_switch",i.LocalUpload="local_upload",i.ExistingAsset="existing_asset";let o=e=>e===a.O.ALL_REFERENCE?{titleKey:"omni_reference_guide",contentKey:"omni_reference_guide_content",fallbackContentKey:"omni_reference_guide_subtitle",contentFormat:"plain-text"}:{titleKey:"popup_s2v_disclaim_title",contentKey:"popup_s2v_disclaim_content",contentFormat:"structured"},c=(e,t)=>{var r;return t?e.contentKey:null!==(r=e.fallbackContentKey)&&void 0!==r?r:e.contentKey},u=(e,t)=>e===a.O.SUBJECT_REFERENCE||e===a.O.ALL_REFERENCE,d=(e,t,r)=>!!u(e,t)&&(e!==a.O.ALL_REFERENCE||"local_upload"===r),h=(e,t)=>t===a.O.SUBJECT_REFERENCE?e===s.Ro.video?n.ry:n.qb:t===a.O.ALL_REFERENCE?e===s.Ro.video?n.Mg:n.nP:null},54466:function(e,t,r){"use strict";r.d(t,{Ab:function(){return a},j2:function(){return n},o4:function(){return c},uU:function(){return s}});let i=null,l=null,n=(e,t)=>{i=e||null,l=t||null},a=()=>{let e=i;o(),null==e||e()},s=()=>{let e=l;o(),null==e||e()},o=()=>{i=null,l=null},c=()=>null!==i||null!==l},17189:function(e,t,r){"use strict";r.d(t,{Z:function(){return e_}});var i=r(77804),l=r(88661),n=r(28733),a=r(42873),s=r(11719),o=r(26015);let c={RULER_HEIGHT:28,VIDEO_TRACK_HEIGHT:80,CLIP_BORDER_RADIUS:6,CLIP_MIN_WIDTH:20,CLIP_PADDING:4,PLAYHEAD_WIDTH:2,PLAYHEAD_HEAD_WIDTH:16,PLAYHEAD_HEAD_HEIGHT:20,DEFAULT_SCALE:100,MIN_SCALE:10,MAX_SCALE:500,ZOOM_FACTOR:1.15,EDGE_DRAG_WIDTH:8,CROP_HANDLE_WIDTH:8,CROP_HANDLE_OUTSET:8,WAVEFORM_BAR_WIDTH:2,WAVEFORM_BAR_GAP:1,TRACK_PADDING_H:6,MIN_TOTAL_DURATION:60},u={BACKGROUND:"#ffffff",RULER_LINE:"#12141F73",RULER_TEXT:"#12141F73",PLAYHEAD:"#15171F",PLAYHEAD_FILL:"#F5F7FF",PLAYHEAD_STROKE:"#000000",VIDEO_CLIP:"#ffffff10",SELECTED_BORDER:"#ffffff",HOVER_BORDER:"#aaaaaa",CLIP_TEXT:"#ffffff",CROP_MASK:"rgba(255, 255, 255, 0.8)",CROP_BORDER:"#000000",CROP_HANDLE:"#000000",CROP_HANDLE_INNER:"#F5F6FF",AUDIO_WAVEFORM:"#7657FF",THUMBNAIL_PLACEHOLDER:"rgba(0, 0, 0, 0.10)",THUMBNAIL_SEPARATOR:"rgba(255, 255, 255, 0.06)"},d={BACKGROUND:"#121316",RULER_LINE:"rgba(224, 229, 255, 0.35)",RULER_TEXT:"rgba(235, 238, 255, 0.65)",PLAYHEAD:"#F5F6FF",PLAYHEAD_FILL:"#F5F6FF",PLAYHEAD_STROKE:"#15171F",VIDEO_CLIP:"rgba(255, 255, 255, 0.06)",SELECTED_BORDER:"#F5F6FF",HOVER_BORDER:"rgba(235, 238, 255, 0.65)",CLIP_TEXT:"#F5F6FF",CROP_MASK:"rgba(18, 19, 22, 0.8)",CROP_BORDER:"#F5F6FF",CROP_HANDLE:"#F5F6FF",CROP_HANDLE_INNER:"#15171F",AUDIO_WAVEFORM:"#7657FF",THUMBNAIL_PLACEHOLDER:"rgba(255, 255, 255, 0.06)",THUMBNAIL_SEPARATOR:"rgba(197, 184, 255, 0.08)"},h={minDuration:2,maxDuration:15},p=[{minScale:400,interval:.5,subDivisions:5},{minScale:200,interval:1,subDivisions:5},{minScale:80,interval:1,subDivisions:5},{minScale:40,interval:2,subDivisions:5},{minScale:15,interval:5,subDivisions:5},{minScale:5,interval:10,subDivisions:5},{minScale:2,interval:30,subDivisions:6},{minScale:0,interval:60,subDivisions:6}],m=[{maxDuration:15,sampleInterval:.5,widthMultiplier:1},{maxDuration:60,sampleInterval:1,widthMultiplier:1},{maxDuration:180,sampleInterval:2,widthMultiplier:1},{maxDuration:600,sampleInterval:5,widthMultiplier:2},{maxDuration:1/0,sampleInterval:10,widthMultiplier:4}];function f(e){var t;return null!==(t=m.find(t=>e<=t.maxDuration))&&void 0!==t?t:m[m.length-1]}
1function v(e,t){let r=f(e),{TRACK_PADDING_H:i,MIN_SCALE:l,MAX_SCALE:n}=c;return Math.max(l,Math.min(n,(t-2*i)*r.widthMultiplier/e))}let g={clips:[],totalDuration:c.MIN_TOTAL_DURATION,currentTime:0,isPlaying:!1,scale:c.DEFAULT_SCALE,scrollX:0,selectedClipIds:new Set,hoverClipId:null,cropRange:null,previewFrame:null};class x{getState(){return this.state}setState(e){Object.keys(e).some(t=>this.state[t]!==e[t])&&(this.state=(0,s._)({},this.state,e),this.emitChange())}setStateSilent(e){this.state=(0,s._)({},this.state,e)}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}emitChange(){for(let e of this.listeners)e()}setCurrentTime(e){let t=Math.max(0,Math.min(e,this.state.totalDuration));this.setState({currentTime:t})}setScale(e){let{MIN_SCALE:t,MAX_SCALE:r}=c;this.setState({scale:Math.max(t,Math.min(e,r))})}setScrollX(e){this.setState({scrollX:Math.max(0,e)})}selectClip(e){e?this.setState({selectedClipIds:new Set([e])}):this.setState({selectedClipIds:new Set})}setHoverClip(e){this.setState({hoverClipId:e})}addClip(e){this.setState({clips:[...this.state.clips,e],totalDuration:Math.max(c.MIN_TOTAL_DURATION,this.state.totalDuration,e.startTime+e.duration)})}updateClip(e,t){this.setState({clips:this.state.clips.map(r=>r.id===e?(0,s._)({},r,t):r)})}removeClip(e){let t=this.state.clips.find(t=>t.id===e);if(t&&!this.state.clips.some(r=>r.id!==e&&r.assetId===t.assetId)){var r;null===(r=this.onAssetOrphan)||void 0===r||r.call(this,t.assetId)}this.setState({clips:this.state.clips.filter(t=>t.id!==e),selectedClipIds:new Set([...this.state.selectedClipIds].filter(t=>t!==e))})}clearAllClips(){let e=new Set;for(let t of this.state.clips)e.add(t.assetId);for(let r of e){var t;null===(t=this.onAssetOrphan)||void 0===t||t.call(this,r)}this.setState({clips:[],selectedClipIds:new Set,hoverClipId:null})}togglePlay(){this.setState({isPlaying:!this.state.isPlaying})}setPreviewFrame(e){let t=this.state.previewFrame;t&&t!==e&&t.close(),this.setState({previewFrame:e})}setCropRange(e){this.setState({cropRange:e})}reset(){let e=this.state.previewFrame;e&&e.close(),this.state=(0,s._)({},g),this.emitChange()}getActions(){return{setCurrentTime:e=>this.setCurrentTime(e),setScale:e=>this.setScale(e),setScrollX:e=>this.setScrollX(e),selectClip:e=>this.selectClip(e),setHoverClip:e=>this.setHoverClip(e),addClip:e=>this.addClip(e),updateClip:(e,t)=>this.updateClip(e,t),removeClip:e=>this.removeClip(e),clearAllClips:()=>this.clearAllClips(),togglePlay:()=>this.togglePlay(),setPreviewFrame:e=>this.setPreviewFrame(e),setCropRange:e=>this.setCropRange(e),setState:e=>this.setState(e)}}constructor(){this.listeners=new Set,this.onAssetOrphan=null,this.state=(0,s._)({},g)}}class _{getWidth(){return this.width}setColors(e){this.colors=e,this.rulerCacheKey="",this.markNeedsRender()}markNeedsRender(){this.needsRender=!0,null!==this.rafId||this.destroyed||(this.rafId=requestAnimationFrame(()=>{this.rafId=null,!this.destroyed&&this.needsRender&&this.render(this.getState())}))}resize(e,t){this.rulerHeight=t.rulerHeight,this.trackGap=t.trackGap;let r=t.rulerHeight+t.trackGap+t.thumbnailHeight;this.width=e,this.height=r;let i=e*this.dpr,l=r*this.dpr;(this.canvas.width!==i||this.canvas.height!==l)&&(this.canvas.width=i,this.canvas.height=l),this.canvas.style.width="".concat(e,"px"),this.canvas.style.height="".concat(r,"px"),this.rulerLayer=new OffscreenCanvas(i,t.rulerHeight*this.dpr),this.rulerCtx=this.rulerLayer.getContext("2d"),this.rulerCacheKey=""}render(e){this.needsRender=!1,this.ctx.setTransform(this.dpr,0,0,this.dpr,0,0),this.clear(),this.drawBackground(),this.drawRulerCached(e),this.drawTrack(e),this.drawCropOverlay(e),this.drawPlayhead(e)}clear(){this.ctx.clearRect(0,0,this.width,this.height)}drawBackground(){if(this.hooks.drawBackground){this.hooks.drawBackground(this.ctx,this.width,this.height);return}this.ctx.fillStyle=this.colors.BACKGROUND,this.ctx.fillRect(0,0,this.width,this.height)}drawRulerCached(e){if(!this.rulerLayer||!this.rulerCtx)return;let t="".concat(e.scale,":").concat(e.scrollX,":").concat(e.totalDuration,":").concat(this.width);
1this.rulerCacheKey!==t&&(this.drawRulerToLayer(e),this.rulerCacheKey=t),this.ctx.drawImage(this.rulerLayer,0,0,this.width,this.rulerHeight)}drawRulerToLayer(e){let t=this.rulerCtx,r=this.rulerHeight;t.setTransform(this.dpr,0,0,this.dpr,0,0),t.clearRect(0,0,this.width,r);let{RULER_LINE:i,RULER_TEXT:l}=this.colors,{TRACK_PADDING_H:n}=c,{scale:a,scrollX:s}=e,o=this.width-n,{interval:u,subDivisions:d}=this.calculateInterval(a),h=Math.floor(s/a/u)*u,p=Math.ceil((s+this.width)/a/u)*u,m=r/2;t.font="11px Inter, sans-serif",t.textBaseline="middle",t.save(),t.beginPath(),t.rect(n,0,o-n,r),t.clip();for(let e=h;e<=p;e+=u){let r=e*a-s+n;if(r>=n-8&&r<=o+8){t.fillStyle=l;let i=function(e){if(e<60)return Number.isInteger(e)?"".concat(e,"s"):"".concat(e.toFixed(1),"s");let t=Math.floor(e/60),r=e%60;return 0===r?"".concat(t,"m"):"".concat(t,":").concat(r.toString().padStart(2,"0"))}(e);r<n+4?(t.textAlign="left",t.fillText(i,n,m)):r>o-4?(t.textAlign="right",t.fillText(i,o,m)):(t.textAlign="center",t.fillText(i,r,m))}let c=r+u/d*(d-1)*a;if(!(r>o)&&!(c<n)){t.fillStyle=i;for(let e=1;e<d;e++){let i=r+u/d*e*a;if(i>o)break;i<n||(t.beginPath(),t.ellipse(i,m,.5,1,0,0,2*Math.PI),t.fill())}}}t.restore()}drawTrack(e){let t=this.rulerHeight+this.trackGap,r=this.height-t,{TRACK_PADDING_H:i}=c,l=this.ctx;l.save(),l.beginPath(),l.rect(i,t,this.width-2*i,r),l.clip(),this.drawClips(e,t),l.restore()}drawClips(e,t){let{CLIP_BORDER_RADIUS:r,CLIP_PADDING:i,TRACK_PADDING_H:l}=c,n=this.height-this.rulerHeight-this.trackGap,{scale:a,scrollX:s,clips:o}=e,u=this.width-l;o.forEach(e=>{var o,c,d,h;let p=e.startTime*a-s+l,m=(e.startTime-e.sourceOffset)*a-s+l,f=e.duration*a,v=t+i,g=n-2*i;if(p+f<l||p>u)return;let x=Math.max(p,l);if(Math.min(p+f,u)-x<=0)return;let _={x:p,y:v,width:f,height:g,sourceX:m};this.ctx.save(),this.drawRoundRect(p,v,f,g,r),this.ctx.fillStyle=this.colors.VIDEO_CLIP,this.ctx.fill(),(null===(o=(c=this.hooks).drawClipContent)||void 0===o?void 0:o.call(c,this.ctx,e,_))||("audio"===e.type?this.drawAudioWaveform(e,p,v,f,g):this.drawVideoThumbnails(e,p,v,f,g,m)),null===(d=(h=this.hooks).drawClipOverlay)||void 0===d||d.call(h,this.ctx,e,_),this.ctx.restore()})}drawVideoThumbnails(e,t,r,i,l,n){if(!this.thumbnailStore.has(e.assetId)){let e=this.ctx;e.save();let n=c.CLIP_BORDER_RADIUS;this.drawRoundRect(t,r,i,l,n),e.clip(),e.fillStyle=this.colors.THUMBNAIL_PLACEHOLDER,e.fillRect(t,r,i,l),e.restore();return}let a=Math.max(12,Math.floor(Math.max(8,Math.floor(l))*(e.width&&e.height?e.width/e.height:16/9))),s=this.ctx;s.save();let o=c.CLIP_BORDER_RADIUS;this.drawRoundRect(t,r,i,l,o),s.clip();let u=Math.ceil(i/a)+1;s.fillStyle=this.colors.THUMBNAIL_PLACEHOLDER;for(let o=0;o<u;o++){let c=n+o*a;if(c>t+i)break;let u=(c-n+a/2)/i*e.duration,d=this.thumbnailStore.getFrameAtTime(e.assetId,u);if(d)try{s.drawImage(d,c,r,a,l)}catch(e){s.fillRect(c,r,a,l)}else s.fillRect(c,r,a,l)}s.strokeStyle=this.colors.THUMBNAIL_SEPARATOR,s.lineWidth=1,s.beginPath();for(let e=0;e<u;e++){let o=n+e*a;if(o>t+i)break;s.moveTo(o+a,r),s.lineTo(o+a,r+l)}s.stroke(),s.restore()}drawAudioWaveform(e,t,r,i,l){var n;let a=this.ctx,s=c.CLIP_BORDER_RADIUS;a.save(),this.drawRoundRect(t,r,i,l,s),a.clip();let o=null===(n=this.waveformService)||void 0===n?void 0:n.getPeaks(e.assetId);if(!o){a.restore();return}let u=o.peaks.length/2,d=u/o.duration,h=c.WAVEFORM_BAR_WIDTH,p=h+c.WAVEFORM_BAR_GAP,m=Math.floor(i/p);if(m<=0){a.restore();return}let f=e.duration/m,v=r+l/2,g=l/2;a.fillStyle=this.colors.AUDIO_WAVEFORM,a.beginPath();for(let r=0;r<m;r++){let i=e.sourceOffset+r*f,l=i+f,n=Math.floor(i*d),s=Math.min(Math.ceil(l*d),u),c=0,m=0;for(let e=n;e<s;e++)c=Math.min(c,o.peaks[2*e]),m=Math.max(m,o.peaks[2*e+1]);let x=t+r*p,_=v-m*g,C=Math.max(1,v-c*g-_);a.rect(x,_,h,C)}a.fill(),a.restore()}drawCropOverlay(e){let{cropRange:t}=e;if(!t)return;let{CLIP_PADDING:r,CROP_HANDLE_WIDTH:i,CROP_HANDLE_OUTSET:l,TRACK_PADDING_H:n}=c,{CROP_MASK:a,CROP_HANDLE:s,CROP_HANDLE_INNER:o}=this.colors,{scale:u,scrollX:d}=e,h=this.ctx,p=this.rulerHeight+this.trackGap+r,m=this.height-this.rulerHeight-this.trackGap-2*r,f=Math.max(0,t.start*u-d+n-l),v=Math.min(this.width,t.end*u-
1d+n+l);h.save();let g=f+i,x=v-i;g>0&&(h.fillStyle=a,h.fillRect(0,p,g,m)),x<this.width&&(h.fillStyle=a,h.fillRect(x,p,this.width-x,m));let _=Math.max(0,n-l),C=Math.min(this.width,this.width-n+l);h.save(),h.beginPath(),h.rect(_,p,C-_,m),h.clip();let w=v-f,b=f+i,y=p+2,k=m-4;h.fillStyle=s,h.beginPath(),h.roundRect(f,p,w,m,6),h.roundRect(b,y,w-2*i,k,4),h.fill("evenodd");let R=(e,t)=>{let r=p+(m-12)/2;h.fillStyle=o,h.beginPath(),h.roundRect((t?e:e-i)+(i-2)/2,r,2,12,1),h.fill()};R(f,!0),R(v,!1),h.restore(),h.restore()}drawPlayhead(e){if(0===e.clips.length)return;let{TRACK_PADDING_H:t,CLIP_PADDING:r}=c,{PLAYHEAD:i,PLAYHEAD_FILL:l,PLAYHEAD_STROKE:n}=this.colors,{currentTime:a,scale:s,scrollX:o}=e,u=a*s-o+t;if(u<t||u>this.width-t)return;let d=this.ctx,h=this.height-r;d.strokeStyle=i,d.lineWidth=1,d.beginPath(),d.moveTo(u,15),d.lineTo(u,h),d.stroke(),d.beginPath(),d.moveTo(u-2,.75),d.lineTo(u+2,.75),d.bezierCurveTo(u+3.821,.75,u+5.25,2.167,u+5.25,3.858),d.lineTo(u+5.25,11.507),d.bezierCurveTo(u+5.25,11.889,u+5.051,12.258,u+4.702,12.481),d.lineTo(u+.702,15.046),d.bezierCurveTo(u+.278,15.318,u-.278,15.318,u-.702,15.046),d.lineTo(u-4.702,12.481),d.bezierCurveTo(u-5.051,12.258,u-5.25,11.889,u-5.25,11.507),d.lineTo(u-5.25,3.858),d.bezierCurveTo(u-5.25,2.167,u-3.821,.75,u-2,.75),d.closePath(),d.fillStyle=l,d.fill(),d.strokeStyle=n,d.lineWidth=1.5,d.stroke()}drawRoundRect(e,t,r,i,l){this.ctx.beginPath(),this.ctx.roundRect(e,t,r,i,l)}calculateInterval(e){for(let t of p)if(e>=t.minScale)return{interval:t.interval,subDivisions:t.subDivisions};return{interval:10,subDivisions:5}}destroy(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];this.destroyed=!0,null!==this.rafId&&(cancelAnimationFrame(this.rafId),this.rafId=null),e&&(this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)),this.rulerLayer=null,this.rulerCtx=null,this.rulerCacheKey=""}constructor(e,t,r,i,l){var n,a;this.width=0,this.height=0,this.needsRender=!1,this.destroyed=!1,this.rafId=null,this.rulerHeight=c.RULER_HEIGHT,this.trackGap=0,this.rulerLayer=null,this.rulerCtx=null,this.rulerCacheKey="",this.canvas=e;let s=e.getContext("2d");if(!s)throw Error("æ æ³è·å Canvas 2D ä¸ä¸æ");this.ctx=s,this.dpr=window.devicePixelRatio||1,this.getState=t,this.thumbnailStore=r,this.waveformService=null!=i?i:null,this.hooks=null!==(n=null==l?void 0:l.hooks)&&void 0!==n?n:{},this.colors=null!==(a=null==l?void 0:l.colors)&&void 0!==a?a:u}}class C{updateCropConfig(e){this.cropConfig=e}updateLayout(e){this.rulerHeight=e.rulerHeight,this.trackGap=e.trackGap,this.thumbnailHeight=e.thumbnailHeight}bindEvents(){this.canvas.addEventListener("mousedown",this.boundMouseDown),this.canvas.addEventListener("mousemove",this.boundMouseMove),this.canvas.addEventListener("mouseup",this.boundMouseUp),this.canvas.addEventListener("wheel",this.boundWheel,{passive:!1}),this.canvas.addEventListener("mouseleave",this.boundMouseLeave),document.addEventListener("mouseup",this.boundMouseUp),document.addEventListener("mousemove",this.boundMouseMove),document.addEventListener("keydown",this.boundKeyDown),this.resizeObserver=new ResizeObserver(()=>{this.rectCache=null,this.cachedRect=null}),this.resizeObserver.observe(this.canvas),window.addEventListener("resize",this.boundInvalidateRect)}unbindEvents(){var e;this.canvas.removeEventListener("mousedown",this.boundMouseDown),this.canvas.removeEventListener("mousemove",this.boundMouseMove),this.canvas.removeEventListener("mouseup",this.boundMouseUp),this.canvas.removeEventListener("wheel",this.boundWheel),this.canvas.removeEventListener("mouseleave",this.boundMouseLeave),document.removeEventListener("mouseup",this.boundMouseUp),document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("keydown",this.boundKeyDown),null===(e=this.resizeObserver)||void 0===e||e.disconnect(),this.resizeObserver=null,window.removeEventListener("resize",this.boundInvalidateRect)}getCanvasRect(){return this.rectCache||(this.rectCache=this.canvas.getBoundingClientRect()),this.rectCache}onKeyDown(e){var t;let r=e.target,i=null==r?void 0:null===(t=r.tagName)||void 0===t?void 0:t.toLowerCase();"input"!==i&&"textarea"!==i&&(null==r||!r.isContentEditable)&&"Escape"===e.key&&this.get
1State().cropRange&&(e.preventDefault(),this.callbacks.onStateChange({cropRange:null}),this.callbacks.onRequestRender())}onMouseDown(e){this.cachedRect=this.getCanvasRect();let t=this.cachedRect,r=e.clientX-t.left,i=e.clientY-t.top,l=this.getState();if(this.dragStartX=r,this.dragStartScrollX=l.scrollX,i<this.rulerHeight){if(0===this.getState().clips.length)return;this.isDragging=!0,this.dragType="playhead",this.updatePlayheadPosition(r),this.canvas.style.cursor="col-resize";return}let n=this.hitTestCropHandle(r,i);if(n){var a,s;this.isDragging=!0,this.dragType=n;let e=l.cropRange;if(this.cropDragStartStart=e.start,this.cropDragStartEnd=e.end,"crop-body"===n){let t=(r-c.TRACK_PADDING_H+l.scrollX)/l.scale;this.cropBodyGrabOffset=t-e.start}this.canvas.style.cursor="crop-body"===n?"grab":"ew-resize",null===(a=(s=this.callbacks).onUserInteraction)||void 0===a||a.call(s);return}this.isDragging=!0,this.dragType="scroll",this.canvas.style.cursor="grabbing"}onMouseMove(e){let t=this.isDragging&&this.cachedRect?this.cachedRect:this.getCanvasRect(),r=e.clientX-t.left,i=e.clientY-t.top;if(this.isDragging){this.handleDrag(r,i);return}this.updateHoverState(r,i)}handleDrag(e,t){let{scale:r,scrollX:i,totalDuration:l}=this.getState(),{minDuration:n,maxDuration:a}=this.cropConfig;switch(this.dragType){case"playhead":this.updatePlayheadPosition(e);break;case"crop-left":{let t=(e-c.TRACK_PADDING_H+i)/r,l=this.cropDragStartEnd;this.callbacks.onStateChange({cropRange:{start:Math.max(Math.max(0,l-a),Math.min(t,l-n)),end:l}}),this.callbacks.onRequestRender();break}case"crop-right":{let t=(e-c.TRACK_PADDING_H+i)/r,s=this.cropDragStartStart;this.callbacks.onStateChange({cropRange:{start:s,end:Math.max(s+n,Math.min(t,Math.min(l,s+a)))}}),this.callbacks.onRequestRender();break}case"crop-body":{let t=(e-c.TRACK_PADDING_H+i)/r,n=this.cropDragStartEnd-this.cropDragStartStart,a=t-this.cropBodyGrabOffset;a=Math.max(0,Math.min(a,l-n)),this.callbacks.onStateChange({cropRange:{start:a,end:a+n}}),this.callbacks.onRequestRender();break}case"scroll":{var s,o;let t=this.dragStartX-e,r=Math.max(0,this.dragStartScrollX+t);this.callbacks.onStateChange({scrollX:r}),null===(s=(o=this.callbacks).onUserInteraction)||void 0===s||s.call(o),this.callbacks.onRequestRender()}}}onMouseUp(){if(this.isDragging){let r=this.dragType;if(this.isDragging=!1,this.dragType=null,this.cachedRect=null,this.canvas.style.cursor="default","crop-left"===r||"crop-right"===r||"crop-body"===r){var e,t;null===(e=(t=this.callbacks).onCropDragEnd)||void 0===e||e.call(t,r)}this.callbacks.onRequestRender()}}onMouseLeave(){this.isDragging||(this.canvas.style.cursor="default")}onWheel(e){var t,r,i,l,n,a;e.preventDefault();let{scale:s,scrollX:o}=this.getState(),{MIN_SCALE:u,MAX_SCALE:d,ZOOM_FACTOR:h}=c;if(e.ctrlKey||e.metaKey){let t=this.getCanvasRect(),r=e.clientX-t.left,n=Math.min(d,Math.max(u,s*(e.deltaY>0?1/h:h))),a=Math.max(0,(r-c.TRACK_PADDING_H+o)/s*n-(r-c.TRACK_PADDING_H));this.callbacks.onStateChange({scale:n,scrollX:a}),null===(i=(l=this.callbacks).onUserInteraction)||void 0===i||i.call(l),this.callbacks.onRequestRender();return}if(0!==e.deltaX){let t=Math.max(0,o+e.deltaX);this.callbacks.onStateChange({scrollX:t}),null===(n=(a=this.callbacks).onUserInteraction)||void 0===n||n.call(a),this.callbacks.onRequestRender();return}let p=Math.max(0,o+e.deltaY);this.callbacks.onStateChange({scrollX:p}),null===(t=(r=this.callbacks).onUserInteraction)||void 0===t||t.call(r),this.callbacks.onRequestRender()}updateHoverState(e,t){if(t<this.rulerHeight){this.canvas.style.cursor=this.getState().clips.length>0?"col-resize":"default";return}let r=this.hitTestCropHandle(e,t);if("crop-left"===r||"crop-right"===r){this.canvas.style.cursor="ew-resize";return}if("crop-body"===r){this.canvas.style.cursor="grab";return}this.canvas.style.cursor="default"}updatePlayheadPosition(e){var t,r;let{scale:i,scrollX:l,totalDuration:n}=this.getState(),a=Math.max(0,Math.min((e-c.TRACK_PADDING_H+l)/i,n));this.callbacks.onStateChange({currentTime:a}),null===(t=(r=this.callbacks).onPlayheadSeek)||void 0===t||t.call(r,a),this.callbacks.onRequestRender()}hitTestCropHandle(e,t){let r=this.getState(),{cropRange:i}=r;if(!i)return null;let{CLIP_PADDING:l,CROP_HANDLE_WIDTH:n,CROP_HANDLE_OUTSET:a,TRACK_PADD
1ING_H:s}=c,{scale:o,scrollX:u}=r,d=this.rulerHeight+this.trackGap+l,h=this.thumbnailHeight-2*l;if(t<d||t>d+h)return null;let p=this.getCanvasRect().width;if(e<Math.max(0,s-a)||e>Math.min(p,p-s+a))return null;let m=Math.max(0,i.start*o-u+s-a),f=Math.min(p,i.end*o-u+s+a);return e>=m-2&&e<=m+n+2?"crop-left":e>=f-n-2&&e<=f+2?"crop-right":e>m+n&&e<f-n?"crop-body":null}destroy(){this.unbindEvents()}constructor(e,t,r){this.cropConfig=h,this.rulerHeight=c.RULER_HEIGHT,this.trackGap=0,this.thumbnailHeight=c.VIDEO_TRACK_HEIGHT,this.isDragging=!1,this.dragType=null,this.dragStartX=0,this.dragStartScrollX=0,this.cropDragStartStart=0,this.cropDragStartEnd=0,this.cropBodyGrabOffset=0,this.cachedRect=null,this.rectCache=null,this.resizeObserver=null,this.canvas=e,this.callbacks=t,this.getState=r,this.boundMouseDown=this.onMouseDown.bind(this),this.boundMouseMove=this.onMouseMove.bind(this),this.boundMouseUp=this.onMouseUp.bind(this),this.boundWheel=this.onWheel.bind(this),this.boundMouseLeave=this.onMouseLeave.bind(this),this.boundKeyDown=this.onKeyDown.bind(this),this.boundInvalidateRect=()=>{this.rectCache=null},this.bindEvents()}}class w{registerVideoAsset(e){let t=crypto.randomUUID(),r=URL.createObjectURL(e),i={id:t,file:e,objectUrl:r,mime:e.type,name:e.name,size:e.size};return this.assets.set(t,i),i}registerAudioAsset(e){return this.registerVideoAsset(e)}getAsset(e){var t;return null!==(t=this.assets.get(e))&&void 0!==t?t:null}releaseAsset(e){let t=this.assets.get(e);t&&(URL.revokeObjectURL(t.objectUrl),this.assets.delete(e))}clear(){for(let e of this.assets.values())URL.revokeObjectURL(e.objectUrl);this.assets.clear()}has(e){return this.assets.has(e)}constructor(){this.assets=new Map}}class b{setFrames(e,t){this.frameAtlas.set(e,t)}appendFrame(e,t){let r=this.frameAtlas.get(e);r||(r=[],this.frameAtlas.set(e,r)),r.push(t)}getFrameAtTime(e,t){var r;let i=this.frameAtlas.get(e);if(!i)return null;let l=function(e,t){if(0===e.length)return null;if(1===e.length)return e[0];let r=0,i=e.length-1;for(;r<i;){let l=r+i>>1;e[l].timestamp<t?r=l+1:i=l}if(0===r)return e[0];let l=e[r-1],n=e[r];return Math.abs(l.timestamp-t)<=Math.abs(n.timestamp-t)?l:n}(i,t);return null!==(r=null==l?void 0:l.img)&&void 0!==r?r:null}getFrameCount(e){var t,r;return null!==(r=null===(t=this.frameAtlas.get(e))||void 0===t?void 0:t.length)&&void 0!==r?r:0}has(e){let t=this.frameAtlas.get(e);return!!t&&t.length>0}clearAsset(e){this.releaseFrames(this.frameAtlas.get(e)),this.frameAtlas.delete(e)}clear(){this.frameAtlas.forEach(e=>this.releaseFrames(e)),this.frameAtlas.clear()}releaseFrames(e){null==e||e.forEach(e=>{let{img:t}=e;t instanceof ImageBitmap&&t.close()})}constructor(){this.frameAtlas=new Map}}var y=r(51887);class k{async getVideoMeta(e){let t=await this.videoFrameCache.getVideoDecoderCtx(e);return{sourceDuration:t.sourceDuration,width:t.width,height:t.height}}async generateThumbnails(e,t,r,i,l,n,a){let s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:.5;if(this.thumbnailStore.has(e))return;let o=Math.max(1,Math.ceil(t/s)),c=[];for(let e=0;e<o;e++)c.push((e+.5)*t/o);let u=await this.videoFrameCache.getVideoDecoderCtx(e);if(null==a?void 0:a.aborted)return;let d=new y.C(u.track,{width:Math.max(12,Math.floor(r*(i&&l?i/l:16/9))),height:r,fit:"contain",poolSize:2}),h=c.map(e=>Math.max(0,Math.min(e,Math.max(0,u.sourceDuration-.001)))),p=d.canvase
1sAtTimestamps(h);if(!p)return;let m=0;try{for(let t=0;t<o;t++){if(null==a?void 0:a.aborted)return;let r=await p.next();if(null==a?void 0:a.aborted)return;if(!r.value)continue;let i=await createImageBitmap(r.value.canvas);this.thumbnailStore.appendFrame(e,{timestamp:c[t],img:i});let l=performance.now();(t===o-1||l-m>=200)&&(null==n||n(),m=l)}}finally{try{await p.return(void 0)}catch(e){}}}async disposeAsset(e){await this.videoFrameCache.clearAsset(e),this.thumbnailStore.clearAsset(e)}constructor(e,t){this.videoFrameCache=e,this.thumbnailStore=t}}var R=r(54897),M=r(36212),j=r(67065);class S{async getVideoDecoderCtx(e){return await this._getDecoder(e)}async getCanvases(e,t){var r,i;if(this.canvasesMap.has(e))return this.canvasesMap.get(e);this.cleanupPromises.length>0&&(await Promise.all(this.cleanupPromises),this.cleanupPromises=[]);let l=await this._getDecoder(e),n=l.canvasSink.canvases(t);return this.canvasesMap.set(e,n),l.nextFrame=null!==(i=null===(r=await n.next())||void 0===r?void 0:r.value)&&void 0!==i?i:null,this.canvasesMap.get(e)}async getFrameCanvas(e,t){try{if(!this.getAsset(e))return null;let l=await this._getDecoder(e),n=Math.max(0,Math.min(t,Math.max(0,l.sourceDuration-.001)));if(void 0!==l.lastSeekTime&&n<l.lastSeekTime&&this.canvasesMap.has(e)){let t=this.canvasesMap.get(e);this.canvasesMap.delete(e);try{await t.return(null)}catch(e){}}l.lastSeekTime=n;let a=await this.getCanvases(e,n);for(;l.nextFrame;){var r,i;if(!(l.nextFrame.timestamp<=n))return{canvas:l.nextFrame.canvas,width:l.width,height:l.height};l.nextFrame=null!==(i=null===(r=await a.next())||void 0===r?void 0:r.value)&&void 0!==i?i:null}return null}catch(e){return console.error("VideoFrameCache: è§£ç è§é¢å¸§å¤±è´¥",e),null}}async getFrame(e,t){let r=await this.getFrameCanvas(e,t);return r?await createImageBitmap(r.canvas):null}async _getDecoder(e){let t=this.decoderMap.get(e);if(t)return t;let r=(async()=>{var t,r,i,l;let n=this.getAsset(e);if(!n)throw Error("asset ä¸åå¨: ".concat(e));let a=new R.I({formats:M.t6,source:new j.pC(n.file)}),s=await a.computeDuration(),o=await a.getPrimaryVideoTrack();if(!o)throw a.dispose(),Error("该æä»¶ä¸å
å«è§é¢è½¨é");
1let c=await o.canBeTransparent(),u=new y.C(o,{poolSize:2,fit:"contain",alpha:c}),d=null!==(r=null!==(t=o.displayWidth)&&void 0!==t?t:o.codedWidth)&&void 0!==r?r:0,h=null!==(l=null!==(i=o.displayHeight)&&void 0!==i?i:o.codedHeight)&&void 0!==l?l:0;return d&&h||(d=1920,h=1080),{input:a,nextFrame:null,track:o,canvasSink:u,sourceDuration:s,width:d,height:h}})();return this.decoderMap.set(e,r),r}resetCanvases(){for(let e of this.decoderMap.values())e.then(e=>{e.nextFrame=null}).catch(()=>{});let e=[];this.canvasesMap.forEach(t=>{e.push(t.return(null).then(()=>{}).catch(()=>{}))}),this.canvasesMap.clear(),this.cleanupPromises=e}async clearAsset(e){let t=this.canvasesMap.get(e);if(this.canvasesMap.delete(e),t)try{await t.return(null)}catch(e){}let r=this.decoderMap.get(e);if(this.decoderMap.delete(e),r)try{let e=await r;e.nextFrame=null,e.input.dispose()}catch(e){}}async clear(){for(let[,e]of this.canvasesMap.entries())try{await e.return(null)}catch(e){}for(let[,e]of(this.canvasesMap.clear(),this.decoderMap.entries()))try{let t=await e;t.nextFrame=null,t.input.dispose()}catch(e){}this.decoderMap.clear()}constructor(e){this.decoderMap=new Map,this.canvasesMap=new Map,this.cleanupPromises=[],this.getAsset=e}}class E{getAudioContext(){if(!this.audioContext)try{this.audioContext=new AudioContext({sampleRate:22050})}catch(e){this.audioContext=new AudioContext}return this.audioContext}getWorker(){if(this.worker)return this.worker;try{let e=new Blob(["\nself.onmessage = function (e) {\n var channelData = e.data.channelData;\n var samplesPerPixel = e.data.samplesPerPixel;\n var jobId = e.data.jobId;\n var totalSamples = channelData.length;\n var peakCount = Math.ceil(totalSamples / samplesPerPixel);\n var peaks = new Float32Array(peakCount * 2);\n for (var i = 0; i < peakCount; i++) {\n var start = i * samplesPerPixel;\n var end = Math.min(start + samplesPerPixel, totalSamples);\n var min = 1, max = -1;\n for (var j = start; j < end; j++) {\n var v = channelData[j];\n if (v < min) min = v;\n if (v > max) max = v;\n }\n peaks[i * 2] = min;\n peaks[i * 2 + 1] = max;\n }\n self.postMessage({ jobId: jobId, peaks: peaks }, [peaks.buffer]);\n};\n"],{type:"text/javascript"}),t=URL.createObjectURL(e),r=new Worker(t);return URL.revokeObjectURL(t),r.onmessage=e=>{let{jobId:t,peaks:r}=e.data,i=this.workerPending.get(t);i&&(this.workerPending.delete(t),i.resolve(r))},r.onerror=e=>{var t,r;for(let[,t]of this.workerPending)t.reject(Error(null!==(r=e.message)&&void 0!==r?r:"Peak worker error"));this.workerPending.clear(),null===(t=this.worker)||void 0===t||t.terminate(),this.worker=null},this.worker=r,r}catch(e){return null}}async extractPeaks(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:256,i=this.cache.get(e);if(i)return i;let l=this.getAudioContext(),n=await t.arrayBuffer(),a=await l.decodeAudioData(n),{duration:s,sampleRate:o}=a,c=a.getChannelData(0),u={peaks:await this.computePeaksInWorker(c,r),duration:s,sampleRate:o};return this.cache.set(e,u),u}async computePeaksInWorker(e,t){let r=this.getWorker();if(!r)return this.computePeaksSync(e,t);let i=++this.workerJobId,l=new Float32Array(e);return new Promise((e,n)=>{this.workerPending.set(i,{resolve:e,reject:n}),r.postMessage({jobId:i,channelData:l,samplesPerPixel:t},[l.buffer])}).catch(()=>this.computePeaksSync(e,t))}computePeaksSync(e,t){let r=e.length,i=Math.ceil(r/t),l=new Float32Array(2*i);for(let n=0;n<i;n++){let i=n*t,a=Math.min(i+t,r),s=1,o=-1;for(let t=i;t<a;t++){let r=e[t];r<s&&(s=r),r>o&&(o=r)}l[2*n]=s,l[2*n+1]=o}return l}getPeaks(e){var t;return null!==(t=this.cache.get(e))&&void 0!==t?t:null}clearAsset(e){this.cache.delete(e)}clear(){var e;this.cache.clear(),this.audioContext&&(this.audioContext.close(),this.audioContext=null),null===(e=this.worker)||void 0===e||e.terminate(),this.worker=null,this.workerPending.clear()}constructor(){this.cache=new Map,this.audioContext=null,this.worker=null,this.workerJobId=0,this.workerPending=new Map}}var N=r(66936),D=r(763),T=r(16065),A=r(48593);async function P(e,t,r,i){let{onProgress:l,targetWidth:n,targetHeight:a,maxBitrate:c}=null!=i?i:{},u=new R.I({formats:M.t6,source:new j.pC(e)});try{let e=await u.getFormat(),i=e instanceof M.nY?new N.HF:e instanceof M.hQ?new N.Ps:e instanceof M.Oj?new N.bu:e instanceof M.uc?new N.IF:e instanceof M.O5?new N.Fr:e instanceof M.hL?new N.PX:e instanceof M._9?new N.nP:e instanceof M.dM?new
1N.WC({fastStart:"in-memory"}):(M.QX,new N.E1({fastStart:"in-memory"})),d=new D.Vl,h=new T.r({format:i,target:d}),p={};n&&(p.width=n),a&&(p.height=a),p.width&&p.height&&(p.fit="fill");let m=await u.getPrimaryVideoTrack();if(c){let t=c[e instanceof M.dM?"mov":e instanceof M.QX?"mp4":e instanceof M.hL?"webm":e instanceof M._9?"mkv":e instanceof M.nY?"mp3":e instanceof M.hQ?"aac":e instanceof M.Oj?"flac":e instanceof M.uc?"ogg":e instanceof M.O5?"wav":"mp4"];if(t&&m){let e=await m.computePacketStats(),r=!!(p.width||p.height);e.averageBitrate>t?p.bitrate=Math.round(t):r&&(p.bitrate=Math.round(e.averageBitrate))}}m&&0===Object.keys(p).length&&(p.width=m.displayWidth,p.height=m.displayHeight,p.fit="fill");let f=await u.getPrimaryAudioTrack(),v=await A.uz.init((0,o._)((0,s._)({input:u,output:h,trim:{start:t,end:r}},Object.keys(p).length>0?{video:p}:{},f?{audio:{forceTranscode:!0}}:{}),{showWarnings:!1}));v.isValid||console.warn("é¨å轨éå¨è½¬æ¢ä¸è¢«ä¸¢å¼ï¼ç»§ç»å¯¼åºå¯ç¨è½¨é"),l&&(v.onProgress=l),await v.execute();let g=i.mimeType;return new Blob([d.buffer],{type:g})}finally{u.dispose()}}(0,r(87319).D)();class L{attachCanvas(e,t,r){var i,l;this.canvas=e;let n=null!==(l=null!=t?t:null===(i=e.parentElement)||void 0===i?void 0:i.clientWidth)&&void 0!==l?l:e.clientWidth,a=null!=r?r:L.DEFAULT_LAYOUT;this.renderer=new _(e,()=>this.store.getState(),this.thumbnailStore,this.waveformService,{colors:this.colors}),this.renderer.resize(n,a),this.eventHandler=new C(e,{onStateChange:e=>this.store.setState(e),onRequestRender:()=>this.requestRender(),onPlayheadSeek:e=>{this.scheduleSeekPreview(e)},onUserInteraction:()=>{this.store.getState().isPlaying&&(this.pause(),this.requestRender())},onCropDragEnd:e=>{let{cropRange:t}=this.store.getState();if(!t)return;let r="crop-right"===e?t.end:t.start;this.seek(r)}},()=>this.store.getState()),this.eventHandler.updateCropConfig(this.cropConfig),this.eventHandler.updateLayout(a),this.requestRender()}detachCanvas(){var e,t;let r=!(arguments.length>0)||void 0===arguments[0]||arguments[0];null===(e=this.eventHandler)||void 0===e||e.destroy(),null===(t=this.renderer)||void 0===t||t.destroy(r),this.eventHandler=null,this.renderer=null,this.canvas=null}destroy(){var e,t;this.destroyed||(this.destroyed=!0,this.stopPlayLoop(),null===(e=this.playUnsubscribe)||void 0===e||e.call(this),null!==this.seekRafId&&(cancelAnimationFrame(this.seekRafId),this.seekRafId=null),this.pendingSeekTime=null,null===(t=this.thumbAbort)||void 0===t||t.abort(),this.disposeAudioElement(),this.detachCanvas(),this.thumbnailStore.clear(),this.waveformService.clear(),this.videoFrameCache.resetCanvases(),this.videoFrameCache.clear(),this.mediaRegistry.clear(),this.store.reset())}getState(){return this.store.getState()}subscribe(e){return this.store.subscribe(e)}isAudioFile(e){return e.type.startsWith("audio/")}async addMedia(e){var t;this.store.setState({isPlaying:!1,currentTime:0}),null===(t=this.thumbAbort)||void 0===t||t.abort(),this.thumbAbort=null,this.disposeAudioElement();let r=this.store.getState();if(r.clips.length>0){let e=new Set(r.clips.map(e=>e.assetId));for(let t of e)this.thumbnailStore.clearAsset(t),this.waveformService.clearAsset(t);for(let t of(this.store.clearAllClips(),e))await this.videoFrameCache.clearAsset(t)}this.isAudioFile(e)?await this.addAudioInternal(e):await this.addVideoInternal(e)}async addVideoInternal(e){let t;let r=this.mediaRegistry.registerVideoAsset(e);try{t=await this.thumbnailService.getVideoMeta(r.id)}catch(e){console.warn("è§£æè§é¢å¤±è´¥ï¼",e);return}let i=Math.max(.1,t.sourceDuration||.1),l={id:crypto.randomUUID(),assetId:r.id,name:e.name,startTime:0,duration:i,sourceOffset:0,sourceDuration:t.sourceDuration,thumbnails:[],width:t.width,height:t.height};this.store.addClip(l);let n=Math.min(i,this.cropConfig.maxDuration);this.store.setState({totalDuration:i,cropRange:{start:0,end:n},currentTime:0}),this.disposeAudioElement(),this.audioElement=new Audio(r.objectUrl),this.audioElement.preload="auto",this.audioAssetId=r.id,this.requestRender(),await this.updatePreviewFrame(0),this.videoFrameCache.resetCanvases(),this.requestRender();let a=new AbortController;this.thumbAbort=a;let{CLIP_PADDING:s,VIDEO_TRACK_HEIGHT:o}=c,u=f(i);this.thumbnailService.generateThumbnails(r.id,i,Math.max(8,o-2*s),t.width,t.height,()=>this.requestRender(),a.signal,u.sampleInterval)}async addAudioInternal(e){let t=this.mediaRegistry.registerAudioAsset(e),r=new Audio(t.objectUrl);r.preload="auto";let[i,l]=await Promise.all([this.waveformService.extractPeaks(t.id,e).catch(e=>(console.warn("è§£æé³é¢å¤±è´¥ï¼",e),null)),new Promise(e=>{r.onloadedmetadata=()=>e(r.duration),r.onerror=()=>e(0)})]);if(!i)return;let n=Math.max(.1,l||i.duration||.1),a={id:crypto.randomUUID(),type:"audio",assetId:t.id,name:e.name,startTime:0,duration:n,sourceOffset:0,sourceDuration:n,thumbnails:[],width:0,height:0};this.store.addClip(a);let s=Math.min(n,this.cropConfig.maxDuration);this.store.setState({totalDuration:n,cropRange:{start:0,end:s},currentTime:0}),this.disposeAudioElement(),this.audioElement=r,this.audioAssetId=t.id,this.requestRender()}getActiveAudioClip(){var e;return null!==(e=this.store.getState().clips.find(e=>"audio"===e.type))&&void 0!==e?e:null}disposeAudioElement(){this.audioElement&&(this.audioElement.pause(),this.audioElement.src="",this.audioElement=null,this.audioAssetId=null)}removeClip(e){this.store.removeClip(e),this.requestRender()}getClips(){return this.store.getState().clips}getCropRange(){return this.store.getState().cropRange}setCropRange(e){if(e){let t=e.end-e.start;if(t<this.cropConfig.minDuration||t>this.cropConfig.maxDuration)return}this.store.setCropRange(e),this.requestRender()}async exportCrop(e){let t=this.store.getState();if(0===t.clips.length||!t.cropRange)return null;t.isPlaying&&this.store.setState({isPlaying:!1});let r=t.clips[0],i=this.mediaRegistry.getAsset(r.assetId);if(!i)return null;let l=t.cropRange.start+r.sourceOffset,n=function(e,t,r){let i=e.end-e.start;return e.end+t-Math.min(.1,Math.max(0,i-r))}(t.cropRange,r.sourceOffset,this.cropConfig.minDuration),a=(0,s._)({},e),o=a.maxResolution,c=r.width,u=r.height;if(o&&u>0&&u>o){let e=o/u;u=o,c=Math.floor(r.width*e),a.targetHeight=u}delete a.maxResolution;let d=a.maxTotalPixels;if(d&&c>0&&u>0&&c*u>d){let e=Math.sqrt(d/(c*u));a.targetWidth=Math.floor(c*e),a.targetHeight=Math.floor(u*e)}return delete a.maxTotalPixels,P(i.file,l,n,a)}play(){let e=this.store.getState();if(!e.isPlaying){if(e.cropRange&&(e.currentTime<e.cropRange.start||e.currentTime>=e.cropRange.end)&&this.store.setState({currentTime:e.cropRange.start}),this.ensurePlayheadVisible(),this.audioElement){let e=this.store.getState(),t=e.clips[0];t&&(this.audioElement.currentTime=e.currentTime+t.sourceOffset),this.audioElement.play().catch(()=>{this.store.getState().isPlaying&&this.pause()})}this.store.setState({isPlaying:!0})}}pause(){var e;null===(e=this.audioElement)||void 0===e||e.pause(),this.store.setState({isPlaying:!1})}togglePlay(){this.store.getState().isPlaying?this.pause():this.play(),this.requestRender()}seek(e){if(this.store.setCurrentTime(e),this.audioElement){let t=this.store.getState().clips[0];t&&(this.audioElement.currentTime=e+t.sourceOffset)}this.scheduleSeekPreview(e),this.requestRender()}async getPreviewFrame(e){let t=this.store.getState().clips.find(t=>e>=t.startTime&&e<=t.startTime+t.duration);if(!t||"audio"===t.type)return null;let r=e-t.startTime+t.sourceOffset;return this.videoFrameCache.getFrame(t.assetId,r)}async getPreviewFrameCanvas(e){let t=this.store.getState().clips.find(t=>e>=t.startTime&&e<=t.startTime+t.duration);if(!t||"audio"===t.type)return null;let r=e-t.startTime+t.sourceOffset;return this.videoFrameCache.getFrameCanvas(t.assetId,r)}setScale(e){this.pauseIfPlaying(),this.store.setScale(e),this.requestRender()}zoomIn(){this.pauseIfPlaying();let{MAX_SCALE:e,ZOOM_FACTOR:t}=c,r=this.store.getState().scale;this.store.setScale(Math.min(e,r*t)),this.requestRender()}zoomOut(){this.pauseIfPlaying();let{MIN_SCALE:e,ZOOM_FACTOR:t}=c,r=this.store.getState().scale;this.store.setScale(Math.max(e,r/t)),this.requestRender()}setScrollX(e){this.pauseIfPlaying(),this.store.setScrollX(e),this.requestRender()}resize(e,t){var r,i;null===(r=this.renderer)||void 0===r||r.resize(e,t),null===(i=this.eventHandler)||void 0===i||i.updateLayout(t),this.requestRender()}updateCropConfig(e){var t;this.cropConfig=e,null===(t=this.eventHandler)||void 0===t||t.updateCropConfig(e)}setColors(e){var t;this.colors=e,null===(t=this.renderer)||void 0===t||t.setColors(e)}pauseIfPlaying(){this.store.getState().isPlaying&&this.pause()}requestRender(){var e;null===(e=this.renderer)||void 0===e||e.markNeedsRender()}scheduleSeekPreview(e){this.pendingSeekTime=e,null===this.seekRafId&&(this.seekRafId=requestAnimationFrame(()=>{this.seekRafId=null,null!==this.pendingSeekTime&&(this.updatePreviewFrame(this.pendingSeekTime),this.pendingSeekTime=null)}))}async updatePreviewFrame(e){let t=++this.seekSeq,r=this.store.getState().clips.find(t=>e>=t.startTime&&e<=t.startTime+t.duration);if(!r){this.store.setPreviewFrame(null);return}if("audio"===r.type)return;let i=e-r.startTime+r.sourceOffset,l=await this.videoFrameCache.getFrame(r.assetId,i);if(this.seekSeq!==t){null==l||l.close();return}l&&this.store.setPreviewFrame(l)}async updatePreviewFrameDirect(e){if(this.directDecoding){this.directPendingTime=e;return}this.directDecoding=!0;try{let t=this.store.getState().clips.find(t=>e>=t.startTime&&e<=t.startTime+t.duration);if(!t||"audio"===t.type)return;let r=e-t.startTime+t.sourceOffset,i=await this.videoFrameCache.getFrameCanvas(t.assetId,r);i&&this.onPreviewFrameDirect&&this.onPreviewFrameDirect(i.canvas,i.width,i.height)}finally{if(this.directDecoding=!1,null!==this.directPendingTime){let e=this.directPendingTime;this.directPendingTime=null,this.updatePreviewFrameDirect(e)}}}ensurePlayheadVisible(){var e,t;let{currentTime:r,scale:i,scrollX:l}
1=this.store.getState(),{TRACK_PADDING_H:n}=c,a=null!==(t=null===(e=this.renderer)||void 0===e?void 0:e.getWidth())&&void 0!==t?t:0;if(a<=0)return;let s=r*i-l+n;(s<n||s>a-n)&&this.store.setState({scrollX:Math.max(0,r*i-.1*(a-2*n))})}autoFollowPlayhead(e){var t,r;let{scale:i,scrollX:l}=this.store.getState(),{TRACK_PADDING_H:n}=c,a=null!==(r=null===(t=this.renderer)||void 0===t?void 0:t.getWidth())&&void 0!==r?r:0;!(a<=0)&&e*i-l+n>a-n&&this.store.setStateSilent({scrollX:Math.max(0,e*i-.1*(a-2*n))})}startPlayLoop(){var e;this.playLastTime=performance.now(),this.videoFrameCache.resetCanvases();let t=!!this.getActiveAudioClip(),r=!!this.audioElement,i=null!==(e=this.store.getState().clips[0])&&void 0!==e?e:null,l=e=>{var n,a;let s;if(!this.store.getState().isPlaying){this.playRafId=null,this.videoFrameCache.resetCanvases(),null===(n=this.audioElement)||void 0===n||n.pause();return}let o=this.store.getState(),c=o.cropRange?o.cropRange.end:o.totalDuration;if(r&&i)s=Math.min(this.audioElement.currentTime-i.sourceOffset,c);else{let t=(e-this.playLastTime)/1e3;this.playLastTime=e,s=Math.min(o.currentTime+t,c)}if(s>=c){null===(a=this.audioElement)||void 0===a||a.pause(),this.store.setState({currentTime:c,isPlaying:!1}),this.requestRender(),this.playRafId=null,this.videoFrameCache.resetCanvases();return}this.store.setStateSilent({currentTime:s}),this.autoFollowPlayhead(s),t||this.updatePreviewFrameDirect(s),this.requestRender(),this.playRafId=requestAnimationFrame(l)};this.playRafId=requestAnimationFrame(l)}stopPlayLoop(){var e;null!==this.playRafId&&(cancelAnimationFrame(this.playRafId),this.playRafId=null),null===(e=this.audioElement)||void 0===e||e.pause(),this.videoFrameCache.resetCanvases()}constructor(e){var t;this.renderer=null,this.eventHandler=null,this.canvas=null,this.thumbAbort=null,this.seekSeq=0,this.destroyed=!1,this.playRafId=null,this.playLastTime=0,this.playUnsubscribe=null,this.seekRafId=null,this.pendingSeekTime=null,this.directDecoding=!1,this.directPendingTime=null,this.audioElement=null,this.audioAssetId=null,this.onPreviewFrameDirect=null,this.cropConfig=null!==(t=null==e?void 0:e.cropConfig)&&void 0!==t?t:h,this.colors=null==e?void 0:e.colors,this.store=new x,this.mediaRegistry=new w,this.thumbnailStore=new b,this.videoFrameCache=new S(e=>this.mediaRegistry.getAsset(e)),this.thumbnailService=new k(this.videoFrameCache,this.thumbnailStore),this.waveformService=new E,this.store.onAssetOrphan=e=>{this.mediaRegistry.releaseAsset(e)};let r=!1;this.playUnsubscribe=this.store.subscribe(()=>{let{isPlaying:e}=this.store.getState();e!==r&&(r=e,e&&null===this.playRafId&&this.startPlayLoop())})}}L.DEFAULT_LAYOUT={rulerHeight:c.RULER_HEIGHT,trackGap:0,thumbnailHeight:c.VIDEO_TRACK_HEIGHT+2*c.CLIP_PADDING};var I=r(16610),F=r(75074);let H={rulerHeight:20,trackGap:4,thumbnailHeight:76},O=c.MIN_SCALE,U=c.MAX_SCALE,B=H.rulerHeight+H.trackGap+H.thumbnailHeight,V={clips:[],totalDuration:0,currentTime:0,isPlaying:!1,scale:c.DEFAULT_SCALE,scrollX:0,selectedClipIds:new Set,hoverClipId:null,cropRange:null,previewFrame:null};
1class Z extends Error{constructor(e){super(e),this.name="TrimFileValidationError"}}function W(e,t){let r=t.split(",").map(e=>e.trim().toLowerCase());return e.filter(e=>{var t;let i="."+((null===(t=e.name.split(".").pop())||void 0===t?void 0:t.toLowerCase())||"");return r.includes(i)})}function G(e){var t;if(e.type.startsWith("audio/"))return!0;let r=null===(t=e.name.split(".").pop())||void 0===t?void 0:t.toLowerCase();return"mp3"===r||"wav"===r||"aac"===r}function q(e){let t=Math.round(100*Math.max(0,e)),r=Math.floor(t/100);return"".concat(String(Math.floor(r/60)).padStart(2,"0"),":").concat(String(r%60).padStart(2,"0"),":").concat(String(t%100).padStart(2,"0"))}function X(e,t){if(!e)return;let r=e.getContext("2d");if(!r)return;let i=t.width/t.height;e.height=320,e.width=Math.round(320*i),r.drawImage(t,0,0,e.width,e.height)}var K=r(71596),z=r(41673),Y=r(73862),Q=r(36678),J=r(2490),$=r(8991),ee=r(56108),et=r(62784),er=r(91309),ei=r(7537),el=r(13197),en=r(28280);function ea(e){let{className:t}=e;return(0,i.jsx)("svg",{className:t,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{d:"M2.5 2.49981C2.49995 2.32385 2.54632 2.151 2.63444 1.9987C2.72256 1.8464 2.8493 1.72005 3.00188 1.63241C3.15445 1.54476 3.32744 1.49892 3.50339 1.49952C3.67935 1.50011 3.85203 1.54713 4.004 1.63581L10.0025 5.13481C10.1539 5.22265 10.2796 5.34868 10.367 5.50031C10.4544 5.65194 10.5005 5.82386 10.5006 5.99888C10.5008 6.1739 10.455 6.34589 10.3678 6.49767C10.2807 6.64946 10.1552 6.77571 10.004 6.86381L4.004 10.3638C3.85203 10.4525 3.67935 10.4995 3.50339 10.5001C3.32744 10.5007 3.15445 10.4549 3.00188 10.3672C2.8493 10.2796 2.72256 10.1532 2.63444 10.0009C2.54632 9.84862 2.49995 9.67576 2.5 9.49981V2.49981Z",fill:"currentColor",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})})}function es(e){let{className:t}=e;return(0,i.jsxs)("svg",{className:t,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("rect",{x:"2",y:"1",width:"3",height:"10",rx:"1",fill:"currentColor"}),(0,i.jsx)("rect",{x:"7",y:"1",width:"3",height:"10",rx:"1",fill:"currentColor"})]})}function eo(e){let{className:t}=e;return(0,i.jsx)("svg",{className:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{d:"M3.33 8H12.67",stroke:"currentColor",strokeWidth:"1.33",strokeLinecap:"round"})})}function ec(e){let{className:t}=e;return(0,i.jsx)("svg",{className:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,i.jsx)("path",{d:"M8 3.33V12.67M3.33 8H12.67",stroke:"currentColor",strokeWidth:"1.33",strokeLinecap:"round"})})}function eu(e){let{className:t}=e;return(0,i.jsxs)("svg",{className:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{d:"M2.67 4H13.33M12 4V13.33C12 13.7 11.7 14 11.33 14H4.67C4.3 14 4 13.7 4 13.33V4M6 4V2.67C6 2.3 6.3 2 6.67 2H9.33C9.7 2 10 2.3 10 2.67V4",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,i.jsx)("path",{d:"M6.67 7.33V11.33M9.33 7.33V11.33",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function ed(e){let{className:t}=e;return(0,i.jsxs)("svg",{className:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.2"}),(0,i.jsx)("path",{d:"M8 7.33V11.33",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"}),(0,i.jsx)("circle",{cx:"8",cy:"5.33",r:"0.67",fill:"currentColor"})]})}function eh(e){let{className:t}=e;return(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:t,children:(0,i.jsx)("path",{d:"M3.19327 9.28447C3.45527 9.6318 3.73793 9.9798 4.04127 10.3225L3.87793 10.4865L3.3326 12.6671L5.51327 12.1225L5.6766 11.9585C6.01137 12.2543 6.35741 12.5372 6.71393 12.8
1065L6.32527 13.1958C6.23993 13.2812 6.13301 13.3418 6.01593 13.3711L2.57793 14.2311C2.46625 14.259 2.34927 14.2574 2.23837 14.2266C2.12746 14.1959 2.02642 14.1369 1.94507 14.0555C1.86372 13.9741 1.80483 13.873 1.77414 13.762C1.74345 13.6511 1.742 13.5341 1.76993 13.4225L2.62927 9.98447C2.65845 9.86712 2.71907 9.75995 2.8046 9.67447L3.19327 9.28447ZM11.5093 2.00047C12.0016 2.00079 12.4827 2.1469 12.892 2.42039C13.3014 2.69387 13.6205 3.08246 13.8093 3.53714C13.9976 3.99213 14.0468 4.49273 13.9506 4.97567C13.8545 5.45862 13.6174 5.90223 13.2693 6.25047L8.2866 11.2318C8.9846 11.7351 9.6546 12.1185 10.2499 12.3685C10.8166 12.6065 11.2519 12.6978 11.5426 12.7025C11.6959 12.7051 11.7746 12.6838 11.8073 12.6711C11.8206 12.6378 11.8419 12.5598 11.8393 12.4058C11.8346 12.1151 11.7426 11.6791 11.5059 11.1138C11.2945 10.6233 11.0411 10.152 10.7486 9.70514C10.7826 9.67714 10.8166 9.64847 10.8479 9.61647L11.7159 8.74914C13.1206 10.8365 13.5986 12.7731 12.7539 13.6178C11.5826 14.7891 8.3106 13.4165 5.44727 10.5531C2.58327 7.68914 1.21127 4.4178 2.38327 3.24647C2.5626 3.06647 2.79127 2.94647 3.05993 2.88314C2.7206 4.06714 3.3446 5.91847 4.68793 7.7898L9.74927 2.7298C10.2159 2.26314 10.8493 2.00047 11.5093 2.00047ZM11.5093 3.3338
1C11.2026 3.3338 10.9086 3.45514 10.6919 3.6718L5.5206 8.84247C6.02535 9.42649 6.57166 9.97325 7.15527 10.4785L12.3273 5.3078C12.5439 5.0907 12.6656 4.79652 12.6656 4.4898C12.6656 4.18309 12.5439 3.8889 12.3273 3.6718C12.1101 3.45527 11.8159 3.33371 11.5093 3.3338ZM5.54193 1.3758C5.56799 1.32038 5.60929 1.27351 5.661 1.24069C5.7127 1.20786 5.77269 1.19043 5.83393 1.19043C5.89518 1.19043 5.95516 1.20786 6.00687 1.24069C6.05858 1.27351 6.09987 1.32038 6.12593 1.3758L6.43793 2.04447C6.5446 2.27314 6.72793 2.45647 6.9566 2.56314L7.62527 2.87514C7.68069 2.9012 7.72756 2.94249 7.76038 2.9942C7.79321 3.04591 7.81064 3.10589 7.81064 3.16714C7.81064 3.22838 7.79321 3.28836 7.76038 3.34007C7.72756 3.39178 7.68069 3.43308 7.62527 3.45914L6.9566 3.77114C6.72793 3.8778 6.5446 4.06114 6.43793 4.2898L6.12593 4.9578C6.10007 5.01345 6.05884 5.06054 6.00711 5.09355C5.95538 5.12655 5.89529 5.14408 5.83393 5.14408C5.77257 5.14408 5.71249 5.12655 5.66075 5.09355C5.60902 5.06054 5.5678 5.01345 5.54193 4.9578L5.22993 4.2898C5.12327 4.0614 4.93967 3.8778 4.71127 3.77114L4.04327 3.45914C3.98762 3.43327 3.94052 3.39205 3.90752 3.34031C3.87452 3.28858 3.85699 3.2285 3.85699 3.16714C3.85699 3.10577 3.87452 3.04569 3.90752 2.99396C3.94052 2.94222 3.98762 2.901 4.04327 2.87514L4.71127 2.56314C4.93993 2.45647 5.12327 2.27314 5.22993 2.04447L5.54193 1.3758Z",fill:"currentColor"})})}function ep(e){let{className:t}=e;return(0,i.jsxs)("svg",{className:t,viewBox:"0 0 68 79",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{d:"M62.0257 0.0119325C64.3823 -0.162813 66.4369 1.60226 66.6169 3.95864L67.1484 10.9355C67.3281 13.2872 65.5734 15.3436 63.2227 15.5351L38.856 17.5189L39.8605 58.8066L39.8354 58.7815C39.6803 69.651 30.8283 78.4146 19.9219 78.4146C8.91911 78.4144 0.000544489 69.4953 0 58.4927C0 47.4895 8.91877 38.5668 19.9219 38.5666C23.3436 38.5666 26.5632 39.4327 29.3764 40.9522L28.5519 6.58699C28.4969 4.30478 30.239 2.37941 32.5153 2.2092L62.0257 0.0119325Z",fill:"url(#paint0_linear_audio_icon)"}),(0,i.jsx)("defs",{children:(0,i.jsxs)("linearGradient",{id:"paint0_linear_audio_icon",x1:"34.1841",y1:"6.93425",x2:"34.1841",y2:"79.2633",gradientUnits:"userSpaceOnUse",children:[(0,i.jsx)("stop",{stopColor:"white",stopOpacity:"0.4"}),(0,i.jsx)("stop",{offset:"1",stopColor:"#F5F7FF"})]})})]})}function em(e){let{hasClips:t,parsing:r,activeClip:a,previewCanvasRef:s,previewLabel:o,isAudioOnly:c,isPlaying:u,onUploadClick:d,onFileDrop:h,accept:p,maxClips:m,minDuration:f,maxDuration:v,totalClipsDuration:g}=e,x=(0,n.T)(),[_,C]=(0,l.useState)(!1),w=(0,l.useRef)(0),b=!(0,Q.im)(g,{minDuration:f,maxDuration:v}),y=(0,l.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),w.current++,e.dataTransfer.types.includes("Files")&&C(!0)},[]),k=(0,l.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),w.current--,0===w.current&&C(!1)},[]),R=(0,l.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"},[]),M=(0,l.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),w.current=0,C(!1),b){K.Z.warn(x("trim_video_exceed_duration_tip"));return}let t=W(Array.from(e.dataTransfer.files),p);t.length>0&&h(t)},[p,b,h]),j=(0,l.useMemo)(()=>c?[er.dU.Audio]:[er.dU.Video],[c]),S=(0,l.useCallback)(async e=>{let t=e.url;if(!t)return!0;try{let r=await fetch(t),i=await r.blob(),l=e.file_type||"mp4",n=e.name||"recent.".concat(l),a=new File([i],n,{type:i.type||""});h([a])}catch(e){console.error("Failed to download recent file")}return!0},[h]),E=(0,l.useCallback)(e=>{let t=e.target;t.closest(".recent-images-popover")||t.closest(".ant-popover")||d()},[d]),N=!t&&!r;return(0,i.jsxs)("div",{className:"relative flex flex-col items-center py-1 ".concat(N?"cursor-pointer":""),onClick:N?E:void 0,onDragEnter:y,onDragLeave:k,onDragOver:R,onDrop:M,children:[(0,i.jsx)("div",{className:"relative overflow-hidden rounded-2xl",style:{height:320},children:t||r?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("canvas",{ref:s,className:"bg-hl_bg_00 block h-full rounded-2xl ".concat((null==a?void 0:a.isAudio)?"hidden":"")}),(null==a?void 0:a.isAudio)&&(0,i.jsxs)("div",{className:"relative h-full w-full",children:[(0,i.jsx)("img",{src:a.thumbnailUrl||(0,F.p)({fileName:a.file.name}),alt:"Audio",className:"h-full w-full rounded-2xl object-cover"}),u?(0,i.jsx)(en.a,{className:"absolute left-1/2 top-1/2 h-[76px] w-[68px] -translate-x-1/2 -translate-y-1/2"}):(0,i.jsx)(ep,{className:"absolute left-1/2 top-1/2 h-[56px] w-[48px] -translate-x-1/2 -translate-y-1/2"})]}),r&&(0,i.jsx)("div",{className:"bg-hl_bg_06 absolute inset-0 flex items-center justify-center rounded-2xl",children:(0,i.jsx)(ee.P7,{width:"24px",height:"24px"})}),a&&!r&&(0,i.jsxs)("div",{className:"bg-hl_mask_01 absolute left-2 top-2 flex items-center gap-0.5 rounded-full px-2 py-1 backdrop-blur-[25px]",children:[(0,i.jsx)(eh,{className:"text-hl_text_06 h-4 w-4"}),(0,i.jsx)("span",{className:"cl_hl_H10_M text-hl_text_06",children:o})]})]}):(0,i.jsx)("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2 px-4",children:(0,i.jsxs)("p",{className:"cl_hl_H8_M text-hl_text_03 text-center",children:[x(c?"trim_audio_empty_tip":"trim_video_empty_tip")," ",(0,i.jsx)(ei.ZP,{fileType:et.cd.Media,remaining:1,assetFileTypes:j,onSelect:S,onPickUpload:()=>d(),children:(0,i.jsx)("span",{className:"text-hl_text_00 underline",children:x("trim_video_upload_link")})})]})})}),_&&(0,i.jsxs)("div",{className:"bg-hl_bg_04 pointer-events-none absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 rounded-2xl",children:[(0,i.jsx)(el.KL,{className:"text-hl_text_00 h-[40px] w-[40px]"}),(0,i.jsx)("p",{className:"cl_hl_H8_M text-hl_text_00 text-center",children:x("video_edit_upload_drag_tip")}),(0,i.jsxs)("p",{className:"text-hl_text_04 text-center text-xs",children:[x(c?"video_edit_upload_support_audio":"video_edit_upload_support_video"),"(",c?"MP3/WAV":"MP4/MOV",")ï¼",x("video_edit_upload_max_count_limit")]})]})]})}var ef=r(4707);function ev(e){let{isPlaying:t,currentTime:r,totalDuration:l,parsing:n,zoomPercent:a,zoomSliderRef:s,timelineContainerRef:o,timelineCanvasRef:c,timeDisplayRef:u,onTogglePlay:d,onZoomIn:h,onZoomOut:p,onZoomSliderMouseDown:m}=e;return(0,i.jsx)("div",{className:"px-1",children:(0,i.jsxs)("div",{ref:o,className:"bg-hl_bg_01 rounded-2xl px-2 pb-2",children:[(0,i.jsx)("div",{className:"px-1.5",children:(0,i.jsxs)("div",{className:"border-hl_line_00 flex h-12 items-center justify-between border-b-[0.5px]",children:[(0,i.jsx)("div",{className:"min-w-0 flex-1"}),(0,i.jsxs)("div",{className:"flex min-w-0 flex-1 items-center justify-center",children:[(0,i.jsx)("button",{type:"button",onClick:d,className:"bg-hl_white_100 border-hl_line_02 flex h-6 w-6 shrink-0 items-center justify-center rounded-full border-[0.46px]",children:t?(0,i.jsx)(es,{className:"text-hl_text_05 h-3 w-3"}):(0,i.jsx)(ea,{className:"text-hl_text_05 h-3 w-3"})}),(0,i.jsxs)("span",{className:"cl_hl_H9_M text-hl_text_00 flex h-6 w-[170px] items-center justify-center whitespace-nowrap text-[12px]".concat(n?" invisible":""),style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace",fontVariantNumeric:"tabular-nums"},children:[(0,i.jsx)("span",{ref:u,children:q(r)}),(0,i.jsxs)("span",{className:"text-hl_text_03 ml-1",children:["/ ",q(l)]})]})]}),(0,i.jsxs)("div",{className:"flex min-w-0 flex-1 items-center justify-end gap-2",children:[(0,i.jsx)("button",{type:"button",onClick:p,disabled:a<=0,className:"shrink-0 ".concat(a<=0?"pointer-events-none opacity-30":""),children:(0,i.jsx)(eo,{className:"text-hl_text_02 h-4 w-4"})}),(0,i.jsxs)("div",{ref:s,className:"relative flex h-3 w-[85px] shrink-0 cursor-pointer items-center",onMouseDown:m,children:[(0,i.jsx)("div",{className:"bg-hl_white_12 absolute h-0.5 w-full rounded-full"}),(0,i.jsx)("div",{className:"bg-hl_white_85 absolute left-0 h-0.5 rounded-full",style:{width:"".concat(a,"%")}}),(0,i.jsx)(ef.Z,{title:"".concat(Math.round(a),"%"),placement:"top",children:(0,i.jsx)("div",{className:"group/thumb bg-hl_text_00 absolute h-2 w-2 rounded-full",style:{left:"".concat(a,"%"),transform:"translateX(-50%)"}})})]}),(0,i.jsx)("button",{type:"button",onClick:h,disabled:a>=100,className:"shrink-0 ".concat(a>=100?"pointer-events-none opacity-30":""),children:(0,i.jsx)(ec,{className:"text-hl_text_02 h-4 w-4"})})]})]})}),(0,i.jsx)("canvas",{ref:c,className:"w-full",style:{height:B}})]})})}function eg(e){let{clips:t,activeClipId:r,maxClips:a,minDuration:s,maxDuration:o,totalClipsDuration:c,cropRange:u,displayNames:d,isPlaying:h,onSwitchClip:p,onRemoveClip:m,onAddClick:f,onFileDrop:v,accept:g}=e,x=(0,n.T)(),[_,C]=(0,l.useState)(!1),w=(0,l.useRef)(0),b=(0,l.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),w.current++,e.dataTransfer.types.includes("Files")&&C(!0)},[]),y=(0,l.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),w.current--,0===w.current&&C(!1)},[]),k=(0,l.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy"},[]),R=(0,l.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),w.current=0,C(!1);let t=W(Array.from(e.dataTransfer.files),g);t.length>0&&v(t)},[g,v]);return(0,i.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,i.jsxs)("div",{className:"flex items-start justify-between",children:[(0,i.jsxs)("div",{className:"flex items-center gap-0.5",children:[(0,i.jsx)(eh,{className:"text-hl_text_02 h-4 w-4"}),(0,i.jsxs)("span",{className:"cl_hl_H8_M text-hl_text_02",children:[x(t.every(e=>e.isAudio)?"trim_video_ref_section_title2":"trim_video_ref_section_title1")," ",x("trim_video_ref_limit")]})]}),(0,i.jsxs)("span",{className:"cl_hl_H8_M text-hl_text_03",children:[x("trim_video_total_label"),(0,i.jsxs)("span",{className:"inline-block text-right",style:{minWidth:85},children:[c.toFixed(1),"s / ",o,"s"]})]})]}),(0,i.jsxs)("div",{className:"grid grid-cols-3 gap-2",children:[t.map(e=>{let t=e.id===r,l=d.get(e.id)||e.name,n=t&&u?u.start:e.startTime,a=t&&u?u.end:e.endTime,s=a-n;return(0,i.jsxs)("div",{className:"group flex cursor-default items-center justify-between overflow-hidden rounded-lg border px-0.5 py-0.5 transition-colors ".concat(t?"border-hl_text_00":"bg-hl_bg_05 border-transparent"),onClick:()=>p(e.id),children:[(0,i.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,i.jsx)("div",{className:"bg-hl_bg_05 relative h-12 w-12 shrink-0 overflow-hidden rounded-md",children:e.isAudio?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("img",{src:(null==e?void 0:e.thumbnailUrl)||(0,F.p)({fileName:e.file.name}),alt:"".concat(l," cover"),className:"h-full w-full object-cover"}),t&&h?(0,i.jsx)(en.a,{className:"absolute left-1/2 top-1/2 h-5 w-5 -translate-x-1/2 -translate-y-1/2"}):(0,i.jsx)(ep,{className:"absolute left-1/2 top-1/2 h-4 w-4 -translate-x-1/2 -translate-y-1/2"})]}):e.thumbnailUrl&&(0,i.jsx)("img",{src:e.thumbnailUrl,alt:"".concat(l," thumbnail"),className:"h-full w-full object-cover"})}),(0,i.jsxs)("div",{className:"flex min-w-0 flex-col gap-1",children:[(0,i.jsxs)("div",{className:"flex h-5 items-center gap-1 py-0.5",children:[(0,i.jsx)("span",{className:"cl_hl_H9_M text-hl_text_00 truncate",children:l}),(0,i.jsx)("div",{className:"bg-hl_bg_06 flex h-4 shrink-0 items-center rounded px-1 backdrop-blur-[25px]",children:(0,i.jsxs)("span",{className:"text-hl_text_00 text-[9px] font-medium leading-[14px] tracking-[0.36px]",children:[(Math.floor(10*s)/10).toFixed(1),"s"]})})]}),(0,i.jsxs)("span",{className:"cl_hl_H11_R text-hl_text_03 truncate",children:[q(n),"-",q(a)]})]})]}),(0,i.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),m(e.id)},className:"group/del ml-1 flex h-9 w-9 shrink-0 cursor-pointer items-center justify-center ".concat(t?"opacity-100":"opacity-0 group-hover:opacity-100"),children:(0,i.jsx)(eu,{className:"text-hl_text_03 group-hover/del:text-hl_text_00 h-4 w-4 transition-colors"})})]},e.id)}),t.length<a&&(()=>{let e=!(0,Q.im)(c,{minDuration:s,maxDuration:o}),r=(0,i.jsx)("button",{type:"button",disabled:e,onClick:e?void 0:f,onDragEnter:e?void 0:b,onDragLeave:e?void 0:y,onDragOver:e?void 0:k,onDrop:e?void 0:R,className:"flex min-h-[52px] items-center justify-center rounded-lg border transition-colors ".concat(e?"bg-hl_white_04 cursor-not-allowed border-transparent opacity-50":_?"border-hl_text_03 cursor-pointer border-dashed bg-transparent":"bg-hl_white_04 hover:border-hl_text_03 cursor-pointer border-transparent hover:border-dashed hover:bg-transparent"),style:{gridColumn:"span ".concat(a-t.length)},children:(0,i.jsx)(ec,{className:"text-hl_text_00 h-5 w-5 opacity-30"})});return e?(0,i.jsx)(ef.Z,{title:(0,Y.zn)(o),children:r}):r})()]})]})}
1function ex(e){let{maxClips:t,minDuration:r,maxDuration:l,exporting:a,hasClips:s,hasRemovedClip:o,onClose:c,onConfirm:u}=e,d=(0,n.T)(),h=(0,Y.ed)(t,r,l);return(0,i.jsxs)("div",{className:"flex items-center justify-between py-4",children:[(0,i.jsxs)("div",{className:"flex items-center gap-1",children:[(0,i.jsx)(ef.Z,{title:h,children:(0,i.jsx)("span",{className:"flex shrink-0 items-center",children:(0,i.jsx)(ed,{className:"text-hl_text_03 h-4 w-4"})})}),(0,i.jsx)("span",{className:"cl_hl_H8_R text-hl_text_03",children:h})]}),(0,i.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,i.jsx)("button",{type:"button",onClick:c,className:"border-hl_line_01 cl_hl_H8_M text-hl_text_02 hover:border-hl_line_00 flex h-10 w-[114px] items-center justify-center rounded-[10px] border transition-colors",children:d("button_cancel")}),(0,i.jsxs)("button",{type:"button",onClick:u,disabled:a||!s&&!o,className:"cl_hl_H8_M flex h-10 w-[119px] items-center justify-center gap-1.5 rounded-[10px] transition-all ".concat(a?"bg-hl_text_00 text-hl_text_05":"bg-hl_white_100 text-hl_text_05 ".concat(s||o?"hover:opacity-90":"opacity-50")),children:[a&&(0,i.jsx)(ee.P7,{width:"16px",height:"16px"}),d("button_confirm")]})]})]})}function e_(e){let{open:t,onClose:r,onConfirm:c,videoFile:h,maxClips:p=3,minDuration:m=Q.Bx,maxDuration:f=Q.H2,accept:g=".mp4,.mov,.mp3,.wav",maxUploadCount:x=1,initialCropRanges:_,initialActiveFile:C,initialCoverUrls:w,maxExportResolution:b=720,maxExportTotalPixels:y=927408,maxExportBitrate:k={mov:25e6}}=e,R=(0,n.T)(),M=function(e){let{open:t,onConfirm:r,videoFile:i,maxClips:n,minDuration:a,maxDuration:c,maxUploadCount:h,initialCropRanges:p,initialActiveFile:m,initialCoverUrls:f,maxExportResolution:g=720,maxExportTotalPixels:x=927408,maxExportBitrate:_,accept:C}=e,{isDark:w}=(0,I.Z)(),b=(0,l.useRef)(new Map);b.current=null!=p?p:new Map;let y=(0,l.useRef)(new Map);y.current=null!=f?f:new Map;let k=(0,l.useRef)(void 0);k.current=m;let R=(0,l.useRef)(new Map),M=(0,l.useRef)(null),j=(0,l.useRef)(null),S=(0,l.useRef)(null),E=(0,l.useRef)(null),N=(0,l.useRef)(null),D=(0,l.useRef)(null),[T,A]=(0,l.useState)([]),[P,O]=(0,l.useState)(null),[U,B]=(0,l.useState)(!1),[ee,et]=(0,l.useState)(!1),[er,ei]=(0,l.useState)(!1),el=(0,l.useRef)(null),[en,ea]=(0,l.useState)(0),es=(0,l.useRef)(0),eo=(0,l.useRef)(!1),ec=(0,l.useRef)(0),eu=(0,l.useRef)(null),ed=T.length>0;(0,l.useEffect)(()=>{el.current=P},[P]);let eh=(0,l.useCallback)(e=>M.current?M.current.subscribe(e):()=>void 0,[en]),ep=(0,l.useCallback)(()=>{var e,t;return null!==(t=null===(e=M.current)||void 0===e?void 0:e.getState())&&void 0!==t?t:V},[en]),em=(0,l.useSyncExternalStore)(eh,ep,()=>V);(0,l.useEffect)(()=>{let e;if(!em.isPlaying||!M.current)return;let t=()=>{let r=D.current;if(r){var i,l;let e=null!==(l=null===(i=M.current)||void 0===i?void 0:i.getState().currentTime)&&void 0!==l?l:0;r.textContent=q(e)}e=requestAnimationFrame(t)};return e=requestAnimationFrame(t),()=>cancelAnimationFrame(e)},[em.isPlaying]),(0,l.useEffect)(()=>{var e;let t=w?d:u;R.current.forEach(e=>e.setColors(t)),null===(e=eu.current)||void 0===e||e.setColors(t)},[w]),(0,l.useEffect)(()=>{if(t)return()=>{var e;ec.current++,R.current.forEach(e=>e.destroy()),R.current.clear(),null===(e=eu.current)||void 0===e||e.destroy(),eu.current=null,M.current=null,A([]),O(null),ea(0),es.current=0,eo.current=!1,ei(!1)}},[t]),(0,l.useEffect)(()=>{if(!t||ed)return;let e=!1,r=()=>{if(e||M.current)return;let t=j.current,i=E.current;if(!t||!i){requestAnimationFrame(r);return}let l=i.clientWidth-parseFloat(getComputedStyle(i).paddingLeft)-parseFloat(getComputedStyle(i).paddingRight);if(!(l>0)){requestAnimationFrame(r);return}eu.current||(eu.current=new L({cropConfig:{minDuration:a,maxDuration:c},colors:w?d:u}));let n=eu.current;n.attachCanvas(t,l,H),M.current=n,ea(e=>e+1)};return requestAnimationFrame(r),()=>{e=!0}},[t,ed]);let ef=(0,l.useCallback)(()=>{let e=E.current;if(!e)return 756;let t=getComputedStyle(e);return e.clientWidth-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)},[]),ev=(0,l.useCallback)(e=>{e.onPreviewFrameDirect=(e,t,r)=>{let i=S.current;if(!i)return;let l=i.getContext("2d");l&&(i.height=320,i.width=Math.round(t/r*320),l.drawImage(e,0,0,i.width,i.height))}},[]),eg=(0,l.useCallback)(function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=j.current;if(!r)return;let i=ef();if(e.attachCanvas(r,i,H),ev(e),t){let{totalDuration:t}=e.getState(),r=v(t,i);e.setScale(r)}},[ef,ev]),ex=(0,l.useCallback)(function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=M.current;t&&(t.getState().isPlaying&&t.togglePlay(),t.onPreviewFrameDirect=null,t.detachCanvas(e))},[]);(0,l.useEffect)(()=>{let e=E.current;if(!e)return;let t=new ResizeObserver(()=>{let e=M.current;if(!e)return;let t=ef();e.resize(t,H)});return t.observe(e),()=>t.disconnect()},[ef]);let e_=(0,l.useCallback)(()=>{let e=el.current;if(!e)return;let t=R.current.get(e);if(!t)return;let r=t.getCropRange();r&&A(t=>t.map(t=>
1t.id===e?(0,o._)((0,s._)({},t),{startTime:r.start,endTime:r.end,duration:r.end-r.start}):t))},[]),eC=(0,l.useCallback)(async(e,t,r,i)=>{let l,n;let s=new L({cropConfig:{minDuration:a,maxDuration:c},colors:w?d:u});await s.addMedia(e);let{totalDuration:o}=s.getState();if(!G(e)){let{width:t,height:r}=await (0,J.jC)(e).catch(()=>({width:0,height:0}));if(t>0&&r>0&&(t<$.gh||r<$.gh||t>$.D||r>$.D||t*r<$.MK))throw s.destroy(),new Z((0,z.getTranslation)("video_edit_upload_resolution_limit"))}if(o>0&&o<a)throw s.destroy(),new Z((0,Y.oi)(a));r?n=Math.max((l=Math.max(0,Math.min(r.start,o)))+a,Math.min(r.end,o)):(l=0,n=Math.min(o,null!=t?t:c)),s.setCropRange({start:l,end:n});let h=G(e),p=r?l:0,m=await s.getPreviewFrame(p),f=h?(0,F.p)({backendCoverUrl:i,fileName:e.name}):i||(m?function(e){try{let t=Math.min(window.devicePixelRatio||1,2),r=Math.round(48*t),i=document.createElement("canvas");i.width=r,i.height=r;let l=i.getContext("2d");if(!l)return;return!function(e,t,r,i,l,n){let a=Math.max(l/r,n/i),s=r*a,o=i*a;e.drawImage(t,(l-s)/2,(n-o)/2,s,o)}(l,e,e.width,e.height,r,r),i.toDataURL("image/jpeg",.8)}catch(e){return}}(m):void 0);return r&&l>0&&s.seek(l),es.current++,{clip:{id:crypto.randomUUID(),name:"Video".concat(es.current),file:e,sourceFile:e,startTime:l,endTime:n,duration:n-l,thumbnailUrl:f,totalDuration:o,isAudio:h,initialStartTime:l,initialEndTime:n},engine:s,bitmap:m}},[a,c,w]),ew=(0,l.useCallback)(async(e,t)=>{e_();let r=M.current;(null==r?void 0:r.getState().isPlaying)&&r.togglePlay();let i=ec.current,l=b.current.get(e),n=y.current.get(e);et(!0);try{let{clip:r,engine:a,bitmap:s}=await eC(e,t,l,n);if(ec.current!==i){a.destroy();return}if(R.current.set(r.id,a),ex(!1),eg(a,!0),l){let{scale:e}=a.getState(),t=ef(),r=(l.start+l.end)/2*e;a.setScrollX(Math.max(0,r-t/2))}s&&X(S.current,s),M.current=a,A(e=>[...e,r]),O(r.id),ea(e=>e+1)}catch(e){if(e instanceof Z){K.Z.warn(e.message);return}throw e}finally{et(!1)}},[e_,eC,ex,eg,ef]),eb=(0,l.useCallback)(async e=>{let t;if(0===e.length)return;e_();let r=c-T.reduce((e,t)=>{if(t.id===el.current){let r=R.current.get(t.id),i=null==r?void 0:r.getCropRange();if(i)return e+(i.end-i.start)}return e+t.duration},0);if(t=Math.max(t=T.length>0?r/e.length:1===e.length?6:5,a),1===e.length){await ew(e[0],t);return}let i=M.current;(null==i?void 0:i.getState().isPlaying)&&i.togglePlay();let l=ec.current;et(!0);try{let r=await Promise.allSettled(e.map(e=>{let r=b.current.get(e),i=y.current.get(e);return eC(e,t,r,i)})),i=r.filter(e=>"rejected"===e.status&&e.reason instanceof Z).map(e=>e.reason.message);i.length>0&&K.Z.warn(i[0]);let n=r.filter(e=>"fulfilled"===e.status).map(e=>e.value);if(0===n.length)return;if(ec.current!==l){n.forEach(e=>e.engine.destroy());return}for(let e of n)R.current.set(e.clip.id,e.engine);let a=n.length-1,s=k.current;if(s){let e=n.findIndex(e=>e.clip.file===s);e>=0&&(a=e)}let o=ef();for(let e of n){let t=v(e.clip.totalDuration,o);e.engine.setScale(t);let r=b.current.get(e.clip.file);if(r){let i=(r.start+r.end)/2*t;e.engine.setScrollX(Math.max(0,i-o/2))}}let c=n[a];ex(!1),eg(c.engine),c.bitmap&&X(S.current,c.bitmap),M.current=c.engine;let u=n.map(e=>e.clip);A(e=>[...e,...u]),O(u[a].id),ea(e=>e+1)}finally{et(!1)}},[T,c,a,ew,e_,eC,ex,eg,ef]);(0,l.useEffect)(()=>{if(!t||!(null==i?void 0:i.length)||eo.current)return;et(!0);let e=requestAnimationFrame(async()=>{eo.current||(eo.current=!0,await eb(i))});return()=>cancelAnimationFrame(e)},[t,i,eb]),(0,l.useEffect)(()=>{let e=M.current;if(!e||em.isPlaying)return;let t=!1;return e.getPreviewFrame(em.currentTime).then(e=>{!t&&e&&X(S.current,e)}),()=>{t=!0}},[em.currentTime,em.isPlaying,en]),(0,l.useEffect)(()=>{if(!P)return;let e=R.current.get(P);if(!e)return;let t=Math.max(a,Math.min(c-T.reduce((e,t)=>t.id===P?e:e+t.duration,0),c));e.updateCropConfig({minDuration:a,maxDuration:t});let r=e.getCropRange();r&&r.end-r.start>t&&e.setCropRange({start:r.start,end:r.start+t})},[T,P,a,c]);let ey=(0,l.useCallback)(()=>{var e;return null===(e=M.current)||void 0===e?void 0:e.togglePlay()},[]),ek=(0,l.useCallback)(()=>{var e;null===(e=N.current)||void 0===e||e.click()},[]),eR=(0,l.useCallback)(e=>{if(0===e.length)return;let t=(null!=n?n:3)-T.length;if(t<=0)return;let r=e.slice(0,t);0!==r.length&&eb(r)},[T.length,n,eb]),eM=(0,l.useCallback)(e=>{let t=e.target.files;if(!t||0===t.length)return;let r=(null!=n?n:3)-T.length;if(r<=0)return;let i=W(Array.from(t),C).slice(0,Math.min(r,null!=h?h:1));e.target.value="",0!==i.length&&eb(i)},[T.length,n,h,C,eb]),ej=(0,l.useCallback)(e=>{if(e===P)return;e_(),ex(!1);let t=R.current.get(e);if(!t)return;eg(t),M.current=t,O(e),ea(e=>e+1);let r=t.getState();t.getPreviewFrame(r.currentTime).then(e=>{e&&X(S.current,e)})},[P,e_,ex,eg]),eS=(0,l.useCallback)((e,t,r)=>{let i=r[0],l=R.current.get(i.id);t.getState().isPlaying&&t.togglePlay(),t.onPreviewFrameDirect=null,t.detachCanvas(!1),M.current=null,D.current&&(D.current.textContent=q(0)),l&&(eg(l),M.current=l,l.seek(0),l.getPreviewFrame(0).then(e=>{e&&X(S.current,e)})),t.destroy(),R.current.delete(e),O(i.id)},[eg]),eE=(0,l.useCallback)((e,t,r)=>{if(t&&(r&&(t.getState().isPlaying&&t.togglePlay(),t.onPreviewFrameDirect=null,t.detachCanvas(),M.current=null),t.destroy(),R.current.delete(e)),r){D.current&&(D.current.textContent=q(0)),O(null);let e=S.current;if(e){let t=e.getContext("2d");t&&t.clearRect(0,0,e.width,e.height)}}},[]),eN=(0,l.useCallback)(e=>{let t=R.current.get(e),r=t===M.current,i=T.filter(t=>t.id!==e);r&&i.length>0&&t?eS(e,t,i):eE(e,t,r),A(i),ei(!0),ea(e=>e+1)},[T,eS,eE]),eD=(0,l.useCallback)(async()=>
1{if(!U){if(0===T.length){r([]);return}B(!0);try{let e=[...T];if(P){let t=R.current.get(P);if(t){let r=t.getCropRange();r&&(e=e.map(e=>e.id===P?(0,o._)((0,s._)({},e),{startTime:r.start,endTime:r.end,duration:r.end-r.start}):e))}}let t=(await Promise.all(e.map(async e=>{let t=R.current.get(e.id);if(!t)return null;let r=.01>Math.abs(e.startTime-e.initialStartTime)&&.01>Math.abs(e.endTime-e.initialEndTime),i=.01>Math.abs(e.startTime)&&.01>Math.abs(e.endTime-e.totalDuration),l=(0,Q.t7)(e.duration,{minDuration:a,maxDuration:c});if(r&&i&&!l)return(0,o._)((0,s._)({},e),{sourceFile:e.file,file:e.file});let n=g;if(!e.isAudio){let t=await (0,J.jC)(e.file).catch(()=>({width:0,height:0}));if(t.width>0&&t.height>0&&t.height>g){let e=g/t.height;Math.floor(t.width*e)*g<$.MK&&(n=Math.ceil(Math.sqrt($.MK*t.height/t.width))+2)}}let u=await t.exportCrop({maxResolution:n,maxTotalPixels:x,maxBitrate:_});if(!u)return null;let d=new File([u],e.file.name,{type:u.type});return(0,o._)((0,s._)({},e),{sourceFile:e.file,file:d})}))).filter(e=>null!==e);r(t)}catch(e){console.error("导åºè£åªèµæºå¤±è´¥ï¼",e)}finally{B(!1)}}},[T,P,U,r,g,x,_,a,c]),eT=T.find(e=>e.id===P);return{clips:T,activeClipId:P,activeClip:eT,exporting:U,parsing:ee,hasClips:ed,hasRemovedClip:er,state:em,engineVersion:en,timelineCanvasRef:j,previewCanvasRef:S,timelineContainerRef:E,fileInputRef:N,timeDisplayRef:D,activeEngineRef:M,handleTogglePlay:ey,handleAddClick:ek,handleFileDrop:eR,handleFileSelected:eM,handleSwitchClip:ej,handleRemoveClip:eN,handleConfirm:eD}}({open:t,onConfirm:c,videoFile:h,maxClips:p,minDuration:m,maxDuration:f,maxUploadCount:x,initialCropRanges:_,initialActiveFile:C,initialCoverUrls:w,maxExportResolution:b,maxExportTotalPixels:y,maxExportBitrate:k,accept:g}),j=function(e){let{open:t,scale:r,activeEngineRef:i}=e,n=(0,l.useRef)(null),a=(0,l.useMemo)(()=>Math.log(O),[]),s=(0,l.useMemo)(()=>Math.log(U),[]),o=(0,l.useMemo)(()=>Math.min(100,Math.max(0,(Math.log(r)-a)/(s-a)*100)),[r,a,s]),c=(0,l.useCallback)(e=>{let t=i.current;if(!t)return;let r=(Math.log(t.getState().scale)-a)/(s-a),l=Math.exp(a+Math.max(0,Math.min(1,r+e))*(s-a));t.setScale(l)},[i,a,s]),u=(0,l.useCallback)(()=>c(.05),[c]),d=(0,l.useCallback)(()=>c(-.05),[c]);(0,l.useEffect)(()=>{if(!t)return;let e=e=>{var t;let r=null===(t=e.target)||void 0===t?void 0:t.tagName;"INPUT"!==r&&"TEXTAREA"!==r&&("+"===e.key||"="===e.key?(e.preventDefault(),u()):("-"===e.key||"_"===e.key)&&(e.preventDefault(),d()))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t,u,d]);let h=(0,l.useCallback)(e=>{var t;let r=n.current;if(!r)return;let l=r.getBoundingClientRect(),o=Math.exp(a+Math.max(0,Math.min(1,(e-l.left)/l.width))*(s-a));null===(t=i.current)||void 0===t||t.setScale(o)},[i,a,s]);return{zoomPercent:o,zoomSliderRef:n,handleZoomIn:u,handleZoomOut:d,handleZoomSliderMouseDown:(0,l.useCallback)(e=>{e.preventDefault(),h(e.clientX);let t=e=>h(e.clientX),r=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",t),document.addEventListener("mouseup",r)},[h])}}({open:t,scale:M.state.scale,activeEngineRef:M.activeEngineRef}),S=(0,l.useMemo)(()=>{let e=M.state.cropRange?M.state.cropRange.end-M.state.cropRange.start:null;return M.clips.reduce((t,r)=>r.id===M.activeClipId&&null!==e?t+e:t+r.duration,0)},[M.clips,M.activeClipId,M.state.cropRange]),E=(0,l.useMemo)(()=>{let e=new Map,t=0,r=0;for(let i of M.clips)i.isAudio?(r++,e.set(i.id,"".concat(R("filter_type_audio")).concat(r))):(t++,e.set(i.id,"".concat(R("filter_type_video")).concat(t)));return e},[M.clips,R]),N=(M.activeClipId?E.get(M.activeClipId):void 0)||R("filter_type_video"),D=(0,l.useMemo)(()=>{let e=g.split(",").map(e=>e.trim().toLowerCase()),t=[".mp3",".wav",".aac",".flac",".ogg",".wma",".m4a"];return e.length>0&&e.every(e=>t.includes(e))},[g]);return(0,i.jsxs)(a.Z,{open:t,onCancel:r,footer:null,colorMode:"dark",closable:!0,maskClosable:!1,destroyOnClose:!0,size:"xl",title:D?R("trim_video_title2"):R("trim_video_title1"),classNames:{body:"!p-0",wrapper:"trim-video-modal"},children:[(0,i.jsx)("input",{ref:M.fileInputRef,type:"file",accept:g,multiple:x>1,onChange:M.handleFileSelected,className:"hidden"}),(0,i.jsxs)("div",{className:"flex flex-col gap-6",children:[(0,i.jsxs)("div",{className:"bg-hl_bg_06 overflow-hidden rounded-[20px] pb-1",children:[(0,i.jsx)(em,{hasClips:M.hasClips,parsing:M.parsing,activeClip:M.activeClip,previewCanvasRef:M.previewCanvasRef,previewLabel:N,isAudioOnly:D,isPlaying:M.state.isPlaying,onUploadClick:M.handleAddClick,onFileDrop:M.handleFileDrop,accept:g,maxClips:p,minDuration:m,maxDuration:f,totalClipsDuration:S}
1),(0,i.jsx)(ev,{isPlaying:M.state.isPlaying,currentTime:M.state.currentTime,totalDuration:M.state.totalDuration,parsing:M.parsing,zoomPercent:j.zoomPercent,zoomSliderRef:j.zoomSliderRef,timelineContainerRef:M.timelineContainerRef,timelineCanvasRef:M.timelineCanvasRef,timeDisplayRef:M.timeDisplayRef,onTogglePlay:M.handleTogglePlay,onZoomIn:j.handleZoomIn,onZoomOut:j.handleZoomOut,onZoomSliderMouseDown:j.handleZoomSliderMouseDown})]}),(0,i.jsx)(eg,{clips:M.clips,activeClipId:M.activeClipId,maxClips:p,minDuration:m,maxDuration:f,totalClipsDuration:S,cropRange:M.state.cropRange,displayNames:E,isPlaying:M.state.isPlaying,onSwitchClip:M.handleSwitchClip,onRemoveClip:M.handleRemoveClip,onAddClick:M.handleAddClick,onFileDrop:M.handleFileDrop,accept:g})]}),(0,i.jsx)(ex,{maxClips:p,minDuration:m,maxDuration:f,exporting:M.exporting,hasClips:M.hasClips,hasRemovedClip:M.hasRemovedClip,onClose:r,onConfirm:M.handleConfirm})]})}},35676:function(e,t,r){"use strict";var i=r(11719),l=r(26015),n=r(88661),a=r(84089);t.Z=e=>{var t;let{modelId:r,isExtendMode:s,assets:o,resolutions:c,durations:u,costs:d,selectedDuration:h,selectedResolution:p,preferredDuration:m,enabledDurations:f,onResetDuration:v,onConsumePreferredDuration:g}=e,x=(0,n.useMemo)(()=>(0,a.zu)({isExtendMode:s,assets:o,durations:u,enabledDurations:null}),[s,o,u]),_=(0,n.useMemo)(()=>(0,a._7)({resolutions:c,durations:u,costs:d}),[c,u,d]),C="audio"===x.sourceMediaType?_.enabledDurations:f,w=(0,n.useMemo)(()=>(0,a.zu)({isExtendMode:s,assets:o,durations:u,enabledDurations:C}),[s,o,u,C]),b=(0,n.useRef)(null),y=w.eligibleDurations?Array.from(w.eligibleDurations).sort((e,t)=>e-t).join(","):"",k=w.active?"".concat(null!=r?r:"","|").concat(w.assetSignature,"|").concat(null!==(t=w.sourceMediaType)&&void 0!==t?t:"","|").concat(y):null;return(0,n.useEffect)(()=>{if(!k){b.current=null;return}let e=b.current!==k,t=(0,a.lj)({constraint:w,baselineChanged:e,preserveEligibleSelectionOnBaselineChange:void 0!==m&&h===m,selectedDuration:h,selectedResolution:p,resolutions:c,audioAvailability:_});b.current=k,void 0!==m&&(null==g||g()),t&&v(t.duration,t.resolution)},[k,w,h,p,m,c,_,v,g]),(0,l._)((0,i._)({},w),{getAudioResolution:e=>(0,a.M7)({duration:e,selectedResolution:p,resolutions:c,availability:_})})}},75074:function(e,t,r){"use strict";r.d(t,{p:function(){return l}});var i=r(27149);function l(e){return e.backendCoverUrl?e.backendCoverUrl:(0,i.P)(e.fileId||e.url||e.fileName||"")}},27149:function(e,t,r){"use strict";r.d(t,{P:function(){return n}});var i=r(77269);let l=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let r=t;for(let e=0;e<8;e++)r=1&r?r>>>1^3988292384:r>>>1;e[t]=r}return e})();function n(e){let t=function(e){let t=new TextEncoder().encode(e),r=4294967295;for(let e=0;e<t.length;e++)r=r>>>8^l[(r^t[e])&255];return(4294967295^r)>>>0}(e)%22+1,r=i.a1?"https://cdn.hailuoai.video/moss/assets/bg":"https://minimax-public-cdn.oss-cn-wulanchabu.aliyuncs.com/cdn-yingshi-ai-com/moss/assets/bg";return"".concat(r,"/bg_").concat(t,".jpg")}},38585:function(){}}]);
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.