(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9905],{71508:function(e,t,n){Promise.resolve().then(n.bind(n,54434))},99376:function(e,t,n){"use strict";var r=n(35475);n.o(r,"redirect")&&n.d(t,{redirect:function(){return r.redirect}}),n.o(r,"usePathname")&&n.d(t,{usePathname:function(){return r.usePathname}}),n.o(r,"useRouter")&&n.d(t,{useRouter:function(){return r.useRouter}}),n.o(r,"useSearchParams")&&n.d(t,{useSearchParams:function(){return r.useSearchParams}})},54434:function(e,t,n){"use strict";n.d(t,{TemplateList:function(){return b}});var r=n(57437),a=n(99376),l=n(2265),o=n(37799),s=n(23755),i=n(67481);function c(e){let{items:t,itemWidth:n,openModal:a}=e;return(0,r.jsx)(s.r,{children:(0,r.jsx)("div",{className:"flex gap-8",children:t.map((e,t)=>(0,r.jsx)("div",{className:(0,o.A)("h-full w-full",200===n?"flex-[0_0_50%]":"flex-[0_0_75%]",200===n?"sm:flex-[0_0_200px]":"sm:flex-[0_0_400px]"),children:(0,r.jsx)(i.k,{...e,onClick:()=>a(t)})},t))})})}var u=n(29626),d=n(58114);function f(){return(0,r.jsx)("div",{className:"flex w-full flex-col gap-8 overflow-hidden px-0 sm:px-8",children:(0,r.jsx)("div",{className:"hero relative rounded-none bg-gradient-to-r from-slate-900 to-slate-800 sm:rounded-lg",children:(0,r.jsxs)("div",{className:"hero-content py-20 text-center",children:[(0,r.jsxs)("div",{className:"z-10 max-w-xl space-y-8 rounded-lg",children:[(0,r.jsx)("h1",{className:"text-3xl font-bold sm:text-5xl",children:"Templates"}),(0,r.jsx)(d.SearchNavigation,{}),(0,r.jsx)("p",{className:"text-base sm:text-xl",children:"Explore thousands of templates made by our community. They are a great way to get started creating your own masterpieces."})]}),(0,r.jsxs)("picture",{className:"blur-xs absolute bottom-0 right-0 top-0 hidden h-full max-w-sm rounded-r-lg object-contain opacity-50 bg-blend-darken shadow-2xl sm:block",children:[(0,r.jsx)("source",{srcSet:"".concat(u.wM,"/templates/text-to-video-banner.webp"),type:"image/webp"}),(0,r.jsx)("img",{src:"".concat(u.wM,"/templates/text-to-video-banner.png"),alt:"main banner image",className:"h-full rounded-r-lg"})]}),(0,r.jsxs)("picture",{className:"blur-xs absolute bottom-0 left-0 top-0 hidden h-full max-w-sm rounded-l-lg object-contain opacity-50 bg-blend-darken shadow-2xl sm:block",children:[(0,r.jsx)("source",{srcSet:"".concat(u.wM,"/templates/main-banner.webp"),type:"image/webp"}),(0,r.jsx)("img",{src:"".concat(u.wM,"/templates/main-banner.png"),alt:"main banner image",className:"h-full rounded-l-lg"})]})]})})})}var m=n(44785),p=n(16922),h=n(74062);let x={popular:"portrait",new:"portrait",TIKTOK:"portrait",MOVIES:"landscape",BOLLYWOOD:"portrait","MUSIC VIDEO":"landscape",SPORTS:"portrait",MEMES:"landscape",TRANSITION:"portrait",KPOP:"portrait"};function b(e){var t;let n;let{templates:o}=e,s=e=>t=>"landscape"==e?t.height<t.width:t.height>t.width,i={new:o.filter(s("portrait")).toSorted((e,t)=>t.createdAt.getTime()-e.createdAt.getTime()).slice(0,20),popular:o.filter(s("portrait")).toSorted((e,t)=>t.usedCount-e.usedCount).slice(0,20),"video-to-video":o.filter(e=>"VIDEO_TO_VIDEO"===e.type&&s("portrait")(e)).toSorted((e,t)=>t.usedCount-e.usedCount).slice(0,20),animation:o.filter(e=>"ANIMATION"===e.type&&s("portrait")(e)).toSorted((e,t)=>t.usedCount-e.usedCount).slice(0,20)};for(let e of m.N6)i[e]=o.filter(t=>{var n,r;return(null===(n=t.tags)||void 0===n?void 0:n.includes(e))&&s(null!==(r=x[e])&&void 0!==r?r:"portrait")(t)}).slice(0,20);let d=["popular","new","video-to-video","animation",...m.N6],[b,v]=(0,l.useState)(null),[w,j]=(0,l.useState)(void 0),[N,y]=(0,l.useState)(!1),S=(0,a.usePathname)(),_=(0,a.useRouter)(),[E]=(0,l.useState)(S);return(0,l.useEffect)(()=>{S&&(S.includes("details")&&!N?_.push(S):S.includes("details")||y(!1))},[S]),(0,r.jsxs)("div",{className:"my-8 flex w-full flex-col gap-8",children:[(0,r.jsx)(f,{}),d.map((e,t)=>{var n;let a=i[e];if(!a||a.length<1)return null;let l=e.toLowerCase().replaceAll(/[^a-z]/g," "),o=e.toLowerCase().replaceAll(/[^a-z]/g,"-"),s="landscape"===x[e]?400:200;return(0,r.jsxs)(g,{title:l,slug:o,children:[0===t&&(0,r.jsx)("link",{rel:"preload",fetchPriority:"high",as:"image",href:"".concat(u.X_,"/").concat(null===(n=a[0])||void 0===n?void 0:n.id,"/preview.png"),type:"image/png"}),(0,r.jsx)(c,{items:a,itemWidth:s,openModal:t=>{var n;v(e),j(t),y(!0);let r=null===(n=i[e])||void 0===n?void 0:n[t];r&&history.pushState({},"","/".concat((0,p.L)(r)))}})]},e)}),(0,r.jsx)(h.s,{template:void 0===w?void 0:null===(t=i[null!=b?b:""])||void 0===t?void 0:t[w],idx:w,isOpen:N,closeModal:function(){y(!1),j(void 0),v(null),history.pushState({},"",E)},handleIdx:(n=null!=b?b:"",e=>{var t;let r=null!==(t=i[n])&&void 0!==t?t:[];e>=r.length?j(0):e<0?j(r.length-1):j(e)})})]})}function g(e){let{title:t,slug:n,children:a}=e;return(0,r.jsxs)("div",{className:"flex flex-col gap-4 px-8",children:[(0,r.jsxs)("div",{className:"flex justify-between",children:[(0,r.jsx)("a",{href:"/templates/".concat(n),children:(0,r.jsx)("h2",{className:"text-2xl font-bold capitalize",children:t})}),(0,r.jsx)("a",{href:"/templates/".concat(n),children:"See all"})]}),a]})}},37799:function(e,t,n){"use strict";function r(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.filter(Boolean).join(" ")}n.d(t,{A:function(){return r}})},47505:function(e,t,n){"use strict";n.d(t,{AnalyticsWrapper:function(){return o},q:function(){return i},trackEvent:function(){return s}});var r=n(57437),a=n(2265),l=n(82953);function o(){return(0,a.useEffect)(()=>{let e="G-PX0XW62L06";e&&l.ZP.initialize(e),async function(){let{BrowserAgent:e}=await n.e(2091).then(n.bind(n,52091));new e({init:{distributed_tracing:{enabled:!0},privacy:{cookies_enabled:!0},ajax:{deny_list:["bam.nr-data.net"]}},info:{beacon:"bam.nr-data.net",errorBeacon:"bam.nr-data.net",licenseKey:"NRJS-4dfdd59cc5a9ba67cd0",applicationID:"1049528869",sa:1},loader_config:{accountID:"3978410",trustKey:"3978410",agentID:"1134343550",licenseKey:"NRJS-4dfdd59cc5a9ba67cd0",applicationID:"1049528869"}})}()},[]),(0,r.jsx)(r.Fragment,{children:(0,r.jsx)("link",{rel:"preconnect",href:"https://www.googletagmanager.com"})})}function s(e){let{eventName:t,action:n,category:r}=e;l.ZP.event({category:r||t,action:"".concat(t,"-").concat(n)})}function i(e){(0,a.useEffect)(()=>{s({...e,action:"view"})},[])}},29626:function(e,t,n){"use strict";n.d(t,{DN:function(){return r},QM:function(){return d},X_:function(){return c},Xv:function(){return l},ZH:function(){return u},i3:function(){return o},kR:function(){return a},vE:function(){return s},wM:function(){return i}});let r="bg-gradient-to-r from-teal-500 via-indigo-600 to-purple-600",a="".concat(r," hover:from-teal-400 hover:via-indigo-500 hover:to-purple-700"),l=10,o={ANIMATION:1e4,FACE_SWAP:6e3,IMAGE_TO_VIDEO:2e3,LIP_SYNC:6e3,TEXT_TO_VIDEO:2e3,VIDEO_TO_VIDEO:1800},s={ANIMATION:1,FACE_SWAP:1,IMAGE_TO_VIDEO:2,LIP_SYNC:1,TEXT_TO_VIDEO:2,VIDEO_TO_VIDEO:2},i="https://d28dkohlqf5vwj.cloudfront.net",c="https://videos.magichour.ai",u=1073741824,d=400},23755:function(e,t,n){"use strict";n.d(t,{r:function(){return u}});var r=n(57437),a=n(52700),l=n(73910),o=n(3371),s=n(9467),i=n(2265),c=n(37799);function u(e){let{children:t,prevButtonClass:n="",nextButtonClass:u="",loop:d=!1,autoScroll:f}=e,m=[];f&&m.push((0,o.Z)(f));let[p,h]=(0,s.Z)({loop:d,slidesToScroll:"auto"},m),[x,b]=(0,i.useState)(!0),[g,v]=(0,i.useState)(!0),w=(0,i.useCallback)(()=>{h&&h.scrollPrev()},[h]),j=(0,i.useCallback)(()=>{h&&h.scrollNext()},[h]),N=(0,i.useCallback)(e=>{b(!e.canScrollPrev()),v(!e.canScrollNext())},[]);return(0,i.useEffect)(()=>{h&&(N(h),h.on("reInit",N),h.on("select",N))},[h,N]),(0,r.jsxs)("div",{className:"relative w-full",children:[(0,r.jsx)("div",{className:"overflow-hidden",ref:p,children:t}),(0,r.jsx)("button",{className:(0,c.A)("btn btn-circle btn-neutral absolute -left-6 bottom-4 top-0 my-auto flex items-center justify-center",x?"hidden":"block",n),onClick:w,disabled:x,role:"button","aria-label":"Previous Button",children:(0,r.jsx)(a.Z,{className:"h-6 w-6"})}),(0,r.jsx)("button",{className:(0,c.A)("btn btn-circle btn-neutral absolute -right-6 bottom-4 top-0 my-auto flex items-center justify-center",g?"hidden":"block",u),onClick:j,disabled:g,role:"button","aria-label":"Next Button",children:(0,r.jsx)(l.Z,{className:"h-6 w-6"})})]})}},58114:function(e,t,n){"use strict";n.d(t,{M:function(){return s},SearchNavigation:function(){return i}});var r=n(57437),a=n(41556),l=n(99376),o=n(2265);function s(e){let{query:t,setQuery:n,onClick:l}=e;return(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"flex w-full gap-2",children:[(0,r.jsxs)("label",{className:"input flex grow items-center gap-2 border border-gray-600 bg-slate-800 focus-within:border-gray-400 focus-within:outline-none focus-within:ring-0",children:[(0,r.jsx)(a.Z,{className:"hidden h-4 w-4 sm:block"}),(0,r.jsx)("input",{type:"text",className:"grow border-none border-neutral px-0 focus:border-none focus:ring-0",placeholder:"Search thousands of templates",onChange:e=>n(e.target.value),value:t})]}),(0,r.jsxs)("button",{className:"btn btn-outline w-14 bg-slate-800",onClick:l,children:[(0,r.jsx)(a.Z,{className:"h-6 w-6"}),(0,r.jsx)("span",{className:"sr-only",children:"Search"})]})]})})}function i(e){let{filter:t}=e,[n,a]=(0,o.useState)(""),i=(0,l.useRouter)();function c(){if(n.length>0){let e=new URLSearchParams;e.append("query",encodeURIComponent(n)),t&&e.append("filter",encodeURIComponent(t)),i.push("/templates/search?".concat(e.toString()))}}let u=e=>{"Enter"===e.key&&c()};return(0,o.useEffect)(()=>(document.addEventListener("keydown",u),()=>document.removeEventListener("keydown",u)),[n]),(0,r.jsx)("div",{className:"flex w-full flex-col gap-2",children:(0,r.jsx)(s,{query:n,setQuery:a,onClick:c})})}},41556:function(e,t,n){"use strict";var r=n(2265);let a=r.forwardRef(function(e,t){let{title:n,titleId:a,...l}=e;return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":a},l),n?r.createElement("title",{id:a},n):null,r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"}))});t.Z=a}},function(e){e.O(0,[605,2953,3841,2957,1229,2525,8061,3709,1233,9419,2971,2117,1744],function(){return e(e.s=71508)}),_N_E=e.O()}]);
//# sourceMappingURL=page-dc793587f1f120b1.js.map