1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8217],{44984:function(t,e,n){n.d(e,{AuthProvider:function(){return p},a:function(){return f}});var r=n(57437),o=n(2265),i=n(99376);function a(){let t=(0,i.usePathname)(),e=(0,i.useSearchParams)(),n=(0,i.useRouter)();return(0,o.useEffect)(()=>{n.replace("/logout?".concat(new URLSearchParams({redirect:"".concat(t).concat((null==e?void 0:e.size)?"?".concat(e):"")})))},[]),null}var u=n(88751),c=n(4374),l=n(52110);let s=(0,o.createContext)({admin:!1,loggedIn:!1}),f=()=>(0,o.useContext)(s);async function d(t,e){return Promise.all([(0,l.f1)("like",async n=>{let r=n.projectId,o=(t.likes||[]).filter(t=>t!==r);n.like&&o.push(r),await e("likes",o)}),(0,l.f1)("favorite",async n=>{let r=n.optionId,o=(t.favorites||[]).filter(t=>t!==r);n.favorite&&o.push(r),await e("favorites",o)})])}function p(t){let{children:e,admin:n,logout:i,user:f}=t,[p,m]=(0,o.useState)(f);(0,o.useEffect)(()=>{m(f),f?d(f,v.updateUser):(0,l.o0)()},[f]);let v={admin:n,loggedIn:!!p,user:p,deleteUser:async()=>{p&&(await (0,c.Z)("/api/user",{method:"DELETE"}),localStorage.clear())},updateUser:async(t,e)=>{if(p){var n;let r=await (n={id:p.id,[t]:e},(0,c.Z)("/api/user",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).then(t=>t.json()));return m(r),r}},updateLocalUser:function(t,e){if(!p)return;let n={...p,[t]:e};return m(n),n},cancelSubscription:async()=>{p&&(await (0,u.E)(),m({...p,product:void 0,subscription:void 0}))}};return(0,r.jsxs)(s.Provider,{value:v,children:[e,(0,r.jsx)(o.Suspense,{children:i&&(0,r.jsx)(a,{})})]})}},85518:function(t,e,n){n.d(e,{ToastProvider:function(){return x},e:function(){return w}});var r=n(57437),o=n(93810),i=n.n(o),a=n(7633),u=n.n(a),c=n(99376),l=n(2265),s=n(36760),f=n.n(s),d=n(20138),p=n(14082),m=n(95804);let v={info:"bg-toast",error:"bg-toast-error text-background",success:"bg-toast-success text-background",warning:"bg-toast-warning text-background"},C={info:void 0,error:(0,r.jsx)(function(t){let{className:e}=t;return(0,r.jsx)("svg",{className:f()("icon",e),height:"32",viewBox:"0 0 32 32",width:"32",children:(0,r.jsx)("path",{d:"M16 0C12.8355 0 9.74207 0.938383 7.11088 2.69649C4.4797 4.45459 2.42894 6.95344 1.21793 9.87706C0.00693255 12.8007 -0.309921 16.0177 0.307443 19.1214C0.924806 22.2251 2.44866 25.0761 4.6863 27.3137C6.92394 29.5513 9.77486 31.0752 12.8786 31.6926C15.9823 32.3099 19.1993 31.9931 22.1229 30.7821C25.0466 29.5711 27.5454 27.5203 29.3035 24.8891C31.0616 22.2579 32 19.1645 32 16C31.9919 11.759 30.3035 7.69409 27.3047 4.69527C24.3059 1.69645 20.241 0.00813226 16 0ZM14.7692 8.61538C14.7692 8.28896 14.8989 7.97591 15.1297 7.7451C15.3605 7.51428 15.6736 7.38461 16 7.38461C16.3264 7.38461 16.6395 7.51428 16.8703 7.7451C17.1011 7.97591 17.2308 8.28896 17.2308 8.61538V17.2308C17.2308 17.5572 17.1011 17.8702 16.8703 18.1011C16.6395 18.3319 16.3264 18.4615 16 18.4615C15.6736 18.4615 15.3605 18.3319 15.1297 18.1011C14.8989 17.8702 14.7692 17.5572 14.7692 17.2308V8.61538ZM16 24.6154C15.6349 24.6154 15.2779 24.5071 14.9743 24.3042C14.6707 24.1014 14.4341 23.8131 14.2944 23.4757C14.1546 23.1384 14.1181 22.7672 14.1893 22.4091C14.2606 22.0509 14.4364 21.722 14.6946 21.4638C14.9528 21.2056 15.2817 21.0298 15.6398 20.9585C15.998 20.8873 16.3692 20.9239 16.7065 21.0636C17.0438 21.2033 17.3322 21.44 17.535 21.7436C17.7379 22.0472 17.8462 22.4041 17.8462 22.7692C17.8462 23.2589 17.6516 23.7284 17.3054 24.0747C16.9592 24.4209 16.4896 24.6154 16 24.6154Z"})})},{className:"size-6 fill-background"}),success:(0,r.jsx)(function(t){let{className:e}=t;return(0,r.jsx)("svg",{className:f()("icon",e),height:"32",viewBox:"0 0 32 32",width:"32",children:(0,r.jsx)("path",{d:"M16 0C12.8355 0 9.74207 0.938383 7.11088 2.69649C4.4797 4.45459 2.42894 6.95344 1.21793 9.87706C0.00693255 12.8007 -0.309921 16.0177 0.307443 19.1214C0.924806 22.2251 2.44866 25.0761 4.6863 27.3137C6.92394 29.5513 9.77486 31.0752 12.8786 31.6926C15.9823 32.3099 19.1993 31.9931 22.1229 30.7821C25.0466 29.5711 27.5454 27.5203 29.3035 24.8891C31.0616 22.2579 32 19.1645 32 16C31.9919 11.759 30.3035 7.69409 27.3047 4.69527C24.3059 1.69645 20.241 0.00813226 16 0ZM23.6154 13.2L14.6 21.8154C14.3669 22.0346 14.0584 22.1558 13.7385 22.1538C13.5821 22.1561 13.4268 22.1273 13.2815 22.0692C13.1363 22.0111 13.004 21.9249 12.8923 21.8154L8.38462 17.5077C8.25959 17.3986 8.15791 17.2654 8.08569 17.116C8.01347 16.9666 7.9722 16.8042 7.96436 16.6384C7.95651 16.4727 7.98226 16.3071 8.04006 16.1516C8.09786 15.996 8.1865 15.8538 8.30067 15.7334C8.41484 15.613 8.55218 15.5169 8.70442 15.451C8.85667 15.385 9.02068 15.3505 9.1866 15.3495C9.35252 15.3486 9.51692 15.3812 9.66992 15.4453C9.82293 15.5095 9.96137 15.604 10.0769 15.7231L13.7385 19.2154L21.9231 11.4154C22.1624 11.2066 22.4731 11.0984 22.7904 11.1134C23.1076 11.1284 23.4068 11.2655 23.6253 11.4959C23.8438 11.7264 23.9648 12.0324 23.963 12.3499C23.9611 12.6675 23.8366 12.9721 23.6154 13.2Z"})})},{className:"size-6 fill-background"}),warning:(0,r.jsx)(function(t){let{className:e}=t;return(0,r.jsx)("svg",{className:f()("icon",e),height:"32",viewBox:"0 0 32 32",width:"32",children:(0,r.jsx)("path",{d:"M31.53 24.4346L18.9717 2.71826C18.6711 2.19597 18.2381 1.76214 17.7164 1.46049C17.1946 1.15883 16.6026 1 16 1C15.3974 1 14.8054 1.15883 14.2836 1.46049C13.7619 1.76214 13.3289 2.19597 13.0283 2.71826L0.469962 24.4346C0.164887 24.9542 0.00275698 25.5454 3.48519e-05 26.1479C-0.00268727 26.7505 0.154096 27.3431 0.454463 27.8654C0.75483 28.3878 1.18808 28.8214 1.71023 29.1222C2.23237 29.423 2.82481 29.5802 3.42738 29.5779H28.5726C29.1752 29.5802 29.7676 29.423 30.2898 29.1222C30.8119 28.8214 31.2452 28.3878 31.5455 27.8654C31.8459 27.3431 32.0027 26.7505 32 26.1479C31.9972 25.5454 31.8351 24.9542 31.53 24.4346ZM14.857 12.4335C14.857 12.1303 14.9775 11.8396 15.1918 11.6253C15.4061 11.4109 15.6969 11.2905 16 11.2905C16.3031 11.2905 16.5939 11.4109 16.8082 11.6253C17.0225 11.8396 17.143 12.1303 17.143 12.4335V18.1483C17.143 18.4514 17.0225 18.7421 16.8082 18.9565C16.5939 19.1708 16.3031 19.2913 16 19.2913C15.6969 19.2913 15.4061 19.1708 15.1918 18.9565C14.9775 18.7421 14.857 18.4514 14.857 18.1483V12.4335ZM16 25.0061C15.6609 25.0061 15.3294 24.9055 15.0475 24.7171C14.7656 24.5288 14.5458 24.261 14.4161 23.9477C14.2863 23.6344 14.2523 23.2897 14.3185 22.9572C14.3846 22.6246 14.5479 22.3191 14.7877 22.0793C15.0275 21.8396 15.333 21.6763 15.6655 21.6101C15.9981 21.544 16.3428 21.5779 16.6561 21.7077C16.9694 21.8375 17.2371 22.0572 17.4255 22.3391C17.6139 22.6211 17.7144 22.9525 17.7144 23.2916C17.7144 23.7463 17.5338 24.1824 17.2123 24.5039C16.8908 24.8255 16.4547 25.0061 16 25.0061Z"})})},{className:"size-6 fill-background"})};function g(t){let{className:e,onClose:n,toast:o}=t,[i,a]=(0,l.useState)(!1),[u,c]=(0,l.useState)(!1),[s,g]=(0,l.useState)(0),h=(0,l.useRef)(null),y=(0,l.useRef)(0);function w(){a(!1),setTimeout(()=>{n(o)},200)}return(0,l.useEffect)(()=>{let t;if(requestAnimationFrame(()=>{a(!0)}),!o.sticky){var e;t="error"===o.type||"warning"===o.type||((null===(e=o.message)||void 0===e?void 0:e.toString().split(" ").length)||0)>=5?setTimeout(w,7e3):setTimeout(w,2e3)}let n=h.current;if(n)return n&&(n.addEventListener("touchstart",t=>{var e,n;(null===(e=(n=t.target).closest)||void 0===e?void 0:e.call(n,".exclude"))||(0,p.Z)(t)}),n.addEventListener("mousedown",p.Z)),()=>{clearTimeout(t),n.removeEventListener("touchstart",p.Z),n.removeEventListener("mousedown",p.Z)}},[o]),(0,l.useEffect)(()=>
1{if(!u)return;let t=t=>{t.preventDefault(),g(Math.min(0,t.clientY-y.current))},e=t=>{t.preventDefault(),c(!1),y.current-t.clientY>20?w():g(0)};return document.addEventListener("pointermove",t),document.addEventListener("pointercancel",e),document.addEventListener("pointerup",e),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointercancel",e),document.removeEventListener("pointerup",e)}},[u]),(0,r.jsxs)("div",{ref:h,"aria-label":"Toast",className:f()("toast flex min-h-toast flex-row items-center justify-center","gap-2 rounded-button px-4 py-2 text-sm font-bold",v[o.type],!u&&"transition-[opacity,transform]",i?"pointer-events-auto":"pointer-events-none -translate-y-full opacity-0",e),role:"button",style:{transform:u?"translateY(".concat(s,"px)"):void 0},tabIndex:0,onKeyUp:t=>{(" "===t.key||"Enter"===t.key)&&w()},onPointerDown:t=>{y.current=t.clientY,c(!0)},children:[C[o.type],(0,r.jsx)("div",{className:"grow",children:o.message}),o.sticky&&(0,r.jsx)(m.Z,{"aria-label":"Close Toast",className:"btn-icon-sm btn-tertiary exclude",onClick:w,onPointerDown:p.Z,children:(0,r.jsx)(d.Z,{className:"size-4"})})]})}var h=n(6904);let y=(0,l.createContext)({toasts:[],addToast:i()}),w=()=>(0,l.useContext)(y);function x(t){let{children:e}=t,n=(0,c.usePathname)(),[o,i]=(0,l.useState)([]);function a(t){i(e=>e.filter(e=>e.id!==t.id))}return(0,l.useEffect)(()=>{i([])},[n]),(0,r.jsxs)(y.Provider,{value:{toasts:o,addToast:function(t){var e;let n=u()("toast");i(o.filter(e=>e.message!==t.message).concat({...t,id:n})),(0,h.B)("toast",{message:null===(e=t.message)||void 0===e?void 0:e.toString(),type:t.type})}},children:[e,(0,r.jsx)("div",{className:"pointer-events-none fixed left-1/2 top-0 z-50 flex w-full max-w-[calc(100%-3rem)] -translate-x-1/2 flex-col-reverse items-center justify-start gap-4 p-4 lg:max-w-screen-xs",children:o.map(t=>(0,r.jsx)(g,{toast:t,onClose:a},"toast-".concat(t.id,"}")))})]})}},82245:function(t,e,n){n.d(e,{Z:function(){return o}});var r=n(1392);function o(t){let e=Date.now(),n={...t,id:(0,r.Z)(),name:(null==t?void 0:t.name)||"",originalId:void 0,private:!1,template:!1,tokens:(null==t?void 0:t.tokens)||[],userId:void 0,createdAt:e,updatedAt:e};return(null==t?void 0:t.template)&&(n.originalTemplateId=t.id),n}},88751:function(t,e,n){n.d(e,{E:function(){return i},X:function(){return o}});var r=n(4374);function o(){return(0,r.Z)("/api/billing/products").then(t=>t.json())}function i(){return(0,r.Z)("/api/billing/cancel",{method:"POST"})}},55749:function(t,e,n){n.d(e,{$L:function(){return l},Ft:function(){return u},e5:function(){return a},mW:function(){return i},th:function(){return f},ty:function(){return s},uJ:function(){return c}});var r=n(52110),o=n(4374);function i(){let{limit:t,startKey:e,updated:n}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=new URLSearchParams;return n instanceof Date&&r.append("updated","".concat(+n)),t&&!isNaN(t)&&r.append("limit","".concat(t)),e&&r.append("startKey",e),(0,o.Z)("/api/project/recent?".concat(r))}function a(t){return(0,o.Z)("/api/project/".concat(t),void 0,!0).then(t=>{if(404!==t.status)return t.json()})}function u(){return(0,o.Z)("/api/project/recent",void 0,!0).then(t=>t.json()).then(t=>t[0])}function c(t){var e,n;return{...t,tokens:null==t?void 0:null===(n=t.tokens)||void 0===n?void 0:null===(e=n.filter(t=>!t.temporary))||void 0===e?void 0:e.map(t=>({...t,audioBuffer:void 0,disconnect:void 0,sourceNode:void 0}))}}function l(t){return(0,o.Z)("/api/project/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(c(t))}).then(t=>t.json())}function s(t){return(0,o.Z)("/api/project/".concat(t.id),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(c(t))}).then(t=>t.json())}function f(t){let e=(0,r.FV)();return(null==e?void 0:e.id)===t&&(0,r.Qr)(),(0,o.Z)("/api/project/".concat(t),{method:"DELETE"})}},6904:function(t,e,n){n.d(e,{B:function(){return o},MU:function(){return r},sh:function(){return i}});let r="GTM-W56S2R3";function o(t,e){var n,o;r&&(null!==(o=(n=window).dataLayer)&&void 0!==o||(n.dataLayer=[]),window.dataLayer.push({event:t,...e}))}function i(t){return t.options.map(t=>"".concat(t.type,": ").concat(t.label)).join(", ")||"Empty token"}},52110:function(t,e,n){n.d(e,{VP:function(){return Y},Mw:function(){return z},Qr:function(){return j},o0:function(){return T},c4:function(){return O},jt:function(){return I},G$:function(){return Z},EB:function(){return F},FW:function(){return J},e5:function(){return N},FV:function(){return x},FR:function(){return S},i1:function(){return P},Ji:function(){return M},f1:function(){return B},UI:function(){return L},ff:function(){return V},Ov:function(){return U},wp:function(){return b},pF:function(){return E}});var r=n(21652),o=n.n(r),i=n(82245),a=n(55749),u=n(59301),c=n(70291),l=n(7147),s=n(15529);function f(t){"ambient"===t.type&&(t.type="sound");let e=t.originalValue;e&&(delete t.originalValue,"sound"===t.type&&(t.modifiers[0].value=e),"video"===t.type&&(t.sources=[e])),"filter"===t.type&&(t.modifiers=t.modifiers.flatMap(t=>"filter"===t.tag?t.value.replace(/\)/g,"").split(";").map(e=>{let[n,r]=e.split("(");return{tag:"filter",value:n,args:r?r.split(",").reduce((t,e)=>
1{let[n,r]=e.split("=");return t[n.trim()]=parseFloat(r),t},{}):t.args}}):t))}let d="worbler-project-v1",p="worbler-change-voice-project-v1",m="worbler-onboard-v2",v="worbler-songify-onboard-v1",C="worbler-option-v1",g="worbler-login-actions-v1",h="worbler-last-editor-tool-v1";function y(t){return localStorage.getItem(t)}function w(t,e){localStorage.setItem(t,e)}function x(){let t=y(d);if(t)return function(t){t.tokens=t.tokens.reduce((t,e)=>(("number"!=typeof e.lane||e.lane<0||("video"===e.type?4!==e.lane:e.lane>3))&&delete e.lane,e.options.forEach(f),e.children)?(e.children.forEach(t=>{t.options.forEach(f)}),t.concat(e,e.children)):t.concat(e),[]),null==t.template&&(t.template=!1),null==t.private&&(t.private=!1);let e=t.video;if(!(0,u.go)(t)&&e){let n=(0,c.tY)(e);n.startTime=0,t.tokens=[...t.tokens.filter(t=>"audio"!==t.type||!(0,l.Tr)(t)&&!(0,l.cq)(t)),n],delete t.video}if((0,u.go)(t)&&t.trim){let e=t.trim,n=t.tokens.filter(t=>"video"===t.type);1!==n.length||n[0].trim||(n[0].trim=e),delete t.trim}return null!=t.zoom&&(t.zoom<.01||t.zoom>s.sZ)&&delete t.zoom,t}(JSON.parse(t))}function b(t){w(d,JSON.stringify({...t,tokens:t.tokens.filter(t=>!t.temporary)}))}function j(){localStorage.removeItem(d)}function S(){let t=y(p);if(t)return JSON.parse(t)}function E(t){w(p,JSON.stringify(t))}async function k(t){let e=await (0,a.e5)(t.id);return!e&&(0,u.go)(t)&&(e=await (0,a.$L)(t)),e}async function N(t,e){let n;if(e){let t=await (0,a.e5)(e);if(!t)throw Error("Template not found");n=Z(t)}else n=x();let r=n;if(t){let t=n?await k(n):await (0,a.Ft)();t&&b(r=t)}return r}function Z(t){let e=(0,i.Z)(t);return b(e),e}async function L(t,e){return e&&(0,u.go)(t)&&(t.userId?await (0,a.ty)(t):t=await (0,a.$L)(t)),b(t),t}function T(){let t=x();(null==t?void 0:t.userId)&&localStorage.removeItem(d),localStorage.removeItem(g)}function M(){return"true"===y(v)}function I(){w(v,"true")}function P(){return"true"===y(m)}function O(){w(m,"true")}function J(){let t=y(C);if(t)return JSON.parse(t)}function U(t){w(C,JSON.stringify(t))}function z(){localStorage.removeItem(C)}function F(){let t=y(h);if(t){let e=JSON.parse(t);return"record"===e.type?{...e,recording:!1,recorder:void 0}:e}}function V(t){if(!t){localStorage.removeItem(h);return}w(h,JSON.stringify(t))}function D(){let t=y(g);if(t)return JSON.parse(t)}function Y(t){if(!t)return;let e=D()||[];(e=e.filter(e=>e.type!==t.type)).push(t),w(g,JSON.stringify(e))}async function B(t,e){let n=(D()||[]).filter(e=>e.type===t),r=n.map(e);await Promise.all(r),function(t){if(!t.length)return;let e=D()||[];for(let n of t){let t=e.findIndex(t=>o()(t,n));t>-1&&e.splice(t,1)}w(g,JSON.stringify(e))}(n)}},15529:function(t,e,n){n.d(e,{dg:function(){return i},hG:function(){return a},sZ:function(){return r},sn:function(){return o}});let r=3.5;function o(t){let{containerWidth:e,defaultSecondWidth:n,duration:o,maxZoom:i=r}=t;return Math.min(i,Math.max(0,Math.max(0,.4*e/o)/n))}function i(t){return t.length?{x:t.reduce((t,e)=>t+e.clientX,0)/t.length,y:t.reduce((t,e)=>t+e.clientY,0)/t.length}:{x:0,y:0}}function a(t){if(t.length<2)return 0;let e=t[0],n=t[1];return Math.sqrt(Math.pow(Math.abs(e.clientX-n.clientX),2)+Math.pow(Math.abs(e.clientY-n.clientY),2))}}}]);
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.