PageSourceSearch

https://fourevamedia.com/_next/static/chunks/16740-88a797a46bad93bf.js?dpl=dpl_DtPCZbPoZGXvTayFeF2JHvMH65Zh

js fourevamedia.com collected 2026-10-02 05:06:55 UTC 55,223 bytes, 13 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8727,16740],{408727:(e,t,a)=>{a.r(t),a.d(t,{ThumbnailWithFallback:()=>c,getThumbnailUrl:()=>o,pollForThumbnail:()=>l});var r=a(695155),n=a(212115),s=a(117243),i=a(506296);function o(e){return`https://vz-0775a2c7-585.b-cdn.net/${e}/thumbnail.jpg`}async function l(e,t){let a=t?.maxAttempts??20,r=t?.intervalMs??3e3,n=t?.initialDelayMs??5e3,s=o(e),i=async()=>{try{return(await fetch(s,{method:"HEAD"})).ok}catch{return!1}};for(let e=0;e<a;e++)if(await new Promise(t=>setTimeout(t,0===e?n:r)),await i())return s;return""}function c({src:e,alt:t="Video thumbnail",className:a="",showLabel:o=!0,loadingLabel:l="Loading thumbnail...",loadedLabel:d="Auto-generated from video"}){let[u,h]=(0,n.useState)(!0),[p,x]=(0,n.useState)(!1),[m,f]=(0,n.useState)(0);return((0,n.useEffect)(()=>{if(p&&m<5){let e=setTimeout(()=>{x(!1),h(!0),f(e=>e+1)},3e3);return()=>clearTimeout(e)}},[p,m]),(0,n.useEffect)(()=>{h(!0),x(!1),f(0)},[e]),p&&m>=5)?(0,r.jsxs)("div",{className:`flex items-center gap-3 ${a}`,children:[(0,r.jsx)("div",{className:"w-20 h-12 rounded-lg bg-[#e1ddd8] dark:bg-[#262b35] flex items-center justify-center",children:(0,r.jsx)(s.A,{className:"w-4 h-4 text-[#8c8c8c]"})}),o&&(0,r.jsx)("span",{className:"text-sm text-[#5f5a55] dark:text-[#b2b6c2] font-albert",children:"Thumbnail generating..."})]}):(0,r.jsxs)("div",{className:`flex items-center gap-3 ${a}`,children:[(0,r.jsxs)("div",{className:"relative w-20 h-12",children:[u&&(0,r.jsx)("div",{className:"absolute inset-0 rounded-lg bg-[#e1ddd8] dark:bg-[#262b35] animate-pulse flex items-center justify-center",children:(0,r.jsx)(i.A,{className:"w-4 h-4 animate-spin text-[#8c8c8c]"})}),(0,r.jsx)("img",{src:`${e}?t=${m}`,alt:t,className:`w-20 h-12 object-cover rounded-lg transition-opacity ${u?"opacity-0":"opacity-100"}`,onLoad:()=>h(!1),onError:()=>{h(!1),x(!0)}})]}),o&&(0,r.jsx)("span",{className:"text-sm text-[#5f5a55] dark:text-[#b2b6c2] font-albert",children:u?l:d})]})}},716740:(e,t,a)=>{a.r(t),a.d(t,{ImageUpload:()=>ee,MediaUpload:()=>ee});var r=a(695155),n=a(212115),s=a(450910),i=a(337206),o=a(506296),l=a(86901),c=a(310013),d=a(645005),u=a(33223),h=a(117243),p=a(512445),x=a(32087),m=a(408727),f=a(466542),b=a(467760),g=a(704603),v=a(474862),j=a(5772),w=a(161878),k=a(754332),y=a(833210),N=a(394537),$=a(442763),C=a(562840),P=a(140980);let M="professional coaching",S={zIndex:0x7fffffbc},E={zIndex:0x7fffffc6},L={"data-pexels-stock-layer":""};function z(e){if(!e)return"";let t=Math.round(e),a=Math.floor(t/60);return`${a}:${(t%60).toString().padStart(2,"0")}`}function A({open:e,onOpenChange:t,type:a="image",title:s="Stock Media",zIndex:i="z-[2147483590]",searchEndpoint:l="/api/coach/pexels",onSelect:c}
1){let u=(0,N.U)("(min-width: 768px)"),p=(0,n.useRef)(0),x=(0,n.useRef)(M),m=(0,n.useRef)(null),f=(0,n.useMemo)(()=>(function(e){switch(e){case"image":return["image"];case"video":return["video"];case"media":case"any":return["image","video"];default:return[]}})(a),[a]),[b,g]=(0,n.useState)(()=>f[0]||"image"),[v,T]=(0,n.useState)(M),[D,U]=(0,n.useState)([]),[W,R]=(0,n.useState)(1),[F,_]=(0,n.useState)(!1),[B,I]=(0,n.useState)(!1),[V,O]=(0,n.useState)(!1),[G,H]=(0,n.useState)(null);(0,n.useEffect)(()=>{0!==f.length&&(f.includes(b)||g(f[0]))},[b,f]),(0,n.useEffect)(()=>{e||(p.current+=1,m.current?.abort(),m.current=null,H(null),I(!1),O(!1))},[e]),(0,n.useEffect)(()=>()=>m.current?.abort(),[]);let q=(0,n.useCallback)(async(t,a,r=!1)=>{if(!e||0===f.length||!f.includes(b))return;let n=t.trim()||M,s=++p.current;m.current?.abort();let i=new AbortController;m.current=i,r||(x.current=n),r?O(!0):(I(!0),U([])),H(null);try{let e=new URLSearchParams({query:n,type:"video"===b?"videos":"photos",page:String(a),perPage:String(12)}),t=await fetch(`${l}?${e.toString()}`,{cache:"no-store",signal:i.signal}),o=await t.json().catch(()=>({}));if(!t.ok)throw Error(o.error||"Stock search failed");if(p.current!==s)return;let c=Array.isArray(o.results)?o.results:[];U(e=>r?[...e,...c]:c),R("number"==typeof o.page?o.page:a),_(!!o.hasMore)}catch(e){if(e instanceof DOMException&&"AbortError"===e.name||p.current!==s)return;H(e instanceof Error?e.message:"Stock search failed"),r||U([])}finally{p.current===s&&(I(!1),O(!1))}},[b,f,e,l]);(0,n.useEffect)(()=>{e&&0!==f.length&&q(x.current,1)},[f.length,b,q,e]);let J=(0,r.jsxs)("div",{className:"space-y-5 pt-6",onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[(0,r.jsxs)("form",{onSubmit:e=>{e.preventDefault(),e.stopPropagation();let t=v.trim()||M;T(t),q(t,1)},className:"relative flex h-12 min-w-0 flex-1 items-center gap-3 overflow-hidden rounded-full border border-[#e1ddd8] bg-white pl-5 pr-1.5 shadow-sm transition-colors focus-within:border-brand-accent dark:border-[#262b35] dark:bg-[#11141b]",children:[(0,r.jsx)(w.A,{className:"pointer-events-none h-4 w-4 shrink-0 text-[#8f8a85]"}),(0,r.jsx)("input",{value:v,onChange:e=>T(e.target.value),placeholder:"Search stock",className:"h-full min-w-0 flex-1 bg-transparent pr-2 text-[15px] font-albert text-[#1a1a1a] placeholder:text-[#9a958f] focus:outline-none dark:text-[#f5f5f8]"}),(0,r.jsx)("button",{type:"submit",className:"h-9 shrink-0 rounded-full bg-brand-accent px-4 text-sm font-semibold text-brand-accent-on-accent transition-opacity hover:opacity-90 font-albert",children:"Search"})]}),f.length>1&&(0,r.jsx)("div",{className:"flex h-12 shrink-0 items-center gap-1 rounded-full bg-[#f3f1ef] p-1 dark:bg-[#262b35]",children:f.map(e=>{let t="video"===e?d.A:h.A,a=b===e;return(0,r.jsxs)("button",{type:"button",onClick:()=>g(e),className:(0,P.cn)("flex h-full items-center gap-2 rounded-full px-4 text-sm font-semibold transition-colors font-albert",a?"bg-white text-[#1a1a1a] shadow-sm dark:bg-[#171b22] dark:text-white":"text-[#6b6560] hover:bg-white/60 dark:text-[#b2b6c2] dark:hover:bg-[#171b22]/70"),children:[(0,r.jsx)(t,{className:"h-4 w-4"}),"video"===e?"Videos":"Images"]},e)})})]}),B?(0,r.jsx)("div",{className:"flex min-h-[320px] items-center justify-center",children:(0,r.jsx)(o.A,{className:"h-6 w-6 animate-spin text-brand-accent"})}):G?(0,r.jsxs)("div",{className:"flex min-h-[280px] flex-col items-center justify-center rounded-2xl border border-dashed border-[#e1ddd8] bg-[#fbfaf9] px-6 text-center dark:border-[#262b35] dark:bg-[#11141b]/60",children:[(0,r.jsx)("div",{className:"mb-3 flex h-12 w-12 items-center justify-center rounded-full bg-white text-brand-accent shadow-sm dark:bg-white/10",children:(0,r.jsx)(w.A,{className:"h-5 w-5"})}),(0,r.jsx)("p",{className:"text-sm font-semibold text-[#1a1a1a] dark:text-[#f5f5f8] font-albert",children:"Stock search unavailable"}),(0,r.jsx)("p",{className:"mt-1 max-w-xs text-sm text-[#8f8a85] dark:text-[#8f929e] font-albert",children:G})]}):0===D.length?(0,r.jsxs)("div",{className:"flex min-h-[280px] flex-col items-center justify-center rounded-2xl border border-dashed border-[#e1ddd8] bg-[#fbfaf9] px-6 text-center dark:border-[#262b35] dark:bg-[#11141b]/60",children:[(0,r.jsx)("div",{className:"mb-3 flex h-12 w-12 items-center justify-center rounded-full bg-white text-brand-accent shadow-sm dark:bg-white/10",children:(0,r.jsx)(w.A,{className:"h-5 w-5"})}),(0,r.jsx)("p",{className:"text-sm font-semibold text-[#1a1a1a] dark:text-[#f5f5f8] font-albert",children:"No stock matches"}),(0,r.jsx)("p",{className:"mt-1 max-w-xs text-sm text-[#8f8a85] dark:text-[#8f929e] font-albert",children:"Try a more visual search term."})]}):(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-3",children:D.map(e=>{let a=e.thumbnailUrl||e.thumbnail||e.imageUrl||e.contentUrl,n="video"===e.type;return(0,r.jsxs)("button",{type:"button",onClick:a=>{a.stopPropagation(),c(e),t(!1)},className:"group overflow-hidden rounded-xl border border-[#e1ddd8] bg-white text-left shadow-sm transition-all hover:-translate-y-0.5 hover:border-brand-accent/60 hover:shadow-md dark:border-[#262b35] dark:bg-[#11141b]",children:[(0,r.jsxs)("div",{className:"relative aspect-video bg-[#f3f1ef] dar
1k:bg-[#262b35]",children:[a?(0,r.jsx)(j.default,{src:a,alt:e.alt||`${"video"===e.type?"Video":"Photo"} by ${e.attributionName||e.photographer||"Pexels"}`,fill:!0,className:"object-cover",sizes:"260px"}):(0,r.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:n?(0,r.jsx)(k.A,{className:"h-7 w-7 text-[#8f8a85]"}):(0,r.jsx)(h.A,{className:"h-7 w-7 text-[#8f8a85]"})}),(0,r.jsxs)("span",{className:"absolute left-2 top-2 flex items-center gap-1 rounded-full bg-black/55 px-2 py-1 text-[11px] font-semibold text-white backdrop-blur-sm font-albert",children:[n?(0,r.jsx)(k.A,{className:"h-3 w-3"}):(0,r.jsx)(h.A,{className:"h-3 w-3"}),n?"Video":"Image"]}),n&&z(e.duration)&&(0,r.jsx)("span",{className:"absolute bottom-2 right-2 rounded-full bg-black/55 px-2 py-1 text-[11px] font-semibold text-white backdrop-blur-sm font-albert",children:z(e.duration)})]}),(0,r.jsxs)("div",{className:"p-3",children:[(0,r.jsx)("p",{className:"truncate text-sm font-semibold text-[#1a1a1a] dark:text-[#f5f5f8] font-albert",children:e.attributionName||e.photographer||"Pexels"}),(0,r.jsxs)("p",{className:"mt-0.5 truncate text-xs text-[#8f8a85] dark:text-[#8f929e] font-albert",children:["Pexels",e.width&&e.height?` \xb7 ${e.width}\xd7${e.height}`:""]})]})]},`${e.type}-${e.id}`)})}),F&&(0,r.jsx)("div",{className:"flex justify-center border-t border-[#e1ddd8]/70 pt-4 dark:border-[#262b35]",children:(0,r.jsxs)("button",{type:"button",onClick:()=>void q(x.current,W+1,!0),disabled:V,className:"flex h-10 items-center gap-2 rounded-full border border-[#e1ddd8] bg-white px-4 text-sm font-semibold text-[#1a1a1a] transition-colors hover:border-brand-accent hover:text-brand-accent disabled:opacity-60 dark:border-[#262b35] dark:bg-[#11141b] dark:text-[#f5f5f8] font-albert",children:[V&&(0,r.jsx)(o.A,{className:"h-4 w-4 animate-spin"}),"Load more"]})})]})]});return u?(0,r.jsx)($.lG,{open:e,onOpenChange:t,children:(0,r.jsxs)($.Cf,{"data-pexels-stock-layer":"",className:"!flex max-h-[85vh] max-w-4xl flex-col gap-0 overflow-hidden p-0",hideCloseButton:!0,zIndex:i,overlayStyle:S,overlayProps:L,style:E,children:[(0,r.jsxs)($.c7,{className:"!flex-row items-center justify-between gap-3 space-y-0 px-6 py-5",children:[(0,r.jsx)($.L3,{className:"font-albert",children:s}),(0,r.jsx)("button",{type:"button",onClick:()=>t(!1),className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-[#6b6560] transition-colors hover:bg-[#f3f1ef] hover:text-[#1a1a1a] dark:text-[#b2b6c2] dark:hover:bg-[#262b35] dark:hover:text-white","aria-label":"Close stock picker",children:(0,r.jsx)(y.A,{className:"h-4 w-4"})})]}),(0,r.jsx)($.FE,{className:"px-6",children:J})]})}):(0,r.jsx)(C._s,{open:e,onOpenChange:t,children:(0,r.jsxs)(C.zj,{"data-pexels-stock-layer":"",className:"h-[90vh] max-h-[90vh]",hideHandle:!0,zIndex:i,overlayStyle:S,overlayProps:L,style:E,children:[(0,r.jsxs)(C.BE,{className:"!flex !flex-row items-center justify-between gap-3 text-left",children:[(0,r.jsx)(C.gk,{className:"font-albert",children:s}),(0,r.jsx)("button",{type:"button",onClick:()=>t(!1),className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-[#6b6560] transition-colors hover:bg-[#f3f1ef] hover:text-[#1a1a1a] dark:text-[#b2b6c2] dark:hover:bg-[#262b35] dark:hover:text-white","aria-label":"Close stock picker",children:(0,r.jsx)(y.A,{className:"h-4 w-4"})})]}),(0,r.jsx)(C.oF,{className:"px-4",children:J})]})})}var T=a(813210),D=a(588440),U=a(116057),W=a(889345),R=a(589594),F=a(969120);let _=(0,i.default)(()=>a.e(80748).then(a.bind(a,80748)).then(e=>({default:e.AnnotateVideoButton})),{loadableGenerated:{webpack:()=>[80748]},ssr:!1}),B=["image/jpeg","image/jpg","image/png","image/webp","image/gif","image/heic","image/heif"],I=["video/mp4","video/webm","video/quicktime"],V=["audio/mpeg","audio/mp3","audio/wav","audio/x-wav","audio/ogg","audio/mp4","audio/aac","audio/webm","audio/m4a","audio/x-m4a"],O=["application/pdf","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation"],G=["application/pdf","application/zip","application/x-zip-compressed","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","text/plain","text/csv",...B,...I,...V],H=e=>e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:e<0x40000000?`${(e/1048576).toFixed(1)} MB`:`${(e/0x40000000).toFixed(1)} GB`,q=e=>!!(/\.(mp4|webm|mov)(\?|$)/i.test(e)||/\.m3u8(\?|$)/i.test(e)||/vz-[a-z0-9-]+\.b-cdn\.net\/[a-f0-9-]+/i.test(e)),J=e=>{try{return(new URL(e).pathname.split("/").pop()||"file").replace(/^\d+-/,"")}catch{return e.split("/").pop()?.split("?")[0]||"file"}},K=e=>{let t=e.split("?")[0].match(/\/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})(?:\/|$)/i);return t?.[1]??null},X=e=>{let t=e.split("?")[0];if(/\/playlist\.m3u8$/i.test(t))return t.replace(/\/playlist\.m3u8$/i,"/thumbnail.jpg");let a=K(t);if(a)return`https://vz-0775a2c7-585.b-cdn.net/${a}/thumbnail.jpg`},Y=e=>{!e?.id||(e.usageCount||0)>0||fetch(`/api/content/library/${e.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({incrementUsage:!0})}).catch(()=>{})},Z=({icon:e,size:t=24})=>({pdf:(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,r.jsx)("path",{d:"M14 2v6h6"}),(0,r.jsx)("path",{d:"M10 12h4"}),(0,r.jsx)("path",{d:"M10 16h4"}),(0,r.jsx)("path",{d:"M8 12h.01"}),(0,r.jsx)("path",{d:"M8 16h.01"})]}),word:(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,r.jsx)("path",{d:"M14 2v6h6"}),(0,r.jsx)("path",{d:"M8 13h2l1 4 1-4h2"})]}),excel:(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,r.jsx)("path",{d:"M14 2v6h6"}),(0,r.jsx)("path",{d:"M8 13v4"}),(0,r.jsx)("path",{d:"M12 13v4"}),(0,r.jsx)("path",{d:"M16 13v4"}),(0,r.jsx)("path",{d:"M8 13h8"}),(0,r.jsx)("path",{d:"M8 15.5h8"})]}),powerpoint:(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,r.jsx)("path",{d:"M14 2v6h6"}
1),(0,r.jsx)("rect",{x:"8",y:"12",width:"8",height:"6",rx:"1"})]}),zip:(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,r.jsx)("path",{d:"M14 2v6h6"}),(0,r.jsx)("path",{d:"M10 12h1v1h-1z"}),(0,r.jsx)("path",{d:"M13 12h1v1h-1z"}),(0,r.jsx)("path",{d:"M10 15h1v1h-1z"}),(0,r.jsx)("path",{d:"M13 15h1v1h-1z"})]}),audio:(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M9 18V5l12-2v13"}),(0,r.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,r.jsx)("circle",{cx:"18",cy:"16",r:"3"})]}),generic:(0,r.jsxs)("svg",{width:t,height:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,r.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,r.jsx)("path",{d:"M14 2v6h6"})]})})[e],Q=e=>{switch(e){case"3:1":return"aspect-[3/1]";case"2:1":return"aspect-[2/1]";case"16:9":return"aspect-video";case"16:7":return"aspect-[16/7]";case"1:1":return"aspect-square";case"4:3":return"aspect-[4/3]";case"3:4":return"aspect-[3/4]";case"4:5":return"aspect-[4/5]";default:return"h-32"}};function ee({value:e,onChange:t,folder:a,type:i="image",label:j="Media",required:w=!1,uploadEndpoint:k="/api/admin/upload-media",customUpload:y,preserveOriginal:N=!1,hideLabel:$=!1,aspectRatio:C,previewSize:P="full",collapsiblePreview:M=!1,collapseSourceControls:S=!0,onBunnyVideoCreated:E,onThumbnailReady:L,minimalPlaceholder:z=!1,hideUploadCta:et=!1,showAiGenerate:ea=!1,onUploadStateChange:er,onFileMetadata:en,onFileSelected:es,onBunnyVideoRemoved:ei,uploadAreaClassName:eo,allowReplaceWhenValue:el=!1,hideVideoControls:ec=!1,simpleUploadPrompt:ed=!1,recommendedSize:eu,enableLibrary:eh=!0,enableStock:ep=!0,stockSearchEndpoint:ex,onLibraryItemSelected:em,annotatable:ef=!0}){let eb,eg,ev="string"==typeof e?e:"",ej=(0,s.c)("ui"),[ew,ek]=(0,n.useState)(!1),ey=(0,n.useRef)(er),eN=(0,n.useRef)(ew),[e$,eC]=(0,n.useState)(0),[eP,eM]=(0,n.useState)(null),[eS,eE]=(0,n.useState)(!1),[eL,ez]=(0,n.useState)(!1),[eA,eT]=(0,n.use
1State)(!1),[eD,eU]=(0,n.useState)(!1),[eW,eR]=(0,n.useState)(!1),[eF,e_]=(0,n.useState)(0),[eB,eI]=(0,n.useState)(!1),[eV,eO]=(0,n.useState)(!1),[eG,eH]=(0,n.useState)(!1),[eq,eJ]=(0,n.useState)(""),[eK,eX]=(0,n.useState)(!1),[eY,eZ]=(0,n.useState)(null),{openCreditPurchase:eQ}=(0,p.a)(),{isDemoMode:e0,openSignupModal:e1}=(0,x._)(),e2=(0,n.useCallback)(async()=>{if(eq.trim()&&!eK){eX(!0),eZ(null);try{let e=await fetch("/api/ai/generate-cover-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({prompt:eq.trim(),folder:a,aspectRatio:C||"16:9"})});if(402===e.status)return void eQ();let r=await e.json();if(!e.ok)throw Error(r.error||"Generation failed");let{url:n}=r;k.includes("/api/coach/")&&(0,T.u$)({url:n,filename:"AI generated image",mediaType:"image",contentType:"image/png",source:"ai_generated"}).then(Y),t(n),eH(!1),eJ("")}catch(e){eZ(e instanceof Error?e.message:"Failed to generate image. Try again.")}finally{eX(!1)}}},[eq,eK,a,C,t,eQ,k]);(0,n.useEffect)(()=>{eU(!1)},[ev]),(0,n.useEffect)(()=>{if(eW)return;let e=e9.current;e&&L&&(e9.current=null,eU(!0),(0,m.pollForThumbnail)(e,{initialDelayMs:2e3}).then(e=>{e&&L(e)}).finally(()=>{eU(!1)}))},[eW,L]),(0,n.useEffect)(()=>{ey.current=er},[er]),(0,n.useEffect)(()=>{eN.current=ew,ey.current?.(ew)},[ew]),(0,n.useEffect)(()=>()=>{eN.current&&ey.current?.(!1)},[]),(0,n.useEffect)(()=>{if(!ew)return;let e=e=>(e.preventDefault(),""),t=()=>{e4.current?.abort(),e8.current?.abort(),e6.current?.()};return window.addEventListener("beforeunload",e),window.addEventListener("unload",t),()=>{window.removeEventListener("beforeunload",e),window.removeEventListener("unload",t)}},[ew]),(0,n.useEffect)(()=>()=>{let e=!!e4.current||!!e8.current||!!e6.current;if(e4.current&&(e4.current.abort(),e4.current=null),e8.current&&(e8.current.abort(),e8.current=null),e6.current&&(e6.current(),e6.current=null),e&&e7.current){let e=e7.current;e7.current=null,fetch(y?`/api/upload/video?bunnyVideoId=${encodeURIComponent(e)}`:`/api/coach/bunny-video/${e}`,{method:"DELETE"}).catch(()=>{})}},[]);let e5=(0,n.useRef)(null),e8=(0,n.useRef)(null),e4=(0,n.useRef)(null),e6=(0,n.useRef)(null),e3=(0,n.useRef)(null),e7=(0,n.useRef)(null),e9=(0,n.useRef)(null),te=(0,n.useRef)(null),tt=(0,n.useRef)(0),ta=(e=>{switch(e){case"image":return B;case"video":return I;case"visual":return[...B,...I];case"audio":return V;case"presentation":return O;case"media":return[...B,...I,...V];case"file":return G;case"any":return[...B,...I,...G]}})(i),tr=k.includes("/api/coach/"),tn="/api/public/tools/upload"===k,ts=eh&&tr&&!e0,ti="video"===i||"visual"===i||"media"===i?0x80000000:"audio"===i?524288e3:"presentation"===i||"file"===i?0x6400000:0xa00000,to=y||tr||tn?ti:"video"===i?4718592:"visual"===i||"media"===i?0xa00000:"file"===i||"presentation"===i?Math.min(ti,0x3200000):ti,tl=eo||`w-full max-h-48 ${Q(C)}`,tc="image"===i||"video"===i||"visual"===i||"media"===i||"any"===i,td="presentation"===i?"file":i,tu="visual"===i?"media":"presentation"===i?"file":i,th=ep&&tc&&!e0&&(ts||!!ex),tp=ts||th;(0,n.useEffect)(()=>{if(!ts||!ev||te.current===ev||ev.startsWith("blob:")||ev.startsWith("data:"))return;te.current=ev;let e=(()=>"video"===i||q(ev)?"video":"image"===i||/\.(jpg|jpeg|png|gif|webp|svg)(\?|$)/i.test(ev)?"image":"audio"===i||/\.(mp3|wav|ogg|m4a|aac)(\?|$)/i.test(ev)?"audio":"file")(),t="video"===e?K(ev):null;(0,T.u$)({url:ev,filename:J(ev),mediaType:e,contentType:"video"===e?"application/vnd.apple.mpegurl":"image"===e?"image/*":"audio"===e?"audio/*":"application/octet-stream",bunnyVideoId:t||void 0,source:"migration"}).then(Y)},[ts,i,ev]);let tx=(0,n.useCallback)(async e=>{for(let t=0;t<150;t++){if(e3.current!==e)return;await new Promise(e=>setTimeout(e,0===t?1e3:2e3));try{let t=await fetch(`/api/coach/bunny-video/${e}/status`);if(!t.ok)continue;let a=await t.json();if(e3.current!==e)return;if("number"==typeof a.encodeProgress&&e_(a.encodeProgress),"finished"===a.status){e_(100),eR(!1);return}if("failed"===a.status||"error"===a.status){eR(!1),e_(0),eM("Video processing failed. Please upload again.");return}}catch{}}eR(!1)},[]);(0,n.useEffect)(()=>
1{if(!ev||!q(ev)){e3.current=null,eR(!1);return}let e=K(ev);if(!e){e3.current=null,eR(!1);return}e3.current=e;let t=!1;return(async()=>{try{let a=await fetch(`/api/coach/bunny-video/${e}/status`);if(!a.ok||t||e3.current!==e)return;let r=await a.json();if(t||e3.current!==e)return;if("finished"===r.status)return void eR(!1);if("failed"===r.status||"error"===r.status){eR(!1),eM("Video processing failed. Please upload again.");return}eR(!0),tx(e)}catch{}})(),()=>{t=!0}},[ev,tx]);let tm=(e,t,a)=>{ts&&t&&(0,T.u$)({url:t,filename:e.name,mediaType:(0,T.rr)(e),contentType:e.type||"application/octet-stream",fileSizeBytes:e.size,durationSeconds:a?.durationSeconds,bunnyVideoId:a?.bunnyVideoId,source:"upload"}).then(Y)},tf=async(e,r)=>{eM(null),ek(!0),eC(0),eE(!1),eR(!1),e_(0);try{if(tn&&e.type.startsWith("image/")){let a=await (0,W.i)(e);eC(100),tm(e,a,{durationSeconds:r}),t(a),ek(!1),eC(0);return}if(!tr){let a=await (0,R.uploadFileToBunnyStorage)(e,{purpose:"user-upload",onProgress:eC,onRequestChange:e=>{e8.current=e}});eC(100),tm(e,a.url,{durationSeconds:r}),t(a.url),ek(!1),eC(0),e8.current=null;return}let n=await fetch("/api/coach/org-upload-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:e.name,contentType:e.type,fileSize:e.size,folder:a,preserveOriginal:N||"file"===i||"presentation"===i})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error||"Failed to get upload URL")}let s=await n.json();"bunny"===s.uploadType?await tb(e,s,r):"bunny-storage"===s.uploadType?await tv(e,r):await tg(e,s,r)}catch(e){console.error("Direct upload error:",e),e7.current&&(fetch(`/api/coach/bunny-video/${e7.current}`,{method:"DELETE"}).catch(()=>{}),e7.current=null),eM(e instanceof Error?e.message:"Upload failed. Please try again."),ek(!1),eC(0),eE(!1),e8.current=null,e4.current=null}},tb=async(e,a,r)=>{let{videoId:n,tusEndpoint:s,tusHeaders:i}=a;e7.current=n,E?.(n);try{await (0,f.W)({file:e,endpoint:s,headers:i,metadata:{filetype:e.type,title:e.name},onUploadCreated:e=>{e4.current=e},onRetrying:()=>{eE(!0)},onProgress:(e,t)=>{eE(!1);let a=Math.round(e/t*100);eC(a)}})}catch(t){eE(!1);let e=t instanceof Error?t.message:"Upload failed";throw Error(`Upload failed: ${e}`)}eC(100),eE(!1),e3.current=n;let o=!1,l=null;for(let e=0;e<10;e++){try{let e=await fetch(`/api/coach/bunny-video/${n}/status`);if(e.ok){let t=await e.json();if(l=t.status,"created"!==t.status){o=!0;break}}}catch{}await new Promise(e=>setTimeout(e,1e3))}o||console.warn('[TUS] Upload verification remained "created" after retries');let c=a.playbackUrl||`https://vz-0775a2c7-585.b-cdn.net/${n}/playlist.m3u8`;tm(e,c,{durationSeconds:r,bunnyVideoId:n}
1),"finished"!==l&&(eR(!0),tx(n)),setTimeout(()=>{t(c),ek(!1),eC(0),e4.current=null,e7.current=null},200),L&&("finished"===l?(eU(!0),(0,m.pollForThumbnail)(n).then(e=>{e&&L(e)}).finally(()=>{eU(!1)})):e9.current=n)},tg=async(e,a,r)=>{let{uploadUrl:n,publicUrl:s,storagePath:i}=a;await new Promise((t,a)=>{let r=new XMLHttpRequest;e8.current=r,r.upload.onprogress=e=>{e.lengthComputable&&eC(Math.round(e.loaded/e.total*90))},r.onload=()=>{r.status>=200&&r.status<300?t():a(Error(`Upload failed with status ${r.status}`))},r.onerror=()=>a(Error("Network error during upload")),r.onabort=()=>a(Error("Upload cancelled")),r.open("PUT",n),r.setRequestHeader("Content-Type",e.type),r.send(e)}),eC(95);let o=await fetch("/api/coach/org-make-public",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({storagePath:i})});if(!o.ok)throw Error((await o.json().catch(()=>({}))).error||"Failed to make file public");eC(100),setTimeout(()=>{tm(e,s,{durationSeconds:r}),t(s),ek(!1),eC(0),e8.current=null},200)},tv=async(e,r)=>{eM(null),ek(!0),eC(10);try{let n=new FormData;n.append("file",e),n.append("folder",a);let s=setInterval(()=>{eC(e=>Math.min(e+10,90))},200),i=await fetch(k,{method:"POST",body:n});if(clearInterval(s),!i.ok){let t=await i.json().catch(()=>({}));if(413===i.status||"FILE_TOO_LARGE_FOR_SERVER"===t.code)throw Error(`File too large (${H(e.size)}). Maximum size for this upload type is ${H(4718592)}.`);if(401===i.status)throw Error("Please sign in to upload files.");if(403===i.status)throw Error(`You don't have permission to upload files. ${t.error||t.details||""}`);throw Error(t.error||t.details||"Upload failed. Please try again.")}let o=await i.json();eC(100),setTimeout(()=>{tm(e,o.url,{durationSeconds:r}),t(o.url),ek(!1),eC(0)},200)}catch(t){console.error("Upload error:",t);let e=t instanceof Error?t.message:"Upload failed. Please try again.";"Failed to fetch"===e||e.includes("NetworkError")?eM("Network error. Please check your connection and try again."):eM(e),ek(!1),eC(0)}},tj=()=>{if(e4.current&&(e4.current.abort(),e4.current=null),e7.current){let e=e7.current;fetch(y?`/api/upload/video?bunnyVideoId=${encodeURIComponent(e)}`:`/api/coach/bunny-video/${e}`,{method:"DELETE"}).catch(()=>{}),e7.current=null}e8.current&&(e8.current.abort(),e8.current=null),e6.current&&(e6.current(),e6.current=null),e3.current=ev?K(ev):null,ek(!1),eC(0),e_(0),eE(!1),eR(!1),eU(!1),eM(null),e5.current&&(e5.current.value="")},tw=async e=>{if(y){eM(null),ek(!0),eC(0),eE(!1);try{let a=await y(e,{onProgress:eC,onAbortReady:e=>
1{e6.current=e},onBunnyVideoCreated:e=>{e7.current=e,E?.(e)}});e6.current=null,e7.current=null,a.bunnyVideoId&&(e3.current=a.bunnyVideoId),a.thumbnailUrl&&L?.(a.thumbnailUrl),eC(100),ek(!1),t(a.url)}catch(t){e6.current=null,e7.current=null;let e=t instanceof Error?t.message:"Upload failed. Please try again.";e.toLowerCase().includes("cancel")||eM(e),ek(!1),eC(0)}}},tk=async e=>{var t,a;let r=(0,F.m3)(e.name,e.type);r!==e.type&&(e=new File([e],e.name,{type:r,lastModified:e.lastModified}));let n="presentation"===i&&/\.(pdf|ppt|pptx)$/i.test(e.name);if("file"!==i&&!ta.includes(e.type)&&!n){let e="image"===i?"image (JPG, PNG, WebP, GIF)":"video"===i?"video (MP4, WebM, MOV)":"visual"===i?"image or video":"audio"===i?"audio (MP3, WAV, M4A, OGG)":"presentation"===i?"presentation (PDF, PPT, PPTX)":"media"===i?"image, video, or audio":"file";eM(`Please select a valid ${e} file`);return}let s="media"!==i&&"visual"!==i||e.type.startsWith("video/")?to:0xa00000;if(!y&&!tr&&!tn&&(e.type.startsWith("video/")?s=4718592:e.type.startsWith("image/")||e.type.startsWith("audio/")||(s=Math.min(s,0x3200000))),e.size>s)return void eM(`File size must be less than ${H(s)}`);let o=await (!(t=e).type.startsWith("audio/")&&!t.type.startsWith("video/")?Promise.resolve(void 0):new Promise(e=>{let a=URL.createObjectURL(t),r=document.createElement(t.type.startsWith("audio/")?"audio":"video"),n=!1,s=t=>{n||(n=!0,URL.revokeObjectURL(a),r.removeAttribute("src"),r.load(),e(Number.isFinite(t)&&t&&t>0?t:void 0))};r.preload="metadata",r.onloadedmetadata=()=>s(r.duration),r.onerror=()=>s(void 0),window.setTimeout(()=>s(void 0),5e3),r.src=a}));en?.({fileSizeBytes:e.size,contentType:e.type,...o?{durationSeconds:o}:{}});try{await es?.(e)}catch(e){console.warn("Media pre-upload processing failed:",e)}y?await tw(e):(a=e,tn?a.type.startsWith("image/"):tr?!!(a.type.startsWith("video/")||a.type.startsWith("audio/"))||"file"===i||"presentation"===i||a.size>4718592:!a.type.startsWith("video/"))?await tf(e,o):await tv(e,o)},ty=async e=>{let t=e.target.files?.[0];t&&await tk(t)},tN=e=>{e.preventDefault(),e.stopPropagation(),tt.current++,e.dataTransfer.items&&e.dataTransfer.items.length>0&&ez(!0)},t$=e=>{e.preventDefault(),e.stopPropagation(),tt.current--,0===tt.current&&ez(!1)},tC=e=>{e.preventDefault(),e.stopPropagation()},tP=async e=>{if(e.preventDefault(),e.stopPropagation(),ez(!1),tt.current=0,ew)return;let t=e.dataTransfer.files?.[0];t&&await tk(t)},tM=()=>{let e,a=ev?(e=ev.match(/vz-[a-z0-9-]+\.b-cdn\.net\/([a-f0-9-]{36})/i),e?.[1]??null):null,r=e7.current;e4.current&&(e4.current.abort(),e4.current=null),r&&(fetch(y?`/api/upload/video?bunnyVideoId=${encodeURIComponent(r)}`:`/api/coach/bunny-video/${r}`,{method:"DELETE"}).catch(()=>{}),e7.current=null),a&&a!==r&&(ei?ei(a):fetch(`/api/coach/bunny-video/${a}`,{method:"DELETE"}).catch(()=>{})),e8.current&&(e8.current.abort(),e8.current=null),e6.current&&(e6.current(),e6.current=null),e3.current=null,t(""),ek(!1),eC(0),e_(0),eE(!1),eR(!1),eU(!1),eM(null),e5.current&&(e5.current.value="")},tS=!!(ev&&("audio"===i||/\.(mp3|wav|ogg|m4a|aac)(\?|$)/i.test(ev))),tE=!!(ev&&!tS&&q(ev)),tL=ev&&(/\.(jpg|jpeg|png|gif|webp|svg)(\?|$)/i.test(ev)||"image"===i&&!q(ev)),tz=ev&&!tE&&!tL&&!tS,tA=tz?"pdf"===(eb=ev.split(".").pop()?.toLowerCase()?.split("?")[0]||"")?{type:"PDF",icon:"pdf",color:"#dc2626"}:["doc","docx"].includes(eb)?{type:"Word",icon:"word",color:"#2563eb"}:["xls","xlsx","csv"].includes(eb)?{type:"Excel",icon:"excel",color:"#16a34a"}:["ppt","pptx"].includes(eb)?{type:"PowerPoint",icon:"powerpoint",color:"#ea580c"}:["zip","rar","7z","tar","gz"].includes(eb)?{type:"Archive",icon:"zip",color:"#eab308"}:["mp3","wav","ogg","m4a","aac"].includes(eb)?{type:"Audio",icon:"audio",color:"#8b5cf6"}:{type:eb.toUpperCase()||"File",icon:"generic",color:"#6b7280"}:null,tT=tz?J(ev):null,tD=()=>{switch(i){case"image":return"image";case"video":return"video";case"visual":return"image or video";case"audio":return"audio";case"presentation":return"presentation";case"media":return"media";case"file":case"any":return"file"}},tU=()=>{switch(i){case"image":return`JPG, PNG, WebP, GIF (max ${H(to)})`;case"video":return`MP4, WebM, MOV (max ${H(to)})`;case"visual":return`Images up to 10MB, videos up to ${H(to)}`;case"audio":return`MP3, WAV, M4A, OGG (max ${H(to)})`;case"presentation":return`PDF, PowerPoint (max ${H(to)})`;case"media":return`Images up to 10MB, audio/videos up to ${H(to)}`;case"file":return`PDF, Word, Excel, ZIP (max ${H(to)})`;case"any":return`Images, videos, or documents (max ${H(to)})`}},tW=(()=>
1{if("image"!==i||!eu)return null;if("string"==typeof eu)return eu;if("podcasts"===a)return"1400×1400px";switch(C){case"3:1":return"1500×500px";case"2:1":return"1200×600px";case"16:7":return"1280×560px";case"1:1":return"1080×1080px";case"4:3":return"1200×900px";case"3:4":return"1200×1600px";case"4:5":return"1080×1350px";default:return"1280×720px"}})(),tR=tW?(0,U.a2)(tW):null,tF=tp?(0,r.jsxs)("div",{className:"flex items-center gap-1 rounded-full bg-[#f3f1ef] p-1 dark:bg-[#262b35]",children:[(0,r.jsx)("button",{type:"button",onClick:()=>{e0?e1():e5.current?.click()},className:"flex-1 rounded-full bg-white px-3 py-1.5 text-xs font-semibold text-[#1a1a1a] shadow-sm transition-colors dark:bg-[#171b22] dark:text-white font-albert",children:"Upload"}),ts&&(0,r.jsx)("button",{type:"button",onClick:()=>eI(!0),className:"flex-1 rounded-full px-3 py-1.5 text-xs font-semibold text-[#6b6560] transition-colors hover:bg-white/60 dark:text-[#b2b6c2] dark:hover:bg-[#171b22]/70 font-albert",children:"Library"}),th&&(0,r.jsx)("button",{type:"button",onClick:()=>eO(!0),className:"flex-1 rounded-full px-3 py-1.5 text-xs font-semibold text-[#6b6560] transition-colors hover:bg-white/60 dark:text-[#b2b6c2] dark:hover:bg-[#171b22]/70 font-albert",children:"Stock"})]}):null;return(0,r.jsxs)("div",{className:"space-y-2",children:[!$&&(0,r.jsxs)("label",{className:"block text-sm font-medium text-[#1a1a1a] dark:text-[#f5f5f8] font-albert",children:[j," ",w&&"*"]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(!M||!S)&&tF,M?(0,r.jsxs)("div",{className:"rounded-xl border border-[#e1ddd8] dark:border-[#262b35] overflow-hidden bg-white dark:bg-[#1d222b]",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>eT(!eA),className:"flex w-full items-center gap-3 p-3 text-left hover:bg-[#f9f7f5] dark:hover:bg-[#262b35]/50 transition-colors font-albert",children:[(0,r.jsx)("span",{className:"relative flex h-12 w-12 flex-shrink-0 items-center justify-center overflow-hidden rounded-lg bg-[#f5f2ed] dark:bg-[#1a1f2a]",children:ev&&tL?(0,r.jsx)(D.S,{src:ev,alt:"Cover preview",sizes:"48px"}):(0,r.jsx)("svg",{className:"w-6 h-6 text-[#a7a39e] dark:text-[#5f6670]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),(0,r.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,r.jsx)("span",{className:"block text-sm font-semibold text-[#1a1a1a] dark:text-[#f5f5f8]",children:ev?j:`Add ${j}`}),!ev&&tR&&(0,r.jsx)("span",{className:"mt-0.5 block text-xs font-medium text-[#5f5a55] dark:text-[#b2b6c2]",children:ej("recommendedImageSize",{size:tR.size})})]}),(0,r.jsx)("svg",{className:`h-5 w-5 shrink-0 text-[#5f5a55] transition-transform duration-200 dark:text-[#b2b6c2] ${eA?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),(0,r.jsx)("div",{className:`overflow-hidden transition-all duration-200 ease-out ${eA?"max-h-[500px] opacity-100":"max-h-0 opacity-0"}`,children:(0,r.jsxs)("div",{className:"px-3 pt-1 pb-3",children:[S&&tF&&(0,r.jsx)("div",{className:"mb-2",children:tF}),ev&&tL?(0,r.jsxs)("div",{className:`relative rounded-lg overflow-hidden bg-[#f5f2ed] dark:bg-[#1a1f2a] w-full max-h-48 ${Q(C)}`,children:[(0,r.jsx)(D.S,{src:ev,alt:"Preview",sizes:"400px"}),(0,r.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),tM()},className:"absolute top-2 right-2 p-1.5 bg-white/90 dark:bg-[#1a1f2a]/90 backdrop-blur-sm rounded-full hover:bg-white dark:hover:bg-[#1a1f2a] transition-colors shadow-sm",title:`Remove ${tD()}`,children:(0,r.jsx)("svg",{className:"w-4 h-4 text-red-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):(0,r.jsx)("div",{onClick:()=>{e0?e1():ew||eK||eG||e5.current?.click()},onDragEnter:tN,onDragLeave:t$,onDragOver:tC,onDrop:e=>{if(e0){e.preventDefault(),e1();return}tP(e)},className:`
2                        relative rounded-2xl transition-all cursor-pointer overflow-hidden
3                        ${tl}
4                        ${ew?"bg-gradient-to-br from-brand-accent/10 to-brand-accent/5 cursor-wait":eL?"bg-gradient-to-br from-brand-accent/20 to-brand-accent/10 ring-2 ring-brand-accent/30":"bg-gradient-to-br from-[#f8f7f5] to-[#f3f1ef] dar
4k:from-[#2a303c] dark:to-[#232830] hover:from-[#f3f1ef] hover:to-[#ebe8e4] dark:hover:from-[#2f3542] dark:hover:to-[#282e38] shadow-[inset_0_1px_0_0_rgba(255,255,255,0.5)] dark:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.05)]"}
5                      `,children:ew||eK?(0,r.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("div",{className:"w-12 h-12 relative",children:eK?(0,r.jsx)(o.A,{className:"w-12 h-12 text-brand-accent animate-spin"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("svg",{className:"w-12 h-12 transform -rotate-90",viewBox:"0 0 36 36",children:[(0,r.jsx)("circle",{cx:"18",cy:"18",r:"16",fill:"none",stroke:"#e1ddd8",strokeWidth:"2"}),(0,r.jsx)("circle",{cx:"18",cy:"18",r:"16",fill:"none",stroke:"var(--brand-accent-light)",strokeWidth:"2",strokeDasharray:`${e$} 100`,strokeLinecap:"round"})]}),(0,r.jsxs)("span",{className:"absolute inset-0 flex items-center justify-center text-xs font-medium text-brand-accent font-albert",children:[e$,"%"]})]})}),(0,r.jsx)("p",{className:"mt-2 text-xs text-[#5f5a55] dark:text-[#b2b6c2] font-albert",children:eK?"Generating image...":eS?"Reconnecting upload...":"Uploading..."}),ew&&!eK&&(0,r.jsx)("button",{type:"button",onClick:el?tj:tM,className:"mt-1.5 text-xs font-medium text-[#8f8a85] dark:text-[#8f929e] hover:text-red-500 dark:hover:text-red-400 transition-colors font-albert",children:"Cancel"})]}):eG?(0,r.jsx)("div",{className:"absolute inset-0 flex flex-col items-center justify-center p-4",onClick:e=>e.stopPropagation(),children:(0,r.jsxs)("div",{className:"w-full max-w-sm space-y-2",children:[(0,r.jsx)("input",{type:"text",value:eq,onChange:e=>eJ(e.target.value),onKeyDown:e=>"Enter"===e.key&&e2(),placeholder:"Describe the cover image you want...",className:"w-full px-3 py-2 text-sm rounded-lg border border-[#e1ddd8] dark:border-white/[0.08] bg-white dark:bg-[#1d222b] focus:outline-none focus:border-brand-accent transition-colors font-albert",autoFocus:!0}),(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,r.jsxs)("button",{type:"button",onClick:e2,disabled:!eq.trim(),className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg bg-brand-accent text-white hover:bg-brand-accent/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-albert",children:[(0,r.jsx)(l.A,{className:"w-3 h-3"}),"Generate (1 credit)"]}),(0,r.jsx)("button",{type:"button",onClick:()=>{eH(!1),eZ(null),eJ("")},className:"px-3 py-1.5 text-xs font-medium rounded-lg text-[#5f5a55] dark:text-[#b2b6c2] hover:bg-[#f5f2ed] dark:hover:bg-[#262b35] transition-colors font-albert",children:"Cancel"})]}),eY&&(0,r.jsx)("p",{className:"text-xs text-red-500 text-center font-albert",children:eY})]})}):(0,r.jsxs)("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:[(0,r.jsx)("svg",{className:"w-8 h-8 text-brand-accent mb-2",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})}),(0,r.jsx)("p",{className:"text-sm text-[#5f5a55] dark:text-[#b2b6c2] font-albert",children:eL?`Drop ${tD()} here`:"Drag & drop or click to upload"}),(0,r.jsx)("p",{className:"text-xs text-[#5f5a55] dark:text-[#b2b6c2]/70 font-albert mt-1",children:tU()}),ea&&"image"===i&&(0,r.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),eH(!0)},className:"flex items-center gap-1 mt-2 text-xs text-brand-accent hover:text-brand-accent/80 font-medium font-albert transition-colors",children:[(0,r.jsx)(l.A,{className:"w-3 h-3"}),"or generate with AI"]})]})})]})})]}):ev?(0,r.jsxs)("div",{className:`relative ${"thumbnail"===P?"inline-block":""} ${el?"cursor-pointer group/replace":""}`,onClick:()=>{if(el){if(e0)return void e1();ew||eK||eG||e5.current?.click()}},onDragEnter:el?tN:void 0,onDragLeave:el?t$:void 0,onDragOver:el?tC:void 0,onDrop:el?e=>{if(e0){e.preventDefault(),e1();return}tP(e)}:void 0,children:[(0,r.jsx)("div",{className:`relative rounded-xl overflow-hidden ${tE?"bg-black":"bg-[#f5f2ed] dark:bg-[#1a1f2a] border border-[#e1ddd8] dark:border-[#262b35]"} ${"thumbnail"===P?"w-20 h-20":"w-full"}`,children:tS?"thumbnail"===P?(0,r.jsx)("div",{className:"flex h-full w-full items-center justify-center",children:(0,r.jsx)(c.A,{className:"h-7 w-7 text-brand-accent"})}):(0,r.jsx)("div",{className:"p-3 sm:p-4",children:(0,r.jsx)(g.Y,{src:ev,className:"w-full"})}):tE?eW?"thumbnail"===P?(0,r.jsx)("div",{className:"w-full h-full flex items-center justify-center bg-black",children:(0,r.jsx)(o.A,{className:"w-5 h-5 animate-spin text-white/80"})}):(0,r.jsx)("div",{className:"w-full",children:(0,r.jsxs)("div",{className:`w-full rounded-xl bg-black flex flex-col items-center justify-center gap-3 ${"4:3"===C?"aspect-[4/3]":"1:1"===C?"aspect-square":"aspect-video"}`,children:[(0,r.jsx)(o.A,{className:"w-8 h-8 animate-spin text-white/80"}),(0,r.jsxs)("p",{className:"text-sm text-white/80 font-albert",children:["Processing video",eF>0?` — ${eF}%`:"..."]}),eF>0&&(0,r.jsx)("div",{className:"w-32 h-1.5 bg-white/20 rounded-full overflow-hidden",children:(0,r.jsx)("div",{className:"h-full bg-white/80 rounded-full transition-all duration-500",style:{width:`${eF}%`}})})]})}):"thumbnail"===P?(0,r.jsx)(b.VideoPlayer,{src:ev,autoPlay:!0,poster:X(ev),objectFit:"cover",cropScale:1.18,className:"w-full h-full",aspectRatio:"1:1",compact:!0,hideControls:!0}):(0,r.jsxs)("div",{className:"w-full",children:[(0,r.jsxs)("div",{className:"relative isolate z-0",children:[(0,r.jsx)(b.VideoPlayer,{src:ev,autoPlay:ec,poster:X(ev),objectFit:"contain",aspectRatio:"4:3"===C?"4:3":"1:1"===C?"1:1":"16:9",compact:ec,hideControls:ec}),ef&&!ec&&!eW&&(0,r.jsx)("div",{className:"absolute left-3 top-3 z-30 max-w-[calc(100%-4.5rem)]",onMouseDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:(0,r.jsx)(_,{videoUrl:ev,className:"max-w-full truncate rounded-full border border-white/25 bg-black/55 px-3 py-2 text-white shadow-[0_4px_16px_rgba(0,0,0,0.24)] backdrop-blur-md hover:bg-black/70 hover:text-white"})})]}),eD&&(0,r.jsxs)("div",{className:"flex items-center gap-2 mt-2 px-1 text-sm text-[#5f5a55] dark:text-[#b2b6c2] font-albert",children:[(0,r.jsx)(o.A,{className:"w-4 h-4 animate-spin text-brand-accent"}),(0,r.jsx)("span",{children:"Uploaded - Generating thumbnail..."})]})]}):tz&&tA?(0,r.jsxs)("div",{className:`flex items-center gap-3 p-4 ${"thumbnail"===P?"flex-col justify-center h-full p-2":""}`,children:[(0,r.jsx)("div",{className:`flex-shrink-0 ${"thumbnail"===P?"":"p-3 rounded-lg bg-white dark:bg-[#11141b]"}`,style:{color:tA.color},children:(0,r.jsx)(Z,{icon:tA.icon,size:"thumbnail"===P?28:36})}),"thumbnail"!==P&&(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"text-sm font-medium text-[#1a1a1a] dark:text-[#f5f5f8] truncate font-albert",children:tT}),(0,r.jsxs)("p",{className:"text-xs text-[#5f5a55] dark:text-[#b2b6c2] font-albert",children:[tA.type," Document"]})]})]}):(0,r.jsx)("div",{className:"thumbnail"===P?"relative w-full h-full":`relative w-full ${Q(C)}`,children:(0,r.jsx)(D.S,{src:ev,alt:"Preview",sizes:"thumbnail"===P?"80px":"400px"})})}),el&&!ew&&!eK&&(0,r.jsx)("div",{className:"pointer-events-none absolute inset-0 z-30 flex items-center justify-center rounded-xl bg-black/0 opacity-0 transition-opacity group-hover/replace:bg-black/35 group-hover/replace:opacity-100",children:(0,r.jsx)("span",{"data-keep-white":!0,className:"rounded-full bg-white/90 px-3 py-1.5 text-xs font-medium text-[#1a1a1a] shadow-sm font-albert",children:"Replace"})}),(ew||eK)&&(0,r.jsxs)("div",{className:"absolute inset-0 z-40 flex flex-col items-center justify-center rounded-xl bg-white/85 dark:bg-[#11141b]/85 backdrop-blur-sm",onClick:e=>e.stopPropagation(),children:[(0,r.jsx)("div",{className:"w-12 h-12 relative",children:eK?(0,r.jsx)(o.A,{className:"w-12 h-12 text-brand-accent animate-spin"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("svg",{className:"w-12 h-12 transform -rotate-90",viewBox:"0 0 36 36",children:[(0,r.jsx)("circle",{cx:"18",cy:"18",r:"16",fill:"none",stroke:"#e1ddd8",strokeWidth:"2"}),(0,r.jsx)("circle",{cx:"18",cy:"18",r:"16",fill:"none",stroke:"var(--brand-accent-light)",strokeWidth:"2",strokeDasharray:`${e$} 100`,strokeLinecap:"round"})]}),(0,r.jsxs)("span",{className:"absolute inset-0 flex items-center justify-center text-xs font-medium text-brand-accent font-albert",children:[e$,"%"]})]})}),(0,r.jsx)("p",{className:"mt-2 text-xs text-[#5f5a55] dark:text-[#b2b6c2] font-albert",children:eK?"Generating image...":eS?"Reconnecting upload...":"Uploading..."}),ew&&!eK&&(0,r.jsx)("button",{type:"button",onClick:el?tj:tM,className:"mt-1.5 text-xs font-medium text-[#8f8a85] dark:text-[#8f929e] hover:text-red-500 dark:hover:text-red-400 transition-colors font-albert",children:"Cancel"})]}),(0,r.jsx)("button",{type:"button",onMouseDown:e=>{e.preventDefault(),e.stopPropagation()},onClick:e=>{e.preventDefault(),e.stopPropagation(),tM()},className:`absolute z-50 pointer-events-auto rounded-full border border-white/40 dark:border-white/20 bg-white/45 dark:bg-white/10 backdrop-blur-xl hover:bg-white/60 dark:hover:bg-white/20 transition-colors shadow-[0_8px_24px_rgba(0,0,0,0.18)] ${"thumbnail"===P?"-top-1 -right-1 p-1":"top-2 right-2 p-2"}`,title:`Remove ${tD()}`,children:(0,r.jsx)("svg",{className:`text-[#ef4444] ${"thumbnail"===P?"w-3 h-3":"w-4 h-4"}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2.2,d:"M6 18L18 6M6 6l12 12"})})})]}):(eg=(0,r.jsx)("div",{onClick:()=>{e0?e1():ew||eK||eG||e5.current?.click()},onDragEnter:tN,onDragLeave:t$,onDragOver:tC,onDrop:e=>{if(e0){e.preventDefault(),e1();return}tP(e)},className:ed?`
6                relative rounded-xl border-2 border-dashed transition-all overflow-hidden
7                ${"thumbnail"===P?"w-20 h-20":tl}
8                ${ew||eK?"border-gray-300 bg-gray-50 dark:border-[#3a4150] dark:bg-[#11141b]/50 cursor-wait opacity-80":eL?"border-brand-accent bg-brand-accent/5 dark:bg-brand-accent/10 scale-[1.01]":"border-gray-300 bg-gray-50 hover:border-gray-400 hover:bg-gray-100 dark:border-[#3a4150] dark:bg-[#11141b]/50 dark:hover:bg-[#1d222b]/50 cursor-pointer"}
9              `:`
10                relative rounded-2xl transition-all overflow-hidden
11                ${"thumbnail"===P?"w-20 h-20":tl}
12                ${ew||eK?"bg-gradient-to-br from-brand-accent/10 to-brand-accent/5 cursor-wait":eL?"bg-gradient-to-br from-brand-accent/20 to-brand-accent/10 ring-2 ring-brand-accent/30 scale-[1.01]":"bg-gradient-to-br from-[#f8f7f5] to-[#f3f1ef] dar
12k:from-[#2a303c] dark:to-[#232830] hover:from-[#f3f1ef] hover:to-[#ebe8e4] dark:hover:from-[#2f3542] dark:hover:to-[#282e38] cursor-pointer shadow-[inset_0_1px_0_0_rgba(255,255,255,0.5)] dark:shadow-[inset_0_1px_0_0_rgba(255,255,255,0.05)]"}
13              `,children:ew||eK?(0,r.jsx)("div",{className:"absolute inset-0 flex flex-col items-center justify-center",onClick:e=>e.stopPropagation(),children:"thumbnail"===P?(0,r.jsx)("div",{className:"w-8 h-8 relative",children:eK?(0,r.jsx)(o.A,{className:"w-8 h-8 text-brand-accent animate-spin"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("svg",{className:"w-8 h-8 transform -rotate-90",viewBox:"0 0 36 36",children:[(0,r.jsx)("circle",{cx:"18",cy:"18",r:"16",fill:"none",stroke:"#e1ddd8",strokeWidth:"3"}),(0,r.jsx)("circle",{cx:"18",cy:"18",r:"16",fill:"none",stroke:"var(--brand-accent-light)",strokeWidth:"3",strokeDasharray:`${e$} 100`,strokeLinecap:"round"})]}),(0,r.jsxs)("span",{className:"absolute inset-0 flex items-center justify-center text-[10px] font-medium text-brand-accent font-albert",children:[e$,"%"]})]})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:"w-16 h-16 relative",children:eK?(0,r.jsx)(o.A,{className:"w-16 h-16 text-brand-accent animate-spin"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("svg",{className:"w-16 h-16 transform -rotate-90",viewBox:"0 0 36 36",children:[(0,r.jsx)("circle",{cx:"18",cy:"18",r:"16",fill:"none",stroke:"#e1ddd8",strokeWidth:"2"}),(0,r.jsx)("circle",{cx:"18",cy:"18",r:"16",fill:"none",stroke:"var(--brand-accent-light)",strokeWidth:"2",strokeDasharray:`${e$} 100`,strokeLinecap:"round"})]}),(0,r.jsxs)("span",{className:"absolute inset-0 flex items-center justify-center text-sm font-medium text-brand-accent font-albert",children:[e$,"%"]})]})}),(0,r.jsx)("p",{className:"mt-2 text-xs text-[#5f5a55] dark:text-[#b2b6c2] font-albert",children:eK?"Generating image...":eS?"Reconnecting upload...":"Uploading..."}),ew&&!eK&&(0,r.jsx)("button",{type:"button",onClick:el?tj:tM,className:"mt-1.5 text-xs font-medium text-[#8f8a85] dark:text-[#8f929e] hover:text-red-500 dark:hover:text-red-400 transition-colors font-albert",children:"Cancel"})]})}):eG?(0,r.jsx)("div",{className:"absolute inset-0 flex flex-col items-center justify-center p-4",onClick:e=>e.stopPropagation(),children:(0,r.jsxs)("div",{className:"w-full max-w-sm space-y-2",children:[(0,r.jsx)("input",{type:"text",value:eq,onChange:e=>eJ(e.target.value),onKeyDown:e=>"Enter"===e.key&&e2(),placeholder:"Describe the cover image you want...",className:"w-full px-3 py-2 text-sm rounded-lg border border-[#e1ddd8] dark:border-white/[0.08] bg-white dark:bg-[#1d222b] focus:outline-none focus:border-brand-accent transition-colors font-albert",autoFocus:!0}),(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,r.jsxs)("button",{type:"button",onClick:e2,disabled:!eq.trim(),className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-lg bg-brand-accent text-white hover:bg-brand-accent/90 disabled:opacity-50 disabled:cursor-not-allowed transition-colors font-albert",children:[(0,r.jsx)(l.A,{className:"w-3 h-3"}),"Generate (1 credit)"]}),(0,r.jsx)("button",{type:"button",onClick:()=>{eH(!1),eZ(null),eJ("")},className:"px-3 py-1.5 text-xs font-medium rounded-lg text-[#5f5a55] dark:text-[#b2b6c2] hover:bg-[#f5f2ed] dark:hover:bg-[#262b35] transition-colors font-albert",children:"Cancel"})]}),eY&&(0,r.jsx)("p",{className:"text-xs text-red-500 text-center font-albert",children:eY})]})}):(0,r.jsx)("div",{className:"absolute inset-0 flex flex-col items-center justify-center",children:ed?(0,r.jsxs)(r.Fragment,{children:["video"===i?(0,r.jsx)(d.A,{className:"w-5 h-5 text-gray-400 dark:text-[#9ca3af]"}):"audio"===i?(0,r.jsx)(c.A,{className:"w-5 h-5 text-gray-400 dark:text-[#9ca3af]"}):"presentation"===i?(0,r.jsx)(u.A,{className:"w-5 h-5 text-gray-400 dark:text-[#9ca3af]"}):(0,r.jsx)(h.A,{className:"w-5 h-5 text-gray-400 dark:text-[#9ca3af]"}),(0,r.jsx)("span",{className:"mt-1.5 text-[10px] text-gray-400 dark:text-[#9ca3af] font-albert",children:"Upload"})]}):"thumbnail"===P||z?(0,r.jsx)("div",{className:"w-10 h-10 rounded-full bg-white/60 dark:bg-white/10 backdrop-blur-sm flex items-center justify-center shadow-sm",children:(0,r.jsx)("svg",{className:"w-5 h-5 text-brand-accent",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("div",{className:`rounded-full bg-white/60 dark:bg-white/10 backdrop-blur-sm flex items-center justify-center shadow-sm ${et?"w-10 h-10 mb-2":"w-14 h-14 mb-3"}`,children:"video"===i?(0,r.jsx)("svg",{className:`${et?"w-5 h-5":"w-6 h-6"} text-brand-accent`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z"})}):"audio"===i?(0,r.jsx)(c.A,{className:`${et?"w-5 h-5":"w-6 h-6"} text-brand-accent`}):"presentation"===i?(0,r.jsx)(u.A,{className:`${et?"w-5 h-5":"w-6 h-6"} text-brand-accent`}):(0,r.jsx)("svg",{className:`${et?"w-5 h-5":"w-6 h-6"} text-brand-accent`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})})}),et?eL&&(0,r.jsxs)("p",{className:"text-xs font-medium text-[#5f5a55] dark:text-[#b2b6c2] font-albert",children:["Drop ",tD()," here"]}):(0,r.jsx)("p",{className:"text-sm font-medium text-[#5f5a55] dark:text-[#b2b6c2] font-albert",children:eL?`Drop ${tD()} here`:"Click to upload"}),(0,r.jsx)("p",{className:`text-[#8f8a85] dark:text-[#8f929e] font-albert ${et?"text-[10px] leading-snug px-1":"text-xs mt-1"}`,children:tU()}),!et&&ea&&"image"===i&&(0,r.jsxs)("button",{type:"button",onClick:e=>{e.stopPropagation(),eH(!0)},className:"flex items-center gap-1 mt-2 text-xs text-brand-accent hover:text-brand-accent/80 font-medium font-albert transition-colors",children:[(0,r.jsx)(l.A,{className:"w-3 h-3"}),"or generate with AI"]})]})})}),tW?(0,r.jsxs)("div",{className:"space-y-1.5",children:[eg,(0,r.jsxs)("p",{className:"text-[11px] text-[#8f8a85]/80 dark:text-[#8f929e]/80 font-albert",children:["Recommended: ",tW]})]}):eg),(0,r.jsx)("input",{ref:e5,type:"file",accept:(e=>{switch(e){case"image":return"image/jpeg,image/jpg,image/png,image/webp,image/gif,image/heic,image/heif,.he
13ic,.heif";case"video":return"video/mp4,video/webm,video/quicktime";case"visual":return"image/jpeg,image/jpg,image/png,image/webp,image/gif,image/heic,image/heif,.heic,.heif,video/mp4,video/webm,video/quicktime";case"audio":return V.join(",");case"presentation":return`${O.join(",")},.pdf,.ppt,.pptx`;case"media":return"image/jpeg,image/jpg,image/png,image/webp,image/gif,image/heic,image/heif,.heic,.heif,video/mp4,video/webm,video/quicktime,"+V.join(",");case"file":case"any":return"*/*"}})(i),onChange:ty,className:"hidden"}),ts&&(0,r.jsx)(v.MediaLibraryPicker,{open:eB,onOpenChange:eI,type:td,folder:a,uploadEndpoint:k,title:`Choose ${tD()}`,onSelect:e=>{em?.(e),(e.fileSizeBytes||e.contentType||e.durationSeconds||e.durationSec)&&en?.({fileSizeBytes:e.fileSizeBytes||Math.round(1024*(e.fileSizeMb||0)*1024),contentType:e.contentType||"application/octet-stream",durationSeconds:e.durationSeconds||e.durationSec}),e.thumbnailUrl&&"video"===e.mediaType&&L?.(e.thumbnailUrl),e.bunnyVideoId&&(e3.current=e.bunnyVideoId),t(e.url)}}),th&&(0,r.jsx)(A,{open:eV,onOpenChange:eO,type:tu,folder:a,title:`Choose stock ${tD()}`,searchEndpoint:ex,onSelect:e=>{let a="video"===e.type?e.videoUrl||e.contentUrl:e.imageUrl||e.contentUrl;if(!a)return;let r=e.thumbnailUrl||e.thumbnail,n="video"===e.type?"video/mp4":"image/jpeg";"video"===e.type&&(r&&L?.(r),en?.({fileSizeBytes:0,contentType:n,durationSeconds:e.duration})),ts&&(0,T.u$)({url:a,filename:e.alt||`Pexels ${e.type} ${e.id}`,mediaType:e.type,contentType:n,durationSeconds:e.duration,thumbnailUrl:r,source:"pexels",externalProvider:"pexels",externalId:e.externalId||e.id,attributionName:e.attributionName||e.photographer,attributionUrl:e.attributionUrl,sourcePageUrl:e.sourcePageUrl||e.url}).then(e=>{Y(e),e&&em?.(e)}),te.current=a,t(a)}})]}),eP&&(0,r.jsx)("p",{className:"text-sm text-red-600 font-albert",children:eP})]})}}}]);

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.