1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a0ecc4-ccd0-77d2-84a5-9190f675abb9")}catch(e){}}();(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3956],{3617:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(48907).A)("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]])},7755:(e,t,a)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var a in t)Object.defineProperty(e,a,{enumerable:!0,get:t[a]})}(t,{default:function(){return c},getImageProps:function(){return i}});let s=a(22679),r=a(93741),l=a(53245),n=s._(a(46823));function i(e){let{props:t}=(0,r.getImgProps)(e,{defaultLoader:n.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,a]of Object.entries(t))void 0===a&&delete t[e];return{props:t}}let c=l.Image},8008:(e,t,a)=>{"use strict";a.d(t,{bq:()=>m,eb:()=>f,gC:()=>h,l6:()=>o,yv:()=>u});var s=a(74817),r=a(27717),l=a(6369),n=a(50843),i=a(94922),c=a(90911),d=a(33359);let o=l.bL;l.YJ;let u=l.WT,m=r.forwardRef((e,t)=>{let{className:a,children:r,...i}=e;return(0,s.jsxs)(l.l9,{ref:t,className:(0,d.cn)("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...i,children:[r,(0,s.jsx)(l.In,{asChild:!0,children:(0,s.jsx)(n.A,{className:"h-4 w-4 opacity-50"})})]})});m.displayName=l.l9.displayName;let p=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)(l.PP,{ref:t,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",a),...r,children:(0,s.jsx)(i.A,{className:"h-4 w-4"})})});p.displayName=l.PP.displayName;let x=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)(l.wn,{ref:t,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",a),...r,children:(0,s.jsx)(n.A,{className:"h-4 w-4"})})});x.displayName=l.wn.displayName;let h=r.forwardRef((e,t)=>{let{className:a,children:r,position:n="popper",...i}=e;return(0,s.jsx)(l.ZL,{children:(0,s.jsxs)(l.UC,{ref:t,className:(0,d.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:n,...i,children:[(0,s.jsx)(p,{}),(0,s.jsx)(l.LM,{className:(0,d.cn)("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:r}),(0,s.jsx)(x,{})]})})});h.displayName=l.UC.displayName,r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)(l.JU,{ref:t,className:(0,d.cn)("px-2 py-1.5 text-sm font-semibold",a),...r})}).displayName=l.JU.displayName;let f=r.forwardRef((e,t)=>{let{className:a,children:r,...n}=e;return(0,s.jsxs)(l.q7,{ref:t,className:(0,d.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...n,children:[(0,s.jsx)("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(l.VF,{children:(0,s.jsx)(c.A,{className:"h-4 w-4"})})}),(0,s.jsx)(l.p4,{children:r})]})});f.displayName=l.q7.displayName,r.forwardRef((e,t)=>
1{let{className:a,...r}=e;return(0,s.jsx)(l.wv,{ref:t,className:(0,d.cn)("-mx-1 my-1 h-px bg-muted",a),...r})}).displayName=l.wv.displayName},13014:(e,t,a)=>{"use strict";a.d(t,{f:()=>r});var s=a(55219);let r=(0,s.createServerReference)("00a7aa3862880c57b682dd03ab81c40d9a2ebd46d1",s.callServer,void 0,s.findSourceMapURL,"getClientUserBenefits")},20957:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(48907).A)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},21305:(e,t,a)=>{"use strict";a.d(t,{h:()=>n});var s=a(74817),r=a(33359);let l={blue:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",cyan:"bg-cyan-100 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-400",emerald:"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400",violet:"bg-violet-100 text-violet-700 dark:bg-violet-900/30 dark:text-violet-400",amber:"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",rose:"bg-rose-100 text-rose-700 dark:bg-rose-900/30 dark:text-rose-400",orange:"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400",slate:"bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-300"};function n(e){let{tone:t,children:a,className:n,...i}=e;return(0,s.jsx)("span",{className:(0,r.cn)("inline-flex max-w-full items-center gap-1 whitespace-nowrap rounded-full px-2 py-0.5 text-xs font-medium",l[t],n),...i,children:a})}},34595:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(48907).A)("Music2",[["circle",{cx:"8",cy:"18",r:"4",key:"1fc0mg"}],["path",{d:"M12 18V2l7 4",key:"g04rme"}]])},38251:(e,t,a)=>{"use strict";a.d(t,{A:()=>i});var s=a(74817),r=a(27717),l=a(83452),n=a(33359);let i=r.forwardRef((e,t)=>{var a,r;let{className:i,value:c,defaultValue:d,trackClassName:o,rangeClassName:u,thumbClassName:m,thumbClassNames:p,...x}=e,h=null!=(r=null!=(a=null==c?void 0:c.length)?a:null==d?void 0:d.length)?r:1;return(0,s.jsxs)(l.bL,{ref:t,className:(0,n.cn)("relative flex w-full touch-none select-none items-center cursor-pointer",i),value:c,defaultValue:d,...x,children:[(0,s.jsx)(l.CC,{className:(0,n.cn)("relative h-1.5 w-full grow overflow-hidden rounded-full bg-gray-200 dark:bg-gray-800",o),children:(0,s.jsx)(l.Q6,{className:(0,n.cn)("absolute h-full bg-blue-600",u)})}),Array.from({length:h}).map((e,t)=>(0,s.jsx)(l.zi,{className:(0,n.cn)("block h-4 w-4 cursor-grab active:cursor-grabbing rounded-full border-2 border-blue-600 bg-white shadow transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 disabled:pointer-events-none disabled:opacity-50",m,null==p?void 0:p[t])},t))]})});i.displayName=l.bL.displayName},38857:(e,t,a)=>{"use strict";a.d(t,{bL:()=>w,zi:()=>N});var s=a(27717),r=a(50319),l=a(80148),n=a(15242),i=a(85259),c=a(59383),d=a(72503),o=a(74212),u=a(74817),m="Switch",[p,x]=(0,n.A)(m),[h,f]=p(m),b=s.forwardRef((e,t)=>{let{__scopeSwitch:a,name:n,checked:c,defaultChecked:d,required:p,disabled:x,value:f="on",onCheckedChange:b,form:y,...g}=e,[w,N]=s.useState(null),k=(0,l.s)(t,e=>N(e)),_=s.useRef(!1),A=!w||y||!!w.closest("form"),[M,I]=(0,i.i)({prop:c,defaultProp:null!=d&&d,onChange:b,caller:m});return(0,u.jsxs)(h,{scope:a,checked:M,disabled:x,children:[(0,u.jsx)(o.sG.button,{type:"button",role:"switch","aria-checked":M,"aria-required":p,"data-state":j(M),"data-disabled":x?"":void 0,disabled:x,value:f,...g,ref:k,onClick:(0,r.mK)(e.onClick,e=>{I(e=>!e),A&&(_.current=e.isPropagationStopped(),_.current||e.stopPropagation())})}),A&&(0,u.jsx)(v,{control:w,bubbles:!_.current,name:n,value:f,checked:M,required:p,disabled:x,form:y,style:{transform:"translateX(-100%)"}})]})});b.displayName=m;var y="SwitchThumb",g=s.forwardRef((e,t)=>{let{__scopeSwitch:a,...s}=e,r=f(y,a);return(0,u.jsx)(o.sG.span,{"data-state":j(r.checked),"data-disabled":r.disabled?"":void 0,...s,ref:t})});g.displayName=y;var v=s.forwardRef((e,t)=>{let{__scopeSwitch:a,control:r,checked:n,bubbles:i=!0,...o}=e,m=s.useRef(null),p=(0,l.s)(m,t),x=(0,c.Z)(n),h=(0,d.X)(r);return s.useEffect(()=>{let e=m.current;if(!e)return;let t=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(x!==n&&t){let a=new Event("click",{bubbles:i});t.call(e,n),e.dispatchEvent(a)}},[x,n,i]),(0,u.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...o,tabIndex:-1,ref:p,style:{...o.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function j(e){return e?"checked":"unchecked"}v.displayName="SwitchBubbleInput";var w=b,N=g},43720:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(48907).A)("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]])},46450:(e,t,a)=>{"use strict";a.d(t,{T:()=>n});var s=a(74817),r=a(27717),l=a(33359);let n=r.forwardRef((e,t)=>
1{let{className:a,...r}=e;return(0,s.jsx)("textarea",{className:(0,l.cn)("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",a),ref:t,...r})});n.displayName="Textarea"},47976:(e,t,a)=>{"use strict";a.d(t,{d:()=>i});var s=a(74817),r=a(27717),l=a(38857),n=a(33359);let i=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)(l.bL,{className:(0,n.cn)("peer relative inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent before:absolute before:-inset-y-2.5 before:-inset-x-1 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",a),...r,ref:t,children:(0,s.jsx)(l.zi,{className:(0,n.cn)("pointer-events-none block h-5 w-5 rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0 data-[state=checked]:bg-white data-[state=unchecked]:bg-background")})})});i.displayName=l.bL.displayName},50319:(e,t,a)=>{"use strict";a.d(t,{mK:()=>r});var s=!!("undefined"!=typeof window&&window.document&&window.document.createElement);function r(e,t,{checkForDefaultPrevented:a=!0}={}){return function(s){if(e?.(s),!1===a||!s.defaultPrevented)return t?.(s)}}},52552:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(48907).A)("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]])},53956:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>I});var s=a(74817),r=a(27717),l=a(1647),n=a(96634),i=a(43720),c=a(52552),d=a(50843),o=a(99653),u=a(3617),m=a(66260),p=a(83248),x=a(9465),h=a(13014),f=a(11536),b=a(34940),y=a(46450),g=a(81434),v=a(47976),j=a(38251),w=a(8008),N=a(21305);let k=["V6","V6_MINI","V6_WILD"];var _=a(94068),A=a.n(_),M=a(77539);function I(e){let{blueTheme:t=!1}=e,a=(0,l.c3)("AIMusic"),{user:_,showLoginDialog:I}=(0,x.A)(),[C,S]=(0,r.useState)("V6"),[R,L]=(0,r.useState)(!0),[z,P]=(0,r.useState)(!1),[T,F]=(0,r.useState)(!1),[E,q]=(0,r.useState)(""),[O,V]=(0,r.useState)(""),[D,H]=(0,r.useState)(""),[U,J]=(0,r.useState)(""),[B,W]=(0,r.useState)("any"),[G,$]=(0,r.useState)({weirdnessConstraint:.5,styleWeight:.5,audioWeight:.5}),[K,X]=(0,r.useState)([]),[Y,Q]=(0,r.useState)(null),Z=(0,r.useRef)(null),[ee,et]=(0,r.useState)(!1),[ea,es]=(0,r.useState)(""),[er,el]=(0,r.useState)(!1),en=(0,r.useRef)(!1),ei=(0,r.useRef)(null),ec=(0,r.useRef)(null==_?void 0:_.id);ec.current=null==_?void 0:_.id;let ed=(0,r.useCallback)(async()=>{let e=ec.current,t=await (0,h.f)();e===ec.current&&t.success&&t.data&&Q(t.data.totalAvailableCredits)},[]),eo=(0,r.useCallback)(async()=>{let e=ec.current;if(e)try{let t=await fetch("/api/music/records",{cache:"no-store"});if(!t.ok)throw Error();let a=await t.json();e===ec.current&&(X(e=>e.map(e=>a.records.find(t=>t.id===e.id)||e)),el(!1))}catch(t){e===ec.current&&el(!0)}},[]);async function eu(e){var t;if(e.preventDefault(),!_)return void I();if(en.current||R&&!O.trim()||R&&T&&!D.trim())return;es("");let a={model:C,customMode:R,instrumental:T,prompt:E,style:D.trim()||void 0,...R?{title:O,negativeTags:U,vocalGender:T||"any"===B?void 0:B,...G}:{}};en.current=!0,et(!0),null==(t=ei.current)||t.pause(),X([]),el(!1);try{let e=await fetch("/api/music/kie/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),t=await e.json();
1if(!e.ok){es(["unauthorized","invalidInput","promptRequired","titleRequired","styleRequired","insufficientCredits","unavailable","generationFailed"].includes(t.error)?t.error:"requestFailed"),401===e.status&&I();return}Z.current={model:C,customMode:R,instrumental:T,prompt:E,title:O,style:D,negativeTags:U,vocalGender:B,weights:{...G}},q(""),V(""),H(""),J(""),X([{id:t.recordId,task_id:t.taskId||null,model:C,status:t.status,billing_status:"pending",failed_reason:null,created_at:new Date().toISOString(),music_data:[]}])}catch(e){es("uncertain")}finally{en.current=!1,et(!1)}}function em(){let e=Z.current;e&&(S(e.model),L(e.customMode),F(e.instrumental),q(e.prompt),V(e.title),H(e.style),J(e.negativeTags),W(e.vocalGender),$({...e.weights}),es(""))}(0,r.useEffect)(()=>{X([]),Q(null),Z.current=null,el(!1),(null==_?void 0:_.id)&&ed()},[null==_?void 0:_.id,ed]),(0,r.useEffect)(()=>{let e;if(!(null==_?void 0:_.id)||!K.some(e=>!["completed","failed"].includes(e.status)))return;let t=!1,a=async()=>{let s=K.filter(e=>!["completed","failed"].includes(e.status));try{s.some(e=>!e.task_id)&&await eo();let e=await Promise.all(s.filter(e=>e.task_id).map(async e=>{let t=await fetch("/api/music/task-status?taskId=".concat(encodeURIComponent(e.task_id)),{cache:"no-store"});if(!t.ok)throw Error();return(await t.json()).record}));!t&&(e.length&&X(t=>t.map(t=>e.find(e=>e.id===t.id)||t)),e.length&&el(!1),e.some(e=>"completed"===e.status)&&ed())}catch(e){t||el(!0)}t||(e=setTimeout(a,1e4))};return e=setTimeout(a,1e4),()=>{t=!0,clearTimeout(e)}},[K,null==_?void 0:_.id,ed,er,eo]);let ep=R?5e3:3e3,ex=R&&T;function eh(e){ei.current&&ei.current!==e&&ei.current.pause(),ei.current=e}return(0,s.jsxs)("div",{className:"".concat(A().generator," ").concat(t?A().blue:""),children:[(0,s.jsxs)("form",{onSubmit:eu,className:"".concat(A().form," space-y-4"),children:[(0,s.jsxs)("div",{className:"mb-5 flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,s.jsx)("div",{className:A().tabs,role:"group","aria-label":a("mode"),children:[!0,!1].map(e=>(0,s.jsx)(f.$,{type:"button",variant:"ghost","aria-pressed":R===e,className:A().tab,onClick:()=>L(e),children:a(e?"custom":"simple")},String(e)))}),(0,s.jsxs)(w.l6,{value:C,onValueChange:S,children:[(0,s.jsx)(w.bq,{className:"".concat(A().model," w-full sm:w-36 sm:shrink-0"),"aria-label":a("model"),children:(0,s.jsx)(w.yv,{})}),(0,s.jsx)(w.gC,{children:k.map(e=>(0,s.jsx)(w.eb,{value:e,children:a("models.".concat(e))},e))})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,s.jsx)(g.J,{htmlFor:"music-prompt",className:A().label,children:a(R?"lyrics":"prompt")}),(0,s.jsx)(f.$,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 rounded-full ".concat(A().muted),"aria-label":a("clearPrompt"),title:a("clearPrompt"),disabled:ex,onClick:()=>q(""),children:(0,s.jsx)(n.A,{className:"h-4 w-4"})})]}),(0,s.jsxs)("div",{className:A().promptBox,children:[!ex&&(0,s.jsx)(y.T,{id:"music-prompt",value:E,onChange:e=>q(e.target.value),maxLength:ep,placeholder:a(R?"lyricsPlaceholder":"promptPlaceholder"),className:A().prompt}),(0,s.jsxs)("div",{className:"".concat(A().promptFooter," ").concat(ex?"":A().promptFooterOverlay),children:[(0,s.jsxs)("label",{className:A().instrumental,title:a("instrumentalHint"),children:[(0,s.jsx)(v.d,{id:"music-instrumental",checked:T,onCheckedChange:F,className:"h-5 w-10 border-0 data-[state=checked]:bg-[#1ed760] data-[state=unchecked]:bg-zinc-400 dark:data-[state=unchecked]:bg-zinc-700 [&>span]:h-4 [&>span]:w-4 data-[state=checked]:[&>span]:bg-[#052e1f] data-[state=unchecked]:[&>span]:bg-zinc-200"}),a("instrumental")]}),!ex&&(0,s.jsxs)("span",{className:"text-xs ".concat(A().muted),children:[E.length,"/",ep]})]})]})]}),R&&(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(g.J,{htmlFor:"music-title",className:A().label,children:a("title")}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(b.p,{id:"music-title",value:O,maxLength:80,onChange:e=>V(e.target.value),placeholder:a("titlePlaceholder"),className:"".concat(A().field," h-11 pr-16")}),(0,s.jsxs)("span",{className:"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-xs ".concat(A().muted),children:[O.length,"/80"]})]})]})}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(g.J,{htmlFor:"music-style",className:A().label,children:a(R&&T?"styleRequiredLabel":"style")}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(y.T,{id:"music-style",required:R&&T,value:D,maxLength:1e3,onChange:e=>H(e.target.value),placeholder:a("stylePlaceholder"),className:"".concat(A().field," min-h-[86px] resize-y pb-7")}),(0,s.jsxs)("span",{className:"pointer-events-none absolute bottom-2 right-3 text-xs ".concat(A().muted),children:[D.length,"/1000"]})]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2 pt-1",children:["folk","pop","jazz","ambient"].map(e=>(0,s.jsxs)(f.$,{type:"button",size:"sm",variant:"secondary",className:A().preset,onClick:()=>H(a("presets.".concat(e))),children:[(0,s.jsx)(i.A,{className:"h-3.5 w-3.5"}),a("presets.".concat(e))]},e))})]}),R&&(0,s.jsxs)(s.Fragment,{children:[!T&&(0,s.jsxs)("fieldset",{className:A().voice,children:[(0,s.jsx)("legend",{className:"sr-only",children:a("vocalGender")}),(0,s.jsx)("span",{className:"text-sm font-semibold",title:a("voiceHint"),children:a("vocalGender")}),(0,s.jsx)("div",{className:"flex flex-wrap gap-3",children:[{value:"any",label:"anyVoice"},{value:"m",label:"male"},{value:"f",label:"female"}].map(e=>(0,s.jsxs)("label",{className:A().voiceOption,children:[(0,s.jsx)("input",{type:"radio",name:"music-voice",value:e.value,checked:B===e.value,onChange:()=>W(e.value)}),a(e.label)]},e.value))})]}),(0,s.jsxs)("div",{className:A().advanced,children:[(0,s.jsxs)(f.$,{type:"button",variant:"ghost","aria-expanded":z,"aria-controls":"music-advanced",onClick:()=>P(e=>!e),className:"h-auto w-full justify-between px-2 py-2 text-base font-semibold",children:[(0,s.jsxs)("span",{className:"flex items-center gap-2",children:[(0,s.jsx)(c.A,{className:"h-5 w-5 ".concat(A().muted)}),a("advanced")]}),(0,s.jsx)(d.A,{className:"h-4 w-4 transition-transform ".concat(z?"rotate-180":"")})]}),(0,s.jsxs)("div",{id:"music-advanced",hidden:!z,className:"space-y-3 pt-4",children:[(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(g.J,{htmlFor:"music-negative",className:"sr-only",children:a("negativeTags")}),(0,s.jsx)(i.A,{className:"pointer-events-none absolute left-5 top-1/2 h-5 w-5 -translate-y-1/2 ".concat(A().muted)}),(0,s.jsx)(b.p,{id:"music-negative",value:U,maxLength:1e3,onChange:e=>J(e.target.value),placeholder:a("negativePlaceholder"),className:"".concat(A().field," h-16 pl-14 text-base")})]}),Object.keys(G).map(e=>(0,s.jsxs)("div",{className:A().sliderRow,children:[(0,s.jsx)(g.J,{htmlFor:"music-".concat(e),className:"col-span-2 font-semibold sm:col-span-1",children:a(e)}),(0,s.jsxs)("div",{className:"relative h-8 min-w-0",children:[(0,s.jsx)("div",{className:A().ticks,"aria-hidden":"true",children:Array.from({length:9},(e,t)=>(0,s.jsx)("span",{},t))}),(0,s.jsx)(j.A,{id:"music-".concat(e),"aria-label":a(e),min:0,max:100,step:1,value:[Math.round(100*G[e])],onValueChange:t=>{let[a]=t;return $(t=>({...t,[e]:a/100}))},className:"absolute inset-0",trackClassName:"h-0 bg-transparent dark:bg-transparent",rangeClassName:"bg-transparent",thumbClassName:"h-7 w-2 rounded-full border-0 bg-[#1ed760] shadow-none focus-visible:ring-emerald-500"})]}),(0,s.jsxs)("span",{className:"text-right font-semibold tabular-nums",children:[Math.round(100*G[e]),"%"]})]},e)),(0,s.jsx)("p",{className:"px-1 text-xs ".concat(A().muted),children:a("weightsHint")})]})]})]}),ea&&(0,s.jsx)("p",{role:"alert",className:"text-sm text-rose-600 dar
1k:text-rose-400",children:a("errors.".concat(ea))}),(0,s.jsxs)("div",{className:"space-y-2 pt-1",children:[(0,s.jsxs)(f.$,{type:"submit",disabled:ee||R&&!O.trim()||R&&T&&!D.trim(),className:"".concat(A().primary," h-12 w-full rounded-full text-base font-semibold shadow-none"),children:[ee?(0,s.jsx)(o.A,{className:"animate-spin"}):(0,s.jsx)(u.A,{}),a(ee?"submitting":_?"generate":"signIn")]}),(0,s.jsxs)("p",{className:"text-center text-xs ".concat(A().muted),children:[a("price",{credits:5}),null!==Y&&(0,s.jsxs)("span",{children:[" \xb7 ",a("balance",{credits:Y})]})]})]})]}),(0,s.jsxs)("section",{className:A().results,"aria-label":a("results"),children:[(K.length>0||er)&&(0,s.jsx)("div",{className:"mb-6",children:(0,s.jsx)("h2",{className:"text-lg font-semibold",children:a("results")})}),er&&(0,s.jsx)("p",{role:"alert",className:"mb-4 text-sm text-amber-700 dark:text-amber-400",children:a("errors.connection")}),ee&&0===K.length?(0,s.jsxs)("div",{role:"status",className:"flex min-h-[500px] flex-col items-center justify-center gap-4 ".concat(A().muted),children:[(0,s.jsx)(o.A,{className:"h-10 w-10 animate-spin text-emerald-500"}),a("submitting")]}):0===K.length?(0,s.jsxs)("div",{className:"flex min-h-[500px] flex-col items-center justify-center px-3 py-6 text-center",children:[(0,s.jsx)("div",{className:"".concat(A().record," mb-7"),"aria-hidden":"true",children:(0,s.jsx)("div",{className:A().recordCenter,children:(0,s.jsx)(m.A,{className:"h-16 w-16"})})}),(0,s.jsx)("h2",{className:"text-2xl font-bold",children:a("emptyTitle")}),(0,s.jsx)("p",{className:"mt-3 max-w-sm text-sm ".concat(A().muted),children:a("emptyHint")})]}):(0,s.jsx)("div",{className:"mx-auto max-h-[1000px] max-w-2xl space-y-6 overflow-y-auto pr-1",children:K.map(e=>(0,s.jsxs)("article",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:["completed"===e.status&&(0,s.jsx)("span",{className:"text-xs font-medium ".concat(A().muted),children:a("resultModel",{model:a("models.".concat(e.model))})}),"completed"!==e.status&&(e.music_data.length>0||"failed"===e.status)&&(0,s.jsx)(N.h,{tone:"failed"===e.status?"rose":"amber",children:a("statuses.".concat(e.status))})]}),"failed"===e.status&&e.failed_reason&&(0,s.jsx)("p",{role:"alert",className:"whitespace-pre-wrap break-words text-sm text-rose-600 dar
1k:text-rose-400",children:e.failed_reason}),"insufficient"===e.billing_status&&(0,s.jsx)("p",{className:"text-xs text-amber-700 dark:text-amber-400",children:a("settlementPending")}),0===e.music_data.length&&!["completed","failed"].includes(e.status)&&(0,s.jsxs)("div",{role:"status",className:"flex min-h-48 flex-col items-center justify-center gap-4 text-center",children:[(0,s.jsx)(o.A,{className:"h-10 w-10 animate-spin text-emerald-500","aria-hidden":"true"}),(0,s.jsx)("p",{className:"text-sm ".concat(A().muted),children:a("statuses.".concat(e.status))})]}),e.music_data.map(t=>(0,s.jsx)(M.B,{track:t,recordId:e.id,onPlay:eh},t.id)),"completed"===e.status&&Z.current&&(0,s.jsx)("div",{className:"flex justify-center pt-3",children:(0,s.jsxs)(f.$,{type:"button",variant:"secondary",size:"sm",className:A().action,onClick:em,children:[(0,s.jsx)(p.A,{}),a("regenerate")]})})]},e.id))})]})]})}},66260:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(48907).A)("Disc3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M6 12c0-1.7.7-3.2 1.8-4.2",key:"oqkarx"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M18 12c0 1.7-.7 3.2-1.8 4.2",key:"1eah9h"}]])},77539:(e,t,a)=>{"use strict";a.d(t,{B:()=>h});var s=a(74817),r=a(27717),l=a(79124),n=a(1647),i=a(34595),c=a(83129),d=a(73019),o=a(99653),u=a(20957),m=a(11536),p=a(94068),x=a.n(p);function h(e){let{track:t,recordId:a,onPlay:p}=e,h=(0,n.c3)("AIMusic"),f=(0,r.useRef)(null),[b,y]=(0,r.useState)(!1),[g,v]=(0,r.useState)(!1),[j,w]=(0,r.useState)(!1),[N,k]=(0,r.useState)(!1);async function _(){if(!j){w(!0),k(!1);try{var e;let s=await fetch("/api/music/download?recordId=".concat(a,"&trackId=").concat(encodeURIComponent(t.id)));if(!s.ok)throw Error("Download failed");let r=await s.blob(),l=URL.createObjectURL(r),n=document.createElement("a");n.href=l,n.download="".concat(t.title||"music",".").concat((null==(e=t.audio_url.split(".").pop())?void 0:e.split("?")[0])||"mp3"),document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(l),6e4)}catch(e){k(!0)}finally{w(!1)}}}async function A(){let e=f.current;if(e){if(!e.paused)return void e.pause();v(!1);try{p(e),await e.play()}catch(e){v(!0)}}}return(0,s.jsxs)("div",{className:x().track,children:[(0,s.jsxs)("div",{className:"grid grid-cols-[64px_minmax(0,1fr)] gap-3 sm:grid-cols-[82px_minmax(0,1fr)]",children:[(0,s.jsx)("div",{className:"aspect-square overflow-hidden rounded-lg bg-zinc-200 dark:bg-zinc-800",children:t.image_url?(0,s.jsx)(l.default,{unoptimized:!0,width:82,height:82,src:t.image_url,alt:h("coverAlt",{title:t.title||h("untitled")}),className:"h-full w-full object-cover",loading:"lazy"}):(0,s.jsx)("div",{className:"flex h-full items-center justify-center",children:(0,s.jsx)(i.A,{className:"h-7 w-7 text-muted-foreground"})})}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsx)("h3",{className:"truncate text-sm font-semibold",children:t.title||h("untitled")}),(0,s.jsx)("p",{className:"mt-1 truncate text-xs text-muted-foreground",children:t.tags})]}),null!==t.duration&&(0,s.jsxs)("span",{className:"rounded-full bg-muted text-muted-foreground shrink-0 px-2 py-1 text-xs tabular-nums",children:[Math.floor(t.duration/60),":",String(Math.floor(t.duration%60)).padStart(2,"0")]})]}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2",children:[(0,s.jsxs)(m.$,{type:"button",variant:"secondary",size:"sm",className:x().action,onClick:()=>void A(),children:[b?(0,s.jsx)(c.A,{}):(0,s.jsx)(d.A,{}),h(b?"pause":"play")]}),(0,s.jsxs)(m.$,{type:"button",variant:"secondary",size:"sm",className:x().action,disabled:j,"aria-busy":j,onClick:()=>void _(),children:[j?(0,s.jsx)(o.A,{className:"animate-spin"}):(0,s.jsx)(u.A,{}),h(j?"downloading":"download")]})]})]})]}),(0,s.jsx)("audio",{ref:f,preload:"none",src:t.audio_url,onPlay:()=>y(!0),onPause:()=>y(!1),onEnded:()=>y(!1),onError:()=>{y(!1),v(!0)}}),g&&(0,s.jsx)("p",{role:"alert",className:"mt-3 text-xs text-rose-600 dar
1k:text-rose-400",children:h("errors.playbackFailed")}),N&&(0,s.jsx)("p",{role:"alert",className:"mt-3 text-xs text-rose-600 dark:text-rose-400",children:h("errors.downloadFailed")})]})}},79124:(e,t,a)=>{"use strict";a.d(t,{default:()=>r.a});var s=a(7755),r=a.n(s)},81434:(e,t,a)=>{"use strict";a.d(t,{J:()=>d});var s=a(74817),r=a(27717),l=a(89393),n=a(39172),i=a(33359);let c=(0,n.F)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)(l.b,{ref:t,className:(0,i.cn)(c(),a),...r})});d.displayName=l.b.displayName},83129:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(48907).A)("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]])},83248:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(48907).A)("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]])},89393:(e,t,a)=>{"use strict";a.d(t,{b:()=>i});var s=a(27717),r=a(74212),l=a(74817),n=s.forwardRef((e,t)=>(0,l.jsx)(r.sG.label,{...e,ref:t,onMouseDown:t=>{var a;t.target.closest("button, input, select, textarea")||(null==(a=e.onMouseDown)||a.call(e,t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));n.displayName="Label";var i=n},94068:e=>{e.exports={generator:"AIMusic_generator__79N6L",form:"AIMusic_form__d_QrH",results:"AIMusic_results__Yeqhu",tabs:"AIMusic_tabs__BJT72",tab:"AIMusic_tab__Hh0CT",primary:"AIMusic_primary__io7mE",field:"AIMusic_field__wWKFt",model:"AIMusic_model__nAaKW",preset:"AIMusic_preset___DNLu",track:"AIMusic_track__A1nxp",voice:"AIMusic_voice__ViEV5",advanced:"AIMusic_advanced__EEe5b",label:"AIMusic_label__nBTDU",muted:"AIMusic_muted__yzW3T",promptBox:"AIMusic_promptBox__ipSi_",prompt:"AIMusic_prompt__n64tY",promptFooter:"AIMusic_promptFooter__XhncV",promptFooterOverlay:"AIMusic_promptFooterOverlay__Off9L",instrumental:"AIMusic_instrumental__bv6Jv",action:"AIMusic_action__hDMbc",voiceOption:"AIMusic_voiceOption__jD_BU",sliderRow:"AIMusic_sliderRow__fralu",ticks:"AIMusic_ticks__dGFUH",record:"AIMusic_record__dWHLD",recordCenter:"AIMusic_recordCenter__hsPJL",duration:"AIMusic_duration__WaW2K",blue:"AIMusic_blue__nXI2B"}},96634:(e,t,a)=>{"use strict";a.d(t,{A:()=>s});let s=(0,a(48907).A)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])}}]); 2//# chunkId=01a0ecc4-ccd0-77d2-84a5-9190f675abb9
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.